Skip to content

Commit bb2a8f2

Browse files
committed
fix naming and annotations
1 parent 71bb150 commit bb2a8f2

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

tests/test_page_inputs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import parsel
88
from web_poet.page_inputs import (
9-
ResponseURL,
10-
RequestURL,
9+
RequestUrl,
10+
ResponseUrl,
1111
HttpRequest,
1212
HttpResponse,
1313
HttpRequestBody,
@@ -18,7 +18,7 @@
1818
)
1919

2020

21-
@pytest.mark.parametrize("cls", [ResponseURL, RequestURL])
21+
@pytest.mark.parametrize("cls", [RequestUrl, ResponseUrl])
2222
def test_url(cls):
2323
url_value = "https://example.com/category/product?query=123&id=xyz#frag1"
2424

web_poet/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
HttpRequestBody,
1111
HttpResponseBody,
1212
Meta,
13-
RequestURL,
14-
ResponseURL,
13+
RequestUrl,
14+
ResponseUrl,
1515
)
1616
from .overrides import PageObjectRegistry, consume_modules, OverrideRule
1717

web_poet/page_inputs/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
from .meta import Meta
22
from .client import HttpClient
33
from .http import (
4-
ResponseURL,
5-
RequestURL,
64
HttpRequest,
75
HttpResponse,
86
HttpRequestHeaders,
97
HttpResponseHeaders,
108
HttpRequestBody,
119
HttpResponseBody,
12-
RequestURL,
13-
ResponseURL
10+
RequestUrl,
11+
ResponseUrl
1412
)
1513
from .browser import BrowserHtml

web_poet/page_inputs/http.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_AnyStrDict = Dict[AnyStr, Union[AnyStr, List[AnyStr], Tuple[AnyStr, ...]]]
2020

2121

22-
class _URL:
22+
class _Url:
2323
def __init__(self, url: Union[str, yarl.URL]):
2424
self._url = yarl.URL(str(url))
2525

@@ -37,7 +37,7 @@ def scheme(self) -> str:
3737
return self._url.scheme
3838

3939
@property
40-
def host(self) -> str:
40+
def host(self) -> Optional[str]:
4141
return self._url.host
4242

4343
@property
@@ -53,12 +53,12 @@ def fragment(self) -> str:
5353
return self._url.fragment
5454

5555

56-
class ResponseURL(_URL):
56+
class ResponseUrl(_Url):
5757
""" URL of the response """
5858
pass
5959

6060

61-
class RequestURL(_URL):
61+
class RequestUrl(_Url):
6262
""" URL of the request """
6363
pass
6464

@@ -197,7 +197,7 @@ class HttpRequest:
197197
**web-poet** like :class:`~.HttpClient`.
198198
"""
199199

200-
url: RequestURL = attrs.field(converter=RequestURL)
200+
url: RequestUrl = attrs.field(converter=RequestUrl)
201201
method: str = attrs.field(default="GET", kw_only=True)
202202
headers: HttpRequestHeaders = attrs.field(
203203
factory=HttpRequestHeaders, converter=HttpRequestHeaders, kw_only=True
@@ -230,7 +230,7 @@ class HttpResponse(SelectableMixin):
230230
is auto-detected from headers and body content.
231231
"""
232232

233-
url: ResponseURL = attrs.field(converter=ResponseURL)
233+
url: ResponseUrl = attrs.field(converter=ResponseUrl)
234234
body: HttpResponseBody = attrs.field(converter=HttpResponseBody)
235235
status: Optional[int] = attrs.field(default=None, kw_only=True)
236236
headers: HttpResponseHeaders = attrs.field(factory=HttpResponseHeaders,

0 commit comments

Comments
 (0)