zarr_metadata.v3.data_type
zarr_metadata.v3.data_type ¶
Zarr v3 data type spec types.
Each v3 data type has its own submodule:
- Core primitives:
bool,int8/16/32/64,uint8/16/32/64,float16/32/64,complex64/128,raw(forr<N>) - zarr-extensions:
bytes,string,numpy_datetime64,numpy_timedelta64,struct
The two canonical types per dtype are re-exported here:
<X>DataTypeName-- the literal type of the dtype'sdata_typestring (or, for named-config dtypes, the literal value of theirnamefield)<X>FillValue-- the permitted JSON shape of thefill_valuefield
Named-config dtypes (numpy_datetime64, numpy_timedelta64, struct) also
expose their envelope TypedDict here. For configuration TypedDicts, branded
HexFloat<N> / Base64Bytes types, and the corresponding validator
functions, import directly from the leaf submodule.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
zarr_metadata.v3.data_type.bool ¶
Zarr v3 bool data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
BOOL_DATA_TYPE_NAME
module-attribute
¶
BOOL_DATA_TYPE_NAME: Final = 'bool'
The data_type value for the bool type.
BoolDataTypeName
module-attribute
¶
BoolDataTypeName = Literal['bool']
Literal type of the data_type field for bool.
BoolFillValue
module-attribute
¶
BoolFillValue = bool
Permitted JSON shape of the fill_value field for bool: a JSON boolean.
__all__
module-attribute
¶
BoolDataType
dataclass
¶
Bases: DataTypeEntity
The bool data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/bool.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = BOOL_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.int8 ¶
Zarr v3 int8 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
INT8_DATA_TYPE_NAME
module-attribute
¶
INT8_DATA_TYPE_NAME: Final = 'int8'
The data_type value for the int8 type.
Int8DataTypeName
module-attribute
¶
Int8DataTypeName = Literal['int8']
Literal type of the data_type field for int8.
Int8FillValue
module-attribute
¶
Int8FillValue = int
Permitted JSON shape of the fill_value field for int8: a JSON integer in [-128, 127].
__all__
module-attribute
¶
Int8DataType
dataclass
¶
Bases: IntegerDataType
The int8 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/int8.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = INT8_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.int16 ¶
Zarr v3 int16 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
INT16_DATA_TYPE_NAME
module-attribute
¶
INT16_DATA_TYPE_NAME: Final = 'int16'
The data_type value for the int16 type.
Int16DataTypeName
module-attribute
¶
Int16DataTypeName = Literal['int16']
Literal type of the data_type field for int16.
Int16FillValue
module-attribute
¶
Int16FillValue = int
Permitted JSON shape of the fill_value field for int16: a JSON integer in [-32768, 32767].
__all__
module-attribute
¶
Int16DataType
dataclass
¶
Bases: IntegerDataType
The int16 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/int16.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = INT16_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.int32 ¶
Zarr v3 int32 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
INT32_DATA_TYPE_NAME
module-attribute
¶
INT32_DATA_TYPE_NAME: Final = 'int32'
The data_type value for the int32 type.
Int32DataTypeName
module-attribute
¶
Int32DataTypeName = Literal['int32']
Literal type of the data_type field for int32.
Int32FillValue
module-attribute
¶
Int32FillValue = int
Permitted JSON shape of the fill_value field for int32: a JSON integer in [-231, 231 - 1].
__all__
module-attribute
¶
Int32DataType
dataclass
¶
Bases: IntegerDataType
The int32 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/int32.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = INT32_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.int64 ¶
Zarr v3 int64 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
INT64_DATA_TYPE_NAME
module-attribute
¶
INT64_DATA_TYPE_NAME: Final = 'int64'
The data_type value for the int64 type.
Int64DataTypeName
module-attribute
¶
Int64DataTypeName = Literal['int64']
Literal type of the data_type field for int64.
Int64FillValue
module-attribute
¶
Int64FillValue = int
Permitted JSON shape of the fill_value field for int64: a JSON integer in [-263, 263 - 1].
__all__
module-attribute
¶
Int64DataType
dataclass
¶
Bases: IntegerDataType
The int64 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/int64.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = INT64_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.uint8 ¶
Zarr v3 uint8 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
UINT8_DATA_TYPE_NAME
module-attribute
¶
UINT8_DATA_TYPE_NAME: Final = 'uint8'
The data_type value for the uint8 type.
Uint8DataTypeName
module-attribute
¶
Uint8DataTypeName = Literal['uint8']
Literal type of the data_type field for uint8.
Uint8FillValue
module-attribute
¶
Uint8FillValue = int
Permitted JSON shape of the fill_value field for uint8: a JSON integer in [0, 255].
__all__
module-attribute
¶
Uint8DataType
dataclass
¶
Bases: IntegerDataType
The uint8 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/uint8.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = UINT8_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.uint16 ¶
Zarr v3 uint16 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
UINT16_DATA_TYPE_NAME
module-attribute
¶
UINT16_DATA_TYPE_NAME: Final = 'uint16'
The data_type value for the uint16 type.
Uint16DataTypeName
module-attribute
¶
Uint16DataTypeName = Literal['uint16']
Literal type of the data_type field for uint16.
Uint16FillValue
module-attribute
¶
Uint16FillValue = int
Permitted JSON shape of the fill_value field for uint16: a JSON integer in [0, 65535].
__all__
module-attribute
¶
Uint16DataType
dataclass
¶
Bases: IntegerDataType
The uint16 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/uint16.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = UINT16_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.uint32 ¶
Zarr v3 uint32 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
UINT32_DATA_TYPE_NAME
module-attribute
¶
UINT32_DATA_TYPE_NAME: Final = 'uint32'
The data_type value for the uint32 type.
Uint32DataTypeName
module-attribute
¶
Uint32DataTypeName = Literal['uint32']
Literal type of the data_type field for uint32.
Uint32FillValue
module-attribute
¶
Uint32FillValue = int
Permitted JSON shape of the fill_value field for uint32: a JSON integer in [0, 2**32 - 1].
__all__
module-attribute
¶
Uint32DataType
dataclass
¶
Bases: IntegerDataType
The uint32 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/uint32.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = UINT32_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.uint64 ¶
Zarr v3 uint64 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
UINT64_DATA_TYPE_NAME
module-attribute
¶
UINT64_DATA_TYPE_NAME: Final = 'uint64'
The data_type value for the uint64 type.
Uint64DataTypeName
module-attribute
¶
Uint64DataTypeName = Literal['uint64']
Literal type of the data_type field for uint64.
Uint64FillValue
module-attribute
¶
Uint64FillValue = int
Permitted JSON shape of the fill_value field for uint64: a JSON integer in [0, 2**64 - 1].
__all__
module-attribute
¶
Uint64DataType
dataclass
¶
Bases: IntegerDataType
The uint64 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/uint64.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = UINT64_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.float16 ¶
Zarr v3 float16 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
CANONICAL_NAN_HEX_FLOAT16
module-attribute
¶
CANONICAL_NAN_HEX_FLOAT16: Final = '0x7e00'
Canonical hex form of the float16 NaN sentinel "NaN".
Per spec (https://github.com/zarr-developers/zarr-specs/blob/fc7dd9c9beb5a50b87f9b08b00bf50fc0048482f/docs/v3/data-types/index.rst#L72-L74) the named "NaN" sentinel denotes the float with sign=0, the
most significant mantissa bit set, and all other mantissa bits zero
(the IEEE 754 default quiet NaN). Other NaN bit patterns must be
encoded with the explicit hex-string form.
CANONICAL_NEGATIVE_INFINITY_HEX_FLOAT16
module-attribute
¶
CANONICAL_NEGATIVE_INFINITY_HEX_FLOAT16: Final = '0xfc00'
Canonical hex form of the float16 "-Infinity" sentinel.
CANONICAL_POSITIVE_INFINITY_HEX_FLOAT16
module-attribute
¶
CANONICAL_POSITIVE_INFINITY_HEX_FLOAT16: Final = '0x7c00'
Canonical hex form of the float16 "Infinity" sentinel.
FLOAT16_DATA_TYPE_NAME
module-attribute
¶
FLOAT16_DATA_TYPE_NAME: Final = 'float16'
The data_type value for the float16 type.
Float16DataTypeName
module-attribute
¶
Float16DataTypeName = Literal['float16']
Literal type of the data_type field for float16.
Float16FillValue
module-attribute
¶
Float16FillValue = (
float | int | Float16SpecialFillValue | HexFloat16
)
Permitted JSON shape of the fill_value field for float16.
Either a JSON number, one of the named non-finite sentinels ("NaN",
"Infinity", "-Infinity"), or a HexFloat16 (0xYYYY string encoding
the unsigned-integer representation of the IEEE 754 value).
Float16SpecialFillValue
module-attribute
¶
Float16SpecialFillValue = Literal[
"NaN", "Infinity", "-Infinity"
]
Named non-finite fill values permitted by the spec for IEEE 754 floats.
https://github.com/zarr-developers/zarr-specs/blob/fc7dd9c9beb5a50b87f9b08b00bf50fc0048482f/docs/v3/data-types/index.rst#L63-L79
HexFloat16
module-attribute
¶
A 6-character hex string (0x + 4 hex digits) encoding the
unsigned-integer representation of a float16.
__all__
module-attribute
¶
__all__ = [
"CANONICAL_NAN_HEX_FLOAT16",
"CANONICAL_NEGATIVE_INFINITY_HEX_FLOAT16",
"CANONICAL_POSITIVE_INFINITY_HEX_FLOAT16",
"FLOAT16_DATA_TYPE_NAME",
"Float16DataType",
"Float16DataTypeName",
"Float16FillValue",
"Float16SpecialFillValue",
"HexFloat16",
"hex_float16",
]
Float16DataType
dataclass
¶
Bases: FloatDataType
The float16 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/float16.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = FLOAT16_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
largest
class-attribute
¶
largest: float | None = 65504.0
The largest finite magnitude this width holds, or None for float64.
None because a Python float is a float64, so no literal that reaches here can exceed it.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
hex_float16 ¶
hex_float16(value: str) -> HexFloat16
Validate value as a HexFloat16 and brand it.
Raises ValueError if value is not exactly 0x followed by 4 hex
digits.
Source code in src/zarr_metadata/v3/data_type/float16.py
zarr_metadata.v3.data_type.float32 ¶
Zarr v3 float32 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
CANONICAL_NAN_HEX_FLOAT32
module-attribute
¶
CANONICAL_NAN_HEX_FLOAT32: Final = '0x7fc00000'
Canonical hex form of the float32 NaN sentinel "NaN".
Per spec (https://github.com/zarr-developers/zarr-specs/blob/fc7dd9c9beb5a50b87f9b08b00bf50fc0048482f/docs/v3/data-types/index.rst#L72-L74) the named "NaN" sentinel denotes the float with sign=0, the
most significant mantissa bit set, and all other mantissa bits zero
(the IEEE 754 default quiet NaN). Other NaN bit patterns must be
encoded with the explicit hex-string form.
CANONICAL_NEGATIVE_INFINITY_HEX_FLOAT32
module-attribute
¶
CANONICAL_NEGATIVE_INFINITY_HEX_FLOAT32: Final = (
"0xff800000"
)
Canonical hex form of the float32 "-Infinity" sentinel.
CANONICAL_POSITIVE_INFINITY_HEX_FLOAT32
module-attribute
¶
CANONICAL_POSITIVE_INFINITY_HEX_FLOAT32: Final = (
"0x7f800000"
)
Canonical hex form of the float32 "Infinity" sentinel.
FLOAT32_DATA_TYPE_NAME
module-attribute
¶
FLOAT32_DATA_TYPE_NAME: Final = 'float32'
The data_type value for the float32 type.
Float32DataTypeName
module-attribute
¶
Float32DataTypeName = Literal['float32']
Literal type of the data_type field for float32.
Float32FillValue
module-attribute
¶
Float32FillValue = (
float | int | Float32SpecialFillValue | HexFloat32
)
Permitted JSON shape of the fill_value field for float32.
Either a JSON number, one of the named non-finite sentinels ("NaN",
"Infinity", "-Infinity"), or a HexFloat32 (0xYYYYYYYY string
encoding the unsigned-integer representation of the IEEE 754 value).
Float32SpecialFillValue
module-attribute
¶
Float32SpecialFillValue = Literal[
"NaN", "Infinity", "-Infinity"
]
Named non-finite fill values permitted by the spec for IEEE 754 floats.
https://github.com/zarr-developers/zarr-specs/blob/fc7dd9c9beb5a50b87f9b08b00bf50fc0048482f/docs/v3/data-types/index.rst#L63-L79
HexFloat32
module-attribute
¶
A 10-character hex string (0x + 8 hex digits) encoding the
unsigned-integer representation of a float32.
__all__
module-attribute
¶
__all__ = [
"CANONICAL_NAN_HEX_FLOAT32",
"CANONICAL_NEGATIVE_INFINITY_HEX_FLOAT32",
"CANONICAL_POSITIVE_INFINITY_HEX_FLOAT32",
"FLOAT32_DATA_TYPE_NAME",
"Float32DataType",
"Float32DataTypeName",
"Float32FillValue",
"Float32SpecialFillValue",
"HexFloat32",
"hex_float32",
]
Float32DataType
dataclass
¶
Bases: FloatDataType
The float32 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/float32.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = FLOAT32_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
largest
class-attribute
¶
largest: float | None = 3.4028235e+38
The largest finite magnitude this width holds, or None for float64.
None because a Python float is a float64, so no literal that reaches here can exceed it.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
hex_float32 ¶
hex_float32(value: str) -> HexFloat32
Validate value as a HexFloat32 and brand it.
Raises ValueError if value is not exactly 0x followed by 8 hex
digits.
Source code in src/zarr_metadata/v3/data_type/float32.py
zarr_metadata.v3.data_type.float64 ¶
Zarr v3 float64 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
CANONICAL_NAN_HEX_FLOAT64
module-attribute
¶
CANONICAL_NAN_HEX_FLOAT64: Final = '0x7ff8000000000000'
Canonical hex form of the float64 NaN sentinel "NaN".
Per spec (https://github.com/zarr-developers/zarr-specs/blob/fc7dd9c9beb5a50b87f9b08b00bf50fc0048482f/docs/v3/data-types/index.rst#L72-L74) the named "NaN" sentinel denotes the float with sign=0, the
most significant mantissa bit set, and all other mantissa bits zero
(the IEEE 754 default quiet NaN). Other NaN bit patterns must be
encoded with the explicit hex-string form.
CANONICAL_NEGATIVE_INFINITY_HEX_FLOAT64
module-attribute
¶
CANONICAL_NEGATIVE_INFINITY_HEX_FLOAT64: Final = (
"0xfff0000000000000"
)
Canonical hex form of the float64 "-Infinity" sentinel.
CANONICAL_POSITIVE_INFINITY_HEX_FLOAT64
module-attribute
¶
CANONICAL_POSITIVE_INFINITY_HEX_FLOAT64: Final = (
"0x7ff0000000000000"
)
Canonical hex form of the float64 "Infinity" sentinel.
FLOAT64_DATA_TYPE_NAME
module-attribute
¶
FLOAT64_DATA_TYPE_NAME: Final = 'float64'
The data_type value for the float64 type.
Float64DataTypeName
module-attribute
¶
Float64DataTypeName = Literal['float64']
Literal type of the data_type field for float64.
Float64FillValue
module-attribute
¶
Float64FillValue = (
float | int | Float64SpecialFillValue | HexFloat64
)
Permitted JSON shape of the fill_value field for float64.
Either a JSON number, one of the named non-finite sentinels ("NaN",
"Infinity", "-Infinity"), or a HexFloat64 (0xYYYYYYYYYYYYYYYY
string encoding the unsigned-integer representation of the IEEE 754
value).
Float64SpecialFillValue
module-attribute
¶
Float64SpecialFillValue = Literal[
"NaN", "Infinity", "-Infinity"
]
Named non-finite fill values permitted by the spec for IEEE 754 floats.
https://github.com/zarr-developers/zarr-specs/blob/fc7dd9c9beb5a50b87f9b08b00bf50fc0048482f/docs/v3/data-types/index.rst#L63-L79
HexFloat64
module-attribute
¶
An 18-character hex string (0x + 16 hex digits) encoding the
unsigned-integer representation of a float64.
__all__
module-attribute
¶
__all__ = [
"CANONICAL_NAN_HEX_FLOAT64",
"CANONICAL_NEGATIVE_INFINITY_HEX_FLOAT64",
"CANONICAL_POSITIVE_INFINITY_HEX_FLOAT64",
"FLOAT64_DATA_TYPE_NAME",
"Float64DataType",
"Float64DataTypeName",
"Float64FillValue",
"Float64SpecialFillValue",
"HexFloat64",
"hex_float64",
]
Float64DataType
dataclass
¶
Bases: FloatDataType
The float64 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/float64.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = FLOAT64_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
largest
class-attribute
¶
largest: float | None = None
The largest finite magnitude this width holds, or None for float64.
None because a Python float is a float64, so no literal that reaches here can exceed it.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
hex_float64 ¶
hex_float64(value: str) -> HexFloat64
Validate value as a HexFloat64 and brand it.
Raises ValueError if value is not exactly 0x followed by 16 hex
digits.
Source code in src/zarr_metadata/v3/data_type/float64.py
zarr_metadata.v3.data_type.complex64 ¶
Zarr v3 complex64 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
COMPLEX64_DATA_TYPE_NAME
module-attribute
¶
COMPLEX64_DATA_TYPE_NAME: Final = 'complex64'
The data_type value for the complex64 type.
Complex64Component
module-attribute
¶
Complex64Component = Float32FillValue
One real or imaginary component of a complex64 fill value.
Same shape as a float32 fill value: a JSON number, a named sentinel,
or a HexFloat32 string.
Complex64DataTypeName
module-attribute
¶
Complex64DataTypeName = Literal['complex64']
Literal type of the data_type field for complex64.
Complex64FillValue
module-attribute
¶
Complex64FillValue = tuple[
Complex64Component, Complex64Component
]
Permitted JSON shape of the fill_value field for complex64.
A two-element JSON array [real, imag] where each component is a
Complex64Component.
__all__
module-attribute
¶
__all__ = [
"COMPLEX64_DATA_TYPE_NAME",
"Complex64Component",
"Complex64DataType",
"Complex64DataTypeName",
"Complex64FillValue",
]
Complex64DataType
dataclass
¶
Bases: ComplexDataType
The complex64 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/complex64.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = COMPLEX64_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.complex128 ¶
Zarr v3 complex128 data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
COMPLEX128_DATA_TYPE_NAME
module-attribute
¶
COMPLEX128_DATA_TYPE_NAME: Final = 'complex128'
The data_type value for the complex128 type.
Complex128Component
module-attribute
¶
Complex128Component = Float64FillValue
One real or imaginary component of a complex128 fill value.
Same shape as a float64 fill value: a JSON number, a named sentinel,
or a HexFloat64 string.
Complex128DataTypeName
module-attribute
¶
Complex128DataTypeName = Literal['complex128']
Literal type of the data_type field for complex128.
Complex128FillValue
module-attribute
¶
Complex128FillValue = tuple[
Complex128Component, Complex128Component
]
Permitted JSON shape of the fill_value field for complex128.
A two-element JSON array [real, imag] where each component is a
Complex128Component.
__all__
module-attribute
¶
__all__ = [
"COMPLEX128_DATA_TYPE_NAME",
"Complex128Component",
"Complex128DataType",
"Complex128DataTypeName",
"Complex128FillValue",
]
Complex128DataType
dataclass
¶
Bases: ComplexDataType
The complex128 data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/complex128.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = COMPLEX128_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.raw ¶
Zarr v3 r<N> raw-bytes data type (parameterised by bit count).
The data_type value is a string of the form r<N> where N is a
positive multiple of 8 (e.g. r8, r16, r24).
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html (https://github.com/zarr-developers/zarr-specs/blob/fc7dd9c9beb5a50b87f9b08b00bf50fc0048482f/docs/v3/data-types/index.rst#L46-L47; fill value: https://github.com/zarr-developers/zarr-specs/blob/fc7dd9c9beb5a50b87f9b08b00bf50fc0048482f/docs/v3/data-types/index.rst#L97-L99)
RAW_BYTES_FAMILY
module-attribute
¶
RAW_BYTES_FAMILY: Final = 'r<N>'
Canonical key for the parameterized raw-bytes data type family.
Spelled as the spec writes the family; the angle brackets keep it unforgeable by a real name.
RAW_BYTES_NAME_PATTERN
module-attribute
¶
The shape of a raw-bytes data type name, not its validity.
ASCII digits only: \d would also match every other Unicode decimal, so
r16 would be read as sixteen bits and a genuine third-party
name spelled that way would be folded into this family.
Matches every r<N> spelling including malformed ones (r0, r12), so
that a misspelled member of this family is recognized as belonging to it
and reported as a misspelling, rather than passing as an unknown
third-party extension. raw_bytes_dtype_name applies the validity rule
on top. Sole owner of this grammar: other modules match through it.
RawBytesDataTypeName
module-attribute
¶
A spec-conformant r<N> raw-bytes name (e.g. "r8", "r16").
"raw bits, variable size given by *, limited to be a multiple of 8": https://github.com/zarr-developers/zarr-specs/blob/fc7dd9c9beb5a50b87f9b08b00bf50fc0048482f/docs/v3/data-types/index.rst#L46-L47
RawBytesFillValue
module-attribute
¶
Permitted JSON shape of the fill_value field for r<N>.
A JSON array of N/8 integers in [0, 255] (one per byte).
__all__
module-attribute
¶
__all__ = [
"RAW_BYTES_FAMILY",
"RAW_BYTES_NAME_PATTERN",
"RawBytesDataType",
"RawBytesDataTypeName",
"RawBytesFillValue",
"raw_bytes_dtype_name",
]
RawBytesDataType
dataclass
¶
Bases: DataTypeEntity
An r<N> raw-bytes data type, coerced from its metadata.
One class for the whole family, because r8 and r4096 differ only
in a number. That is why this is the one entity whose identifier is
not a name any document carries: r<N> is a shape, not a spelling,
and no real name can collide with it.
The spelling is kept rather than the bit count, so a document comes
back out as it went in. r008 is a valid and distinct way of writing
r8, and canonicalizing it away is not this package's call.
Source code in src/zarr_metadata/v3/data_type/raw.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration, kw_only=True
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
data_type_name
instance-attribute
¶
The spelling as written -- r8, r008 -- which is where the width lives.
identifier
class-attribute
¶
identifier: str = RAW_BYTES_FAMILY
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__init__ ¶
__init__(
data_type_name: Annotated[str, FROM_NAME],
*,
configuration: Configuration = Configuration(),
) -> None
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Every r<N> spelling, valid or not.
A malformed member of the family is recognized as belonging to it and reported as malformed, rather than passing unjudged as some third party's extension.
Source code in src/zarr_metadata/v3/data_type/raw.py
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
One byte value per byte of the scalar.
A malformed name says nothing about how wide the scalar is, so
there is no length to check against; name_problems reports the name.
Source code in src/zarr_metadata/v3/data_type/raw.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
This family's validity is in its name, not in a configuration.
"raw bits, variable size given by *, limited to be a multiple of 8" -- and zero bits is not a data type.
Source code in src/zarr_metadata/v3/data_type/raw.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
raw_bytes_dtype_name ¶
raw_bytes_dtype_name(value: str) -> RawBytesDataTypeName
Validate value as a r<N> raw-bytes name and brand it.
Raises ValueError if value is not r followed by a positive
multiple of 8.
Source code in src/zarr_metadata/v3/data_type/raw.py
zarr_metadata.v3.data_type.bytes ¶
Zarr bytes data type (variable-length raw bytes, zarr-extensions).
See https://github.com/zarr-developers/zarr-extensions/blob/4da7b37a84f76e660902f6d3de3eaef0e0febae6/data-types/bytes/README.md
BYTES_DATA_TYPE_NAME
module-attribute
¶
BYTES_DATA_TYPE_NAME: Final = 'bytes'
The data_type value for the variable-length bytes type.
Base64Bytes
module-attribute
¶
A standard-alphabet base64-encoded byte sequence.
BytesDataTypeName
module-attribute
¶
BytesDataTypeName = Literal['bytes']
Literal type of the data_type field for bytes.
BytesFillValue
module-attribute
¶
BytesFillValue = tuple[int, ...] | Base64Bytes
Permitted JSON shape of the fill_value field for bytes.
Either a JSON array of integers in [0, 255] (one per byte), or a
Base64Bytes string encoding the byte sequence.
__all__
module-attribute
¶
__all__ = [
"BYTES_DATA_TYPE_NAME",
"Base64Bytes",
"BytesDataType",
"BytesDataTypeName",
"BytesFillValue",
"base64_bytes",
]
BytesDataType
dataclass
¶
Bases: DataTypeEntity
The bytes data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/bytes.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = BYTES_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Base64, or an array of byte values of any length.
Source code in src/zarr_metadata/v3/data_type/bytes.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
base64_bytes ¶
base64_bytes(value: str) -> Base64Bytes
Validate value as a Base64Bytes and brand it.
Raises ValueError if value is not standard-alphabet base64
(length must be a multiple of 4 once padded; only A-Z, a-z,
0-9, +, /, and trailing = padding are permitted).
Source code in src/zarr_metadata/v3/data_type/bytes.py
zarr_metadata.v3.data_type.string ¶
Zarr string data type (variable-length utf-8, zarr-extensions).
See https://github.com/zarr-developers/zarr-extensions/blob/4da7b37a84f76e660902f6d3de3eaef0e0febae6/data-types/string/README.md
STRING_DATA_TYPE_NAME
module-attribute
¶
STRING_DATA_TYPE_NAME: Final = 'string'
The data_type value for the string type.
StringDataTypeName
module-attribute
¶
StringDataTypeName = Literal['string']
Literal type of the data_type field for string.
StringFillValue
module-attribute
¶
StringFillValue = str
Permitted JSON shape of the fill_value field for string: a JSON unicode string.
__all__
module-attribute
¶
StringDataType
dataclass
¶
Bases: DataTypeEntity
The string data type. The name says everything.
Source code in src/zarr_metadata/v3/data_type/string.py
configuration
class-attribute
instance-attribute
¶
configuration: Configuration = field(
default_factory=Configuration
)
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = STRING_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.numpy_datetime64 ¶
Zarr numpy.datetime64 data type (zarr-extensions).
See https://github.com/zarr-developers/zarr-extensions/blob/4da7b37a84f76e660902f6d3de3eaef0e0febae6/data-types/numpy.datetime64/README.md
NUMPY_DATETIME64_DATA_TYPE_NAME
module-attribute
¶
NUMPY_DATETIME64_DATA_TYPE_NAME: Final = 'numpy.datetime64'
The name field value of the numpy.datetime64 data type.
NumpyDatetime64DataTypeName
module-attribute
¶
NumpyDatetime64DataTypeName = Literal['numpy.datetime64']
Literal type of the name field of the numpy.datetime64 data type.
NumpyDatetime64FillValue
module-attribute
¶
Permitted JSON shape of the fill_value field for numpy.datetime64.
Either a JSON integer (count of unit * scale_factor since the epoch),
or the string "NaT" (equivalent to the integer -2**63).
NumpyTimeUnit
module-attribute
¶
NumpyTimeUnit = Literal[
"Y",
"M",
"W",
"D",
"h",
"m",
"s",
"ms",
"us",
"μs",
"ns",
"ps",
"fs",
"as",
"generic",
]
Time unit codes shared by numpy.datetime64 and numpy.timedelta64.
__all__
module-attribute
¶
__all__ = [
"NUMPY_DATETIME64_DATA_TYPE_NAME",
"NumpyDatetime64",
"NumpyDatetime64Configuration",
"NumpyDatetime64DataType",
"NumpyDatetime64DataTypeName",
"NumpyDatetime64FillValue",
"NumpyTimeUnit",
]
NumpyDatetime64 ¶
Bases: TypedDict
numpy.datetime64 data type metadata.
Source code in src/zarr_metadata/v3/data_type/numpy_datetime64.py
NumpyDatetime64Configuration ¶
Bases: TypedDict
Configuration for the numpy.datetime64 data type.
Attributes:
-
unit(ReadOnly[NumpyTimeUnit]) –A string encoding a unit of time.
-
scale_factor(ReadOnly[int]) –The multiplier relative to the unit.
Source code in src/zarr_metadata/v3/data_type/numpy_datetime64.py
NumpyDatetime64DataType
dataclass
¶
Bases: NumpyTimeDataType
The numpy.datetime64 data type, coerced from its metadata.
Source code in src/zarr_metadata/v3/data_type/numpy_datetime64.py
configuration
instance-attribute
¶
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = NUMPY_DATETIME64_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.
Source code in src/zarr_metadata/v3/_entity.py
zarr_metadata.v3.data_type.numpy_timedelta64 ¶
Zarr numpy.timedelta64 data type (zarr-extensions).
See https://github.com/zarr-developers/zarr-extensions/blob/4da7b37a84f76e660902f6d3de3eaef0e0febae6/data-types/numpy.timedelta64/README.md
NUMPY_TIMEDELTA64_DATA_TYPE_NAME
module-attribute
¶
NUMPY_TIMEDELTA64_DATA_TYPE_NAME: Final = (
"numpy.timedelta64"
)
The name field value of the numpy.timedelta64 data type.
NUMPY_TIME_MAX_SCALE_FACTOR
module-attribute
¶
NUMPY_TIME_MAX_SCALE_FACTOR: Final = 2 ** 31 - 1
The largest scale_factor numpy stores: the field is a signed int32.
NUMPY_TIME_UNIT
module-attribute
¶
NUMPY_TIME_UNIT: Final = (
"Y",
"M",
"W",
"D",
"h",
"m",
"s",
"ms",
"us",
"μs",
"ns",
"ps",
"fs",
"as",
"generic",
)
Tuple of the permitted unit values, in numpy's order from coarse to fine.
NumpyTimeUnit
module-attribute
¶
NumpyTimeUnit = Literal[
"Y",
"M",
"W",
"D",
"h",
"m",
"s",
"ms",
"us",
"μs",
"ns",
"ps",
"fs",
"as",
"generic",
]
Time unit codes shared by numpy.datetime64 and numpy.timedelta64.
NumpyTimedelta64DataTypeName
module-attribute
¶
NumpyTimedelta64DataTypeName = Literal['numpy.timedelta64']
Literal type of the name field of the numpy.timedelta64 data type.
NumpyTimedelta64FillValue
module-attribute
¶
Permitted JSON shape of the fill_value field for numpy.timedelta64.
Either a JSON integer (a count of unit * scale_factor), or the string
"NaT" (equivalent to the integer -2**63).
__all__
module-attribute
¶
__all__ = [
"NUMPY_TIMEDELTA64_DATA_TYPE_NAME",
"NUMPY_TIME_MAX_SCALE_FACTOR",
"NUMPY_TIME_UNIT",
"NumpyTimeUnit",
"NumpyTimedelta64",
"NumpyTimedelta64Configuration",
"NumpyTimedelta64DataType",
"NumpyTimedelta64DataTypeName",
"NumpyTimedelta64FillValue",
]
NumpyTimedelta64 ¶
Bases: TypedDict
numpy.timedelta64 data type metadata.
Source code in src/zarr_metadata/v3/data_type/numpy_timedelta64.py
NumpyTimedelta64Configuration ¶
Bases: TypedDict
Configuration for the numpy.timedelta64 data type.
Attributes:
-
unit(ReadOnly[NumpyTimeUnit]) –A string encoding a unit of time.
-
scale_factor(ReadOnly[int]) –The multiplier relative to the unit.
Source code in src/zarr_metadata/v3/data_type/numpy_timedelta64.py
NumpyTimedelta64DataType
dataclass
¶
Bases: NumpyTimeDataType
The numpy.timedelta64 data type, coerced from its metadata.
Source code in src/zarr_metadata/v3/data_type/numpy_timedelta64.py
configuration
instance-attribute
¶
The record of this entity's members.
An entity with members narrows it to its own record, configuration:
GzipOptions, its one positional argument. An entity of a bare name
defaults it to the empty record -- configuration: Configuration =
field(default_factory=Configuration) -- so that Crc32cCodec()
builds; coerce passes the record either way.
identifier
class-attribute
¶
identifier: str = NUMPY_TIMEDELTA64_DATA_TYPE_NAME
The name this entity is registered under.
Usually the name the metadata carries. The raw-bytes data types are
the exception: every r<N> spelling is one family, so the family gets
an invented identifier that no real name can collide with.
__post_init__ ¶
Refuse a record that is not this entity's own, then the first problem the rules find.
The runtime half of the entity's type, as the record's constructor
is of the record's: GzipCodec(BloscOptions(...)) and a family
member carrying a name that is not a string are refused before
any rule reads them. Then BloscCodec(BloscOptions(clevel=99))
raises on the first problem the rules yield.
Source code in src/zarr_metadata/v3/_entity.py
accepts
classmethod
¶
Whether name denotes this entity.
Constant for all but the raw-bytes family, where one class covers
every r<N>.
canonical ¶
canonical() -> Self
This entity in the simplest form that means the same thing.
A transformation, asked for by canonicalize_array_metadata_v3
and by nothing else. to_json does not apply it, because writing
a document back is not the same as asking for it to be rewritten:
a reader that reads and writes should not change bytes it was not
asked to change.
The default is the entity itself. Override it where two spellings
of the entity's members mean the same -- a rectilinear
dimension's run-length encoding, a typesize that noshuffle
ignores -- and, in an entity that contains entities, to put those
in canonical form: self.with_configuration(inner=self.inner.canonical()).
Source code in src/zarr_metadata/v3/_entity.py
coerce
classmethod
¶
value as this entity, or the reasons it is not one: the class's validation routine.
resolve relates a field's name to this class and hands it the
field, refined JSON with arrays as tuples, which is what value
is; this is what the class does with it. The configuration is
parsed against the record the configuration field names,
member by member; a member holding another entity is read in
context, the scope this reading is happening in. An optional
member the document left out is UNSET in the record, so no
field's default decides what a document said. The entity is
built only when every member of its own read -- its rules are
written over a whole configuration -- and handed back only when
everything inside it read too.
The envelope is the field's, not the class's, and resolve
judges it: a stray member or a must_understand of false is
not reported here. Called on a class no scope has registered,
this runs with none of registration's refusals having happened.
Source code in src/zarr_metadata/v3/_entity.py
create_unchecked
classmethod
¶
This entity with these fields, built without the constructor's checks.
The one way around them, for a caller that has just made them:
coerce, which type-checked the record and ran the rules before
building. Every field is given -- the record, and the carried
name for a family -- since nothing here applies a default.
Anything that has not checked goes through the constructor.
Source code in src/zarr_metadata/v3/_entity.py
fill_value_problems ¶
fill_value_problems(
value: object, loc: Loc = ()
) -> tuple[ValidationProblem, ...]
Why value is not a fill value of this type, if it is not.
Every data type answers this; one that accepts any fill value
says so with return ().
Source code in src/zarr_metadata/v3/data_type/_families.py
name_problems
classmethod
¶
name_problems(name: str) -> Iterator[ValidationProblem]
Why name, which accepts claimed, is not a well-formed name of this family.
For a family, whose names carry data -- r<N> -- and which claims
a malformed member so that it is reported rather than waved
through as an unknown extension. Locations are relative to the
entity: (). Default: none, for an entity of one name.
Source code in src/zarr_metadata/v3/_entity.py
storage_class ¶
storage_class() -> StorageClass | None
How one scalar occupies bytes, or None if undetermined.
None only for a composite whose parts are not all in scope: an answer would be a guess, and the rules that ask decline instead.
Source code in src/zarr_metadata/v3/_entity.py
to_json ¶
to_json() -> ZarrV3MetadataFieldJSON
This entity as a document would write it.
Written from the configuration record by the same declaration
coerce reads it by, each member by the writer its annotation
implies: the bare name when every member it holds is absent, the
object otherwise, a contained entity through its own to_json,
a JSON-valued member copied so the document is not a handle on
the entity. Faithful to every member: read a document, write it
back, and those come out as they went in. The envelope is
written the entity's way -- the bare name when nothing is
configured, the object otherwise, no must_understand, which
means what absence means -- because an entity alone has no
document to be faithful to; ArrayDocumentV3.to_json puts back
the spelling the document used. Ask canonical first if you
want the simplest equivalent spelling.
An entity whose JSON is not its fields overrides this; none in the package does.
Source code in src/zarr_metadata/v3/_entity.py
with_configuration ¶
This entity with these configuration members changed.
codec.with_configuration(typesize=UNSET) is the record rebuilt
through its constructor, which refuses a member of the wrong
type, and the entity rebuilt through its own, which refuses a
value the rules disallow -- the same checks as any construction,
since pyright cannot see the members through **changes. A
name that is not a member is refused the way replace refuses
it.