Passed
Pull Request — master (#4)
by Ramon
03:24
created

nptyping.array   F

Complexity

Total Complexity 138

Size/Duplication

Total Lines 445
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 281
dl 0
loc 445
rs 2
c 0
b 0
f 0
wmc 138

138 Methods

Rating   Name   Duplication   Size   Complexity  
A Array.__setitem__() 0 2 1
A Array.__rtruediv__() 0 2 1
A Array.__imul__() 0 2 1
A Array.__array_priority__() 0 2 1
A Array.dump() 0 2 1
A Array.flat() 0 2 1
A Array.ravel() 0 2 1
A Array.base() 0 2 1
A Array.shape() 0 2 1
A Array.__rpow__() 0 2 1
A Array.__index__() 0 2 1
A Array.__rdivmod__() 0 2 1
A Array.prod() 0 2 1
A Array.max() 0 2 1
A Array.argmax() 0 2 1
A Array.__pow__() 0 2 1
A Array.__float__() 0 2 1
A Array.__imatmul__() 0 2 1
A Array.ndim() 0 2 1
A Array.getfield() 0 2 1
A Array.__imod__() 0 2 1
A Array.clip() 0 2 1
A Array.cumprod() 0 2 1
A Array.__array_ufunc__() 0 2 1
A Array.__setstate__() 0 2 1
A Array.__ior__() 0 2 1
A Array.__len__() 0 2 1
A Array.__isub__() 0 2 1
A Array.__truediv__() 0 2 1
A Array.__contains__() 0 2 1
A Array.__getitem__() 0 2 1
A Array.transpose() 0 2 1
A Array.sort() 0 2 1
A Array.__matmul__() 0 2 1
A Array.argsort() 0 2 1
A Array.itemset() 0 2 1
A Array.__sub__() 0 2 1
A Array.__radd__() 0 2 1
A Array.__iter__() 0 2 1
A Array.__rrshift__() 0 2 1
A Array.__rfloordiv__() 0 2 1
A Array.setfield() 0 2 1
A Array.__rmul__() 0 2 1
A Array.flatten() 0 2 1
A Array.resize() 0 2 1
A Array.trace() 0 2 1
A Array.item() 0 2 1
A Array.any() 0 2 1
A Array.view() 0 2 1
A Array.argmin() 0 2 1
A Array.put() 0 2 1
A Array.tobytes() 0 2 1
A Array.var() 0 2 1
A Array.__int__() 0 2 1
A Array.copy() 0 2 1
A Array.choose() 0 2 1
A Array.__copy__() 0 2 1
A Array.flags() 0 2 1
A Array.swapaxes() 0 2 1
A Array.__iand__() 0 2 1
A Array.nbytes() 0 2 1
A Array.conjugate() 0 2 1
A Array.tostring() 0 2 1
A Array.squeeze() 0 2 1
A Array.__ifloordiv__() 0 2 1
A Array.__deepcopy__() 0 2 1
A Array.data() 0 2 1
A Array.__mul__() 0 2 1
A Array.__array__() 0 2 1
A Array.__invert__() 0 2 1
A Array.dtype() 0 2 1
A Array.take() 0 2 1
A Array.searchsorted() 0 2 1
A Array.tolist() 0 2 1
A Array.setflags() 0 2 1
A Array.argpartition() 0 2 1
A Array.__floordiv__() 0 2 1
A Array.__ilshift__() 0 2 1
A Array.size() 0 2 1
A Array.itemsize() 0 2 1
A Array.__xor__() 0 2 1
A Array.__rmod__() 0 2 1
A Array.round() 0 2 1
A Array.real() 0 2 1
A Array.__pos__() 0 2 1
A Array.__array_wrap__() 0 2 1
A Array.__divmod__() 0 2 1
A Array.__iadd__() 0 2 1
A Array.nonzero() 0 2 1
A Array.std() 0 2 1
A Array.tofile() 0 2 1
A Array.__array_function__() 0 2 1
A Array.__complex__() 0 2 1
A Array.repeat() 0 2 1
A Array.__mod__() 0 2 1
A Array.imag() 0 2 1
A Array.__array_struct__() 0 2 1
A Array.mean() 0 2 1
A Array.__add__() 0 2 1
A Array.__array_prepare__() 0 2 1
A Array.byteswap() 0 2 1
A Array.diagonal() 0 2 1
A Array.__array_interface__() 0 2 1
A Array.__rmatmul__() 0 2 1
A Array.ptp() 0 2 1
A Array.__abs__() 0 2 1
A Array.astype() 0 2 1
A Array.__rlshift__() 0 2 1
A Array.__rshift__() 0 2 1
A Array.__or__() 0 2 1
A Array.__bool__() 0 2 1
A Array.__ipow__() 0 2 1
A Array.newbyteorder() 0 2 1
A Array.conj() 0 2 1
A Array.partition() 0 2 1
A Array.fill() 0 2 1
A Array.__irshift__() 0 2 1
A Array.sum() 0 2 1
A Array.compress() 0 2 1
A Array.ctypes() 0 2 1
A Array.reshape() 0 2 1
A Array.__ror__() 0 2 1
A Array.__ixor__() 0 2 1
A Array.dumps() 0 2 1
A Array.__and__() 0 2 1
A Array.__array_finalize__() 0 2 1
A Array.dot() 0 2 1
A Array.__delitem__() 0 2 1
A Array.all() 0 2 1
A Array.__rand__() 0 2 1
A Array.__neg__() 0 2 1
A Array.__itruediv__() 0 2 1
A Array.__rxor__() 0 2 1
A Array.min() 0 2 1
A Array.__rsub__() 0 2 1
A Array.cumsum() 0 2 1
A Array.__lshift__() 0 2 1
A Array.strides() 0 2 1

How to fix   Complexity   

Complexity

Complex classes like nptyping.array often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
"""
2
The array module: support for typing Numpy ndarrays.
3
"""
4
import functools
5
import numpy as np
6
from nptyping import _array_meta
7
8
9
class Array(metaclass=_array_meta.meta()):
10
    """
11
    A representation of the `numpy.ndarray`.
12
13
    Example of an array with an undefined generic type and shape:
14
        `Array`
15
16
    Example of an array with a defined generic type:
17
        `Array[int]`
18
19
    Example of an array with a defined generic type and shape (rows):
20
        `Array[int, 3]`
21
        `Array[int, 3, ...]`
22
        `Array[int, 3, None]`
23
24
    Examples of an array with a defined generic type and shape (cols):
25
        `Array[int, None, 2]`
26
        `Array[int, ..., 2]`
27
28
    Example of an array with a defined generic type and shape (rows and cols):
29
        `Array[int, 3, 2]`
30
31
    """
32
    @functools.wraps(np.ndarray.__abs__)
33
    def __abs__(self): ...
34
35
    @functools.wraps(np.ndarray.__add__)
36
    def __add__(self): ...
37
38
    @functools.wraps(np.ndarray.__and__)
39
    def __and__(self): ...
40
41
    @functools.wraps(np.ndarray.__array__)
42
    def __array__(self): ...
43
44
    @functools.wraps(np.ndarray.__array_finalize__)
45
    def __array_finalize__(self): ...
46
47
    @functools.wraps(np.ndarray.__array_function__)
48
    def __array_function__(self): ...
49
50
    @functools.wraps(np.ndarray.__array_interface__)
51
    def __array_interface__(self): ...
52
53
    @functools.wraps(np.ndarray.__array_prepare__)
54
    def __array_prepare__(self): ...
55
56
    @functools.wraps(np.ndarray.__array_priority__)
57
    def __array_priority__(self): ...
58
59
    @functools.wraps(np.ndarray.__array_struct__)
60
    def __array_struct__(self): ...
61
62
    @functools.wraps(np.ndarray.__array_ufunc__)
63
    def __array_ufunc__(self): ...
64
65
    @functools.wraps(np.ndarray.__array_wrap__)
66
    def __array_wrap__(self): ...
67
68
    @functools.wraps(np.ndarray.__bool__)
69
    def __bool__(self): ...
70
71
    @functools.wraps(np.ndarray.__complex__)
72
    def __complex__(self): ...
73
74
    @functools.wraps(np.ndarray.__contains__)
75
    def __contains__(self): ...
76
77
    @functools.wraps(np.ndarray.__copy__)
78
    def __copy__(self): ...
79
80
    @functools.wraps(np.ndarray.__deepcopy__)
81
    def __deepcopy__(self): ...
82
83
    @functools.wraps(np.ndarray.__delitem__)
84
    def __delitem__(self): ...
85
86
    @functools.wraps(np.ndarray.__divmod__)
87
    def __divmod__(self): ...
88
89
    @functools.wraps(np.ndarray.__float__)
90
    def __float__(self): ...
91
92
    @functools.wraps(np.ndarray.__floordiv__)
93
    def __floordiv__(self): ...
94
95
    @functools.wraps(np.ndarray.__getitem__)
96
    def __getitem__(self): ...
97
98
    @functools.wraps(np.ndarray.__iadd__)
99
    def __iadd__(self): ...
100
101
    @functools.wraps(np.ndarray.__iand__)
102
    def __iand__(self): ...
103
104
    @functools.wraps(np.ndarray.__ifloordiv__)
105
    def __ifloordiv__(self): ...
106
107
    @functools.wraps(np.ndarray.__ilshift__)
108
    def __ilshift__(self): ...
109
110
    @functools.wraps(np.ndarray.__imatmul__)
111
    def __imatmul__(self): ...
112
113
    @functools.wraps(np.ndarray.__imod__)
114
    def __imod__(self): ...
115
116
    @functools.wraps(np.ndarray.__imul__)
117
    def __imul__(self): ...
118
119
    @functools.wraps(np.ndarray.__index__)
120
    def __index__(self): ...
121
122
    @functools.wraps(np.ndarray.__int__)
123
    def __int__(self): ...
124
125
    @functools.wraps(np.ndarray.__invert__)
126
    def __invert__(self): ...
127
128
    @functools.wraps(np.ndarray.__ior__)
129
    def __ior__(self): ...
130
131
    @functools.wraps(np.ndarray.__ipow__)
132
    def __ipow__(self): ...
133
134
    @functools.wraps(np.ndarray.__irshift__)
135
    def __irshift__(self): ...
136
137
    @functools.wraps(np.ndarray.__isub__)
138
    def __isub__(self): ...
139
140
    @functools.wraps(np.ndarray.__iter__)
141
    def __iter__(self): ...
142
143
    @functools.wraps(np.ndarray.__itruediv__)
144
    def __itruediv__(self): ...
145
146
    @functools.wraps(np.ndarray.__ixor__)
147
    def __ixor__(self): ...
148
149
    @functools.wraps(np.ndarray.__len__)
150
    def __len__(self): ...
151
152
    @functools.wraps(np.ndarray.__lshift__)
153
    def __lshift__(self): ...
154
155
    @functools.wraps(np.ndarray.__matmul__)
156
    def __matmul__(self): ...
157
158
    @functools.wraps(np.ndarray.__mod__)
159
    def __mod__(self): ...
160
161
    @functools.wraps(np.ndarray.__mul__)
162
    def __mul__(self): ...
163
164
    @functools.wraps(np.ndarray.__neg__)
165
    def __neg__(self): ...
166
167
    @functools.wraps(np.ndarray.__or__)
168
    def __or__(self): ...
169
170
    @functools.wraps(np.ndarray.__pos__)
171
    def __pos__(self): ...
172
173
    @functools.wraps(np.ndarray.__pow__)
174
    def __pow__(self): ...
175
176
    @functools.wraps(np.ndarray.__radd__)
177
    def __radd__(self): ...
178
179
    @functools.wraps(np.ndarray.__rand__)
180
    def __rand__(self): ...
181
182
    @functools.wraps(np.ndarray.__rdivmod__)
183
    def __rdivmod__(self): ...
184
185
    @functools.wraps(np.ndarray.__rfloordiv__)
186
    def __rfloordiv__(self): ...
187
188
    @functools.wraps(np.ndarray.__rlshift__)
189
    def __rlshift__(self): ...
190
191
    @functools.wraps(np.ndarray.__rmatmul__)
192
    def __rmatmul__(self): ...
193
194
    @functools.wraps(np.ndarray.__rmod__)
195
    def __rmod__(self): ...
196
197
    @functools.wraps(np.ndarray.__rmul__)
198
    def __rmul__(self): ...
199
200
    @functools.wraps(np.ndarray.__ror__)
201
    def __ror__(self): ...
202
203
    @functools.wraps(np.ndarray.__rpow__)
204
    def __rpow__(self): ...
205
206
    @functools.wraps(np.ndarray.__rrshift__)
207
    def __rrshift__(self): ...
208
209
    @functools.wraps(np.ndarray.__rshift__)
210
    def __rshift__(self): ...
211
212
    @functools.wraps(np.ndarray.__rsub__)
213
    def __rsub__(self): ...
214
215
    @functools.wraps(np.ndarray.__rtruediv__)
216
    def __rtruediv__(self): ...
217
218
    @functools.wraps(np.ndarray.__rxor__)
219
    def __rxor__(self): ...
220
221
    @functools.wraps(np.ndarray.__setitem__)
222
    def __setitem__(self): ...
223
224
    @functools.wraps(np.ndarray.__setstate__)
225
    def __setstate__(self): ...
226
227
    @functools.wraps(np.ndarray.__sub__)
228
    def __sub__(self): ...
229
230
    @functools.wraps(np.ndarray.__truediv__)
231
    def __truediv__(self): ...
232
233
    @functools.wraps(np.ndarray.__xor__)
234
    def __xor__(self): ...
235
236
    @functools.wraps(np.ndarray.all)
237
    def all(self): ...
238
239
    @functools.wraps(np.ndarray.any)
240
    def any(self): ...
241
242
    @functools.wraps(np.ndarray.argmax)
243
    def argmax(self): ...
244
245
    @functools.wraps(np.ndarray.argmin)
246
    def argmin(self): ...
247
248
    @functools.wraps(np.ndarray.argpartition)
249
    def argpartition(self): ...
250
251
    @functools.wraps(np.ndarray.argsort)
252
    def argsort(self): ...
253
254
    @functools.wraps(np.ndarray.astype)
255
    def astype(self): ...
256
257
    @functools.wraps(np.ndarray.base)
258
    def base(self): ...
259
260
    @functools.wraps(np.ndarray.byteswap)
261
    def byteswap(self): ...
262
263
    @functools.wraps(np.ndarray.choose)
264
    def choose(self): ...
265
266
    @functools.wraps(np.ndarray.clip)
267
    def clip(self): ...
268
269
    @functools.wraps(np.ndarray.compress)
270
    def compress(self): ...
271
272
    @functools.wraps(np.ndarray.conj)
273
    def conj(self): ...
274
275
    @functools.wraps(np.ndarray.conjugate)
276
    def conjugate(self): ...
277
278
    @functools.wraps(np.ndarray.copy)
279
    def copy(self): ...
280
281
    @functools.wraps(np.ndarray.ctypes)
282
    def ctypes(self): ...
283
284
    @functools.wraps(np.ndarray.cumprod)
285
    def cumprod(self): ...
286
287
    @functools.wraps(np.ndarray.cumsum)
288
    def cumsum(self): ...
289
290
    @functools.wraps(np.ndarray.data)
291
    def data(self): ...
292
293
    @functools.wraps(np.ndarray.diagonal)
294
    def diagonal(self): ...
295
296
    @functools.wraps(np.ndarray.dot)
297
    def dot(self): ...
298
299
    @functools.wraps(np.ndarray.dtype)
300
    def dtype(self): ...
301
302
    @functools.wraps(np.ndarray.dump)
303
    def dump(self): ...
304
305
    @functools.wraps(np.ndarray.dumps)
306
    def dumps(self): ...
307
308
    @functools.wraps(np.ndarray.fill)
309
    def fill(self): ...
310
311
    @functools.wraps(np.ndarray.flags)
312
    def flags(self): ...
313
314
    @functools.wraps(np.ndarray.flat)
315
    def flat(self): ...
316
317
    @functools.wraps(np.ndarray.flatten)
318
    def flatten(self): ...
319
320
    @functools.wraps(np.ndarray.getfield)
321
    def getfield(self): ...
322
323
    @functools.wraps(np.ndarray.imag)
324
    def imag(self): ...
325
326
    @functools.wraps(np.ndarray.item)
327
    def item(self): ...
328
329
    @functools.wraps(np.ndarray.itemset)
330
    def itemset(self): ...
331
332
    @functools.wraps(np.ndarray.itemsize)
333
    def itemsize(self): ...
334
335
    @functools.wraps(np.ndarray.max)
336
    def max(self): ...
337
338
    @functools.wraps(np.ndarray.mean)
339
    def mean(self): ...
340
341
    @functools.wraps(np.ndarray.min)
342
    def min(self): ...
343
344
    @functools.wraps(np.ndarray.nbytes)
345
    def nbytes(self): ...
346
347
    @functools.wraps(np.ndarray.ndim)
348
    def ndim(self): ...
349
350
    @functools.wraps(np.ndarray.newbyteorder)
351
    def newbyteorder(self): ...
352
353
    @functools.wraps(np.ndarray.nonzero)
354
    def nonzero(self): ...
355
356
    @functools.wraps(np.ndarray.partition)
357
    def partition(self): ...
358
359
    @functools.wraps(np.ndarray.prod)
360
    def prod(self): ...
361
362
    @functools.wraps(np.ndarray.ptp)
363
    def ptp(self): ...
364
365
    @functools.wraps(np.ndarray.put)
366
    def put(self): ...
367
368
    @functools.wraps(np.ndarray.ravel)
369
    def ravel(self): ...
370
371
    @functools.wraps(np.ndarray.real)
372
    def real(self): ...
373
374
    @functools.wraps(np.ndarray.repeat)
375
    def repeat(self): ...
376
377
    @functools.wraps(np.ndarray.reshape)
378
    def reshape(self): ...
379
380
    @functools.wraps(np.ndarray.resize)
381
    def resize(self): ...
382
383
    @functools.wraps(np.ndarray.round)
384
    def round(self): ...
385
386
    @functools.wraps(np.ndarray.searchsorted)
387
    def searchsorted(self): ...
388
389
    @functools.wraps(np.ndarray.setfield)
390
    def setfield(self): ...
391
392
    @functools.wraps(np.ndarray.setflags)
393
    def setflags(self): ...
394
395
    @functools.wraps(np.ndarray.shape)
396
    def shape(self): ...
397
398
    @functools.wraps(np.ndarray.size)
399
    def size(self): ...
400
401
    @functools.wraps(np.ndarray.sort)
402
    def sort(self): ...
403
404
    @functools.wraps(np.ndarray.squeeze)
405
    def squeeze(self): ...
406
407
    @functools.wraps(np.ndarray.std)
408
    def std(self): ...
409
410
    @functools.wraps(np.ndarray.strides)
411
    def strides(self): ...
412
413
    @functools.wraps(np.ndarray.sum)
414
    def sum(self): ...
415
416
    @functools.wraps(np.ndarray.swapaxes)
417
    def swapaxes(self): ...
418
419
    @functools.wraps(np.ndarray.take)
420
    def take(self): ...
421
422
    @functools.wraps(np.ndarray.tobytes)
423
    def tobytes(self): ...
424
425
    @functools.wraps(np.ndarray.tofile)
426
    def tofile(self): ...
427
428
    @functools.wraps(np.ndarray.tolist)
429
    def tolist(self): ...
430
431
    @functools.wraps(np.ndarray.tostring)
432
    def tostring(self): ...
433
434
    @functools.wraps(np.ndarray.trace)
435
    def trace(self): ...
436
437
    @functools.wraps(np.ndarray.transpose)
438
    def transpose(self): ...
439
440
    @functools.wraps(np.ndarray.var)
441
    def var(self): ...
442
443
    @functools.wraps(np.ndarray.view)
444
    def view(self): ...
445