Skip to content

Commit

Permalink
Merge pull request #4389 from opsmill/pog-return-code-typing
Browse files Browse the repository at this point in the history
Add type annotations for returned objects
  • Loading branch information
dgarros authored Sep 20, 2024
2 parents 2b2fde6 + c2499a1 commit 6927bfe
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion backend/infrahub/graphql/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from infrahub.graphql import GraphqlContext


async def default_resolver(*args: Any, **kwargs):
async def default_resolver(*args: Any, **kwargs) -> dict | list[dict] | None:
"""Not sure why but the default resolver returns sometime 4 positional args and sometime 2.
When it returns 4, they are organized as follow
Expand Down
2 changes: 1 addition & 1 deletion backend/infrahub/graphql/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def selected_field_names_fast(
return selected_field_names(selection_set, context, runtime_type)


def selected_field_names_naive(selection_set: SelectionSetNode):
def selected_field_names_naive(selection_set: SelectionSetNode) -> list:
"""Get the list of field names that are selected at the current level. Does not include nested names.
Limitations:
Expand Down
14 changes: 0 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -595,27 +595,13 @@ max-complexity = 33
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
]

"backend/infrahub/graphql/resolver.py" = [
##################################################################################################
# Review and change the below later #
##################################################################################################
"ANN201", # Missing return type annotation for public function
]

"backend/infrahub/graphql/schema.py" = [
##################################################################################################
# Review and change the below later #
##################################################################################################
"ANN201", # Missing return type annotation for public function
]

"backend/infrahub/graphql/utils.py" = [
##################################################################################################
# Review and change the below later #
##################################################################################################
"ANN201", # Missing return type annotation for public function
]

"backend/tests/**.py" = [
"S101", # Use of assert detected
"S105", # Possible hardcoded password assigned to variable
Expand Down

0 comments on commit 6927bfe

Please sign in to comment.