Skip to content

Commit fad05dc

Browse files
authored
Merge pull request #91 from opsmill/pog-ctl-importer
Fix typehints and remove type ignores for ctl.importer & ctl.exporter
2 parents 7040f72 + d2599ec commit fad05dc

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

infrahub_sdk/ctl/exporter.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from .parameters import CONFIG_PARAM
1313

1414

15-
def directory_name_with_timestamp():
15+
def directory_name_with_timestamp() -> str:
1616
right_now = datetime.now(timezone.utc).astimezone()
1717
timestamp = right_now.strftime("%Y%m%d-%H%M%S")
1818
return f"infrahubexport-{timestamp}"
@@ -38,9 +38,10 @@ def dump(
3838
"""Export nodes and their relationships out of the database."""
3939
console = Console()
4040

41-
client = aiorun(
42-
initialize_client(branch=branch, timeout=timeout, max_concurrent_execution=concurrent, retry_on_failure=True)
41+
client = initialize_client(
42+
branch=branch, timeout=timeout, max_concurrent_execution=concurrent, retry_on_failure=True
4343
)
44+
4445
exporter = LineDelimitedJSONExporter(client, console=Console() if not quiet else None)
4546
try:
4647
aiorun(exporter.export(export_directory=directory, namespaces=namespace, branch=branch, exclude=exclude))

infrahub_sdk/ctl/importer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .parameters import CONFIG_PARAM
1212

1313

14-
def local_directory():
14+
def local_directory() -> Path:
1515
# We use a function here to avoid failure when generating the documentation due to directory name
1616
return Path().resolve()
1717

@@ -34,9 +34,10 @@ def load(
3434
"""Import nodes and their relationships into the database."""
3535
console = Console()
3636

37-
client = aiorun(
38-
initialize_client(branch=branch, timeout=timeout, max_concurrent_execution=concurrent, retry_on_failure=True)
37+
client = initialize_client(
38+
branch=branch, timeout=timeout, max_concurrent_execution=concurrent, retry_on_failure=True
3939
)
40+
4041
importer = LineDelimitedJSONImporter(
4142
client,
4243
InfrahubSchemaTopologicalSorter(),

pyproject.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,10 @@ ignore_errors = true
159159
module = "infrahub_sdk.ctl.cli_commands"
160160
ignore_errors = true
161161

162-
[[tool.mypy.overrides]]
163-
module = "infrahub_sdk.ctl.exporter"
164-
ignore_errors = true
165-
166162
[[tool.mypy.overrides]]
167163
module = "infrahub_sdk.ctl.generator"
168164
ignore_errors = true
169165

170-
[[tool.mypy.overrides]]
171-
module = "infrahub_sdk.ctl.importer"
172-
ignore_errors = true
173-
174166
[[tool.mypy.overrides]]
175167
module = "infrahub_sdk.ctl.schema"
176168
ignore_errors = true

0 commit comments

Comments
 (0)