Skip to content

Commit 261e10e

Browse files
committed
added TODO/XXX/FIXME/misc comments
1 parent 85f5996 commit 261e10e

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

larray/core/abstractbases.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
# define abstract base classes to enable isinstance type checking on our objects
77
# idea taken from https://github.com/pandas-dev/pandas/blob/master/pandas/core/dtypes/generic.py
8+
# FIXME: __metaclass__ is ignored in Python 3
89
class ABCAxis(object):
910
__metaclass__ = ABCMeta
1011

larray/core/array.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# * Axis.sequence? geo.seq('A31', 'A38') (equivalent to geo['A31..A38'])
1919

20-
# * re-implement row_totals/col_totals? or what do we do with them?
20+
# ? re-implement row_totals/col_totals? or what do we do with them?
2121

2222
# * time specific API so that we know if we go for a subclass or not
2323

@@ -397,7 +397,7 @@ def __getitem__(self, key):
397397

398398
def __setitem__(self, key, value):
399399
# we still need to prepare the key instead of letting numpy handle everything so that
400-
# existing (integer)LArray keys are handled correctly (broadcasted using axes names).
400+
# existing (integer)LArray keys are broadcasted correctly (using axes names).
401401
self.array.__setitem__(self._prepare_key(key, wildcard=True), value, translate_key=False)
402402

403403

@@ -710,7 +710,7 @@ def meta(self, meta):
710710
"instead of {}".format(type(meta).__name__))
711711
self._meta = meta if isinstance(meta, Metadata) else Metadata(meta)
712712

713-
# TODO: rename to posnonzero and implement a label version of nonzero
713+
# TODO: rename to inonzero and implement a label version of nonzero
714714
# TODO: implement wildcard argument to avoid producing the combined labels
715715
def nonzero(self):
716716
r"""
@@ -1273,6 +1273,9 @@ def __bool__(self):
12731273
# Python 2
12741274
__nonzero__ = __bool__
12751275

1276+
# TODO: this should be a thin wrapper around a method in AxisCollection
1277+
# TODO: either support a list (of axes names) as first argument here (and set_labels)
1278+
# or don't support that in set_axes
12761279
def rename(self, renames=None, to=None, inplace=False, **kwargs):
12771280
"""Renames axes of the array.
12781281
@@ -8379,6 +8382,7 @@ def stack(elements=None, axis=None, title=None, meta=None, **kwargs):
83798382
axis = Axis(axis)
83808383
if elements is None:
83818384
if not isinstance(axis, Axis) and sys.version_info[:2] < (3, 6):
8385+
# XXX: this should probably be a warning, not an error
83828386
raise TypeError("axis argument should provide label order when using keyword arguments on Python < 3.6")
83838387
elements = kwargs.items()
83848388
elif kwargs:
@@ -8394,6 +8398,8 @@ def stack(elements=None, axis=None, title=None, meta=None, **kwargs):
83948398
axis = elements.axes[axis]
83958399
values = [elements[k] for k in axis]
83968400
elif isinstance(elements, dict):
8401+
# TODO: support having no Axis object for Python3.7 (without error or warning)
8402+
# XXX: we probably want to support this with a warning on Python < 3.7
83978403
assert isinstance(axis, Axis)
83988404
values = [elements[v] for v in axis.labels]
83998405
elif isinstance(elements, Iterable):

larray/core/axis.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def __init__(self, labels, name=None):
104104
self.__sorted_values = None
105105
self._length = None
106106
self._iswildcard = False
107+
# set _labels, _length and _iswildcard via the property
107108
self.labels = labels
108109

109110
@property
@@ -2059,6 +2060,9 @@ def copy(self):
20592060
"""
20602061
return self[:]
20612062

2063+
# XXX: what's the point in supporting a list of Axis or AxisCollection in axes_to_replace?
2064+
# it is used in LArray.set_axes but if it is only there, shouldn't the support for that be
2065+
# moved there?
20622066
def replace(self, axes_to_replace=None, new_axis=None, inplace=False, **kwargs):
20632067
"""Replace one, several or all axes of the collection.
20642068

larray/inout/xw_excel.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def close(self):
270270
if self.filepath is not None and os.path.isfile(self.xw_wkb.fullname):
271271
tmp_file = self.xw_wkb.fullname
272272
self.xw_wkb.close()
273+
# XXX: do we check for this case earlier and act differently depending on overwrite?
273274
os.remove(self.filepath)
274275
os.rename(tmp_file, self.filepath)
275276
else:
@@ -292,6 +293,10 @@ def __enter__(self):
292293
return self
293294

294295
def __exit__(self, type_, value, traceback):
296+
# XXX: we should probably also avoid closing the workbook for visible=True???
297+
# XXX: we might want to disallow using open_excel as a context manager (in __enter__)
298+
# when we have nothing to do in close because it is kinda misleading (this might piss off
299+
# users though, so maybe a warning would be better).
295300
if not self.active_workbook:
296301
self.close()
297302

0 commit comments

Comments
 (0)