diff options
| author | robot-piglet <[email protected]> | 2026-03-24 22:03:23 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2026-03-24 22:34:09 +0300 |
| commit | 6092233e61d1dc129fe1eb007399cc192c5ceb59 (patch) | |
| tree | 90522e5b7449e5cdb06bd24eafb333b9e9d3e9f1 /contrib/python/fonttools/fontTools/diff/utils.py | |
| parent | c8c3fda4b2e47ceaad9790b7a5fb192110162f15 (diff) | |
Intermediate changes
commit_hash:5e2a2254279501ad2bde571fbd53c1a27a00e898
Diffstat (limited to 'contrib/python/fonttools/fontTools/diff/utils.py')
| -rw-r--r-- | contrib/python/fonttools/fontTools/diff/utils.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/python/fonttools/fontTools/diff/utils.py b/contrib/python/fonttools/fontTools/diff/utils.py new file mode 100644 index 00000000000..aed97063636 --- /dev/null +++ b/contrib/python/fonttools/fontTools/diff/utils.py @@ -0,0 +1,28 @@ +import os +from datetime import datetime, timezone +from typing import List, Optional, Text, Union + + +def file_exists(path: Union[bytes, str, "os.PathLike[Text]"]) -> bool: + """Validates file path as existing local file""" + return os.path.isfile(path) + + +def get_file_modtime(path: Union[bytes, str, "os.PathLike[Text]"]) -> Text: + """Returns ISO formatted file modification time in local system timezone""" + return ( + datetime.fromtimestamp(os.stat(path).st_mtime, timezone.utc) + .astimezone() + .isoformat() + ) + + +def get_tables_argument_list(table_list: Optional[List[Text]]) -> Optional[List[Text]]: + """Converts a list of OpenType table string into a Python list or + return None if the table_list was not defined (i.e., it was not included + in an option on the command line). Tables that are composed of three + characters must be right padded with a space.""" + if table_list is None: + return None + else: + return [table.ljust(4) for table in table_list] |
