Skip to content

Commit 69699d9

Browse files
committed
Fabrication of the code moved functions in folders.py
1 parent 054a98b commit 69699d9

File tree

3 files changed

+324
-207
lines changed

3 files changed

+324
-207
lines changed

datashuttle/configs/canonical_tags.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,25 @@ def tags(tag_name: str) -> str:
1818
return tags[tag_name]
1919

2020

21-
_DATETIME_FORMATS = {
22-
"datetime": "%Y%m%dT%H%M%S",
23-
"time": "%H%M%S",
24-
"date": "%Y%m%d",
25-
}
21+
def get_datetime_formats() -> dict:
22+
"""
23+
Get all datetime format strings.
24+
25+
Returns
26+
-------
27+
dict
28+
A dictionary containing format strings for datetime, time, and date
29+
"""
30+
return {
31+
"datetime": "%Y%m%dT%H%M%S",
32+
"time": "%H%M%S",
33+
"date": "%Y%m%d",
34+
}
2635

2736

2837
def get_datetime_format(format_type: str) -> str:
2938
"""
30-
Get the datetime format string for a given format type.
39+
Get the datetime format string for a specific format type.
3140
3241
Parameters
3342
----------
@@ -37,14 +46,8 @@ def get_datetime_format(format_type: str) -> str:
3746
Returns
3847
-------
3948
str
40-
The format string for the specified type
41-
42-
Raises
43-
------
44-
ValueError
45-
If format_type is not one of the supported types
49+
The format string for the specified format type
4650
"""
47-
if format_type not in _DATETIME_FORMATS:
48-
raise ValueError(f"Invalid format type: {format_type}. Must be one of {list(_DATETIME_FORMATS.keys())}")
49-
return _DATETIME_FORMATS[format_type]
51+
formats = get_datetime_formats()
52+
return formats[format_type]
5053

0 commit comments

Comments
 (0)