Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ repos:
# rev: v0.960
# hooks:
# - id: mypy
# files: "^pystac_client/.*\\.py$"
# files: ".*\\.py$"
# exclude: ^(docs/.*|tests/.*)$
# args:
# - --ignore-missing-imports
# additional_dependencies:
Expand Down
14 changes: 8 additions & 6 deletions pystac_client/item_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
from pystac_client.stac_api_io import StacApiIO

if TYPE_CHECKING:
from pystac_client import client
from pystac_client import client as _client

DATETIME_REGEX = re.compile(
r"(?P<year>\d{4})(\-(?P<month>\d{2})(\-(?P<day>\d{2})"
r"(?P<remainder>(T|t)\d{2}:\d{2}:\d{2}(\.\d+)?"
r"(?P<year>\d{4})(-(?P<month>\d{2})(-(?P<day>\d{2})"
r"(?P<remainder>([Tt])\d{2}:\d{2}:\d{2}(\.\d+)?"
r"(?P<tz_info>Z|([-+])(\d{2}):(\d{2}))?)?)?)?"
)

Expand Down Expand Up @@ -219,7 +219,7 @@ def __init__(
method: Optional[str] = "POST",
max_items: Optional[int] = DEFAULT_LIMIT_AND_MAX_ITEMS,
stac_io: Optional[StacApiIO] = None,
client: Optional["client.Client"] = None,
client: Optional["_client.Client"] = None,
limit: Optional[int] = DEFAULT_LIMIT_AND_MAX_ITEMS,
ids: Optional[IDsLike] = None,
collections: Optional[CollectionsLike] = None,
Expand Down Expand Up @@ -265,7 +265,9 @@ def __init__(
"fields": self._format_fields(fields),
}

self._parameters = {k: v for k, v in params.items() if v is not None}
self._parameters: Dict[str, Any] = {
k: v for k, v in params.items() if v is not None
}

def _assert_conforms_to(self, conformance_class: ConformanceClasses) -> None:
self._stac_io.assert_conforms_to(conformance_class)
Expand Down Expand Up @@ -491,7 +493,7 @@ def _format_sortby(self, value: Optional[SortbyLike]) -> Optional[Sortby]:
if value and isinstance(value[0], str):
return [self._sortby_part_to_dict(str(v)) for v in value]
elif value and isinstance(value[0], dict):
return value
return value # type: ignore

raise Exception(
"sortby must be of type None, str, List[str], or List[Dict[str, str]"
Expand Down