Skip to content

Commit

Permalink
ENH: add alias to_numpy_descr to BuiltinDtype
Browse files Browse the repository at this point in the history
  • Loading branch information
genematx committed Nov 8, 2024
1 parent 7d427ac commit 7b3df2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tiled/server/pydantic_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def to_numpy_str(self):
# we need to divide by 4.
size = self.itemsize if self.kind != Kind.unicode else self.itemsize // 4
return f"{endianness}{self.kind.value}{size}{self.dt_units or ''}"

def to_numpy_descr(self):
return self.to_numpy_str() # Alias to match StructDtype API

@classmethod
def from_json(cls, structure):
Expand Down
3 changes: 3 additions & 0 deletions tiled/structures/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def to_numpy_str(self):
# we need to divide by 4.
size = self.itemsize if self.kind != Kind.unicode else self.itemsize // 4
return f"{endianness}{self.kind.value}{size}{self.dt_units or ''}"

def to_numpy_descr(self):
return self.to_numpy_str() # Alias to match StructDtype API

@classmethod
def from_json(cls, structure):
Expand Down

0 comments on commit 7b3df2a

Please sign in to comment.