Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into last-modified-download
Browse files Browse the repository at this point in the history
  • Loading branch information
jake authored and jake committed Oct 20, 2023
2 parents ed13390 + 457f7bf commit 753dee4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.261
rev: v0.0.269

hooks:
- id: ruff
Expand All @@ -42,7 +42,7 @@ repos:
- id: codespell # See setup.cfg for args

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.3.0
hooks:
- id: mypy
additional_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion internetarchive/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _advanced_search(self):
auth=self.auth,
**self.request_kwargs)
j = r.json()
num_found = int(j['response']['numFound'])
num_found = int(j.get('response', {}).get('numFound', 0))
if not self._num_found:
self._num_found = num_found
if j.get('error'):
Expand Down
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@ max-statements = 124

[tool.ruff.per-file-ignores]
"__init__.py" = ["E402"]
"tests/*" = [
"PT017",
"S101",
]
"tests/conftest.py" = ["B018", "F811"]
"tests/*" = ["PT017", "S101"]
"tests/cli/test_ia_list.py" = ["E741"]
"tests/test_api.py" = ["E712"]
"tests/test_config.py" = ["PT011"]
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ docs =
test =
pytest==7.1.2
responses==0.20.0
ruff==0.0.261
ruff==0.0.269
types =
tqdm-stubs>=0.2.0
types-colorama
Expand Down
15 changes: 2 additions & 13 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
from internetarchive.cli import ia
from internetarchive.utils import json

try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError

try:
WindowsError # type: ignore[used-before-def]
except NameError:
class WindowsError(Exception):
pass

PROTOCOL = 'https:'
BASE_URL = 'https://archive.org/'
METADATA_URL = f'{BASE_URL}metadata/'
Expand Down Expand Up @@ -74,7 +63,7 @@ def load_test_data_file(filename):


def call_cmd(cmd, expected_exit_code=0):
proc = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
proc = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) # noqa: S602
stdout, stderr = proc.communicate()
stdout = stdout.decode('utf-8').strip()
stderr = stderr.decode('utf-8').strip()
Expand Down Expand Up @@ -134,5 +123,5 @@ def nasa_metadata():

# TODO: Why is this function defined twice in this file? See issue #505
@pytest.fixture() # type: ignore
def nasa_item(nasa_mocker):
def nasa_item(nasa_mocker): # noqa: F811
return get_item('nasa')
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pytest==7.2.2
responses==0.23.1
ruff==0.0.261
ruff==0.0.269

0 comments on commit 753dee4

Please sign in to comment.