Use pathlib.stem instead of str(x).ends_with

This commit is contained in:
Simon Ebner 2021-10-23 12:25:09 +02:00
parent 96f99699e0
commit fde10f5395
1 changed files with 2 additions and 2 deletions

View File

@ -91,7 +91,7 @@ class IResolver:
logger.debug(f"Searching for {cls.object_type.__name__} {object_name} in '{directory}'")
for entry in directory.iterdir():
# Only consider python files
if not str(entry).endswith('.py'):
if entry.suffix != '.py':
logger.debug('Ignoring %s', entry)
continue
if entry.is_symlink() and not entry.is_file():
@ -169,7 +169,7 @@ class IResolver:
objects = []
for entry in directory.iterdir():
# Only consider python files
if not str(entry).endswith('.py'):
if entry.suffix != '.py':
logger.debug('Ignoring %s', entry)
continue
module_path = entry.resolve()