Skip to content

Commit

Permalink
πŸ§Žβ€β™€οΈ Genuflect to the types.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 7, 2024
1 parent fd3a0ab commit 9d4908e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions importlib_metadata/__init__.py
Expand Up @@ -33,7 +33,7 @@
from importlib import import_module
from importlib.abc import MetaPathFinder
from itertools import starmap
from typing import Any, Iterable, List, Mapping, Optional, Set, cast
from typing import Any, Iterable, List, Mapping, Match, Optional, Set, cast

__all__ = [
'Distribution',
Expand Down Expand Up @@ -180,7 +180,7 @@ def load(self) -> Any:
is indicated by the value, return that module. Otherwise,
return the named object.
"""
match = self.pattern.match(self.value)
match = cast(Match, self.pattern.match(self.value))
module = import_module(match.group('module'))
attrs = filter(None, (match.group('attr') or '').split('.'))
return functools.reduce(getattr, attrs, module)
Expand Down Expand Up @@ -769,6 +769,7 @@ class Lookup:
"""
A micro-optimized class for searching a (fast) path for metadata.
"""

def __init__(self, path: FastPath):
"""
Calculate all of the children representing metadata.
Expand Down

0 comments on commit 9d4908e

Please sign in to comment.