Skip to content

Commit

Permalink
Restrict the start chars SPLIT_PATTERN can match (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
walrusVision authored and justinfx committed Jul 19, 2017
1 parent 75ddf60 commit 23614a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fileseq/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Example: /film/shot/renders/[email protected]
# Example: /film/shot/renders/bilbo_bty.1-100@@@@#.exr
# Example: /film/shot/renders/bilbo_bty.1-100%04d.exr
SPLIT_PATTERN = r"([-:,xy\d]*)([{0}]+|%\d+d)".format(''.join(PAD_MAP.keys()))
SPLIT_PATTERN = r"((?:[-\d][-:,xy\d]*)?)([{0}]+|%\d+d)".format(''.join(PAD_MAP.keys()))
SPLIT_RE = re.compile(SPLIT_PATTERN)

# Regular expression pattern for matching padding against a printf syntax
Expand Down
9 changes: 9 additions & 0 deletions test/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,15 @@ def test_yield_sequences_in_list(self):
])
self.assertEquals(actual, expected)

def testIgnoreFrameSetStrings(self):
for char in "xy:,".split():
fs = FileSequence("/path/to/file{0}1-1x1#.exr".format(char))
self.assertEquals(fs.basename(), "file{0}".format(char))
self.assertEquals(fs.start(), 1)
self.assertEquals(fs.end(), 1)
self.assertEquals(fs.padding(), '#')
self.assertEquals(str(fs), "/path/to/file{0}1-1x1#.exr".format(char))

class TestFindSequencesOnDisk(TestBase):

def testFindSequencesOnDisk(self):
Expand Down

0 comments on commit 23614a8

Please sign in to comment.