diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-11 08:54:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-11 08:54:35 +0000 |
commit | d1f00706bff58b863b0a1c5bf4adf39d36049d4c (patch) | |
tree | 3a8ecc5d1509d655d5df6b1455bc1e309da2c02c /sqlglot/time.py | |
parent | Releasing debian version 9.0.6-1. (diff) | |
download | sqlglot-d1f00706bff58b863b0a1c5bf4adf39d36049d4c.tar.xz sqlglot-d1f00706bff58b863b0a1c5bf4adf39d36049d4c.zip |
Merging upstream version 10.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/time.py')
-rw-r--r-- | sqlglot/time.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sqlglot/time.py b/sqlglot/time.py index 729b50d..97726b3 100644 --- a/sqlglot/time.py +++ b/sqlglot/time.py @@ -1,9 +1,13 @@ -# the generic time format is based on python time.strftime +import typing as t + +# The generic time format is based on python time.strftime. # https://docs.python.org/3/library/time.html#time.strftime from sqlglot.trie import in_trie, new_trie -def format_time(string, mapping, trie=None): +def format_time( + string: str, mapping: t.Dict[str, str], trie: t.Optional[t.Dict] = None +) -> t.Optional[str]: """ Converts a time string given a mapping. @@ -11,11 +15,16 @@ def format_time(string, mapping, trie=None): >>> format_time("%Y", {"%Y": "YYYY"}) 'YYYY' - mapping: Dictionary of time format to target time format - trie: Optional trie, can be passed in for performance + Args: + mapping: dictionary of time format to target time format. + trie: optional trie, can be passed in for performance. + + Returns: + The converted time string. """ if not string: return None + start = 0 end = 1 size = len(string) |