1111import operator
1212import os
1313import tarfile
14- from typing import Dict
14+ from typing import Dict , Iterable , Optional
1515from typing import Generator
1616from typing import List
1717from typing import NamedTuple
@@ -70,7 +70,7 @@ class Result(NamedTuple):
7070
7171
7272def get_requirements_from_distribution (
73- handler : BasePypiHandler ,
73+ handler : type [ BasePypiHandler ] ,
7474 location : str ,
7575) -> List [Requirement ]:
7676 """
@@ -84,7 +84,7 @@ def get_requirements_from_distribution(
8484 reqs = []
8585 for package_data in handler .parse (location ):
8686 dependencies = package_data .dependencies
87- reqs .extend (get_requirements_from_dependencies (dependencies = dependencies ))
87+ reqs .extend (get_requirements_from_dependencies (dependencies = dependencies ))
8888 return reqs
8989
9090
@@ -103,7 +103,7 @@ def get_deps_from_distribution(
103103 deps = []
104104 for package_data in handler .parse (location ):
105105 dependencies = package_data .dependencies
106- deps .extend (dependencies = dependencies )
106+ deps .extend (dependencies )
107107 return deps
108108
109109
@@ -254,7 +254,7 @@ def remove_extras(identifier: str) -> str:
254254 return name
255255
256256
257- def get_reqs_from_requirements_file_in_sdist (sdist_location : str , files : str ) -> List [Requirement ]:
257+ def get_reqs_from_requirements_file_in_sdist (sdist_location : str , files : List ) -> List [Requirement ]:
258258 """
259259 Return a list of parsed requirements from the ``sdist_location`` sdist location
260260 """
@@ -282,7 +282,7 @@ def get_requirements_from_python_manifest(
282282 """
283283 Return a list of parsed requirements from the ``sdist_location`` sdist location
284284 """
285- # Look in requirements file if and only if they are refered in setup.py or setup.cfg
285+ # Look in requirements file if and only if they are referred in setup.py or setup.cfg
286286 # And no deps have been yielded by requirements file.
287287 requirements = list (
288288 get_reqs_from_requirements_file_in_sdist (
@@ -388,7 +388,7 @@ def get_preference(
388388 return transitive , identifier
389389
390390 def get_versions_for_package (
391- self , name : str , repo : Union [ List [ PypiSimpleRepository ], None ] = None
391+ self , name : str , repo : Optional [ PypiSimpleRepository ] = None
392392 ) -> List [Version ]:
393393 """
394394 Return a list of versions for a package.
@@ -442,7 +442,7 @@ def get_versions_for_package_from_pypi_json_api(self, name: str) -> List[Version
442442
443443 def get_requirements_for_package (
444444 self , purl : PackageURL , candidate : Candidate
445- ) -> Generator [Requirement , None , None ]:
445+ ) -> Iterable [Requirement ]:
446446 """
447447 Yield requirements for a package.
448448 """
@@ -524,7 +524,7 @@ def get_requirements_for_package_from_pypi_simple(
524524
525525 def get_requirements_for_package_from_pypi_json_api (
526526 self , purl : PackageURL
527- ) -> List [Requirement ]:
527+ ) -> Iterable [Requirement ]:
528528 """
529529 Return requirements for a package from the PyPI.org JSON API
530530 """
@@ -548,7 +548,7 @@ def get_candidates(
548548 bad_versions : List [str ],
549549 name : str ,
550550 extras : Dict ,
551- ) -> Generator [Candidate , None , None ]:
551+ ) -> Iterable [Candidate ]:
552552 """
553553 Generate candidates for the given identifier. Overridden.
554554 """
@@ -574,7 +574,7 @@ def _iter_matches(
574574 incompatibilities : Dict ,
575575 ) -> Generator [Candidate , None , None ]:
576576 """
577- Yield candidates for the given identifier, requirements and incompatibilities
577+ Yield candidates for the given identifier, requirements and incompatibilities.
578578 """
579579 name = remove_extras (identifier = identifier )
580580 bad_versions = {c .version for c in incompatibilities [identifier ]}
0 commit comments