Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
addresses #16: put in empty help messages for all arrays to clobber t…
Browse files Browse the repository at this point in the history
…he wrong one
  • Loading branch information
jpivarski committed Oct 26, 2018
1 parent 05f85a4 commit 28e4862
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 0 deletions.
8 changes: 8 additions & 0 deletions awkward/array/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
import awkward.util

class AwkwardArray(awkward.util.NDArrayOperatorsMixin):
"""
AwkwardArray: abstract base class
"""

def __array__(self, *args, **kwargs):
# hitting this function is usually undesirable; uncomment to search for performance bugs
# raise Exception("{0} {1}".format(args, kwargs))
Expand Down Expand Up @@ -187,6 +191,10 @@ def minby(self, function):
return self[function(*args, **kwargs).argmin()]

class AwkwardArrayWithContent(AwkwardArray):
"""
AwkwardArrayWithContent: abstract base class
"""

def __setitem__(self, where, what):
if isinstance(where, awkward.util.string):
self._content[where] = what
Expand Down
8 changes: 8 additions & 0 deletions awkward/array/chunked.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
import awkward.util

class ChunkedArray(awkward.array.base.AwkwardArray):
"""
ChunkedArray
"""

def __init__(self, chunks, counts=[]):
self.chunks = chunks
self.counts = counts
Expand Down Expand Up @@ -610,6 +614,10 @@ def pandas(self):
raise NotImplementedError

class AppendableArray(ChunkedArray):
"""
AppendableArray
"""

def __init__(self, chunkshape, dtype, chunks=[]):
self.chunkshape = chunkshape
self.dtype = dtype
Expand Down
12 changes: 12 additions & 0 deletions awkward/array/indexed.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def invert(permutation):
return out

class IndexedArray(awkward.array.base.AwkwardArrayWithContent):
"""
IndexedArray
"""

def __init__(self, index, content):
self.index = index
self.content = content
Expand Down Expand Up @@ -204,6 +208,10 @@ def pandas(self):
return self._content[self._index].pandas()

class ByteIndexedArray(IndexedArray):
"""
ByteIndexedArray
"""

def __init__(self, index, content, dtype):
super(ByteIndexedArray, self).__init__(index, content)
self.dtype = dtype
Expand Down Expand Up @@ -363,6 +371,10 @@ def pandas(self):
raise NotImplementedError

class SparseArray(awkward.array.base.AwkwardArrayWithContent):
"""
SparseArray
"""

def __init__(self, length, index, content, default=None):
self.length = length
self.index = index
Expand Down
8 changes: 8 additions & 0 deletions awkward/array/jagged.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ def uniques2offsetsparents(uniques):
return offsets, parents

class JaggedArray(awkward.array.base.AwkwardArrayWithContent):
"""
JaggedArray
"""

def __init__(self, starts, stops, content):
self.starts = starts
self.stops = stops
Expand Down Expand Up @@ -1089,6 +1093,10 @@ def pandas(self):
return out

class ByteJaggedArray(JaggedArray):
"""
ByteJaggedArray
"""

def __init__(self, starts, stops, content, subdtype):
super(ByteJaggedArray, self).__init__(starts, stops, content)
self.subdtype = subdtype
Expand Down
12 changes: 12 additions & 0 deletions awkward/array/masked.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
import awkward.util

class MaskedArray(awkward.array.base.AwkwardArrayWithContent):
"""
MaskedArray
"""

### WTF were the designers of numpy.ma thinking?
# @staticmethod
# def is_masked(x):
Expand Down Expand Up @@ -278,6 +282,10 @@ def pandas(self):
raise NotImplementedError

class BitMaskedArray(MaskedArray):
"""
BitMaskedArray
"""

def __init__(self, mask, content, maskedwhen=True, lsborder=False):
super(BitMaskedArray, self).__init__(mask, content, maskedwhen=maskedwhen)
self.lsborder = lsborder
Expand Down Expand Up @@ -505,6 +513,10 @@ def pandas(self):
raise NotImplementedError

class IndexedMaskedArray(MaskedArray):
"""
IndexedMaskedArray
"""

def __init__(self, mask, content, maskedwhen=-1):
super(IndexedMaskedArray, self).__init__(mask, content, maskedwhen=maskedwhen)
self._isvalid = False
Expand Down
8 changes: 8 additions & 0 deletions awkward/array/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
import awkward.util

class Methods(object):
"""
Methods: abstract mix-in
"""

@staticmethod
def mixin(methods, awkwardtype):
assert issubclass(methods, Methods)
Expand All @@ -55,6 +59,10 @@ def maybemixin(sample, awkwardtype):
return awkwardtype

class ObjectArray(awkward.array.base.AwkwardArrayWithContent):
"""
ObjectArray
"""

def __init__(self, content, generator, args=(), kwargs={}):
self.content = content
self.generator = generator
Expand Down
8 changes: 8 additions & 0 deletions awkward/array/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@
import awkward.util

class Table(awkward.array.base.AwkwardArray):
"""
Table
"""

##################### class Row

class Row(object):
"""
Table.Row
"""

__slots__ = ["_table", "_index"]

def __init__(self, table, index):
Expand Down
4 changes: 4 additions & 0 deletions awkward/array/union.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
import awkward.util

class UnionArray(awkward.array.base.AwkwardArray):
"""
UnionArray
"""

def __init__(self, tags, index, contents):
self.tags = tags
self.index = index
Expand Down
4 changes: 4 additions & 0 deletions awkward/array/virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
import awkward.util

class VirtualArray(awkward.array.base.AwkwardArray):
"""
VirtualArray
"""

class TransientKey(object):
def __init__(self, id):
self._id = id
Expand Down
8 changes: 8 additions & 0 deletions awkward/derived/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
import awkward.array.objects

class StringMethods(object):
"""
StringMethods
"""

def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
if method != "__call__":
raise NotImplemented
Expand Down Expand Up @@ -90,6 +94,10 @@ def tostring(x, decoder):
return decoder(x, errors="replace")[0]

class StringArray(StringMethods, awkward.array.objects.ObjectArray):
"""
StringArray
"""

def __init__(self, starts, stops, content, encoding="utf-8"):
self._content = awkward.array.jagged.ByteJaggedArray(starts, stops, content, awkward.util.CHARTYPE)
self._generator = tostring
Expand Down

0 comments on commit 28e4862

Please sign in to comment.