aio_taginfo.api.v4.key.stats
/api/4/key/stats
endpoint.
1"""`/api/4/key/stats` endpoint.""" 2 3from aio_taginfo.api.v4 import ObjectType, Response 4from aio_taginfo.api.v4._internal import NonEmptyString, api_get_json, api_params 5 6from aiohttp import ClientSession 7from pydantic import Field 8from pydantic.dataclasses import dataclass 9 10 11__all__ = ( 12 "KeyStats", 13 "call", 14) 15 16 17@dataclass(kw_only=True, frozen=True) 18class KeyStats: 19 """ 20 Database statistics for given key. 21 22 Attributes: 23 type: Object type. 24 count: Number of objects with this type and key. 25 count_fraction: Number of objects in relation to all objects. 26 values: Number of different values for this key. 27 """ 28 29 type: ObjectType = Field(repr=True) 30 count: int = Field(ge=0, repr=True) 31 count_fraction: float = Field(ge=0.0, le=1.0, allow_inf_nan=False, repr=True) 32 values: int = Field(ge=0, repr=True) 33 34 35@dataclass(kw_only=True, frozen=True) 36class _Params: 37 key: NonEmptyString = Field(repr=True) 38 39 40async def call( 41 key: str, 42 session: ClientSession | None = None, 43) -> Response[list[KeyStats]]: 44 """ 45 Show some database statistics for given key. 46 47 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_stats 48 49 Args: 50 key: tag key 51 session: request client session 52 53 Raises: 54 TaginfoError 55 """ 56 return await api_get_json( 57 path="key/stats", 58 cls=Response[list[KeyStats]], 59 session=session, 60 params=api_params(_Params, key=key), 61 ) 62 63 64__docformat__ = "google"
@dataclass(kw_only=True, frozen=True)
class
KeyStats:
18@dataclass(kw_only=True, frozen=True) 19class KeyStats: 20 """ 21 Database statistics for given key. 22 23 Attributes: 24 type: Object type. 25 count: Number of objects with this type and key. 26 count_fraction: Number of objects in relation to all objects. 27 values: Number of different values for this key. 28 """ 29 30 type: ObjectType = Field(repr=True) 31 count: int = Field(ge=0, repr=True) 32 count_fraction: float = Field(ge=0.0, le=1.0, allow_inf_nan=False, repr=True) 33 values: int = Field(ge=0, repr=True)
Database statistics for given key.
Attributes:
- type: Object type.
- count: Number of objects with this type and key.
- count_fraction: Number of objects in relation to all objects.
- values: Number of different values for this key.
async def
call( key: str, session: aiohttp.client.ClientSession | None = None) -> aio_taginfo.api.v4.Response[list[KeyStats]]:
41async def call( 42 key: str, 43 session: ClientSession | None = None, 44) -> Response[list[KeyStats]]: 45 """ 46 Show some database statistics for given key. 47 48 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_stats 49 50 Args: 51 key: tag key 52 session: request client session 53 54 Raises: 55 TaginfoError 56 """ 57 return await api_get_json( 58 path="key/stats", 59 cls=Response[list[KeyStats]], 60 session=session, 61 params=api_params(_Params, key=key), 62 )
Show some database statistics for given key.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_stats
Arguments:
- key: tag key
- session: request client session
Raises:
- TaginfoError