generated from MinBZK/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acb831a
commit 1be023d
Showing
5 changed files
with
61 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,14 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: PROJECT VERSION\n" | ||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||
"POT-Creation-Date: 2024-10-20 20:26+0200\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"POT-Creation-Date: 0001-01-01 00:00+0000\n" | ||
"PO-Revision-Date: 0001-01-01 00:00+0000\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Babel 2.16.0\n" | ||
"Generated-By: Babel 2.15.0\n" | ||
|
||
#: amt/api/ai_act_profile.py:24 | ||
msgid "Type" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,16 +7,16 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: PROJECT VERSION\n" | ||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||
"POT-Creation-Date: 2024-10-20 20:26+0200\n" | ||
"PO-Revision-Date: 2024-07-25 21:01+0200\n" | ||
"POT-Creation-Date: 0001-01-01 00:00+0000\n" | ||
"PO-Revision-Date: 0001-01-01 00:00+0000\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language: en_US\n" | ||
"Language-Team: en_US <[email protected]>\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Babel 2.16.0\n" | ||
"Generated-By: Babel 2.15.0\n" | ||
|
||
#: amt/api/ai_act_profile.py:24 | ||
msgid "Type" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,16 +7,16 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: PROJECT VERSION\n" | ||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||
"POT-Creation-Date: 2024-10-20 20:26+0200\n" | ||
"PO-Revision-Date: 2024-07-25 21:01+0200\n" | ||
"POT-Creation-Date: 0001-01-01 00:00+0000\n" | ||
"PO-Revision-Date: 0001-01-01 00:00+0000\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language: nl_NL\n" | ||
"Language-Team: nl_NL <[email protected]>\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Babel 2.16.0\n" | ||
"Generated-By: Babel 2.15.0\n" | ||
|
||
#: amt/api/ai_act_profile.py:24 | ||
msgid "Type" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
from datetime import MINYEAR, UTC, datetime | ||
|
||
from babel.messages import pofile | ||
|
||
|
||
def remove_timestamps(filename: str) -> bool: | ||
with open(filename, "rb") as f: | ||
catalog = pofile.read_po(f) | ||
|
||
modified = False | ||
if catalog.creation_date or catalog.revision_date: | ||
min_datetime = datetime(MINYEAR, 1, 1, 0, 0, 0, 0, tzinfo=UTC) | ||
if catalog.creation_date == min_datetime and catalog.revision_date == min_datetime: | ||
return modified | ||
catalog.creation_date = min_datetime | ||
catalog.revision_date = min_datetime | ||
modified = True | ||
|
||
if modified: | ||
with open(filename, "wb") as f: | ||
pofile.write_po(f, catalog, ignore_obsolete=True, include_previous=True) | ||
|
||
return modified | ||
|
||
|
||
def main() -> int: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("filenames", nargs="*") | ||
args = parser.parse_args() | ||
|
||
return_code = 0 | ||
for filename in args.filenames: | ||
if remove_timestamps(filename): | ||
print(f"Removed timestamps from {filename}") | ||
return_code = 1 | ||
return return_code | ||
|
||
|
||
if __name__ == "__main__": | ||
exit(main()) |