ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/opt/alt/python37/lib/python3.7/site-packages/prospector/ |
Upload File : |
import os
def is_virtualenv(path):
if os.name == 'nt':
# Windows!
clues = ('Scripts', 'lib', 'include')
else:
clues = ('bin', 'lib', 'include')
try:
dircontents = os.listdir(path)
except (OSError, TypeError):
# listdir failed, probably due to path length issues in windows
return False
if not all([clue in dircontents for clue in clues]):
# we don't have the 3 directories which would imply
# this is a virtualenvironment
return False
if not all([os.path.isdir(os.path.join(path, clue)) for clue in clues]):
# some of them are not actually directories
return False
# if we do have all three directories, make sure that it's not
# just a coincidence by doing some heuristics on the rest of
# the directory
if len(dircontents) > 7:
# if there are more than 7 things it's probably not a virtualenvironment
return False
return True