Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
used.
Defaults to ``os.sep``
:type path: str
:param path: A path to check for the most common sep
:rtype: str
"""
sep = os.sep
count = 0
for nextSep in ('/', '\\'):
if path.count(nextSep) > count:
sep = nextSep
return sep
utils._getPathSep = _getCommonPathSep
class TestUtils(unittest.TestCase):
def testXrange(self):
# Test that a platform-specific xrange does not produce OverflowError
xrng = utils.xrange(1, sys.maxsize)
self.assertTrue(len(xrng) != 0)
class TestFrameSet(unittest.TestCase):
def testFloatFrameValues(self):
table = [
([1, 5.8, 10], [1, 5, 10]),
([1.5, 5, 10.2], [1, 5, 10]),
def setDirname(self, dirname):
"""
Set a new directory name for the sequence.
Args:
dirname (str): the new directory name
"""
# Make sure the dirname always ends in
# a path separator character
dirname = utils.asString(dirname)
sep = utils._getPathSep(dirname)
if not dirname.endswith(sep):
dirname = futils.native_str(dirname) + sep
self._dir = dirname
if not include_hidden:
files = filter(_not_hidden, files)
# Filter by files that match the provided file pattern
if _match_pattern:
files = filter(_match_pattern, files)
# Filter by files that match the frame padding in the file pattern
if _filter_padding:
# returns a generator
files = _filter_padding(files)
# Ensure our dirpath ends with a path separator, so
# that we can control which sep is used during the
# os.path.join
sep = utils._getPathSep(dirpath)
if not dirpath.endswith(sep):
dirpath += sep
files = (_join(dirpath, f) for f in files)
files = list(files)
seqs = list(FileSequence.yield_sequences_in_list(files))
if _filter_padding and seq:
pad = cls.conformPadding(seq.padding())
# strict padding should preserve the original padding
# characters in the found sequences.
for s in seqs:
s.setPadding(pad)
return seqs