Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert some modern type annotations, to keep support for Python 3.8 #694

Merged
merged 1 commit into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading