WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit bc70ca8

Browse files
committed
ruff linting, part of #57
1 parent 39bccab commit bc70ca8

File tree

12 files changed

+26
-30
lines changed

12 files changed

+26
-30
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ build:
88

99
tld-endpoints:
1010
uv run tools/list_public_tlds_with_rdap_endpoints.py
11+
12+
13+
check:
14+
uvx ruff check
15+
16+
17+
format:
18+
uvx ruff format

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import os
2-
import sys
31
from setuptools import setup, find_packages
42

53

tests/test_bootstrap.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import json
33
from pathlib import Path
44
from ipaddress import IPv4Network, IPv4Address, IPv6Network, IPv6Address
5-
65
import whoisit
76

87

@@ -87,7 +86,7 @@ def test_bootstrap_ipv6_parser(self):
8786
}
8887
self.assertEqual(whoisit._bootstrap.parse_ipv6_data(test_data), expected)
8988

90-
def test_bootstrap_ipv6_parser(self):
89+
def test_bootstrap_object_parser(self):
9190
test_rdap_url = 'https://rdap.example.com/'
9291
test_data = [[['does', 'nothing', 'yet'], [test_rdap_url]]]
9392
expected = {}

tests/test_parser.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
from pathlib import Path
44
from datetime import datetime
55
from ipaddress import IPv4Network, IPv6Network
6-
76
from dateutil.tz import tzoffset, tzutc
8-
97
import whoisit
108

119

tests/test_proxy.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import unittest
2-
3-
42
import whoisit
53

64

tests/test_public_interface.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
from datetime import datetime, timezone
44
from ipaddress import IPv4Network, IPv6Network
55
from pathlib import Path
6-
76
import pytest
87
import responses
98
import yaml
109
from dateutil.tz import tzoffset
11-
from responses import _recorder
12-
10+
# from responses import _recorder
1311
import whoisit
1412

13+
1514
BASE_DIR = Path(__file__).resolve().parent
1615
RESPONSES = BASE_DIR / "responses"
1716
UTC = timezone.utc

tests/test_query.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import unittest
33
from pathlib import Path
44
from ipaddress import IPv4Network, IPv4Address, IPv6Network, IPv6Address
5-
65
import whoisit
76

87

tools/list_public_tlds_with_rdap_endpoints.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
sys.path.append(str(parent_dir))
1515

1616

17-
import requests
18-
import whoisit
19-
from whoisit.logger import get_logger
20-
from whoisit.errors import UnsupportedError
21-
from whoisit.overrides import iana_overrides
17+
import requests # noqa: E402
18+
import whoisit # noqa: E402
19+
from whoisit.logger import get_logger # noqa: E402
20+
from whoisit.errors import UnsupportedError # noqa: E402
21+
from whoisit.overrides import iana_overrides # noqa: E402
2222

2323

2424
log = get_logger('tools')
@@ -61,4 +61,4 @@ def get_endpoint(tld: str) -> tuple[list[str], str]:
6161
log.error(f'.{tld} UNSUPPORTED')
6262
else:
6363
log.info(f'.{tld} ({label}) endpoints {endpoints_str}')
64-
log.info(f'Done')
64+
log.info('Done')

whoisit/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from .errors import ArgumentError
77
from .parser import parse
88
from .query import Query, QueryAsync, QueryBuilder
9-
from .utils import get_async_client, get_session, recursive_merge, clear_session, set_proxy, get_proxy, clear_proxy
10-
from .version import version
9+
from .utils import get_async_client, get_session, recursive_merge, clear_session as clear_session, set_proxy as set_proxy, get_proxy as get_proxy, clear_proxy as clear_proxy
10+
from .version import version as version
1111

1212

1313
# Private methods

whoisit/bootstrap.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,10 @@ def load_bootstrap_data(self, data: str | dict, overrides: bool = False, allow_i
164164
if from_json:
165165
data = json.loads(data)
166166
except Exception as e:
167-
raise BootstrapError(f'Unable to load bootstrap data, failed to parse '
168-
f'as JSON: {e}') from e
167+
raise BootstrapError(f'Unable to load bootstrap data, failed to parse as JSON: {e}') from e
169168
timestamp = data.get('timestamp', None)
170169
if not isinstance(timestamp, int):
171-
raise BootstrapError(f'Unable to load bootstrap data, missing or '
172-
f'invalid timestamp')
170+
raise BootstrapError('Unable to load bootstrap data, missing or invalid timestamp')
173171
items_loaded = set()
174172
for name, item in data.items():
175173
if name == 'timestamp':

0 commit comments

Comments
 (0)