Skip to content

Commit

Permalink
Add ruff rules
Browse files Browse the repository at this point in the history
  • Loading branch information
yugokato committed Feb 27, 2025
1 parent 8b4ca4c commit 2d9bc48
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
17 changes: 16 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,25 @@ indent-width = 4
select = [
"E", # pycodestyle
"F", # Pyflakes
"FA", # flake8-future-annotations
"I", # isort
"PIE", # flake8-pie
"PLC", # Pylint convention
"PLE", # Pylint error
"PLW", # Pylint warning
"RUF", # Ruff-specific rules
"T20", # flake8-print
"UP", # pyupgrade
"W", # pycodestyle warning
]
ignore = [
"E731",
"E741",
"F403",
"PIE790",
"PLC0206",
"PLW2901",
]
ignore = ["E731", "E741", "F403"]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
18 changes: 9 additions & 9 deletions src/k8s_connector/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def __init__(
self,
service_account_file_path: Path | str,
cluster_name: str,
region: str = None,
zone: str = None,
region: str | None = None,
zone: str | None = None,
app_label_selector_key: str = "app",
run: bool = True,
timeout: int = 60,
Expand Down Expand Up @@ -220,7 +220,7 @@ def get_pod_details(self, pod_name: str, parse: bool = False, **kwargs) -> str |
return output

@requires_container
def describe_pods(self, pod_name: str = None, **kwargs) -> str:
def describe_pods(self, pod_name: str | None = None, **kwargs) -> str:
"""Get output of 'kubectl describe pods' command for the current app
:param pod_name: Pod name
Expand All @@ -240,20 +240,20 @@ def describe_pods(self, pod_name: str = None, **kwargs) -> str:
@requires_container
def get_logs(
self,
pod: str = None,
container: str = None,
pod: str | None = None,
container: str | None = None,
follow: bool = False,
limit_bytes: int = None,
limit_bytes: int | None = None,
previous: bool = False,
since: str = "30s",
since_time: str = None,
since_time: str | None = None,
tail: int = -1,
timestamps: bool = False,
remove_color: bool = True,
raw: bool = False,
filters: dict[str, Any] = None,
filters: dict[str, Any] | None = None,
**kwargs,
) -> str:
) -> str | None:
"""Get output of 'kubectl logs' command for the current app, or stream logs.
NOTE: since_time value will be parsed with dateparser library to support various format.
Expand Down

0 comments on commit 2d9bc48

Please sign in to comment.