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 391a449
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 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,12 @@ 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
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 +43,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 +54,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 391a449

Please sign in to comment.