Skip to content

Commit

Permalink
Make annotations compatible with Python 3.9
Browse files Browse the repository at this point in the history
Fixes: #544
  • Loading branch information
WhyNotHugo committed Oct 29, 2023
1 parent 31a96d4 commit 16a4983
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# noqa: INP001
from __future__ import annotations

from typing import Iterator

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ target-version = "py38"

[tool.ruff.isort]
force-single-line = true
required-imports = ["from __future__ import annotations"]

[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import time
from datetime import datetime
Expand Down
2 changes: 2 additions & 0 deletions tests/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

__all__ = [
"pyicu_sensitive",
]
Expand Down
2 changes: 2 additions & 0 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from datetime import date
from datetime import datetime

Expand Down
2 changes: 2 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import datetime
import sys
from os.path import exists
Expand Down
2 changes: 2 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from unittest.mock import patch

import pytest
Expand Down
2 changes: 2 additions & 0 deletions tests/test_filtering.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from datetime import datetime
from datetime import timedelta
from uuid import uuid4
Expand Down
2 changes: 2 additions & 0 deletions tests/test_formatter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from datetime import date
from datetime import datetime
from datetime import time
Expand Down
2 changes: 2 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import sys
from subprocess import PIPE
Expand Down
2 changes: 2 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from datetime import date
from datetime import datetime
from datetime import timedelta
Expand Down
2 changes: 2 additions & 0 deletions tests/test_porcelain.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import json
from datetime import datetime
from uuid import uuid4
Expand Down
2 changes: 2 additions & 0 deletions tests/test_ui.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from datetime import datetime
from unittest import mock

Expand Down
2 changes: 2 additions & 0 deletions tests/test_widgets.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from unittest import mock

from todoman.widgets import ExtendedEdit
Expand Down
2 changes: 2 additions & 0 deletions todoman/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from todoman import version # type: ignore[attr-defined]

__version__ = version.version
Expand Down
2 changes: 2 additions & 0 deletions todoman/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from todoman.cli import cli

if __name__ == "__main__":
Expand Down
5 changes: 3 additions & 2 deletions todoman/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import contextlib
import functools
import glob
Expand All @@ -7,7 +9,6 @@
from datetime import datetime
from datetime import timedelta
from os.path import isdir
from typing import Tuple

import click
import click_log
Expand Down Expand Up @@ -97,7 +98,7 @@ def _validate_priority_param(ctx, param, val):
raise click.BadParameter(e) from None


def _validate_start_date_param(ctx, param, val) -> Tuple[bool, datetime] | None:
def _validate_start_date_param(ctx, param, val) -> tuple[bool, datetime] | None:
ctx = ctx.find_object(AppContext)
if not val:
return None
Expand Down
3 changes: 3 additions & 0 deletions todoman/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from __future__ import annotations


class TodomanError(Exception):
"""
Base class for all our exceptions.
Expand Down
2 changes: 2 additions & 0 deletions todoman/interactive.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import urwid

from todoman import widgets
Expand Down
2 changes: 2 additions & 0 deletions todoman/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from __future__ import annotations

import re
from typing import Callable

Expand Down

0 comments on commit 16a4983

Please sign in to comment.