Skip to content

Commit

Permalink
Fix type annotation syntax for Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMStraub authored and Nick-Hall committed Feb 6, 2025
1 parent 4c40d01 commit 1e572e4
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions gramps/gen/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from __future__ import annotations

from typing import NewType, Type, TypeVar
from typing import NewType, Type, TypeVar, Union

from .lib import (
Citation,
Expand All @@ -49,18 +49,18 @@
MediaHandle = NewType("MediaHandle", str)
NoteHandle = NewType("NoteHandle", str)
TagHandle = NewType("TagHandle", str)
PrimaryObjectHandle = (
PersonHandle
| FamilyHandle
| EventHandle
| PlaceHandle
| SourceHandle
| RepositoryHandle
| CitationHandle
| MediaHandle
| NoteHandle
)
AnyHandle = PrimaryObjectHandle | TagHandle
PrimaryObjectHandle = Union[
PersonHandle,
FamilyHandle,
EventHandle,
PlaceHandle,
SourceHandle,
RepositoryHandle,
CitationHandle,
MediaHandle,
NoteHandle,
]
AnyHandle = Union[PrimaryObjectHandle, TagHandle]
TableObjectType = TypeVar("TableObjectType", bound=TableObject)

PersonGrampsID = NewType("PersonGrampsID", str)
Expand All @@ -73,15 +73,15 @@
MediaGrampsID = NewType("MediaGrampsID", str)
NoteGrampsID = NewType("NoteGrampsID", str)
# No Tag IDs
PrimaryObjectGrampsID = (
PersonGrampsID
| FamilyGrampsID
| EventGrampsID
| PlaceGrampsID
| SourceGrampsID
| RepositoryGrampsID
| CitationGrampsID
| MediaGrampsID
| NoteGrampsID
)
PrimaryObjectGrampsID = Union[
PersonGrampsID,
FamilyGrampsID,
EventGrampsID,
PlaceGrampsID,
SourceGrampsID,
RepositoryGrampsID,
CitationGrampsID,
MediaGrampsID,
NoteGrampsID,
]
AnyGrampsID = PrimaryObjectGrampsID # No Tag IDs

0 comments on commit 1e572e4

Please sign in to comment.