Skip to content

Commit 84da860

Browse files
committed
lint: remove some type: ignores
pystac 1.7.0 made these unnecessary.
1 parent 15a3966 commit 84da860

File tree

3 files changed

+8
-24
lines changed

3 files changed

+8
-24
lines changed

pystac_client/client.py

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
from functools import lru_cache
2-
from typing import (
3-
TYPE_CHECKING,
4-
Any,
5-
Callable,
6-
Dict,
7-
Iterator,
8-
List,
9-
Optional,
10-
Union,
11-
cast,
12-
)
2+
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Optional, Union
133

144
import pystac
155
import pystac.utils
@@ -204,7 +194,7 @@ def from_file( # type: ignore
204194
request_modifier=request_modifier,
205195
)
206196

207-
client: Client = super().from_file(href, stac_io) # type: ignore
197+
client: Client = super().from_file(href, stac_io)
208198

209199
client._stac_io._conformance = client.extra_fields.get( # type: ignore
210200
"conformsTo", []
@@ -241,10 +231,6 @@ def from_dict(
241231
f"Could not open Client (href={href}), "
242232
f"expected type=Catalog, found type={d.get('type', None)}"
243233
)
244-
# cast require for mypy to believe that we have a Client, rather than
245-
# the super type.
246-
# https://github.com/stac-utils/pystac/issues/862
247-
result = cast(Client, result)
248234

249235
result.modifier = modifier
250236
return result

pystac_client/collection_client.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414

1515
class CollectionClient(pystac.Collection):
16-
1716
modifier: Callable[[Modifiable], None]
1817
_stac_io: Optional[StacApiIO]
1918

@@ -69,8 +68,7 @@ def from_dict(
6968
# error: Cannot assign to a method [assignment]
7069
# https://github.com/python/mypy/issues/2427
7170
setattr(result, "modifier", modifier)
72-
# ignore the return type: https://github.com/stac-utils/pystac/issues/862
73-
return result # type: ignore
71+
return result
7472

7573
def __repr__(self) -> str:
7674
return "<CollectionClient id={}>".format(self.id)

tests/test_item_search.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
class TestItemPerformance:
3535
@pytest.fixture(scope="function")
3636
def single_href(self) -> str:
37-
item_href = "https://planetarycomputer.microsoft.com/api/stac/v1/collections/{collections}/items/{ids}".format(
38-
collections=ITEM_EXAMPLE["collections"], ids=ITEM_EXAMPLE["ids"]
37+
item_href = (
38+
"https://planetarycomputer.microsoft.com/api/stac/v1/collections/"
39+
f"{ITEM_EXAMPLE['collections']}/items/{ITEM_EXAMPLE['ids']}"
3940
)
4041
return item_href
4142

@@ -457,7 +458,6 @@ def test_sortby(self) -> None:
457458
ItemSearch(url=SEARCH_URL, sortby=[1]) # type: ignore
458459

459460
def test_fields(self) -> None:
460-
461461
with pytest.raises(Exception):
462462
ItemSearch(url=SEARCH_URL, fields=1) # type: ignore
463463

@@ -629,7 +629,8 @@ def test_result_paging(self) -> None:
629629
max_items=20,
630630
)
631631

632-
# Check that the current page changes on the ItemSearch instance when a new page is requested
632+
# Check that the current page changes on the ItemSearch instance when a new page
633+
# is requested
633634
pages = list(search.pages())
634635

635636
assert pages[1] != pages[2]
@@ -725,7 +726,6 @@ def test_query_shortcut_syntax(self) -> None:
725726

726727
@pytest.mark.vcr
727728
def test_query_json_syntax(self) -> None:
728-
729729
# with a list of json strs (format of CLI argument to ItemSearch)
730730
search = ItemSearch(
731731
url=SEARCH_URL,

0 commit comments

Comments
 (0)