Skip to content

Fix linting issues #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions infrahub_sdk/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,4 @@ class SchemaLoadResponse(BaseModel):

@property
def schema_updated(self) -> bool:
if self.hash and self.previous_hash and self.hash != self.previous_hash:
return True
return False
return bool(self.hash and self.previous_hash and self.hash != self.previous_hash)
4 changes: 2 additions & 2 deletions infrahub_sdk/transfer/importer/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .interface import ImporterInterface

if TYPE_CHECKING:
from .schema import NodeSchema, RelationshipSchema
from ...schema import NodeSchema, RelationshipSchema


class LineDelimitedJSONImporter(ImporterInterface):
Expand Down Expand Up @@ -163,7 +163,7 @@ async def execute_batches(
self, batches: list[InfrahubBatch], progress_bar_message: str = "Executing batches"
) -> Sequence[Any]:
if self.console:
task_count = sum((batch.num_tasks for batch in batches))
task_count = sum(batch.num_tasks for batch in batches)
progress = Progress()
progress.start()
progress_task = progress.add_task(f"{progress_bar_message}...", total=task_count)
Expand Down
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ ignore = [
"B008", # Do not perform function call `typer.Option` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
"C408", # Unnecessary `dict` call (rewrite as a literal)
"C414", # Unnecessary `list` call within `sorted()`
"FURB110", # Replace ternary `if` expression with `or` operator
"FURB113", # Use `lines.extend((" " * self.indentation + "}", "}"))` instead of repeatedly calling `lines.append()`
"FURB177", # Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups
Expand All @@ -267,12 +266,10 @@ ignore = [
"PTH109", # `os.getcwd()` should be replaced by `Path.cwd()`
"RET504", # Unnecessary assignment to `data` before `return` statement
"RUF", # Unused `noqa` directive
"S105", # Possible hardcoded password assigned to: "PASS"
"S108", # Probable insecure usage of temporary file or directory
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"S701", # By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True`
"SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM103", # Return the condition directly
"SIM105", # Use `contextlib.suppress(KeyError)` instead of `try`-`except`-`pass`
"SIM108", # Use ternary operator `key_str = f"{value[ALIAS_KEY]}: {key}" if ALIAS_KEY in value and value[ALIAS_KEY] else key` instead of `if`-`else`-block
"SIM110", # Use `return any(getattr(item, resource_field) == resource_id for item in getattr(self, RESOURCE_MAP[resource_type]))` instead of `for` loop
Expand All @@ -282,7 +279,6 @@ ignore = [
"SIM910", # Use `data.get(key)` instead of `data.get(key, None)`
"UP007", # Use X | Y for type annotations
"UP031", # Use format specifiers instead of percent format
"UP034", # Avoid extraneous parentheses
]


Expand Down Expand Up @@ -322,10 +318,15 @@ max-complexity = 17
"PLR0904", # Too many public methods
]

"infrahub_sdk/pytest_plugin/models.py" = [
"S105", # 'PASS' is not a password but a state
]


"tests/**/*.py" = [
"PLR2004", # Magic value used in comparison
"S101", # Use of assert detected
"S106", # Possible hardcoded password assigned to variable
"S105", # Possible hardcoded password assigned to variable
"S106", # Possible hardcoded password assigned to argument

##################################################################################################
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TestObjectStore(TestInfrahubApp):
async def test_upload_and_get(self, client: InfrahubClient):
response = await client.object_store.upload(content=FILE_CONTENT_01)

assert sorted(list(response.keys())) == ["checksum", "identifier"]
assert sorted(response.keys()) == ["checksum", "identifier"]
assert response["checksum"] == "aa19b96860ec59a73906dd8660bb3bad"
assert response["identifier"]

Expand Down