mirror of
https://github.com/codeflash-ai/codeflash-agent.git
synced 2026-05-04 18:25:19 +00:00
Fix all ruff lint errors in codeflash-core
- Replace commented-out code pattern with descriptive comment in __init__.py - Move ModuleType into TYPE_CHECKING block in _git.py - Add noqa: F821 for PEP 562 lazy-loaded git module references - Restore noqa: PLC0415 on reformatted sentry imports in _telemetry.py
This commit is contained in:
parent
fdfade528f
commit
2d9fca6b3e
3 changed files with 11 additions and 7 deletions
|
|
@ -34,7 +34,7 @@ if TYPE_CHECKING:
|
|||
from ._state import LanguageState
|
||||
|
||||
_SUBMODULE_ATTRS: dict[str, tuple[str, str]] = {
|
||||
# (_submodule, _name)
|
||||
# Maps public name to its private submodule and attribute.
|
||||
"REQUIRED_CAPABILITIES": ("._capabilities", "REQUIRED_CAPABILITIES"),
|
||||
"CompareResultsFn": ("._capabilities", "CompareResultsFn"),
|
||||
"DiscoverFn": ("._capabilities", "DiscoverFn"),
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ import logging
|
|||
import sys
|
||||
import time
|
||||
from functools import cache
|
||||
from types import ModuleType
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
from types import ModuleType
|
||||
|
||||
import git as git_types
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ def get_remote_url(
|
|||
git_remote: str = "origin",
|
||||
) -> str:
|
||||
"""Return the URL of the given git remote."""
|
||||
repository: git_types.Repo = repo or git.Repo(
|
||||
repository: git_types.Repo = repo or git.Repo( # noqa: F821
|
||||
search_parent_directories=True,
|
||||
)
|
||||
return repository.remote(name=git_remote).url
|
||||
|
|
@ -64,11 +64,11 @@ def get_repo_owner_and_name(
|
|||
def check_running_in_git_repo(module_root: str) -> bool:
|
||||
"""Return *True* if *module_root* is inside a git repository."""
|
||||
try:
|
||||
_ = git.Repo(
|
||||
_ = git.Repo( # noqa: F821
|
||||
module_root,
|
||||
search_parent_directories=True,
|
||||
).git_dir
|
||||
except git.InvalidGitRepositoryError:
|
||||
except git.InvalidGitRepositoryError: # noqa: F821
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -55,8 +55,12 @@ def ph(event: str, properties: dict[str, Any] | None = None) -> None:
|
|||
def _init_sentry(*, exclude_errors: bool = False) -> None:
|
||||
"""Configure and initialize the Sentry SDK."""
|
||||
import sentry_sdk # noqa: PLC0415
|
||||
from sentry_sdk.integrations.logging import LoggingIntegration # noqa: PLC0415
|
||||
from sentry_sdk.integrations.stdlib import StdlibIntegration # noqa: PLC0415
|
||||
from sentry_sdk.integrations.logging import ( # noqa: PLC0415
|
||||
LoggingIntegration,
|
||||
)
|
||||
from sentry_sdk.integrations.stdlib import ( # noqa: PLC0415
|
||||
StdlibIntegration,
|
||||
)
|
||||
|
||||
sentry_logging = LoggingIntegration(
|
||||
level=logging.INFO,
|
||||
|
|
|
|||
Loading…
Reference in a new issue