- Fixed import sorting in cli.py, __main__.py, detectors/__init__.py, base.py, python.py, rust.py, openapi.py, models/__init__.py - Removed unused imports (sys, asyncio, Observer, Text, Parameter, ParameterIn, HTTPMethod, DocConfig, List, Optional) - Removed trailing whitespace from blank lines - Split lines exceeding 100 characters - Added missing __init__ docstrings in generators and static/templates packages
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
"""Base detector abstract class."""
|
{"""Base detector abstract class."""
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, Optional
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from docgen.models import Endpoint
|
from docgen.models import Endpoint
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import List
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BaseDetector(ABC):
|
class BaseDetector(ABC):
|
||||||
@@ -28,12 +29,12 @@ class BaseDetector(ABC):
|
|||||||
"""Scan a directory for endpoints."""
|
"""Scan a directory for endpoints."""
|
||||||
endpoints = []
|
endpoints = []
|
||||||
pattern = "**/*" if recursive else "*"
|
pattern = "**/*" if recursive else "*"
|
||||||
|
|
||||||
for file_path in directory.glob(pattern):
|
for file_path in directory.glob(pattern):
|
||||||
if file_path.is_file() and self.can_detect(file_path):
|
if file_path.is_file() and self.can_detect(file_path):
|
||||||
try:
|
try:
|
||||||
endpoints.extend(self.detect_endpoints(file_path))
|
endpoints.extend(self.detect_endpoints(file_path))
|
||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return endpoints
|
return endpoints
|
||||||
|
|||||||
Reference in New Issue
Block a user