stadiamaps 1.0.6__py3-none-any.whl → 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. stadiamaps/__init__.py +6 -24
  2. stadiamaps/api/geocoding_api.py +1917 -760
  3. stadiamaps/api/geospatial_api.py +483 -221
  4. stadiamaps/api/routing_api.py +1615 -723
  5. stadiamaps/api_client.py +275 -272
  6. stadiamaps/api_response.py +12 -16
  7. stadiamaps/configuration.py +13 -11
  8. stadiamaps/exceptions.py +67 -30
  9. stadiamaps/models/__init__.py +5 -23
  10. stadiamaps/models/access.py +44 -26
  11. stadiamaps/models/admin_region.py +46 -28
  12. stadiamaps/models/administrative.py +48 -30
  13. stadiamaps/models/auto_costing_options.py +69 -48
  14. stadiamaps/models/auto_costing_options_all_of.py +1 -1
  15. stadiamaps/models/base_costing_options.py +52 -33
  16. stadiamaps/models/base_trace_request.py +70 -40
  17. stadiamaps/models/bicycle_costing_options.py +61 -42
  18. stadiamaps/models/bicycle_costing_options_all_of.py +1 -1
  19. stadiamaps/models/bike_network.py +42 -24
  20. stadiamaps/models/contour.py +45 -27
  21. stadiamaps/models/coordinate.py +45 -26
  22. stadiamaps/models/costing_model.py +10 -12
  23. stadiamaps/models/costing_options.py +51 -33
  24. stadiamaps/models/directions_options.py +45 -27
  25. stadiamaps/models/distance_unit.py +8 -11
  26. stadiamaps/models/edge_sign.py +46 -28
  27. stadiamaps/models/edge_use.py +8 -11
  28. stadiamaps/models/end_node.py +48 -30
  29. stadiamaps/models/geo_attributes.py +47 -29
  30. stadiamaps/models/geo_json_geometry.py +25 -25
  31. stadiamaps/models/geo_json_geometry_base.py +45 -27
  32. stadiamaps/models/geo_json_line_string.py +47 -28
  33. stadiamaps/models/geo_json_line_string_all_of.py +2 -2
  34. stadiamaps/models/geo_json_point.py +47 -28
  35. stadiamaps/models/geo_json_point_all_of.py +2 -2
  36. stadiamaps/models/geo_json_polygon.py +47 -28
  37. stadiamaps/models/geo_json_polygon_all_of.py +2 -2
  38. stadiamaps/models/geocoding_object.py +46 -28
  39. stadiamaps/models/height_request.py +55 -34
  40. stadiamaps/models/height_response.py +49 -30
  41. stadiamaps/models/highway_classification.py +52 -34
  42. stadiamaps/models/intersecting_edge.py +45 -27
  43. stadiamaps/models/isochrone_costing_model.py +8 -11
  44. stadiamaps/models/isochrone_feature.py +45 -27
  45. stadiamaps/models/isochrone_properties.py +48 -30
  46. stadiamaps/models/isochrone_request.py +54 -35
  47. stadiamaps/models/isochrone_response.py +47 -29
  48. stadiamaps/models/locate_detailed_edge.py +73 -55
  49. stadiamaps/models/locate_edge.py +56 -39
  50. stadiamaps/models/locate_edge_info.py +47 -29
  51. stadiamaps/models/locate_node.py +50 -31
  52. stadiamaps/models/locate_node_all_of.py +1 -1
  53. stadiamaps/models/locate_object.py +49 -31
  54. stadiamaps/models/maneuver_sign.py +50 -32
  55. stadiamaps/models/maneuver_sign_element.py +45 -27
  56. stadiamaps/models/map_match_costing_model.py +8 -11
  57. stadiamaps/models/map_match_request.py +74 -44
  58. stadiamaps/models/map_match_request_all_of.py +1 -1
  59. stadiamaps/models/map_match_route_response.py +57 -29
  60. stadiamaps/models/map_match_route_response_all_of.py +1 -1
  61. stadiamaps/models/map_match_trace_options.py +47 -29
  62. stadiamaps/models/map_match_waypoint.py +49 -30
  63. stadiamaps/models/map_match_waypoint_all_of.py +1 -1
  64. stadiamaps/models/matched_point.py +52 -34
  65. stadiamaps/models/matrix_costing_model.py +9 -12
  66. stadiamaps/models/matrix_distance.py +46 -28
  67. stadiamaps/models/matrix_request.py +70 -39
  68. stadiamaps/models/matrix_response.py +60 -36
  69. stadiamaps/models/motor_scooter_costing_options.py +70 -49
  70. stadiamaps/models/motor_scooter_costing_options_all_of.py +1 -1
  71. stadiamaps/models/motorcycle_costing_options.py +69 -48
  72. stadiamaps/models/motorcycle_costing_options_all_of.py +1 -1
  73. stadiamaps/models/nearest_roads_request.py +65 -34
  74. stadiamaps/models/node_id.py +42 -24
  75. stadiamaps/models/node_type.py +8 -11
  76. stadiamaps/models/optimized_route_request.py +66 -35
  77. stadiamaps/models/pedestrian_costing_options.py +59 -40
  78. stadiamaps/models/pelias_geo_json_feature.py +50 -31
  79. stadiamaps/models/pelias_geo_json_properties.py +54 -36
  80. stadiamaps/models/pelias_geo_json_properties_addendum.py +43 -25
  81. stadiamaps/models/pelias_geo_json_properties_addendum_osm.py +42 -24
  82. stadiamaps/models/pelias_layer.py +8 -11
  83. stadiamaps/models/pelias_response.py +49 -30
  84. stadiamaps/models/pelias_response_geocoding.py +1 -1
  85. stadiamaps/models/pelias_source.py +8 -11
  86. stadiamaps/models/restrictions.py +44 -26
  87. stadiamaps/models/road_class.py +8 -11
  88. stadiamaps/models/route_leg.py +48 -29
  89. stadiamaps/models/route_maneuver.py +73 -55
  90. stadiamaps/models/route_request.py +76 -43
  91. stadiamaps/models/route_response.py +56 -28
  92. stadiamaps/models/route_response_alternates_inner.py +105 -0
  93. stadiamaps/models/route_response_trip.py +1 -1
  94. stadiamaps/models/route_summary.py +48 -30
  95. stadiamaps/models/route_trip.py +135 -0
  96. stadiamaps/models/routing_response_waypoint.py +49 -30
  97. stadiamaps/models/routing_response_waypoint_all_of.py +1 -1
  98. stadiamaps/models/routing_waypoint.py +60 -41
  99. stadiamaps/models/routing_waypoint_all_of.py +1 -1
  100. stadiamaps/models/routing_waypoint_all_of_search_filter.py +48 -30
  101. stadiamaps/models/simple_routing_waypoint.py +48 -29
  102. stadiamaps/models/simple_routing_waypoint_all_of.py +1 -1
  103. stadiamaps/models/speeds.py +49 -31
  104. stadiamaps/models/trace_attribute_filter_options.py +47 -28
  105. stadiamaps/models/trace_attribute_key.py +8 -11
  106. stadiamaps/models/trace_attributes_base_response.py +51 -32
  107. stadiamaps/models/trace_attributes_request.py +72 -42
  108. stadiamaps/models/trace_attributes_request_all_of.py +1 -1
  109. stadiamaps/models/trace_attributes_request_all_of_filters.py +2 -2
  110. stadiamaps/models/trace_attributes_response.py +54 -35
  111. stadiamaps/models/trace_attributes_response_all_of.py +1 -1
  112. stadiamaps/models/trace_edge.py +88 -70
  113. stadiamaps/models/travel_mode.py +8 -11
  114. stadiamaps/models/traversability.py +8 -11
  115. stadiamaps/models/truck_costing_options.py +72 -51
  116. stadiamaps/models/truck_costing_options_all_of.py +1 -1
  117. stadiamaps/models/tz_response.py +45 -27
  118. stadiamaps/models/valhalla_languages.py +8 -11
  119. stadiamaps/models/valhalla_long_units.py +8 -11
  120. stadiamaps/models/warning.py +42 -24
  121. stadiamaps/py.typed +0 -0
  122. stadiamaps/rest.py +127 -172
  123. {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/METADATA +4 -4
  124. stadiamaps-2.0.0.dist-info/RECORD +128 -0
  125. {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/WHEEL +1 -1
  126. stadiamaps-1.0.6.dist-info/RECORD +0 -125
  127. {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/LICENSE.txt +0 -0
  128. {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/top_level.txt +0 -0
@@ -3,14 +3,14 @@
3
3
  """
4
4
  Stadia Maps Geospatial APIs
5
5
 
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
7
 
8
- The version of the OpenAPI document: 5.0.5
8
+ The version of the OpenAPI document: 6.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
16
  from __future__ import annotations
@@ -18,20 +18,22 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import Optional, Union
23
- from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing_extensions import Annotated
24
24
  from stadiamaps.models.access import Access
25
25
  from stadiamaps.models.administrative import Administrative
26
26
  from stadiamaps.models.node_id import NodeId
27
27
  from stadiamaps.models.node_type import NodeType
28
+ from typing import Optional, Set
29
+ from typing_extensions import Self
28
30
 
29
31
  class LocateNode(BaseModel):
30
32
  """
31
33
  LocateNode
32
- """
33
- lat: Union[StrictFloat, StrictInt] = Field(..., description="The latitude of a point in the shape.")
34
- lon: Union[StrictFloat, StrictInt] = Field(..., description="The longitude of a point in the shape.")
34
+ """ # noqa: E501
35
+ lat: Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]] = Field(description="The latitude of a point in the shape.")
36
+ lon: Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]] = Field(description="The longitude of a point in the shape.")
35
37
  traffic_signal: Optional[StrictBool] = None
36
38
  type: Optional[NodeType] = None
37
39
  node_id: Optional[NodeId] = None
@@ -43,43 +45,59 @@ class LocateNode(BaseModel):
43
45
  local_edge_count: Optional[StrictInt] = None
44
46
  mode_change: Optional[StrictBool] = None
45
47
  additional_properties: Dict[str, Any] = {}
46
- __properties = ["lat", "lon", "traffic_signal", "type", "node_id", "access", "edge_count", "administrative", "intersection_type", "density", "local_edge_count", "mode_change"]
48
+ __properties: ClassVar[List[str]] = ["lat", "lon", "traffic_signal", "type", "node_id", "access", "edge_count", "administrative", "intersection_type", "density", "local_edge_count", "mode_change"]
47
49
 
48
- @validator('intersection_type')
50
+ @field_validator('intersection_type')
49
51
  def intersection_type_validate_enum(cls, value):
50
52
  """Validates the enum"""
51
53
  if value is None:
52
54
  return value
53
55
 
54
- if value not in ('regular', 'false', 'dead-end', 'fork'):
56
+ if value not in set(['regular', 'false', 'dead-end', 'fork']):
55
57
  raise ValueError("must be one of enum values ('regular', 'false', 'dead-end', 'fork')")
56
58
  return value
57
59
 
58
- class Config:
59
- """Pydantic configuration"""
60
- allow_population_by_field_name = True
61
- validate_assignment = True
60
+ model_config = ConfigDict(
61
+ populate_by_name=True,
62
+ validate_assignment=True,
63
+ protected_namespaces=(),
64
+ )
65
+
62
66
 
63
67
  def to_str(self) -> str:
64
68
  """Returns the string representation of the model using alias"""
65
- return pprint.pformat(self.dict(by_alias=True))
69
+ return pprint.pformat(self.model_dump(by_alias=True))
66
70
 
67
71
  def to_json(self) -> str:
68
72
  """Returns the JSON representation of the model using alias"""
73
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
74
  return json.dumps(self.to_dict())
70
75
 
71
76
  @classmethod
72
- def from_json(cls, json_str: str) -> LocateNode:
77
+ def from_json(cls, json_str: str) -> Optional[Self]:
73
78
  """Create an instance of LocateNode from a JSON string"""
74
79
  return cls.from_dict(json.loads(json_str))
75
80
 
76
- def to_dict(self):
77
- """Returns the dictionary representation of the model using alias"""
78
- _dict = self.dict(by_alias=True,
79
- exclude={
80
- "additional_properties"
81
- },
82
- exclude_none=True)
81
+ def to_dict(self) -> Dict[str, Any]:
82
+ """Return the dictionary representation of the model using alias.
83
+
84
+ This has the following differences from calling pydantic's
85
+ `self.model_dump(by_alias=True)`:
86
+
87
+ * `None` is only added to the output dict for nullable fields that
88
+ were set at model initialization. Other fields with value `None`
89
+ are ignored.
90
+ * Fields in `self.additional_properties` are added to the output dict.
91
+ """
92
+ excluded_fields: Set[str] = set([
93
+ "additional_properties",
94
+ ])
95
+
96
+ _dict = self.model_dump(
97
+ by_alias=True,
98
+ exclude=excluded_fields,
99
+ exclude_none=True,
100
+ )
83
101
  # override the default output from pydantic by calling `to_dict()` of node_id
84
102
  if self.node_id:
85
103
  _dict['node_id'] = self.node_id.to_dict()
@@ -97,23 +115,23 @@ class LocateNode(BaseModel):
97
115
  return _dict
98
116
 
99
117
  @classmethod
100
- def from_dict(cls, obj: dict) -> LocateNode:
118
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
101
119
  """Create an instance of LocateNode from a dict"""
102
120
  if obj is None:
103
121
  return None
104
122
 
105
123
  if not isinstance(obj, dict):
106
- return LocateNode.parse_obj(obj)
124
+ return cls.model_validate(obj)
107
125
 
108
- _obj = LocateNode.parse_obj({
126
+ _obj = cls.model_validate({
109
127
  "lat": obj.get("lat"),
110
128
  "lon": obj.get("lon"),
111
129
  "traffic_signal": obj.get("traffic_signal"),
112
130
  "type": obj.get("type"),
113
- "node_id": NodeId.from_dict(obj.get("node_id")) if obj.get("node_id") is not None else None,
114
- "access": Access.from_dict(obj.get("access")) if obj.get("access") is not None else None,
131
+ "node_id": NodeId.from_dict(obj["node_id"]) if obj.get("node_id") is not None else None,
132
+ "access": Access.from_dict(obj["access"]) if obj.get("access") is not None else None,
115
133
  "edge_count": obj.get("edge_count"),
116
- "administrative": Administrative.from_dict(obj.get("administrative")) if obj.get("administrative") is not None else None,
134
+ "administrative": Administrative.from_dict(obj["administrative"]) if obj.get("administrative") is not None else None,
117
135
  "intersection_type": obj.get("intersection_type"),
118
136
  "density": obj.get("density"),
119
137
  "local_edge_count": obj.get("local_edge_count"),
@@ -126,3 +144,4 @@ class LocateNode(BaseModel):
126
144
 
127
145
  return _obj
128
146
 
147
+
@@ -5,7 +5,7 @@
5
5
 
6
6
  The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
7
7
 
8
- The version of the OpenAPI document: 5.0.5
8
+ The version of the OpenAPI document: 5.0.6
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
@@ -3,14 +3,14 @@
3
3
  """
4
4
  Stadia Maps Geospatial APIs
5
5
 
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
7
 
8
- The version of the OpenAPI document: 5.0.5
8
+ The version of the OpenAPI document: 6.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
16
  from __future__ import annotations
@@ -18,49 +18,66 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import List, Optional, Union
23
- from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conlist
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
24
23
  from stadiamaps.models.locate_edge import LocateEdge
25
24
  from stadiamaps.models.locate_node import LocateNode
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
26
27
 
27
28
  class LocateObject(BaseModel):
28
29
  """
29
30
  LocateObject
30
- """
31
- id: Optional[StrictStr] = Field(None, description="An identifier to disambiguate requests (echoed by the server).")
32
- input_lat: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The input (searched) latitude.")
33
- input_lon: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The input (searched) longitude.")
34
- nodes: Optional[conlist(LocateNode)] = None
35
- edges: Optional[conlist(LocateEdge)] = None
31
+ """ # noqa: E501
32
+ id: Optional[StrictStr] = Field(default=None, description="An identifier to disambiguate requests (echoed by the server).")
33
+ input_lat: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The input (searched) latitude.")
34
+ input_lon: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The input (searched) longitude.")
35
+ nodes: Optional[List[LocateNode]] = None
36
+ edges: Optional[List[LocateEdge]] = None
36
37
  additional_properties: Dict[str, Any] = {}
37
- __properties = ["id", "input_lat", "input_lon", "nodes", "edges"]
38
+ __properties: ClassVar[List[str]] = ["id", "input_lat", "input_lon", "nodes", "edges"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
38
45
 
39
- class Config:
40
- """Pydantic configuration"""
41
- allow_population_by_field_name = True
42
- validate_assignment = True
43
46
 
44
47
  def to_str(self) -> str:
45
48
  """Returns the string representation of the model using alias"""
46
- return pprint.pformat(self.dict(by_alias=True))
49
+ return pprint.pformat(self.model_dump(by_alias=True))
47
50
 
48
51
  def to_json(self) -> str:
49
52
  """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
54
  return json.dumps(self.to_dict())
51
55
 
52
56
  @classmethod
53
- def from_json(cls, json_str: str) -> LocateObject:
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
58
  """Create an instance of LocateObject from a JSON string"""
55
59
  return cls.from_dict(json.loads(json_str))
56
60
 
57
- def to_dict(self):
58
- """Returns the dictionary representation of the model using alias"""
59
- _dict = self.dict(by_alias=True,
60
- exclude={
61
- "additional_properties"
62
- },
63
- exclude_none=True)
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ * Fields in `self.additional_properties` are added to the output dict.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ "additional_properties",
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
64
81
  # override the default output from pydantic by calling `to_dict()` of each item in nodes (list)
65
82
  _items = []
66
83
  if self.nodes:
@@ -83,20 +100,20 @@ class LocateObject(BaseModel):
83
100
  return _dict
84
101
 
85
102
  @classmethod
86
- def from_dict(cls, obj: dict) -> LocateObject:
103
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
104
  """Create an instance of LocateObject from a dict"""
88
105
  if obj is None:
89
106
  return None
90
107
 
91
108
  if not isinstance(obj, dict):
92
- return LocateObject.parse_obj(obj)
109
+ return cls.model_validate(obj)
93
110
 
94
- _obj = LocateObject.parse_obj({
111
+ _obj = cls.model_validate({
95
112
  "id": obj.get("id"),
96
113
  "input_lat": obj.get("input_lat"),
97
114
  "input_lon": obj.get("input_lon"),
98
- "nodes": [LocateNode.from_dict(_item) for _item in obj.get("nodes")] if obj.get("nodes") is not None else None,
99
- "edges": [LocateEdge.from_dict(_item) for _item in obj.get("edges")] if obj.get("edges") is not None else None
115
+ "nodes": [LocateNode.from_dict(_item) for _item in obj["nodes"]] if obj.get("nodes") is not None else None,
116
+ "edges": [LocateEdge.from_dict(_item) for _item in obj["edges"]] if obj.get("edges") is not None else None
100
117
  })
101
118
  # store additional fields in additional_properties
102
119
  for _key in obj.keys():
@@ -105,3 +122,4 @@ class LocateObject(BaseModel):
105
122
 
106
123
  return _obj
107
124
 
125
+
@@ -3,14 +3,14 @@
3
3
  """
4
4
  Stadia Maps Geospatial APIs
5
5
 
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
7
 
8
- The version of the OpenAPI document: 5.0.5
8
+ The version of the OpenAPI document: 6.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
16
  from __future__ import annotations
@@ -18,47 +18,64 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import List, Optional
23
- from pydantic import BaseModel, Field, conlist
21
+ from pydantic import BaseModel, ConfigDict, Field
22
+ from typing import Any, ClassVar, Dict, List, Optional
24
23
  from stadiamaps.models.maneuver_sign_element import ManeuverSignElement
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
25
26
 
26
27
  class ManeuverSign(BaseModel):
27
28
  """
28
29
  ManeuverSign
29
- """
30
- exit_number_elements: Optional[conlist(ManeuverSignElement)] = Field(None, description="A list of exit number elements. This is typically just a single value.")
31
- exit_branch_elements: Optional[conlist(ManeuverSignElement)] = Field(None, description="A list of exit branch elements. The text is a subsequent road name or route number after the sign.")
32
- exit_toward_elements: Optional[conlist(ManeuverSignElement)] = Field(None, description="A list of exit name elements. The text is the interchange identifier (used more frequently outside the US).")
33
- exit_name_elements: Optional[conlist(ManeuverSignElement)] = Field(None, description="A list of exit name elements. The text is the location where the road ahead goes (typically a city, but occasionally a road name or route number).")
30
+ """ # noqa: E501
31
+ exit_number_elements: Optional[List[ManeuverSignElement]] = Field(default=None, description="A list of exit number elements. This is typically just a single value.")
32
+ exit_branch_elements: Optional[List[ManeuverSignElement]] = Field(default=None, description="A list of exit branch elements. The text is a subsequent road name or route number after the sign.")
33
+ exit_toward_elements: Optional[List[ManeuverSignElement]] = Field(default=None, description="A list of exit name elements. The text is the interchange identifier (used more frequently outside the US).")
34
+ exit_name_elements: Optional[List[ManeuverSignElement]] = Field(default=None, description="A list of exit name elements. The text is the location where the road ahead goes (typically a city, but occasionally a road name or route number).")
34
35
  additional_properties: Dict[str, Any] = {}
35
- __properties = ["exit_number_elements", "exit_branch_elements", "exit_toward_elements", "exit_name_elements"]
36
+ __properties: ClassVar[List[str]] = ["exit_number_elements", "exit_branch_elements", "exit_toward_elements", "exit_name_elements"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
36
43
 
37
- class Config:
38
- """Pydantic configuration"""
39
- allow_population_by_field_name = True
40
- validate_assignment = True
41
44
 
42
45
  def to_str(self) -> str:
43
46
  """Returns the string representation of the model using alias"""
44
- return pprint.pformat(self.dict(by_alias=True))
47
+ return pprint.pformat(self.model_dump(by_alias=True))
45
48
 
46
49
  def to_json(self) -> str:
47
50
  """Returns the JSON representation of the model using alias"""
51
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
52
  return json.dumps(self.to_dict())
49
53
 
50
54
  @classmethod
51
- def from_json(cls, json_str: str) -> ManeuverSign:
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
56
  """Create an instance of ManeuverSign from a JSON string"""
53
57
  return cls.from_dict(json.loads(json_str))
54
58
 
55
- def to_dict(self):
56
- """Returns the dictionary representation of the model using alias"""
57
- _dict = self.dict(by_alias=True,
58
- exclude={
59
- "additional_properties"
60
- },
61
- exclude_none=True)
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ * Fields in `self.additional_properties` are added to the output dict.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ "additional_properties",
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
62
79
  # override the default output from pydantic by calling `to_dict()` of each item in exit_number_elements (list)
63
80
  _items = []
64
81
  if self.exit_number_elements:
@@ -95,19 +112,19 @@ class ManeuverSign(BaseModel):
95
112
  return _dict
96
113
 
97
114
  @classmethod
98
- def from_dict(cls, obj: dict) -> ManeuverSign:
115
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
116
  """Create an instance of ManeuverSign from a dict"""
100
117
  if obj is None:
101
118
  return None
102
119
 
103
120
  if not isinstance(obj, dict):
104
- return ManeuverSign.parse_obj(obj)
121
+ return cls.model_validate(obj)
105
122
 
106
- _obj = ManeuverSign.parse_obj({
107
- "exit_number_elements": [ManeuverSignElement.from_dict(_item) for _item in obj.get("exit_number_elements")] if obj.get("exit_number_elements") is not None else None,
108
- "exit_branch_elements": [ManeuverSignElement.from_dict(_item) for _item in obj.get("exit_branch_elements")] if obj.get("exit_branch_elements") is not None else None,
109
- "exit_toward_elements": [ManeuverSignElement.from_dict(_item) for _item in obj.get("exit_toward_elements")] if obj.get("exit_toward_elements") is not None else None,
110
- "exit_name_elements": [ManeuverSignElement.from_dict(_item) for _item in obj.get("exit_name_elements")] if obj.get("exit_name_elements") is not None else None
123
+ _obj = cls.model_validate({
124
+ "exit_number_elements": [ManeuverSignElement.from_dict(_item) for _item in obj["exit_number_elements"]] if obj.get("exit_number_elements") is not None else None,
125
+ "exit_branch_elements": [ManeuverSignElement.from_dict(_item) for _item in obj["exit_branch_elements"]] if obj.get("exit_branch_elements") is not None else None,
126
+ "exit_toward_elements": [ManeuverSignElement.from_dict(_item) for _item in obj["exit_toward_elements"]] if obj.get("exit_toward_elements") is not None else None,
127
+ "exit_name_elements": [ManeuverSignElement.from_dict(_item) for _item in obj["exit_name_elements"]] if obj.get("exit_name_elements") is not None else None
111
128
  })
112
129
  # store additional fields in additional_properties
113
130
  for _key in obj.keys():
@@ -116,3 +133,4 @@ class ManeuverSign(BaseModel):
116
133
 
117
134
  return _obj
118
135
 
136
+
@@ -3,14 +3,14 @@
3
3
  """
4
4
  Stadia Maps Geospatial APIs
5
5
 
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
7
 
8
- The version of the OpenAPI document: 5.0.5
8
+ The version of the OpenAPI document: 6.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
16
  from __future__ import annotations
@@ -18,45 +18,62 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import Optional
23
- from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
24
25
 
25
26
  class ManeuverSignElement(BaseModel):
26
27
  """
27
28
  ManeuverSignElement
28
- """
29
- text: StrictStr = Field(..., description="The interchange sign text (varies based on the context; see the `maneuverSign` schema).")
30
- is_route_number: Optional[StrictBool] = Field(None, description="True if the sign is a route number.")
31
- consecutive_count: Optional[StrictInt] = Field(None, description="The frequency of this sign element within a set a consecutive signs.")
29
+ """ # noqa: E501
30
+ text: StrictStr = Field(description="The interchange sign text (varies based on the context; see the `maneuverSign` schema).")
31
+ is_route_number: Optional[StrictBool] = Field(default=None, description="True if the sign is a route number.")
32
+ consecutive_count: Optional[StrictInt] = Field(default=None, description="The frequency of this sign element within a set a consecutive signs.")
32
33
  additional_properties: Dict[str, Any] = {}
33
- __properties = ["text", "is_route_number", "consecutive_count"]
34
+ __properties: ClassVar[List[str]] = ["text", "is_route_number", "consecutive_count"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
34
41
 
35
- class Config:
36
- """Pydantic configuration"""
37
- allow_population_by_field_name = True
38
- validate_assignment = True
39
42
 
40
43
  def to_str(self) -> str:
41
44
  """Returns the string representation of the model using alias"""
42
- return pprint.pformat(self.dict(by_alias=True))
45
+ return pprint.pformat(self.model_dump(by_alias=True))
43
46
 
44
47
  def to_json(self) -> str:
45
48
  """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
50
  return json.dumps(self.to_dict())
47
51
 
48
52
  @classmethod
49
- def from_json(cls, json_str: str) -> ManeuverSignElement:
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
54
  """Create an instance of ManeuverSignElement from a JSON string"""
51
55
  return cls.from_dict(json.loads(json_str))
52
56
 
53
- def to_dict(self):
54
- """Returns the dictionary representation of the model using alias"""
55
- _dict = self.dict(by_alias=True,
56
- exclude={
57
- "additional_properties"
58
- },
59
- exclude_none=True)
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ * Fields in `self.additional_properties` are added to the output dict.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ "additional_properties",
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
60
77
  # puts key-value pairs in additional_properties in the top level
61
78
  if self.additional_properties is not None:
62
79
  for _key, _value in self.additional_properties.items():
@@ -65,15 +82,15 @@ class ManeuverSignElement(BaseModel):
65
82
  return _dict
66
83
 
67
84
  @classmethod
68
- def from_dict(cls, obj: dict) -> ManeuverSignElement:
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
69
86
  """Create an instance of ManeuverSignElement from a dict"""
70
87
  if obj is None:
71
88
  return None
72
89
 
73
90
  if not isinstance(obj, dict):
74
- return ManeuverSignElement.parse_obj(obj)
91
+ return cls.model_validate(obj)
75
92
 
76
- _obj = ManeuverSignElement.parse_obj({
93
+ _obj = cls.model_validate({
77
94
  "text": obj.get("text"),
78
95
  "is_route_number": obj.get("is_route_number"),
79
96
  "consecutive_count": obj.get("consecutive_count")
@@ -85,3 +102,4 @@ class ManeuverSignElement(BaseModel):
85
102
 
86
103
  return _obj
87
104
 
105
+
@@ -3,23 +3,20 @@
3
3
  """
4
4
  Stadia Maps Geospatial APIs
5
5
 
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
7
 
8
- The version of the OpenAPI document: 5.0.5
8
+ The version of the OpenAPI document: 6.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
+ from __future__ import annotations
16
17
  import json
17
- import pprint
18
- import re # noqa: F401
19
- from aenum import Enum, no_arg
20
-
21
-
22
-
18
+ from enum import Enum
19
+ from typing_extensions import Self
23
20
 
24
21
 
25
22
  class MapMatchCostingModel(str, Enum):
@@ -36,8 +33,8 @@ class MapMatchCostingModel(str, Enum):
36
33
  PEDESTRIAN = 'pedestrian'
37
34
 
38
35
  @classmethod
39
- def from_json(cls, json_str: str) -> MapMatchCostingModel:
36
+ def from_json(cls, json_str: str) -> Self:
40
37
  """Create an instance of MapMatchCostingModel from a JSON string"""
41
- return MapMatchCostingModel(json.loads(json_str))
38
+ return cls(json.loads(json_str))
42
39
 
43
40