From 3a294254ad1bce8de53fc329568c38d0b7f6e0f5 Mon Sep 17 00:00:00 2001 From: bilalabbad Date: Wed, 11 Dec 2024 17:25:29 +0100 Subject: [PATCH] fix poetry lock + lint --- backend/infrahub/graphql/mutations/branch.py | 1 + .../integration/git/test_git_repository.py | 1 - poetry.lock | 2 +- tasks/shared.py | 24 ++++++++++++++++++- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/backend/infrahub/graphql/mutations/branch.py b/backend/infrahub/graphql/mutations/branch.py index e3e57cc2e4..3a82f8ed57 100644 --- a/backend/infrahub/graphql/mutations/branch.py +++ b/backend/infrahub/graphql/mutations/branch.py @@ -83,6 +83,7 @@ async def mutate( fields = await extract_fields(info.field_nodes[0].selection_set) return cls(object=await obj.to_graphql(fields=fields.get("object", {})), ok=True, task=task) + class BranchNameInput(InputObjectType): name = String(required=False) diff --git a/backend/tests/integration/git/test_git_repository.py b/backend/tests/integration/git/test_git_repository.py index 4e6d769d2b..8769973103 100644 --- a/backend/tests/integration/git/test_git_repository.py +++ b/backend/tests/integration/git/test_git_repository.py @@ -319,7 +319,6 @@ async def test_get_missing_file(self, db: InfrahubDatabase, client: InfrahubClie id=obj.id, name=git_repo_car_dealership.name, location=git_repo_car_dealership.path, - task_report=FakeTaskReportLogger(), client=client, ) diff --git a/poetry.lock b/poetry.lock index 092880f41e..9fcd39e69f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -5800,4 +5800,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.10, < 3.13" -content-hash = "0709c9a922de0a8b67d447ed32160378ea3070179724c810d51a12a15050b4f8" +content-hash = "7b1ff36c08dd52951d7caa461cbf3803c8c1ce9518648d3b2d9aee452b55edf0" diff --git a/tasks/shared.py b/tasks/shared.py index 4f89ef6089..3c9500765b 100644 --- a/tasks/shared.py +++ b/tasks/shared.py @@ -275,4 +275,26 @@ def build_dev_compose_files_cmd(database: str) -> str: print("!! Found a dev override file for docker-compose !!") DEV_COMPOSE_FILES.append(DEV_OVERRIDE_FILE) - return f"-f {' -f '.join(map(str, DEV_COMPOSE_FILES))}" \ No newline at end of file + return f"-f {' -f '.join(map(str, DEV_COMPOSE_FILES))}" + + +def init_yaml_obj(line_length: int | None = None) -> YAML: + """Instantiate a ruamel.yaml YAML object. + + Args: + line_length (int, optional): Override the .yamllint.yml line length. Defaults to None. + + Returns: + YAML: Instantiated ruamel.yaml.YAML object. + """ + from ruamel.yaml import YAML + + yamllint_rules: dict = get_yamllint_rules() + + yaml = YAML(typ="rt") + yaml.preserve_quotes = True + yaml.indent(mapping=2, sequence=4, offset=2) + yaml.explicit_start = True + yaml.width = line_length or yamllint_rules.get("line-length", {}).get("max", 120) + + return yaml