Commit 1b598d99 authored by theos's avatar theos
Browse files

Added missing

parent ad5ddd5c
# -*- coding: utf-8 -*-
import numpy as np
class FieldType(object):
def __init__(self, shape, dtype):
new_shape = tuple([int(i) for i in shape])
except TypeError:
new_shape = (int(shape), )
self._shape = new_shape
self._dtype = np.dtype(dtype)
def __hash__(self):
# Extract the identifying parts from the vars(self) dict.
result_hash = 0
for (key, item) in vars(self).items():
result_hash ^= item.__hash__() ^ int(hash(key)/117)
return result_hash
def __eq__(self, x):
if isinstance(x, type(self)):
return hash(self) == hash(x)
return False
def shape(self):
return self._shape
def dtype(self):
return self._dtype
def dim(self):
raise NotImplementedError
def process(self, method_name, array, inplace=True, **kwargs):
result_array = self.__getattr__(method_name)(array,
except AttributeError:
if inplace:
result_array = array
result_array = array.copy()
return result_array
def complement_cast(self, x, axes=None):
return x
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment