Skip to content

Commit

Permalink
Stricter mypy settings; remove fixed false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Aug 13, 2024
1 parent 6cd213e commit e7407d3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyinaturalist/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def load_json(value: ResponseOrFile) -> ResponseOrResults:
with open(expanduser(str(value))) as f:
json_value = json.load(f)
else:
json_value = json.load(value) # type: ignore
json_value = json.load(value)

if 'results' in json_value:
json_value = json_value['results']
Expand Down
2 changes: 1 addition & 1 deletion pyinaturalist/models/conservation_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ConservationStatus(BaseModel):
url: str = field(default=None, doc='Link to data source with more details')

# Lazy-loaded nested model objects
place: property = LazyProperty( # type: ignore
place: property = LazyProperty(
Place.from_json, type=Place, doc='Location that the conservation status applies to'
)
updater: User = LazyProperty(User.from_json, type=User, doc='User that last updated the record') # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion pyinaturalist/models/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def __init__(self, **kwargs):
}
ancestors = [taxa_by_id.get(i) for i in kwargs['taxon'].get('ancestor_ids')]
kwargs['taxon']['ancestors'] = list(filter(None, ancestors))
self.__attrs_init__(**kwargs) # type: ignore
self.__attrs_init__(**kwargs)

@property
def cumulative_ids(self) -> Tuple[int, int]:
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ skip_gitignore = true
known_first_party = ['test']

[tool.mypy]
check-untyped-defs = true
ignore_missing_imports = true
pretty = true
show_column_numbers = true
show_error_codes = true
warn_redundant_casts = true
warn_unused_ignores = true
files = ['pyinaturalist']

[tool.pytest.ini_options]
Expand Down
2 changes: 1 addition & 1 deletion test/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_request_dry_run_disabled(requests_mock):
assert ClientSession().request('GET', 'http://url').json() == real_response


@patch.object(urllib3.util.retry.time, 'sleep') # type: ignore
@patch.object(urllib3.util.retry.time, 'sleep')
def test_request_validate_json__retry_failure(mock_sleep, requests_mock):
requests_mock.get(
'http://url/invalid_json',
Expand Down

0 comments on commit e7407d3

Please sign in to comment.