From a6203dbd703d487dce6ad1736f249f34f69931c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Fri, 4 Jun 2021 17:34:23 +0200 Subject: [PATCH] refactor --- satella/os/misc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/satella/os/misc.py b/satella/os/misc.py index 125869b1..4f37be17 100644 --- a/satella/os/misc.py +++ b/satella/os/misc.py @@ -26,7 +26,8 @@ def whereis(name: str) -> tp.Iterator[str]: for directory in paths_to_look_in: for file in os.listdir(directory): - if 'x' not in stat.filemode(os.stat(os.path.join(directory, file)).st_mode): + path = os.path.join(directory, file) + if 'x' not in stat.filemode(os.stat(path).st_mode): continue if sys.platform.startswith('win'): # a POSIX-specific check @@ -34,7 +35,7 @@ def whereis(name: str) -> tp.Iterator[str]: for extension in available_extensions: if file == '%s%s' % (name, extension): - yield os.path.join(directory, file) + yield path def is_running_as_root() -> bool: -- GitLab