Skip to content

Commit

Permalink
Fix typing related syntax-errors for 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbueno committed Nov 15, 2024
1 parent 638ea8a commit ff9431b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions extracontext/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Self
# from typing import Self


class ContextLocal:
_backend_registry: dict[str, type[Self]] = {}
_backend_registry: dict[str, type["ContextLocal"]] = {}

def __new__(cls, *args, backend=None, **kwargs):
if backend is None:
Expand Down
5 changes: 3 additions & 2 deletions extracontext/mapping.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections.abc import Mapping, MutableMapping
from typing import Optional

from .base import ContextLocal
from .contextlocal import PyContextLocal
Expand Down Expand Up @@ -48,7 +49,7 @@ class PyContextMap(ContextMap, PyContextLocal):
_backend_key = "python"
_BASEDIST = 1

def __init__(self, initial: None | Mapping = None, *, backend=None):
def __init__(self, initial: Optional[Mapping] = None, *, backend=None):
super().__init__()
if not initial:
return
Expand All @@ -63,7 +64,7 @@ def __init__(self, initial: None | Mapping = None, *, backend=None):
class NativeContextMap(ContextMap, NativeContextLocal):
_backend_key = "native"

def __init__(self, initial: None | Mapping = None, *, backend=None):
def __init__(self, initial: Optional[Mapping] = None, *, backend=None):
super().__init__()
if not initial:
return
Expand Down

0 comments on commit ff9431b

Please sign in to comment.