mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Replace Optional["T"] with "T | None"
In Python 3.10 strings don't support the | operator, so ruff doesn't attempt to fix these. Quote the entire type specification to avoid the typing.Optional import. Alternatives I considered: - leaving it as is (only use of Optional in the code base) - using `from future import __annotations__` (replacing one import with another one)
This commit is contained in:
parent
fe38515ad0
commit
1d5924c82f
1 changed files with 1 additions and 3 deletions
|
|
@ -11,8 +11,6 @@ See the COPYRIGHT file distributed with this work for additional
|
|||
information regarding copyright ownership.
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import abc
|
||||
|
||||
import dns.name
|
||||
|
|
@ -37,7 +35,7 @@ class ResponseSpoofer(ResponseHandler, abc.ABC):
|
|||
cls.spoofers[mode] = cls
|
||||
|
||||
@classmethod
|
||||
def get_spoofer(cls, mode: str) -> Optional["ResponseSpoofer"]:
|
||||
def get_spoofer(cls, mode: str) -> "ResponseSpoofer | None":
|
||||
try:
|
||||
return cls.spoofers[mode]()
|
||||
except KeyError:
|
||||
|
|
|
|||
Loading…
Reference in a new issue