1
1
import abc
2
2
import attr
3
- from typing import Any , Optional
3
+ import typing
4
4
5
5
from web_poet .mixins import ResponseShortcutsMixin
6
6
from web_poet .page_inputs import ResponseData
7
- from web_poet .requests import HttpClient
8
7
9
8
10
9
class Injectable (abc .ABC ):
@@ -27,13 +26,12 @@ class Injectable(abc.ABC):
27
26
Injectable .register (type (None ))
28
27
29
28
30
- def is_injectable (cls : Any ) -> bool :
29
+ def is_injectable (cls : typing . Any ) -> bool :
31
30
"""Return True if ``cls`` is a class which inherits
32
31
from :class:`~.Injectable`."""
33
32
return isinstance (cls , type ) and issubclass (cls , Injectable )
34
33
35
34
36
- @attr .define
37
35
class ItemPage (Injectable , abc .ABC ):
38
36
"""Base Page Object with a required :meth:`to_item` method.
39
37
Make sure you're creating Page Objects with ``to_item`` methods
@@ -45,7 +43,7 @@ def to_item(self):
45
43
"""Extract an item from a web page"""
46
44
47
45
48
- @attr .define
46
+ @attr .s ( auto_attribs = True )
49
47
class WebPage (Injectable , ResponseShortcutsMixin ):
50
48
"""Base Page Object which requires :class:`~.ResponseData`
51
49
and provides XPath / CSS shortcuts.
@@ -56,9 +54,9 @@ class WebPage(Injectable, ResponseShortcutsMixin):
56
54
response : ResponseData
57
55
58
56
59
- @attr .define
57
+ @attr .s ( auto_attribs = True )
60
58
class ItemWebPage (WebPage , ItemPage ):
61
59
""":class:`WebPage` that requires the :meth:`to_item` method to
62
60
be implemented.
63
61
"""
64
- http_client : Optional [ HttpClient ]
62
+ pass
0 commit comments