Skip to content

Commit a923028

Browse files
committed
Minor fixes
1 parent d9b59d3 commit a923028

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

Changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## 0.0.82
2-
*INCOMPLETE*
2+
+ Minor fixes.
33

44
## 0.0.81
55
+ Refactored `Parameter.type` field to `Parameter.dtype`.

muna/beta/openai/annotations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def get_parameter(
244244
dtype = dtype if isinstance(dtype, set) else { dtype }
245245
for idx, param in enumerate(parameters):
246246
if (
247-
param.type in dtype and
247+
param.dtype in dtype and
248248
(not denotation or param.denotation == denotation)
249249
):
250250
return idx, param

muna/beta/openai/completions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def __create_delegate(self, tag: str) -> ChatCompletionDelegate:
194194
idx
195195
for idx, param in enumerate(signature.outputs)
196196
if (
197-
param.type == Dtype.dict and
197+
param.dtype == Dtype.dict and
198198
param.value_schema["title"] in { "ChatCompletion", "ChatCompletionChunk" }
199199
)
200200
), None)

muna/beta/remote/remote.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ def _create_remote_value(obj: Value) -> RemoteValue:
135135

136136
def _parse_remote_value(value: RemoteValue) -> Value:
137137
buffer = _download_value_data(value.data) if value.data else None
138-
is_tensor = value.type in _TENSOR_DTYPES
139-
match value.type:
138+
is_tensor = value.dtype in _TENSOR_DTYPES
139+
match value.dtype:
140140
case Dtype.null:
141141
return None
142142
case _ if is_tensor:
@@ -152,7 +152,7 @@ def _parse_remote_value(value: RemoteValue) -> Value:
152152
case Dtype.binary:
153153
return buffer
154154
case _:
155-
raise ValueError(f"Failed to parse remote value with type `{value.type}` because it is not supported")
155+
raise ValueError(f"Failed to parse remote value with type `{value.dtype}` because it is not supported")
156156

157157
def _parse_remote_prediction(prediction: RemotePrediction) -> Prediction:
158158
results = (

muna/c/value.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def data(self):
3838
return data
3939

4040
@property
41-
def type(self) -> Dtype:
41+
def dtype(self) -> Dtype:
4242
dtype = c_int()
4343
status = get_fxnc().FXNValueGetType(self.__value, byref(dtype))
4444
if status != FXNStatus.OK:
@@ -47,7 +47,7 @@ def type(self) -> Dtype:
4747

4848
@property
4949
def shape(self) -> tuple[int, ...] | None:
50-
if self.type not in _TENSOR_ISH_DTYPES:
50+
if self.dtype not in _TENSOR_ISH_DTYPES:
5151
return None
5252
fxnc = get_fxnc()
5353
dims = c_int32()
@@ -79,7 +79,7 @@ def serialize(self, mime: str=None) -> bytes:
7979
return result
8080

8181
def to_object(self) -> Object:
82-
match self.type:
82+
match self.dtype:
8383
case Dtype.null: return None
8484
case t if t in _TENSOR_DTYPES:
8585
ctype = as_ctypes_type(dtype(t))
@@ -92,7 +92,7 @@ def to_object(self) -> Object:
9292
data = as_array(cast(self.data, POINTER(c_uint8)), self.shape).copy()
9393
return Image.fromarray(data.squeeze())
9494
case Dtype.binary: return string_at(self.data, self.shape[0])
95-
case _: raise ValueError(f"Failed to convert value with type `{self.type}` to object because it is not supported")
95+
case _: raise ValueError(f"Failed to convert value with type `{self.dtype}` to object because it is not supported")
9696

9797
def __enter__(self):
9898
return self

test/remote_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_prediction_endpoint_create_eager():
2424
prediction = _prediction_endpoint_eager(payload)
2525
assert isinstance(prediction, RemotePrediction)
2626
assert isinstance(prediction.results, list)
27-
assert prediction.results[0].type == Dtype.string
27+
assert prediction.results[0].dtype == Dtype.string
2828

2929
def test_prediction_endpoint_stream_eager():
3030
@prediction_endpoint(tag="@muna/greeting")
@@ -60,7 +60,7 @@ def test_prediction_endpoint_create_generator():
6060
prediction = _prediction_endpoint_generator(payload)
6161
assert isinstance(prediction, RemotePrediction)
6262
assert isinstance(prediction.results, list)
63-
assert prediction.results[0].type == Dtype.string
63+
assert prediction.results[0].dtype == Dtype.string
6464

6565
def test_prediction_endpoint_stream_generator():
6666
payload = CreatePredictionInput(

test/value_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ def test_deserialize_png_to_image():
2727
image_data = Path("test/data/cat.jpg").read_bytes()
2828
image_value = Value.from_bytes(image_data, mime="image/*")
2929
# Check
30-
assert image_value.type == Dtype.image
30+
assert image_value.dtype == Dtype.image
3131
assert image_value.shape == (224, 224, 3)

0 commit comments

Comments
 (0)