Skip to content

Commit

Permalink
MNT: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
genematx committed Oct 23, 2024
1 parent 720f891 commit 7f67f76
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions tiled/server/pydantic_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

import pydantic

from ..structures.array import BuiltinDtype, StructDtype, Endianness, Kind
from ..structures.array import BuiltinDtype, Endianness, Kind, StructDtype
from ..structures.sparse import SparseLayout


class COOStructure(pydantic.BaseModel):
shape: Tuple[int, ...] # tuple of ints like (3, 3)
chunks: Tuple[Tuple[int, ...], ...] # tuple-of-tuples-of-ints like ((3,), (3,))
data_type: Optional[Union[BuiltinDtype, StructDtype]] = None
coord_data_type: BuiltinDtype = BuiltinDtype(Endianness("little"), Kind("u"), 8) # numpy 'uint' dtype
coord_data_type: Optional[BuiltinDtype] = BuiltinDtype(
Endianness("little"), Kind("u"), 8
) # numpy 'uint' dtype
dims: Optional[Tuple[str, ...]] = None # None or tuple of names like ("x", "y")
resizable: Union[bool, Tuple[bool, ...]] = False
layout: SparseLayout = SparseLayout.COO
Expand Down
10 changes: 7 additions & 3 deletions tiled/structures/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from dataclasses import dataclass
from typing import Optional, Tuple, Union

from .array import BuiltinDtype, StructDtype, Endianness, Kind
from .array import BuiltinDtype, Endianness, Kind, StructDtype


class SparseLayout(str, enum.Enum):
Expand All @@ -16,7 +16,9 @@ class COOStructure:
chunks: Tuple[Tuple[int, ...], ...] # tuple-of-tuples-of-ints like ((3,), (3,))
shape: Tuple[int, ...] # tuple of ints like (3, 3)
data_type: Optional[Union[BuiltinDtype, StructDtype]] = None
coord_data_type: BuiltinDtype = BuiltinDtype(Endianness("little"), Kind("u"), 8) # numpy 'uint' dtype
coord_data_type: Optional[BuiltinDtype] = BuiltinDtype(
Endianness("little"), Kind("u"), 8
) # numpy 'uint' dtype
dims: Optional[Tuple[str, ...]] = None # None or tuple of names like ("x", "y")
resizable: Union[bool, Tuple[bool, ...]] = False
layout: SparseLayout = SparseLayout.COO
Expand All @@ -29,7 +31,9 @@ def from_json(cls, structure):
data_type = StructDtype.from_json(data_type)
else:
data_type = BuiltinDtype.from_json(data_type)
coord_data_type = structure.get("coord_data_type", {"endianness":"little", "kind":"u", "itemsize":8})
coord_data_type = structure.get(
"coord_data_type", {"endianness": "little", "kind": "u", "itemsize": 8}
)
return cls(
data_type=data_type,
coord_data_type=BuiltinDtype.from_json(coord_data_type),
Expand Down

0 comments on commit 7f67f76

Please sign in to comment.