Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .generation/config.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[input]
backendCommit = 1076a616369dcc33e86b422a9364ac99553a18f8
backendCommit = cdb162df11bff5a3ae5854126d15538c77a2cabb

[general]
githubUrl = https://github.com/geo-engine/openapi-client
version = 0.0.23
version = 0.0.24

[python]
name = geoengine_openapi_client
Expand Down
40 changes: 34 additions & 6 deletions .generation/input/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6953,20 +6953,22 @@
"required": [
"fileName",
"inputType",
"numInputBands",
"outputType"
"outputType",
"inputShape",
"outputShape"
],
"properties": {
"fileName": {
"type": "string"
},
"inputShape": {
"$ref": "#/components/schemas/MlTensorShape3D"
},
"inputType": {
"$ref": "#/components/schemas/RasterDataType"
},
"numInputBands": {
"type": "integer",
"format": "int32",
"minimum": 0
"outputShape": {
"$ref": "#/components/schemas/MlTensorShape3D"
},
"outputType": {
"$ref": "#/components/schemas/RasterDataType"
Expand Down Expand Up @@ -7005,6 +7007,32 @@
}
}
},
"MlTensorShape3D": {
"type": "object",
"description": "A struct describing tensor shape for `MlModelMetadata`",
"required": [
"y",
"x",
"bands"
],
"properties": {
"bands": {
"type": "integer",
"format": "int32",
"minimum": 0
},
"x": {
"type": "integer",
"format": "int32",
"minimum": 0
},
"y": {
"type": "integer",
"format": "int32",
"minimum": 0
}
}
},
"MockDatasetDataSourceLoadingInfo": {
"type": "object",
"required": [
Expand Down
3 changes: 3 additions & 0 deletions python/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ docs/MlModel.md
docs/MlModelMetadata.md
docs/MlModelNameResponse.md
docs/MlModelResource.md
docs/MlTensorShape3D.md
docs/MockDatasetDataSourceLoadingInfo.md
docs/MockMetaData.md
docs/MultiBandRasterColorizer.md
Expand Down Expand Up @@ -338,6 +339,7 @@ geoengine_openapi_client/models/ml_model.py
geoengine_openapi_client/models/ml_model_metadata.py
geoengine_openapi_client/models/ml_model_name_response.py
geoengine_openapi_client/models/ml_model_resource.py
geoengine_openapi_client/models/ml_tensor_shape3_d.py
geoengine_openapi_client/models/mock_dataset_data_source_loading_info.py
geoengine_openapi_client/models/mock_meta_data.py
geoengine_openapi_client/models/multi_band_raster_colorizer.py
Expand Down Expand Up @@ -567,6 +569,7 @@ test/test_ml_model.py
test/test_ml_model_metadata.py
test/test_ml_model_name_response.py
test/test_ml_model_resource.py
test/test_ml_tensor_shape3_d.py
test/test_mock_dataset_data_source_loading_info.py
test/test_mock_meta_data.py
test/test_multi_band_raster_colorizer.py
Expand Down
1 change: 1 addition & 0 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ Class | Method | HTTP request | Description
- [MlModelMetadata](docs/MlModelMetadata.md)
- [MlModelNameResponse](docs/MlModelNameResponse.md)
- [MlModelResource](docs/MlModelResource.md)
- [MlTensorShape3D](docs/MlTensorShape3D.md)
- [MockDatasetDataSourceLoadingInfo](docs/MockDatasetDataSourceLoadingInfo.md)
- [MockMetaData](docs/MockMetaData.md)
- [MultiBandRasterColorizer](docs/MultiBandRasterColorizer.md)
Expand Down
1 change: 1 addition & 0 deletions python/geoengine_openapi_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
from geoengine_openapi_client.models.ml_model_metadata import MlModelMetadata
from geoengine_openapi_client.models.ml_model_name_response import MlModelNameResponse
from geoengine_openapi_client.models.ml_model_resource import MlModelResource
from geoengine_openapi_client.models.ml_tensor_shape3_d import MlTensorShape3D
from geoengine_openapi_client.models.mock_dataset_data_source_loading_info import MockDatasetDataSourceLoadingInfo
from geoengine_openapi_client.models.mock_meta_data import MockMetaData
from geoengine_openapi_client.models.multi_band_raster_colorizer import MultiBandRasterColorizer
Expand Down
1 change: 1 addition & 0 deletions python/geoengine_openapi_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
from geoengine_openapi_client.models.ml_model_metadata import MlModelMetadata
from geoengine_openapi_client.models.ml_model_name_response import MlModelNameResponse
from geoengine_openapi_client.models.ml_model_resource import MlModelResource
from geoengine_openapi_client.models.ml_tensor_shape3_d import MlTensorShape3D
from geoengine_openapi_client.models.mock_dataset_data_source_loading_info import MockDatasetDataSourceLoadingInfo
from geoengine_openapi_client.models.mock_meta_data import MockMetaData
from geoengine_openapi_client.models.multi_band_raster_colorizer import MultiBandRasterColorizer
Expand Down
16 changes: 12 additions & 4 deletions python/geoengine_openapi_client/models/ml_model_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List
from typing_extensions import Annotated
from geoengine_openapi_client.models.ml_tensor_shape3_d import MlTensorShape3D
from geoengine_openapi_client.models.raster_data_type import RasterDataType
from typing import Optional, Set
from typing_extensions import Self
Expand All @@ -30,10 +30,11 @@ class MlModelMetadata(BaseModel):
MlModelMetadata
""" # noqa: E501
file_name: StrictStr = Field(alias="fileName")
input_shape: MlTensorShape3D = Field(alias="inputShape")
input_type: RasterDataType = Field(alias="inputType")
num_input_bands: Annotated[int, Field(strict=True, ge=0)] = Field(alias="numInputBands")
output_shape: MlTensorShape3D = Field(alias="outputShape")
output_type: RasterDataType = Field(alias="outputType")
__properties: ClassVar[List[str]] = ["fileName", "inputType", "numInputBands", "outputType"]
__properties: ClassVar[List[str]] = ["fileName", "inputShape", "inputType", "outputShape", "outputType"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -74,6 +75,12 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of input_shape
if self.input_shape:
_dict['inputShape'] = self.input_shape.to_dict()
# override the default output from pydantic by calling `to_dict()` of output_shape
if self.output_shape:
_dict['outputShape'] = self.output_shape.to_dict()
return _dict

@classmethod
Expand All @@ -87,8 +94,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:

_obj = cls.model_validate({
"fileName": obj.get("fileName"),
"inputShape": MlTensorShape3D.from_dict(obj["inputShape"]) if obj.get("inputShape") is not None else None,
"inputType": obj.get("inputType"),
"numInputBands": obj.get("numInputBands"),
"outputShape": MlTensorShape3D.from_dict(obj["outputShape"]) if obj.get("outputShape") is not None else None,
"outputType": obj.get("outputType")
})
return _obj
Expand Down
93 changes: 93 additions & 0 deletions python/geoengine_openapi_client/models/ml_tensor_shape3_d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# coding: utf-8

"""
Geo Engine API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: 0.8.0
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501


from __future__ import annotations
import pprint
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field
from typing import Any, ClassVar, Dict, List
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self

class MlTensorShape3D(BaseModel):
"""
A struct describing tensor shape for `MlModelMetadata`
""" # noqa: E501
bands: Annotated[int, Field(strict=True, ge=0)]
x: Annotated[int, Field(strict=True, ge=0)]
y: Annotated[int, Field(strict=True, ge=0)]
__properties: ClassVar[List[str]] = ["bands", "x", "y"]

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)


def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of MlTensorShape3D from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:

* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])

_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of MlTensorShape3D from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({
"bands": obj.get("bands"),
"x": obj.get("x"),
"y": obj.get("y")
})
return _obj


18 changes: 16 additions & 2 deletions python/test/test_ml_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ def make_instance(self, include_optional) -> MlModel:
display_name = '',
metadata = geoengine_openapi_client.models.ml_model_metadata.MlModelMetadata(
file_name = '',
input_shape = geoengine_openapi_client.models.ml_tensor_shape3_d.MlTensorShape3D(
bands = 0,
x = 0,
y = 0, ),
input_type = 'U8',
num_input_bands = 0,
output_shape = geoengine_openapi_client.models.ml_tensor_shape3_d.MlTensorShape3D(
bands = 0,
x = 0,
y = 0, ),
output_type = 'U8', ),
name = '',
upload = ''
Expand All @@ -52,8 +59,15 @@ def make_instance(self, include_optional) -> MlModel:
display_name = '',
metadata = geoengine_openapi_client.models.ml_model_metadata.MlModelMetadata(
file_name = '',
input_shape = geoengine_openapi_client.models.ml_tensor_shape3_d.MlTensorShape3D(
bands = 0,
x = 0,
y = 0, ),
input_type = 'U8',
num_input_bands = 0,
output_shape = geoengine_openapi_client.models.ml_tensor_shape3_d.MlTensorShape3D(
bands = 0,
x = 0,
y = 0, ),
output_type = 'U8', ),
name = '',
upload = '',
Expand Down
18 changes: 16 additions & 2 deletions python/test/test_ml_model_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,29 @@ def make_instance(self, include_optional) -> MlModelMetadata:
if include_optional:
return MlModelMetadata(
file_name = '',
input_shape = geoengine_openapi_client.models.ml_tensor_shape3_d.MlTensorShape3D(
bands = 0,
x = 0,
y = 0, ),
input_type = 'U8',
num_input_bands = 0,
output_shape = geoengine_openapi_client.models.ml_tensor_shape3_d.MlTensorShape3D(
bands = 0,
x = 0,
y = 0, ),
output_type = 'U8'
)
else:
return MlModelMetadata(
file_name = '',
input_shape = geoengine_openapi_client.models.ml_tensor_shape3_d.MlTensorShape3D(
bands = 0,
x = 0,
y = 0, ),
input_type = 'U8',
num_input_bands = 0,
output_shape = geoengine_openapi_client.models.ml_tensor_shape3_d.MlTensorShape3D(
bands = 0,
x = 0,
y = 0, ),
output_type = 'U8',
)
"""
Expand Down
57 changes: 57 additions & 0 deletions python/test/test_ml_tensor_shape3_d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# coding: utf-8

"""
Geo Engine API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: 0.8.0
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501


import unittest

from geoengine_openapi_client.models.ml_tensor_shape3_d import MlTensorShape3D

class TestMlTensorShape3D(unittest.TestCase):
"""MlTensorShape3D unit test stubs"""

def setUp(self):
pass

def tearDown(self):
pass

def make_instance(self, include_optional) -> MlTensorShape3D:
"""Test MlTensorShape3D
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `MlTensorShape3D`
"""
model = MlTensorShape3D()
if include_optional:
return MlTensorShape3D(
bands = 0,
x = 0,
y = 0
)
else:
return MlTensorShape3D(
bands = 0,
x = 0,
y = 0,
)
"""

def testMlTensorShape3D(self):
"""Test MlTensorShape3D"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)

if __name__ == '__main__':
unittest.main()
Loading