Skip to content

Commit

Permalink
fix a few wrong type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Oct 29, 2024
1 parent 99bd1fe commit 56fd9c8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bfabric/bfabric_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def read_config(
config_path: str | Path,
config_env: str = None,
config_env: str | None = None,
) -> tuple[BfabricClientConfig, BfabricAuth | None]:
"""
Reads bfabricpy.yml file, parses it, extracting authentication and configuration data
Expand Down
4 changes: 2 additions & 2 deletions src/bfabric/results/response_format_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def _recursive_drop_empty(response_elem: list | dict) -> None:
del response_elem[k]


def drop_empty_elements(response: list | dict, inplace: bool = True) -> list | dict | None:
def drop_empty_elements(response: list | dict, inplace: bool = True) -> list | dict:
"""
Iterates over all nested lists, dictionaries and basic values. Whenever a dictionary value is encountered, that is
either an empty list or None, the key-value pair gets deleted from the dictionary
:param response: A parsed query response, consisting of nested lists, dicts and basic types (int, str)
:param inplace: If true, will return nothing and edit the argument. Otherwise, will preserve the argument
and return an edited copy
:return: Nothing, or an edited response, depending on `inplace`
:return: An edited response, depending on `inplace`
"""
response_filtered = deepcopy(response) if not inplace else response
_recursive_drop_empty(response_filtered)
Expand Down
3 changes: 2 additions & 1 deletion src/bfabric/utils/paginator.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from __future__ import annotations

import math
from collections.abc import Generator

# Single page query limit for BFabric API (as of time of writing, adapt if it changes)
BFABRIC_QUERY_LIMIT = 100


def page_iter(objs: list, page_size: int = BFABRIC_QUERY_LIMIT) -> list:
def page_iter(objs: list, page_size: int = BFABRIC_QUERY_LIMIT) -> Generator[list, None, None]:
"""
:param objs: A list of objects to provide to bfabric as part of a query
:param page_size: Number of objects per page
Expand Down

0 comments on commit 56fd9c8

Please sign in to comment.