1 # SPDX-License-Identifier: GPL-3.0-or-later
 
   3 # This file is part of Nominatim. (https://nominatim.org)
 
   5 # Copyright (C) 2024 by the Nominatim developer community.
 
   6 # For a full list of authors see the git log.
 
   8 Type definitions for typing annotations.
 
  10 Complex type definitions are moved here, to keep the source files readable.
 
  12 from typing import Any, Union, Mapping, TypeVar, Sequence, TYPE_CHECKING
 
  18 StrPath = Union[str, 'os.PathLike[str]']
 
  20 SysEnv = Mapping[str, str]
 
  22 # psycopg-related types
 
  24 T_ResultKey = TypeVar('T_ResultKey', int, str)
 
  27 class DictCursorResult(Mapping[str, Any]):
 
  28     def __getitem__(self, x: Union[int, str]) -> Any: ...
 
  31 DictCursorResults = Sequence[DictCursorResult]
 
  33 # The following typing features require typing_extensions to work
 
  34 # on all supported Python versions.
 
  35 # Only require this for type checking but not for normal operations.
 
  38     from typing_extensions import (Protocol as Protocol,
 
  40                                    TypedDict as TypedDict)