replace some typing.* constructs with native ones
This commit is contained in:
@@ -3,23 +3,22 @@ from __future__ import annotations
|
||||
import dataclasses
|
||||
import logging
|
||||
import os.path
|
||||
import typing
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
_cached_config: typing.Optional[Config] = None
|
||||
_cached_config: Config | None = None
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class Config:
|
||||
_source_filename: str
|
||||
controllers: typing.List[str]
|
||||
server_names: typing.List[str]
|
||||
controllers: list[str]
|
||||
server_names: list[str]
|
||||
comm_secret: str
|
||||
cookie_secret: str
|
||||
venue_info_url: typing.Optional[str]
|
||||
venue_info_url: str | None
|
||||
session_timeout: int # in seconds
|
||||
api_port: int
|
||||
controller_port: int
|
||||
@@ -27,7 +26,7 @@ class Config:
|
||||
debug: bool
|
||||
|
||||
@staticmethod
|
||||
def load_default_once(filename: typing.Optional[str] = None) -> Config:
|
||||
def load_default_once(filename: str | None = None) -> Config:
|
||||
global _cached_config
|
||||
if not _cached_config:
|
||||
_cached_config = Config.load(filename)
|
||||
@@ -38,7 +37,7 @@ class Config:
|
||||
return _cached_config
|
||||
|
||||
@staticmethod
|
||||
def load(filename: typing.Optional[str] = None) -> Config:
|
||||
def load(filename: str | None = None) -> Config:
|
||||
if filename is None:
|
||||
for name in ('capport.yaml', '/etc/capport.yaml'):
|
||||
if os.path.exists(name):
|
||||
|
||||
Reference in New Issue
Block a user