Simplify spec_matches_module_path
This commit is contained in:
parent
fddb7db189
commit
24c7d2c2a0
|
@ -650,11 +650,11 @@ def spec_matches_module_path(
|
|||
module_spec: Optional[ModuleSpec], module_path: Path
|
||||
) -> bool:
|
||||
"""Return true if the given ModuleSpec can be used to import the given module path."""
|
||||
if module_spec is not None and module_spec.origin is not None:
|
||||
if Path(module_spec.origin) == module_path:
|
||||
return True
|
||||
if module_spec is None or module_spec.origin is None:
|
||||
return False
|
||||
|
||||
return Path(module_spec.origin) == module_path
|
||||
|
||||
|
||||
# Implement a special _is_same function on Windows which returns True if the two filenames
|
||||
# compare equal, to circumvent os.path.samefile returning False for mounts in UNC (#7678).
|
||||
|
|
Loading…
Reference in New Issue