|
10 | 10 | from typing import Iterable
|
11 | 11 | from typing import Iterator
|
12 | 12 | from typing import TypeVar
|
13 |
| -from typing import cast |
14 | 13 |
|
15 | 14 | from poetry.core.constraints.version import parse_constraint
|
16 | 15 | from poetry.core.packages.dependency_group import MAIN_GROUP
|
@@ -483,38 +482,42 @@ def to_dependency(self) -> Dependency:
|
483 | 482 |
|
484 | 483 | dep: Dependency
|
485 | 484 | if self.source_type == "directory":
|
| 485 | + assert self._source_url is not None |
486 | 486 | dep = DirectoryDependency(
|
487 | 487 | self._name,
|
488 |
| - Path(cast(str, self._source_url)), |
| 488 | + Path(self._source_url), |
489 | 489 | groups=list(self._dependency_groups.keys()),
|
490 | 490 | optional=self.optional,
|
491 | 491 | base=self.root_dir,
|
492 | 492 | develop=self.develop,
|
493 | 493 | extras=self.features,
|
494 | 494 | )
|
495 | 495 | elif self.source_type == "file":
|
| 496 | + assert self._source_url is not None |
496 | 497 | dep = FileDependency(
|
497 | 498 | self._name,
|
498 |
| - Path(cast(str, self._source_url)), |
| 499 | + Path(self._source_url), |
499 | 500 | groups=list(self._dependency_groups.keys()),
|
500 | 501 | optional=self.optional,
|
501 | 502 | base=self.root_dir,
|
502 | 503 | extras=self.features,
|
503 | 504 | )
|
504 | 505 | elif self.source_type == "url":
|
| 506 | + assert self._source_url is not None |
505 | 507 | dep = URLDependency(
|
506 | 508 | self._name,
|
507 |
| - cast(str, self._source_url), |
| 509 | + self._source_url, |
508 | 510 | directory=self.source_subdirectory,
|
509 | 511 | groups=list(self._dependency_groups.keys()),
|
510 | 512 | optional=self.optional,
|
511 | 513 | extras=self.features,
|
512 | 514 | )
|
513 | 515 | elif self.source_type == "git":
|
| 516 | + assert self._source_url is not None |
514 | 517 | dep = VCSDependency(
|
515 | 518 | self._name,
|
516 | 519 | self.source_type,
|
517 |
| - cast(str, self.source_url), |
| 520 | + self._source_url, |
518 | 521 | rev=self.source_reference,
|
519 | 522 | resolved_rev=self.source_resolved_reference,
|
520 | 523 | directory=self.source_subdirectory,
|
|
0 commit comments