remove unneded code and remarks, added needed except clause

This commit is contained in:
Emmo Emminghaus 2018-11-10 21:56:39 +01:00
parent 558ca61d20
commit 973921df5a
5 changed files with 6 additions and 12 deletions

View file

@ -15,8 +15,6 @@ def check_python():
required_funcs = {os.stat, os.utime, os.chown}
if not os.supports_follow_symlinks.issuperset(required_funcs):
raise PythonLibcTooOld
pass
class ExtensionModuleError(Error):

View file

@ -1,10 +1,8 @@
import errno
import os
# begin moved form helpers/usergroup.py
import grp
import pwd
from functools import lru_cache
# end moved
from libc.errno cimport errno as c_errno
@ -67,7 +65,6 @@ def local_pid_alive(pid):
# Any other error (eg. permissions) means that the process ID refers to a live process.
return True
# begin moved form helpers/usergroup.py
@lru_cache(maxsize=None)
def uid2user(uid, default=None):
@ -114,8 +111,8 @@ def posix_acl_use_stored_uid_gid(acl):
else:
entries.append(entry)
return safe_encode('\n'.join(entries))
#end moved
def getosusername():
"""Return the os user name."""
return uid2user(os.getuid(), os.getuid())
return uid2user(os.getuid())

View file

@ -37,7 +37,7 @@ class BufferTooSmallError(Exception):
def _check(rv, path=None, detect_buffer_too_small=False):
from . import get_errno # circular reference if imported at global level!
from . import get_errno
if rv < 0:
e = get_errno()
if detect_buffer_too_small and e == errno.ERANGE:

View file

@ -3,8 +3,8 @@ import filecmp
import functools
import os
try:
import posix # buildin but not everywhere
except:
import posix
except ImportError:
posix = None
import stat
@ -48,7 +48,7 @@ except ImportError:
has_llfuse = False
# The mtime get/set precision varies on different OS and Python versions
if posix != None and 'HAVE_FUTIMENS' in getattr(posix, '_have_functions', []):
if posix and 'HAVE_FUTIMENS' in getattr(posix, '_have_functions', []):
st_mtime_ns_round = 0
elif 'HAVE_UTIMES' in sysconfig.get_config_vars():
st_mtime_ns_round = -6

View file

@ -54,7 +54,6 @@ class HashIndexTestCase(BaseTestCase):
for x in range(50):
self.assert_raises(KeyError, idx.__delitem__, H(x))
self.assert_equal(len(idx), 50)
idx_name = tempfile.NamedTemporaryFile()
with unopened_tempfile() as filepath:
idx.write(filepath)
del idx