Skip to content

Commit

Permalink
fix typing and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnzZ committed Jan 9, 2023
1 parent 513235d commit c53249c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions web_poet/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ def __init__(self, *, rules: Optional[Iterable[ApplyRule]] = None):
self._item_matchers: Dict[Optional[Type], URLMatcher] = defaultdict(URLMatcher)

# Ensures that URLMatcher is deterministic in returning a rule when
# matching. Currently, `URLMatcher._sort_domain` has this sorting
# criteria:
# matching. As of url_macher==0.2.0, `url_matcher.URLMatcher._sort_domain`
# has this sorting criteria:
# * Priority (descending)
# * Sorted list of includes for this domain (descending)
# * Rule identifier (descending)
# This means that if the priority and domain are the same, the last tie
# breaker woulud be the "Rule identifier", this means we can base it on
# when a given rule was added to the registry, i.e. a counter.
# breaker would be the "Rule identifier", this means we can base it on
# the order of rule addition to the registry, i.e. a counter.
self._rule_counter = 0

if rules is not None:
Expand Down Expand Up @@ -331,7 +331,9 @@ def _rules_for_url(

return result

def overrides_for(self, url: Union[_Url, str]) -> Mapping[Type, Type[ItemPage]]:
def overrides_for(
self, url: Union[_Url, str]
) -> Mapping[Type[ItemPage], Type[ItemPage]]:
"""Finds all of the page objects associated with the given URL and
returns a Mapping where the 'key' represents the page object that is
**overridden** by the page object in 'value'.
Expand Down

0 comments on commit c53249c

Please sign in to comment.