Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cubed/primitive/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BufferCopies:
"""The number of copies made when writing an array to storage."""


def get_buffer_copies(spec: Optional[Spec]):
def get_buffer_copies(spec: Optional[Spec]) -> BufferCopies:
"""Return the number of buffer copies to use, based on the spec.

Using cloud storage will result in more buffer copies being accounted for.
Expand Down Expand Up @@ -84,10 +84,10 @@ class MemoryModeller:
current_mem: int = 0
peak_mem: int = 0

def allocate(self, num_bytes):
def allocate(self, num_bytes: int) -> None:
self.current_mem += num_bytes
self.peak_mem = max(self.peak_mem, self.current_mem)

def free(self, num_bytes):
def free(self, num_bytes: int) -> None:
self.current_mem -= num_bytes
self.peak_mem = max(self.peak_mem, self.current_mem)
5 changes: 2 additions & 3 deletions cubed/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import collections
import inspect
import itertools
import numbers
import platform
import sys
import sysconfig
Expand Down Expand Up @@ -386,8 +385,8 @@ def normalize_shape(shape: Union[int, Tuple[int, ...], None]) -> Tuple[int, ...]
if shape is None:
raise TypeError("shape is None")

if isinstance(shape, numbers.Integral):
shape = (int(shape),)
if isinstance(shape, int):
shape = (shape,)

shape = cast(Tuple[int, ...], shape)
shape = tuple(int(s) for s in shape)
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,22 @@ known-third-party = [
"toolz",
"zarr",
]

[tool.mypy]
files = "cubed"
python_version = "3.11"
strict = false
enable_error_code = ["truthy-bool"]
ignore_missing_imports = true
allow_redefinition= true
exclude = [
"cubed/array_api",
"cubed/tests",
"cubed/vendor",
"docs"
]

[[tool.mypy.overrides]]
# Ignore vendored libraries
module = [ "cubed.array_api.*", "cubed.vendor.*", ]
ignore_errors = true
87 changes: 0 additions & 87 deletions setup.cfg

This file was deleted.

Loading