Skip to content

Commit

Permalink
Revert some modern type annotations for supporting Python 3.8 (#694)
Browse files Browse the repository at this point in the history
Signed-off-by: F.N. Claessen <felix@seita.nl>
  • Loading branch information
Flix6x committed May 22, 2023
1 parent da6fdf7 commit 877991f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions flexmeasures/auth/policy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

# Use | instead of Union when FM stops supporting Python 3.9 (because of https://github.com/python/cpython/issues/86399)
from typing import Union
# Use | instead of Union, list instead of List and tuple instead of Tuple when FM stops supporting Python 3.9 (because of https://github.com/python/cpython/issues/86399)
from typing import List, Tuple, Union

from flask import current_app
from flask_security import current_user
Expand All @@ -16,7 +16,7 @@
# constants to allow access to certain groups
EVERY_LOGGED_IN_USER = "every-logged-in-user"

PRINCIPALS_TYPE = Union[str, tuple[str], list[Union[str, tuple[str]]]]
PRINCIPALS_TYPE = Union[str, Tuple[str], List[Union[str, Tuple[str]]]]


class AuthModelMixin(object):
Expand Down
18 changes: 9 additions & 9 deletions flexmeasures/data/services/time_series.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

# Use | instead of Union when FM stops supporting Python 3.9 (because of https://github.com/python/cpython/issues/86399)
from typing import Any, Callable, Optional, Union
# Use | instead of Union, list instead of List and tuple instead of Tuple when FM stops supporting Python 3.9 (because of https://github.com/python/cpython/issues/86399)
from typing import Any, Callable, List, Optional, Tuple, Union
from datetime import datetime, timedelta

import inflect
Expand All @@ -22,14 +22,14 @@
# Signature of a callable that build queries
QueryCallType = Callable[
[
tuple[str],
tuple[datetime, datetime],
tuple[Optional[timedelta], Optional[timedelta]],
tuple[Optional[datetime], Optional[datetime]],
Tuple[str],
Tuple[datetime, datetime],
Tuple[Optional[timedelta], Optional[timedelta]],
Tuple[Optional[datetime], Optional[datetime]],
Optional[datetime],
Optional[Union[int, list[int]]],
Optional[list[str]],
Optional[list[str]],
Optional[Union[int, List[int]]],
Optional[List[str]],
Optional[List[str]],
],
Query,
]
Expand Down

0 comments on commit 877991f

Please sign in to comment.