Skip to content

Commit

Permalink
Fix code for mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
BergLucas committed Aug 23, 2023
1 parent b243837 commit 35be3e7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/poetry/core/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import Union
from warnings import warn

from packaging.utils import NormalizedName
from packaging.utils import canonicalize_name

from poetry.core.utils.helpers import combine_unicode
Expand Down Expand Up @@ -179,20 +180,24 @@ def configure_package(
package=package, group="dev", dependencies=config["dev-dependencies"]
)

extra_deps = {}
extra_deps: dict[
tuple[NormalizedName, frozenset[NormalizedName]], Dependency
] = {}
extras = config.get("extras", {})
for extra_name, requirements in extras.items():
extra_name = canonicalize_name(extra_name)
package.extras[extra_name] = []

# Checking for dependency
for req in requirements:
req_extras: list[NormalizedName] = []
req_match = REQUIREMENT_PATTERN.match(req.replace(" ", ""))
if req_match is not None:
req = req_match.group(1)
req_extras = req_match.group(2).split(",")
else:
req_extras = []
req_extras.extend(
canonicalize_name(extra)
for extra in req_match.group(2).split(",")
)

req = Dependency(req, "*")

Expand Down

0 comments on commit 35be3e7

Please sign in to comment.