-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d707102
commit 31cb867
Showing
3 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
from abc import ABC, abstractmethod | ||
from collections.abc import Generator | ||
from typing import Any | ||
from typing import Any, Protocol | ||
|
||
from parsel import Selector | ||
|
||
from rscraping.data.models import Datasource, Lineup, Race, RaceName | ||
|
||
|
||
class HtmlParser(ABC): | ||
class HtmlParser(Protocol): | ||
DATASOURCE: Datasource | ||
|
||
@abstractmethod | ||
def parse_race(self, selector: Selector, **kwargs) -> Race | None: | ||
raise NotImplementedError | ||
... | ||
|
||
@abstractmethod | ||
def parse_race_ids(self, selector: Selector, **kwargs) -> Generator[str, Any, Any]: | ||
raise NotImplementedError | ||
... | ||
|
||
@abstractmethod | ||
def parse_race_names(self, selector: Selector, **kwargs) -> Generator[RaceName, Any, Any]: | ||
raise NotImplementedError | ||
... | ||
|
||
@abstractmethod | ||
def parse_lineup(self, selector: Selector, **kwargs) -> Lineup: | ||
raise NotImplementedError | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters