Coverage for django_querycache/type_annotations.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

22 statements  

1from typing import Any, Dict, List, Optional, Tuple, TypedDict, Union 

2 

3 

4class IndicatorRow(TypedDict): 

5 """ 

6 Type hinting for the input to 'indicator_table' objects 

7 """ 

8 

9 value: Optional[Union[str, int, float]] 

10 name: Optional[str] 

11 group: Optional[str] 

12 

13 

14class IndicatorTable(TypedDict): 

15 groups: Optional[List[str]] 

16 rows: List[IndicatorRow] 

17 

18 

19# The formal specifications for these types 

20# can be found at 

21# https://datatracker.ietf.org/doc/html/rfc7946#section-3.2 

22 

23 

24Position = Tuple[float, float] 

25PositionWithElevation = Tuple[float, float, float] 

26 

27CoordsSinglePart = Union[List[Position], List[PositionWithElevation]] 

28CoordsMultiPart = List[CoordsSinglePart] 

29 

30 

31class Geometry(TypedDict): 

32 type: str 

33 coordinates: Union[CoordsSinglePart, CoordsMultiPart] 

34 

35 

36class Feature(TypedDict): 

37 geometry: Geometry 

38 properties: Dict[str, Any] 

39 type: str 

40 # Note that a Feature may also allow arbitrary additional data 

41 # which can't be handled by mypy 

42 

43 

44class FeatureCollection(TypedDict): 

45 type: str 

46 features: List[Feature]