From 3d9f5f1ba0eaa8ca273a59ee785f66d72765a1ff Mon Sep 17 00:00:00 2001 From: Alvin Wan Date: Sun, 19 Jan 2025 23:51:42 -0800 Subject: [PATCH] Fixes compatibility with python3.8 (#47) * fix compat with python 3.8 * version bump --- setup.py | 4 ++-- timefhuman/renderers.py | 2 -- timefhuman/utils.py | 5 +++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 6b8f6f4..4ea1f4d 100644 --- a/setup.py +++ b/setup.py @@ -24,14 +24,14 @@ def run_tests(self): sys.exit(errno) -VERSION = '0.1.0' +VERSION = '0.1.1' setup( name="timefhuman", version=VERSION, author="Alvin Wan", author_email='hi@alvinwan.com', - description=("Convert natural language date-like string to Python objects"), + description=("Extract datetimes, datetime ranges, and datetime lists from natural language text"), long_description=open('README.md', 'r', encoding='utf-8').read(), long_description_content_type='text/markdown', license="Apache 2.0", diff --git a/timefhuman/renderers.py b/timefhuman/renderers.py index 80f72cf..42bbdbc 100644 --- a/timefhuman/renderers.py +++ b/timefhuman/renderers.py @@ -47,7 +47,6 @@ class tfhCollection(tfhDatelike): def __init__(self, items): self.items = items - @staticmethod def getter(key): def get(self): for item in self.items: @@ -56,7 +55,6 @@ def get(self): return None return get - @staticmethod def setter(key): def set(self, value): for item in self.items: diff --git a/timefhuman/utils.py b/timefhuman/utils.py index cd14f58..7f39218 100644 --- a/timefhuman/utils.py +++ b/timefhuman/utils.py @@ -5,6 +5,7 @@ from lark.lexer import Token from dataclasses import dataclass from enum import Enum +from typing import List MONTHS = [ @@ -72,14 +73,14 @@ def node_to_dict(node: Tree) -> dict: raise ValueError(f"Unknown node type: {type(node)} ({node})") -def nodes_to_dict(nodes: list[Tree]) -> dict: +def nodes_to_dict(nodes: List[Tree]) -> dict: result = {} for node in nodes: result.update(node_to_dict(node)) return result -def nodes_to_multidict(nodes: list[Tree]) -> dict: +def nodes_to_multidict(nodes: List[Tree]) -> dict: result = {} for node in nodes: for key, value in node_to_dict(node).items():