Merge pull request #5777 from SimonEbner/pathlib_stem
Use pathlib.stem instead of str(x).ends_with
This commit is contained in:
commit
b4bedc22d7
@ -91,7 +91,7 @@ class IResolver:
|
|||||||
logger.debug(f"Searching for {cls.object_type.__name__} {object_name} in '{directory}'")
|
logger.debug(f"Searching for {cls.object_type.__name__} {object_name} in '{directory}'")
|
||||||
for entry in directory.iterdir():
|
for entry in directory.iterdir():
|
||||||
# Only consider python files
|
# Only consider python files
|
||||||
if not str(entry).endswith('.py'):
|
if entry.suffix != '.py':
|
||||||
logger.debug('Ignoring %s', entry)
|
logger.debug('Ignoring %s', entry)
|
||||||
continue
|
continue
|
||||||
if entry.is_symlink() and not entry.is_file():
|
if entry.is_symlink() and not entry.is_file():
|
||||||
@ -169,7 +169,7 @@ class IResolver:
|
|||||||
objects = []
|
objects = []
|
||||||
for entry in directory.iterdir():
|
for entry in directory.iterdir():
|
||||||
# Only consider python files
|
# Only consider python files
|
||||||
if not str(entry).endswith('.py'):
|
if entry.suffix != '.py':
|
||||||
logger.debug('Ignoring %s', entry)
|
logger.debug('Ignoring %s', entry)
|
||||||
continue
|
continue
|
||||||
module_path = entry.resolve()
|
module_path = entry.resolve()
|
||||||
|
Loading…
Reference in New Issue
Block a user