Skip to content

Commit c486bc3

Browse files
committed
[Enh] Change file names for PEP-8
1 parent 325adf6 commit c486bc3

File tree

12 files changed

+34
-32
lines changed

12 files changed

+34
-32
lines changed

spm/__wrapper__/Array.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ def from_cell(cls, other, **kwargs) -> "Array":
178178
array : Array
179179
Converted array.
180180
"""
181-
from .Cell import Cell # FIXME: avoid circular import
181+
from .. import Cell # FIXME: avoid circular import
182+
182183
if not isinstance(other, Cell):
183184
raise TypeError(f"Expected a {Cell} but got a {type(other)}")
184185
order = kwargs.get("order", None)

spm/__wrapper__/Runtime.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def _import_initialize():
6060
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6161
print(Runtime._help)
6262
raise e
63+
6364
# Make sure matlab is imported
6465
_import_matlab()
6566

spm/__wrapper__/Struct.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def from_any(cls, other, **kwargs) -> "Struct":
271271
@classmethod
272272
def from_cell(cls, other, **kwargs) -> "Struct":
273273
"""See `from_any`."""
274-
from .Cell import Cell
274+
from . import Cell
275275
if not isinstance(other, Cell):
276276
raise TypeError(f"Expected a {Cell} but got a {type(other)}.")
277277
return cls.from_any(other, **kwargs)
@@ -352,7 +352,7 @@ def as_dict(self, keys=None) -> dict:
352352
for key in keys:
353353
asdict[key].append(item[key])
354354

355-
from .Cell import Cell
355+
from . import Cell
356356
for key in keys:
357357
asdict[key] = Cell.from_any(asdict[key])
358358

spm/__wrapper__/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
from . import utils
22
from . import core
3-
from .Runtime import Runtime
4-
from .MatlabClass import MatlabClass
5-
from .MatlabFunction import MatlabFunction
6-
from .Cell import Cell
7-
from .Struct import Struct
8-
from .Array import Array
9-
from .SparseArray import SparseArray
3+
from . import helpers
4+
from .runtime import Runtime
5+
from .matlab_class import MatlabClass
6+
from .matlab_function import MatlabFunction
7+
from .cell import Cell
8+
from .struct import Struct
9+
from .array import Array
10+
from .sparse_array import SparseArray
1011

1112

1213
# ----------------------------------------------------------------------

spm/__wrapper__/core/delayed_types.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def as_num(self) -> "DelayedArray":
193193
return self._future
194194

195195
def as_obj(self, obj):
196-
from ..MatlabClass import MatlabClass
196+
from .. import MatlabClass
197197
if (
198198
self._future is not None and
199199
not isinstance(self._future, MatlabClass)
@@ -216,10 +216,12 @@ def __getattr__(self, key):
216216
return self.as_struct[key]
217217

218218
def __setitem__(self, index, value):
219-
from ..MatlabClass import MatlabClass
220-
from ..Cell import Cell
221-
from ..Array import Array
222-
from ..Struct import Struct
219+
from .. import (
220+
MatlabClass,
221+
Cell,
222+
Array,
223+
Struct
224+
)
223225

224226
if isinstance(index, str):
225227
arr = self.as_struct
@@ -315,7 +317,7 @@ def __init__(self, shape, parent, *index):
315317
*index : int | str
316318
Index of the future object in its parent.
317319
"""
318-
from ..Struct import Struct
320+
from .. import Struct
319321
future = Struct.from_shape(shape)
320322
future._delayed_wrapper = self
321323
super().__init__(future, parent, *index)
@@ -339,7 +341,7 @@ def __init__(self, shape, parent, *index):
339341
*index : int | str
340342
Index of the future object in its parent.
341343
"""
342-
from ..Cell import Cell
344+
from .. import Cell
343345
future = Cell.from_shape(shape)
344346
future._delayed_wrapper = self
345347
super().__init__(future, parent, *index)
@@ -373,7 +375,7 @@ def __init__(self, shape, parent, *index):
373375
*index : int | str
374376
Index of the future object in its parent.
375377
"""
376-
from ..Array import Array
378+
from .. import Array
377379
future = Array.from_shape(shape)
378380
future._delayed_wrapper = self
379381
super().__init__(future, parent, *index)

spm/__wrapper__/core/mixin_types.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
from typing import TYPE_CHECKING
1616
if TYPE_CHECKING:
17-
from .Struct import Struct
18-
from .Cell import Cell
17+
from .. import Struct, Cell
1918

2019
class _ListishMixin:
2120
"""These methods are implemented in Cell and Array, but not Struct."""
@@ -451,7 +450,7 @@ def __getitem__(self, key):
451450

452451
parent = getattr(self, "_delayed_wrapper", self)
453452

454-
from ..Struct import Struct # FIXME: circular imports
453+
from ..struct import Struct # FIXME: circular imports
455454
delayed = Struct(self.shape)
456455
opt = dict(
457456
flags=['refs_ok', 'zerosize_ok', 'multi_index'],
@@ -532,7 +531,7 @@ def setdefault(self, key, value=None):
532531
item.setdefault(key, value)
533532

534533
def update(self, other):
535-
from ..Struct import Struct # FIXME: circular imports
534+
from ..struct import Struct # FIXME: circular imports
536535
other = Struct.from_any(other)
537536
other = np.ndarray.view(other, np.ndarray)
538537
other = np.broadcast_to(other, self.shape)
@@ -578,6 +577,6 @@ def broadcast_to_struct(self, struct: "Struct") -> "Struct":
578577
return np.broadcast_to(self, shape)
579578

580579
def to_cell(self) -> "Cell":
581-
from ..Cell import Cell # FIXME: circular imports
580+
from .. import Cell # FIXME: circular imports
582581
return np.ndarray.view(self, Cell)
583582

spm/__wrapper__/core/wrapped_types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,7 @@ def _resize_for_index(self, index, set_default=True):
293293
arr[scalar_index] = scalar
294294

295295
def _return_delayed(self, index):
296-
from ..Cell import Cell
297-
from ..Struct import Struct
296+
from .. import Cell, Struct # FIXME: avoid circular import
298297

299298
if not isinstance(index, tuple):
300299
index = (index,)
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .core import MatlabType
2+
from .runtime import Runtime
23

34
import numpy as np
45
import warnings
@@ -7,7 +8,6 @@ class MatlabClass(MatlabType):
78
_subclasses = dict()
89

910
def __new__(cls, *args, _objdict=None, **kwargs):
10-
from .Runtime import Runtime
1111

1212
if _objdict is None:
1313
if cls.__name__ in MatlabClass._subclasses.keys():
@@ -88,6 +88,7 @@ def __call(self, *index):
8888
raise IndexError(index)
8989

9090
def _process_index(self, ind, k=1, n=1):
91+
# FIXME: This should not need to call matlab
9192
try:
9293
return tuple(
9394
self._process_index(i, k+1, len(ind))
@@ -96,8 +97,6 @@ def _process_index(self, ind, k=1, n=1):
9697
except TypeError:
9798
pass
9899

99-
from .Runtime import Runtime
100-
101100
if not hasattr(self, '__endfn'):
102101
self.__endfn = Runtime.call('str2func', 'end')
103102

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .core import MatlabType
2-
from .Runtime import Runtime
2+
from .runtime import Runtime
33
from .utils import _import_matlab
44

55
class MatlabFunction(MatlabType):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
_spcopy_if_needed,
77
sparse
88
)
9-
from .Array import Array
9+
from .array import Array
1010

1111
import numpy as np
1212
import warnings

0 commit comments

Comments
 (0)