mirror of https://github.com/tLDP/python-tldp
remove references to unused statinfo stuff
This commit is contained in:
parent
5ca7ee9a16
commit
af80925d70
|
@ -19,6 +19,7 @@ from tldp.utils import statfile, statfiles, stem_and_ext
|
|||
from tldp.utils import arg_isexecutable, isexecutable
|
||||
from tldp.utils import arg_isreadablefile, isreadablefile
|
||||
from tldp.utils import arg_isdirectory, arg_isloglevel
|
||||
from tldp.utils import arg_isstr
|
||||
from tldp.utils import swapdirs
|
||||
|
||||
|
||||
|
@ -54,6 +55,12 @@ class Test_isreadablefile_and_friends(unittest.TestCase):
|
|||
self.assertIsNone(arg_isreadablefile(f.name))
|
||||
|
||||
|
||||
class Test_arg_isstr(unittest.TestCase):
|
||||
|
||||
def test_arg_isstr(self):
|
||||
self.assertEqual('s', arg_isstr('s'))
|
||||
self.assertEqual(None, arg_isstr(7))
|
||||
|
||||
class Test_arg_isloglevel(unittest.TestCase):
|
||||
|
||||
def test_arg_isloglevel_integer(self):
|
||||
|
@ -247,11 +254,5 @@ class Test_swapdirs(TestToolsFilesystem):
|
|||
self.assertTrue(os.path.exists(b))
|
||||
self.assertTrue(os.path.exists(bfile))
|
||||
|
||||
|
||||
class Test_att_statinfo(unittest.TestCase):
|
||||
|
||||
def test_max_mtime(self):
|
||||
pass
|
||||
|
||||
#
|
||||
# -- end of file
|
||||
|
|
|
@ -229,7 +229,7 @@ def isstr(s):
|
|||
unicode
|
||||
stringy = (str, unicode)
|
||||
except NameError:
|
||||
stringy = (str,)
|
||||
stringy = (str,) # -- python3
|
||||
return isinstance(s, stringy)
|
||||
|
||||
|
||||
|
@ -349,39 +349,5 @@ def fileinfo(name, relative=None, func=statfile):
|
|||
del info[relpath]
|
||||
return info
|
||||
|
||||
|
||||
def att_statinfo(statinfo, attr='st_mtime', func=max):
|
||||
if statinfo:
|
||||
return func([getattr(v, attr) for v in statinfo.values()])
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
max_size = functools.partial(att_statinfo, attr='st_size', func=max)
|
||||
min_size = functools.partial(att_statinfo, attr='st_size', func=min)
|
||||
|
||||
max_mtime = functools.partial(att_statinfo, attr='st_mtime', func=max)
|
||||
min_mtime = functools.partial(att_statinfo, attr='st_mtime', func=min)
|
||||
|
||||
max_ctime = functools.partial(att_statinfo, attr='st_ctime', func=max)
|
||||
min_ctime = functools.partial(att_statinfo, attr='st_ctime', func=min)
|
||||
|
||||
max_atime = functools.partial(att_statinfo, attr='st_atime', func=max)
|
||||
min_atime = functools.partial(att_statinfo, attr='st_atime', func=min)
|
||||
|
||||
|
||||
def sieve(operand, statinfo, attr='st_mtime', func=operator.gt):
|
||||
result = set()
|
||||
for fname, stbuf in statinfo.items():
|
||||
if func(getattr(stbuf, attr), operand):
|
||||
result.add(fname)
|
||||
return result
|
||||
|
||||
mtime_gt = functools.partial(sieve, attr='st_mtime', func=operator.gt)
|
||||
mtime_lt = functools.partial(sieve, attr='st_mtime', func=operator.lt)
|
||||
|
||||
size_gt = functools.partial(sieve, attr='st_size', func=operator.gt)
|
||||
size_lt = functools.partial(sieve, attr='st_size', func=operator.lt)
|
||||
|
||||
#
|
||||
# -- end of file
|
||||
|
|
Loading…
Reference in New Issue