From 391a4495391412650a386d639228c204c353cfa9 Mon Sep 17 00:00:00 2001 From: Kevin Lloyd Bernal Date: Tue, 8 Feb 2022 18:27:51 +0800 Subject: [PATCH] revert changes to page.py --- web_poet/pages.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/web_poet/pages.py b/web_poet/pages.py index fa06df05..0b3cdf63 100644 --- a/web_poet/pages.py +++ b/web_poet/pages.py @@ -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): @@ -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 @@ -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. @@ -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