Skip to content

Commit 9ec5b2a

Browse files
authored
fix: include fixes for metadata types (#165)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 8998c15 commit 9ec5b2a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/uhi/resources/histogram.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"oneOf": [
5757
{
5858
"type": "string",
59-
"description": "A path (URI?) to the floating point bin data; outer dimension is [∑weights, ∑weights², value, variance]"
59+
"description": "A path (similar to URI) to the floating point bin data"
6060
},
6161
{
6262
"type": "array",

src/uhi/typing/serialization.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from collections.abc import Sequence
4-
from typing import Any, Literal, TypedDict
4+
from typing import Literal, TypedDict, Union
55

66
__all__ = [
77
"BooleanAxis",
@@ -17,6 +17,8 @@
1717
"WeightedStorage",
1818
]
1919

20+
SupportedMetadata = Union[float, str, bool]
21+
2022

2123
def __dir__() -> list[str]:
2224
return __all__
@@ -33,7 +35,7 @@ class _RequiredRegularAxis(TypedDict):
3335

3436

3537
class RegularAxis(_RequiredRegularAxis, total=False):
36-
metadata: dict[str, Any]
38+
metadata: dict[str, SupportedMetadata]
3739

3840

3941
class _RequiredVariableAxis(TypedDict):
@@ -45,7 +47,7 @@ class _RequiredVariableAxis(TypedDict):
4547

4648

4749
class VariableAxis(_RequiredVariableAxis, total=False):
48-
metadata: dict[str, Any]
50+
metadata: dict[str, SupportedMetadata]
4951

5052

5153
class _RequiredCategoryStrAxis(TypedDict):
@@ -55,7 +57,7 @@ class _RequiredCategoryStrAxis(TypedDict):
5557

5658

5759
class CategoryStrAxis(_RequiredCategoryStrAxis, total=False):
58-
metadata: dict[str, Any]
60+
metadata: dict[str, SupportedMetadata]
5961

6062

6163
class _RequiredCategoryIntAxis(TypedDict):
@@ -65,15 +67,15 @@ class _RequiredCategoryIntAxis(TypedDict):
6567

6668

6769
class CategoryIntAxis(_RequiredCategoryIntAxis, total=False):
68-
metadata: dict[str, Any]
70+
metadata: dict[str, SupportedMetadata]
6971

7072

7173
class _RequiredBooleanAxis(TypedDict):
7274
type: Literal["boolean"]
7375

7476

7577
class BooleanAxis(_RequiredBooleanAxis, total=False):
76-
metadata: dict[str, Any]
78+
metadata: dict[str, SupportedMetadata]
7779

7880

7981
class IntStorage(TypedDict):
@@ -117,4 +119,4 @@ class _RequiredHistogram(TypedDict):
117119

118120

119121
class Histogram(_RequiredHistogram, total=False):
120-
metadata: dict[str, Any]
122+
metadata: dict[str, SupportedMetadata]

0 commit comments

Comments
 (0)