Skip to content

Commit

Permalink
Fix regexp definition and test
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed May 22, 2024
1 parent 3e37cb2 commit 9cbf186
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions photo_importer/fileprop.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
class FileProp(object):
DATE_REGEX = [
(
re.compile('\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}'),
re.compile(r'\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}'),
'%Y-%m-%d_%H-%M-%S',
),
(
re.compile('\d{4}-\d{2}-\d{2}-\d{2}-\d{2}-\d{2}'),
re.compile(r'\d{4}-\d{2}-\d{2}-\d{2}-\d{2}-\d{2}'),
'%Y-%m-%d-%H-%M-%S',
),
(
re.compile('\d{4}-\d{2}-\d{2}T\d{2}.\d{2}.\d{2}'),
re.compile(r'\d{4}-\d{2}-\d{2}T\d{2}.\d{2}.\d{2}'),
'%Y-%m-%dT%H.%M.%S',
),
(
re.compile('\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}'),
re.compile(r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}'),
'%Y-%m-%dT%H:%M:%S',
),
(
re.compile('\d{4}_\d{2}_\d{2}_\d{2}_\d{2}_\d{2}'),
re.compile(r'\d{4}_\d{2}_\d{2}_\d{2}_\d{2}_\d{2}'),
'%Y_%m_%d_%H_%M_%S',
),
(re.compile('\d{8}_\d{6}'), '%Y%m%d_%H%M%S'),
(re.compile('\d{14}'), '%Y%m%d%H%M%S'),
(re.compile('\d{8}'), '%Y%m%d'),
(re.compile(r'\d{8}_\d{6}'), '%Y%m%d_%H%M%S'),
(re.compile(r'\d{14}'), '%Y%m%d%H%M%S'),
(re.compile(r'\d{8}'), '%Y%m%d'),
]

SPACE_REGEX = re.compile(r'\s+')
Expand Down
2 changes: 1 addition & 1 deletion photo_importer/importer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ def test_importer(self):
self.assertEqual(
files[1],
os.path.join(
tmpdirname, 'Foto/2022/2022-11-21/2022-11-21_00-42-07.JPG'
tmpdirname, 'Foto/2022/2022-11-21/2022-11-21_00-42-07.jpg'
),
)

0 comments on commit 9cbf186

Please sign in to comment.