Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-client
Commits
e49ef6f6
Commit
e49ef6f6
authored
Dec 29, 2024
by
Wei Shoulin
Browse files
utils
parent
c79c0d5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_dfs_client/common/utils.py
0 → 100644
View file @
e49ef6f6
from
datetime
import
datetime
import
re
def
is_valid_filename
(
file_name
:
str
)
->
bool
:
pattern
=
r
'^.*\..*$'
if
re
.
match
(
pattern
,
file_name
):
return
True
else
:
raise
False
def
is_valid_datetime_format
(
date_str
:
str
,
format
=
'%Y-%m-%d %H:%M:%S'
)
->
bool
:
try
:
datetime
.
strptime
(
date_str
,
format
)
return
True
except
ValueError
:
raise
ValueError
(
f
"Incorrect data format, should be
{
format
}
"
)
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment