Skip to content

Commit 00e4c98

Browse files
committed
chore: autoupdate pre-commit
This lets remove a bunch of # type: ignores
1 parent 381d256 commit 00e4c98

File tree

9 files changed

+48
-49
lines changed

9 files changed

+48
-49
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,38 @@
33

44
repos:
55
- repo: https://github.com/psf/black
6-
rev: 22.3.0
6+
rev: 22.12.0
77
hooks:
88
- id: black
99
- repo: https://github.com/codespell-project/codespell
10-
rev: v2.1.0
10+
rev: v2.2.2
1111
hooks:
1212
- id: codespell
1313
args: [--ignore-words=.codespellignore]
1414
types_or: [jupyter, markdown, python, shell]
1515
- repo: https://github.com/PyCQA/doc8
16-
rev: 0.11.2
16+
rev: v1.1.1
1717
hooks:
1818
- id: doc8
1919
args: [--ignore=D004]
2020
additional_dependencies:
2121
- importlib_metadata < 5; python_version == "3.7"
2222
- repo: https://github.com/PyCQA/flake8
23-
rev: 4.0.1
23+
rev: 6.0.0
2424
hooks:
2525
- id: flake8
2626
- repo: https://github.com/pycqa/isort
27-
rev: 5.10.1
27+
rev: 5.11.4
2828
hooks:
2929
- id: isort
3030
name: isort (python)
3131
- repo: https://github.com/pre-commit/mirrors-mypy
32-
rev: v0.960
32+
rev: v0.991
3333
hooks:
3434
- id: mypy
3535
files: ".*\\.py$"
3636
additional_dependencies:
3737
- pystac
38+
- pytest-vcr
3839
- types-requests
3940
- types-python-dateutil

docs/tutorials/authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ While not integrated into this library directly, pystac-client provides a series
44

55
## Basic auth
66

7-
Pystac-client supports HTTP basic authentication by simply exposing the ability to define headers to be used when sending requets. Simply encode the token and provide the header.
7+
Pystac-client supports HTTP basic authentication by simply exposing the ability to define headers to be used when sending requests. Simply encode the token and provide the header.
88

99
```python
1010
import base64

pystac_client/collection_client.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,12 @@ def get_items(self) -> Iterator["Item_Type"]:
100100
url=link.href,
101101
method="GET",
102102
stac_io=stac_io,
103-
modifier=self.modifier, # type: ignore
103+
modifier=self.modifier,
104104
)
105105
yield from search.items()
106106
else:
107107
for item in super().get_items():
108-
# what is going on with mypy here?
109-
# error: Too many arguments [call-arg]
110-
call_modifier(self.modifier, item) # type: ignore
108+
call_modifier(self.modifier, item)
111109
yield item
112110

113111
def get_item(self, id: str, recursive: bool = False) -> Optional["Item_Type"]:
@@ -155,7 +153,6 @@ def get_item(self, id: str, recursive: bool = False) -> Optional["Item_Type"]:
155153
break
156154

157155
if item:
158-
# error: Too many arguments [call-arg]
159-
call_modifier(self.modifier, item) # type: ignore
156+
call_modifier(self.modifier, item)
160157

161158
return item

pystac_client/stac_api_io.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ def stac_object_from_dict(
168168
root: Optional["Catalog_Type"] = None,
169169
preserve_dict: bool = True,
170170
) -> "STACObject_Type":
171-
"""Deserializes a :class:`~pystac.STACObject` sub-class instance from a dictionary.
171+
"""Deserializes a :class:`~pystac.STACObject` sub-class instance from a
172+
dictionary.
172173
173174
Args:
174175
d : The dictionary to deserialize

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class TestCLI:
8-
@pytest.mark.vcr # type: ignore[misc]
8+
@pytest.mark.vcr
99
def test_item_search(self, script_runner: ScriptRunner) -> None:
1010
args = [
1111
"stac-client",

tests/test_client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
class TestAPI:
24-
@pytest.mark.vcr # type: ignore[misc]
24+
@pytest.mark.vcr
2525
def test_instance(self) -> None:
2626
api = Client.open(STAC_URLS["PLANETARY-COMPUTER"])
2727

@@ -30,7 +30,7 @@ def test_instance(self) -> None:
3030

3131
assert str(api) == "<Client id=microsoft-pc>"
3232

33-
@pytest.mark.vcr # type: ignore[misc]
33+
@pytest.mark.vcr
3434
def test_links(self) -> None:
3535
api = Client.open(STAC_URLS["PLANETARY-COMPUTER"])
3636

@@ -57,7 +57,7 @@ def test_spec_conformance(self) -> None:
5757

5858
assert client._stac_io.conforms_to(ConformanceClasses.CORE)
5959

60-
@pytest.mark.vcr # type: ignore[misc]
60+
@pytest.mark.vcr
6161
def test_no_conformance(self) -> None:
6262
"""Should raise a NotImplementedError if no conformance info can be found.
6363
Luckily, the test API doesn't publish a "conformance" link so we can just
@@ -73,7 +73,7 @@ def test_no_conformance(self) -> None:
7373
with pytest.raises(NotImplementedError):
7474
client._stac_io.assert_conforms_to(ConformanceClasses.ITEM_SEARCH)
7575

76-
@pytest.mark.vcr # type: ignore[misc]
76+
@pytest.mark.vcr
7777
def test_no_stac_core_conformance(self) -> None:
7878
"""Should raise a NotImplementedError if the API does not conform to the
7979
STAC API - Core spec."""
@@ -87,7 +87,7 @@ def test_no_stac_core_conformance(self) -> None:
8787

8888
assert client._stac_io.conforms_to(ConformanceClasses.ITEM_SEARCH)
8989

90-
@pytest.mark.vcr # type: ignore[misc]
90+
@pytest.mark.vcr
9191
def test_from_file(self) -> None:
9292
api = Client.from_file(STAC_URLS["PLANETARY-COMPUTER"])
9393

@@ -448,7 +448,7 @@ def test_opening_a_collection(self) -> None:
448448

449449

450450
class TestAPISearch:
451-
@pytest.fixture(scope="function") # type: ignore[misc]
451+
@pytest.fixture(scope="function")
452452
def api(self) -> Client:
453453
return Client.from_file(str(TEST_DATA / "planetary-computer-root.json"))
454454

@@ -513,7 +513,7 @@ def test_json_search_link(self, api: Client) -> None:
513513
api.add_link(search_link)
514514
api.search(limit=1, max_items=1, collections="naip")
515515

516-
@pytest.mark.vcr # type: ignore[misc]
516+
@pytest.mark.vcr
517517
def test_search_max_items_unlimited_default(self, api: Client) -> None:
518518
search = api.search(
519519
bbox=[-73.21, 43.99, -73.12, 45.05],
@@ -533,7 +533,7 @@ def __call__(self, x: Modifiable) -> None:
533533

534534

535535
class TestSigning:
536-
@pytest.mark.vcr # type: ignore[misc]
536+
@pytest.mark.vcr
537537
def test_signing(self) -> None:
538538
sign = MySign()
539539
# sign is callable, but mypy keeps trying to interpret it as a "MySign" object.
@@ -543,7 +543,7 @@ def test_signing(self) -> None:
543543
collection = client.get_collection("cil-gdpcir-cc0")
544544
assert collection
545545
assert isinstance(collection, CollectionClient)
546-
assert collection.modifier is sign # type: ignore
546+
assert collection.modifier is sign
547547
assert sign.call_count == 1
548548

549549
collection.get_item("cil-gdpcir-INM-INM-CM5-0-ssp585-r1i1p1f1-day")
@@ -577,7 +577,7 @@ def test_signing(self) -> None:
577577
search.item_collection()
578578
assert sign.call_count == 11
579579

580-
@pytest.mark.vcr # type: ignore[misc]
580+
@pytest.mark.vcr
581581
def test_sign_with_return_warns(self) -> None:
582582
def modifier_ok(x: Any) -> Any:
583583
return x

tests/test_collection_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88

99
class TestCollectionClient:
10-
@pytest.mark.vcr # type: ignore[misc]
10+
@pytest.mark.vcr
1111
def test_instance(self) -> None:
1212
client = Client.open(STAC_URLS["PLANETARY-COMPUTER"])
1313
collection = client.get_collection("aster-l1t")
1414

1515
assert isinstance(collection, CollectionClient)
1616
assert str(collection) == "<CollectionClient id=aster-l1t>"
1717

18-
@pytest.mark.vcr # type: ignore[misc]
18+
@pytest.mark.vcr
1919
def test_get_items(self) -> None:
2020
client = Client.open(STAC_URLS["PLANETARY-COMPUTER"])
2121
collection = client.get_collection("aster-l1t")
@@ -24,7 +24,7 @@ def test_get_items(self) -> None:
2424
assert item.collection_id == collection.id
2525
return
2626

27-
@pytest.mark.vcr # type: ignore[misc]
27+
@pytest.mark.vcr
2828
def test_get_item(self) -> None:
2929
client = Client.open(STAC_URLS["PLANETARY-COMPUTER"])
3030
collection = client.get_collection("aster-l1t")

tests/test_item_search.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333

3434
class TestItemPerformance:
35-
@pytest.fixture(scope="function") # type: ignore[misc]
35+
@pytest.fixture(scope="function")
3636
def single_href(self) -> str:
3737
item_href = "https://planetarycomputer.microsoft.com/api/stac/v1/collections/{collections}/items/{ids}".format(
3838
collections=ITEM_EXAMPLE["collections"], ids=ITEM_EXAMPLE["ids"]
@@ -62,7 +62,7 @@ def test_single_item_search(
6262

6363

6464
class TestItemSearchParams:
65-
@pytest.fixture(scope="function") # type: ignore[misc]
65+
@pytest.fixture(scope="function")
6666
def sample_client(self) -> Client:
6767
api_content = read_data_file("planetary-computer-root.json", parse_json=True)
6868
return Client.from_dict(api_content)
@@ -451,18 +451,18 @@ def test_sortby(self) -> None:
451451
)
452452

453453
with pytest.raises(Exception):
454-
ItemSearch(url=SEARCH_URL, sortby=1) # type: ignore[arg-type]
454+
ItemSearch(url=SEARCH_URL, sortby=1) # type: ignore
455455

456456
with pytest.raises(Exception):
457-
ItemSearch(url=SEARCH_URL, sortby=[1]) # type: ignore[arg-type]
457+
ItemSearch(url=SEARCH_URL, sortby=[1]) # type: ignore
458458

459459
def test_fields(self) -> None:
460460

461461
with pytest.raises(Exception):
462-
ItemSearch(url=SEARCH_URL, fields=1) # type: ignore[arg-type]
462+
ItemSearch(url=SEARCH_URL, fields=1) # type: ignore
463463

464464
with pytest.raises(Exception):
465-
ItemSearch(url=SEARCH_URL, fields=[1]) # type: ignore[list-item]
465+
ItemSearch(url=SEARCH_URL, fields=[1]) # type: ignore
466466

467467
search = ItemSearch(url=SEARCH_URL, fields="id,collection,+foo,-bar")
468468
assert search.get_parameters()["fields"] == {
@@ -504,7 +504,7 @@ def test_fields(self) -> None:
504504

505505

506506
class TestItemSearch:
507-
@pytest.fixture(scope="function") # type: ignore[misc]
507+
@pytest.fixture(scope="function")
508508
def astraea_api(self) -> Client:
509509
api_content = read_data_file("astraea_api.json", parse_json=True)
510510
return Client.from_dict(api_content)
@@ -539,7 +539,7 @@ def test_method_params(self) -> None:
539539
assert all(key in params for key in params_in)
540540
assert all(isinstance(params[key], str) for key in params_in)
541541

542-
@pytest.mark.vcr # type: ignore[misc]
542+
@pytest.mark.vcr
543543
def test_results(self) -> None:
544544
search = ItemSearch(
545545
url=SEARCH_URL,
@@ -551,7 +551,7 @@ def test_results(self) -> None:
551551

552552
assert all(isinstance(item, pystac.Item) for item in results)
553553

554-
@pytest.mark.vcr # type: ignore[misc]
554+
@pytest.mark.vcr
555555
def test_ids_results(self) -> None:
556556
ids = [
557557
"S2B_MSIL2A_20210610T115639_N0212_R066_T33XXG_20210613T185024.SAFE",
@@ -566,7 +566,7 @@ def test_ids_results(self) -> None:
566566
assert len(results) == 1
567567
assert all(item.id in ids for item in results)
568568

569-
@pytest.mark.vcr # type: ignore[misc]
569+
@pytest.mark.vcr
570570
def test_datetime_results(self) -> None:
571571
# Datetime range string
572572
datetime_ = "2019-01-01T00:00:01Z/2019-01-01T00:00:10Z"
@@ -585,7 +585,7 @@ def test_datetime_results(self) -> None:
585585
min_datetime <= item.datetime <= (max_datetime + timedelta(seconds=1))
586586
)
587587

588-
@pytest.mark.vcr # type: ignore[misc]
588+
@pytest.mark.vcr
589589
def test_intersects_results(self) -> None:
590590
# GeoJSON-like dict
591591
intersects_dict = {
@@ -619,7 +619,7 @@ def __geo_interface__(self) -> Dict[str, Any]:
619619
new_results = search.items()
620620
assert all(isinstance(item, pystac.Item) for item in new_results)
621621

622-
@pytest.mark.vcr # type: ignore[misc]
622+
@pytest.mark.vcr
623623
def test_result_paging(self) -> None:
624624
search = ItemSearch(
625625
url=SEARCH_URL,
@@ -635,7 +635,7 @@ def test_result_paging(self) -> None:
635635
assert pages[1] != pages[2]
636636
assert pages[1].items != pages[2].items
637637

638-
@pytest.mark.vcr # type: ignore[misc]
638+
@pytest.mark.vcr
639639
def test_item_collection(self) -> None:
640640
search = ItemSearch(
641641
url=SEARCH_URL,
@@ -648,8 +648,8 @@ def test_item_collection(self) -> None:
648648
assert isinstance(item_collection, pystac.ItemCollection)
649649
assert len(item_collection) == 20
650650

651-
@pytest.mark.vcr # type: ignore[misc]
652-
@pytest.mark.parametrize( # type: ignore[misc]
651+
@pytest.mark.vcr
652+
@pytest.mark.parametrize(
653653
"method, alternative, is_sequence, is_pystac",
654654
[
655655
("get_item_collections", "pages", True, True),
@@ -688,7 +688,7 @@ def test_deprecations(
688688

689689
assert result == expected
690690

691-
@pytest.mark.vcr # type: ignore[misc]
691+
@pytest.mark.vcr
692692
def test_items_as_dicts(self) -> None:
693693
search = ItemSearch(
694694
url=SEARCH_URL,
@@ -701,7 +701,7 @@ def test_items_as_dicts(self) -> None:
701701

702702

703703
class TestItemSearchQuery:
704-
@pytest.mark.vcr # type: ignore[misc]
704+
@pytest.mark.vcr
705705
def test_query_shortcut_syntax(self) -> None:
706706
search = ItemSearch(
707707
url=SEARCH_URL,
@@ -723,7 +723,7 @@ def test_query_shortcut_syntax(self) -> None:
723723
assert len(items2) == 1
724724
assert items1[0].id == items2[0].id
725725

726-
@pytest.mark.vcr # type: ignore[misc]
726+
@pytest.mark.vcr
727727
def test_query_json_syntax(self) -> None:
728728

729729
# with a list of json strs (format of CLI argument to ItemSearch)

tests/test_stac_api_io.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313

1414

1515
class TestSTAC_IOOverride:
16-
@pytest.mark.vcr # type: ignore[misc]
16+
@pytest.mark.vcr
1717
def test_request_input(self) -> None:
1818
stac_api_io = StacApiIO()
1919
response = stac_api_io.read_text(STAC_URLS["PLANETARY-COMPUTER"])
2020
assert isinstance(response, str)
2121

22-
@pytest.mark.vcr # type: ignore[misc]
22+
@pytest.mark.vcr
2323
def test_str_input(self) -> None:
2424
stac_api_io = StacApiIO()
2525
response = stac_api_io.read_text(STAC_URLS["PLANETARY-COMPUTER"])
2626

2727
assert isinstance(response, str)
2828

29-
@pytest.mark.vcr # type: ignore[misc]
29+
@pytest.mark.vcr
3030
def test_http_error(self) -> None:
3131
stac_api_io = StacApiIO()
3232
# Attempt to access an authenticated endpoint

0 commit comments

Comments
 (0)