Skip to content

Commit

Permalink
revert changes to page.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnzZ committed Feb 8, 2022
1 parent cf7de8d commit 6507672
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions web_poet/pages.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import abc
import attr
from typing import Any, Optional
import typing

from web_poet.mixins import ResponseShortcutsMixin
from web_poet.page_inputs import ResponseData
from web_poet.requests import HttpClient


class Injectable(abc.ABC):
Expand All @@ -27,13 +26,13 @@ class Injectable(abc.ABC):
Injectable.register(type(None))


def is_injectable(cls: Any) -> bool:
def is_injectable(cls: typing.Any) -> bool:
"""Return True if ``cls`` is a class which inherits
from :class:`~.Injectable`."""
return isinstance(cls, type) and issubclass(cls, Injectable)


@attr.define
@attr.s(auto_attribs=True)
class ItemPage(Injectable, abc.ABC):
"""Base Page Object with a required :meth:`to_item` method.
Make sure you're creating Page Objects with ``to_item`` methods
Expand All @@ -45,7 +44,7 @@ def to_item(self):
"""Extract an item from a web page"""


@attr.define
@attr.s(auto_attribs=True)
class WebPage(Injectable, ResponseShortcutsMixin):
"""Base Page Object which requires :class:`~.ResponseData`
and provides XPath / CSS shortcuts.
Expand All @@ -56,9 +55,9 @@ class WebPage(Injectable, ResponseShortcutsMixin):
response: ResponseData


@attr.define
@attr.s(auto_attribs=True)
class ItemWebPage(WebPage, ItemPage):
""":class:`WebPage` that requires the :meth:`to_item` method to
be implemented.
"""
http_client: Optional[HttpClient]
pass

0 comments on commit 6507672

Please sign in to comment.