|
1 | 1 | from __future__ import annotations |
2 | | -from collections.abc import Iterable, Iterator, Mapping |
3 | | -from typing import Any, BinaryIO, IO, MutableMapping, Optional, TextIO, TypeVar |
| 2 | +from collections.abc import Iterable, Iterator, Mapping, MutableMapping |
| 3 | +from typing import Any, BinaryIO, IO, TextIO, TypeVar |
4 | 4 | from .reading import load |
5 | 5 | from .writing import dump |
6 | 6 | from .xmlprops import dump_xml, load_xml |
@@ -39,7 +39,7 @@ class Properties(MutableMapping[str, str]): |
39 | 39 | def __init__( |
40 | 40 | self, |
41 | 41 | data: None | Mapping[str, str] | Iterable[tuple[str, str]] = None, |
42 | | - defaults: Optional["Properties"] = None, |
| 42 | + defaults: Properties | None = None, |
43 | 43 | ) -> None: |
44 | 44 | self.data: dict[str, str] = {} |
45 | 45 | #: A `Properties` subobject used as fallback for `getProperty`. Only |
@@ -80,7 +80,7 @@ def __eq__(self, other: Any) -> bool: |
80 | 80 | else: |
81 | 81 | return NotImplemented |
82 | 82 |
|
83 | | - def getProperty(self, key: str, defaultValue: Optional[T] = None) -> str | T | None: |
| 83 | + def getProperty(self, key: str, defaultValue: T | None = None) -> str | T | None: |
84 | 84 | """ |
85 | 85 | Fetch the value associated with the key ``key`` in the `Properties` |
86 | 86 | instance. If the key is not present, `defaults` is checked, and then |
@@ -141,7 +141,7 @@ def setProperty(self, key: str, value: str) -> None: |
141 | 141 | """Equivalent to ``self[key] = value``""" |
142 | 142 | self[key] = value |
143 | 143 |
|
144 | | - def store(self, out: TextIO, comments: Optional[str] = None) -> None: |
| 144 | + def store(self, out: TextIO, comments: str | None = None) -> None: |
145 | 145 | """ |
146 | 146 | Write the `Properties` instance's entries (in unspecified order) in |
147 | 147 | ``.properties`` format to ``out``, including the current timestamp. |
@@ -188,7 +188,7 @@ def loadFromXML(self, inStream: IO) -> None: |
188 | 188 | def storeToXML( |
189 | 189 | self, |
190 | 190 | out: BinaryIO, |
191 | | - comment: Optional[str] = None, |
| 191 | + comment: str | None = None, |
192 | 192 | encoding: str = "UTF-8", |
193 | 193 | ) -> None: |
194 | 194 | """ |
|
0 commit comments