Skip to content

Commit f493f0e

Browse files
committed
Fix linting issues
1 parent 7040f72 commit f493f0e

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

infrahub_sdk/schema.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,4 @@ class SchemaLoadResponse(BaseModel):
983983

984984
@property
985985
def schema_updated(self) -> bool:
986-
if self.hash and self.previous_hash and self.hash != self.previous_hash:
987-
return True
988-
return False
986+
return bool(self.hash and self.previous_hash and self.hash != self.previous_hash)

infrahub_sdk/transfer/importer/json.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .interface import ImporterInterface
1818

1919
if TYPE_CHECKING:
20-
from .schema import NodeSchema, RelationshipSchema
20+
from ...schema import NodeSchema, RelationshipSchema
2121

2222

2323
class LineDelimitedJSONImporter(ImporterInterface):
@@ -163,7 +163,7 @@ async def execute_batches(
163163
self, batches: list[InfrahubBatch], progress_bar_message: str = "Executing batches"
164164
) -> Sequence[Any]:
165165
if self.console:
166-
task_count = sum((batch.num_tasks for batch in batches))
166+
task_count = sum(batch.num_tasks for batch in batches)
167167
progress = Progress()
168168
progress.start()
169169
progress_task = progress.add_task(f"{progress_bar_message}...", total=task_count)

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ ignore = [
245245
"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
246246
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
247247
"C408", # Unnecessary `dict` call (rewrite as a literal)
248-
"C414", # Unnecessary `list` call within `sorted()`
249248
"FURB110", # Replace ternary `if` expression with `or` operator
250249
"FURB113", # Use `lines.extend((" " * self.indentation + "}", "}"))` instead of repeatedly calling `lines.append()`
251250
"FURB177", # Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups
@@ -267,12 +266,10 @@ ignore = [
267266
"PTH109", # `os.getcwd()` should be replaced by `Path.cwd()`
268267
"RET504", # Unnecessary assignment to `data` before `return` statement
269268
"RUF", # Unused `noqa` directive
270-
"S105", # Possible hardcoded password assigned to: "PASS"
271269
"S108", # Probable insecure usage of temporary file or directory
272270
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
273271
"S701", # By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True`
274272
"SIM102", # Use a single `if` statement instead of nested `if` statements
275-
"SIM103", # Return the condition directly
276273
"SIM105", # Use `contextlib.suppress(KeyError)` instead of `try`-`except`-`pass`
277274
"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
278275
"SIM110", # Use `return any(getattr(item, resource_field) == resource_id for item in getattr(self, RESOURCE_MAP[resource_type]))` instead of `for` loop
@@ -282,7 +279,6 @@ ignore = [
282279
"SIM910", # Use `data.get(key)` instead of `data.get(key, None)`
283280
"UP007", # Use X | Y for type annotations
284281
"UP031", # Use format specifiers instead of percent format
285-
"UP034", # Avoid extraneous parentheses
286282
]
287283

288284

@@ -322,10 +318,15 @@ max-complexity = 17
322318
"PLR0904", # Too many public methods
323319
]
324320

321+
"infrahub_sdk/pytest_plugin/models.py" = [
322+
"S105", # 'PASS' is not a password but a state
323+
]
324+
325+
325326
"tests/**/*.py" = [
326327
"PLR2004", # Magic value used in comparison
327328
"S101", # Use of assert detected
328-
"S106", # Possible hardcoded password assigned to variable
329+
"S105", # Possible hardcoded password assigned to variable
329330
"S106", # Possible hardcoded password assigned to argument
330331

331332
##################################################################################################

tests/integration/test_object_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TestObjectStore(TestInfrahubApp):
1111
async def test_upload_and_get(self, client: InfrahubClient):
1212
response = await client.object_store.upload(content=FILE_CONTENT_01)
1313

14-
assert sorted(list(response.keys())) == ["checksum", "identifier"]
14+
assert sorted(response.keys()) == ["checksum", "identifier"]
1515
assert response["checksum"] == "aa19b96860ec59a73906dd8660bb3bad"
1616
assert response["identifier"]
1717

0 commit comments

Comments
 (0)