Skip to content

Commit

Permalink
🔖 version 0.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Aug 6, 2024
1 parent d9b48f1 commit 05c9318
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "tarina"
version = "0.5.4"
version = "0.5.5"
description = "A collection of common utils for Arclet"
authors = [
{name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com"},
Expand Down
10 changes: 5 additions & 5 deletions src/tarina/lang/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"""


def new(*_):
i18n_dir = Path.cwd() / "i18n"
if i18n_dir.exists():
Expand Down Expand Up @@ -191,7 +192,6 @@ def model(*_):
print(f"model for lang file {'created' if created else 'updated'}. Now you can create or update your lang files.")



def create(args):
root = Path.cwd()
if args.yaml:
Expand All @@ -200,10 +200,10 @@ def create(args):
with lang_file.open("w+") as f:
f.write(LANG_TEMPLATE_YAML)
else:
lang_file = root / f"{args.name}.json"
lang_file = root / f"{args.name}.json"

with lang_file.open("w+") as f:
f.write(LANG_TEMPLATE_JSON)
with lang_file.open("w+") as f:
f.write(LANG_TEMPLATE_JSON)

print(f"lang file created: {lang_file}")

Expand All @@ -219,7 +219,6 @@ def delete(args):
print(f"lang file not found: {lang_file}")



def main():
parser = ArgumentParser(description="tarina-lang CLI tool")

Expand Down Expand Up @@ -257,5 +256,6 @@ def main():
else:
parser.print_help()


if __name__ == "__main__":
main()
5 changes: 3 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,14 @@ def add_user(user: User):


def test_date_parser():
from datetime import datetime
from datetime import datetime, timedelta

from tarina import DateParser

assert DateParser.parse("2021-01-01") == datetime(2021, 1, 1)
assert DateParser.parse("2021-01-01 12:34:56") == datetime(2021, 1, 1, 12, 34, 56)

assert DateParser.parse("1m") == datetime.now() + timedelta(minutes=1)
assert DateParser.parse("h3") == datetime.now() + timedelta(hours=3)

def test_safe_eval():
from tarina import safe_eval
Expand Down

0 comments on commit 05c9318

Please sign in to comment.