code
stringlengths 22
1.05M
| apis
listlengths 1
3.31k
| extract_api
stringlengths 75
3.25M
|
|---|---|---|
# pylint: disable-msg=W0401,W0511,W0611,W0612,W0614,R0201,E1102
"""Tests suite for MaskedArray & subclassing.
:author: <NAME>
:contact: pierregm_at_uga_dot_edu
"""
from __future__ import division, absolute_import, print_function
__author__ = "<NAME>"
import warnings
import pickle
import operator
import itertools
from functools import reduce
import numpy as np
import numpy.ma.core
import numpy.core.fromnumeric as fromnumeric
import numpy.core.umath as umath
from numpy.testing import TestCase, run_module_suite, assert_raises
from numpy import ndarray
from numpy.compat import asbytes, asbytes_nested
from numpy.ma.testutils import (
assert_, assert_array_equal, assert_equal, assert_almost_equal,
assert_equal_records, fail_if_equal, assert_not_equal,
assert_mask_equal,
)
from numpy.ma.core import (
MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all,
allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2,
arcsin, arctan, argsort, array, asarray, choose, concatenate,
conjugate, cos, cosh, count, default_fill_value, diag, divide, empty,
empty_like, equal, exp, flatten_mask, filled, fix_invalid,
flatten_structured_array, fromflex, getmask, getmaskarray, greater,
greater_equal, identity, inner, isMaskedArray, less, less_equal, log,
log10, make_mask, make_mask_descr, mask_or, masked, masked_array,
masked_equal, masked_greater, masked_greater_equal, masked_inside,
masked_less, masked_less_equal, masked_not_equal, masked_outside,
masked_print_option, masked_values, masked_where, max, maximum,
maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply,
mvoid, nomask, not_equal, ones, outer, power, product, put, putmask,
ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt,
subtract, sum, take, tan, tanh, transpose, where, zeros,
)
pi = np.pi
class TestMaskedArray(TestCase):
# Base test class for MaskedArrays.
def setUp(self):
# Base data definition.
x = np.array([1., 1., 1., -2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.])
y = np.array([5., 0., 3., 2., -1., -4., 0., -10., 10., 1., 0., 3.])
a10 = 10.
m1 = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
m2 = [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1]
xm = masked_array(x, mask=m1)
ym = masked_array(y, mask=m2)
z = np.array([-.5, 0., .5, .8])
zm = masked_array(z, mask=[0, 1, 0, 0])
xf = np.where(m1, 1e+20, x)
xm.set_fill_value(1e+20)
self.d = (x, y, a10, m1, m2, xm, ym, z, zm, xf)
def test_basicattributes(self):
# Tests some basic array attributes.
a = array([1, 3, 2])
b = array([1, 3, 2], mask=[1, 0, 1])
assert_equal(a.ndim, 1)
assert_equal(b.ndim, 1)
assert_equal(a.size, 3)
assert_equal(b.size, 3)
assert_equal(a.shape, (3,))
assert_equal(b.shape, (3,))
def test_basic0d(self):
# Checks masking a scalar
x = masked_array(0)
assert_equal(str(x), '0')
x = masked_array(0, mask=True)
assert_equal(str(x), str(masked_print_option))
x = masked_array(0, mask=False)
assert_equal(str(x), '0')
x = array(0, mask=1)
self.assertTrue(x.filled().dtype is x._data.dtype)
def test_basic1d(self):
# Test of basic array creation and properties in 1 dimension.
(x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
self.assertTrue(not isMaskedArray(x))
self.assertTrue(isMaskedArray(xm))
self.assertTrue((xm - ym).filled(0).any())
fail_if_equal(xm.mask.astype(int), ym.mask.astype(int))
s = x.shape
assert_equal(np.shape(xm), s)
assert_equal(xm.shape, s)
assert_equal(xm.dtype, x.dtype)
assert_equal(zm.dtype, z.dtype)
assert_equal(xm.size, reduce(lambda x, y:x * y, s))
assert_equal(count(xm), len(m1) - reduce(lambda x, y:x + y, m1))
assert_array_equal(xm, xf)
assert_array_equal(filled(xm, 1.e20), xf)
assert_array_equal(x, xm)
def test_basic2d(self):
# Test of basic array creation and properties in 2 dimensions.
(x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
for s in [(4, 3), (6, 2)]:
x.shape = s
y.shape = s
xm.shape = s
ym.shape = s
xf.shape = s
self.assertTrue(not isMaskedArray(x))
self.assertTrue(isMaskedArray(xm))
assert_equal(shape(xm), s)
assert_equal(xm.shape, s)
assert_equal(xm.size, reduce(lambda x, y:x * y, s))
assert_equal(count(xm), len(m1) - reduce(lambda x, y:x + y, m1))
assert_equal(xm, xf)
assert_equal(filled(xm, 1.e20), xf)
assert_equal(x, xm)
def test_concatenate_basic(self):
# Tests concatenations.
(x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
# basic concatenation
assert_equal(np.concatenate((x, y)), concatenate((xm, ym)))
assert_equal(np.concatenate((x, y)), concatenate((x, y)))
assert_equal(np.concatenate((x, y)), concatenate((xm, y)))
assert_equal(np.concatenate((x, y, x)), concatenate((x, ym, x)))
def test_concatenate_alongaxis(self):
# Tests concatenations.
(x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
# Concatenation along an axis
s = (3, 4)
x.shape = y.shape = xm.shape = ym.shape = s
assert_equal(xm.mask, np.reshape(m1, s))
assert_equal(ym.mask, np.reshape(m2, s))
xmym = concatenate((xm, ym), 1)
assert_equal(np.concatenate((x, y), 1), xmym)
assert_equal(np.concatenate((xm.mask, ym.mask), 1), xmym._mask)
x = zeros(2)
y = array(ones(2), mask=[False, True])
z = concatenate((x, y))
assert_array_equal(z, [0, 0, 1, 1])
assert_array_equal(z.mask, [False, False, False, True])
z = concatenate((y, x))
assert_array_equal(z, [1, 1, 0, 0])
assert_array_equal(z.mask, [False, True, False, False])
def test_concatenate_flexible(self):
# Tests the concatenation on flexible arrays.
data = masked_array(list(zip(np.random.rand(10),
np.arange(10))),
dtype=[('a', float), ('b', int)])
test = concatenate([data[:5], data[5:]])
assert_equal_records(test, data)
def test_creation_ndmin(self):
# Check the use of ndmin
x = array([1, 2, 3], mask=[1, 0, 0], ndmin=2)
assert_equal(x.shape, (1, 3))
assert_equal(x._data, [[1, 2, 3]])
assert_equal(x._mask, [[1, 0, 0]])
def test_creation_ndmin_from_maskedarray(self):
# Make sure we're not losing the original mask w/ ndmin
x = array([1, 2, 3])
x[-1] = masked
xx = array(x, ndmin=2, dtype=float)
assert_equal(x.shape, x._mask.shape)
assert_equal(xx.shape, xx._mask.shape)
def test_creation_maskcreation(self):
# Tests how masks are initialized at the creation of Maskedarrays.
data = arange(24, dtype=float)
data[[3, 6, 15]] = masked
dma_1 = MaskedArray(data)
assert_equal(dma_1.mask, data.mask)
dma_2 = MaskedArray(dma_1)
assert_equal(dma_2.mask, dma_1.mask)
dma_3 = MaskedArray(dma_1, mask=[1, 0, 0, 0] * 6)
fail_if_equal(dma_3.mask, dma_1.mask)
x = array([1, 2, 3], mask=True)
assert_equal(x._mask, [True, True, True])
x = array([1, 2, 3], mask=False)
assert_equal(x._mask, [False, False, False])
y = array([1, 2, 3], mask=x._mask, copy=False)
assert_(np.may_share_memory(x.mask, y.mask))
y = array([1, 2, 3], mask=x._mask, copy=True)
assert_(not np.may_share_memory(x.mask, y.mask))
def test_creation_with_list_of_maskedarrays(self):
# Tests creating a masked array from a list of masked arrays.
x = array(np.arange(5), mask=[1, 0, 0, 0, 0])
data = array((x, x[::-1]))
assert_equal(data, [[0, 1, 2, 3, 4], [4, 3, 2, 1, 0]])
assert_equal(data._mask, [[1, 0, 0, 0, 0], [0, 0, 0, 0, 1]])
x.mask = nomask
data = array((x, x[::-1]))
assert_equal(data, [[0, 1, 2, 3, 4], [4, 3, 2, 1, 0]])
self.assertTrue(data.mask is nomask)
def test_asarray(self):
(x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
xm.fill_value = -9999
xm._hardmask = True
xmm = asarray(xm)
assert_equal(xmm._data, xm._data)
assert_equal(xmm._mask, xm._mask)
assert_equal(xmm.fill_value, xm.fill_value)
assert_equal(xmm._hardmask, xm._hardmask)
def test_asarray_default_order(self):
# See Issue #6646
m = np.eye(3).T
self.assertFalse(m.flags.c_contiguous)
new_m = asarray(m)
self.assertTrue(new_m.flags.c_contiguous)
def test_asarray_enforce_order(self):
# See Issue #6646
m = np.eye(3).T
self.assertFalse(m.flags.c_contiguous)
new_m = asarray(m, order='C')
self.assertTrue(new_m.flags.c_contiguous)
def test_fix_invalid(self):
# Checks fix_invalid.
with np.errstate(invalid='ignore'):
data = masked_array([np.nan, 0., 1.], mask=[0, 0, 1])
data_fixed = fix_invalid(data)
assert_equal(data_fixed._data, [data.fill_value, 0., 1.])
assert_equal(data_fixed._mask, [1., 0., 1.])
def test_maskedelement(self):
# Test of masked element
x = arange(6)
x[1] = masked
self.assertTrue(str(masked) == '--')
self.assertTrue(x[1] is masked)
assert_equal(filled(x[1], 0), 0)
def test_set_element_as_object(self):
# Tests setting elements with object
a = empty(1, dtype=object)
x = (1, 2, 3, 4, 5)
a[0] = x
assert_equal(a[0], x)
self.assertTrue(a[0] is x)
import datetime
dt = datetime.datetime.now()
a[0] = dt
self.assertTrue(a[0] is dt)
def test_indexing(self):
# Tests conversions and indexing
x1 = np.array([1, 2, 4, 3])
x2 = array(x1, mask=[1, 0, 0, 0])
x3 = array(x1, mask=[0, 1, 0, 1])
x4 = array(x1)
# test conversion to strings
str(x2) # raises?
repr(x2) # raises?
assert_equal(np.sort(x1), sort(x2, endwith=False))
# tests of indexing
assert_(type(x2[1]) is type(x1[1]))
assert_(x1[1] == x2[1])
assert_(x2[0] is masked)
assert_equal(x1[2], x2[2])
assert_equal(x1[2:5], x2[2:5])
assert_equal(x1[:], x2[:])
assert_equal(x1[1:], x3[1:])
x1[2] = 9
x2[2] = 9
assert_equal(x1, x2)
x1[1:3] = 99
x2[1:3] = 99
assert_equal(x1, x2)
x2[1] = masked
assert_equal(x1, x2)
x2[1:3] = masked
assert_equal(x1, x2)
x2[:] = x1
x2[1] = masked
assert_(allequal(getmask(x2), array([0, 1, 0, 0])))
x3[:] = masked_array([1, 2, 3, 4], [0, 1, 1, 0])
assert_(allequal(getmask(x3), array([0, 1, 1, 0])))
x4[:] = masked_array([1, 2, 3, 4], [0, 1, 1, 0])
assert_(allequal(getmask(x4), array([0, 1, 1, 0])))
assert_(allequal(x4, array([1, 2, 3, 4])))
x1 = np.arange(5) * 1.0
x2 = masked_values(x1, 3.0)
assert_equal(x1, x2)
assert_(allequal(array([0, 0, 0, 1, 0], MaskType), x2.mask))
assert_equal(3.0, x2.fill_value)
x1 = array([1, 'hello', 2, 3], object)
x2 = np.array([1, 'hello', 2, 3], object)
s1 = x1[1]
s2 = x2[1]
assert_equal(type(s2), str)
assert_equal(type(s1), str)
assert_equal(s1, s2)
assert_(x1[1:1].shape == (0,))
def test_matrix_indexing(self):
# Tests conversions and indexing
x1 = np.matrix([[1, 2, 3], [4, 3, 2]])
x2 = array(x1, mask=[[1, 0, 0], [0, 1, 0]])
x3 = array(x1, mask=[[0, 1, 0], [1, 0, 0]])
x4 = array(x1)
# test conversion to strings
str(x2) # raises?
repr(x2) # raises?
# tests of indexing
assert_(type(x2[1, 0]) is type(x1[1, 0]))
assert_(x1[1, 0] == x2[1, 0])
assert_(x2[1, 1] is masked)
assert_equal(x1[0, 2], x2[0, 2])
assert_equal(x1[0, 1:], x2[0, 1:])
assert_equal(x1[:, 2], x2[:, 2])
assert_equal(x1[:], x2[:])
assert_equal(x1[1:], x3[1:])
x1[0, 2] = 9
x2[0, 2] = 9
assert_equal(x1, x2)
x1[0, 1:] = 99
x2[0, 1:] = 99
assert_equal(x1, x2)
x2[0, 1] = masked
assert_equal(x1, x2)
x2[0, 1:] = masked
assert_equal(x1, x2)
x2[0, :] = x1[0, :]
x2[0, 1] = masked
assert_(allequal(getmask(x2), np.array([[0, 1, 0], [0, 1, 0]])))
x3[1, :] = masked_array([1, 2, 3], [1, 1, 0])
assert_(allequal(getmask(x3)[1], array([1, 1, 0])))
assert_(allequal(getmask(x3[1]), array([1, 1, 0])))
x4[1, :] = masked_array([1, 2, 3], [1, 1, 0])
assert_(allequal(getmask(x4[1]), array([1, 1, 0])))
assert_(allequal(x4[1], array([1, 2, 3])))
x1 = np.matrix(np.arange(5) * 1.0)
x2 = masked_values(x1, 3.0)
assert_equal(x1, x2)
assert_(allequal(array([0, 0, 0, 1, 0], MaskType), x2.mask))
assert_equal(3.0, x2.fill_value)
def test_copy(self):
# Tests of some subtle points of copying and sizing.
n = [0, 0, 1, 0, 0]
m = make_mask(n)
m2 = make_mask(m)
self.assertTrue(m is m2)
m3 = make_mask(m, copy=1)
self.assertTrue(m is not m3)
x1 = np.arange(5)
y1 = array(x1, mask=m)
assert_equal(y1._data.__array_interface__, x1.__array_interface__)
self.assertTrue(allequal(x1, y1.data))
assert_equal(y1._mask.__array_interface__, m.__array_interface__)
y1a = array(y1)
self.assertTrue(y1a._data.__array_interface__ ==
y1._data.__array_interface__)
self.assertTrue(y1a.mask is y1.mask)
y2 = array(x1, mask=m)
self.assertTrue(y2._data.__array_interface__ == x1.__array_interface__)
self.assertTrue(y2._mask.__array_interface__ == m.__array_interface__)
self.assertTrue(y2[2] is masked)
y2[2] = 9
self.assertTrue(y2[2] is not masked)
self.assertTrue(y2._mask.__array_interface__ != m.__array_interface__)
self.assertTrue(allequal(y2.mask, 0))
y3 = array(x1 * 1.0, mask=m)
self.assertTrue(filled(y3).dtype is (x1 * 1.0).dtype)
x4 = arange(4)
x4[2] = masked
y4 = resize(x4, (8,))
assert_equal(concatenate([x4, x4]), y4)
assert_equal(getmask(y4), [0, 0, 1, 0, 0, 0, 1, 0])
y5 = repeat(x4, (2, 2, 2, 2), axis=0)
assert_equal(y5, [0, 0, 1, 1, 2, 2, 3, 3])
y6 = repeat(x4, 2, axis=0)
assert_equal(y5, y6)
y7 = x4.repeat((2, 2, 2, 2), axis=0)
assert_equal(y5, y7)
y8 = x4.repeat(2, 0)
assert_equal(y5, y8)
y9 = x4.copy()
assert_equal(y9._data, x4._data)
assert_equal(y9._mask, x4._mask)
x = masked_array([1, 2, 3], mask=[0, 1, 0])
# Copy is False by default
y = masked_array(x)
assert_equal(y._data.ctypes.data, x._data.ctypes.data)
assert_equal(y._mask.ctypes.data, x._mask.ctypes.data)
y = masked_array(x, copy=True)
assert_not_equal(y._data.ctypes.data, x._data.ctypes.data)
assert_not_equal(y._mask.ctypes.data, x._mask.ctypes.data)
def test_copy_immutable(self):
# Tests that the copy method is immutable, GitHub issue #5247
a = np.ma.array([1, 2, 3])
b = np.ma.array([4, 5, 6])
a_copy_method = a.copy
b.copy
assert_equal(a_copy_method(), [1, 2, 3])
def test_deepcopy(self):
from copy import deepcopy
a = array([0, 1, 2], mask=[False, True, False])
copied = deepcopy(a)
assert_equal(copied.mask, a.mask)
assert_not_equal(id(a._mask), id(copied._mask))
copied[1] = 1
assert_equal(copied.mask, [0, 0, 0])
assert_equal(a.mask, [0, 1, 0])
copied = deepcopy(a)
assert_equal(copied.mask, a.mask)
copied.mask[1] = False
assert_equal(copied.mask, [0, 0, 0])
assert_equal(a.mask, [0, 1, 0])
def test_str_repr(self):
a = array([0, 1, 2], mask=[False, True, False])
assert_equal(str(a), '[0 -- 2]')
assert_equal(repr(a), 'masked_array(data = [0 -- 2],\n'
' mask = [False True False],\n'
' fill_value = 999999)\n')
a = np.ma.arange(2000)
a[1:50] = np.ma.masked
assert_equal(
repr(a),
'masked_array(data = [0 -- -- ..., 1997 1998 1999],\n'
' mask = [False True True ..., False False False],\n'
' fill_value = 999999)\n'
)
def test_pickling(self):
# Tests pickling
a = arange(10)
a[::3] = masked
a.fill_value = 999
a_pickled = pickle.loads(a.dumps())
assert_equal(a_pickled._mask, a._mask)
assert_equal(a_pickled._data, a._data)
assert_equal(a_pickled.fill_value, 999)
def test_pickling_subbaseclass(self):
# Test pickling w/ a subclass of ndarray
a = array(np.matrix(list(range(10))), mask=[1, 0, 1, 0, 0] * 2)
a_pickled = pickle.loads(a.dumps())
assert_equal(a_pickled._mask, a._mask)
assert_equal(a_pickled, a)
self.assertTrue(isinstance(a_pickled._data, np.matrix))
def test_pickling_maskedconstant(self):
# Test pickling MaskedConstant
mc = np.ma.masked
mc_pickled = pickle.loads(mc.dumps())
assert_equal(mc_pickled._baseclass, mc._baseclass)
assert_equal(mc_pickled._mask, mc._mask)
assert_equal(mc_pickled._data, mc._data)
def test_pickling_wstructured(self):
# Tests pickling w/ structured array
a = array([(1, 1.), (2, 2.)], mask=[(0, 0), (0, 1)],
dtype=[('a', int), ('b', float)])
a_pickled = pickle.loads(a.dumps())
assert_equal(a_pickled._mask, a._mask)
assert_equal(a_pickled, a)
def test_pickling_keepalignment(self):
# Tests pickling w/ F_CONTIGUOUS arrays
a = arange(10)
a.shape = (-1, 2)
b = a.T
test = pickle.loads(pickle.dumps(b))
assert_equal(test, b)
def test_single_element_subscript(self):
# Tests single element subscripts of Maskedarrays.
a = array([1, 3, 2])
b = array([1, 3, 2], mask=[1, 0, 1])
assert_equal(a[0].shape, ())
assert_equal(b[0].shape, ())
assert_equal(b[1].shape, ())
def test_topython(self):
# Tests some communication issues with Python.
assert_equal(1, int(array(1)))
assert_equal(1.0, float(array(1)))
assert_equal(1, int(array([[[1]]])))
assert_equal(1.0, float(array([[1]])))
self.assertRaises(TypeError, float, array([1, 1]))
with warnings.catch_warnings():
warnings.simplefilter('ignore', UserWarning)
assert_(np.isnan(float(array([1], mask=[1]))))
a = array([1, 2, 3], mask=[1, 0, 0])
self.assertRaises(TypeError, lambda:float(a))
assert_equal(float(a[-1]), 3.)
self.assertTrue(np.isnan(float(a[0])))
self.assertRaises(TypeError, int, a)
assert_equal(int(a[-1]), 3)
self.assertRaises(MAError, lambda:int(a[0]))
def test_oddfeatures_1(self):
# Test of other odd features
x = arange(20)
x = x.reshape(4, 5)
x.flat[5] = 12
assert_(x[1, 0] == 12)
z = x + 10j * x
assert_equal(z.real, x)
assert_equal(z.imag, 10 * x)
assert_equal((z * conjugate(z)).real, 101 * x * x)
z.imag[...] = 0.0
x = arange(10)
x[3] = masked
assert_(str(x[3]) == str(masked))
c = x >= 8
assert_(count(where(c, masked, masked)) == 0)
assert_(shape(where(c, masked, masked)) == c.shape)
z = masked_where(c, x)
assert_(z.dtype is x.dtype)
assert_(z[3] is masked)
assert_(z[4] is not masked)
assert_(z[7] is not masked)
assert_(z[8] is masked)
assert_(z[9] is masked)
assert_equal(x, z)
def test_oddfeatures_2(self):
# Tests some more features.
x = array([1., 2., 3., 4., 5.])
c = array([1, 1, 1, 0, 0])
x[2] = masked
z = where(c, x, -x)
assert_equal(z, [1., 2., 0., -4., -5])
c[0] = masked
z = where(c, x, -x)
assert_equal(z, [1., 2., 0., -4., -5])
assert_(z[0] is masked)
assert_(z[1] is not masked)
assert_(z[2] is masked)
def test_oddfeatures_3(self):
# Tests some generic features
atest = array([10], mask=True)
btest = array([20])
idx = atest.mask
atest[idx] = btest[idx]
assert_equal(atest, [20])
def test_filled_w_object_dtype(self):
a = np.ma.masked_all(1, dtype='O')
assert_equal(a.filled('x')[0], 'x')
def test_filled_w_flexible_dtype(self):
# Test filled w/ flexible dtype
flexi = array([(1, 1, 1)],
dtype=[('i', int), ('s', '|S8'), ('f', float)])
flexi[0] = masked
assert_equal(flexi.filled(),
np.array([(default_fill_value(0),
default_fill_value('0'),
default_fill_value(0.),)], dtype=flexi.dtype))
flexi[0] = masked
assert_equal(flexi.filled(1),
np.array([(1, '1', 1.)], dtype=flexi.dtype))
def test_filled_w_mvoid(self):
# Test filled w/ mvoid
ndtype = [('a', int), ('b', float)]
a = mvoid((1, 2.), mask=[(0, 1)], dtype=ndtype)
# Filled using default
test = a.filled()
assert_equal(tuple(test), (1, default_fill_value(1.)))
# Explicit fill_value
test = a.filled((-1, -1))
assert_equal(tuple(test), (1, -1))
# Using predefined filling values
a.fill_value = (-999, -999)
assert_equal(tuple(a.filled()), (1, -999))
def test_filled_w_nested_dtype(self):
# Test filled w/ nested dtype
ndtype = [('A', int), ('B', [('BA', int), ('BB', int)])]
a = array([(1, (1, 1)), (2, (2, 2))],
mask=[(0, (1, 0)), (0, (0, 1))], dtype=ndtype)
test = a.filled(0)
control = np.array([(1, (0, 1)), (2, (2, 0))], dtype=ndtype)
assert_equal(test, control)
test = a['B'].filled(0)
control = np.array([(0, 1), (2, 0)], dtype=a['B'].dtype)
assert_equal(test, control)
# test if mask gets set correctly (see #6760)
Z = numpy.ma.zeros(2, numpy.dtype([("A", "(2,2)i1,(2,2)i1", (2,2))]))
assert_equal(Z.data.dtype, numpy.dtype([('A', [('f0', 'i1', (2, 2)),
('f1', 'i1', (2, 2))], (2, 2))]))
assert_equal(Z.mask.dtype, numpy.dtype([('A', [('f0', '?', (2, 2)),
('f1', '?', (2, 2))], (2, 2))]))
def test_filled_w_f_order(self):
# Test filled w/ F-contiguous array
a = array(np.array([(0, 1, 2), (4, 5, 6)], order='F'),
mask=np.array([(0, 0, 1), (1, 0, 0)], order='F'),
order='F') # this is currently ignored
self.assertTrue(a.flags['F_CONTIGUOUS'])
self.assertTrue(a.filled(0).flags['F_CONTIGUOUS'])
def test_optinfo_propagation(self):
# Checks that _optinfo dictionary isn't back-propagated
x = array([1, 2, 3, ], dtype=float)
x._optinfo['info'] = '???'
y = x.copy()
assert_equal(y._optinfo['info'], '???')
y._optinfo['info'] = '!!!'
assert_equal(x._optinfo['info'], '???')
def test_fancy_printoptions(self):
# Test printing a masked array w/ fancy dtype.
fancydtype = np.dtype([('x', int), ('y', [('t', int), ('s', float)])])
test = array([(1, (2, 3.0)), (4, (5, 6.0))],
mask=[(1, (0, 1)), (0, (1, 0))],
dtype=fancydtype)
control = "[(--, (2, --)) (4, (--, 6.0))]"
assert_equal(str(test), control)
# Test 0-d array with multi-dimensional dtype
t_2d0 = masked_array(data = (0, [[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0]],
0.0),
mask = (False, [[True, False, True],
[False, False, True]],
False),
dtype = "int, (2,3)float, float")
control = "(0, [[--, 0.0, --], [0.0, 0.0, --]], 0.0)"
assert_equal(str(t_2d0), control)
def test_flatten_structured_array(self):
# Test flatten_structured_array on arrays
# On ndarray
ndtype = [('a', int), ('b', float)]
a = np.array([(1, 1), (2, 2)], dtype=ndtype)
test = flatten_structured_array(a)
control = np.array([[1., 1.], [2., 2.]], dtype=np.float)
assert_equal(test, control)
assert_equal(test.dtype, control.dtype)
# On masked_array
a = array([(1, 1), (2, 2)], mask=[(0, 1), (1, 0)], dtype=ndtype)
test = flatten_structured_array(a)
control = array([[1., 1.], [2., 2.]],
mask=[[0, 1], [1, 0]], dtype=np.float)
assert_equal(test, control)
assert_equal(test.dtype, control.dtype)
assert_equal(test.mask, control.mask)
# On masked array with nested structure
ndtype = [('a', int), ('b', [('ba', int), ('bb', float)])]
a = array([(1, (1, 1.1)), (2, (2, 2.2))],
mask=[(0, (1, 0)), (1, (0, 1))], dtype=ndtype)
test = flatten_structured_array(a)
control = array([[1., 1., 1.1], [2., 2., 2.2]],
mask=[[0, 1, 0], [1, 0, 1]], dtype=np.float)
assert_equal(test, control)
assert_equal(test.dtype, control.dtype)
assert_equal(test.mask, control.mask)
# Keeping the initial shape
ndtype = [('a', int), ('b', float)]
a = np.array([[(1, 1), ], [(2, 2), ]], dtype=ndtype)
test = flatten_structured_array(a)
control = np.array([[[1., 1.], ], [[2., 2.], ]], dtype=np.float)
assert_equal(test, control)
assert_equal(test.dtype, control.dtype)
def test_void0d(self):
# Test creating a mvoid object
ndtype = [('a', int), ('b', int)]
a = np.array([(1, 2,)], dtype=ndtype)[0]
f = mvoid(a)
assert_(isinstance(f, mvoid))
a = masked_array([(1, 2)], mask=[(1, 0)], dtype=ndtype)[0]
assert_(isinstance(a, mvoid))
a = masked_array([(1, 2), (1, 2)], mask=[(1, 0), (0, 0)], dtype=ndtype)
f = mvoid(a._data[0], a._mask[0])
assert_(isinstance(f, mvoid))
def test_mvoid_getitem(self):
# Test mvoid.__getitem__
ndtype = [('a', int), ('b', int)]
a = masked_array([(1, 2,), (3, 4)], mask=[(0, 0), (1, 0)],
dtype=ndtype)
# w/o mask
f = a[0]
self.assertTrue(isinstance(f, mvoid))
assert_equal((f[0], f['a']), (1, 1))
assert_equal(f['b'], 2)
# w/ mask
f = a[1]
self.assertTrue(isinstance(f, mvoid))
self.assertTrue(f[0] is masked)
self.assertTrue(f['a'] is masked)
assert_equal(f[1], 4)
# exotic dtype
A = masked_array(data=[([0,1],)],
mask=[([True, False],)],
dtype=[("A", ">i2", (2,))])
assert_equal(A[0]["A"], A["A"][0])
assert_equal(A[0]["A"], masked_array(data=[0, 1],
mask=[True, False], dtype=">i2"))
def test_mvoid_iter(self):
# Test iteration on __getitem__
ndtype = [('a', int), ('b', int)]
a = masked_array([(1, 2,), (3, 4)], mask=[(0, 0), (1, 0)],
dtype=ndtype)
# w/o mask
assert_equal(list(a[0]), [1, 2])
# w/ mask
assert_equal(list(a[1]), [masked, 4])
def test_mvoid_print(self):
# Test printing a mvoid
mx = array([(1, 1), (2, 2)], dtype=[('a', int), ('b', int)])
assert_equal(str(mx[0]), "(1, 1)")
mx['b'][0] = masked
ini_display = masked_print_option._display
masked_print_option.set_display("-X-")
try:
assert_equal(str(mx[0]), "(1, -X-)")
assert_equal(repr(mx[0]), "(1, -X-)")
finally:
masked_print_option.set_display(ini_display)
# also check if there are object datatypes (see gh-7493)
mx = array([(1,), (2,)], dtype=[('a', 'O')])
assert_equal(str(mx[0]), "(1,)")
def test_mvoid_multidim_print(self):
# regression test for gh-6019
t_ma = masked_array(data = [([1, 2, 3],)],
mask = [([False, True, False],)],
fill_value = ([999999, 999999, 999999],),
dtype = [('a', '<i4', (3,))])
assert_(str(t_ma[0]) == "([1, --, 3],)")
assert_(repr(t_ma[0]) == "([1, --, 3],)")
# additional tests with structured arrays
t_2d = masked_array(data = [([[1, 2], [3,4]],)],
mask = [([[False, True], [True, False]],)],
dtype = [('a', '<i4', (2,2))])
assert_(str(t_2d[0]) == "([[1, --], [--, 4]],)")
assert_(repr(t_2d[0]) == "([[1, --], [--, 4]],)")
t_0d = masked_array(data = [(1,2)],
mask = [(True,False)],
dtype = [('a', '<i4'), ('b', '<i4')])
assert_(str(t_0d[0]) == "(--, 2)")
assert_(repr(t_0d[0]) == "(--, 2)")
t_2d = masked_array(data = [([[1, 2], [3,4]], 1)],
mask = [([[False, True], [True, False]], False)],
dtype = [('a', '<i4', (2,2)), ('b', float)])
assert_(str(t_2d[0]) == "([[1, --], [--, 4]], 1.0)")
assert_(repr(t_2d[0]) == "([[1, --], [--, 4]], 1.0)")
t_ne = masked_array(data=[(1, (1, 1))],
mask=[(True, (True, False))],
dtype = [('a', '<i4'), ('b', 'i4,i4')])
assert_(str(t_ne[0]) == "(--, (--, 1))")
assert_(repr(t_ne[0]) == "(--, (--, 1))")
def test_object_with_array(self):
mx1 = masked_array([1.], mask=[True])
mx2 = masked_array([1., 2.])
mx = masked_array([mx1, mx2], mask=[False, True])
assert_(mx[0] is mx1)
assert_(mx[1] is not mx2)
assert_(np.all(mx[1].data == mx2.data))
assert_(np.all(mx[1].mask))
# check that we return a view.
mx[1].data[0] = 0.
assert_(mx2[0] == 0.)
class TestMaskedArrayArithmetic(TestCase):
# Base test class for MaskedArrays.
def setUp(self):
# Base data definition.
x = np.array([1., 1., 1., -2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.])
y = np.array([5., 0., 3., 2., -1., -4., 0., -10., 10., 1., 0., 3.])
a10 = 10.
m1 = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
m2 = [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1]
xm = masked_array(x, mask=m1)
ym = masked_array(y, mask=m2)
z = np.array([-.5, 0., .5, .8])
zm = masked_array(z, mask=[0, 1, 0, 0])
xf = np.where(m1, 1e+20, x)
xm.set_fill_value(1e+20)
self.d = (x, y, a10, m1, m2, xm, ym, z, zm, xf)
self.err_status = np.geterr()
np.seterr(divide='ignore', invalid='ignore')
def tearDown(self):
np.seterr(**self.err_status)
def test_basic_arithmetic(self):
# Test of basic arithmetic.
(x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
a2d = array([[1, 2], [0, 4]])
a2dm = masked_array(a2d, [[0, 0], [1, 0]])
assert_equal(a2d * a2d, a2d * a2dm)
assert_equal(a2d + a2d, a2d + a2dm)
assert_equal(a2d - a2d, a2d - a2dm)
for s in [(12,), (4, 3), (2, 6)]:
x = x.reshape(s)
y = y.reshape(s)
xm = xm.reshape(s)
ym = ym.reshape(s)
xf = xf.reshape(s)
assert_equal(-x, -xm)
assert_equal(x + y, xm + ym)
assert_equal(x - y, xm - ym)
assert_equal(x * y, xm * ym)
assert_equal(x / y, xm / ym)
assert_equal(a10 + y, a10 + ym)
assert_equal(a10 - y, a10 - ym)
assert_equal(a10 * y, a10 * ym)
assert_equal(a10 / y, a10 / ym)
assert_equal(x + a10, xm + a10)
assert_equal(x - a10, xm - a10)
assert_equal(x * a10, xm * a10)
assert_equal(x / a10, xm / a10)
assert_equal(x ** 2, xm ** 2)
assert_equal(abs(x) ** 2.5, abs(xm) ** 2.5)
assert_equal(x ** y, xm ** ym)
assert_equal(np.add(x, y), add(xm, ym))
assert_equal(np.subtract(x, y), subtract(xm, ym))
assert_equal(np.multiply(x, y), multiply(xm, ym))
assert_equal(np.divide(x, y), divide(xm, ym))
def test_divide_on_different_shapes(self):
x = arange(6, dtype=float)
x.shape = (2, 3)
y = arange(3, dtype=float)
z = x / y
assert_equal(z, [[-1., 1., 1.], [-1., 4., 2.5]])
assert_equal(z.mask, [[1, 0, 0], [1, 0, 0]])
z = x / y[None,:]
assert_equal(z, [[-1., 1., 1.], [-1., 4., 2.5]])
assert_equal(z.mask, [[1, 0, 0], [1, 0, 0]])
y = arange(2, dtype=float)
z = x / y[:, None]
assert_equal(z, [[-1., -1., -1.], [3., 4., 5.]])
assert_equal(z.mask, [[1, 1, 1], [0, 0, 0]])
def test_mixed_arithmetic(self):
# Tests mixed arithmetics.
na = np.array([1])
ma = array([1])
self.assertTrue(isinstance(na + ma, MaskedArray))
self.assertTrue(isinstance(ma + na, MaskedArray))
def test_limits_arithmetic(self):
tiny = np.finfo(float).tiny
a = array([tiny, 1. / tiny, 0.])
assert_equal(getmaskarray(a / 2), [0, 0, 0])
assert_equal(getmaskarray(2 / a), [1, 0, 1])
def test_masked_singleton_arithmetic(self):
# Tests some scalar arithmetics on MaskedArrays.
# Masked singleton should remain masked no matter what
xm = array(0, mask=1)
self.assertTrue((1 / array(0)).mask)
self.assertTrue((1 + xm).mask)
self.assertTrue((-xm).mask)
self.assertTrue(maximum(xm, xm).mask)
self.assertTrue(minimum(xm, xm).mask)
def test_masked_singleton_equality(self):
# Tests (in)equality on masked singleton
a = array([1, 2, 3], mask=[1, 1, 0])
assert_((a[0] == 0) is masked)
assert_((a[0] != 0) is masked)
assert_equal((a[-1] == 0), False)
assert_equal((a[-1] != 0), True)
def test_arithmetic_with_masked_singleton(self):
# Checks that there's no collapsing to masked
x = masked_array([1, 2])
y = x * masked
assert_equal(y.shape, x.shape)
assert_equal(y._mask, [True, True])
y = x[0] * masked
assert_(y is masked)
y = x + masked
assert_equal(y.shape, x.shape)
assert_equal(y._mask, [True, True])
def test_arithmetic_with_masked_singleton_on_1d_singleton(self):
# Check that we're not losing the shape of a singleton
x = masked_array([1, ])
y = x + masked
assert_equal(y.shape, x.shape)
assert_equal(y.mask, [True, ])
def test_scalar_arithmetic(self):
x = array(0, mask=0)
assert_equal(x.filled().ctypes.data, x.ctypes.data)
# Make sure we don't lose the shape in some circumstances
xm = array((0, 0)) / 0.
assert_equal(xm.shape, (2,))
assert_equal(xm.mask, [1, 1])
def test_basic_ufuncs(self):
# Test various functions such as sin, cos.
(x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
assert_equal(np.cos(x), cos(xm))
assert_equal(np.cosh(x), cosh(xm))
assert_equal(np.sin(x), sin(xm))
assert_equal(np.sinh(x), sinh(xm))
assert_equal(np.tan(x), tan(xm))
assert_equal(np.tanh(x), tanh(xm))
assert_equal(np.sqrt(abs(x)), sqrt(xm))
assert_equal(np.log(abs(x)), log(xm))
assert_equal(np.log10(abs(x)), log10(xm))
assert_equal(np.exp(x), exp(xm))
assert_equal(np.arcsin(z), arcsin(zm))
assert_equal(np.arccos(z), arccos(zm))
assert_equal(np.arctan(z), arctan(zm))
assert_equal(np.arctan2(x, y), arctan2(xm, ym))
assert_equal(np.absolute(x), absolute(xm))
assert_equal(np.angle(x + 1j*y), angle(xm + 1j*ym))
assert_equal(np.angle(x + 1j*y, deg=True), angle(xm + 1j*ym, deg=True))
assert_equal(np.equal(x, y), equal(xm, ym))
assert_equal(np.not_equal(x, y), not_equal(xm, ym))
assert_equal(np.less(x, y), less(xm, ym))
assert_equal(np.greater(x, y), greater(xm, ym))
assert_equal(np.less_equal(x, y), less_equal(xm, ym))
assert_equal(np.greater_equal(x, y), greater_equal(xm, ym))
assert_equal(np.conjugate(x), conjugate(xm))
def test_count_func(self):
# Tests count
assert_equal(1, count(1))
assert_equal(0, array(1, mask=[1]))
ott = array([0., 1., 2., 3.], mask=[1, 0, 0, 0])
res = count(ott)
self.assertTrue(res.dtype.type is np.intp)
assert_equal(3, res)
ott = ott.reshape((2, 2))
res = count(ott)
assert_(res.dtype.type is np.intp)
assert_equal(3, res)
res = count(ott, 0)
assert_(isinstance(res, ndarray))
assert_equal([1, 2], res)
assert_(getmask(res) is nomask)
ott = array([0., 1., 2., 3.])
res = count(ott, 0)
assert_(isinstance(res, ndarray))
assert_(res.dtype.type is np.intp)
assert_raises(ValueError, ott.count, axis=1)
def test_minmax_func(self):
# Tests minimum and maximum.
(x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
# max doesn't work if shaped
xr = np.ravel(x)
xmr = ravel(xm)
# following are true because of careful selection of data
assert_equal(max(xr), maximum(xmr))
assert_equal(min(xr), minimum(xmr))
assert_equal(minimum([1, 2, 3], [4, 0, 9]), [1, 0, 3])
assert_equal(maximum([1, 2, 3], [4, 0, 9]), [4, 2, 9])
x = arange(5)
y = arange(5) - 2
x[3] = masked
y[0] = masked
assert_equal(minimum(x, y), where(less(x, y), x, y))
assert_equal(maximum(x, y), where(greater(x, y), x, y))
assert_(minimum(x) == 0)
assert_(maximum(x) == 4)
x = arange(4).reshape(2, 2)
x[-1, -1] = masked
assert_equal(maximum(x), 2)
def test_minimummaximum_func(self):
a = np.ones((2, 2))
aminimum = minimum(a, a)
self.assertTrue(isinstance(aminimum, MaskedArray))
assert_equal(aminimum, np.minimum(a, a))
aminimum = minimum.outer(a, a)
self.assertTrue(isinstance(aminimum, MaskedArray))
assert_equal(aminimum, np.minimum.outer(a, a))
amaximum = maximum(a, a)
self.assertTrue(isinstance(amaximum, MaskedArray))
assert_equal(amaximum, np.maximum(a, a))
amaximum = maximum.outer(a, a)
self.assertTrue(isinstance(amaximum, MaskedArray))
assert_equal(amaximum, np.maximum.outer(a, a))
def test_minmax_reduce(self):
# Test np.min/maximum.reduce on array w/ full False mask
a = array([1, 2, 3], mask=[False, False, False])
b = np.maximum.reduce(a)
assert_equal(b, 3)
def test_minmax_funcs_with_output(self):
# Tests the min/max functions with explicit outputs
mask = np.random.rand(12).round()
xm = array(np.random.uniform(0, 10, 12), mask=mask)
xm.shape = (3, 4)
for funcname in ('min', 'max'):
# Initialize
npfunc = getattr(np, funcname)
mafunc = getattr(numpy.ma.core, funcname)
# Use the np version
nout = np.empty((4,), dtype=int)
try:
result = npfunc(xm, axis=0, out=nout)
except MaskError:
pass
nout = np.empty((4,), dtype=float)
result = npfunc(xm, axis=0, out=nout)
self.assertTrue(result is nout)
# Use the ma version
nout.fill(-999)
result = mafunc(xm, axis=0, out=nout)
self.assertTrue(result is nout)
def test_minmax_methods(self):
# Additional tests on max/min
(_, _, _, _, _, xm, _, _, _, _) = self.d
xm.shape = (xm.size,)
assert_equal(xm.max(), 10)
self.assertTrue(xm[0].max() is masked)
self.assertTrue(xm[0].max(0) is masked)
self.assertTrue(xm[0].max(-1) is masked)
assert_equal(xm.min(), -10.)
self.assertTrue(xm[0].min() is masked)
self.assertTrue(xm[0].min(0) is masked)
self.assertTrue(xm[0].min(-1) is masked)
assert_equal(xm.ptp(), 20.)
self.assertTrue(xm[0].ptp() is masked)
self.assertTrue(xm[0].ptp(0) is masked)
self.assertTrue(xm[0].ptp(-1) is masked)
x = array([1, 2, 3], mask=True)
self.assertTrue(x.min() is masked)
self.assertTrue(x.max() is masked)
self.assertTrue(x.ptp() is masked)
def test_addsumprod(self):
# Tests add, sum, product.
(x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
assert_equal(np.add.reduce(x), add.reduce(x))
assert_equal(np.add.accumulate(x), add.accumulate(x))
assert_equal(4, sum(array(4), axis=0))
assert_equal(4, sum(array(4), axis=0))
assert_equal(np.sum(x, axis=0), sum(x, axis=0))
assert_equal(np.sum(filled(xm, 0), axis=0), sum(xm, axis=0))
assert_equal(np.sum(x, 0), sum(x, 0))
assert_equal(np.product(x, axis=0), product(x, axis=0))
assert_equal(np.product(x, 0), product(x, 0))
assert_equal(np.product(filled(xm, 1), axis=0), product(xm, axis=0))
s = (3, 4)
x.shape = y.shape = xm.shape = ym.shape = s
if len(s) > 1:
assert_equal(np.concatenate((x, y), 1), concatenate((xm, ym), 1))
assert_equal(np.add.reduce(x, 1), add.reduce(x, 1))
assert_equal(np.sum(x, 1), sum(x, 1))
assert_equal(np.product(x, 1), product(x, 1))
def test_binops_d2D(self):
# Test binary operations on 2D data
a = array([[1.], [2.], [3.]], mask=[[False], [True], [True]])
b = array([[2., 3.], [4., 5.], [6., 7.]])
test = a * b
control = array([[2., 3.], [2., 2.], [3., 3.]],
mask=[[0, 0], [1, 1], [1, 1]])
assert_equal(test, control)
assert_equal(test.data, control.data)
assert_equal(test.mask, control.mask)
test = b * a
control = array([[2., 3.], [4., 5.], [6., 7.]],
mask=[[0, 0], [1, 1], [1, 1]])
assert_equal(test, control)
assert_equal(test.data, control.data)
assert_equal(test.mask, control.mask)
a = array([[1.], [2.], [3.]])
b = array([[2., 3.], [4., 5.], [6., 7.]],
mask=[[0, 0], [0, 0], [0, 1]])
test = a * b
control = array([[2, 3], [8, 10], [18, 3]],
mask=[[0, 0], [0, 0], [0, 1]])
assert_equal(test, control)
assert_equal(test.data, control.data)
assert_equal(test.mask, control.mask)
test = b * a
control = array([[2, 3], [8, 10], [18, 7]],
mask=[[0, 0], [0, 0], [0, 1]])
assert_equal(test, control)
assert_equal(test.data, control.data)
assert_equal(test.mask, control.mask)
def test_domained_binops_d2D(self):
# Test domained binary operations on 2D data
a = array([[1.], [2.], [3.]], mask=[[False], [True], [True]])
b = array([[2., 3.], [4., 5.], [6., 7.]])
test = a / b
control = array([[1. / 2., 1. / 3.], [2., 2.], [3., 3.]],
mask=[[0, 0], [1, 1], [1, 1]])
assert_equal(test, control)
assert_equal(test.data, control.data)
assert_equal(test.mask, control.mask)
test = b / a
control = array([[2. / 1., 3. / 1.], [4., 5.], [6., 7.]],
mask=[[0, 0], [1, 1], [1, 1]])
assert_equal(test, control)
assert_equal(test.data, control.data)
assert_equal(test.mask, control.mask)
a = array([[1.], [2.], [3.]])
b = array([[2., 3.], [4., 5.], [6., 7.]],
mask=[[0, 0], [0, 0], [0, 1]])
test = a / b
control = array([[1. / 2, 1. / 3], [2. / 4, 2. / 5], [3. / 6, 3]],
mask=[[0, 0], [0, 0], [0, 1]])
assert_equal(test, control)
assert_equal(test.data, control.data)
assert_equal(test.mask, control.mask)
test = b / a
control = array([[2 / 1., 3 / 1.], [4 / 2., 5 / 2.], [6 / 3., 7]],
mask=[[0, 0], [0, 0], [0, 1]])
assert_equal(test, control)
assert_equal(test.data, control.data)
assert_equal(test.mask, control.mask)
def test_noshrinking(self):
# Check that we don't shrink a mask when not wanted
# Binary operations
a = masked_array([1., 2., 3.], mask=[False, False, False],
shrink=False)
b = a + 1
assert_equal(b.mask, [0, 0, 0])
# In place binary operation
a += 1
assert_equal(a.mask, [0, 0, 0])
# Domained binary operation
b = a / 1.
assert_equal(b.mask, [0, 0, 0])
# In place binary operation
a /= 1.
assert_equal(a.mask, [0, 0, 0])
def test_noshink_on_creation(self):
# Check that the mask is not shrunk on array creation when not wanted
a = np.ma.masked_values([1., 2.5, 3.1], 1.5, shrink=False)
assert_equal(a.mask, [0, 0, 0])
def test_mod(self):
# Tests mod
(x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
assert_equal(mod(x, y), mod(xm, ym))
test = mod(ym, xm)
assert_equal(test, np.mod(ym, xm))
assert_equal(test.mask, mask_or(xm.mask, ym.mask))
test = mod(xm, ym)
assert_equal(test, np.mod(xm, ym))
assert_equal(test.mask, mask_or(mask_or(xm.mask, ym.mask), (ym == 0)))
def test_TakeTransposeInnerOuter(self):
# Test of take, transpose, inner, outer products
x = arange(24)
y = np.arange(24)
x[5:6] = masked
x = x.reshape(2, 3, 4)
y = y.reshape(2, 3, 4)
assert_equal(np.transpose(y, (2, 0, 1)), transpose(x, (2, 0, 1)))
assert_equal(np.take(y, (2, 0, 1), 1), take(x, (2, 0, 1), 1))
assert_equal(np.inner(filled(x, 0), filled(y, 0)),
inner(x, y))
assert_equal(np.outer(filled(x, 0), filled(y, 0)),
outer(x, y))
y = array(['abc', 1, 'def', 2, 3], object)
y[2] = masked
t = take(y, [0, 3, 4])
assert_(t[0] == 'abc')
assert_(t[1] == 2)
assert_(t[2] == 3)
def test_imag_real(self):
# Check complex
xx = array([1 + 10j, 20 + 2j], mask=[1, 0])
assert_equal(xx.imag, [10, 2])
assert_equal(xx.imag.filled(), [1e+20, 2])
assert_equal(xx.imag.dtype, xx._data.imag.dtype)
assert_equal(xx.real, [1, 20])
assert_equal(xx.real.filled(), [1e+20, 20])
assert_equal(xx.real.dtype, xx._data.real.dtype)
def test_methods_with_output(self):
xm = array(np.random.uniform(0, 10, 12)).reshape(3, 4)
xm[:, 0] = xm[0] = xm[-1, -1] = masked
funclist = ('sum', 'prod', 'var', 'std', 'max', 'min', 'ptp', 'mean',)
for funcname in funclist:
npfunc = getattr(np, funcname)
xmmeth = getattr(xm, funcname)
# A ndarray as explicit input
output = np.empty(4, dtype=float)
output.fill(-9999)
result = npfunc(xm, axis=0, out=output)
# ... the result should be the given output
assert_(result is output)
assert_equal(result, xmmeth(axis=0, out=output))
output = empty(4, dtype=int)
result = xmmeth(axis=0, out=output)
assert_(result is output)
assert_(output[0] is masked)
def test_count_mean_with_matrix(self):
m = np.ma.array(np.matrix([[1,2],[3,4]]), mask=np.zeros((2,2)))
assert_equal(m.count(axis=0).shape, (1,2))
assert_equal(m.count(axis=1).shape, (2,1))
#make sure broadcasting inside mean and var work
assert_equal(m.mean(axis=0), [[2., 3.]])
assert_equal(m.mean(axis=1), [[1.5], [3.5]])
def test_eq_on_structured(self):
# Test the equality of structured arrays
ndtype = [('A', int), ('B', int)]
a = array([(1, 1), (2, 2)], mask=[(0, 1), (0, 0)], dtype=ndtype)
test = (a == a)
assert_equal(test, [True, True])
assert_equal(test.mask, [False, False])
b = array([(1, 1), (2, 2)], mask=[(1, 0), (0, 0)], dtype=ndtype)
test = (a == b)
assert_equal(test, [False, True])
assert_equal(test.mask, [True, False])
b = array([(1, 1), (2, 2)], mask=[(0, 1), (1, 0)], dtype=ndtype)
test = (a == b)
assert_equal(test, [True, False])
assert_equal(test.mask, [False, False])
def test_ne_on_structured(self):
# Test the equality of structured arrays
ndtype = [('A', int), ('B', int)]
a = array([(1, 1), (2, 2)], mask=[(0, 1), (0, 0)], dtype=ndtype)
test = (a != a)
assert_equal(test, [False, False])
assert_equal(test.mask, [False, False])
b = array([(1, 1), (2, 2)], mask=[(1, 0), (0, 0)], dtype=ndtype)
test = (a != b)
assert_equal(test, [True, False])
assert_equal(test.mask, [True, False])
b = array([(1, 1), (2, 2)], mask=[(0, 1), (1, 0)], dtype=ndtype)
test = (a != b)
assert_equal(test, [False, True])
assert_equal(test.mask, [False, False])
def test_eq_w_None(self):
# Really, comparisons with None should not be done, but check them
# anyway. Note that pep8 will flag these tests.
# With partial mask
a = array([1, 2], mask=[0, 1])
assert_equal(a == None, False)
assert_equal(a.data == None, False)
assert_equal(a.mask == None, False)
assert_equal(a != None, True)
# With nomask
a = array([1, 2], mask=False)
assert_equal(a == None, False)
assert_equal(a != None, True)
# With complete mask
a = array([1, 2], mask=True)
assert_equal(a == None, False)
assert_equal(a != None, True)
# Fully masked, even comparison to None should return "masked"
a = masked
assert_equal(a == None, masked)
def test_eq_w_scalar(self):
a = array(1)
assert_equal(a == 1, True)
assert_equal(a == 0, False)
assert_equal(a != 1, False)
assert_equal(a != 0, True)
def test_numpyarithmetics(self):
# Check that the mask is not back-propagated when using numpy functions
a = masked_array([-1, 0, 1, 2, 3], mask=[0, 0, 0, 0, 1])
control = masked_array([np.nan, np.nan, 0, np.log(2), -1],
mask=[1, 1, 0, 0, 1])
test = log(a)
assert_equal(test, control)
assert_equal(test.mask, control.mask)
assert_equal(a.mask, [0, 0, 0, 0, 1])
test = np.log(a)
assert_equal(test, control)
assert_equal(test.mask, control.mask)
assert_equal(a.mask, [0, 0, 0, 0, 1])
class TestMaskedArrayAttributes(TestCase):
def test_keepmask(self):
# Tests the keep mask flag
x = masked_array([1, 2, 3], mask=[1, 0, 0])
mx = masked_array(x)
assert_equal(mx.mask, x.mask)
mx = masked_array(x, mask=[0, 1, 0], keep_mask=False)
assert_equal(mx.mask, [0, 1, 0])
mx = masked_array(x, mask=[0, 1, 0], keep_mask=True)
assert_equal(mx.mask, [1, 1, 0])
# We default to true
mx = masked_array(x, mask=[0, 1, 0])
assert_equal(mx.mask, [1, 1, 0])
def test_hardmask(self):
# Test hard_mask
d = arange(5)
n = [0, 0, 0, 1, 1]
m = make_mask(n)
xh = array(d, mask=m, hard_mask=True)
# We need to copy, to avoid updating d in xh !
xs = array(d, mask=m, hard_mask=False, copy=True)
xh[[1, 4]] = [10, 40]
xs[[1, 4]] = [10, 40]
assert_equal(xh._data, [0, 10, 2, 3, 4])
assert_equal(xs._data, [0, 10, 2, 3, 40])
assert_equal(xs.mask, [0, 0, 0, 1, 0])
self.assertTrue(xh._hardmask)
self.assertTrue(not xs._hardmask)
xh[1:4] = [10, 20, 30]
xs[1:4] = [10, 20, 30]
assert_equal(xh._data, [0, 10, 20, 3, 4])
assert_equal(xs._data, [0, 10, 20, 30, 40])
assert_equal(xs.mask, nomask)
xh[0] = masked
xs[0] = masked
assert_equal(xh.mask, [1, 0, 0, 1, 1])
assert_equal(xs.mask, [1, 0, 0, 0, 0])
xh[:] = 1
xs[:] = 1
assert_equal(xh._data, [0, 1, 1, 3, 4])
assert_equal(xs._data, [1, 1, 1, 1, 1])
assert_equal(xh.mask, [1, 0, 0, 1, 1])
assert_equal(xs.mask, nomask)
# Switch to soft mask
xh.soften_mask()
xh[:] = arange(5)
assert_equal(xh._data, [0, 1, 2, 3, 4])
assert_equal(xh.mask, nomask)
# Switch back to hard mask
xh.harden_mask()
xh[xh < 3] = masked
assert_equal(xh._data, [0, 1, 2, 3, 4])
assert_equal(xh._mask, [1, 1, 1, 0, 0])
xh[filled(xh > 1, False)] = 5
assert_equal(xh._data, [0, 1, 2, 5, 5])
assert_equal(xh._mask, [1, 1, 1, 0, 0])
xh = array([[1, 2], [3, 4]], mask=[[1, 0], [0, 0]], hard_mask=True)
xh[0] = 0
assert_equal(xh._data, [[1, 0], [3, 4]])
assert_equal(xh._mask, [[1, 0], [0, 0]])
xh[-1, -1] = 5
assert_equal(xh._data, [[1, 0], [3, 5]])
assert_equal(xh._mask, [[1, 0], [0, 0]])
xh[filled(xh < 5, False)] = 2
assert_equal(xh._data, [[1, 2], [2, 5]])
assert_equal(xh._mask, [[1, 0], [0, 0]])
def test_hardmask_again(self):
# Another test of hardmask
d = arange(5)
n = [0, 0, 0, 1, 1]
m = make_mask(n)
xh = array(d, mask=m, hard_mask=True)
xh[4:5] = 999
xh[0:1] = 999
assert_equal(xh._data, [999, 1, 2, 3, 4])
def test_hardmask_oncemore_yay(self):
# OK, yet another test of hardmask
# Make sure that harden_mask/soften_mask//unshare_mask returns self
a = array([1, 2, 3], mask=[1, 0, 0])
b = a.harden_mask()
assert_equal(a, b)
b[0] = 0
assert_equal(a, b)
assert_equal(b, array([1, 2, 3], mask=[1, 0, 0]))
a = b.soften_mask()
a[0] = 0
assert_equal(a, b)
assert_equal(b, array([0, 2, 3], mask=[0, 0, 0]))
def test_smallmask(self):
# Checks the behaviour of _smallmask
a = arange(10)
a[1] = masked
a[1] = 1
assert_equal(a._mask, nomask)
a = arange(10)
a._smallmask = False
a[1] = masked
a[1] = 1
assert_equal(a._mask, zeros(10))
def test_shrink_mask(self):
# Tests .shrink_mask()
a = array([1, 2, 3], mask=[0, 0, 0])
b = a.shrink_mask()
assert_equal(a, b)
assert_equal(a.mask, nomask)
def test_flat(self):
# Test that flat can return all types of items [#4585, #4615]
# test simple access
test = masked_array(np.matrix([[1, 2, 3]]), mask=[0, 0, 1])
assert_equal(test.flat[1], 2)
assert_equal(test.flat[2], masked)
self.assertTrue(np.all(test.flat[0:2] == test[0, 0:2]))
# Test flat on masked_matrices
test = masked_array(np.matrix([[1, 2, 3]]), mask=[0, 0, 1])
test.flat = masked_array([3, 2, 1], mask=[1, 0, 0])
control = masked_array(np.matrix([[3, 2, 1]]), mask=[1, 0, 0])
assert_equal(test, control)
# Test setting
test = masked_array(np.matrix([[1, 2, 3]]), mask=[0, 0, 1])
testflat = test.flat
testflat[:] = testflat[[2, 1, 0]]
assert_equal(test, control)
testflat[0] = 9
assert_equal(test[0, 0], 9)
# test 2-D record array
# ... on structured array w/ masked records
x = array([[(1, 1.1, 'one'), (2, 2.2, 'two'), (3, 3.3, 'thr')],
[(4, 4.4, 'fou'), (5, 5.5, 'fiv'), (6, 6.6, 'six')]],
dtype=[('a', int), ('b', float), ('c', '|S8')])
x['a'][0, 1] = masked
x['b'][1, 0] = masked
x['c'][0, 2] = masked
x[-1, -1] = masked
xflat = x.flat
assert_equal(xflat[0], x[0, 0])
assert_equal(xflat[1], x[0, 1])
assert_equal(xflat[2], x[0, 2])
assert_equal(xflat[:3], x[0])
assert_equal(xflat[3], x[1, 0])
assert_equal(xflat[4], x[1, 1])
assert_equal(xflat[5], x[1, 2])
assert_equal(xflat[3:], x[1])
assert_equal(xflat[-1], x[-1, -1])
i = 0
j = 0
for xf in xflat:
assert_equal(xf, x[j, i])
i += 1
if i >= x.shape[-1]:
i = 0
j += 1
# test that matrices keep the correct shape (#4615)
a = masked_array(np.matrix(np.eye(2)), mask=0)
b = a.flat
b01 = b[:2]
assert_equal(b01.data, array([[1., 0.]]))
assert_equal(b01.mask, array([[False, False]]))
def test_assign_dtype(self):
# check that the mask's dtype is updated when dtype is changed
a = np.zeros(4, dtype='f4,i4')
m = np.ma.array(a)
m.dtype = np.dtype('f4')
repr(m) # raises?
assert_equal(m.dtype, np.dtype('f4'))
# check that dtype changes that change shape of mask too much
# are not allowed
def assign():
m = np.ma.array(a)
m.dtype = np.dtype('f8')
assert_raises(ValueError, assign)
b = a.view(dtype='f4', type=np.ma.MaskedArray) # raises?
assert_equal(b.dtype, np.dtype('f4'))
# check that nomask is preserved
a = np.zeros(4, dtype='f4')
m = np.ma.array(a)
m.dtype = np.dtype('f4,i4')
assert_equal(m.dtype, np.dtype('f4,i4'))
assert_equal(m._mask, np.ma.nomask)
class TestFillingValues(TestCase):
def test_check_on_scalar(self):
# Test _check_fill_value set to valid and invalid values
_check_fill_value = np.ma.core._check_fill_value
fval = _check_fill_value(0, int)
assert_equal(fval, 0)
fval = _check_fill_value(None, int)
assert_equal(fval, default_fill_value(0))
fval = _check_fill_value(0, "|S3")
assert_equal(fval, asbytes("0"))
fval = _check_fill_value(None, "|S3")
assert_equal(fval, default_fill_value(b"camelot!"))
self.assertRaises(TypeError, _check_fill_value, 1e+20, int)
self.assertRaises(TypeError, _check_fill_value, 'stuff', int)
def test_check_on_fields(self):
# Tests _check_fill_value with records
_check_fill_value = np.ma.core._check_fill_value
ndtype = [('a', int), ('b', float), ('c', "|S3")]
# A check on a list should return a single record
fval = _check_fill_value([-999, -12345678.9, "???"], ndtype)
self.assertTrue(isinstance(fval, ndarray))
assert_equal(fval.item(), [-999, -12345678.9, asbytes("???")])
# A check on None should output the defaults
fval = _check_fill_value(None, ndtype)
self.assertTrue(isinstance(fval, ndarray))
assert_equal(fval.item(), [default_fill_value(0),
default_fill_value(0.),
asbytes(default_fill_value("0"))])
#.....Using a structured type as fill_value should work
fill_val = np.array((-999, -12345678.9, "???"), dtype=ndtype)
fval = _check_fill_value(fill_val, ndtype)
self.assertTrue(isinstance(fval, ndarray))
assert_equal(fval.item(), [-999, -12345678.9, asbytes("???")])
#.....Using a flexible type w/ a different type shouldn't matter
# BEHAVIOR in 1.5 and earlier: match structured types by position
#fill_val = np.array((-999, -12345678.9, "???"),
# dtype=[("A", int), ("B", float), ("C", "|S3")])
# BEHAVIOR in 1.6 and later: match structured types by name
fill_val = np.array(("???", -999, -12345678.9),
dtype=[("c", "|S3"), ("a", int), ("b", float), ])
fval = _check_fill_value(fill_val, ndtype)
self.assertTrue(isinstance(fval, ndarray))
assert_equal(fval.item(), [-999, -12345678.9, asbytes("???")])
#.....Using an object-array shouldn't matter either
fill_val = np.ndarray(shape=(1,), dtype=object)
fill_val[0] = (-999, -12345678.9, asbytes("???"))
fval = _check_fill_value(fill_val, object)
self.assertTrue(isinstance(fval, ndarray))
assert_equal(fval.item(), [-999, -12345678.9, asbytes("???")])
# NOTE: This test was never run properly as "fill_value" rather than
# "fill_val" was assigned. Written properly, it fails.
#fill_val = np.array((-999, -12345678.9, "???"))
#fval = _check_fill_value(fill_val, ndtype)
#self.assertTrue(isinstance(fval, ndarray))
#assert_equal(fval.item(), [-999, -12345678.9, asbytes("???")])
#.....One-field-only flexible type should work as well
ndtype = [("a", int)]
fval = _check_fill_value(-999999999, ndtype)
self.assertTrue(isinstance(fval, ndarray))
assert_equal(fval.item(), (-999999999,))
def test_fillvalue_conversion(self):
# Tests the behavior of fill_value during conversion
# We had a tailored comment to make sure special attributes are
# properly dealt with
a = array(asbytes_nested(['3', '4', '5']))
a._optinfo.update({'comment':"updated!"})
b = array(a, dtype=int)
assert_equal(b._data, [3, 4, 5])
assert_equal(b.fill_value, default_fill_value(0))
b = array(a, dtype=float)
assert_equal(b._data, [3, 4, 5])
assert_equal(b.fill_value, default_fill_value(0.))
b = a.astype(int)
assert_equal(b._data, [3, 4, 5])
assert_equal(b.fill_value, default_fill_value(0))
assert_equal(b._optinfo['comment'], "updated!")
b = a.astype([('a', '|S3')])
assert_equal(b['a']._data, a._data)
assert_equal(b['a'].fill_value, a.fill_value)
def test_fillvalue(self):
# Yet more fun with the fill_value
data = masked_array([1, 2, 3], fill_value=-999)
series = data[[0, 2, 1]]
assert_equal(series._fill_value, data._fill_value)
mtype = [('f', float), ('s', '|S3')]
x = array([(1, 'a'), (2, 'b'), (pi, 'pi')], dtype=mtype)
x.fill_value = 999
assert_equal(x.fill_value.item(), [999., asbytes('999')])
assert_equal(x['f'].fill_value, 999)
assert_equal(x['s'].fill_value, asbytes('999'))
x.fill_value = (9, '???')
assert_equal(x.fill_value.item(), (9, asbytes('???')))
assert_equal(x['f'].fill_value, 9)
assert_equal(x['s'].fill_value, asbytes('???'))
x = array([1, 2, 3.1])
x.fill_value = 999
assert_equal(np.asarray(x.fill_value).dtype, float)
assert_equal(x.fill_value, 999.)
assert_equal(x._fill_value, np.array(999.))
def test_fillvalue_exotic_dtype(self):
# Tests yet more exotic flexible dtypes
_check_fill_value = np.ma.core._check_fill_value
ndtype = [('i', int), ('s', '|S8'), ('f', float)]
control = np.array((default_fill_value(0),
default_fill_value('0'),
default_fill_value(0.),),
dtype=ndtype)
assert_equal(_check_fill_value(None, ndtype), control)
# The shape shouldn't matter
ndtype = [('f0', float, (2, 2))]
control = np.array((default_fill_value(0.),),
dtype=[('f0', float)]).astype(ndtype)
assert_equal(_check_fill_value(None, ndtype), control)
control = np.array((0,), dtype=[('f0', float)]).astype(ndtype)
assert_equal(_check_fill_value(0, ndtype), control)
ndtype = np.dtype("int, (2,3)float, float")
control = np.array((default_fill_value(0),
default_fill_value(0.),
default_fill_value(0.),),
dtype="int, float, float").astype(ndtype)
test = _check_fill_value(None, ndtype)
assert_equal(test, control)
control = np.array((0, 0, 0), dtype="int, float, float").astype(ndtype)
assert_equal(_check_fill_value(0, ndtype), control)
# but when indexing, fill value should become scalar not tuple
# See issue #6723
M = masked_array(control)
assert_equal(M["f1"].fill_value.ndim, 0)
def test_fillvalue_datetime_timedelta(self):
# Test default fillvalue for datetime64 and timedelta64 types.
# See issue #4476, this would return '?' which would cause errors
# elsewhere
for timecode in ("as", "fs", "ps", "ns", "us", "ms", "s", "m",
"h", "D", "W", "M", "Y"):
control = numpy.datetime64("NaT", timecode)
test = default_fill_value(numpy.dtype("<M8[" + timecode + "]"))
assert_equal(test, control)
control = numpy.timedelta64("NaT", timecode)
test = default_fill_value(numpy.dtype("<m8[" + timecode + "]"))
assert_equal(test, control)
def test_extremum_fill_value(self):
# Tests extremum fill values for flexible type.
a = array([(1, (2, 3)), (4, (5, 6))],
dtype=[('A', int), ('B', [('BA', int), ('BB', int)])])
test = a.fill_value
assert_equal(test['A'], default_fill_value(a['A']))
assert_equal(test['B']['BA'], default_fill_value(a['B']['BA']))
assert_equal(test['B']['BB'], default_fill_value(a['B']['BB']))
test = minimum_fill_value(a)
assert_equal(test[0], minimum_fill_value(a['A']))
assert_equal(test[1][0], minimum_fill_value(a['B']['BA']))
assert_equal(test[1][1], minimum_fill_value(a['B']['BB']))
assert_equal(test[1], minimum_fill_value(a['B']))
test = maximum_fill_value(a)
assert_equal(test[0], maximum_fill_value(a['A']))
assert_equal(test[1][0], maximum_fill_value(a['B']['BA']))
assert_equal(test[1][1], maximum_fill_value(a['B']['BB']))
assert_equal(test[1], maximum_fill_value(a['B']))
def test_fillvalue_individual_fields(self):
# Test setting fill_value on individual fields
ndtype = [('a', int), ('b', int)]
# Explicit fill_value
a = array(list(zip([1, 2, 3], [4, 5, 6])),
fill_value=(-999, -999), dtype=ndtype)
aa = a['a']
aa.set_fill_value(10)
assert_equal(aa._fill_value, np.array(10))
assert_equal(tuple(a.fill_value), (10, -999))
a.fill_value['b'] = -10
assert_equal(tuple(a.fill_value), (10, -10))
# Implicit fill_value
t = array(list(zip([1, 2, 3], [4, 5, 6])), dtype=ndtype)
tt = t['a']
tt.set_fill_value(10)
assert_equal(tt._fill_value, np.array(10))
assert_equal(tuple(t.fill_value), (10, default_fill_value(0)))
def test_fillvalue_implicit_structured_array(self):
# Check that fill_value is always defined for structured arrays
ndtype = ('b', float)
adtype = ('a', float)
a = array([(1.,), (2.,)], mask=[(False,), (False,)],
fill_value=(np.nan,), dtype=np.dtype([adtype]))
b = empty(a.shape, dtype=[adtype, ndtype])
b['a'] = a['a']
b['a'].set_fill_value(a['a'].fill_value)
f = b._fill_value[()]
assert_(np.isnan(f[0]))
assert_equal(f[-1], default_fill_value(1.))
def test_fillvalue_as_arguments(self):
# Test adding a fill_value parameter to empty/ones/zeros
a = empty(3, fill_value=999.)
assert_equal(a.fill_value, 999.)
a = ones(3, fill_value=999., dtype=float)
assert_equal(a.fill_value, 999.)
a = zeros(3, fill_value=0., dtype=complex)
assert_equal(a.fill_value, 0.)
a = identity(3, fill_value=0., dtype=complex)
assert_equal(a.fill_value, 0.)
def test_shape_argument(self):
# Test that shape can be provides as an argument
# GH issue 6106
a = empty(shape=(3, ))
assert_equal(a.shape, (3, ))
a = ones(shape=(3, ), dtype=float)
assert_equal(a.shape, (3, ))
a = zeros(shape=(3, ), dtype=complex)
assert_equal(a.shape, (3, ))
def test_fillvalue_in_view(self):
# Test the behavior of fill_value in view
# Create initial masked array
x = array([1, 2, 3], fill_value=1, dtype=np.int64)
# Check that fill_value is preserved by default
y = x.view()
assert_(y.fill_value == 1)
# Check that fill_value is preserved if dtype is specified and the
# dtype is an ndarray sub-class and has a _fill_value attribute
y = x.view(MaskedArray)
assert_(y.fill_value == 1)
# Check that fill_value is preserved if type is specified and the
# dtype is an ndarray sub-class and has a _fill_value attribute (by
# default, the first argument is dtype, not type)
y = x.view(type=MaskedArray)
assert_(y.fill_value == 1)
# Check that code does not crash if passed an ndarray sub-class that
# does not have a _fill_value attribute
y = x.view(np.ndarray)
y = x.view(type=np.ndarray)
# Check that fill_value can be overridden with view
y = x.view(MaskedArray, fill_value=2)
assert_(y.fill_value == 2)
# Check that fill_value can be overridden with view (using type=)
y = x.view(type=MaskedArray, fill_value=2)
assert_(y.fill_value == 2)
# Check that fill_value gets reset if passed a dtype but not a
# fill_value. This is because even though in some cases one can safely
# cast the fill_value, e.g. if taking an int64 view of an int32 array,
# in other cases, this cannot be done (e.g. int32 view of an int64
# array with a large fill_value).
y = x.view(dtype=np.int32)
assert_(y.fill_value == 999999)
def test_fillvalue_bytes_or_str(self):
# Test whether fill values work as expected for structured dtypes
# containing bytes or str. See issue #7259.
a = empty(shape=(3, ), dtype="(2)3S,(2)3U")
assert_equal(a["f0"].fill_value, default_fill_value(b"spam"))
assert_equal(a["f1"].fill_value, default_fill_value("eggs"))
class TestUfuncs(TestCase):
# Test class for the application of ufuncs on MaskedArrays.
def setUp(self):
# Base data definition.
self.d = (array([1.0, 0, -1, pi / 2] * 2, mask=[0, 1] + [0] * 6),
array([1.0, 0, -1, pi / 2] * 2, mask=[1, 0] + [0] * 6),)
self.err_status = np.geterr()
np.seterr(divide='ignore', invalid='ignore')
def tearDown(self):
np.seterr(**self.err_status)
def test_testUfuncRegression(self):
# Tests new ufuncs on MaskedArrays.
for f in ['sqrt', 'log', 'log10', 'exp', 'conjugate',
'sin', 'cos', 'tan',
'arcsin', 'arccos', 'arctan',
'sinh', 'cosh', 'tanh',
'arcsinh',
'arccosh',
'arctanh',
'absolute', 'fabs', 'negative',
'floor', 'ceil',
'logical_not',
'add', 'subtract', 'multiply',
'divide', 'true_divide', 'floor_divide',
'remainder', 'fmod', 'hypot', 'arctan2',
'equal', 'not_equal', 'less_equal', 'greater_equal',
'less', 'greater',
'logical_and', 'logical_or', 'logical_xor',
]:
try:
uf = getattr(umath, f)
except AttributeError:
uf = getattr(fromnumeric, f)
mf = getattr(numpy.ma.core, f)
args = self.d[:uf.nin]
ur = uf(*args)
mr = mf(*args)
assert_equal(ur.filled(0), mr.filled(0), f)
assert_mask_equal(ur.mask, mr.mask, err_msg=f)
def test_reduce(self):
# Tests reduce on MaskedArrays.
a = self.d[0]
self.assertTrue(not alltrue(a, axis=0))
self.assertTrue(sometrue(a, axis=0))
assert_equal(sum(a[:3], axis=0), 0)
assert_equal(product(a, axis=0), 0)
assert_equal(add.reduce(a), pi)
def test_minmax(self):
# Tests extrema on MaskedArrays.
a = arange(1, 13).reshape(3, 4)
amask = masked_where(a < 5, a)
assert_equal(amask.max(), a.max())
assert_equal(amask.min(), 5)
assert_equal(amask.max(0), a.max(0))
assert_equal(amask.min(0), [5, 6, 7, 8])
self.assertTrue(amask.max(1)[0].mask)
self.assertTrue(amask.min(1)[0].mask)
def test_ndarray_mask(self):
# Check that the mask of the result is a ndarray (not a MaskedArray...)
a = masked_array([-1, 0, 1, 2, 3], mask=[0, 0, 0, 0, 1])
test = np.sqrt(a)
control = masked_array([-1, 0, 1, np.sqrt(2), -1],
mask=[1, 0, 0, 0, 1])
assert_equal(test, control)
assert_equal(test.mask, control.mask)
self.assertTrue(not isinstance(test.mask, MaskedArray))
def test_treatment_of_NotImplemented(self):
# Check that NotImplemented is returned at appropriate places
a = masked_array([1., 2.], mask=[1, 0])
self.assertRaises(TypeError, operator.mul, a, "abc")
self.assertRaises(TypeError, operator.truediv, a, "abc")
class MyClass(object):
__array_priority__ = a.__array_priority__ + 1
def __mul__(self, other):
return "My mul"
def __rmul__(self, other):
return "My rmul"
me = MyClass()
assert_(me * a == "My mul")
assert_(a * me == "My rmul")
# and that __array_priority__ is respected
class MyClass2(object):
__array_priority__ = 100
def __mul__(self, other):
return "Me2mul"
def __rmul__(self, other):
return "Me2rmul"
def __rdiv__(self, other):
return "Me2rdiv"
__rtruediv__ = __rdiv__
me_too = MyClass2()
assert_(a.__mul__(me_too) is NotImplemented)
assert_(all(multiply.outer(a, me_too) == "Me2rmul"))
assert_(a.__truediv__(me_too) is NotImplemented)
assert_(me_too * a == "Me2mul")
assert_(a * me_too == "Me2rmul")
assert_(a / me_too == "Me2rdiv")
def test_no_masked_nan_warnings(self):
# check that a nan in masked position does not
# cause ufunc warnings
m = np.ma.array([0.5, np.nan], mask=[0,1])
with warnings.catch_warnings():
warnings.filterwarnings("error")
# test unary and binary ufuncs
exp(m)
add(m, 1)
m > 0
# test different unary domains
sqrt(m)
log(m)
tan(m)
arcsin(m)
arccos(m)
arccosh(m)
# test binary domains
divide(m, 2)
# also check that allclose uses ma ufuncs, to avoid warning
allclose(m, 0.5)
class TestMaskedArrayInPlaceArithmetics(TestCase):
# Test MaskedArray Arithmetics
def setUp(self):
x = arange(10)
y = arange(10)
xm = arange(10)
xm[2] = masked
self.intdata = (x, y, xm)
self.floatdata = (x.astype(float), y.astype(float), xm.astype(float))
self.othertypes = np.typecodes['AllInteger'] + np.typecodes['AllFloat']
self.othertypes = [np.dtype(_).type for _ in self.othertypes]
self.uint8data = (
x.astype(np.uint8),
y.astype(np.uint8),
xm.astype(np.uint8)
)
def test_inplace_addition_scalar(self):
# Test of inplace additions
(x, y, xm) = self.intdata
xm[2] = masked
x += 1
assert_equal(x, y + 1)
xm += 1
assert_equal(xm, y + 1)
(x, _, xm) = self.floatdata
id1 = x.data.ctypes._data
x += 1.
assert_(id1 == x.data.ctypes._data)
assert_equal(x, y + 1.)
def test_inplace_addition_array(self):
# Test of inplace additions
(x, y, xm) = self.intdata
m = xm.mask
a = arange(10, dtype=np.int16)
a[-1] = masked
x += a
xm += a
assert_equal(x, y + a)
assert_equal(xm, y + a)
assert_equal(xm.mask, mask_or(m, a.mask))
def test_inplace_subtraction_scalar(self):
# Test of inplace subtractions
(x, y, xm) = self.intdata
x -= 1
assert_equal(x, y - 1)
xm -= 1
assert_equal(xm, y - 1)
def test_inplace_subtraction_array(self):
# Test of inplace subtractions
(x, y, xm) = self.floatdata
m = xm.mask
a = arange(10, dtype=float)
a[-1] = masked
x -= a
xm -= a
assert_equal(x, y - a)
assert_equal(xm, y - a)
assert_equal(xm.mask, mask_or(m, a.mask))
def test_inplace_multiplication_scalar(self):
# Test of inplace multiplication
(x, y, xm) = self.floatdata
x *= 2.0
assert_equal(x, y * 2)
xm *= 2.0
assert_equal(xm, y * 2)
def test_inplace_multiplication_array(self):
# Test of inplace multiplication
(x, y, xm) = self.floatdata
m = xm.mask
a = arange(10, dtype=float)
a[-1] = masked
x *= a
xm *= a
assert_equal(x, y * a)
assert_equal(xm, y * a)
assert_equal(xm.mask, mask_or(m, a.mask))
def test_inplace_division_scalar_int(self):
# Test of inplace division
(x, y, xm) = self.intdata
x = arange(10) * 2
xm = arange(10) * 2
xm[2] = masked
x //= 2
assert_equal(x, y)
xm //= 2
assert_equal(xm, y)
def test_inplace_division_scalar_float(self):
# Test of inplace division
(x, y, xm) = self.floatdata
x /= 2.0
assert_equal(x, y / 2.0)
xm /= arange(10)
assert_equal(xm, ones((10,)))
def test_inplace_division_array_float(self):
# Test of inplace division
(x, y, xm) = self.floatdata
m = xm.mask
a = arange(10, dtype=float)
a[-1] = masked
x /= a
xm /= a
assert_equal(x, y / a)
assert_equal(xm, y / a)
assert_equal(xm.mask, mask_or(mask_or(m, a.mask), (a == 0)))
def test_inplace_division_misc(self):
x = [1., 1., 1., -2., pi / 2., 4., 5., -10., 10., 1., 2., 3.]
y = [5., 0., 3., 2., -1., -4., 0., -10., 10., 1., 0., 3.]
m1 = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
m2 = [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1]
xm = masked_array(x, mask=m1)
ym = masked_array(y, mask=m2)
z = xm / ym
assert_equal(z._mask, [1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1])
assert_equal(z._data,
[1., 1., 1., -1., -pi / 2., 4., 5., 1., 1., 1., 2., 3.])
xm = xm.copy()
xm /= ym
assert_equal(xm._mask, [1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1])
assert_equal(z._data,
[1., 1., 1., -1., -pi / 2., 4., 5., 1., 1., 1., 2., 3.])
def test_datafriendly_add(self):
# Test keeping data w/ (inplace) addition
x = array([1, 2, 3], mask=[0, 0, 1])
# Test add w/ scalar
xx = x + 1
assert_equal(xx.data, [2, 3, 3])
assert_equal(xx.mask, [0, 0, 1])
# Test iadd w/ scalar
x += 1
assert_equal(x.data, [2, 3, 3])
assert_equal(x.mask, [0, 0, 1])
# Test add w/ array
x = array([1, 2, 3], mask=[0, 0, 1])
xx = x + array([1, 2, 3], mask=[1, 0, 0])
assert_equal(xx.data, [1, 4, 3])
assert_equal(xx.mask, [1, 0, 1])
# Test iadd w/ array
x = array([1, 2, 3], mask=[0, 0, 1])
x += array([1, 2, 3], mask=[1, 0, 0])
assert_equal(x.data, [1, 4, 3])
assert_equal(x.mask, [1, 0, 1])
def test_datafriendly_sub(self):
# Test keeping data w/ (inplace) subtraction
# Test sub w/ scalar
x = array([1, 2, 3], mask=[0, 0, 1])
xx = x - 1
assert_equal(xx.data, [0, 1, 3])
assert_equal(xx.mask, [0, 0, 1])
# Test isub w/ scalar
x = array([1, 2, 3], mask=[0, 0, 1])
x -= 1
assert_equal(x.data, [0, 1, 3])
assert_equal(x.mask, [0, 0, 1])
# Test sub w/ array
x = array([1, 2, 3], mask=[0, 0, 1])
xx = x - array([1, 2, 3], mask=[1, 0, 0])
assert_equal(xx.data, [1, 0, 3])
assert_equal(xx.mask, [1, 0, 1])
# Test isub w/ array
x = array([1, 2, 3], mask=[0, 0, 1])
x -= array([1, 2, 3], mask=[1, 0, 0])
assert_equal(x.data, [1, 0, 3])
assert_equal(x.mask, [1, 0, 1])
def test_datafriendly_mul(self):
# Test keeping data w/ (inplace) multiplication
# Test mul w/ scalar
x = array([1, 2, 3], mask=[0, 0, 1])
xx = x * 2
assert_equal(xx.data, [2, 4, 3])
assert_equal(xx.mask, [0, 0, 1])
# Test imul w/ scalar
x = array([1, 2, 3], mask=[0, 0, 1])
x *= 2
assert_equal(x.data, [2, 4, 3])
assert_equal(x.mask, [0, 0, 1])
# Test mul w/ array
x = array([1, 2, 3], mask=[0, 0, 1])
xx = x * array([10, 20, 30], mask=[1, 0, 0])
assert_equal(xx.data, [1, 40, 3])
assert_equal(xx.mask, [1, 0, 1])
# Test imul w/ array
x = array([1, 2, 3], mask=[0, 0, 1])
x *= array([10, 20, 30], mask=[1, 0, 0])
assert_equal(x.data, [1, 40, 3])
assert_equal(x.mask, [1, 0, 1])
def test_datafriendly_div(self):
# Test keeping data w/ (inplace) division
# Test div on scalar
x = array([1, 2, 3], mask=[0, 0, 1])
xx = x / 2.
assert_equal(xx.data, [1 / 2., 2 / 2., 3])
assert_equal(xx.mask, [0, 0, 1])
# Test idiv on scalar
x = array([1., 2., 3.], mask=[0, 0, 1])
x /= 2.
assert_equal(x.data, [1 / 2., 2 / 2., 3])
assert_equal(x.mask, [0, 0, 1])
# Test div on array
x = array([1., 2., 3.], mask=[0, 0, 1])
xx = x / array([10., 20., 30.], mask=[1, 0, 0])
assert_equal(xx.data, [1., 2. / 20., 3.])
assert_equal(xx.mask, [1, 0, 1])
# Test idiv on array
x = array([1., 2., 3.], mask=[0, 0, 1])
x /= array([10., 20., 30.], mask=[1, 0, 0])
assert_equal(x.data, [1., 2 / 20., 3.])
assert_equal(x.mask, [1, 0, 1])
def test_datafriendly_pow(self):
# Test keeping data w/ (inplace) power
# Test pow on scalar
x = array([1., 2., 3.], mask=[0, 0, 1])
xx = x ** 2.5
assert_equal(xx.data, [1., 2. ** 2.5, 3.])
assert_equal(xx.mask, [0, 0, 1])
# Test ipow on scalar
x **= 2.5
assert_equal(x.data, [1., 2. ** 2.5, 3])
assert_equal(x.mask, [0, 0, 1])
def test_datafriendly_add_arrays(self):
a = array([[1, 1], [3, 3]])
b = array([1, 1], mask=[0, 0])
a += b
assert_equal(a, [[2, 2], [4, 4]])
if a.mask is not nomask:
assert_equal(a.mask, [[0, 0], [0, 0]])
a = array([[1, 1], [3, 3]])
b = array([1, 1], mask=[0, 1])
a += b
assert_equal(a, [[2, 2], [4, 4]])
assert_equal(a.mask, [[0, 1], [0, 1]])
def test_datafriendly_sub_arrays(self):
a = array([[1, 1], [3, 3]])
b = array([1, 1], mask=[0, 0])
a -= b
assert_equal(a, [[0, 0], [2, 2]])
if a.mask is not nomask:
assert_equal(a.mask, [[0, 0], [0, 0]])
a = array([[1, 1], [3, 3]])
b = array([1, 1], mask=[0, 1])
a -= b
assert_equal(a, [[0, 0], [2, 2]])
assert_equal(a.mask, [[0, 1], [0, 1]])
def test_datafriendly_mul_arrays(self):
a = array([[1, 1], [3, 3]])
b = array([1, 1], mask=[0, 0])
a *= b
assert_equal(a, [[1, 1], [3, 3]])
if a.mask is not nomask:
assert_equal(a.mask, [[0, 0], [0, 0]])
a = array([[1, 1], [3, 3]])
b = array([1, 1], mask=[0, 1])
a *= b
assert_equal(a, [[1, 1], [3, 3]])
assert_equal(a.mask, [[0, 1], [0, 1]])
def test_inplace_addition_scalar_type(self):
# Test of inplace additions
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
xm[2] = masked
x += t(1)
assert_equal(x, y + t(1))
xm += t(1)
assert_equal(xm, y + t(1))
assert_equal(len(w), 0, "Failed on type=%s." % t)
def test_inplace_addition_array_type(self):
# Test of inplace additions
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
m = xm.mask
a = arange(10, dtype=t)
a[-1] = masked
x += a
xm += a
assert_equal(x, y + a)
assert_equal(xm, y + a)
assert_equal(xm.mask, mask_or(m, a.mask))
assert_equal(len(w), 0, "Failed on type=%s." % t)
def test_inplace_subtraction_scalar_type(self):
# Test of inplace subtractions
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
x -= t(1)
assert_equal(x, y - t(1))
xm -= t(1)
assert_equal(xm, y - t(1))
assert_equal(len(w), 0, "Failed on type=%s." % t)
def test_inplace_subtraction_array_type(self):
# Test of inplace subtractions
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
m = xm.mask
a = arange(10, dtype=t)
a[-1] = masked
x -= a
xm -= a
assert_equal(x, y - a)
assert_equal(xm, y - a)
assert_equal(xm.mask, mask_or(m, a.mask))
assert_equal(len(w), 0, "Failed on type=%s." % t)
def test_inplace_multiplication_scalar_type(self):
# Test of inplace multiplication
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
x *= t(2)
assert_equal(x, y * t(2))
xm *= t(2)
assert_equal(xm, y * t(2))
assert_equal(len(w), 0, "Failed on type=%s." % t)
def test_inplace_multiplication_array_type(self):
# Test of inplace multiplication
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
m = xm.mask
a = arange(10, dtype=t)
a[-1] = masked
x *= a
xm *= a
assert_equal(x, y * a)
assert_equal(xm, y * a)
assert_equal(xm.mask, mask_or(m, a.mask))
assert_equal(len(w), 0, "Failed on type=%s." % t)
def test_inplace_floor_division_scalar_type(self):
# Test of inplace division
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
x = arange(10, dtype=t) * t(2)
xm = arange(10, dtype=t) * t(2)
xm[2] = masked
x //= t(2)
xm //= t(2)
assert_equal(x, y)
assert_equal(xm, y)
assert_equal(len(w), 0, "Failed on type=%s." % t)
def test_inplace_floor_division_array_type(self):
# Test of inplace division
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
m = xm.mask
a = arange(10, dtype=t)
a[-1] = masked
x //= a
xm //= a
assert_equal(x, y // a)
assert_equal(xm, y // a)
assert_equal(
xm.mask,
mask_or(mask_or(m, a.mask), (a == t(0)))
)
assert_equal(len(w), 0, "Failed on type=%s." % t)
def test_inplace_division_scalar_type(self):
# Test of inplace division
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
x = arange(10, dtype=t) * t(2)
xm = arange(10, dtype=t) * t(2)
xm[2] = masked
# May get a DeprecationWarning or a TypeError.
#
# This is a consequence of the fact that this is true divide
# and will require casting to float for calculation and
# casting back to the original type. This will only be raised
# with integers. Whether it is an error or warning is only
# dependent on how stringent the casting rules are.
#
# Will handle the same way.
try:
x /= t(2)
assert_equal(x, y)
except (DeprecationWarning, TypeError) as e:
warnings.warn(str(e))
try:
xm /= t(2)
assert_equal(xm, y)
except (DeprecationWarning, TypeError) as e:
warnings.warn(str(e))
if issubclass(t, np.integer):
assert_equal(len(w), 2, "Failed on type=%s." % t)
else:
assert_equal(len(w), 0, "Failed on type=%s." % t)
def test_inplace_division_array_type(self):
# Test of inplace division
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
m = xm.mask
a = arange(10, dtype=t)
a[-1] = masked
# May get a DeprecationWarning or a TypeError.
#
# This is a consequence of the fact that this is true divide
# and will require casting to float for calculation and
# casting back to the original type. This will only be raised
# with integers. Whether it is an error or warning is only
# dependent on how stringent the casting rules are.
#
# Will handle the same way.
try:
x /= a
assert_equal(x, y / a)
except (DeprecationWarning, TypeError) as e:
warnings.warn(str(e))
try:
xm /= a
assert_equal(xm, y / a)
assert_equal(
xm.mask,
mask_or(mask_or(m, a.mask), (a == t(0)))
)
except (DeprecationWarning, TypeError) as e:
warnings.warn(str(e))
if issubclass(t, np.integer):
assert_equal(len(w), 2, "Failed on type=%s." % t)
else:
assert_equal(len(w), 0, "Failed on type=%s." % t)
def test_inplace_pow_type(self):
# Test keeping data w/ (inplace) power
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
# Test pow on scalar
x = array([1, 2, 3], mask=[0, 0, 1], dtype=t)
xx = x ** t(2)
xx_r = array([1, 2 ** 2, 3], mask=[0, 0, 1], dtype=t)
assert_equal(xx.data, xx_r.data)
assert_equal(xx.mask, xx_r.mask)
# Test ipow on scalar
x **= t(2)
assert_equal(x.data, xx_r.data)
assert_equal(x.mask, xx_r.mask)
assert_equal(len(w), 0, "Failed on type=%s." % t)
class TestMaskedArrayMethods(TestCase):
# Test class for miscellaneous MaskedArrays methods.
def setUp(self):
# Base data definition.
x = np.array([8.375, 7.545, 8.828, 8.5, 1.757, 5.928,
8.43, 7.78, 9.865, 5.878, 8.979, 4.732,
3.012, 6.022, 5.095, 3.116, 5.238, 3.957,
6.04, 9.63, 7.712, 3.382, 4.489, 6.479,
7.189, 9.645, 5.395, 4.961, 9.894, 2.893,
7.357, 9.828, 6.272, 3.758, 6.693, 0.993])
X = x.reshape(6, 6)
XX = x.reshape(3, 2, 2, 3)
m = np.array([0, 1, 0, 1, 0, 0,
1, 0, 1, 1, 0, 1,
0, 0, 0, 1, 0, 1,
0, 0, 0, 1, 1, 1,
1, 0, 0, 1, 0, 0,
0, 0, 1, 0, 1, 0])
mx = array(data=x, mask=m)
mX = array(data=X, mask=m.reshape(X.shape))
mXX = array(data=XX, mask=m.reshape(XX.shape))
m2 = np.array([1, 1, 0, 1, 0, 0,
1, 1, 1, 1, 0, 1,
0, 0, 1, 1, 0, 1,
0, 0, 0, 1, 1, 1,
1, 0, 0, 1, 1, 0,
0, 0, 1, 0, 1, 1])
m2x = array(data=x, mask=m2)
m2X = array(data=X, mask=m2.reshape(X.shape))
m2XX = array(data=XX, mask=m2.reshape(XX.shape))
self.d = (x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX)
def test_generic_methods(self):
# Tests some MaskedArray methods.
a = array([1, 3, 2])
assert_equal(a.any(), a._data.any())
assert_equal(a.all(), a._data.all())
assert_equal(a.argmax(), a._data.argmax())
assert_equal(a.argmin(), a._data.argmin())
assert_equal(a.choose(0, 1, 2, 3, 4), a._data.choose(0, 1, 2, 3, 4))
assert_equal(a.compress([1, 0, 1]), a._data.compress([1, 0, 1]))
assert_equal(a.conj(), a._data.conj())
assert_equal(a.conjugate(), a._data.conjugate())
m = array([[1, 2], [3, 4]])
assert_equal(m.diagonal(), m._data.diagonal())
assert_equal(a.sum(), a._data.sum())
assert_equal(a.take([1, 2]), a._data.take([1, 2]))
assert_equal(m.transpose(), m._data.transpose())
def test_allclose(self):
# Tests allclose on arrays
a = np.random.rand(10)
b = a + np.random.rand(10) * 1e-8
self.assertTrue(allclose(a, b))
# Test allclose w/ infs
a[0] = np.inf
self.assertTrue(not allclose(a, b))
b[0] = np.inf
self.assertTrue(allclose(a, b))
# Test allclose w/ masked
a = masked_array(a)
a[-1] = masked
self.assertTrue(allclose(a, b, masked_equal=True))
self.assertTrue(not allclose(a, b, masked_equal=False))
# Test comparison w/ scalar
a *= 1e-8
a[0] = 0
self.assertTrue(allclose(a, 0, masked_equal=True))
# Test that the function works for MIN_INT integer typed arrays
a = masked_array([np.iinfo(np.int_).min], dtype=np.int_)
self.assertTrue(allclose(a, a))
def test_allany(self):
# Checks the any/all methods/functions.
x = np.array([[0.13, 0.26, 0.90],
[0.28, 0.33, 0.63],
[0.31, 0.87, 0.70]])
m = np.array([[True, False, False],
[False, False, False],
[True, True, False]], dtype=np.bool_)
mx = masked_array(x, mask=m)
mxbig = (mx > 0.5)
mxsmall = (mx < 0.5)
self.assertFalse(mxbig.all())
self.assertTrue(mxbig.any())
assert_equal(mxbig.all(0), [False, False, True])
assert_equal(mxbig.all(1), [False, False, True])
assert_equal(mxbig.any(0), [False, False, True])
assert_equal(mxbig.any(1), [True, True, True])
self.assertFalse(mxsmall.all())
self.assertTrue(mxsmall.any())
assert_equal(mxsmall.all(0), [True, True, False])
assert_equal(mxsmall.all(1), [False, False, False])
assert_equal(mxsmall.any(0), [True, True, False])
assert_equal(mxsmall.any(1), [True, True, False])
def test_allany_onmatrices(self):
x = np.array([[0.13, 0.26, 0.90],
[0.28, 0.33, 0.63],
[0.31, 0.87, 0.70]])
X = np.matrix(x)
m = np.array([[True, False, False],
[False, False, False],
[True, True, False]], dtype=np.bool_)
mX = masked_array(X, mask=m)
mXbig = (mX > 0.5)
mXsmall = (mX < 0.5)
self.assertFalse(mXbig.all())
self.assertTrue(mXbig.any())
assert_equal(mXbig.all(0), np.matrix([False, False, True]))
assert_equal(mXbig.all(1), np.matrix([False, False, True]).T)
assert_equal(mXbig.any(0), np.matrix([False, False, True]))
assert_equal(mXbig.any(1), np.matrix([True, True, True]).T)
self.assertFalse(mXsmall.all())
self.assertTrue(mXsmall.any())
assert_equal(mXsmall.all(0), np.matrix([True, True, False]))
assert_equal(mXsmall.all(1), np.matrix([False, False, False]).T)
assert_equal(mXsmall.any(0), np.matrix([True, True, False]))
assert_equal(mXsmall.any(1), np.matrix([True, True, False]).T)
def test_allany_oddities(self):
# Some fun with all and any
store = empty((), dtype=bool)
full = array([1, 2, 3], mask=True)
self.assertTrue(full.all() is masked)
full.all(out=store)
self.assertTrue(store)
self.assertTrue(store._mask, True)
self.assertTrue(store is not masked)
store = empty((), dtype=bool)
self.assertTrue(full.any() is masked)
full.any(out=store)
self.assertTrue(not store)
self.assertTrue(store._mask, True)
self.assertTrue(store is not masked)
def test_argmax_argmin(self):
# Tests argmin & argmax on MaskedArrays.
(x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX) = self.d
assert_equal(mx.argmin(), 35)
assert_equal(mX.argmin(), 35)
assert_equal(m2x.argmin(), 4)
assert_equal(m2X.argmin(), 4)
assert_equal(mx.argmax(), 28)
assert_equal(mX.argmax(), 28)
assert_equal(m2x.argmax(), 31)
assert_equal(m2X.argmax(), 31)
assert_equal(mX.argmin(0), [2, 2, 2, 5, 0, 5])
assert_equal(m2X.argmin(0), [2, 2, 4, 5, 0, 4])
assert_equal(mX.argmax(0), [0, 5, 0, 5, 4, 0])
assert_equal(m2X.argmax(0), [5, 5, 0, 5, 1, 0])
assert_equal(mX.argmin(1), [4, 1, 0, 0, 5, 5, ])
assert_equal(m2X.argmin(1), [4, 4, 0, 0, 5, 3])
assert_equal(mX.argmax(1), [2, 4, 1, 1, 4, 1])
assert_equal(m2X.argmax(1), [2, 4, 1, 1, 1, 1])
def test_clip(self):
# Tests clip on MaskedArrays.
x = np.array([8.375, 7.545, 8.828, 8.5, 1.757, 5.928,
8.43, 7.78, 9.865, 5.878, 8.979, 4.732,
3.012, 6.022, 5.095, 3.116, 5.238, 3.957,
6.04, 9.63, 7.712, 3.382, 4.489, 6.479,
7.189, 9.645, 5.395, 4.961, 9.894, 2.893,
7.357, 9.828, 6.272, 3.758, 6.693, 0.993])
m = np.array([0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1,
0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1,
1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0])
mx = array(x, mask=m)
clipped = mx.clip(2, 8)
assert_equal(clipped.mask, mx.mask)
assert_equal(clipped._data, x.clip(2, 8))
assert_equal(clipped._data, mx._data.clip(2, 8))
def test_compress(self):
# test compress
a = masked_array([1., 2., 3., 4., 5.], fill_value=9999)
condition = (a > 1.5) & (a < 3.5)
assert_equal(a.compress(condition), [2., 3.])
a[[2, 3]] = masked
b = a.compress(condition)
assert_equal(b._data, [2., 3.])
assert_equal(b._mask, [0, 1])
assert_equal(b.fill_value, 9999)
assert_equal(b, a[condition])
condition = (a < 4.)
b = a.compress(condition)
assert_equal(b._data, [1., 2., 3.])
assert_equal(b._mask, [0, 0, 1])
assert_equal(b.fill_value, 9999)
assert_equal(b, a[condition])
a = masked_array([[10, 20, 30], [40, 50, 60]],
mask=[[0, 0, 1], [1, 0, 0]])
b = a.compress(a.ravel() >= 22)
assert_equal(b._data, [30, 40, 50, 60])
assert_equal(b._mask, [1, 1, 0, 0])
x = np.array([3, 1, 2])
b = a.compress(x >= 2, axis=1)
assert_equal(b._data, [[10, 30], [40, 60]])
assert_equal(b._mask, [[0, 1], [1, 0]])
def test_compressed(self):
# Tests compressed
a = array([1, 2, 3, 4], mask=[0, 0, 0, 0])
b = a.compressed()
assert_equal(b, a)
a[0] = masked
b = a.compressed()
assert_equal(b, [2, 3, 4])
a = array(np.matrix([1, 2, 3, 4]), mask=[0, 0, 0, 0])
b = a.compressed()
assert_equal(b, a)
self.assertTrue(isinstance(b, np.matrix))
a[0, 0] = masked
b = a.compressed()
assert_equal(b, [[2, 3, 4]])
def test_empty(self):
# Tests empty/like
datatype = [('a', int), ('b', float), ('c', '|S8')]
a = masked_array([(1, 1.1, '1.1'), (2, 2.2, '2.2'), (3, 3.3, '3.3')],
dtype=datatype)
assert_equal(len(a.fill_value.item()), len(datatype))
b = empty_like(a)
assert_equal(b.shape, a.shape)
assert_equal(b.fill_value, a.fill_value)
b = empty(len(a), dtype=datatype)
assert_equal(b.shape, a.shape)
assert_equal(b.fill_value, a.fill_value)
# check empty_like mask handling
a = masked_array([1, 2, 3], mask=[False, True, False])
b = empty_like(a)
assert_(not np.may_share_memory(a.mask, b.mask))
b = a.view(masked_array)
assert_(np.may_share_memory(a.mask, b.mask))
def test_put(self):
# Tests put.
d = arange(5)
n = [0, 0, 0, 1, 1]
m = make_mask(n)
x = array(d, mask=m)
self.assertTrue(x[3] is masked)
self.assertTrue(x[4] is masked)
x[[1, 4]] = [10, 40]
self.assertTrue(x[3] is masked)
self.assertTrue(x[4] is not masked)
assert_equal(x, [0, 10, 2, -1, 40])
x = masked_array(arange(10), mask=[1, 0, 0, 0, 0] * 2)
i = [0, 2, 4, 6]
x.put(i, [6, 4, 2, 0])
assert_equal(x, asarray([6, 1, 4, 3, 2, 5, 0, 7, 8, 9, ]))
assert_equal(x.mask, [0, 0, 0, 0, 0, 1, 0, 0, 0, 0])
x.put(i, masked_array([0, 2, 4, 6], [1, 0, 1, 0]))
assert_array_equal(x, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ])
assert_equal(x.mask, [1, 0, 0, 0, 1, 1, 0, 0, 0, 0])
x = masked_array(arange(10), mask=[1, 0, 0, 0, 0] * 2)
put(x, i, [6, 4, 2, 0])
assert_equal(x, asarray([6, 1, 4, 3, 2, 5, 0, 7, 8, 9, ]))
assert_equal(x.mask, [0, 0, 0, 0, 0, 1, 0, 0, 0, 0])
put(x, i, masked_array([0, 2, 4, 6], [1, 0, 1, 0]))
assert_array_equal(x, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ])
assert_equal(x.mask, [1, 0, 0, 0, 1, 1, 0, 0, 0, 0])
def test_put_nomask(self):
# GitHub issue 6425
x = zeros(10)
z = array([3., -1.], mask=[False, True])
x.put([1, 2], z)
self.assertTrue(x[0] is not masked)
assert_equal(x[0], 0)
self.assertTrue(x[1] is not masked)
assert_equal(x[1], 3)
self.assertTrue(x[2] is masked)
self.assertTrue(x[3] is not masked)
assert_equal(x[3], 0)
def test_put_hardmask(self):
# Tests put on hardmask
d = arange(5)
n = [0, 0, 0, 1, 1]
m = make_mask(n)
xh = array(d + 1, mask=m, hard_mask=True, copy=True)
xh.put([4, 2, 0, 1, 3], [1, 2, 3, 4, 5])
assert_equal(xh._data, [3, 4, 2, 4, 5])
def test_putmask(self):
x = arange(6) + 1
mx = array(x, mask=[0, 0, 0, 1, 1, 1])
mask = [0, 0, 1, 0, 0, 1]
# w/o mask, w/o masked values
xx = x.copy()
putmask(xx, mask, 99)
assert_equal(xx, [1, 2, 99, 4, 5, 99])
# w/ mask, w/o masked values
mxx = mx.copy()
putmask(mxx, mask, 99)
assert_equal(mxx._data, [1, 2, 99, 4, 5, 99])
assert_equal(mxx._mask, [0, 0, 0, 1, 1, 0])
# w/o mask, w/ masked values
values = array([10, 20, 30, 40, 50, 60], mask=[1, 1, 1, 0, 0, 0])
xx = x.copy()
putmask(xx, mask, values)
assert_equal(xx._data, [1, 2, 30, 4, 5, 60])
assert_equal(xx._mask, [0, 0, 1, 0, 0, 0])
# w/ mask, w/ masked values
mxx = mx.copy()
putmask(mxx, mask, values)
assert_equal(mxx._data, [1, 2, 30, 4, 5, 60])
assert_equal(mxx._mask, [0, 0, 1, 1, 1, 0])
# w/ mask, w/ masked values + hardmask
mxx = mx.copy()
mxx.harden_mask()
putmask(mxx, mask, values)
assert_equal(mxx, [1, 2, 30, 4, 5, 60])
def test_ravel(self):
# Tests ravel
a = array([[1, 2, 3, 4, 5]], mask=[[0, 1, 0, 0, 0]])
aravel = a.ravel()
assert_equal(aravel._mask.shape, aravel.shape)
a = array([0, 0], mask=[1, 1])
aravel = a.ravel()
assert_equal(aravel._mask.shape, a.shape)
a = array(np.matrix([1, 2, 3, 4, 5]), mask=[[0, 1, 0, 0, 0]])
aravel = a.ravel()
assert_equal(aravel.shape, (1, 5))
assert_equal(aravel._mask.shape, a.shape)
# Checks that small_mask is preserved
a = array([1, 2, 3, 4], mask=[0, 0, 0, 0], shrink=False)
assert_equal(a.ravel()._mask, [0, 0, 0, 0])
# Test that the fill_value is preserved
a.fill_value = -99
a.shape = (2, 2)
ar = a.ravel()
assert_equal(ar._mask, [0, 0, 0, 0])
assert_equal(ar._data, [1, 2, 3, 4])
assert_equal(ar.fill_value, -99)
# Test index ordering
assert_equal(a.ravel(order='C'), [1, 2, 3, 4])
assert_equal(a.ravel(order='F'), [1, 3, 2, 4])
def test_reshape(self):
# Tests reshape
x = arange(4)
x[0] = masked
y = x.reshape(2, 2)
assert_equal(y.shape, (2, 2,))
assert_equal(y._mask.shape, (2, 2,))
assert_equal(x.shape, (4,))
assert_equal(x._mask.shape, (4,))
def test_sort(self):
# Test sort
x = array([1, 4, 2, 3], mask=[0, 1, 0, 0], dtype=np.uint8)
sortedx = sort(x)
assert_equal(sortedx._data, [1, 2, 3, 4])
assert_equal(sortedx._mask, [0, 0, 0, 1])
sortedx = sort(x, endwith=False)
assert_equal(sortedx._data, [4, 1, 2, 3])
assert_equal(sortedx._mask, [1, 0, 0, 0])
x.sort()
assert_equal(x._data, [1, 2, 3, 4])
assert_equal(x._mask, [0, 0, 0, 1])
x = array([1, 4, 2, 3], mask=[0, 1, 0, 0], dtype=np.uint8)
x.sort(endwith=False)
assert_equal(x._data, [4, 1, 2, 3])
assert_equal(x._mask, [1, 0, 0, 0])
x = [1, 4, 2, 3]
sortedx = sort(x)
self.assertTrue(not isinstance(sorted, MaskedArray))
x = array([0, 1, -1, -2, 2], mask=nomask, dtype=np.int8)
sortedx = sort(x, endwith=False)
assert_equal(sortedx._data, [-2, -1, 0, 1, 2])
x = array([0, 1, -1, -2, 2], mask=[0, 1, 0, 0, 1], dtype=np.int8)
sortedx = sort(x, endwith=False)
assert_equal(sortedx._data, [1, 2, -2, -1, 0])
assert_equal(sortedx._mask, [1, 1, 0, 0, 0])
def test_sort_2d(self):
# Check sort of 2D array.
# 2D array w/o mask
a = masked_array([[8, 4, 1], [2, 0, 9]])
a.sort(0)
assert_equal(a, [[2, 0, 1], [8, 4, 9]])
a = masked_array([[8, 4, 1], [2, 0, 9]])
a.sort(1)
assert_equal(a, [[1, 4, 8], [0, 2, 9]])
# 2D array w/mask
a = masked_array([[8, 4, 1], [2, 0, 9]], mask=[[1, 0, 0], [0, 0, 1]])
a.sort(0)
assert_equal(a, [[2, 0, 1], [8, 4, 9]])
assert_equal(a._mask, [[0, 0, 0], [1, 0, 1]])
a = masked_array([[8, 4, 1], [2, 0, 9]], mask=[[1, 0, 0], [0, 0, 1]])
a.sort(1)
assert_equal(a, [[1, 4, 8], [0, 2, 9]])
assert_equal(a._mask, [[0, 0, 1], [0, 0, 1]])
# 3D
a = masked_array([[[7, 8, 9], [4, 5, 6], [1, 2, 3]],
[[1, 2, 3], [7, 8, 9], [4, 5, 6]],
[[7, 8, 9], [1, 2, 3], [4, 5, 6]],
[[4, 5, 6], [1, 2, 3], [7, 8, 9]]])
a[a % 4 == 0] = masked
am = a.copy()
an = a.filled(99)
am.sort(0)
an.sort(0)
assert_equal(am, an)
am = a.copy()
an = a.filled(99)
am.sort(1)
an.sort(1)
assert_equal(am, an)
am = a.copy()
an = a.filled(99)
am.sort(2)
an.sort(2)
assert_equal(am, an)
def test_sort_flexible(self):
# Test sort on flexible dtype.
a = array(
data=[(3, 3), (3, 2), (2, 2), (2, 1), (1, 0), (1, 1), (1, 2)],
mask=[(0, 0), (0, 1), (0, 0), (0, 0), (1, 0), (0, 0), (0, 0)],
dtype=[('A', int), ('B', int)])
test = sort(a)
b = array(
data=[(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 2), (1, 0)],
mask=[(0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 1), (1, 0)],
dtype=[('A', int), ('B', int)])
assert_equal(test, b)
assert_equal(test.mask, b.mask)
test = sort(a, endwith=False)
b = array(
data=[(1, 0), (1, 1), (1, 2), (2, 1), (2, 2), (3, 2), (3, 3), ],
mask=[(1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 1), (0, 0), ],
dtype=[('A', int), ('B', int)])
assert_equal(test, b)
assert_equal(test.mask, b.mask)
def test_argsort(self):
# Test argsort
a = array([1, 5, 2, 4, 3], mask=[1, 0, 0, 1, 0])
assert_equal(np.argsort(a), argsort(a))
def test_squeeze(self):
# Check squeeze
data = masked_array([[1, 2, 3]])
assert_equal(data.squeeze(), [1, 2, 3])
data = masked_array([[1, 2, 3]], mask=[[1, 1, 1]])
assert_equal(data.squeeze(), [1, 2, 3])
assert_equal(data.squeeze()._mask, [1, 1, 1])
data = masked_array([[1]], mask=True)
self.assertTrue(data.squeeze() is masked)
def test_swapaxes(self):
# Tests swapaxes on MaskedArrays.
x = np.array([8.375, 7.545, 8.828, 8.5, 1.757, 5.928,
8.43, 7.78, 9.865, 5.878, 8.979, 4.732,
3.012, 6.022, 5.095, 3.116, 5.238, 3.957,
6.04, 9.63, 7.712, 3.382, 4.489, 6.479,
7.189, 9.645, 5.395, 4.961, 9.894, 2.893,
7.357, 9.828, 6.272, 3.758, 6.693, 0.993])
m = np.array([0, 1, 0, 1, 0, 0,
1, 0, 1, 1, 0, 1,
0, 0, 0, 1, 0, 1,
0, 0, 0, 1, 1, 1,
1, 0, 0, 1, 0, 0,
0, 0, 1, 0, 1, 0])
mX = array(x, mask=m).reshape(6, 6)
mXX = mX.reshape(3, 2, 2, 3)
mXswapped = mX.swapaxes(0, 1)
assert_equal(mXswapped[-1], mX[:, -1])
mXXswapped = mXX.swapaxes(0, 2)
assert_equal(mXXswapped.shape, (2, 2, 3, 3))
def test_take(self):
# Tests take
x = masked_array([10, 20, 30, 40], [0, 1, 0, 1])
assert_equal(x.take([0, 0, 3]), masked_array([10, 10, 40], [0, 0, 1]))
assert_equal(x.take([0, 0, 3]), x[[0, 0, 3]])
assert_equal(x.take([[0, 1], [0, 1]]),
masked_array([[10, 20], [10, 20]], [[0, 1], [0, 1]]))
# assert_equal crashes when passed np.ma.mask
self.assertIs(x[1], np.ma.masked)
self.assertIs(x.take(1), np.ma.masked)
x = array([[10, 20, 30], [40, 50, 60]], mask=[[0, 0, 1], [1, 0, 0, ]])
assert_equal(x.take([0, 2], axis=1),
array([[10, 30], [40, 60]], mask=[[0, 1], [1, 0]]))
assert_equal(take(x, [0, 2], axis=1),
array([[10, 30], [40, 60]], mask=[[0, 1], [1, 0]]))
def test_take_masked_indices(self):
# Test take w/ masked indices
a = np.array((40, 18, 37, 9, 22))
indices = np.arange(3)[None,:] + np.arange(5)[:, None]
mindices = array(indices, mask=(indices >= len(a)))
# No mask
test = take(a, mindices, mode='clip')
ctrl = array([[40, 18, 37],
[18, 37, 9],
[37, 9, 22],
[9, 22, 22],
[22, 22, 22]])
assert_equal(test, ctrl)
# Masked indices
test = take(a, mindices)
ctrl = array([[40, 18, 37],
[18, 37, 9],
[37, 9, 22],
[9, 22, 40],
[22, 40, 40]])
ctrl[3, 2] = ctrl[4, 1] = ctrl[4, 2] = masked
assert_equal(test, ctrl)
assert_equal(test.mask, ctrl.mask)
# Masked input + masked indices
a = array((40, 18, 37, 9, 22), mask=(0, 1, 0, 0, 0))
test = take(a, mindices)
ctrl[0, 1] = ctrl[1, 0] = masked
assert_equal(test, ctrl)
assert_equal(test.mask, ctrl.mask)
def test_tolist(self):
# Tests to list
# ... on 1D
x = array(np.arange(12))
x[[1, -2]] = masked
xlist = x.tolist()
self.assertTrue(xlist[1] is None)
self.assertTrue(xlist[-2] is None)
# ... on 2D
x.shape = (3, 4)
xlist = x.tolist()
ctrl = [[0, None, 2, 3], [4, 5, 6, 7], [8, 9, None, 11]]
assert_equal(xlist[0], [0, None, 2, 3])
assert_equal(xlist[1], [4, 5, 6, 7])
assert_equal(xlist[2], [8, 9, None, 11])
assert_equal(xlist, ctrl)
# ... on structured array w/ masked records
x = array(list(zip([1, 2, 3],
[1.1, 2.2, 3.3],
['one', 'two', 'thr'])),
dtype=[('a', int), ('b', float), ('c', '|S8')])
x[-1] = masked
assert_equal(x.tolist(),
[(1, 1.1, asbytes('one')),
(2, 2.2, asbytes('two')),
(None, None, None)])
# ... on structured array w/ masked fields
a = array([(1, 2,), (3, 4)], mask=[(0, 1), (0, 0)],
dtype=[('a', int), ('b', int)])
test = a.tolist()
assert_equal(test, [[1, None], [3, 4]])
# ... on mvoid
a = a[0]
test = a.tolist()
assert_equal(test, [1, None])
def test_tolist_specialcase(self):
# Test mvoid.tolist: make sure we return a standard Python object
a = array([(0, 1), (2, 3)], dtype=[('a', int), ('b', int)])
# w/o mask: each entry is a np.void whose elements are standard Python
for entry in a:
for item in entry.tolist():
assert_(not isinstance(item, np.generic))
# w/ mask: each entry is a ma.void whose elements should be
# standard Python
a.mask[0] = (0, 1)
for entry in a:
for item in entry.tolist():
assert_(not isinstance(item, np.generic))
def test_toflex(self):
# Test the conversion to records
data = arange(10)
record = data.toflex()
assert_equal(record['_data'], data._data)
assert_equal(record['_mask'], data._mask)
data[[0, 1, 2, -1]] = masked
record = data.toflex()
assert_equal(record['_data'], data._data)
assert_equal(record['_mask'], data._mask)
ndtype = [('i', int), ('s', '|S3'), ('f', float)]
data = array([(i, s, f) for (i, s, f) in zip(np.arange(10),
'ABCDEFGHIJKLM',
np.random.rand(10))],
dtype=ndtype)
data[[0, 1, 2, -1]] = masked
record = data.toflex()
assert_equal(record['_data'], data._data)
assert_equal(record['_mask'], data._mask)
ndtype = np.dtype("int, (2,3)float, float")
data = array([(i, f, ff) for (i, f, ff) in zip(np.arange(10),
np.random.rand(10),
np.random.rand(10))],
dtype=ndtype)
data[[0, 1, 2, -1]] = masked
record = data.toflex()
assert_equal_records(record['_data'], data._data)
assert_equal_records(record['_mask'], data._mask)
def test_fromflex(self):
# Test the reconstruction of a masked_array from a record
a = array([1, 2, 3])
test = fromflex(a.toflex())
assert_equal(test, a)
assert_equal(test.mask, a.mask)
a = array([1, 2, 3], mask=[0, 0, 1])
test = fromflex(a.toflex())
assert_equal(test, a)
assert_equal(test.mask, a.mask)
a = array([(1, 1.), (2, 2.), (3, 3.)], mask=[(1, 0), (0, 0), (0, 1)],
dtype=[('A', int), ('B', float)])
test = fromflex(a.toflex())
assert_equal(test, a)
assert_equal(test.data, a.data)
def test_arraymethod(self):
# Test a _arraymethod w/ n argument
marray = masked_array([[1, 2, 3, 4, 5]], mask=[0, 0, 1, 0, 0])
control = masked_array([[1], [2], [3], [4], [5]],
mask=[0, 0, 1, 0, 0])
assert_equal(marray.T, control)
assert_equal(marray.transpose(), control)
assert_equal(MaskedArray.cumsum(marray.T, 0), control.cumsum(0))
class TestMaskedArrayMathMethods(TestCase):
def setUp(self):
# Base data definition.
x = np.array([8.375, 7.545, 8.828, 8.5, 1.757, 5.928,
8.43, 7.78, 9.865, 5.878, 8.979, 4.732,
3.012, 6.022, 5.095, 3.116, 5.238, 3.957,
6.04, 9.63, 7.712, 3.382, 4.489, 6.479,
7.189, 9.645, 5.395, 4.961, 9.894, 2.893,
7.357, 9.828, 6.272, 3.758, 6.693, 0.993])
X = x.reshape(6, 6)
XX = x.reshape(3, 2, 2, 3)
m = np.array([0, 1, 0, 1, 0, 0,
1, 0, 1, 1, 0, 1,
0, 0, 0, 1, 0, 1,
0, 0, 0, 1, 1, 1,
1, 0, 0, 1, 0, 0,
0, 0, 1, 0, 1, 0])
mx = array(data=x, mask=m)
mX = array(data=X, mask=m.reshape(X.shape))
mXX = array(data=XX, mask=m.reshape(XX.shape))
m2 = np.array([1, 1, 0, 1, 0, 0,
1, 1, 1, 1, 0, 1,
0, 0, 1, 1, 0, 1,
0, 0, 0, 1, 1, 1,
1, 0, 0, 1, 1, 0,
0, 0, 1, 0, 1, 1])
m2x = array(data=x, mask=m2)
m2X = array(data=X, mask=m2.reshape(X.shape))
m2XX = array(data=XX, mask=m2.reshape(XX.shape))
self.d = (x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX)
def test_cumsumprod(self):
# Tests cumsum & cumprod on MaskedArrays.
(x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX) = self.d
mXcp = mX.cumsum(0)
assert_equal(mXcp._data, mX.filled(0).cumsum(0))
mXcp = mX.cumsum(1)
assert_equal(mXcp._data, mX.filled(0).cumsum(1))
mXcp = mX.cumprod(0)
assert_equal(mXcp._data, mX.filled(1).cumprod(0))
mXcp = mX.cumprod(1)
assert_equal(mXcp._data, mX.filled(1).cumprod(1))
def test_cumsumprod_with_output(self):
# Tests cumsum/cumprod w/ output
xm = array(np.random.uniform(0, 10, 12)).reshape(3, 4)
xm[:, 0] = xm[0] = xm[-1, -1] = masked
for funcname in ('cumsum', 'cumprod'):
npfunc = getattr(np, funcname)
xmmeth = getattr(xm, funcname)
# A ndarray as explicit input
output = np.empty((3, 4), dtype=float)
output.fill(-9999)
result = npfunc(xm, axis=0, out=output)
# ... the result should be the given output
self.assertTrue(result is output)
assert_equal(result, xmmeth(axis=0, out=output))
output = empty((3, 4), dtype=int)
result = xmmeth(axis=0, out=output)
self.assertTrue(result is output)
def test_ptp(self):
# Tests ptp on MaskedArrays.
(x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX) = self.d
(n, m) = X.shape
assert_equal(mx.ptp(), mx.compressed().ptp())
rows = np.zeros(n, np.float)
cols = np.zeros(m, np.float)
for k in range(m):
cols[k] = mX[:, k].compressed().ptp()
for k in range(n):
rows[k] = mX[k].compressed().ptp()
assert_equal(mX.ptp(0), cols)
assert_equal(mX.ptp(1), rows)
def test_add_object(self):
x = masked_array(['a', 'b'], mask=[1, 0], dtype=object)
y = x + 'x'
assert_equal(y[1], 'bx')
assert_(y.mask[0])
def test_sum_object(self):
# Test sum on object dtype
a = masked_array([1, 2, 3], mask=[1, 0, 0], dtype=np.object)
assert_equal(a.sum(), 5)
a = masked_array([[1, 2, 3], [4, 5, 6]], dtype=object)
assert_equal(a.sum(axis=0), [5, 7, 9])
def test_prod_object(self):
# Test prod on object dtype
a = masked_array([1, 2, 3], mask=[1, 0, 0], dtype=np.object)
assert_equal(a.prod(), 2 * 3)
a = masked_array([[1, 2, 3], [4, 5, 6]], dtype=object)
assert_equal(a.prod(axis=0), [4, 10, 18])
def test_meananom_object(self):
# Test mean/anom on object dtype
a = masked_array([1, 2, 3], dtype=np.object)
assert_equal(a.mean(), 2)
assert_equal(a.anom(), [-1, 0, 1])
def test_trace(self):
# Tests trace on MaskedArrays.
(x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX) = self.d
mXdiag = mX.diagonal()
assert_equal(mX.trace(), mX.diagonal().compressed().sum())
assert_almost_equal(mX.trace(),
X.trace() - sum(mXdiag.mask * X.diagonal(),
axis=0))
assert_equal(np.trace(mX), mX.trace())
def test_dot(self):
# Tests dot on MaskedArrays.
(x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX) = self.d
fx = mx.filled(0)
r = mx.dot(mx)
assert_almost_equal(r.filled(0), fx.dot(fx))
assert_(r.mask is nomask)
fX = mX.filled(0)
r = mX.dot(mX)
assert_almost_equal(r.filled(0), fX.dot(fX))
assert_(r.mask[1,3])
r1 = empty_like(r)
mX.dot(mX, out=r1)
assert_almost_equal(r, r1)
mYY = mXX.swapaxes(-1, -2)
fXX, fYY = mXX.filled(0), mYY.filled(0)
r = mXX.dot(mYY)
assert_almost_equal(r.filled(0), fXX.dot(fYY))
r1 = empty_like(r)
mXX.dot(mYY, out=r1)
assert_almost_equal(r, r1)
def test_dot_shape_mismatch(self):
# regression test
x = masked_array([[1,2],[3,4]], mask=[[0,1],[0,0]])
y = masked_array([[1,2],[3,4]], mask=[[0,1],[0,0]])
z = masked_array([[0,1],[3,3]])
x.dot(y, out=z)
assert_almost_equal(z.filled(0), [[1, 0], [15, 16]])
assert_almost_equal(z.mask, [[0, 1], [0, 0]])
def test_varstd(self):
# Tests var & std on MaskedArrays.
(x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX) = self.d
assert_almost_equal(mX.var(axis=None), mX.compressed().var())
assert_almost_equal(mX.std(axis=None), mX.compressed().std())
assert_almost_equal(mX.std(axis=None, ddof=1),
mX.compressed().std(ddof=1))
assert_almost_equal(mX.var(axis=None, ddof=1),
mX.compressed().var(ddof=1))
assert_equal(mXX.var(axis=3).shape, XX.var(axis=3).shape)
assert_equal(mX.var().shape, X.var().shape)
(mXvar0, mXvar1) = (mX.var(axis=0), mX.var(axis=1))
assert_almost_equal(mX.var(axis=None, ddof=2),
mX.compressed().var(ddof=2))
assert_almost_equal(mX.std(axis=None, ddof=2),
mX.compressed().std(ddof=2))
for k in range(6):
assert_almost_equal(mXvar1[k], mX[k].compressed().var())
assert_almost_equal(mXvar0[k], mX[:, k].compressed().var())
assert_almost_equal(np.sqrt(mXvar0[k]),
mX[:, k].compressed().std())
def test_varstd_specialcases(self):
# Test a special case for var
nout = np.array(-1, dtype=float)
mout = array(-1, dtype=float)
x = array(arange(10), mask=True)
for methodname in ('var', 'std'):
method = getattr(x, methodname)
self.assertTrue(method() is masked)
self.assertTrue(method(0) is masked)
self.assertTrue(method(-1) is masked)
# Using a masked array as explicit output
with warnings.catch_warnings():
warnings.simplefilter('ignore')
method(out=mout)
self.assertTrue(mout is not masked)
assert_equal(mout.mask, True)
# Using a ndarray as explicit output
with warnings.catch_warnings():
warnings.simplefilter('ignore')
method(out=nout)
self.assertTrue(np.isnan(nout))
x = array(arange(10), mask=True)
x[-1] = 9
for methodname in ('var', 'std'):
method = getattr(x, methodname)
self.assertTrue(method(ddof=1) is masked)
self.assertTrue(method(0, ddof=1) is masked)
self.assertTrue(method(-1, ddof=1) is masked)
# Using a masked array as explicit output
method(out=mout, ddof=1)
self.assertTrue(mout is not masked)
assert_equal(mout.mask, True)
# Using a ndarray as explicit output
method(out=nout, ddof=1)
self.assertTrue(np.isnan(nout))
def test_varstd_ddof(self):
a = array([[1, 1, 0], [1, 1, 0]], mask=[[0, 0, 1], [0, 0, 1]])
test = a.std(axis=0, ddof=0)
assert_equal(test.filled(0), [0, 0, 0])
assert_equal(test.mask, [0, 0, 1])
test = a.std(axis=0, ddof=1)
assert_equal(test.filled(0), [0, 0, 0])
assert_equal(test.mask, [0, 0, 1])
test = a.std(axis=0, ddof=2)
assert_equal(test.filled(0), [0, 0, 0])
assert_equal(test.mask, [1, 1, 1])
def test_diag(self):
# Test diag
x = arange(9).reshape((3, 3))
x[1, 1] = masked
out = np.diag(x)
assert_equal(out, [0, 4, 8])
out = diag(x)
assert_equal(out, [0, 4, 8])
assert_equal(out.mask, [0, 1, 0])
out = diag(out)
control = array([[0, 0, 0], [0, 4, 0], [0, 0, 8]],
mask=[[0, 0, 0], [0, 1, 0], [0, 0, 0]])
assert_equal(out, control)
def test_axis_methods_nomask(self):
# Test the combination nomask & methods w/ axis
a = array([[1, 2, 3], [4, 5, 6]])
assert_equal(a.sum(0), [5, 7, 9])
assert_equal(a.sum(-1), [6, 15])
assert_equal(a.sum(1), [6, 15])
assert_equal(a.prod(0), [4, 10, 18])
assert_equal(a.prod(-1), [6, 120])
assert_equal(a.prod(1), [6, 120])
assert_equal(a.min(0), [1, 2, 3])
assert_equal(a.min(-1), [1, 4])
assert_equal(a.min(1), [1, 4])
assert_equal(a.max(0), [4, 5, 6])
assert_equal(a.max(-1), [3, 6])
assert_equal(a.max(1), [3, 6])
class TestMaskedArrayMathMethodsComplex(TestCase):
# Test class for miscellaneous MaskedArrays methods.
def setUp(self):
# Base data definition.
x = np.array([8.375j, 7.545j, 8.828j, 8.5j, 1.757j, 5.928,
8.43, 7.78, 9.865, 5.878, 8.979, 4.732,
3.012, 6.022, 5.095, 3.116, 5.238, 3.957,
6.04, 9.63, 7.712, 3.382, 4.489, 6.479j,
7.189j, 9.645, 5.395, 4.961, 9.894, 2.893,
7.357, 9.828, 6.272, 3.758, 6.693, 0.993j])
X = x.reshape(6, 6)
XX = x.reshape(3, 2, 2, 3)
m = np.array([0, 1, 0, 1, 0, 0,
1, 0, 1, 1, 0, 1,
0, 0, 0, 1, 0, 1,
0, 0, 0, 1, 1, 1,
1, 0, 0, 1, 0, 0,
0, 0, 1, 0, 1, 0])
mx = array(data=x, mask=m)
mX = array(data=X, mask=m.reshape(X.shape))
mXX = array(data=XX, mask=m.reshape(XX.shape))
m2 = np.array([1, 1, 0, 1, 0, 0,
1, 1, 1, 1, 0, 1,
0, 0, 1, 1, 0, 1,
0, 0, 0, 1, 1, 1,
1, 0, 0, 1, 1, 0,
0, 0, 1, 0, 1, 1])
m2x = array(data=x, mask=m2)
m2X = array(data=X, mask=m2.reshape(X.shape))
m2XX = array(data=XX, mask=m2.reshape(XX.shape))
self.d = (x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX)
def test_varstd(self):
# Tests var & std on MaskedArrays.
(x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX) = self.d
assert_almost_equal(mX.var(axis=None), mX.compressed().var())
assert_almost_equal(mX.std(axis=None), mX.compressed().std())
assert_equal(mXX.var(axis=3).shape, XX.var(axis=3).shape)
assert_equal(mX.var().shape, X.var().shape)
(mXvar0, mXvar1) = (mX.var(axis=0), mX.var(axis=1))
assert_almost_equal(mX.var(axis=None, ddof=2),
mX.compressed().var(ddof=2))
assert_almost_equal(mX.std(axis=None, ddof=2),
mX.compressed().std(ddof=2))
for k in range(6):
assert_almost_equal(mXvar1[k], mX[k].compressed().var())
assert_almost_equal(mXvar0[k], mX[:, k].compressed().var())
assert_almost_equal(np.sqrt(mXvar0[k]),
mX[:, k].compressed().std())
class TestMaskedArrayFunctions(TestCase):
# Test class for miscellaneous functions.
def setUp(self):
x = np.array([1., 1., 1., -2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.])
y = np.array([5., 0., 3., 2., -1., -4., 0., -10., 10., 1., 0., 3.])
m1 = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
m2 = [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1]
xm = masked_array(x, mask=m1)
ym = masked_array(y, mask=m2)
xm.set_fill_value(1e+20)
self.info = (xm, ym)
def test_masked_where_bool(self):
x = [1, 2]
y = masked_where(False, x)
assert_equal(y, [1, 2])
assert_equal(y[1], 2)
def test_masked_equal_wlist(self):
x = [1, 2, 3]
mx = masked_equal(x, 3)
assert_equal(mx, x)
assert_equal(mx._mask, [0, 0, 1])
mx = masked_not_equal(x, 3)
assert_equal(mx, x)
assert_equal(mx._mask, [1, 1, 0])
def test_masked_equal_fill_value(self):
x = [1, 2, 3]
mx = masked_equal(x, 3)
assert_equal(mx._mask, [0, 0, 1])
assert_equal(mx.fill_value, 3)
def test_masked_where_condition(self):
# Tests masking functions.
x = array([1., 2., 3., 4., 5.])
x[2] = masked
assert_equal(masked_where(greater(x, 2), x), masked_greater(x, 2))
assert_equal(masked_where(greater_equal(x, 2), x),
masked_greater_equal(x, 2))
assert_equal(masked_where(less(x, 2), x), masked_less(x, 2))
assert_equal(masked_where(less_equal(x, 2), x),
masked_less_equal(x, 2))
assert_equal(masked_where(not_equal(x, 2), x), masked_not_equal(x, 2))
assert_equal(masked_where(equal(x, 2), x), masked_equal(x, 2))
assert_equal(masked_where(not_equal(x, 2), x), masked_not_equal(x, 2))
assert_equal(masked_where([1, 1, 0, 0, 0], [1, 2, 3, 4, 5]),
[99, 99, 3, 4, 5])
def test_masked_where_oddities(self):
# Tests some generic features.
atest = ones((10, 10, 10), dtype=float)
btest = zeros(atest.shape, MaskType)
ctest = masked_where(btest, atest)
assert_equal(atest, ctest)
def test_masked_where_shape_constraint(self):
a = arange(10)
try:
test = masked_equal(1, a)
except IndexError:
pass
else:
raise AssertionError("Should have failed...")
test = masked_equal(a, 1)
assert_equal(test.mask, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
def test_masked_where_structured(self):
# test that masked_where on a structured array sets a structured
# mask (see issue #2972)
a = np.zeros(10, dtype=[("A", "<f2"), ("B", "<f4")])
am = np.ma.masked_where(a["A"] < 5, a)
assert_equal(am.mask.dtype.names, am.dtype.names)
assert_equal(am["A"],
np.ma.masked_array(np.zeros(10), np.ones(10)))
def test_masked_otherfunctions(self):
assert_equal(masked_inside(list(range(5)), 1, 3),
[0, 199, 199, 199, 4])
assert_equal(masked_outside(list(range(5)), 1, 3), [199, 1, 2, 3, 199])
assert_equal(masked_inside(array(list(range(5)),
mask=[1, 0, 0, 0, 0]), 1, 3).mask,
[1, 1, 1, 1, 0])
assert_equal(masked_outside(array(list(range(5)),
mask=[0, 1, 0, 0, 0]), 1, 3).mask,
[1, 1, 0, 0, 1])
assert_equal(masked_equal(array(list(range(5)),
mask=[1, 0, 0, 0, 0]), 2).mask,
[1, 0, 1, 0, 0])
assert_equal(masked_not_equal(array([2, 2, 1, 2, 1],
mask=[1, 0, 0, 0, 0]), 2).mask,
[1, 0, 1, 0, 1])
def test_round(self):
a = array([1.23456, 2.34567, 3.45678, 4.56789, 5.67890],
mask=[0, 1, 0, 0, 0])
assert_equal(a.round(), [1., 2., 3., 5., 6.])
assert_equal(a.round(1), [1.2, 2.3, 3.5, 4.6, 5.7])
assert_equal(a.round(3), [1.235, 2.346, 3.457, 4.568, 5.679])
b = empty_like(a)
a.round(out=b)
assert_equal(b, [1., 2., 3., 5., 6.])
x = array([1., 2., 3., 4., 5.])
c = array([1, 1, 1, 0, 0])
x[2] = masked
z = where(c, x, -x)
assert_equal(z, [1., 2., 0., -4., -5])
c[0] = masked
z = where(c, x, -x)
assert_equal(z, [1., 2., 0., -4., -5])
assert_(z[0] is masked)
assert_(z[1] is not masked)
assert_(z[2] is masked)
def test_round_with_output(self):
# Testing round with an explicit output
xm = array(np.random.uniform(0, 10, 12)).reshape(3, 4)
xm[:, 0] = xm[0] = xm[-1, -1] = masked
# A ndarray as explicit input
output = np.empty((3, 4), dtype=float)
output.fill(-9999)
result = np.round(xm, decimals=2, out=output)
# ... the result should be the given output
self.assertTrue(result is output)
assert_equal(result, xm.round(decimals=2, out=output))
output = empty((3, 4), dtype=float)
result = xm.round(decimals=2, out=output)
self.assertTrue(result is output)
def test_round_with_scalar(self):
# Testing round with scalar/zero dimension input
# GH issue 2244
a = array(1.1, mask=[False])
assert_equal(a.round(), 1)
a = array(1.1, mask=[True])
assert_(a.round() is masked)
a = array(1.1, mask=[False])
output = np.empty(1, dtype=float)
output.fill(-9999)
a.round(out=output)
assert_equal(output, 1)
a = array(1.1, mask=[False])
output = array(-9999., mask=[True])
a.round(out=output)
assert_equal(output[()], 1)
a = array(1.1, mask=[True])
output = array(-9999., mask=[False])
a.round(out=output)
assert_(output[()] is masked)
def test_identity(self):
a = identity(5)
self.assertTrue(isinstance(a, MaskedArray))
assert_equal(a, np.identity(5))
def test_power(self):
x = -1.1
assert_almost_equal(power(x, 2.), 1.21)
self.assertTrue(power(x, masked) is masked)
x = array([-1.1, -1.1, 1.1, 1.1, 0.])
b = array([0.5, 2., 0.5, 2., -1.], mask=[0, 0, 0, 0, 1])
y = power(x, b)
assert_almost_equal(y, [0, 1.21, 1.04880884817, 1.21, 0.])
assert_equal(y._mask, [1, 0, 0, 0, 1])
b.mask = nomask
y = power(x, b)
assert_equal(y._mask, [1, 0, 0, 0, 1])
z = x ** b
assert_equal(z._mask, y._mask)
assert_almost_equal(z, y)
assert_almost_equal(z._data, y._data)
x **= b
assert_equal(x._mask, y._mask)
assert_almost_equal(x, y)
assert_almost_equal(x._data, y._data)
def test_power_w_broadcasting(self):
# Test power w/ broadcasting
a2 = np.array([[1., 2., 3.], [4., 5., 6.]])
a2m = array(a2, mask=[[1, 0, 0], [0, 0, 1]])
b1 = np.array([2, 4, 3])
b2 = np.array([b1, b1])
b2m = array(b2, mask=[[0, 1, 0], [0, 1, 0]])
ctrl = array([[1 ** 2, 2 ** 4, 3 ** 3], [4 ** 2, 5 ** 4, 6 ** 3]],
mask=[[1, 1, 0], [0, 1, 1]])
# No broadcasting, base & exp w/ mask
test = a2m ** b2m
assert_equal(test, ctrl)
assert_equal(test.mask, ctrl.mask)
# No broadcasting, base w/ mask, exp w/o mask
test = a2m ** b2
assert_equal(test, ctrl)
assert_equal(test.mask, a2m.mask)
# No broadcasting, base w/o mask, exp w/ mask
test = a2 ** b2m
assert_equal(test, ctrl)
assert_equal(test.mask, b2m.mask)
ctrl = array([[2 ** 2, 4 ** 4, 3 ** 3], [2 ** 2, 4 ** 4, 3 ** 3]],
mask=[[0, 1, 0], [0, 1, 0]])
test = b1 ** b2m
assert_equal(test, ctrl)
assert_equal(test.mask, ctrl.mask)
test = b2m ** b1
assert_equal(test, ctrl)
assert_equal(test.mask, ctrl.mask)
def test_where(self):
# Test the where function
x = np.array([1., 1., 1., -2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.])
y = np.array([5., 0., 3., 2., -1., -4., 0., -10., 10., 1., 0., 3.])
m1 = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
m2 = [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1]
xm = masked_array(x, mask=m1)
ym = masked_array(y, mask=m2)
xm.set_fill_value(1e+20)
d = where(xm > 2, xm, -9)
assert_equal(d, [-9., -9., -9., -9., -9., 4.,
-9., -9., 10., -9., -9., 3.])
assert_equal(d._mask, xm._mask)
d = where(xm > 2, -9, ym)
assert_equal(d, [5., 0., 3., 2., -1., -9.,
-9., -10., -9., 1., 0., -9.])
assert_equal(d._mask, [1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0])
d = where(xm > 2, xm, masked)
assert_equal(d, [-9., -9., -9., -9., -9., 4.,
-9., -9., 10., -9., -9., 3.])
tmp = xm._mask.copy()
tmp[(xm <= 2).filled(True)] = True
assert_equal(d._mask, tmp)
ixm = xm.astype(int)
d = where(ixm > 2, ixm, masked)
assert_equal(d, [-9, -9, -9, -9, -9, 4, -9, -9, 10, -9, -9, 3])
assert_equal(d.dtype, ixm.dtype)
def test_where_object(self):
a = np.array(None)
b = masked_array(None)
r = b.copy()
assert_equal(np.ma.where(True, a, a), r)
assert_equal(np.ma.where(True, b, b), r)
def test_where_with_masked_choice(self):
x = arange(10)
x[3] = masked
c = x >= 8
# Set False to masked
z = where(c, x, masked)
assert_(z.dtype is x.dtype)
assert_(z[3] is masked)
assert_(z[4] is masked)
assert_(z[7] is masked)
assert_(z[8] is not masked)
assert_(z[9] is not masked)
assert_equal(x, z)
# Set True to masked
z = where(c, masked, x)
assert_(z.dtype is x.dtype)
assert_(z[3] is masked)
assert_(z[4] is not masked)
assert_(z[7] is not masked)
assert_(z[8] is masked)
assert_(z[9] is masked)
def test_where_with_masked_condition(self):
x = array([1., 2., 3., 4., 5.])
c = array([1, 1, 1, 0, 0])
x[2] = masked
z = where(c, x, -x)
assert_equal(z, [1., 2., 0., -4., -5])
c[0] = masked
z = where(c, x, -x)
assert_equal(z, [1., 2., 0., -4., -5])
assert_(z[0] is masked)
assert_(z[1] is not masked)
assert_(z[2] is masked)
x = arange(1, 6)
x[-1] = masked
y = arange(1, 6) * 10
y[2] = masked
c = array([1, 1, 1, 0, 0], mask=[1, 0, 0, 0, 0])
cm = c.filled(1)
z = where(c, x, y)
zm = where(cm, x, y)
assert_equal(z, zm)
assert_(getmask(zm) is nomask)
assert_equal(zm, [1, 2, 3, 40, 50])
z = where(c, masked, 1)
assert_equal(z, [99, 99, 99, 1, 1])
z = where(c, 1, masked)
assert_equal(z, [99, 1, 1, 99, 99])
def test_where_type(self):
# Test the type conservation with where
x = np.arange(4, dtype=np.int32)
y = np.arange(4, dtype=np.float32) * 2.2
test = where(x > 1.5, y, x).dtype
control = np.find_common_type([np.int32, np.float32], [])
assert_equal(test, control)
def test_choose(self):
# Test choose
choices = [[0, 1, 2, 3], [10, 11, 12, 13],
[20, 21, 22, 23], [30, 31, 32, 33]]
chosen = choose([2, 3, 1, 0], choices)
assert_equal(chosen, array([20, 31, 12, 3]))
chosen = choose([2, 4, 1, 0], choices, mode='clip')
assert_equal(chosen, array([20, 31, 12, 3]))
chosen = choose([2, 4, 1, 0], choices, mode='wrap')
assert_equal(chosen, array([20, 1, 12, 3]))
# Check with some masked indices
indices_ = array([2, 4, 1, 0], mask=[1, 0, 0, 1])
chosen = choose(indices_, choices, mode='wrap')
assert_equal(chosen, array([99, 1, 12, 99]))
assert_equal(chosen.mask, [1, 0, 0, 1])
# Check with some masked choices
choices = array(choices, mask=[[0, 0, 0, 1], [1, 1, 0, 1],
[1, 0, 0, 0], [0, 0, 0, 0]])
indices_ = [2, 3, 1, 0]
chosen = choose(indices_, choices, mode='wrap')
assert_equal(chosen, array([20, 31, 12, 3]))
assert_equal(chosen.mask, [1, 0, 0, 1])
def test_choose_with_out(self):
# Test choose with an explicit out keyword
choices = [[0, 1, 2, 3], [10, 11, 12, 13],
[20, 21, 22, 23], [30, 31, 32, 33]]
store = empty(4, dtype=int)
chosen = choose([2, 3, 1, 0], choices, out=store)
assert_equal(store, array([20, 31, 12, 3]))
self.assertTrue(store is chosen)
# Check with some masked indices + out
store = empty(4, dtype=int)
indices_ = array([2, 3, 1, 0], mask=[1, 0, 0, 1])
chosen = choose(indices_, choices, mode='wrap', out=store)
assert_equal(store, array([99, 31, 12, 99]))
assert_equal(store.mask, [1, 0, 0, 1])
# Check with some masked choices + out ina ndarray !
choices = array(choices, mask=[[0, 0, 0, 1], [1, 1, 0, 1],
[1, 0, 0, 0], [0, 0, 0, 0]])
indices_ = [2, 3, 1, 0]
store = empty(4, dtype=int).view(ndarray)
chosen = choose(indices_, choices, mode='wrap', out=store)
assert_equal(store, array([999999, 31, 12, 999999]))
def test_reshape(self):
a = arange(10)
a[0] = masked
# Try the default
b = a.reshape((5, 2))
assert_equal(b.shape, (5, 2))
self.assertTrue(b.flags['C'])
# Try w/ arguments as list instead of tuple
b = a.reshape(5, 2)
assert_equal(b.shape, (5, 2))
self.assertTrue(b.flags['C'])
# Try w/ order
b = a.reshape((5, 2), order='F')
assert_equal(b.shape, (5, 2))
self.assertTrue(b.flags['F'])
# Try w/ order
b = a.reshape(5, 2, order='F')
assert_equal(b.shape, (5, 2))
self.assertTrue(b.flags['F'])
c = np.reshape(a, (2, 5))
self.assertTrue(isinstance(c, MaskedArray))
assert_equal(c.shape, (2, 5))
self.assertTrue(c[0, 0] is masked)
self.assertTrue(c.flags['C'])
def test_make_mask_descr(self):
# Test make_mask_descr
# Flexible
ntype = [('a', np.float), ('b', np.float)]
test = make_mask_descr(ntype)
assert_equal(test, [('a', np.bool), ('b', np.bool)])
# Standard w/ shape
ntype = (np.float, 2)
test = make_mask_descr(ntype)
assert_equal(test, (np.bool, 2))
# Standard standard
ntype = np.float
test = make_mask_descr(ntype)
assert_equal(test, np.dtype(np.bool))
# Nested
ntype = [('a', np.float), ('b', [('ba', np.float), ('bb', np.float)])]
test = make_mask_descr(ntype)
control = np.dtype([('a', 'b1'), ('b', [('ba', 'b1'), ('bb', 'b1')])])
assert_equal(test, control)
# Named+ shape
ntype = [('a', (np.float, 2))]
test = make_mask_descr(ntype)
assert_equal(test, np.dtype([('a', (np.bool, 2))]))
# 2 names
ntype = [(('A', 'a'), float)]
test = make_mask_descr(ntype)
assert_equal(test, np.dtype([(('A', 'a'), bool)]))
def test_make_mask(self):
# Test make_mask
# w/ a list as an input
mask = [0, 1]
test = make_mask(mask)
assert_equal(test.dtype, MaskType)
assert_equal(test, [0, 1])
# w/ a ndarray as an input
mask = np.array([0, 1], dtype=np.bool)
test = make_mask(mask)
assert_equal(test.dtype, MaskType)
assert_equal(test, [0, 1])
# w/ a flexible-type ndarray as an input - use default
mdtype = [('a', np.bool), ('b', np.bool)]
mask = np.array([(0, 0), (0, 1)], dtype=mdtype)
test = make_mask(mask)
assert_equal(test.dtype, MaskType)
assert_equal(test, [1, 1])
# w/ a flexible-type ndarray as an input - use input dtype
mdtype = [('a', np.bool), ('b', np.bool)]
mask = np.array([(0, 0), (0, 1)], dtype=mdtype)
test = make_mask(mask, dtype=mask.dtype)
assert_equal(test.dtype, mdtype)
assert_equal(test, mask)
# w/ a flexible-type ndarray as an input - use input dtype
mdtype = [('a', np.float), ('b', np.float)]
bdtype = [('a', np.bool), ('b', np.bool)]
mask = np.array([(0, 0), (0, 1)], dtype=mdtype)
test = make_mask(mask, dtype=mask.dtype)
assert_equal(test.dtype, bdtype)
assert_equal(test, np.array([(0, 0), (0, 1)], dtype=bdtype))
# test that nomask is returned when m is nomask.
bools = [True, False]
dtypes = [MaskType, np.float]
msgformat = 'copy=%s, shrink=%s, dtype=%s'
for cpy, shr, dt in itertools.product(bools, bools, dtypes):
res = make_mask(nomask, copy=cpy, shrink=shr, dtype=dt)
assert_(res is nomask, msgformat % (cpy, shr, dt))
def test_mask_or(self):
# Initialize
mtype = [('a', np.bool), ('b', np.bool)]
mask = np.array([(0, 0), (0, 1), (1, 0), (0, 0)], dtype=mtype)
# Test using nomask as input
test = mask_or(mask, nomask)
assert_equal(test, mask)
test = mask_or(nomask, mask)
assert_equal(test, mask)
# Using False as input
test = mask_or(mask, False)
assert_equal(test, mask)
# Using another array w / the same dtype
other = np.array([(0, 1), (0, 1), (0, 1), (0, 1)], dtype=mtype)
test = mask_or(mask, other)
control = np.array([(0, 1), (0, 1), (1, 1), (0, 1)], dtype=mtype)
assert_equal(test, control)
# Using another array w / a different dtype
othertype = [('A', np.bool), ('B', np.bool)]
other = np.array([(0, 1), (0, 1), (0, 1), (0, 1)], dtype=othertype)
try:
test = mask_or(mask, other)
except ValueError:
pass
# Using nested arrays
dtype = [('a', np.bool), ('b', [('ba', np.bool), ('bb', np.bool)])]
amask = np.array([(0, (1, 0)), (0, (1, 0))], dtype=dtype)
bmask = np.array([(1, (0, 1)), (0, (0, 0))], dtype=dtype)
cntrl = np.array([(1, (1, 1)), (0, (1, 0))], dtype=dtype)
assert_equal(mask_or(amask, bmask), cntrl)
def test_flatten_mask(self):
# Tests flatten mask
# Standard dtype
mask = np.array([0, 0, 1], dtype=np.bool)
assert_equal(flatten_mask(mask), mask)
# Flexible dtype
mask = np.array([(0, 0), (0, 1)], dtype=[('a', bool), ('b', bool)])
test = flatten_mask(mask)
control = np.array([0, 0, 0, 1], dtype=bool)
assert_equal(test, control)
mdtype = [('a', bool), ('b', [('ba', bool), ('bb', bool)])]
data = [(0, (0, 0)), (0, (0, 1))]
mask = np.array(data, dtype=mdtype)
test = flatten_mask(mask)
control = np.array([0, 0, 0, 0, 0, 1], dtype=bool)
assert_equal(test, control)
def test_on_ndarray(self):
# Test functions on ndarrays
a = np.array([1, 2, 3, 4])
m = array(a, mask=False)
test = anom(a)
assert_equal(test, m.anom())
test = reshape(a, (2, 2))
assert_equal(test, m.reshape(2, 2))
def test_compress(self):
# Test compress function on ndarray and masked array
# Address Github #2495.
arr = np.arange(8)
arr.shape = 4, 2
cond = np.array([True, False, True, True])
control = arr[[0, 2, 3]]
test = np.ma.compress(cond, arr, axis=0)
assert_equal(test, control)
marr = np.ma.array(arr)
test = np.ma.compress(cond, marr, axis=0)
assert_equal(test, control)
def test_compressed(self):
# Test ma.compressed function.
# Address gh-4026
a = np.ma.array([1, 2])
test = np.ma.compressed(a)
assert_(type(test) is np.ndarray)
# Test case when input data is ndarray subclass
class A(np.ndarray):
pass
a = np.ma.array(A(shape=0))
test = np.ma.compressed(a)
assert_(type(test) is A)
# Test that compress flattens
test = np.ma.compressed([[1],[2]])
assert_equal(test.ndim, 1)
test = np.ma.compressed([[[[[1]]]]])
assert_equal(test.ndim, 1)
# Test case when input is MaskedArray subclass
class M(MaskedArray):
pass
test = np.ma.compressed(M(shape=(0,1,2)))
assert_equal(test.ndim, 1)
# with .compressed() overridden
class M(MaskedArray):
def compressed(self):
return 42
test = np.ma.compressed(M(shape=(0,1,2)))
assert_equal(test, 42)
class TestMaskedFields(TestCase):
def setUp(self):
ilist = [1, 2, 3, 4, 5]
flist = [1.1, 2.2, 3.3, 4.4, 5.5]
slist = ['one', 'two', 'three', 'four', 'five']
ddtype = [('a', int), ('b', float), ('c', '|S8')]
mdtype = [('a', bool), ('b', bool), ('c', bool)]
mask = [0, 1, 0, 0, 1]
base = array(list(zip(ilist, flist, slist)), mask=mask, dtype=ddtype)
self.data = dict(base=base, mask=mask, ddtype=ddtype, mdtype=mdtype)
def test_set_records_masks(self):
base = self.data['base']
mdtype = self.data['mdtype']
# Set w/ nomask or masked
base.mask = nomask
assert_equal_records(base._mask, np.zeros(base.shape, dtype=mdtype))
base.mask = masked
assert_equal_records(base._mask, np.ones(base.shape, dtype=mdtype))
# Set w/ simple boolean
base.mask = False
assert_equal_records(base._mask, np.zeros(base.shape, dtype=mdtype))
base.mask = True
assert_equal_records(base._mask, np.ones(base.shape, dtype=mdtype))
# Set w/ list
base.mask = [0, 0, 0, 1, 1]
assert_equal_records(base._mask,
np.array([(x, x, x) for x in [0, 0, 0, 1, 1]],
dtype=mdtype))
def test_set_record_element(self):
# Check setting an element of a record)
base = self.data['base']
(base_a, base_b, base_c) = (base['a'], base['b'], base['c'])
base[0] = (pi, pi, 'pi')
assert_equal(base_a.dtype, int)
assert_equal(base_a._data, [3, 2, 3, 4, 5])
assert_equal(base_b.dtype, float)
assert_equal(base_b._data, [pi, 2.2, 3.3, 4.4, 5.5])
assert_equal(base_c.dtype, '|S8')
assert_equal(base_c._data,
asbytes_nested(['pi', 'two', 'three', 'four', 'five']))
def test_set_record_slice(self):
base = self.data['base']
(base_a, base_b, base_c) = (base['a'], base['b'], base['c'])
base[:3] = (pi, pi, 'pi')
assert_equal(base_a.dtype, int)
assert_equal(base_a._data, [3, 3, 3, 4, 5])
assert_equal(base_b.dtype, float)
assert_equal(base_b._data, [pi, pi, pi, 4.4, 5.5])
assert_equal(base_c.dtype, '|S8')
assert_equal(base_c._data,
asbytes_nested(['pi', 'pi', 'pi', 'four', 'five']))
def test_mask_element(self):
"Check record access"
base = self.data['base']
base[0] = masked
for n in ('a', 'b', 'c'):
assert_equal(base[n].mask, [1, 1, 0, 0, 1])
assert_equal(base[n]._data, base._data[n])
def test_getmaskarray(self):
# Test getmaskarray on flexible dtype
ndtype = [('a', int), ('b', float)]
test = empty(3, dtype=ndtype)
assert_equal(getmaskarray(test),
np.array([(0, 0), (0, 0), (0, 0)],
dtype=[('a', '|b1'), ('b', '|b1')]))
test[:] = masked
assert_equal(getmaskarray(test),
np.array([(1, 1), (1, 1), (1, 1)],
dtype=[('a', '|b1'), ('b', '|b1')]))
def test_view(self):
# Test view w/ flexible dtype
iterator = list(zip(np.arange(10), np.random.rand(10)))
data = np.array(iterator)
a = array(iterator, dtype=[('a', float), ('b', float)])
a.mask[0] = (1, 0)
controlmask = np.array([1] + 19 * [0], dtype=bool)
# Transform globally to simple dtype
test = a.view(float)
assert_equal(test, data.ravel())
assert_equal(test.mask, controlmask)
# Transform globally to dty
test = a.view((float, 2))
assert_equal(test, data)
assert_equal(test.mask, controlmask.reshape(-1, 2))
test = a.view((float, 2), np.matrix)
assert_equal(test, data)
self.assertTrue(isinstance(test, np.matrix))
def test_getitem(self):
ndtype = [('a', float), ('b', float)]
a = array(list(zip(np.random.rand(10), np.arange(10))), dtype=ndtype)
a.mask = np.array(list(zip([0, 0, 0, 0, 0, 0, 0, 0, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 1, 0])),
dtype=[('a', bool), ('b', bool)])
# No mask
self.assertTrue(isinstance(a[1], MaskedArray))
# One element masked
self.assertTrue(isinstance(a[0], MaskedArray))
assert_equal_records(a[0]._data, a._data[0])
assert_equal_records(a[0]._mask, a._mask[0])
# All element masked
self.assertTrue(isinstance(a[-2], MaskedArray))
assert_equal_records(a[-2]._data, a._data[-2])
assert_equal_records(a[-2]._mask, a._mask[-2])
def test_setitem(self):
# Issue 4866: check that one can set individual items in [record][col]
# and [col][record] order
ndtype = np.dtype([('a', float), ('b', int)])
ma = np.ma.MaskedArray([(1.0, 1), (2.0, 2)], dtype=ndtype)
ma['a'][1] = 3.0
assert_equal(ma['a'], np.array([1.0, 3.0]))
ma[1]['a'] = 4.0
assert_equal(ma['a'], np.array([1.0, 4.0]))
# Issue 2403
mdtype = np.dtype([('a', bool), ('b', bool)])
# soft mask
control = np.array([(False, True), (True, True)], dtype=mdtype)
a = np.ma.masked_all((2,), dtype=ndtype)
a['a'][0] = 2
assert_equal(a.mask, control)
a = np.ma.masked_all((2,), dtype=ndtype)
a[0]['a'] = 2
assert_equal(a.mask, control)
# hard mask
control = np.array([(True, True), (True, True)], dtype=mdtype)
a = np.ma.masked_all((2,), dtype=ndtype)
a.harden_mask()
a['a'][0] = 2
assert_equal(a.mask, control)
a = np.ma.masked_all((2,), dtype=ndtype)
a.harden_mask()
a[0]['a'] = 2
assert_equal(a.mask, control)
def test_element_len(self):
# check that len() works for mvoid (Github issue #576)
for rec in self.data['base']:
assert_equal(len(rec), len(self.data['ddtype']))
class TestMaskedView(TestCase):
def setUp(self):
iterator = list(zip(np.arange(10), np.random.rand(10)))
data = np.array(iterator)
a = array(iterator, dtype=[('a', float), ('b', float)])
a.mask[0] = (1, 0)
controlmask = np.array([1] + 19 * [0], dtype=bool)
self.data = (data, a, controlmask)
def test_view_to_nothing(self):
(data, a, controlmask) = self.data
test = a.view()
self.assertTrue(isinstance(test, MaskedArray))
assert_equal(test._data, a._data)
assert_equal(test._mask, a._mask)
def test_view_to_type(self):
(data, a, controlmask) = self.data
test = a.view(np.ndarray)
self.assertTrue(not isinstance(test, MaskedArray))
assert_equal(test, a._data)
assert_equal_records(test, data.view(a.dtype).squeeze())
def test_view_to_simple_dtype(self):
(data, a, controlmask) = self.data
# View globally
test = a.view(float)
self.assertTrue(isinstance(test, MaskedArray))
assert_equal(test, data.ravel())
assert_equal(test.mask, controlmask)
def test_view_to_flexible_dtype(self):
(data, a, controlmask) = self.data
test = a.view([('A', float), ('B', float)])
assert_equal(test.mask.dtype.names, ('A', 'B'))
assert_equal(test['A'], a['a'])
assert_equal(test['B'], a['b'])
test = a[0].view([('A', float), ('B', float)])
self.assertTrue(isinstance(test, MaskedArray))
assert_equal(test.mask.dtype.names, ('A', 'B'))
assert_equal(test['A'], a['a'][0])
assert_equal(test['B'], a['b'][0])
test = a[-1].view([('A', float), ('B', float)])
self.assertTrue(isinstance(test, MaskedArray))
assert_equal(test.dtype.names, ('A', 'B'))
assert_equal(test['A'], a['a'][-1])
assert_equal(test['B'], a['b'][-1])
def test_view_to_subdtype(self):
(data, a, controlmask) = self.data
# View globally
test = a.view((float, 2))
self.assertTrue(isinstance(test, MaskedArray))
assert_equal(test, data)
assert_equal(test.mask, controlmask.reshape(-1, 2))
# View on 1 masked element
test = a[0].view((float, 2))
self.assertTrue(isinstance(test, MaskedArray))
assert_equal(test, data[0])
assert_equal(test.mask, (1, 0))
# View on 1 unmasked element
test = a[-1].view((float, 2))
self.assertTrue(isinstance(test, MaskedArray))
assert_equal(test, data[-1])
def test_view_to_dtype_and_type(self):
(data, a, controlmask) = self.data
test = a.view((float, 2), np.matrix)
assert_equal(test, data)
self.assertTrue(isinstance(test, np.matrix))
self.assertTrue(not isinstance(test, MaskedArray))
class TestOptionalArgs(TestCase):
def test_ndarrayfuncs(self):
# test axis arg behaves the same as ndarray (including mutliple axes)
d = np.arange(24.0).reshape((2,3,4))
m = np.zeros(24, dtype=bool).reshape((2,3,4))
# mask out last element of last dimension
m[:,:,-1] = True
a = np.ma.array(d, mask=m)
def testaxis(f, a, d):
numpy_f = numpy.__getattribute__(f)
ma_f = np.ma.__getattribute__(f)
# test axis arg
assert_equal(ma_f(a, axis=1)[...,:-1], numpy_f(d[...,:-1], axis=1))
assert_equal(ma_f(a, axis=(0,1))[...,:-1],
numpy_f(d[...,:-1], axis=(0,1)))
def testkeepdims(f, a, d):
numpy_f = numpy.__getattribute__(f)
ma_f = np.ma.__getattribute__(f)
# test keepdims arg
assert_equal(ma_f(a, keepdims=True).shape,
numpy_f(d, keepdims=True).shape)
assert_equal(ma_f(a, keepdims=False).shape,
numpy_f(d, keepdims=False).shape)
# test both at once
assert_equal(ma_f(a, axis=1, keepdims=True)[...,:-1],
numpy_f(d[...,:-1], axis=1, keepdims=True))
assert_equal(ma_f(a, axis=(0,1), keepdims=True)[...,:-1],
numpy_f(d[...,:-1], axis=(0,1), keepdims=True))
for f in ['sum', 'prod', 'mean', 'var', 'std']:
testaxis(f, a, d)
testkeepdims(f, a, d)
for f in ['min', 'max']:
testaxis(f, a, d)
d = (np.arange(24).reshape((2,3,4))%2 == 0)
a = np.ma.array(d, mask=m)
for f in ['all', 'any']:
testaxis(f, a, d)
testkeepdims(f, a, d)
def test_count(self):
# test np.ma.count specially
d = np.arange(24.0).reshape((2,3,4))
m = np.zeros(24, dtype=bool).reshape((2,3,4))
m[:,0,:] = True
a = np.ma.array(d, mask=m)
assert_equal(count(a), 16)
assert_equal(count(a, axis=1), 2*ones((2,4)))
assert_equal(count(a, axis=(0,1)), 4*ones((4,)))
assert_equal(count(a, keepdims=True), 16*ones((1,1,1)))
assert_equal(count(a, axis=1, keepdims=True), 2*ones((2,1,4)))
assert_equal(count(a, axis=(0,1), keepdims=True), 4*ones((1,1,4)))
assert_equal(count(a, axis=-2), 2*ones((2,4)))
assert_raises(ValueError, count, a, axis=(1,1))
assert_raises(ValueError, count, a, axis=3)
# check the 'nomask' path
a = np.ma.array(d, mask=nomask)
assert_equal(count(a), 24)
assert_equal(count(a, axis=1), 3*ones((2,4)))
assert_equal(count(a, axis=(0,1)), 6*ones((4,)))
assert_equal(count(a, keepdims=True), 24*ones((1,1,1)))
assert_equal(count(a, axis=1, keepdims=True), 3*ones((2,1,4)))
assert_equal(count(a, axis=(0,1), keepdims=True), 6*ones((1,1,4)))
assert_equal(count(a, axis=-2), 3*ones((2,4)))
assert_raises(ValueError, count, a, axis=(1,1))
assert_raises(ValueError, count, a, axis=3)
# check the 'masked' singleton
assert_equal(count(np.ma.masked), 0)
# check 0-d arrays do not allow axis > 0
assert_raises(ValueError, count, np.ma.array(1), axis=1)
def test_masked_array():
a = np.ma.array([0, 1, 2, 3], mask=[0, 0, 1, 0])
assert_equal(np.argwhere(a), [[1], [3]])
def test_append_masked_array():
a = np.ma.masked_equal([1,2,3], value=2)
b = np.ma.masked_equal([4,3,2], value=2)
result = np.ma.append(a, b)
expected_data = [1, 2, 3, 4, 3, 2]
expected_mask = [False, True, False, False, False, True]
assert_array_equal(result.data, expected_data)
assert_array_equal(result.mask, expected_mask)
a = np.ma.masked_all((2,2))
b = np.ma.ones((3,1))
result = np.ma.append(a, b)
expected_data = [1] * 3
expected_mask = [True] * 4 + [False] * 3
assert_array_equal(result.data[-3], expected_data)
assert_array_equal(result.mask, expected_mask)
result = np.ma.append(a, b, axis=None)
assert_array_equal(result.data[-3], expected_data)
assert_array_equal(result.mask, expected_mask)
def test_append_masked_array_along_axis():
a = np.ma.masked_equal([1,2,3], value=2)
b = np.ma.masked_values([[4, 5, 6], [7, 8, 9]], 7)
# When `axis` is specified, `values` must have the correct shape.
assert_raises(ValueError, np.ma.append, a, b, axis=0)
result = np.ma.append(a[np.newaxis,:], b, axis=0)
expected = np.ma.arange(1, 10)
expected[[1, 6]] = np.ma.masked
expected = expected.reshape((3,3))
assert_array_equal(result.data, expected.data)
assert_array_equal(result.mask, expected.mask)
def test_default_fill_value_complex():
# regression test for Python 3, where 'unicode' was not defined
assert_(default_fill_value(1 + 1j) == 1.e20 + 0.0j)
###############################################################################
if __name__ == "__main__":
run_module_suite()
|
[
"numpy.ma.core.make_mask",
"numpy.ma.core.fix_invalid",
"numpy.arctan2",
"numpy.sum",
"numpy.ravel",
"numpy.ma.core.make_mask_descr",
"numpy.ma.core.empty_like",
"numpy.ma.core.greater_equal",
"numpy.ma.testutils.assert_equal_records",
"numpy.ones",
"numpy.argsort",
"numpy.arange",
"numpy.exp",
"numpy.ma.core.sometrue",
"numpy.ma.core.masked_greater",
"numpy.diag",
"numpy.conjugate",
"numpy.maximum.reduce",
"numpy.ma.core.reshape",
"numpy.may_share_memory",
"numpy.ma.core.empty",
"numpy.ma.__getattribute__",
"numpy.add.reduce",
"numpy.ma.core.masked_less_equal",
"numpy.identity",
"numpy.maximum.outer",
"warnings.catch_warnings",
"numpy.ma.core.arctan2",
"numpy.add.accumulate",
"numpy.ma.core.allclose",
"datetime.datetime.now",
"numpy.ma.core.MaskedArray.cumsum",
"numpy.less_equal",
"numpy.minimum",
"numpy.ma.core.less",
"numpy.ma.core.shape",
"numpy.ma.core.max",
"numpy.ma.core.less_equal",
"numpy.cosh",
"numpy.ma.core.divide",
"numpy.greater_equal",
"numpy.ma.core.count",
"numpy.ma.masked_values",
"numpy.ma.masked_all",
"numpy.ma.core.log",
"numpy.ma.core.identity",
"numpy.ma.core.tan",
"numpy.ma.core.flatten_structured_array",
"numpy.ma.core.ravel",
"numpy.ma.append",
"numpy.ma.array",
"numpy.ma.core.minimum_fill_value",
"numpy.ma.core.equal",
"numpy.array",
"numpy.ma.core.transpose",
"numpy.ma.core.abs",
"functools.reduce",
"numpy.ma.core.filled",
"numpy.sinh",
"numpy.minimum.outer",
"numpy.ma.core.minimum.outer",
"numpy.ma.core.allequal",
"numpy.ma.core.arctan",
"numpy.trace",
"numpy.ma.core.array",
"numpy.ma.core.sin",
"numpy.geterr",
"numpy.angle",
"numpy.ma.where",
"numpy.greater",
"numpy.isnan",
"numpy.ma.core.tanh",
"numpy.ma.core.anom",
"numpy.ma.testutils.fail_if_equal",
"numpy.transpose",
"itertools.product",
"numpy.arccos",
"numpy.ma.testutils.assert_",
"numpy.ma.testutils.assert_equal",
"copy.deepcopy",
"numpy.ma.core.outer",
"numpy.ma.compress",
"numpy.ma.core.exp",
"numpy.divide",
"numpy.ma.core.masked_equal",
"numpy.ma.arange",
"numpy.mod",
"numpy.not_equal",
"numpy.ma.core.maximum_fill_value",
"numpy.argwhere",
"numpy.ma.core.argsort",
"numpy.ma.core.mask_or",
"numpy.all",
"numpy.matrix",
"numpy.ma.masked_equal",
"numpy.dtype",
"numpy.ma.core.not_equal",
"numpy.find_common_type",
"numpy.ma.core.repeat",
"numpy.ma.core.MaskedArray",
"numpy.eye",
"numpy.ma.core.multiply.outer",
"numpy.ma.core.inner",
"numpy.ma.compressed",
"numpy.ma.core.arccos",
"numpy.maximum",
"numpy.ma.core.masked_less",
"numpy.ma.core.resize",
"numpy.empty",
"numpy.ma.core.sum",
"numpy.iinfo",
"numpy.shape",
"numpy.product",
"numpy.sin",
"numpy.ma.testutils.assert_mask_equal",
"numpy.ma.core.isMaskedArray",
"numpy.ndarray",
"numpy.ma.core.choose",
"numpy.ma.core.diag",
"warnings.simplefilter",
"numpy.ma.MaskedArray",
"numpy.equal",
"numpy.finfo",
"numpy.ma.core.sort",
"numpy.tan",
"numpy.ma.core.min",
"numpy.ma.core.mvoid",
"numpy.ma.core.masked_not_equal",
"numpy.ma.core.default_fill_value",
"numpy.ma.core.power",
"pickle.dumps",
"numpy.compat.asbytes",
"numpy.ma.core.cos",
"numpy.testing.assert_raises",
"numpy.ma.core.masked_print_option.set_display",
"numpy.ma.core.add.accumulate",
"numpy.ma.core.sinh",
"numpy.ma.core.sqrt",
"numpy.ma.core.masked_where",
"numpy.random.uniform",
"numpy.ma.core.cosh",
"numpy.log",
"numpy.ma.testutils.assert_almost_equal",
"numpy.ma.core.maximum",
"numpy.zeros",
"numpy.errstate",
"numpy.ma.core.conjugate",
"numpy.ma.core.where",
"numpy.ma.core.take",
"numpy.ma.core.putmask",
"numpy.compat.asbytes_nested",
"numpy.ma.core.getmask",
"numpy.ma.core.add",
"numpy.ma.core.greater",
"numpy.ma.core.arcsin",
"numpy.ma.core.mod",
"numpy.absolute",
"numpy.ma.core.add.reduce",
"numpy.ma.core.subtract",
"numpy.round",
"numpy.multiply",
"numpy.ma.testutils.assert_array_equal",
"numpy.testing.run_module_suite",
"numpy.ma.core.arccosh",
"numpy.ma.testutils.assert_not_equal",
"numpy.ma.core.getmaskarray",
"numpy.arcsin",
"numpy.ma.core.maximum.outer",
"numpy.ma.core.zeros",
"numpy.reshape",
"numpy.ma.core.log10",
"numpy.less",
"numpy.add",
"numpy.tanh",
"numpy.ma.masked_where",
"numpy.ma.core.masked_values",
"numpy.ma.core.put",
"numpy.asarray",
"numpy.ma.core.masked_array",
"numpy.ma.core.alltrue",
"numpy.ma.core.ones",
"numpy.sort",
"numpy.ma.core.angle",
"numpy.ma.core.asarray",
"numpy.cos",
"numpy.arctan",
"numpy.ma.core.concatenate",
"numpy.concatenate",
"numpy.ma.core.masked_greater_equal",
"numpy.ma.core.minimum",
"numpy.ma.core.product",
"numpy.ma.core.absolute",
"warnings.filterwarnings",
"numpy.seterr",
"numpy.subtract",
"numpy.ma.core.multiply",
"numpy.where",
"numpy.ma.ones",
"numpy.ma.core.flatten_mask",
"numpy.take",
"numpy.random.rand",
"numpy.ma.core.arange",
"numpy.sqrt"
] |
[((166569, 166613), 'numpy.ma.array', 'np.ma.array', (['[0, 1, 2, 3]'], {'mask': '[0, 0, 1, 0]'}), '([0, 1, 2, 3], mask=[0, 0, 1, 0])\n', (166580, 166613), True, 'import numpy as np\n'), ((166700, 166738), 'numpy.ma.masked_equal', 'np.ma.masked_equal', (['[1, 2, 3]'], {'value': '(2)'}), '([1, 2, 3], value=2)\n', (166718, 166738), True, 'import numpy as np\n'), ((166745, 166783), 'numpy.ma.masked_equal', 'np.ma.masked_equal', (['[4, 3, 2]'], {'value': '(2)'}), '([4, 3, 2], value=2)\n', (166763, 166783), True, 'import numpy as np\n'), ((166796, 166814), 'numpy.ma.append', 'np.ma.append', (['a', 'b'], {}), '(a, b)\n', (166808, 166814), True, 'import numpy as np\n'), ((166919, 166965), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['result.data', 'expected_data'], {}), '(result.data, expected_data)\n', (166937, 166965), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((166970, 167016), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['result.mask', 'expected_mask'], {}), '(result.mask, expected_mask)\n', (166988, 167016), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((167026, 167050), 'numpy.ma.masked_all', 'np.ma.masked_all', (['(2, 2)'], {}), '((2, 2))\n', (167042, 167050), True, 'import numpy as np\n'), ((167058, 167076), 'numpy.ma.ones', 'np.ma.ones', (['(3, 1)'], {}), '((3, 1))\n', (167068, 167076), True, 'import numpy as np\n'), ((167090, 167108), 'numpy.ma.append', 'np.ma.append', (['a', 'b'], {}), '(a, b)\n', (167102, 167108), True, 'import numpy as np\n'), ((167186, 167236), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['result.data[-3]', 'expected_data'], {}), '(result.data[-3], expected_data)\n', (167204, 167236), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((167241, 167287), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['result.mask', 'expected_mask'], {}), '(result.mask, expected_mask)\n', (167259, 167287), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((167302, 167331), 'numpy.ma.append', 'np.ma.append', (['a', 'b'], {'axis': 'None'}), '(a, b, axis=None)\n', (167314, 167331), True, 'import numpy as np\n'), ((167336, 167386), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['result.data[-3]', 'expected_data'], {}), '(result.data[-3], expected_data)\n', (167354, 167386), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((167391, 167437), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['result.mask', 'expected_mask'], {}), '(result.mask, expected_mask)\n', (167409, 167437), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((167491, 167529), 'numpy.ma.masked_equal', 'np.ma.masked_equal', (['[1, 2, 3]'], {'value': '(2)'}), '([1, 2, 3], value=2)\n', (167509, 167529), True, 'import numpy as np\n'), ((167536, 167582), 'numpy.ma.masked_values', 'np.ma.masked_values', (['[[4, 5, 6], [7, 8, 9]]', '(7)'], {}), '([[4, 5, 6], [7, 8, 9]], 7)\n', (167555, 167582), True, 'import numpy as np\n'), ((167658, 167711), 'numpy.testing.assert_raises', 'assert_raises', (['ValueError', 'np.ma.append', 'a', 'b'], {'axis': '(0)'}), '(ValueError, np.ma.append, a, b, axis=0)\n', (167671, 167711), False, 'from numpy.testing import TestCase, run_module_suite, assert_raises\n'), ((167726, 167767), 'numpy.ma.append', 'np.ma.append', (['a[np.newaxis, :]', 'b'], {'axis': '(0)'}), '(a[np.newaxis, :], b, axis=0)\n', (167738, 167767), True, 'import numpy as np\n'), ((167782, 167801), 'numpy.ma.arange', 'np.ma.arange', (['(1)', '(10)'], {}), '(1, 10)\n', (167794, 167801), True, 'import numpy as np\n'), ((167881, 167927), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['result.data', 'expected.data'], {}), '(result.data, expected.data)\n', (167899, 167927), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((167932, 167978), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['result.mask', 'expected.mask'], {}), '(result.mask, expected.mask)\n', (167950, 167978), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((168256, 168274), 'numpy.testing.run_module_suite', 'run_module_suite', ([], {}), '()\n', (168272, 168274), False, 'from numpy.testing import TestCase, run_module_suite, assert_raises\n'), ((2048, 2127), 'numpy.array', 'np.array', (['[1.0, 1.0, 1.0, -2.0, pi / 2.0, 4.0, 5.0, -10.0, 10.0, 1.0, 2.0, 3.0]'], {}), '([1.0, 1.0, 1.0, -2.0, pi / 2.0, 4.0, 5.0, -10.0, 10.0, 1.0, 2.0, 3.0])\n', (2056, 2127), True, 'import numpy as np\n'), ((2127, 2202), 'numpy.array', 'np.array', (['[5.0, 0.0, 3.0, 2.0, -1.0, -4.0, 0.0, -10.0, 10.0, 1.0, 0.0, 3.0]'], {}), '([5.0, 0.0, 3.0, 2.0, -1.0, -4.0, 0.0, -10.0, 10.0, 1.0, 0.0, 3.0])\n', (2135, 2202), True, 'import numpy as np\n'), ((2322, 2346), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {'mask': 'm1'}), '(x, mask=m1)\n', (2334, 2346), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((2360, 2384), 'numpy.ma.core.masked_array', 'masked_array', (['y'], {'mask': 'm2'}), '(y, mask=m2)\n', (2372, 2384), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((2397, 2428), 'numpy.array', 'np.array', (['[-0.5, 0.0, 0.5, 0.8]'], {}), '([-0.5, 0.0, 0.5, 0.8])\n', (2405, 2428), True, 'import numpy as np\n'), ((2438, 2472), 'numpy.ma.core.masked_array', 'masked_array', (['z'], {'mask': '[0, 1, 0, 0]'}), '(z, mask=[0, 1, 0, 0])\n', (2450, 2472), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((2486, 2508), 'numpy.where', 'np.where', (['m1', '(1e+20)', 'x'], {}), '(m1, 1e+20, x)\n', (2494, 2508), True, 'import numpy as np\n'), ((2692, 2708), 'numpy.ma.core.array', 'array', (['[1, 3, 2]'], {}), '([1, 3, 2])\n', (2697, 2708), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((2721, 2753), 'numpy.ma.core.array', 'array', (['[1, 3, 2]'], {'mask': '[1, 0, 1]'}), '([1, 3, 2], mask=[1, 0, 1])\n', (2726, 2753), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((2762, 2785), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.ndim', '(1)'], {}), '(a.ndim, 1)\n', (2774, 2785), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((2794, 2817), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.ndim', '(1)'], {}), '(b.ndim, 1)\n', (2806, 2817), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((2826, 2849), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.size', '(3)'], {}), '(a.size, 3)\n', (2838, 2849), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((2858, 2881), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.size', '(3)'], {}), '(b.size, 3)\n', (2870, 2881), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((2890, 2917), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.shape', '(3,)'], {}), '(a.shape, (3,))\n', (2902, 2917), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((2926, 2953), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.shape', '(3,)'], {}), '(b.shape, (3,))\n', (2938, 2953), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((3029, 3044), 'numpy.ma.core.masked_array', 'masked_array', (['(0)'], {}), '(0)\n', (3041, 3044), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((3091, 3117), 'numpy.ma.core.masked_array', 'masked_array', (['(0)'], {'mask': '(True)'}), '(0, mask=True)\n', (3103, 3117), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((3185, 3212), 'numpy.ma.core.masked_array', 'masked_array', (['(0)'], {'mask': '(False)'}), '(0, mask=False)\n', (3197, 3212), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((3259, 3275), 'numpy.ma.core.array', 'array', (['(0)'], {'mask': '(1)'}), '(0, mask=1)\n', (3264, 3275), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((3760, 3785), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm.shape', 's'], {}), '(xm.shape, s)\n', (3772, 3785), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((3794, 3825), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm.dtype', 'x.dtype'], {}), '(xm.dtype, x.dtype)\n', (3806, 3825), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((3834, 3865), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['zm.dtype', 'z.dtype'], {}), '(zm.dtype, z.dtype)\n', (3846, 3865), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((4007, 4033), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['xm', 'xf'], {}), '(xm, xf)\n', (4025, 4033), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((4092, 4117), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['x', 'xm'], {}), '(x, xm)\n', (4110, 4117), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((5645, 5669), 'numpy.ma.core.concatenate', 'concatenate', (['(xm, ym)', '(1)'], {}), '((xm, ym), 1)\n', (5656, 5669), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((5809, 5817), 'numpy.ma.core.zeros', 'zeros', (['(2)'], {}), '(2)\n', (5814, 5817), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((5877, 5896), 'numpy.ma.core.concatenate', 'concatenate', (['(x, y)'], {}), '((x, y))\n', (5888, 5896), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((5905, 5940), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['z', '[0, 0, 1, 1]'], {}), '(z, [0, 0, 1, 1])\n', (5923, 5940), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((5949, 6004), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['z.mask', '[False, False, False, True]'], {}), '(z.mask, [False, False, False, True])\n', (5967, 6004), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((6017, 6036), 'numpy.ma.core.concatenate', 'concatenate', (['(y, x)'], {}), '((y, x))\n', (6028, 6036), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((6045, 6080), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['z', '[1, 1, 0, 0]'], {}), '(z, [1, 1, 0, 0])\n', (6063, 6080), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((6089, 6144), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['z.mask', '[False, True, False, False]'], {}), '(z.mask, [False, True, False, False])\n', (6107, 6144), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((6430, 6463), 'numpy.ma.core.concatenate', 'concatenate', (['[data[:5], data[5:]]'], {}), '([data[:5], data[5:]])\n', (6441, 6463), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((6472, 6504), 'numpy.ma.testutils.assert_equal_records', 'assert_equal_records', (['test', 'data'], {}), '(test, data)\n', (6492, 6504), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((6586, 6627), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]', 'ndmin': '(2)'}), '([1, 2, 3], mask=[1, 0, 0], ndmin=2)\n', (6591, 6627), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((6636, 6665), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.shape', '(1, 3)'], {}), '(x.shape, (1, 3))\n', (6648, 6665), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((6674, 6708), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x._data', '[[1, 2, 3]]'], {}), '(x._data, [[1, 2, 3]])\n', (6686, 6708), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((6717, 6751), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x._mask', '[[1, 0, 0]]'], {}), '(x._mask, [[1, 0, 0]])\n', (6729, 6751), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((6881, 6897), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (6886, 6897), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((6934, 6964), 'numpy.ma.core.array', 'array', (['x'], {'ndmin': '(2)', 'dtype': 'float'}), '(x, ndmin=2, dtype=float)\n', (6939, 6964), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((6973, 7009), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.shape', 'x._mask.shape'], {}), '(x.shape, x._mask.shape)\n', (6985, 7009), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((7018, 7056), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.shape', 'xx._mask.shape'], {}), '(xx.shape, xx._mask.shape)\n', (7030, 7056), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((7190, 7213), 'numpy.ma.core.arange', 'arange', (['(24)'], {'dtype': 'float'}), '(24, dtype=float)\n', (7196, 7213), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((7264, 7281), 'numpy.ma.core.MaskedArray', 'MaskedArray', (['data'], {}), '(data)\n', (7275, 7281), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((7290, 7325), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['dma_1.mask', 'data.mask'], {}), '(dma_1.mask, data.mask)\n', (7302, 7325), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((7342, 7360), 'numpy.ma.core.MaskedArray', 'MaskedArray', (['dma_1'], {}), '(dma_1)\n', (7353, 7360), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((7369, 7405), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['dma_2.mask', 'dma_1.mask'], {}), '(dma_2.mask, dma_1.mask)\n', (7381, 7405), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((7422, 7463), 'numpy.ma.core.MaskedArray', 'MaskedArray', (['dma_1'], {'mask': '([1, 0, 0, 0] * 6)'}), '(dma_1, mask=[1, 0, 0, 0] * 6)\n', (7433, 7463), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((7472, 7509), 'numpy.ma.testutils.fail_if_equal', 'fail_if_equal', (['dma_3.mask', 'dma_1.mask'], {}), '(dma_3.mask, dma_1.mask)\n', (7485, 7509), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((7523, 7550), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '(True)'}), '([1, 2, 3], mask=True)\n', (7528, 7550), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((7559, 7600), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x._mask', '[True, True, True]'], {}), '(x._mask, [True, True, True])\n', (7571, 7600), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((7613, 7641), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '(False)'}), '([1, 2, 3], mask=False)\n', (7618, 7641), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((7650, 7694), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x._mask', '[False, False, False]'], {}), '(x._mask, [False, False, False])\n', (7662, 7694), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((7707, 7749), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': 'x._mask', 'copy': '(False)'}), '([1, 2, 3], mask=x._mask, copy=False)\n', (7712, 7749), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((7815, 7856), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': 'x._mask', 'copy': '(True)'}), '([1, 2, 3], mask=x._mask, copy=True)\n', (7820, 7856), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((8109, 8128), 'numpy.ma.core.array', 'array', (['(x, x[::-1])'], {}), '((x, x[::-1]))\n', (8114, 8128), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((8137, 8191), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['data', '[[0, 1, 2, 3, 4], [4, 3, 2, 1, 0]]'], {}), '(data, [[0, 1, 2, 3, 4], [4, 3, 2, 1, 0]])\n', (8149, 8191), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((8200, 8260), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['data._mask', '[[1, 0, 0, 0, 0], [0, 0, 0, 0, 1]]'], {}), '(data._mask, [[1, 0, 0, 0, 0], [0, 0, 0, 0, 1]])\n', (8212, 8260), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((8301, 8320), 'numpy.ma.core.array', 'array', (['(x, x[::-1])'], {}), '((x, x[::-1]))\n', (8306, 8320), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((8329, 8383), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['data', '[[0, 1, 2, 3, 4], [4, 3, 2, 1, 0]]'], {}), '(data, [[0, 1, 2, 3, 4], [4, 3, 2, 1, 0]])\n', (8341, 8383), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((8586, 8597), 'numpy.ma.core.asarray', 'asarray', (['xm'], {}), '(xm)\n', (8593, 8597), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((8606, 8639), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xmm._data', 'xm._data'], {}), '(xmm._data, xm._data)\n', (8618, 8639), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((8648, 8681), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xmm._mask', 'xm._mask'], {}), '(xmm._mask, xm._mask)\n', (8660, 8681), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((8690, 8733), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xmm.fill_value', 'xm.fill_value'], {}), '(xmm.fill_value, xm.fill_value)\n', (8702, 8733), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((8742, 8783), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xmm._hardmask', 'xm._hardmask'], {}), '(xmm._hardmask, xm._hardmask)\n', (8754, 8783), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((8941, 8951), 'numpy.ma.core.asarray', 'asarray', (['m'], {}), '(m)\n', (8948, 8951), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((9159, 9180), 'numpy.ma.core.asarray', 'asarray', (['m'], {'order': '"""C"""'}), "(m, order='C')\n", (9166, 9180), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((9654, 9663), 'numpy.ma.core.arange', 'arange', (['(6)'], {}), '(6)\n', (9660, 9663), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((9912, 9934), 'numpy.ma.core.empty', 'empty', (['(1)'], {'dtype': 'object'}), '(1, dtype=object)\n', (9917, 9934), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((9988, 10009), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a[0]', 'x'], {}), '(a[0], x)\n', (10000, 10009), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((10083, 10106), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (10104, 10106), False, 'import datetime\n'), ((10245, 10267), 'numpy.array', 'np.array', (['[1, 2, 4, 3]'], {}), '([1, 2, 4, 3])\n', (10253, 10267), True, 'import numpy as np\n'), ((10281, 10309), 'numpy.ma.core.array', 'array', (['x1'], {'mask': '[1, 0, 0, 0]'}), '(x1, mask=[1, 0, 0, 0])\n', (10286, 10309), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((10323, 10351), 'numpy.ma.core.array', 'array', (['x1'], {'mask': '[0, 1, 0, 1]'}), '(x1, mask=[0, 1, 0, 1])\n', (10328, 10351), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((10365, 10374), 'numpy.ma.core.array', 'array', (['x1'], {}), '(x1)\n', (10370, 10374), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((10606, 10629), 'numpy.ma.testutils.assert_', 'assert_', (['(x1[1] == x2[1])'], {}), '(x1[1] == x2[1])\n', (10613, 10629), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((10638, 10662), 'numpy.ma.testutils.assert_', 'assert_', (['(x2[0] is masked)'], {}), '(x2[0] is masked)\n', (10645, 10662), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((10671, 10697), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1[2]', 'x2[2]'], {}), '(x1[2], x2[2])\n', (10683, 10697), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((10706, 10736), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1[2:5]', 'x2[2:5]'], {}), '(x1[2:5], x2[2:5])\n', (10718, 10736), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((10745, 10771), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1[:]', 'x2[:]'], {}), '(x1[:], x2[:])\n', (10757, 10771), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((10780, 10808), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1[1:]', 'x3[1:]'], {}), '(x1[1:], x3[1:])\n', (10792, 10808), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((10853, 10873), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (10865, 10873), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((10924, 10944), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (10936, 10944), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((10976, 10996), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (10988, 10996), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((11030, 11050), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (11042, 11050), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((11169, 11209), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3, 4]', '[0, 1, 1, 0]'], {}), '([1, 2, 3, 4], [0, 1, 1, 0])\n', (11181, 11209), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11286, 11326), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3, 4]', '[0, 1, 1, 0]'], {}), '([1, 2, 3, 4], [0, 1, 1, 0])\n', (11298, 11326), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11483, 11505), 'numpy.ma.core.masked_values', 'masked_values', (['x1', '(3.0)'], {}), '(x1, 3.0)\n', (11496, 11505), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11514, 11534), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (11526, 11534), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((11612, 11644), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(3.0)', 'x2.fill_value'], {}), '(3.0, x2.fill_value)\n', (11624, 11644), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((11658, 11691), 'numpy.ma.core.array', 'array', (["[1, 'hello', 2, 3]", 'object'], {}), "([1, 'hello', 2, 3], object)\n", (11663, 11691), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11705, 11741), 'numpy.array', 'np.array', (["[1, 'hello', 2, 3]", 'object'], {}), "([1, 'hello', 2, 3], object)\n", (11713, 11741), True, 'import numpy as np\n'), ((11860, 11880), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['s1', 's2'], {}), '(s1, s2)\n', (11872, 11880), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((11889, 11919), 'numpy.ma.testutils.assert_', 'assert_', (['(x1[1:1].shape == (0,))'], {}), '(x1[1:1].shape == (0,))\n', (11896, 11919), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12011, 12044), 'numpy.matrix', 'np.matrix', (['[[1, 2, 3], [4, 3, 2]]'], {}), '([[1, 2, 3], [4, 3, 2]])\n', (12020, 12044), True, 'import numpy as np\n'), ((12058, 12096), 'numpy.ma.core.array', 'array', (['x1'], {'mask': '[[1, 0, 0], [0, 1, 0]]'}), '(x1, mask=[[1, 0, 0], [0, 1, 0]])\n', (12063, 12096), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((12110, 12148), 'numpy.ma.core.array', 'array', (['x1'], {'mask': '[[0, 1, 0], [1, 0, 0]]'}), '(x1, mask=[[0, 1, 0], [1, 0, 0]])\n', (12115, 12148), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((12162, 12171), 'numpy.ma.core.array', 'array', (['x1'], {}), '(x1)\n', (12167, 12171), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((12350, 12379), 'numpy.ma.testutils.assert_', 'assert_', (['(x1[1, 0] == x2[1, 0])'], {}), '(x1[1, 0] == x2[1, 0])\n', (12357, 12379), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12388, 12415), 'numpy.ma.testutils.assert_', 'assert_', (['(x2[1, 1] is masked)'], {}), '(x2[1, 1] is masked)\n', (12395, 12415), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12424, 12456), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1[0, 2]', 'x2[0, 2]'], {}), '(x1[0, 2], x2[0, 2])\n', (12436, 12456), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12465, 12499), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1[0, 1:]', 'x2[0, 1:]'], {}), '(x1[0, 1:], x2[0, 1:])\n', (12477, 12499), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12508, 12540), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1[:, 2]', 'x2[:, 2]'], {}), '(x1[:, 2], x2[:, 2])\n', (12520, 12540), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12549, 12575), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1[:]', 'x2[:]'], {}), '(x1[:], x2[:])\n', (12561, 12575), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12584, 12612), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1[1:]', 'x3[1:]'], {}), '(x1[1:], x3[1:])\n', (12596, 12612), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12663, 12683), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (12675, 12683), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12738, 12758), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (12750, 12758), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12793, 12813), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (12805, 12813), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((12849, 12869), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (12861, 12869), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((13016, 13050), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3]', '[1, 1, 0]'], {}), '([1, 2, 3], [1, 1, 0])\n', (13028, 13050), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13190, 13224), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3]', '[1, 1, 0]'], {}), '([1, 2, 3], [1, 1, 0])\n', (13202, 13224), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13392, 13414), 'numpy.ma.core.masked_values', 'masked_values', (['x1', '(3.0)'], {}), '(x1, 3.0)\n', (13405, 13414), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13423, 13443), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (13435, 13443), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((13521, 13553), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(3.0)', 'x2.fill_value'], {}), '(3.0, x2.fill_value)\n', (13533, 13553), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((13681, 13693), 'numpy.ma.core.make_mask', 'make_mask', (['n'], {}), '(n)\n', (13690, 13693), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13707, 13719), 'numpy.ma.core.make_mask', 'make_mask', (['m'], {}), '(m)\n', (13716, 13719), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13766, 13786), 'numpy.ma.core.make_mask', 'make_mask', (['m'], {'copy': '(1)'}), '(m, copy=1)\n', (13775, 13786), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13838, 13850), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (13847, 13850), True, 'import numpy as np\n'), ((13864, 13881), 'numpy.ma.core.array', 'array', (['x1'], {'mask': 'm'}), '(x1, mask=m)\n', (13869, 13881), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13890, 13956), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y1._data.__array_interface__', 'x1.__array_interface__'], {}), '(y1._data.__array_interface__, x1.__array_interface__)\n', (13902, 13956), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((14012, 14077), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y1._mask.__array_interface__', 'm.__array_interface__'], {}), '(y1._mask.__array_interface__, m.__array_interface__)\n', (14024, 14077), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((14093, 14102), 'numpy.ma.core.array', 'array', (['y1'], {}), '(y1)\n', (14098, 14102), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((14273, 14290), 'numpy.ma.core.array', 'array', (['x1'], {'mask': 'm'}), '(x1, mask=m)\n', (14278, 14290), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((14693, 14716), 'numpy.ma.core.array', 'array', (['(x1 * 1.0)'], {'mask': 'm'}), '(x1 * 1.0, mask=m)\n', (14698, 14716), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((14793, 14802), 'numpy.ma.core.arange', 'arange', (['(4)'], {}), '(4)\n', (14799, 14802), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((14839, 14855), 'numpy.ma.core.resize', 'resize', (['x4', '(8,)'], {}), '(x4, (8,))\n', (14845, 14855), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((14977, 15009), 'numpy.ma.core.repeat', 'repeat', (['x4', '(2, 2, 2, 2)'], {'axis': '(0)'}), '(x4, (2, 2, 2, 2), axis=0)\n', (14983, 15009), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((15018, 15060), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y5', '[0, 0, 1, 1, 2, 2, 3, 3]'], {}), '(y5, [0, 0, 1, 1, 2, 2, 3, 3])\n', (15030, 15060), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((15074, 15095), 'numpy.ma.core.repeat', 'repeat', (['x4', '(2)'], {'axis': '(0)'}), '(x4, 2, axis=0)\n', (15080, 15095), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((15104, 15124), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y5', 'y6'], {}), '(y5, y6)\n', (15116, 15124), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((15178, 15198), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y5', 'y7'], {}), '(y5, y7)\n', (15190, 15198), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((15236, 15256), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y5', 'y8'], {}), '(y5, y8)\n', (15248, 15256), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((15289, 15321), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y9._data', 'x4._data'], {}), '(y9._data, x4._data)\n', (15301, 15321), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((15330, 15362), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y9._mask', 'x4._mask'], {}), '(y9._mask, x4._mask)\n', (15342, 15362), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((15376, 15415), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3]'], {'mask': '[0, 1, 0]'}), '([1, 2, 3], mask=[0, 1, 0])\n', (15388, 15415), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((15463, 15478), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {}), '(x)\n', (15475, 15478), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((15487, 15541), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y._data.ctypes.data', 'x._data.ctypes.data'], {}), '(y._data.ctypes.data, x._data.ctypes.data)\n', (15499, 15541), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((15550, 15604), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y._mask.ctypes.data', 'x._mask.ctypes.data'], {}), '(y._mask.ctypes.data, x._mask.ctypes.data)\n', (15562, 15604), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((15617, 15643), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {'copy': '(True)'}), '(x, copy=True)\n', (15629, 15643), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((15652, 15710), 'numpy.ma.testutils.assert_not_equal', 'assert_not_equal', (['y._data.ctypes.data', 'x._data.ctypes.data'], {}), '(y._data.ctypes.data, x._data.ctypes.data)\n', (15668, 15710), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((15719, 15777), 'numpy.ma.testutils.assert_not_equal', 'assert_not_equal', (['y._mask.ctypes.data', 'x._mask.ctypes.data'], {}), '(y._mask.ctypes.data, x._mask.ctypes.data)\n', (15735, 15777), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((15896, 15918), 'numpy.ma.array', 'np.ma.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (15907, 15918), True, 'import numpy as np\n'), ((15931, 15953), 'numpy.ma.array', 'np.ma.array', (['[4, 5, 6]'], {}), '([4, 5, 6])\n', (15942, 15953), True, 'import numpy as np\n'), ((16125, 16168), 'numpy.ma.core.array', 'array', (['[0, 1, 2]'], {'mask': '[False, True, False]'}), '([0, 1, 2], mask=[False, True, False])\n', (16130, 16168), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((16186, 16197), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (16194, 16197), False, 'from copy import deepcopy\n'), ((16206, 16239), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['copied.mask', 'a.mask'], {}), '(copied.mask, a.mask)\n', (16218, 16239), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((16327, 16363), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['copied.mask', '[0, 0, 0]'], {}), '(copied.mask, [0, 0, 0])\n', (16339, 16363), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((16372, 16403), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[0, 1, 0]'], {}), '(a.mask, [0, 1, 0])\n', (16384, 16403), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((16422, 16433), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (16430, 16433), False, 'from copy import deepcopy\n'), ((16442, 16475), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['copied.mask', 'a.mask'], {}), '(copied.mask, a.mask)\n', (16454, 16475), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((16515, 16551), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['copied.mask', '[0, 0, 0]'], {}), '(copied.mask, [0, 0, 0])\n', (16527, 16551), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((16560, 16591), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[0, 1, 0]'], {}), '(a.mask, [0, 1, 0])\n', (16572, 16591), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((16634, 16677), 'numpy.ma.core.array', 'array', (['[0, 1, 2]'], {'mask': '[False, True, False]'}), '([0, 1, 2], mask=[False, True, False])\n', (16639, 16677), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((16934, 16952), 'numpy.ma.arange', 'np.ma.arange', (['(2000)'], {}), '(2000)\n', (16946, 16952), True, 'import numpy as np\n'), ((17295, 17305), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (17301, 17305), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((17409, 17447), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a_pickled._mask', 'a._mask'], {}), '(a_pickled._mask, a._mask)\n', (17421, 17447), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((17456, 17494), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a_pickled._data', 'a._data'], {}), '(a_pickled._data, a._data)\n', (17468, 17494), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((17503, 17542), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a_pickled.fill_value', '(999)'], {}), '(a_pickled.fill_value, 999)\n', (17515, 17542), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((17759, 17797), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a_pickled._mask', 'a._mask'], {}), '(a_pickled._mask, a._mask)\n', (17771, 17797), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((17806, 17832), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a_pickled', 'a'], {}), '(a_pickled, a)\n', (17818, 17832), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((18061, 18111), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mc_pickled._baseclass', 'mc._baseclass'], {}), '(mc_pickled._baseclass, mc._baseclass)\n', (18073, 18111), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((18120, 18160), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mc_pickled._mask', 'mc._mask'], {}), '(mc_pickled._mask, mc._mask)\n', (18132, 18160), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((18169, 18209), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mc_pickled._data', 'mc._data'], {}), '(mc_pickled._data, mc._data)\n', (18181, 18209), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((18309, 18397), 'numpy.ma.core.array', 'array', (['[(1, 1.0), (2, 2.0)]'], {'mask': '[(0, 0), (0, 1)]', 'dtype': "[('a', int), ('b', float)]"}), "([(1, 1.0), (2, 2.0)], mask=[(0, 0), (0, 1)], dtype=[('a', int), ('b',\n float)])\n", (18314, 18397), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((18462, 18500), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a_pickled._mask', 'a._mask'], {}), '(a_pickled._mask, a._mask)\n', (18474, 18500), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((18509, 18535), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a_pickled', 'a'], {}), '(a_pickled, a)\n', (18521, 18535), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((18640, 18650), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (18646, 18650), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((18746, 18767), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'b'], {}), '(test, b)\n', (18758, 18767), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((18885, 18901), 'numpy.ma.core.array', 'array', (['[1, 3, 2]'], {}), '([1, 3, 2])\n', (18890, 18901), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((18914, 18946), 'numpy.ma.core.array', 'array', (['[1, 3, 2]'], {'mask': '[1, 0, 1]'}), '([1, 3, 2], mask=[1, 0, 1])\n', (18919, 18946), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((18955, 18983), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a[0].shape', '()'], {}), '(a[0].shape, ())\n', (18967, 18983), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((18992, 19020), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b[0].shape', '()'], {}), '(b[0].shape, ())\n', (19004, 19020), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((19029, 19057), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b[1].shape', '()'], {}), '(b[1].shape, ())\n', (19041, 19057), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((19546, 19578), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]'}), '([1, 2, 3], mask=[1, 0, 0])\n', (19551, 19578), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((19937, 19947), 'numpy.ma.core.arange', 'arange', (['(20)'], {}), '(20)\n', (19943, 19947), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((20007, 20029), 'numpy.ma.testutils.assert_', 'assert_', (['(x[1, 0] == 12)'], {}), '(x[1, 0] == 12)\n', (20014, 20029), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20062, 20085), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z.real', 'x'], {}), '(z.real, x)\n', (20074, 20085), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20094, 20122), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z.imag', '(10 * x)'], {}), '(z.imag, 10 * x)\n', (20106, 20122), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20221, 20231), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (20227, 20231), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((20442, 20460), 'numpy.ma.core.masked_where', 'masked_where', (['c', 'x'], {}), '(c, x)\n', (20454, 20460), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((20469, 20496), 'numpy.ma.testutils.assert_', 'assert_', (['(z.dtype is x.dtype)'], {}), '(z.dtype is x.dtype)\n', (20476, 20496), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20505, 20528), 'numpy.ma.testutils.assert_', 'assert_', (['(z[3] is masked)'], {}), '(z[3] is masked)\n', (20512, 20528), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20537, 20564), 'numpy.ma.testutils.assert_', 'assert_', (['(z[4] is not masked)'], {}), '(z[4] is not masked)\n', (20544, 20564), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20573, 20600), 'numpy.ma.testutils.assert_', 'assert_', (['(z[7] is not masked)'], {}), '(z[7] is not masked)\n', (20580, 20600), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20609, 20632), 'numpy.ma.testutils.assert_', 'assert_', (['(z[8] is masked)'], {}), '(z[8] is masked)\n', (20616, 20632), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20641, 20664), 'numpy.ma.testutils.assert_', 'assert_', (['(z[9] is masked)'], {}), '(z[9] is masked)\n', (20648, 20664), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20673, 20691), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', 'z'], {}), '(x, z)\n', (20685, 20691), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20775, 20807), 'numpy.ma.core.array', 'array', (['[1.0, 2.0, 3.0, 4.0, 5.0]'], {}), '([1.0, 2.0, 3.0, 4.0, 5.0])\n', (20780, 20807), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((20815, 20837), 'numpy.ma.core.array', 'array', (['[1, 1, 1, 0, 0]'], {}), '([1, 1, 1, 0, 0])\n', (20820, 20837), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((20872, 20887), 'numpy.ma.core.where', 'where', (['c', 'x', '(-x)'], {}), '(c, x, -x)\n', (20877, 20887), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((20896, 20938), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[1.0, 2.0, 0.0, -4.0, -5]'], {}), '(z, [1.0, 2.0, 0.0, -4.0, -5])\n', (20908, 20938), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((20969, 20984), 'numpy.ma.core.where', 'where', (['c', 'x', '(-x)'], {}), '(c, x, -x)\n', (20974, 20984), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((20993, 21035), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[1.0, 2.0, 0.0, -4.0, -5]'], {}), '(z, [1.0, 2.0, 0.0, -4.0, -5])\n', (21005, 21035), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((21040, 21063), 'numpy.ma.testutils.assert_', 'assert_', (['(z[0] is masked)'], {}), '(z[0] is masked)\n', (21047, 21063), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((21072, 21099), 'numpy.ma.testutils.assert_', 'assert_', (['(z[1] is not masked)'], {}), '(z[1] is not masked)\n', (21079, 21099), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((21108, 21131), 'numpy.ma.testutils.assert_', 'assert_', (['(z[2] is masked)'], {}), '(z[2] is masked)\n', (21115, 21131), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((21221, 21243), 'numpy.ma.core.array', 'array', (['[10]'], {'mask': '(True)'}), '([10], mask=True)\n', (21226, 21243), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((21260, 21271), 'numpy.ma.core.array', 'array', (['[20]'], {}), '([20])\n', (21265, 21271), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((21337, 21362), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['atest', '[20]'], {}), '(atest, [20])\n', (21349, 21362), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((21418, 21448), 'numpy.ma.masked_all', 'np.ma.masked_all', (['(1)'], {'dtype': '"""O"""'}), "(1, dtype='O')\n", (21434, 21448), True, 'import numpy as np\n'), ((21594, 21660), 'numpy.ma.core.array', 'array', (['[(1, 1, 1)]'], {'dtype': "[('i', int), ('s', '|S8'), ('f', float)]"}), "([(1, 1, 1)], dtype=[('i', int), ('s', '|S8'), ('f', float)])\n", (21599, 21660), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((22190, 22234), 'numpy.ma.core.mvoid', 'mvoid', (['(1, 2.0)'], {'mask': '[(0, 1)]', 'dtype': 'ndtype'}), '((1, 2.0), mask=[(0, 1)], dtype=ndtype)\n', (22195, 22234), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((22748, 22833), 'numpy.ma.core.array', 'array', (['[(1, (1, 1)), (2, (2, 2))]'], {'mask': '[(0, (1, 0)), (0, (0, 1))]', 'dtype': 'ndtype'}), '([(1, (1, 1)), (2, (2, 2))], mask=[(0, (1, 0)), (0, (0, 1))], dtype=ndtype\n )\n', (22753, 22833), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((22892, 22942), 'numpy.array', 'np.array', (['[(1, (0, 1)), (2, (2, 0))]'], {'dtype': 'ndtype'}), '([(1, (0, 1)), (2, (2, 0))], dtype=ndtype)\n', (22900, 22942), True, 'import numpy as np\n'), ((22951, 22978), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (22963, 22978), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((23030, 23076), 'numpy.array', 'np.array', (['[(0, 1), (2, 0)]'], {'dtype': "a['B'].dtype"}), "([(0, 1), (2, 0)], dtype=a['B'].dtype)\n", (23038, 23076), True, 'import numpy as np\n'), ((23085, 23112), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (23097, 23112), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((24046, 24075), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'dtype': 'float'}), '([1, 2, 3], dtype=float)\n', (24051, 24075), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((24142, 24181), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["y._optinfo['info']", '"""???"""'], {}), "(y._optinfo['info'], '???')\n", (24154, 24181), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((24225, 24264), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["x._optinfo['info']", '"""???"""'], {}), "(x._optinfo['info'], '???')\n", (24237, 24264), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((24381, 24438), 'numpy.dtype', 'np.dtype', (["[('x', int), ('y', [('t', int), ('s', float)])]"], {}), "([('x', int), ('y', [('t', int), ('s', float)])])\n", (24389, 24438), True, 'import numpy as np\n'), ((24454, 24546), 'numpy.ma.core.array', 'array', (['[(1, (2, 3.0)), (4, (5, 6.0))]'], {'mask': '[(1, (0, 1)), (0, (1, 0))]', 'dtype': 'fancydtype'}), '([(1, (2, 3.0)), (4, (5, 6.0))], mask=[(1, (0, 1)), (0, (1, 0))],\n dtype=fancydtype)\n', (24459, 24546), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((24748, 24918), 'numpy.ma.core.masked_array', 'masked_array', ([], {'data': '(0, [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], 0.0)', 'mask': '(False, [[True, False, True], [False, False, True]], False)', 'dtype': '"""int, (2,3)float, float"""'}), "(data=(0, [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], 0.0), mask=(False,\n [[True, False, True], [False, False, True]], False), dtype=\n 'int, (2,3)float, float')\n", (24760, 24918), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((25410, 25450), 'numpy.array', 'np.array', (['[(1, 1), (2, 2)]'], {'dtype': 'ndtype'}), '([(1, 1), (2, 2)], dtype=ndtype)\n', (25418, 25450), True, 'import numpy as np\n'), ((25466, 25493), 'numpy.ma.core.flatten_structured_array', 'flatten_structured_array', (['a'], {}), '(a)\n', (25490, 25493), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((25512, 25562), 'numpy.array', 'np.array', (['[[1.0, 1.0], [2.0, 2.0]]'], {'dtype': 'np.float'}), '([[1.0, 1.0], [2.0, 2.0]], dtype=np.float)\n', (25520, 25562), True, 'import numpy as np\n'), ((25567, 25594), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (25579, 25594), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((25603, 25642), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.dtype', 'control.dtype'], {}), '(test.dtype, control.dtype)\n', (25615, 25642), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((25681, 25741), 'numpy.ma.core.array', 'array', (['[(1, 1), (2, 2)]'], {'mask': '[(0, 1), (1, 0)]', 'dtype': 'ndtype'}), '([(1, 1), (2, 2)], mask=[(0, 1), (1, 0)], dtype=ndtype)\n', (25686, 25741), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((25757, 25784), 'numpy.ma.core.flatten_structured_array', 'flatten_structured_array', (['a'], {}), '(a)\n', (25781, 25784), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((25803, 25873), 'numpy.ma.core.array', 'array', (['[[1.0, 1.0], [2.0, 2.0]]'], {'mask': '[[0, 1], [1, 0]]', 'dtype': 'np.float'}), '([[1.0, 1.0], [2.0, 2.0]], mask=[[0, 1], [1, 0]], dtype=np.float)\n', (25808, 25873), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((25902, 25929), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (25914, 25929), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((25938, 25977), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.dtype', 'control.dtype'], {}), '(test.dtype, control.dtype)\n', (25950, 25977), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((25986, 26023), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (25998, 26023), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((26151, 26239), 'numpy.ma.core.array', 'array', (['[(1, (1, 1.1)), (2, (2, 2.2))]'], {'mask': '[(0, (1, 0)), (1, (0, 1))]', 'dtype': 'ndtype'}), '([(1, (1, 1.1)), (2, (2, 2.2))], mask=[(0, (1, 0)), (1, (0, 1))],\n dtype=ndtype)\n', (26156, 26239), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((26269, 26296), 'numpy.ma.core.flatten_structured_array', 'flatten_structured_array', (['a'], {}), '(a)\n', (26293, 26296), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((26315, 26405), 'numpy.ma.core.array', 'array', (['[[1.0, 1.0, 1.1], [2.0, 2.0, 2.2]]'], {'mask': '[[0, 1, 0], [1, 0, 1]]', 'dtype': 'np.float'}), '([[1.0, 1.0, 1.1], [2.0, 2.0, 2.2]], mask=[[0, 1, 0], [1, 0, 1]],\n dtype=np.float)\n', (26320, 26405), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((26430, 26457), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (26442, 26457), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((26466, 26505), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.dtype', 'control.dtype'], {}), '(test.dtype, control.dtype)\n', (26478, 26505), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((26514, 26551), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (26526, 26551), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((26644, 26688), 'numpy.array', 'np.array', (['[[(1, 1)], [(2, 2)]]'], {'dtype': 'ndtype'}), '([[(1, 1)], [(2, 2)]], dtype=ndtype)\n', (26652, 26688), True, 'import numpy as np\n'), ((26708, 26735), 'numpy.ma.core.flatten_structured_array', 'flatten_structured_array', (['a'], {}), '(a)\n', (26732, 26735), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((26754, 26808), 'numpy.array', 'np.array', (['[[[1.0, 1.0]], [[2.0, 2.0]]]'], {'dtype': 'np.float'}), '([[[1.0, 1.0]], [[2.0, 2.0]]], dtype=np.float)\n', (26762, 26808), True, 'import numpy as np\n'), ((26817, 26844), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (26829, 26844), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((26853, 26892), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.dtype', 'control.dtype'], {}), '(test.dtype, control.dtype)\n', (26865, 26892), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((27063, 27071), 'numpy.ma.core.mvoid', 'mvoid', (['a'], {}), '(a)\n', (27068, 27071), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((27229, 27296), 'numpy.ma.core.masked_array', 'masked_array', (['[(1, 2), (1, 2)]'], {'mask': '[(1, 0), (0, 0)]', 'dtype': 'ndtype'}), '([(1, 2), (1, 2)], mask=[(1, 0), (0, 0)], dtype=ndtype)\n', (27241, 27296), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((27309, 27338), 'numpy.ma.core.mvoid', 'mvoid', (['a._data[0]', 'a._mask[0]'], {}), '(a._data[0], a._mask[0])\n', (27314, 27338), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((27499, 27566), 'numpy.ma.core.masked_array', 'masked_array', (['[(1, 2), (3, 4)]'], {'mask': '[(0, 0), (1, 0)]', 'dtype': 'ndtype'}), '([(1, 2), (3, 4)], mask=[(0, 0), (1, 0)], dtype=ndtype)\n', (27511, 27566), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((27683, 27719), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["(f[0], f['a'])", '(1, 1)'], {}), "((f[0], f['a']), (1, 1))\n", (27695, 27719), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((27728, 27751), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["f['b']", '(2)'], {}), "(f['b'], 2)\n", (27740, 27751), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((27923, 27944), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['f[1]', '(4)'], {}), '(f[1], 4)\n', (27935, 27944), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((27981, 28068), 'numpy.ma.core.masked_array', 'masked_array', ([], {'data': '[([0, 1],)]', 'mask': '[([True, False],)]', 'dtype': "[('A', '>i2', (2,))]"}), "(data=[([0, 1],)], mask=[([True, False],)], dtype=[('A', '>i2',\n (2,))])\n", (27993, 28068), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((28122, 28156), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["A[0]['A']", "A['A'][0]"], {}), "(A[0]['A'], A['A'][0])\n", (28134, 28156), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((28400, 28467), 'numpy.ma.core.masked_array', 'masked_array', (['[(1, 2), (3, 4)]'], {'mask': '[(0, 0), (1, 0)]', 'dtype': 'ndtype'}), '([(1, 2), (3, 4)], mask=[(0, 0), (1, 0)], dtype=ndtype)\n', (28412, 28467), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((28696, 28751), 'numpy.ma.core.array', 'array', (['[(1, 1), (2, 2)]'], {'dtype': "[('a', int), ('b', int)]"}), "([(1, 1), (2, 2)], dtype=[('a', int), ('b', int)])\n", (28701, 28751), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((28882, 28920), 'numpy.ma.core.masked_print_option.set_display', 'masked_print_option.set_display', (['"""-X-"""'], {}), "('-X-')\n", (28913, 28920), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((29186, 29225), 'numpy.ma.core.array', 'array', (['[(1,), (2,)]'], {'dtype': "[('a', 'O')]"}), "([(1,), (2,)], dtype=[('a', 'O')])\n", (29191, 29225), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((29363, 29500), 'numpy.ma.core.masked_array', 'masked_array', ([], {'data': '[([1, 2, 3],)]', 'mask': '[([False, True, False],)]', 'fill_value': '([999999, 999999, 999999],)', 'dtype': "[('a', '<i4', (3,))]"}), "(data=[([1, 2, 3],)], mask=[([False, True, False],)],\n fill_value=([999999, 999999, 999999],), dtype=[('a', '<i4', (3,))])\n", (29375, 29500), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((29755, 29872), 'numpy.ma.core.masked_array', 'masked_array', ([], {'data': '[([[1, 2], [3, 4]],)]', 'mask': '[([[False, True], [True, False]],)]', 'dtype': "[('a', '<i4', (2, 2))]"}), "(data=[([[1, 2], [3, 4]],)], mask=[([[False, True], [True, \n False]],)], dtype=[('a', '<i4', (2, 2))])\n", (29767, 29872), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((30059, 30148), 'numpy.ma.core.masked_array', 'masked_array', ([], {'data': '[(1, 2)]', 'mask': '[(True, False)]', 'dtype': "[('a', '<i4'), ('b', '<i4')]"}), "(data=[(1, 2)], mask=[(True, False)], dtype=[('a', '<i4'), ('b',\n '<i4')])\n", (30071, 30148), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((30308, 30447), 'numpy.ma.core.masked_array', 'masked_array', ([], {'data': '[([[1, 2], [3, 4]], 1)]', 'mask': '[([[False, True], [True, False]], False)]', 'dtype': "[('a', '<i4', (2, 2)), ('b', float)]"}), "(data=[([[1, 2], [3, 4]], 1)], mask=[([[False, True], [True, \n False]], False)], dtype=[('a', '<i4', (2, 2)), ('b', float)])\n", (30320, 30447), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((30642, 30746), 'numpy.ma.core.masked_array', 'masked_array', ([], {'data': '[(1, (1, 1))]', 'mask': '[(True, (True, False))]', 'dtype': "[('a', '<i4'), ('b', 'i4,i4')]"}), "(data=[(1, (1, 1))], mask=[(True, (True, False))], dtype=[('a',\n '<i4'), ('b', 'i4,i4')])\n", (30654, 30746), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((30953, 30985), 'numpy.ma.core.masked_array', 'masked_array', (['[1.0]'], {'mask': '[True]'}), '([1.0], mask=[True])\n', (30965, 30985), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((30999, 31023), 'numpy.ma.core.masked_array', 'masked_array', (['[1.0, 2.0]'], {}), '([1.0, 2.0])\n', (31011, 31023), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((31035, 31079), 'numpy.ma.core.masked_array', 'masked_array', (['[mx1, mx2]'], {'mask': '[False, True]'}), '([mx1, mx2], mask=[False, True])\n', (31047, 31079), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((31088, 31109), 'numpy.ma.testutils.assert_', 'assert_', (['(mx[0] is mx1)'], {}), '(mx[0] is mx1)\n', (31095, 31109), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((31118, 31143), 'numpy.ma.testutils.assert_', 'assert_', (['(mx[1] is not mx2)'], {}), '(mx[1] is not mx2)\n', (31125, 31143), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((31302, 31324), 'numpy.ma.testutils.assert_', 'assert_', (['(mx2[0] == 0.0)'], {}), '(mx2[0] == 0.0)\n', (31309, 31324), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((31475, 31554), 'numpy.array', 'np.array', (['[1.0, 1.0, 1.0, -2.0, pi / 2.0, 4.0, 5.0, -10.0, 10.0, 1.0, 2.0, 3.0]'], {}), '([1.0, 1.0, 1.0, -2.0, pi / 2.0, 4.0, 5.0, -10.0, 10.0, 1.0, 2.0, 3.0])\n', (31483, 31554), True, 'import numpy as np\n'), ((31554, 31629), 'numpy.array', 'np.array', (['[5.0, 0.0, 3.0, 2.0, -1.0, -4.0, 0.0, -10.0, 10.0, 1.0, 0.0, 3.0]'], {}), '([5.0, 0.0, 3.0, 2.0, -1.0, -4.0, 0.0, -10.0, 10.0, 1.0, 0.0, 3.0])\n', (31562, 31629), True, 'import numpy as np\n'), ((31749, 31773), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {'mask': 'm1'}), '(x, mask=m1)\n', (31761, 31773), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((31787, 31811), 'numpy.ma.core.masked_array', 'masked_array', (['y'], {'mask': 'm2'}), '(y, mask=m2)\n', (31799, 31811), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((31824, 31855), 'numpy.array', 'np.array', (['[-0.5, 0.0, 0.5, 0.8]'], {}), '([-0.5, 0.0, 0.5, 0.8])\n', (31832, 31855), True, 'import numpy as np\n'), ((31865, 31899), 'numpy.ma.core.masked_array', 'masked_array', (['z'], {'mask': '[0, 1, 0, 0]'}), '(z, mask=[0, 1, 0, 0])\n', (31877, 31899), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((31913, 31935), 'numpy.where', 'np.where', (['m1', '(1e+20)', 'x'], {}), '(m1, 1e+20, x)\n', (31921, 31935), True, 'import numpy as np\n'), ((32051, 32062), 'numpy.geterr', 'np.geterr', ([], {}), '()\n', (32060, 32062), True, 'import numpy as np\n'), ((32071, 32115), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (32080, 32115), True, 'import numpy as np\n'), ((32149, 32177), 'numpy.seterr', 'np.seterr', ([], {}), '(**self.err_status)\n', (32158, 32177), True, 'import numpy as np\n'), ((32322, 32345), 'numpy.ma.core.array', 'array', (['[[1, 2], [0, 4]]'], {}), '([[1, 2], [0, 4]])\n', (32327, 32345), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((32361, 32396), 'numpy.ma.core.masked_array', 'masked_array', (['a2d', '[[0, 0], [1, 0]]'], {}), '(a2d, [[0, 0], [1, 0]])\n', (32373, 32396), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((32405, 32440), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a2d * a2d)', '(a2d * a2dm)'], {}), '(a2d * a2d, a2d * a2dm)\n', (32417, 32440), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((32449, 32484), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a2d + a2d)', '(a2d + a2dm)'], {}), '(a2d + a2d, a2d + a2dm)\n', (32461, 32484), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((32493, 32528), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a2d - a2d)', '(a2d - a2dm)'], {}), '(a2d - a2d, a2d - a2dm)\n', (32505, 32528), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33707, 33729), 'numpy.ma.core.arange', 'arange', (['(6)'], {'dtype': 'float'}), '(6, dtype=float)\n', (33713, 33729), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((33767, 33789), 'numpy.ma.core.arange', 'arange', (['(3)'], {'dtype': 'float'}), '(3, dtype=float)\n', (33773, 33789), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((33817, 33870), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[[-1.0, 1.0, 1.0], [-1.0, 4.0, 2.5]]'], {}), '(z, [[-1.0, 1.0, 1.0], [-1.0, 4.0, 2.5]])\n', (33829, 33870), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33874, 33918), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z.mask', '[[1, 0, 0], [1, 0, 0]]'], {}), '(z.mask, [[1, 0, 0], [1, 0, 0]])\n', (33886, 33918), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33954, 34007), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[[-1.0, 1.0, 1.0], [-1.0, 4.0, 2.5]]'], {}), '(z, [[-1.0, 1.0, 1.0], [-1.0, 4.0, 2.5]])\n', (33966, 34007), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((34011, 34055), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z.mask', '[[1, 0, 0], [1, 0, 0]]'], {}), '(z.mask, [[1, 0, 0], [1, 0, 0]])\n', (34023, 34055), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((34069, 34091), 'numpy.ma.core.arange', 'arange', (['(2)'], {'dtype': 'float'}), '(2, dtype=float)\n', (34075, 34091), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((34127, 34181), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[[-1.0, -1.0, -1.0], [3.0, 4.0, 5.0]]'], {}), '(z, [[-1.0, -1.0, -1.0], [3.0, 4.0, 5.0]])\n', (34139, 34181), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((34184, 34228), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z.mask', '[[1, 1, 1], [0, 0, 0]]'], {}), '(z.mask, [[1, 1, 1], [0, 0, 0]])\n', (34196, 34228), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((34315, 34328), 'numpy.array', 'np.array', (['[1]'], {}), '([1])\n', (34323, 34328), True, 'import numpy as np\n'), ((34342, 34352), 'numpy.ma.core.array', 'array', (['[1]'], {}), '([1])\n', (34347, 34352), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((34556, 34586), 'numpy.ma.core.array', 'array', (['[tiny, 1.0 / tiny, 0.0]'], {}), '([tiny, 1.0 / tiny, 0.0])\n', (34561, 34586), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((34873, 34889), 'numpy.ma.core.array', 'array', (['(0)'], {'mask': '(1)'}), '(0, mask=1)\n', (34878, 34889), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((35210, 35242), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[1, 1, 0]'}), '([1, 2, 3], mask=[1, 1, 0])\n', (35215, 35242), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((35251, 35281), 'numpy.ma.testutils.assert_', 'assert_', (['((a[0] == 0) is masked)'], {}), '((a[0] == 0) is masked)\n', (35258, 35281), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((35290, 35320), 'numpy.ma.testutils.assert_', 'assert_', (['((a[0] != 0) is masked)'], {}), '((a[0] != 0) is masked)\n', (35297, 35320), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((35329, 35360), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a[-1] == 0)', '(False)'], {}), '(a[-1] == 0, False)\n', (35341, 35360), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((35371, 35401), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a[-1] != 0)', '(True)'], {}), '(a[-1] != 0, True)\n', (35383, 35401), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((35524, 35544), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2]'], {}), '([1, 2])\n', (35536, 35544), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((35576, 35606), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y.shape', 'x.shape'], {}), '(y.shape, x.shape)\n', (35588, 35606), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((35615, 35650), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y._mask', '[True, True]'], {}), '(y._mask, [True, True])\n', (35627, 35650), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((35685, 35705), 'numpy.ma.testutils.assert_', 'assert_', (['(y is masked)'], {}), '(y is masked)\n', (35692, 35705), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((35737, 35767), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y.shape', 'x.shape'], {}), '(y.shape, x.shape)\n', (35749, 35767), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((35776, 35811), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y._mask', '[True, True]'], {}), '(y._mask, [True, True])\n', (35788, 35811), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((35957, 35974), 'numpy.ma.core.masked_array', 'masked_array', (['[1]'], {}), '([1])\n', (35969, 35974), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36008, 36038), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y.shape', 'x.shape'], {}), '(y.shape, x.shape)\n', (36020, 36038), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((36047, 36075), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y.mask', '[True]'], {}), '(y.mask, [True])\n', (36059, 36075), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((36129, 36145), 'numpy.ma.core.array', 'array', (['(0)'], {'mask': '(0)'}), '(0, mask=0)\n', (36134, 36145), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36312, 36340), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm.shape', '(2,)'], {}), '(xm.shape, (2,))\n', (36324, 36340), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((36349, 36378), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm.mask', '[1, 1]'], {}), '(xm.mask, [1, 1])\n', (36361, 36378), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((37893, 37939), 'numpy.ma.core.array', 'array', (['[0.0, 1.0, 2.0, 3.0]'], {'mask': '[1, 0, 0, 0]'}), '([0.0, 1.0, 2.0, 3.0], mask=[1, 0, 0, 0])\n', (37898, 37939), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37950, 37960), 'numpy.ma.core.count', 'count', (['ott'], {}), '(ott)\n', (37955, 37960), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38020, 38040), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(3)', 'res'], {}), '(3, res)\n', (38032, 38040), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((38090, 38100), 'numpy.ma.core.count', 'count', (['ott'], {}), '(ott)\n', (38095, 38100), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38109, 38143), 'numpy.ma.testutils.assert_', 'assert_', (['(res.dtype.type is np.intp)'], {}), '(res.dtype.type is np.intp)\n', (38116, 38143), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((38152, 38172), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(3)', 'res'], {}), '(3, res)\n', (38164, 38172), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((38187, 38200), 'numpy.ma.core.count', 'count', (['ott', '(0)'], {}), '(ott, 0)\n', (38192, 38200), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38251, 38276), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['[1, 2]', 'res'], {}), '([1, 2], res)\n', (38263, 38276), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((38332, 38359), 'numpy.ma.core.array', 'array', (['[0.0, 1.0, 2.0, 3.0]'], {}), '([0.0, 1.0, 2.0, 3.0])\n', (38337, 38359), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38370, 38383), 'numpy.ma.core.count', 'count', (['ott', '(0)'], {}), '(ott, 0)\n', (38375, 38383), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38434, 38468), 'numpy.ma.testutils.assert_', 'assert_', (['(res.dtype.type is np.intp)'], {}), '(res.dtype.type is np.intp)\n', (38441, 38468), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((38477, 38521), 'numpy.testing.assert_raises', 'assert_raises', (['ValueError', 'ott.count'], {'axis': '(1)'}), '(ValueError, ott.count, axis=1)\n', (38490, 38521), False, 'from numpy.testing import TestCase, run_module_suite, assert_raises\n'), ((38698, 38709), 'numpy.ravel', 'np.ravel', (['x'], {}), '(x)\n', (38706, 38709), True, 'import numpy as np\n'), ((38724, 38733), 'numpy.ma.core.ravel', 'ravel', (['xm'], {}), '(xm)\n', (38729, 38733), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39027, 39036), 'numpy.ma.core.arange', 'arange', (['(5)'], {}), '(5)\n', (39033, 39036), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39451, 39466), 'numpy.ones', 'np.ones', (['(2, 2)'], {}), '((2, 2))\n', (39458, 39466), True, 'import numpy as np\n'), ((39486, 39499), 'numpy.ma.core.minimum', 'minimum', (['a', 'a'], {}), '(a, a)\n', (39493, 39499), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39628, 39647), 'numpy.ma.core.minimum.outer', 'minimum.outer', (['a', 'a'], {}), '(a, a)\n', (39641, 39647), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39782, 39795), 'numpy.ma.core.maximum', 'maximum', (['a', 'a'], {}), '(a, a)\n', (39789, 39795), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39924, 39943), 'numpy.ma.core.maximum.outer', 'maximum.outer', (['a', 'a'], {}), '(a, a)\n', (39937, 39943), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((40170, 40214), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[False, False, False]'}), '([1, 2, 3], mask=[False, False, False])\n', (40175, 40214), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((40227, 40247), 'numpy.maximum.reduce', 'np.maximum.reduce', (['a'], {}), '(a)\n', (40244, 40247), True, 'import numpy as np\n'), ((40256, 40274), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b', '(3)'], {}), '(b, 3)\n', (40268, 40274), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((41873, 41900), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '(True)'}), '([1, 2, 3], mask=True)\n', (41878, 41900), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((43161, 43221), 'numpy.ma.core.array', 'array', (['[[1.0], [2.0], [3.0]]'], {'mask': '[[False], [True], [True]]'}), '([[1.0], [2.0], [3.0]], mask=[[False], [True], [True]])\n', (43166, 43221), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((43231, 43274), 'numpy.ma.core.array', 'array', (['[[2.0, 3.0], [4.0, 5.0], [6.0, 7.0]]'], {}), '([[2.0, 3.0], [4.0, 5.0], [6.0, 7.0]])\n', (43236, 43274), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((43309, 43383), 'numpy.ma.core.array', 'array', (['[[2.0, 3.0], [2.0, 2.0], [3.0, 3.0]]'], {'mask': '[[0, 0], [1, 1], [1, 1]]'}), '([[2.0, 3.0], [2.0, 2.0], [3.0, 3.0]], mask=[[0, 0], [1, 1], [1, 1]])\n', (43314, 43383), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((43410, 43437), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (43422, 43437), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((43446, 43483), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.data', 'control.data'], {}), '(test.data, control.data)\n', (43458, 43483), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((43492, 43529), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (43504, 43529), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((43570, 43644), 'numpy.ma.core.array', 'array', (['[[2.0, 3.0], [4.0, 5.0], [6.0, 7.0]]'], {'mask': '[[0, 0], [1, 1], [1, 1]]'}), '([[2.0, 3.0], [4.0, 5.0], [6.0, 7.0]], mask=[[0, 0], [1, 1], [1, 1]])\n', (43575, 43644), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((43671, 43698), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (43683, 43698), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((43707, 43744), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.data', 'control.data'], {}), '(test.data, control.data)\n', (43719, 43744), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((43753, 43790), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (43765, 43790), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((43804, 43832), 'numpy.ma.core.array', 'array', (['[[1.0], [2.0], [3.0]]'], {}), '([[1.0], [2.0], [3.0]])\n', (43809, 43832), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((43842, 43916), 'numpy.ma.core.array', 'array', (['[[2.0, 3.0], [4.0, 5.0], [6.0, 7.0]]'], {'mask': '[[0, 0], [0, 0], [0, 1]]'}), '([[2.0, 3.0], [4.0, 5.0], [6.0, 7.0]], mask=[[0, 0], [0, 0], [0, 1]])\n', (43847, 43916), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((43968, 44032), 'numpy.ma.core.array', 'array', (['[[2, 3], [8, 10], [18, 3]]'], {'mask': '[[0, 0], [0, 0], [0, 1]]'}), '([[2, 3], [8, 10], [18, 3]], mask=[[0, 0], [0, 0], [0, 1]])\n', (43973, 44032), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((44065, 44092), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (44077, 44092), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((44101, 44138), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.data', 'control.data'], {}), '(test.data, control.data)\n', (44113, 44138), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((44147, 44184), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (44159, 44184), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((44225, 44289), 'numpy.ma.core.array', 'array', (['[[2, 3], [8, 10], [18, 7]]'], {'mask': '[[0, 0], [0, 0], [0, 1]]'}), '([[2, 3], [8, 10], [18, 7]], mask=[[0, 0], [0, 0], [0, 1]])\n', (44230, 44289), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((44322, 44349), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (44334, 44349), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((44358, 44395), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.data', 'control.data'], {}), '(test.data, control.data)\n', (44370, 44395), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((44404, 44441), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (44416, 44441), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((44548, 44608), 'numpy.ma.core.array', 'array', (['[[1.0], [2.0], [3.0]]'], {'mask': '[[False], [True], [True]]'}), '([[1.0], [2.0], [3.0]], mask=[[False], [True], [True]])\n', (44553, 44608), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((44618, 44661), 'numpy.ma.core.array', 'array', (['[[2.0, 3.0], [4.0, 5.0], [6.0, 7.0]]'], {}), '([[2.0, 3.0], [4.0, 5.0], [6.0, 7.0]])\n', (44623, 44661), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((44696, 44787), 'numpy.ma.core.array', 'array', (['[[1.0 / 2.0, 1.0 / 3.0], [2.0, 2.0], [3.0, 3.0]]'], {'mask': '[[0, 0], [1, 1], [1, 1]]'}), '([[1.0 / 2.0, 1.0 / 3.0], [2.0, 2.0], [3.0, 3.0]], mask=[[0, 0], [1, 1\n ], [1, 1]])\n', (44701, 44787), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((44807, 44834), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (44819, 44834), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((44843, 44880), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.data', 'control.data'], {}), '(test.data, control.data)\n', (44855, 44880), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((44889, 44926), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (44901, 44926), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((44967, 45058), 'numpy.ma.core.array', 'array', (['[[2.0 / 1.0, 3.0 / 1.0], [4.0, 5.0], [6.0, 7.0]]'], {'mask': '[[0, 0], [1, 1], [1, 1]]'}), '([[2.0 / 1.0, 3.0 / 1.0], [4.0, 5.0], [6.0, 7.0]], mask=[[0, 0], [1, 1\n ], [1, 1]])\n', (44972, 45058), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((45078, 45105), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (45090, 45105), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((45114, 45151), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.data', 'control.data'], {}), '(test.data, control.data)\n', (45126, 45151), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((45160, 45197), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (45172, 45197), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((45211, 45239), 'numpy.ma.core.array', 'array', (['[[1.0], [2.0], [3.0]]'], {}), '([[1.0], [2.0], [3.0]])\n', (45216, 45239), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((45249, 45323), 'numpy.ma.core.array', 'array', (['[[2.0, 3.0], [4.0, 5.0], [6.0, 7.0]]'], {'mask': '[[0, 0], [0, 0], [0, 1]]'}), '([[2.0, 3.0], [4.0, 5.0], [6.0, 7.0]], mask=[[0, 0], [0, 0], [0, 1]])\n', (45254, 45323), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((45375, 45471), 'numpy.ma.core.array', 'array', (['[[1.0 / 2, 1.0 / 3], [2.0 / 4, 2.0 / 5], [3.0 / 6, 3]]'], {'mask': '[[0, 0], [0, 0], [0, 1]]'}), '([[1.0 / 2, 1.0 / 3], [2.0 / 4, 2.0 / 5], [3.0 / 6, 3]], mask=[[0, 0],\n [0, 0], [0, 1]])\n', (45380, 45471), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((45495, 45522), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (45507, 45522), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((45531, 45568), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.data', 'control.data'], {}), '(test.data, control.data)\n', (45543, 45568), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((45577, 45614), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (45589, 45614), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((45655, 45751), 'numpy.ma.core.array', 'array', (['[[2 / 1.0, 3 / 1.0], [4 / 2.0, 5 / 2.0], [6 / 3.0, 7]]'], {'mask': '[[0, 0], [0, 0], [0, 1]]'}), '([[2 / 1.0, 3 / 1.0], [4 / 2.0, 5 / 2.0], [6 / 3.0, 7]], mask=[[0, 0],\n [0, 0], [0, 1]])\n', (45660, 45751), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((45775, 45802), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (45787, 45802), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((45811, 45848), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.data', 'control.data'], {}), '(test.data, control.data)\n', (45823, 45848), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((45857, 45894), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (45869, 45894), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((46028, 46099), 'numpy.ma.core.masked_array', 'masked_array', (['[1.0, 2.0, 3.0]'], {'mask': '[False, False, False]', 'shrink': '(False)'}), '([1.0, 2.0, 3.0], mask=[False, False, False], shrink=False)\n', (46040, 46099), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((46148, 46179), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.mask', '[0, 0, 0]'], {}), '(b.mask, [0, 0, 0])\n', (46160, 46179), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((46239, 46270), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[0, 0, 0]'], {}), '(a.mask, [0, 0, 0])\n', (46251, 46270), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((46334, 46365), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.mask', '[0, 0, 0]'], {}), '(b.mask, [0, 0, 0])\n', (46346, 46365), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((46426, 46457), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[0, 0, 0]'], {}), '(a.mask, [0, 0, 0])\n', (46438, 46457), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((46589, 46644), 'numpy.ma.masked_values', 'np.ma.masked_values', (['[1.0, 2.5, 3.1]', '(1.5)'], {'shrink': '(False)'}), '([1.0, 2.5, 3.1], 1.5, shrink=False)\n', (46608, 46644), True, 'import numpy as np\n'), ((46652, 46683), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[0, 0, 0]'], {}), '(a.mask, [0, 0, 0])\n', (46664, 46683), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((46845, 46856), 'numpy.ma.core.mod', 'mod', (['ym', 'xm'], {}), '(ym, xm)\n', (46848, 46856), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((46974, 46985), 'numpy.ma.core.mod', 'mod', (['xm', 'ym'], {}), '(xm, ym)\n', (46977, 46985), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47222, 47232), 'numpy.ma.core.arange', 'arange', (['(24)'], {}), '(24)\n', (47228, 47232), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47245, 47258), 'numpy.arange', 'np.arange', (['(24)'], {}), '(24)\n', (47254, 47258), True, 'import numpy as np\n'), ((47687, 47725), 'numpy.ma.core.array', 'array', (["['abc', 1, 'def', 2, 3]", 'object'], {}), "(['abc', 1, 'def', 2, 3], object)\n", (47692, 47725), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47760, 47778), 'numpy.ma.core.take', 'take', (['y', '[0, 3, 4]'], {}), '(y, [0, 3, 4])\n', (47764, 47778), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47787, 47809), 'numpy.ma.testutils.assert_', 'assert_', (["(t[0] == 'abc')"], {}), "(t[0] == 'abc')\n", (47794, 47809), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((47818, 47836), 'numpy.ma.testutils.assert_', 'assert_', (['(t[1] == 2)'], {}), '(t[1] == 2)\n', (47825, 47836), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((47845, 47863), 'numpy.ma.testutils.assert_', 'assert_', (['(t[2] == 3)'], {}), '(t[2] == 3)\n', (47852, 47863), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((47932, 47974), 'numpy.ma.core.array', 'array', (['[1 + 10.0j, 20 + 2.0j]'], {'mask': '[1, 0]'}), '([1 + 10.0j, 20 + 2.0j], mask=[1, 0])\n', (47937, 47974), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47979, 48009), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.imag', '[10, 2]'], {}), '(xx.imag, [10, 2])\n', (47991, 48009), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((48069, 48117), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.imag.dtype', 'xx._data.imag.dtype'], {}), '(xx.imag.dtype, xx._data.imag.dtype)\n', (48081, 48117), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((48126, 48156), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.real', '[1, 20]'], {}), '(xx.real, [1, 20])\n', (48138, 48156), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((48217, 48265), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.real.dtype', 'xx._data.real.dtype'], {}), '(xx.real.dtype, xx._data.real.dtype)\n', (48229, 48265), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((49633, 49693), 'numpy.ma.core.array', 'array', (['[(1, 1), (2, 2)]'], {'mask': '[(0, 1), (0, 0)]', 'dtype': 'ndtype'}), '([(1, 1), (2, 2)], mask=[(0, 1), (0, 0)], dtype=ndtype)\n', (49638, 49693), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((49726, 49758), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[True, True]'], {}), '(test, [True, True])\n', (49738, 49758), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((49767, 49806), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '[False, False]'], {}), '(test.mask, [False, False])\n', (49779, 49806), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((49819, 49879), 'numpy.ma.core.array', 'array', (['[(1, 1), (2, 2)]'], {'mask': '[(1, 0), (0, 0)]', 'dtype': 'ndtype'}), '([(1, 1), (2, 2)], mask=[(1, 0), (0, 0)], dtype=ndtype)\n', (49824, 49879), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((49912, 49945), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[False, True]'], {}), '(test, [False, True])\n', (49924, 49945), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((49954, 49992), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '[True, False]'], {}), '(test.mask, [True, False])\n', (49966, 49992), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((50005, 50065), 'numpy.ma.core.array', 'array', (['[(1, 1), (2, 2)]'], {'mask': '[(0, 1), (1, 0)]', 'dtype': 'ndtype'}), '([(1, 1), (2, 2)], mask=[(0, 1), (1, 0)], dtype=ndtype)\n', (50010, 50065), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((50098, 50131), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[True, False]'], {}), '(test, [True, False])\n', (50110, 50131), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((50140, 50179), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '[False, False]'], {}), '(test.mask, [False, False])\n', (50152, 50179), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((50321, 50381), 'numpy.ma.core.array', 'array', (['[(1, 1), (2, 2)]'], {'mask': '[(0, 1), (0, 0)]', 'dtype': 'ndtype'}), '([(1, 1), (2, 2)], mask=[(0, 1), (0, 0)], dtype=ndtype)\n', (50326, 50381), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((50414, 50448), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[False, False]'], {}), '(test, [False, False])\n', (50426, 50448), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((50457, 50496), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '[False, False]'], {}), '(test.mask, [False, False])\n', (50469, 50496), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((50509, 50569), 'numpy.ma.core.array', 'array', (['[(1, 1), (2, 2)]'], {'mask': '[(1, 0), (0, 0)]', 'dtype': 'ndtype'}), '([(1, 1), (2, 2)], mask=[(1, 0), (0, 0)], dtype=ndtype)\n', (50514, 50569), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((50602, 50635), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[True, False]'], {}), '(test, [True, False])\n', (50614, 50635), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((50644, 50682), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '[True, False]'], {}), '(test.mask, [True, False])\n', (50656, 50682), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((50695, 50755), 'numpy.ma.core.array', 'array', (['[(1, 1), (2, 2)]'], {'mask': '[(0, 1), (1, 0)]', 'dtype': 'ndtype'}), '([(1, 1), (2, 2)], mask=[(0, 1), (1, 0)], dtype=ndtype)\n', (50700, 50755), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((50788, 50821), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[False, True]'], {}), '(test, [False, True])\n', (50800, 50821), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((50830, 50869), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '[False, False]'], {}), '(test.mask, [False, False])\n', (50842, 50869), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51073, 51099), 'numpy.ma.core.array', 'array', (['[1, 2]'], {'mask': '[0, 1]'}), '([1, 2], mask=[0, 1])\n', (51078, 51099), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((51108, 51138), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a == None)', '(False)'], {}), '(a == None, False)\n', (51120, 51138), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51147, 51182), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a.data == None)', '(False)'], {}), '(a.data == None, False)\n', (51159, 51182), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51191, 51226), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a.mask == None)', '(False)'], {}), '(a.mask == None, False)\n', (51203, 51226), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51235, 51264), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a != None)', '(True)'], {}), '(a != None, True)\n', (51247, 51264), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51299, 51324), 'numpy.ma.core.array', 'array', (['[1, 2]'], {'mask': '(False)'}), '([1, 2], mask=False)\n', (51304, 51324), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((51333, 51363), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a == None)', '(False)'], {}), '(a == None, False)\n', (51345, 51363), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51372, 51401), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a != None)', '(True)'], {}), '(a != None, True)\n', (51384, 51401), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51443, 51467), 'numpy.ma.core.array', 'array', (['[1, 2]'], {'mask': '(True)'}), '([1, 2], mask=True)\n', (51448, 51467), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((51476, 51506), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a == None)', '(False)'], {}), '(a == None, False)\n', (51488, 51506), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51515, 51544), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a != None)', '(True)'], {}), '(a != None, True)\n', (51527, 51544), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51643, 51674), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a == None)', 'masked'], {}), '(a == None, masked)\n', (51655, 51674), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51720, 51728), 'numpy.ma.core.array', 'array', (['(1)'], {}), '(1)\n', (51725, 51728), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((51737, 51763), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a == 1)', '(True)'], {}), '(a == 1, True)\n', (51749, 51763), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51772, 51799), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a == 0)', '(False)'], {}), '(a == 0, False)\n', (51784, 51799), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51808, 51835), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a != 1)', '(False)'], {}), '(a != 1, False)\n', (51820, 51835), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((51844, 51870), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a != 0)', '(True)'], {}), '(a != 0, True)\n', (51856, 51870), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((52001, 52053), 'numpy.ma.core.masked_array', 'masked_array', (['[-1, 0, 1, 2, 3]'], {'mask': '[0, 0, 0, 0, 1]'}), '([-1, 0, 1, 2, 3], mask=[0, 0, 0, 0, 1])\n', (52013, 52053), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((52190, 52196), 'numpy.ma.core.log', 'log', (['a'], {}), '(a)\n', (52193, 52196), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((52205, 52232), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (52217, 52232), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((52241, 52278), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (52253, 52278), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((52287, 52324), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[0, 0, 0, 0, 1]'], {}), '(a.mask, [0, 0, 0, 0, 1])\n', (52299, 52324), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((52341, 52350), 'numpy.log', 'np.log', (['a'], {}), '(a)\n', (52347, 52350), True, 'import numpy as np\n'), ((52359, 52386), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (52371, 52386), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((52395, 52432), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (52407, 52432), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((52441, 52478), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[0, 0, 0, 0, 1]'], {}), '(a.mask, [0, 0, 0, 0, 1])\n', (52453, 52478), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((52601, 52640), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]'}), '([1, 2, 3], mask=[1, 0, 0])\n', (52613, 52640), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((52654, 52669), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {}), '(x)\n', (52666, 52669), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((52678, 52707), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mx.mask', 'x.mask'], {}), '(mx.mask, x.mask)\n', (52690, 52707), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((52721, 52769), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {'mask': '[0, 1, 0]', 'keep_mask': '(False)'}), '(x, mask=[0, 1, 0], keep_mask=False)\n', (52733, 52769), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((52778, 52810), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mx.mask', '[0, 1, 0]'], {}), '(mx.mask, [0, 1, 0])\n', (52790, 52810), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((52824, 52871), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {'mask': '[0, 1, 0]', 'keep_mask': '(True)'}), '(x, mask=[0, 1, 0], keep_mask=True)\n', (52836, 52871), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((52880, 52912), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mx.mask', '[1, 1, 0]'], {}), '(mx.mask, [1, 1, 0])\n', (52892, 52912), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((52955, 52986), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {'mask': '[0, 1, 0]'}), '(x, mask=[0, 1, 0])\n', (52967, 52986), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((52995, 53027), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mx.mask', '[1, 1, 0]'], {}), '(mx.mask, [1, 1, 0])\n', (53007, 53027), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((53095, 53104), 'numpy.ma.core.arange', 'arange', (['(5)'], {}), '(5)\n', (53101, 53104), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((53145, 53157), 'numpy.ma.core.make_mask', 'make_mask', (['n'], {}), '(n)\n', (53154, 53157), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((53171, 53203), 'numpy.ma.core.array', 'array', (['d'], {'mask': 'm', 'hard_mask': '(True)'}), '(d, mask=m, hard_mask=True)\n', (53176, 53203), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((53272, 53316), 'numpy.ma.core.array', 'array', (['d'], {'mask': 'm', 'hard_mask': '(False)', 'copy': '(True)'}), '(d, mask=m, hard_mask=False, copy=True)\n', (53277, 53316), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((53385, 53425), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[0, 10, 2, 3, 4]'], {}), '(xh._data, [0, 10, 2, 3, 4])\n', (53397, 53425), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((53434, 53475), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xs._data', '[0, 10, 2, 3, 40]'], {}), '(xs._data, [0, 10, 2, 3, 40])\n', (53446, 53475), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((53484, 53522), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xs.mask', '[0, 0, 0, 1, 0]'], {}), '(xs.mask, [0, 0, 0, 1, 0])\n', (53496, 53522), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((53673, 53714), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[0, 10, 20, 3, 4]'], {}), '(xh._data, [0, 10, 20, 3, 4])\n', (53685, 53714), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((53723, 53766), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xs._data', '[0, 10, 20, 30, 40]'], {}), '(xs._data, [0, 10, 20, 30, 40])\n', (53735, 53766), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((53775, 53804), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xs.mask', 'nomask'], {}), '(xs.mask, nomask)\n', (53787, 53804), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((53859, 53897), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh.mask', '[1, 0, 0, 1, 1]'], {}), '(xh.mask, [1, 0, 0, 1, 1])\n', (53871, 53897), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((53906, 53944), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xs.mask', '[1, 0, 0, 0, 0]'], {}), '(xs.mask, [1, 0, 0, 0, 0])\n', (53918, 53944), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((53989, 54028), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[0, 1, 1, 3, 4]'], {}), '(xh._data, [0, 1, 1, 3, 4])\n', (54001, 54028), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54037, 54076), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xs._data', '[1, 1, 1, 1, 1]'], {}), '(xs._data, [1, 1, 1, 1, 1])\n', (54049, 54076), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54085, 54123), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh.mask', '[1, 0, 0, 1, 1]'], {}), '(xh.mask, [1, 0, 0, 1, 1])\n', (54097, 54123), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54132, 54161), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xs.mask', 'nomask'], {}), '(xs.mask, nomask)\n', (54144, 54161), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54233, 54242), 'numpy.ma.core.arange', 'arange', (['(5)'], {}), '(5)\n', (54239, 54242), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((54251, 54290), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[0, 1, 2, 3, 4]'], {}), '(xh._data, [0, 1, 2, 3, 4])\n', (54263, 54290), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54299, 54328), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh.mask', 'nomask'], {}), '(xh.mask, nomask)\n', (54311, 54328), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54425, 54464), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[0, 1, 2, 3, 4]'], {}), '(xh._data, [0, 1, 2, 3, 4])\n', (54437, 54464), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54473, 54512), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._mask', '[1, 1, 1, 0, 0]'], {}), '(xh._mask, [1, 1, 1, 0, 0])\n', (54485, 54512), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54559, 54598), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[0, 1, 2, 5, 5]'], {}), '(xh._data, [0, 1, 2, 5, 5])\n', (54571, 54598), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54607, 54646), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._mask', '[1, 1, 1, 0, 0]'], {}), '(xh._mask, [1, 1, 1, 0, 0])\n', (54619, 54646), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54661, 54723), 'numpy.ma.core.array', 'array', (['[[1, 2], [3, 4]]'], {'mask': '[[1, 0], [0, 0]]', 'hard_mask': '(True)'}), '([[1, 2], [3, 4]], mask=[[1, 0], [0, 0]], hard_mask=True)\n', (54666, 54723), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((54750, 54790), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[[1, 0], [3, 4]]'], {}), '(xh._data, [[1, 0], [3, 4]])\n', (54762, 54790), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54799, 54839), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._mask', '[[1, 0], [0, 0]]'], {}), '(xh._mask, [[1, 0], [0, 0]])\n', (54811, 54839), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54871, 54911), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[[1, 0], [3, 5]]'], {}), '(xh._data, [[1, 0], [3, 5]])\n', (54883, 54911), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((54920, 54960), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._mask', '[[1, 0], [0, 0]]'], {}), '(xh._mask, [[1, 0], [0, 0]])\n', (54932, 54960), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((55007, 55047), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[[1, 2], [2, 5]]'], {}), '(xh._data, [[1, 2], [2, 5]])\n', (55019, 55047), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((55056, 55096), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._mask', '[[1, 0], [0, 0]]'], {}), '(xh._mask, [[1, 0], [0, 0]])\n', (55068, 55096), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((55180, 55189), 'numpy.ma.core.arange', 'arange', (['(5)'], {}), '(5)\n', (55186, 55189), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((55230, 55242), 'numpy.ma.core.make_mask', 'make_mask', (['n'], {}), '(n)\n', (55239, 55242), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((55256, 55288), 'numpy.ma.core.array', 'array', (['d'], {'mask': 'm', 'hard_mask': '(True)'}), '(d, mask=m, hard_mask=True)\n', (55261, 55288), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((55341, 55382), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[999, 1, 2, 3, 4]'], {}), '(xh._data, [999, 1, 2, 3, 4])\n', (55353, 55382), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((55557, 55589), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]'}), '([1, 2, 3], mask=[1, 0, 0])\n', (55562, 55589), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((55626, 55644), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', 'b'], {}), '(a, b)\n', (55638, 55644), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((55670, 55688), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', 'b'], {}), '(a, b)\n', (55682, 55688), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((55800, 55818), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', 'b'], {}), '(a, b)\n', (55812, 55818), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((55965, 55975), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (55971, 55975), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((56023, 56052), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a._mask', 'nomask'], {}), '(a._mask, nomask)\n', (56035, 56052), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((56065, 56075), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (56071, 56075), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((56261, 56293), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 0]'}), '([1, 2, 3], mask=[0, 0, 0])\n', (56266, 56293), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((56330, 56348), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', 'b'], {}), '(a, b)\n', (56342, 56348), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((56357, 56385), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', 'nomask'], {}), '(a.mask, nomask)\n', (56369, 56385), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((56587, 56616), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.flat[1]', '(2)'], {}), '(test.flat[1], 2)\n', (56599, 56616), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((56625, 56659), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.flat[2]', 'masked'], {}), '(test.flat[2], masked)\n', (56637, 56659), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((56851, 56890), 'numpy.ma.core.masked_array', 'masked_array', (['[3, 2, 1]'], {'mask': '[1, 0, 0]'}), '([3, 2, 1], mask=[1, 0, 0])\n', (56863, 56890), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((56970, 56997), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (56982, 56997), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((57168, 57195), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (57180, 57195), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((57228, 57255), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test[0, 0]', '(9)'], {}), '(test[0, 0], 9)\n', (57240, 57255), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((57352, 57522), 'numpy.ma.core.array', 'array', (["[[(1, 1.1, 'one'), (2, 2.2, 'two'), (3, 3.3, 'thr')], [(4, 4.4, 'fou'), (5,\n 5.5, 'fiv'), (6, 6.6, 'six')]]"], {'dtype': "[('a', int), ('b', float), ('c', '|S8')]"}), "([[(1, 1.1, 'one'), (2, 2.2, 'two'), (3, 3.3, 'thr')], [(4, 4.4, 'fou'\n ), (5, 5.5, 'fiv'), (6, 6.6, 'six')]], dtype=[('a', int), ('b', float),\n ('c', '|S8')])\n", (57357, 57522), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((57699, 57730), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xflat[0]', 'x[0, 0]'], {}), '(xflat[0], x[0, 0])\n', (57711, 57730), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((57739, 57770), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xflat[1]', 'x[0, 1]'], {}), '(xflat[1], x[0, 1])\n', (57751, 57770), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((57779, 57810), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xflat[2]', 'x[0, 2]'], {}), '(xflat[2], x[0, 2])\n', (57791, 57810), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((57819, 57848), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xflat[:3]', 'x[0]'], {}), '(xflat[:3], x[0])\n', (57831, 57848), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((57857, 57888), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xflat[3]', 'x[1, 0]'], {}), '(xflat[3], x[1, 0])\n', (57869, 57888), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((57897, 57928), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xflat[4]', 'x[1, 1]'], {}), '(xflat[4], x[1, 1])\n', (57909, 57928), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((57937, 57968), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xflat[5]', 'x[1, 2]'], {}), '(xflat[5], x[1, 2])\n', (57949, 57968), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((57977, 58006), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xflat[3:]', 'x[1]'], {}), '(xflat[3:], x[1])\n', (57989, 58006), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((58015, 58049), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xflat[-1]', 'x[-1, -1]'], {}), '(xflat[-1], x[-1, -1])\n', (58027, 58049), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((58615, 58641), 'numpy.zeros', 'np.zeros', (['(4)'], {'dtype': '"""f4,i4"""'}), "(4, dtype='f4,i4')\n", (58623, 58641), True, 'import numpy as np\n'), ((58655, 58669), 'numpy.ma.array', 'np.ma.array', (['a'], {}), '(a)\n', (58666, 58669), True, 'import numpy as np\n'), ((58688, 58702), 'numpy.dtype', 'np.dtype', (['"""f4"""'], {}), "('f4')\n", (58696, 58702), True, 'import numpy as np\n'), ((58971, 59004), 'numpy.testing.assert_raises', 'assert_raises', (['ValueError', 'assign'], {}), '(ValueError, assign)\n', (58984, 59004), False, 'from numpy.testing import TestCase, run_module_suite, assert_raises\n'), ((59172, 59195), 'numpy.zeros', 'np.zeros', (['(4)'], {'dtype': '"""f4"""'}), "(4, dtype='f4')\n", (59180, 59195), True, 'import numpy as np\n'), ((59208, 59222), 'numpy.ma.array', 'np.ma.array', (['a'], {}), '(a)\n', (59219, 59222), True, 'import numpy as np\n'), ((59241, 59258), 'numpy.dtype', 'np.dtype', (['"""f4,i4"""'], {}), "('f4,i4')\n", (59249, 59258), True, 'import numpy as np\n'), ((59316, 59351), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['m._mask', 'np.ma.nomask'], {}), '(m._mask, np.ma.nomask)\n', (59328, 59351), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((59598, 59619), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['fval', '(0)'], {}), '(fval, 0)\n', (59610, 59619), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((60912, 60962), 'numpy.array', 'np.array', (["(-999, -12345678.9, '???')"], {'dtype': 'ndtype'}), "((-999, -12345678.9, '???'), dtype=ndtype)\n", (60920, 60962), True, 'import numpy as np\n'), ((61505, 61593), 'numpy.array', 'np.array', (["('???', -999, -12345678.9)"], {'dtype': "[('c', '|S3'), ('a', int), ('b', float)]"}), "(('???', -999, -12345678.9), dtype=[('c', '|S3'), ('a', int), ('b',\n float)])\n", (61513, 61593), True, 'import numpy as np\n'), ((61873, 61909), 'numpy.ndarray', 'np.ndarray', ([], {'shape': '(1,)', 'dtype': 'object'}), '(shape=(1,), dtype=object)\n', (61883, 61909), True, 'import numpy as np\n'), ((63080, 63099), 'numpy.ma.core.array', 'array', (['a'], {'dtype': 'int'}), '(a, dtype=int)\n', (63085, 63099), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((63108, 63140), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._data', '[3, 4, 5]'], {}), '(b._data, [3, 4, 5])\n', (63120, 63140), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((63212, 63233), 'numpy.ma.core.array', 'array', (['a'], {'dtype': 'float'}), '(a, dtype=float)\n', (63217, 63233), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((63242, 63274), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._data', '[3, 4, 5]'], {}), '(b._data, [3, 4, 5])\n', (63254, 63274), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((63369, 63401), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._data', '[3, 4, 5]'], {}), '(b._data, [3, 4, 5])\n', (63381, 63401), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((63468, 63515), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["b._optinfo['comment']", '"""updated!"""'], {}), "(b._optinfo['comment'], 'updated!')\n", (63480, 63515), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((63562, 63597), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["b['a']._data", 'a._data'], {}), "(b['a']._data, a._data)\n", (63574, 63597), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((63606, 63651), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["b['a'].fill_value", 'a.fill_value'], {}), "(b['a'].fill_value, a.fill_value)\n", (63618, 63651), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((63741, 63781), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3]'], {'fill_value': '(-999)'}), '([1, 2, 3], fill_value=-999)\n', (63753, 63781), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((63823, 63873), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['series._fill_value', 'data._fill_value'], {}), '(series._fill_value, data._fill_value)\n', (63835, 63873), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((63932, 63984), 'numpy.ma.core.array', 'array', (["[(1, 'a'), (2, 'b'), (pi, 'pi')]"], {'dtype': 'mtype'}), "([(1, 'a'), (2, 'b'), (pi, 'pi')], dtype=mtype)\n", (63937, 63984), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((64086, 64122), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["x['f'].fill_value", '(999)'], {}), "(x['f'].fill_value, 999)\n", (64098, 64122), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((64285, 64319), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["x['f'].fill_value", '(9)'], {}), "(x['f'].fill_value, 9)\n", (64297, 64319), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((64389, 64407), 'numpy.ma.core.array', 'array', (['[1, 2, 3.1]'], {}), '([1, 2, 3.1])\n', (64394, 64407), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((64503, 64536), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.fill_value', '(999.0)'], {}), '(x.fill_value, 999.0)\n', (64515, 64536), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((65466, 65500), 'numpy.dtype', 'np.dtype', (['"""int, (2,3)float, float"""'], {}), "('int, (2,3)float, float')\n", (65474, 65500), True, 'import numpy as np\n'), ((65782, 65809), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (65794, 65809), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((66059, 66080), 'numpy.ma.core.masked_array', 'masked_array', (['control'], {}), '(control)\n', (66071, 66080), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((66089, 66129), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["M['f1'].fill_value.ndim", '(0)'], {}), "(M['f1'].fill_value.ndim, 0)\n", (66101, 66129), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((66923, 67016), 'numpy.ma.core.array', 'array', (['[(1, (2, 3)), (4, (5, 6))]'], {'dtype': "[('A', int), ('B', [('BA', int), ('BB', int)])]"}), "([(1, (2, 3)), (4, (5, 6))], dtype=[('A', int), ('B', [('BA', int), (\n 'BB', int)])])\n", (66928, 67016), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67278, 67299), 'numpy.ma.core.minimum_fill_value', 'minimum_fill_value', (['a'], {}), '(a)\n', (67296, 67299), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67566, 67587), 'numpy.ma.core.maximum_fill_value', 'maximum_fill_value', (['a'], {}), '(a)\n', (67584, 67587), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((68957, 68995), 'numpy.ma.core.empty', 'empty', (['a.shape'], {'dtype': '[adtype, ndtype]'}), '(a.shape, dtype=[adtype, ndtype])\n', (68962, 68995), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((69304, 69330), 'numpy.ma.core.empty', 'empty', (['(3)'], {'fill_value': '(999.0)'}), '(3, fill_value=999.0)\n', (69309, 69330), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((69338, 69371), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.fill_value', '(999.0)'], {}), '(a.fill_value, 999.0)\n', (69350, 69371), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((69384, 69422), 'numpy.ma.core.ones', 'ones', (['(3)'], {'fill_value': '(999.0)', 'dtype': 'float'}), '(3, fill_value=999.0, dtype=float)\n', (69388, 69422), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((69430, 69463), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.fill_value', '(999.0)'], {}), '(a.fill_value, 999.0)\n', (69442, 69463), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((69476, 69515), 'numpy.ma.core.zeros', 'zeros', (['(3)'], {'fill_value': '(0.0)', 'dtype': 'complex'}), '(3, fill_value=0.0, dtype=complex)\n', (69481, 69515), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((69523, 69554), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.fill_value', '(0.0)'], {}), '(a.fill_value, 0.0)\n', (69535, 69554), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((69567, 69609), 'numpy.ma.core.identity', 'identity', (['(3)'], {'fill_value': '(0.0)', 'dtype': 'complex'}), '(3, fill_value=0.0, dtype=complex)\n', (69575, 69609), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((69617, 69648), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.fill_value', '(0.0)'], {}), '(a.fill_value, 0.0)\n', (69629, 69648), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((69777, 69794), 'numpy.ma.core.empty', 'empty', ([], {'shape': '(3,)'}), '(shape=(3,))\n', (69782, 69794), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((69804, 69831), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.shape', '(3,)'], {}), '(a.shape, (3,))\n', (69816, 69831), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((69846, 69875), 'numpy.ma.core.ones', 'ones', ([], {'shape': '(3,)', 'dtype': 'float'}), '(shape=(3,), dtype=float)\n', (69850, 69875), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((69885, 69912), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.shape', '(3,)'], {}), '(a.shape, (3,))\n', (69897, 69912), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((69927, 69959), 'numpy.ma.core.zeros', 'zeros', ([], {'shape': '(3,)', 'dtype': 'complex'}), '(shape=(3,), dtype=complex)\n', (69932, 69959), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((69969, 69996), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.shape', '(3,)'], {}), '(a.shape, (3,))\n', (69981, 69996), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((70138, 70184), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'fill_value': '(1)', 'dtype': 'np.int64'}), '([1, 2, 3], fill_value=1, dtype=np.int64)\n', (70143, 70184), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((70271, 70297), 'numpy.ma.testutils.assert_', 'assert_', (['(y.fill_value == 1)'], {}), '(y.fill_value == 1)\n', (70278, 70297), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((70486, 70512), 'numpy.ma.testutils.assert_', 'assert_', (['(y.fill_value == 1)'], {}), '(y.fill_value == 1)\n', (70493, 70512), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((70767, 70793), 'numpy.ma.testutils.assert_', 'assert_', (['(y.fill_value == 1)'], {}), '(y.fill_value == 1)\n', (70774, 70793), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((71102, 71128), 'numpy.ma.testutils.assert_', 'assert_', (['(y.fill_value == 2)'], {}), '(y.fill_value == 2)\n', (71109, 71128), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((71263, 71289), 'numpy.ma.testutils.assert_', 'assert_', (['(y.fill_value == 2)'], {}), '(y.fill_value == 2)\n', (71270, 71289), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((71680, 71711), 'numpy.ma.testutils.assert_', 'assert_', (['(y.fill_value == 999999)'], {}), '(y.fill_value == 999999)\n', (71687, 71711), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((71895, 71933), 'numpy.ma.core.empty', 'empty', ([], {'shape': '(3,)', 'dtype': '"""(2)3S,(2)3U"""'}), "(shape=(3,), dtype='(2)3S,(2)3U')\n", (71900, 71933), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((72397, 72408), 'numpy.geterr', 'np.geterr', ([], {}), '()\n', (72406, 72408), True, 'import numpy as np\n'), ((72417, 72461), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (72426, 72461), True, 'import numpy as np\n'), ((72495, 72523), 'numpy.seterr', 'np.seterr', ([], {}), '(**self.err_status)\n', (72504, 72523), True, 'import numpy as np\n'), ((74182, 74204), 'numpy.ma.core.masked_where', 'masked_where', (['(a < 5)', 'a'], {}), '(a < 5, a)\n', (74194, 74204), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((74597, 74649), 'numpy.ma.core.masked_array', 'masked_array', (['[-1, 0, 1, 2, 3]'], {'mask': '[0, 0, 0, 0, 1]'}), '([-1, 0, 1, 2, 3], mask=[0, 0, 0, 0, 1])\n', (74609, 74649), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((74665, 74675), 'numpy.sqrt', 'np.sqrt', (['a'], {}), '(a)\n', (74672, 74675), True, 'import numpy as np\n'), ((74796, 74823), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (74808, 74823), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((74832, 74869), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'control.mask'], {}), '(test.mask, control.mask)\n', (74844, 74869), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((75066, 75103), 'numpy.ma.core.masked_array', 'masked_array', (['[1.0, 2.0]'], {'mask': '[1, 0]'}), '([1.0, 2.0], mask=[1, 0])\n', (75078, 75103), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((75494, 75521), 'numpy.ma.testutils.assert_', 'assert_', (["(me * a == 'My mul')"], {}), "(me * a == 'My mul')\n", (75501, 75521), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((75530, 75558), 'numpy.ma.testutils.assert_', 'assert_', (["(a * me == 'My rmul')"], {}), "(a * me == 'My rmul')\n", (75537, 75558), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((76142, 76173), 'numpy.ma.testutils.assert_', 'assert_', (["(me_too * a == 'Me2mul')"], {}), "(me_too * a == 'Me2mul')\n", (76149, 76173), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((76182, 76214), 'numpy.ma.testutils.assert_', 'assert_', (["(a * me_too == 'Me2rmul')"], {}), "(a * me_too == 'Me2rmul')\n", (76189, 76214), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((76223, 76255), 'numpy.ma.testutils.assert_', 'assert_', (["(a / me_too == 'Me2rdiv')"], {}), "(a / me_too == 'Me2rdiv')\n", (76230, 76255), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((76399, 76438), 'numpy.ma.array', 'np.ma.array', (['[0.5, np.nan]'], {'mask': '[0, 1]'}), '([0.5, np.nan], mask=[0, 1])\n', (76410, 76438), True, 'import numpy as np\n'), ((77079, 77089), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (77085, 77089), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((77102, 77112), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (77108, 77112), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((77126, 77136), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (77132, 77136), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((77716, 77738), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y + 1)'], {}), '(x, y + 1)\n', (77728, 77738), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((77763, 77786), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y + 1)'], {}), '(xm, y + 1)\n', (77775, 77786), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((77882, 77917), 'numpy.ma.testutils.assert_', 'assert_', (['(id1 == x.data.ctypes._data)'], {}), '(id1 == x.data.ctypes._data)\n', (77889, 77917), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((77926, 77950), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y + 1.0)'], {}), '(x, y + 1.0)\n', (77938, 77950), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((78096, 78122), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 'np.int16'}), '(10, dtype=np.int16)\n', (78102, 78122), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((78185, 78207), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y + a)'], {}), '(x, y + a)\n', (78197, 78207), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((78216, 78239), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y + a)'], {}), '(xm, y + a)\n', (78228, 78239), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((78434, 78456), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y - 1)'], {}), '(x, y - 1)\n', (78446, 78456), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((78481, 78504), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y - 1)'], {}), '(xm, y - 1)\n', (78493, 78504), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((78659, 78682), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 'float'}), '(10, dtype=float)\n', (78665, 78682), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((78745, 78767), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y - a)'], {}), '(x, y - a)\n', (78757, 78767), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((78776, 78799), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y - a)'], {}), '(xm, y - a)\n', (78788, 78799), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((79003, 79025), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y * 2)'], {}), '(x, y * 2)\n', (79015, 79025), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((79052, 79075), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y * 2)'], {}), '(xm, y * 2)\n', (79064, 79075), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((79235, 79258), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 'float'}), '(10, dtype=float)\n', (79241, 79258), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((79321, 79343), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y * a)'], {}), '(x, y * a)\n', (79333, 79343), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((79352, 79375), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y * a)'], {}), '(xm, y * a)\n', (79364, 79375), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((79646, 79664), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', 'y'], {}), '(x, y)\n', (79658, 79664), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((79690, 79709), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', 'y'], {}), '(xm, y)\n', (79702, 79709), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((79857, 79881), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y / 2.0)'], {}), '(x, y / 2.0)\n', (79869, 79881), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((79896, 79906), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (79902, 79906), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((80098, 80121), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 'float'}), '(10, dtype=float)\n', (80104, 80121), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((80184, 80206), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y / a)'], {}), '(x, y / a)\n', (80196, 80206), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((80215, 80238), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y / a)'], {}), '(xm, y / a)\n', (80227, 80238), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((80601, 80625), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {'mask': 'm1'}), '(x, mask=m1)\n', (80613, 80625), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((80639, 80663), 'numpy.ma.core.masked_array', 'masked_array', (['y'], {'mask': 'm2'}), '(y, mask=m2)\n', (80651, 80663), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((80693, 80752), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z._mask', '[1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1]'], {}), '(z._mask, [1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1])\n', (80705, 80752), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((80761, 80856), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z._data', '[1.0, 1.0, 1.0, -1.0, -pi / 2.0, 4.0, 5.0, 1.0, 1.0, 1.0, 2.0, 3.0]'], {}), '(z._data, [1.0, 1.0, 1.0, -1.0, -pi / 2.0, 4.0, 5.0, 1.0, 1.0, \n 1.0, 2.0, 3.0])\n', (80773, 80856), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((80910, 80970), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm._mask', '[1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1]'], {}), '(xm._mask, [1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1])\n', (80922, 80970), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((80979, 81074), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z._data', '[1.0, 1.0, 1.0, -1.0, -pi / 2.0, 4.0, 5.0, 1.0, 1.0, 1.0, 2.0, 3.0]'], {}), '(z._data, [1.0, 1.0, 1.0, -1.0, -pi / 2.0, 4.0, 5.0, 1.0, 1.0, \n 1.0, 2.0, 3.0])\n', (80991, 81074), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((81179, 81211), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (81184, 81211), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((81268, 81300), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.data', '[2, 3, 3]'], {}), '(xx.data, [2, 3, 3])\n', (81280, 81300), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((81309, 81341), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.mask', '[0, 0, 1]'], {}), '(xx.mask, [0, 0, 1])\n', (81321, 81341), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((81395, 81426), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.data', '[2, 3, 3]'], {}), '(x.data, [2, 3, 3])\n', (81407, 81426), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((81435, 81466), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[0, 0, 1]'], {}), '(x.mask, [0, 0, 1])\n', (81447, 81466), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((81507, 81539), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (81512, 81539), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((81598, 81630), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.data', '[1, 4, 3]'], {}), '(xx.data, [1, 4, 3])\n', (81610, 81630), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((81639, 81671), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.mask', '[1, 0, 1]'], {}), '(xx.mask, [1, 0, 1])\n', (81651, 81671), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((81713, 81745), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (81718, 81745), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((81759, 81791), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]'}), '([1, 2, 3], mask=[1, 0, 0])\n', (81764, 81791), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((81800, 81831), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.data', '[1, 4, 3]'], {}), '(x.data, [1, 4, 3])\n', (81812, 81831), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((81840, 81871), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[1, 0, 1]'], {}), '(x.mask, [1, 0, 1])\n', (81852, 81871), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((82004, 82036), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (82009, 82036), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((82064, 82096), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.data', '[0, 1, 3]'], {}), '(xx.data, [0, 1, 3])\n', (82076, 82096), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((82105, 82137), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.mask', '[0, 0, 1]'], {}), '(xx.mask, [0, 0, 1])\n', (82117, 82137), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((82180, 82212), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (82185, 82212), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((82236, 82267), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.data', '[0, 1, 3]'], {}), '(x.data, [0, 1, 3])\n', (82248, 82267), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((82276, 82307), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[0, 0, 1]'], {}), '(x.mask, [0, 0, 1])\n', (82288, 82307), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((82348, 82380), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (82353, 82380), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((82439, 82471), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.data', '[1, 0, 3]'], {}), '(xx.data, [1, 0, 3])\n', (82451, 82471), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((82480, 82512), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.mask', '[1, 0, 1]'], {}), '(xx.mask, [1, 0, 1])\n', (82492, 82512), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((82554, 82586), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (82559, 82586), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((82600, 82632), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]'}), '([1, 2, 3], mask=[1, 0, 0])\n', (82605, 82632), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((82641, 82672), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.data', '[1, 0, 3]'], {}), '(x.data, [1, 0, 3])\n', (82653, 82672), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((82681, 82712), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[1, 0, 1]'], {}), '(x.mask, [1, 0, 1])\n', (82693, 82712), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((82848, 82880), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (82853, 82880), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((82908, 82940), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.data', '[2, 4, 3]'], {}), '(xx.data, [2, 4, 3])\n', (82920, 82940), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((82949, 82981), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.mask', '[0, 0, 1]'], {}), '(xx.mask, [0, 0, 1])\n', (82961, 82981), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((83024, 83056), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (83029, 83056), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((83080, 83111), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.data', '[2, 4, 3]'], {}), '(x.data, [2, 4, 3])\n', (83092, 83111), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((83120, 83151), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[0, 0, 1]'], {}), '(x.mask, [0, 0, 1])\n', (83132, 83151), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((83192, 83224), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (83197, 83224), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((83286, 83319), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.data', '[1, 40, 3]'], {}), '(xx.data, [1, 40, 3])\n', (83298, 83319), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((83328, 83360), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.mask', '[1, 0, 1]'], {}), '(xx.mask, [1, 0, 1])\n', (83340, 83360), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((83402, 83434), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (83407, 83434), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((83448, 83483), 'numpy.ma.core.array', 'array', (['[10, 20, 30]'], {'mask': '[1, 0, 0]'}), '([10, 20, 30], mask=[1, 0, 0])\n', (83453, 83483), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((83492, 83524), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.data', '[1, 40, 3]'], {}), '(x.data, [1, 40, 3])\n', (83504, 83524), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((83533, 83564), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[1, 0, 1]'], {}), '(x.mask, [1, 0, 1])\n', (83545, 83564), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((83694, 83726), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (83699, 83726), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((83755, 83799), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.data', '[1 / 2.0, 2 / 2.0, 3]'], {}), '(xx.data, [1 / 2.0, 2 / 2.0, 3])\n', (83767, 83799), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((83806, 83838), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.mask', '[0, 0, 1]'], {}), '(xx.mask, [0, 0, 1])\n', (83818, 83838), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((83881, 83919), 'numpy.ma.core.array', 'array', (['[1.0, 2.0, 3.0]'], {'mask': '[0, 0, 1]'}), '([1.0, 2.0, 3.0], mask=[0, 0, 1])\n', (83886, 83919), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((83941, 83984), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.data', '[1 / 2.0, 2 / 2.0, 3]'], {}), '(x.data, [1 / 2.0, 2 / 2.0, 3])\n', (83953, 83984), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((83991, 84022), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[0, 0, 1]'], {}), '(x.mask, [0, 0, 1])\n', (84003, 84022), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((84063, 84101), 'numpy.ma.core.array', 'array', (['[1.0, 2.0, 3.0]'], {'mask': '[0, 0, 1]'}), '([1.0, 2.0, 3.0], mask=[0, 0, 1])\n', (84068, 84101), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((84163, 84208), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.data', '[1.0, 2.0 / 20.0, 3.0]'], {}), '(xx.data, [1.0, 2.0 / 20.0, 3.0])\n', (84175, 84208), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((84213, 84245), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.mask', '[1, 0, 1]'], {}), '(xx.mask, [1, 0, 1])\n', (84225, 84245), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((84287, 84325), 'numpy.ma.core.array', 'array', (['[1.0, 2.0, 3.0]'], {'mask': '[0, 0, 1]'}), '([1.0, 2.0, 3.0], mask=[0, 0, 1])\n', (84292, 84325), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((84336, 84377), 'numpy.ma.core.array', 'array', (['[10.0, 20.0, 30.0]'], {'mask': '[1, 0, 0]'}), '([10.0, 20.0, 30.0], mask=[1, 0, 0])\n', (84341, 84377), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((84383, 84425), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.data', '[1.0, 2 / 20.0, 3.0]'], {}), '(x.data, [1.0, 2 / 20.0, 3.0])\n', (84395, 84425), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((84431, 84462), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[1, 0, 1]'], {}), '(x.mask, [1, 0, 1])\n', (84443, 84462), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((84589, 84627), 'numpy.ma.core.array', 'array', (['[1.0, 2.0, 3.0]'], {'mask': '[0, 0, 1]'}), '([1.0, 2.0, 3.0], mask=[0, 0, 1])\n', (84594, 84627), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((84655, 84700), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.data', '[1.0, 2.0 ** 2.5, 3.0]'], {}), '(xx.data, [1.0, 2.0 ** 2.5, 3.0])\n', (84667, 84700), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((84706, 84738), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.mask', '[0, 0, 1]'], {}), '(xx.mask, [0, 0, 1])\n', (84718, 84738), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((84795, 84837), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.data', '[1.0, 2.0 ** 2.5, 3]'], {}), '(x.data, [1.0, 2.0 ** 2.5, 3])\n', (84807, 84837), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((84844, 84875), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[0, 0, 1]'], {}), '(x.mask, [0, 0, 1])\n', (84856, 84875), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((84933, 84956), 'numpy.ma.core.array', 'array', (['[[1, 1], [3, 3]]'], {}), '([[1, 1], [3, 3]])\n', (84938, 84956), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((84969, 84995), 'numpy.ma.core.array', 'array', (['[1, 1]'], {'mask': '[0, 0]'}), '([1, 1], mask=[0, 0])\n', (84974, 84995), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((85019, 85052), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', '[[2, 2], [4, 4]]'], {}), '(a, [[2, 2], [4, 4]])\n', (85031, 85052), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((85150, 85173), 'numpy.ma.core.array', 'array', (['[[1, 1], [3, 3]]'], {}), '([[1, 1], [3, 3]])\n', (85155, 85173), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((85186, 85212), 'numpy.ma.core.array', 'array', (['[1, 1]'], {'mask': '[0, 1]'}), '([1, 1], mask=[0, 1])\n', (85191, 85212), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((85236, 85269), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', '[[2, 2], [4, 4]]'], {}), '(a, [[2, 2], [4, 4]])\n', (85248, 85269), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((85278, 85316), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[[0, 1], [0, 1]]'], {}), '(a.mask, [[0, 1], [0, 1]])\n', (85290, 85316), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((85374, 85397), 'numpy.ma.core.array', 'array', (['[[1, 1], [3, 3]]'], {}), '([[1, 1], [3, 3]])\n', (85379, 85397), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((85410, 85436), 'numpy.ma.core.array', 'array', (['[1, 1]'], {'mask': '[0, 0]'}), '([1, 1], mask=[0, 0])\n', (85415, 85436), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((85460, 85493), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', '[[0, 0], [2, 2]]'], {}), '(a, [[0, 0], [2, 2]])\n', (85472, 85493), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((85591, 85614), 'numpy.ma.core.array', 'array', (['[[1, 1], [3, 3]]'], {}), '([[1, 1], [3, 3]])\n', (85596, 85614), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((85627, 85653), 'numpy.ma.core.array', 'array', (['[1, 1]'], {'mask': '[0, 1]'}), '([1, 1], mask=[0, 1])\n', (85632, 85653), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((85677, 85710), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', '[[0, 0], [2, 2]]'], {}), '(a, [[0, 0], [2, 2]])\n', (85689, 85710), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((85719, 85757), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[[0, 1], [0, 1]]'], {}), '(a.mask, [[0, 1], [0, 1]])\n', (85731, 85757), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((85815, 85838), 'numpy.ma.core.array', 'array', (['[[1, 1], [3, 3]]'], {}), '([[1, 1], [3, 3]])\n', (85820, 85838), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((85851, 85877), 'numpy.ma.core.array', 'array', (['[1, 1]'], {'mask': '[0, 0]'}), '([1, 1], mask=[0, 0])\n', (85856, 85877), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((85901, 85934), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', '[[1, 1], [3, 3]]'], {}), '(a, [[1, 1], [3, 3]])\n', (85913, 85934), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((86032, 86055), 'numpy.ma.core.array', 'array', (['[[1, 1], [3, 3]]'], {}), '([[1, 1], [3, 3]])\n', (86037, 86055), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((86068, 86094), 'numpy.ma.core.array', 'array', (['[1, 1]'], {'mask': '[0, 1]'}), '([1, 1], mask=[0, 1])\n', (86073, 86094), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((86118, 86151), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', '[[1, 1], [3, 3]]'], {}), '(a, [[1, 1], [3, 3]])\n', (86130, 86151), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((86160, 86198), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[[0, 1], [0, 1]]'], {}), '(a.mask, [[0, 1], [0, 1]])\n', (86172, 86198), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((95177, 95447), 'numpy.array', 'np.array', (['[8.375, 7.545, 8.828, 8.5, 1.757, 5.928, 8.43, 7.78, 9.865, 5.878, 8.979, \n 4.732, 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04, 9.63, 7.712, \n 3.382, 4.489, 6.479, 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, 7.357, \n 9.828, 6.272, 3.758, 6.693, 0.993]'], {}), '([8.375, 7.545, 8.828, 8.5, 1.757, 5.928, 8.43, 7.78, 9.865, 5.878,\n 8.979, 4.732, 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04, 9.63, \n 7.712, 3.382, 4.489, 6.479, 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, \n 7.357, 9.828, 6.272, 3.758, 6.693, 0.993])\n', (95185, 95447), True, 'import numpy as np\n'), ((95620, 95742), 'numpy.array', 'np.array', (['[0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1,\n 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0]'], {}), '([0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1,\n 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0])\n', (95628, 95742), True, 'import numpy as np\n'), ((95857, 95878), 'numpy.ma.core.array', 'array', ([], {'data': 'x', 'mask': 'm'}), '(data=x, mask=m)\n', (95862, 95878), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((96000, 96122), 'numpy.array', 'np.array', (['[1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1,\n 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1]'], {}), '([1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,\n 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1])\n', (96008, 96122), True, 'import numpy as np\n'), ((96243, 96265), 'numpy.ma.core.array', 'array', ([], {'data': 'x', 'mask': 'm2'}), '(data=x, mask=m2)\n', (96248, 96265), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((96528, 96544), 'numpy.ma.core.array', 'array', (['[1, 3, 2]'], {}), '([1, 3, 2])\n', (96533, 96544), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((97004, 97027), 'numpy.ma.core.array', 'array', (['[[1, 2], [3, 4]]'], {}), '([[1, 2], [3, 4]])\n', (97009, 97027), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((97321, 97339), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (97335, 97339), True, 'import numpy as np\n'), ((97628, 97643), 'numpy.ma.core.masked_array', 'masked_array', (['a'], {}), '(a)\n', (97640, 97643), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((98186, 98254), 'numpy.array', 'np.array', (['[[0.13, 0.26, 0.9], [0.28, 0.33, 0.63], [0.31, 0.87, 0.7]]'], {}), '([[0.13, 0.26, 0.9], [0.28, 0.33, 0.63], [0.31, 0.87, 0.7]])\n', (98194, 98254), True, 'import numpy as np\n'), ((98313, 98409), 'numpy.array', 'np.array', (['[[True, False, False], [False, False, False], [True, True, False]]'], {'dtype': 'np.bool_'}), '([[True, False, False], [False, False, False], [True, True, False]],\n dtype=np.bool_)\n', (98321, 98409), True, 'import numpy as np\n'), ((98463, 98486), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {'mask': 'm'}), '(x, mask=m)\n', (98475, 98486), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((99210, 99278), 'numpy.array', 'np.array', (['[[0.13, 0.26, 0.9], [0.28, 0.33, 0.63], [0.31, 0.87, 0.7]]'], {}), '([[0.13, 0.26, 0.9], [0.28, 0.33, 0.63], [0.31, 0.87, 0.7]])\n', (99218, 99278), True, 'import numpy as np\n'), ((99337, 99349), 'numpy.matrix', 'np.matrix', (['x'], {}), '(x)\n', (99346, 99349), True, 'import numpy as np\n'), ((99362, 99458), 'numpy.array', 'np.array', (['[[True, False, False], [False, False, False], [True, True, False]]'], {'dtype': 'np.bool_'}), '([[True, False, False], [False, False, False], [True, True, False]],\n dtype=np.bool_)\n', (99370, 99458), True, 'import numpy as np\n'), ((99512, 99535), 'numpy.ma.core.masked_array', 'masked_array', (['X'], {'mask': 'm'}), '(X, mask=m)\n', (99524, 99535), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((100393, 100414), 'numpy.ma.core.empty', 'empty', (['()'], {'dtype': 'bool'}), '((), dtype=bool)\n', (100398, 100414), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((100430, 100457), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '(True)'}), '([1, 2, 3], mask=True)\n', (100435, 100457), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((100669, 100690), 'numpy.ma.core.empty', 'empty', (['()'], {'dtype': 'bool'}), '((), dtype=bool)\n', (100674, 100690), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((101863, 102133), 'numpy.array', 'np.array', (['[8.375, 7.545, 8.828, 8.5, 1.757, 5.928, 8.43, 7.78, 9.865, 5.878, 8.979, \n 4.732, 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04, 9.63, 7.712, \n 3.382, 4.489, 6.479, 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, 7.357, \n 9.828, 6.272, 3.758, 6.693, 0.993]'], {}), '([8.375, 7.545, 8.828, 8.5, 1.757, 5.928, 8.43, 7.78, 9.865, 5.878,\n 8.979, 4.732, 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04, 9.63, \n 7.712, 3.382, 4.489, 6.479, 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, \n 7.357, 9.828, 6.272, 3.758, 6.693, 0.993])\n', (101871, 102133), True, 'import numpy as np\n'), ((102242, 102364), 'numpy.array', 'np.array', (['[0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1,\n 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0]'], {}), '([0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1,\n 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0])\n', (102250, 102364), True, 'import numpy as np\n'), ((102418, 102434), 'numpy.ma.core.array', 'array', (['x'], {'mask': 'm'}), '(x, mask=m)\n', (102423, 102434), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((102475, 102510), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['clipped.mask', 'mx.mask'], {}), '(clipped.mask, mx.mask)\n', (102487, 102510), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((102684, 102740), 'numpy.ma.core.masked_array', 'masked_array', (['[1.0, 2.0, 3.0, 4.0, 5.0]'], {'fill_value': '(9999)'}), '([1.0, 2.0, 3.0, 4.0, 5.0], fill_value=9999)\n', (102696, 102740), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((102902, 102935), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._data', '[2.0, 3.0]'], {}), '(b._data, [2.0, 3.0])\n', (102914, 102935), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((102942, 102971), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._mask', '[0, 1]'], {}), '(b._mask, [0, 1])\n', (102954, 102971), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((102980, 103012), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.fill_value', '(9999)'], {}), '(b.fill_value, 9999)\n', (102992, 103012), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103021, 103050), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b', 'a[condition]'], {}), '(b, a[condition])\n', (103033, 103050), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103123, 103161), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._data', '[1.0, 2.0, 3.0]'], {}), '(b._data, [1.0, 2.0, 3.0])\n', (103135, 103161), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103167, 103199), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._mask', '[0, 0, 1]'], {}), '(b._mask, [0, 0, 1])\n', (103179, 103199), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103208, 103240), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.fill_value', '(9999)'], {}), '(b.fill_value, 9999)\n', (103220, 103240), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103249, 103278), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b', 'a[condition]'], {}), '(b, a[condition])\n', (103261, 103278), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103292, 103363), 'numpy.ma.core.masked_array', 'masked_array', (['[[10, 20, 30], [40, 50, 60]]'], {'mask': '[[0, 0, 1], [1, 0, 0]]'}), '([[10, 20, 30], [40, 50, 60]], mask=[[0, 0, 1], [1, 0, 0]])\n', (103304, 103363), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((103437, 103476), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._data', '[30, 40, 50, 60]'], {}), '(b._data, [30, 40, 50, 60])\n', (103449, 103476), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103485, 103520), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._mask', '[1, 1, 0, 0]'], {}), '(b._mask, [1, 1, 0, 0])\n', (103497, 103520), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103534, 103553), 'numpy.array', 'np.array', (['[3, 1, 2]'], {}), '([3, 1, 2])\n', (103542, 103553), True, 'import numpy as np\n'), ((103601, 103644), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._data', '[[10, 30], [40, 60]]'], {}), '(b._data, [[10, 30], [40, 60]])\n', (103613, 103644), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103653, 103692), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b._mask', '[[0, 1], [1, 0]]'], {}), '(b._mask, [[0, 1], [1, 0]])\n', (103665, 103692), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103764, 103802), 'numpy.ma.core.array', 'array', (['[1, 2, 3, 4]'], {'mask': '[0, 0, 0, 0]'}), '([1, 2, 3, 4], mask=[0, 0, 0, 0])\n', (103769, 103802), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((103838, 103856), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b', 'a'], {}), '(b, a)\n', (103850, 103856), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((103914, 103940), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b', '[2, 3, 4]'], {}), '(b, [2, 3, 4])\n', (103926, 103940), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((104039, 104057), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b', 'a'], {}), '(b, a)\n', (104051, 104057), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((104168, 104196), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b', '[[2, 3, 4]]'], {}), '(b, [[2, 3, 4]])\n', (104180, 104196), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((104323, 104409), 'numpy.ma.core.masked_array', 'masked_array', (["[(1, 1.1, '1.1'), (2, 2.2, '2.2'), (3, 3.3, '3.3')]"], {'dtype': 'datatype'}), "([(1, 1.1, '1.1'), (2, 2.2, '2.2'), (3, 3.3, '3.3')], dtype=\n datatype)\n", (104335, 104409), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((104505, 104518), 'numpy.ma.core.empty_like', 'empty_like', (['a'], {}), '(a)\n', (104515, 104518), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((104527, 104557), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.shape', 'a.shape'], {}), '(b.shape, a.shape)\n', (104539, 104557), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((104566, 104606), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.fill_value', 'a.fill_value'], {}), '(b.fill_value, a.fill_value)\n', (104578, 104606), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((104658, 104688), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.shape', 'a.shape'], {}), '(b.shape, a.shape)\n', (104670, 104688), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((104697, 104737), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.fill_value', 'a.fill_value'], {}), '(b.fill_value, a.fill_value)\n', (104709, 104737), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((104792, 104842), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3]'], {'mask': '[False, True, False]'}), '([1, 2, 3], mask=[False, True, False])\n', (104804, 104842), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((104855, 104868), 'numpy.ma.core.empty_like', 'empty_like', (['a'], {}), '(a)\n', (104865, 104868), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((105070, 105079), 'numpy.ma.core.arange', 'arange', (['(5)'], {}), '(5)\n', (105076, 105079), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((105120, 105132), 'numpy.ma.core.make_mask', 'make_mask', (['n'], {}), '(n)\n', (105129, 105132), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((105145, 105161), 'numpy.ma.core.array', 'array', (['d'], {'mask': 'm'}), '(d, mask=m)\n', (105150, 105161), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((105363, 105398), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '[0, 10, 2, -1, 40]'], {}), '(x, [0, 10, 2, -1, 40])\n', (105375, 105398), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((105594, 105646), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[0, 0, 0, 0, 0, 1, 0, 0, 0, 0]'], {}), '(x.mask, [0, 0, 0, 0, 0, 1, 0, 0, 0, 0])\n', (105606, 105646), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((105714, 105767), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['x', '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]'], {}), '(x, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])\n', (105732, 105767), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((105778, 105830), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[1, 0, 0, 0, 1, 1, 0, 0, 0, 0]'], {}), '(x.mask, [1, 0, 0, 0, 1, 1, 0, 0, 0, 0])\n', (105790, 105830), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((105903, 105926), 'numpy.ma.core.put', 'put', (['x', 'i', '[6, 4, 2, 0]'], {}), '(x, i, [6, 4, 2, 0])\n', (105906, 105926), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((106002, 106054), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[0, 0, 0, 0, 0, 1, 0, 0, 0, 0]'], {}), '(x.mask, [0, 0, 0, 0, 0, 1, 0, 0, 0, 0])\n', (106014, 106054), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((106123, 106176), 'numpy.ma.testutils.assert_array_equal', 'assert_array_equal', (['x', '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]'], {}), '(x, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])\n', (106141, 106176), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((106187, 106239), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', '[1, 0, 0, 0, 1, 1, 0, 0, 0, 0]'], {}), '(x.mask, [1, 0, 0, 0, 1, 1, 0, 0, 0, 0])\n', (106199, 106239), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((106312, 106321), 'numpy.ma.core.zeros', 'zeros', (['(10)'], {}), '(10)\n', (106317, 106321), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((106334, 106372), 'numpy.ma.core.array', 'array', (['[3.0, -1.0]'], {'mask': '[False, True]'}), '([3.0, -1.0], mask=[False, True])\n', (106339, 106372), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((106449, 106470), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x[0]', '(0)'], {}), '(x[0], 0)\n', (106461, 106470), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((106523, 106544), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x[1]', '(3)'], {}), '(x[1], 3)\n', (106535, 106544), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((106637, 106658), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x[3]', '(0)'], {}), '(x[3], 0)\n', (106649, 106658), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((106737, 106746), 'numpy.ma.core.arange', 'arange', (['(5)'], {}), '(5)\n', (106743, 106746), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((106787, 106799), 'numpy.ma.core.make_mask', 'make_mask', (['n'], {}), '(n)\n', (106796, 106799), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((106813, 106860), 'numpy.ma.core.array', 'array', (['(d + 1)'], {'mask': 'm', 'hard_mask': '(True)', 'copy': '(True)'}), '(d + 1, mask=m, hard_mask=True, copy=True)\n', (106818, 106860), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((106918, 106957), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xh._data', '[3, 4, 2, 4, 5]'], {}), '(xh._data, [3, 4, 2, 4, 5])\n', (106930, 106957), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((107026, 107059), 'numpy.ma.core.array', 'array', (['x'], {'mask': '[0, 0, 0, 1, 1, 1]'}), '(x, mask=[0, 0, 0, 1, 1, 1])\n', (107031, 107059), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((107162, 107183), 'numpy.ma.core.putmask', 'putmask', (['xx', 'mask', '(99)'], {}), '(xx, mask, 99)\n', (107169, 107183), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((107192, 107230), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx', '[1, 2, 99, 4, 5, 99]'], {}), '(xx, [1, 2, 99, 4, 5, 99])\n', (107204, 107230), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((107300, 107322), 'numpy.ma.core.putmask', 'putmask', (['mxx', 'mask', '(99)'], {}), '(mxx, mask, 99)\n', (107307, 107322), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((107331, 107376), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mxx._data', '[1, 2, 99, 4, 5, 99]'], {}), '(mxx._data, [1, 2, 99, 4, 5, 99])\n', (107343, 107376), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((107385, 107428), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mxx._mask', '[0, 0, 0, 1, 1, 0]'], {}), '(mxx._mask, [0, 0, 0, 1, 1, 0])\n', (107397, 107428), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((107483, 107539), 'numpy.ma.core.array', 'array', (['[10, 20, 30, 40, 50, 60]'], {'mask': '[1, 1, 1, 0, 0, 0]'}), '([10, 20, 30, 40, 50, 60], mask=[1, 1, 1, 0, 0, 0])\n', (107488, 107539), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((107570, 107595), 'numpy.ma.core.putmask', 'putmask', (['xx', 'mask', 'values'], {}), '(xx, mask, values)\n', (107577, 107595), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((107604, 107648), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx._data', '[1, 2, 30, 4, 5, 60]'], {}), '(xx._data, [1, 2, 30, 4, 5, 60])\n', (107616, 107648), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((107657, 107699), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx._mask', '[0, 0, 1, 0, 0, 0]'], {}), '(xx._mask, [0, 0, 1, 0, 0, 0])\n', (107669, 107699), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((107768, 107794), 'numpy.ma.core.putmask', 'putmask', (['mxx', 'mask', 'values'], {}), '(mxx, mask, values)\n', (107775, 107794), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((107803, 107848), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mxx._data', '[1, 2, 30, 4, 5, 60]'], {}), '(mxx._data, [1, 2, 30, 4, 5, 60])\n', (107815, 107848), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((107857, 107900), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mxx._mask', '[0, 0, 1, 1, 1, 0]'], {}), '(mxx._mask, [0, 0, 1, 1, 1, 0])\n', (107869, 107900), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((108006, 108032), 'numpy.ma.core.putmask', 'putmask', (['mxx', 'mask', 'values'], {}), '(mxx, mask, values)\n', (108013, 108032), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((108041, 108080), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mxx', '[1, 2, 30, 4, 5, 60]'], {}), '(mxx, [1, 2, 30, 4, 5, 60])\n', (108053, 108080), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((108142, 108190), 'numpy.ma.core.array', 'array', (['[[1, 2, 3, 4, 5]]'], {'mask': '[[0, 1, 0, 0, 0]]'}), '([[1, 2, 3, 4, 5]], mask=[[0, 1, 0, 0, 0]])\n', (108147, 108190), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((108226, 108272), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['aravel._mask.shape', 'aravel.shape'], {}), '(aravel._mask.shape, aravel.shape)\n', (108238, 108272), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((108285, 108311), 'numpy.ma.core.array', 'array', (['[0, 0]'], {'mask': '[1, 1]'}), '([0, 0], mask=[1, 1])\n', (108290, 108311), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((108347, 108388), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['aravel._mask.shape', 'a.shape'], {}), '(aravel._mask.shape, a.shape)\n', (108359, 108388), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((108494, 108528), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['aravel.shape', '(1, 5)'], {}), '(aravel.shape, (1, 5))\n', (108506, 108528), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((108537, 108578), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['aravel._mask.shape', 'a.shape'], {}), '(aravel._mask.shape, a.shape)\n', (108549, 108578), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((108637, 108689), 'numpy.ma.core.array', 'array', (['[1, 2, 3, 4]'], {'mask': '[0, 0, 0, 0]', 'shrink': '(False)'}), '([1, 2, 3, 4], mask=[0, 0, 0, 0], shrink=False)\n', (108642, 108689), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((108873, 108909), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['ar._mask', '[0, 0, 0, 0]'], {}), '(ar._mask, [0, 0, 0, 0])\n', (108885, 108909), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((108918, 108954), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['ar._data', '[1, 2, 3, 4]'], {}), '(ar._data, [1, 2, 3, 4])\n', (108930, 108954), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((108963, 108995), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['ar.fill_value', '(-99)'], {}), '(ar.fill_value, -99)\n', (108975, 108995), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109201, 109210), 'numpy.ma.core.arange', 'arange', (['(4)'], {}), '(4)\n', (109207, 109210), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((109269, 109298), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y.shape', '(2, 2)'], {}), '(y.shape, (2, 2))\n', (109281, 109298), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109308, 109343), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y._mask.shape', '(2, 2)'], {}), '(y._mask.shape, (2, 2))\n', (109320, 109343), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109353, 109380), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.shape', '(4,)'], {}), '(x.shape, (4,))\n', (109365, 109380), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109389, 109422), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x._mask.shape', '(4,)'], {}), '(x._mask.shape, (4,))\n', (109401, 109422), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109481, 109535), 'numpy.ma.core.array', 'array', (['[1, 4, 2, 3]'], {'mask': '[0, 1, 0, 0]', 'dtype': 'np.uint8'}), '([1, 4, 2, 3], mask=[0, 1, 0, 0], dtype=np.uint8)\n', (109486, 109535), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((109555, 109562), 'numpy.ma.core.sort', 'sort', (['x'], {}), '(x)\n', (109559, 109562), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((109571, 109612), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['sortedx._data', '[1, 2, 3, 4]'], {}), '(sortedx._data, [1, 2, 3, 4])\n', (109583, 109612), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109621, 109662), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['sortedx._mask', '[0, 0, 0, 1]'], {}), '(sortedx._mask, [0, 0, 0, 1])\n', (109633, 109662), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109682, 109704), 'numpy.ma.core.sort', 'sort', (['x'], {'endwith': '(False)'}), '(x, endwith=False)\n', (109686, 109704), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((109713, 109754), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['sortedx._data', '[4, 1, 2, 3]'], {}), '(sortedx._data, [4, 1, 2, 3])\n', (109725, 109754), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109763, 109804), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['sortedx._mask', '[1, 0, 0, 0]'], {}), '(sortedx._mask, [1, 0, 0, 0])\n', (109775, 109804), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109831, 109866), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x._data', '[1, 2, 3, 4]'], {}), '(x._data, [1, 2, 3, 4])\n', (109843, 109866), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109875, 109910), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x._mask', '[0, 0, 0, 1]'], {}), '(x._mask, [0, 0, 0, 1])\n', (109887, 109910), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((109924, 109978), 'numpy.ma.core.array', 'array', (['[1, 4, 2, 3]'], {'mask': '[0, 1, 0, 0]', 'dtype': 'np.uint8'}), '([1, 4, 2, 3], mask=[0, 1, 0, 0], dtype=np.uint8)\n', (109929, 109978), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((110017, 110052), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x._data', '[4, 1, 2, 3]'], {}), '(x._data, [4, 1, 2, 3])\n', (110029, 110052), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((110061, 110096), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x._mask', '[1, 0, 0, 0]'], {}), '(x._mask, [1, 0, 0, 0])\n', (110073, 110096), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((110141, 110148), 'numpy.ma.core.sort', 'sort', (['x'], {}), '(x)\n', (110145, 110148), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((110223, 110275), 'numpy.ma.core.array', 'array', (['[0, 1, -1, -2, 2]'], {'mask': 'nomask', 'dtype': 'np.int8'}), '([0, 1, -1, -2, 2], mask=nomask, dtype=np.int8)\n', (110228, 110275), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((110294, 110316), 'numpy.ma.core.sort', 'sort', (['x'], {'endwith': '(False)'}), '(x, endwith=False)\n', (110298, 110316), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((110325, 110371), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['sortedx._data', '[-2, -1, 0, 1, 2]'], {}), '(sortedx._data, [-2, -1, 0, 1, 2])\n', (110337, 110371), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((110384, 110445), 'numpy.ma.core.array', 'array', (['[0, 1, -1, -2, 2]'], {'mask': '[0, 1, 0, 0, 1]', 'dtype': 'np.int8'}), '([0, 1, -1, -2, 2], mask=[0, 1, 0, 0, 1], dtype=np.int8)\n', (110389, 110445), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((110464, 110486), 'numpy.ma.core.sort', 'sort', (['x'], {'endwith': '(False)'}), '(x, endwith=False)\n', (110468, 110486), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((110495, 110541), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['sortedx._data', '[1, 2, -2, -1, 0]'], {}), '(sortedx._data, [1, 2, -2, -1, 0])\n', (110507, 110541), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((110550, 110594), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['sortedx._mask', '[1, 1, 0, 0, 0]'], {}), '(sortedx._mask, [1, 1, 0, 0, 0])\n', (110562, 110594), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((110698, 110734), 'numpy.ma.core.masked_array', 'masked_array', (['[[8, 4, 1], [2, 0, 9]]'], {}), '([[8, 4, 1], [2, 0, 9]])\n', (110710, 110734), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((110761, 110800), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', '[[2, 0, 1], [8, 4, 9]]'], {}), '(a, [[2, 0, 1], [8, 4, 9]])\n', (110773, 110800), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((110813, 110849), 'numpy.ma.core.masked_array', 'masked_array', (['[[8, 4, 1], [2, 0, 9]]'], {}), '([[8, 4, 1], [2, 0, 9]])\n', (110825, 110849), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((110876, 110915), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', '[[1, 4, 8], [0, 2, 9]]'], {}), '(a, [[1, 4, 8], [0, 2, 9]])\n', (110888, 110915), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((110954, 111019), 'numpy.ma.core.masked_array', 'masked_array', (['[[8, 4, 1], [2, 0, 9]]'], {'mask': '[[1, 0, 0], [0, 0, 1]]'}), '([[8, 4, 1], [2, 0, 9]], mask=[[1, 0, 0], [0, 0, 1]])\n', (110966, 111019), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((111046, 111085), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', '[[2, 0, 1], [8, 4, 9]]'], {}), '(a, [[2, 0, 1], [8, 4, 9]])\n', (111058, 111085), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((111094, 111139), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a._mask', '[[0, 0, 0], [1, 0, 1]]'], {}), '(a._mask, [[0, 0, 0], [1, 0, 1]])\n', (111106, 111139), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((111152, 111217), 'numpy.ma.core.masked_array', 'masked_array', (['[[8, 4, 1], [2, 0, 9]]'], {'mask': '[[1, 0, 0], [0, 0, 1]]'}), '([[8, 4, 1], [2, 0, 9]], mask=[[1, 0, 0], [0, 0, 1]])\n', (111164, 111217), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((111244, 111283), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a', '[[1, 4, 8], [0, 2, 9]]'], {}), '(a, [[1, 4, 8], [0, 2, 9]])\n', (111256, 111283), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((111292, 111337), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a._mask', '[[0, 0, 1], [0, 0, 1]]'], {}), '(a._mask, [[0, 0, 1], [0, 0, 1]])\n', (111304, 111337), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((111363, 111525), 'numpy.ma.core.masked_array', 'masked_array', (['[[[7, 8, 9], [4, 5, 6], [1, 2, 3]], [[1, 2, 3], [7, 8, 9], [4, 5, 6]], [[7,\n 8, 9], [1, 2, 3], [4, 5, 6]], [[4, 5, 6], [1, 2, 3], [7, 8, 9]]]'], {}), '([[[7, 8, 9], [4, 5, 6], [1, 2, 3]], [[1, 2, 3], [7, 8, 9], [4,\n 5, 6]], [[7, 8, 9], [1, 2, 3], [4, 5, 6]], [[4, 5, 6], [1, 2, 3], [7, 8,\n 9]]])\n', (111375, 111525), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((111721, 111741), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['am', 'an'], {}), '(am, an)\n', (111733, 111741), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((111836, 111856), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['am', 'an'], {}), '(am, an)\n', (111848, 111856), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((111951, 111971), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['am', 'an'], {}), '(am, an)\n', (111963, 111971), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((112058, 112230), 'numpy.ma.core.array', 'array', ([], {'data': '[(3, 3), (3, 2), (2, 2), (2, 1), (1, 0), (1, 1), (1, 2)]', 'mask': '[(0, 0), (0, 1), (0, 0), (0, 0), (1, 0), (0, 0), (0, 0)]', 'dtype': "[('A', int), ('B', int)]"}), "(data=[(3, 3), (3, 2), (2, 2), (2, 1), (1, 0), (1, 1), (1, 2)], mask=[\n (0, 0), (0, 1), (0, 0), (0, 0), (1, 0), (0, 0), (0, 0)], dtype=[('A',\n int), ('B', int)])\n", (112063, 112230), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((112275, 112282), 'numpy.ma.core.sort', 'sort', (['a'], {}), '(a)\n', (112279, 112282), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((112295, 112467), 'numpy.ma.core.array', 'array', ([], {'data': '[(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 2), (1, 0)]', 'mask': '[(0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 1), (1, 0)]', 'dtype': "[('A', int), ('B', int)]"}), "(data=[(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 2), (1, 0)], mask=[\n (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 1), (1, 0)], dtype=[('A',\n int), ('B', int)])\n", (112300, 112467), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((112504, 112525), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'b'], {}), '(test, b)\n', (112516, 112525), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((112534, 112565), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'b.mask'], {}), '(test.mask, b.mask)\n', (112546, 112565), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((112582, 112604), 'numpy.ma.core.sort', 'sort', (['a'], {'endwith': '(False)'}), '(a, endwith=False)\n', (112586, 112604), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((112617, 112789), 'numpy.ma.core.array', 'array', ([], {'data': '[(1, 0), (1, 1), (1, 2), (2, 1), (2, 2), (3, 2), (3, 3)]', 'mask': '[(1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 1), (0, 0)]', 'dtype': "[('A', int), ('B', int)]"}), "(data=[(1, 0), (1, 1), (1, 2), (2, 1), (2, 2), (3, 2), (3, 3)], mask=[\n (1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 1), (0, 0)], dtype=[('A',\n int), ('B', int)])\n", (112622, 112789), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((112830, 112851), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'b'], {}), '(test, b)\n', (112842, 112851), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((112860, 112891), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'b.mask'], {}), '(test.mask, b.mask)\n', (112872, 112891), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((112956, 113000), 'numpy.ma.core.array', 'array', (['[1, 5, 2, 4, 3]'], {'mask': '[1, 0, 0, 1, 0]'}), '([1, 5, 2, 4, 3], mask=[1, 0, 0, 1, 0])\n', (112961, 113000), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((113117, 113142), 'numpy.ma.core.masked_array', 'masked_array', (['[[1, 2, 3]]'], {}), '([[1, 2, 3]])\n', (113129, 113142), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((113206, 113249), 'numpy.ma.core.masked_array', 'masked_array', (['[[1, 2, 3]]'], {'mask': '[[1, 1, 1]]'}), '([[1, 2, 3]], mask=[[1, 1, 1]])\n', (113218, 113249), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((113367, 113397), 'numpy.ma.core.masked_array', 'masked_array', (['[[1]]'], {'mask': '(True)'}), '([[1]], mask=True)\n', (113379, 113397), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((113532, 113802), 'numpy.array', 'np.array', (['[8.375, 7.545, 8.828, 8.5, 1.757, 5.928, 8.43, 7.78, 9.865, 5.878, 8.979, \n 4.732, 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04, 9.63, 7.712, \n 3.382, 4.489, 6.479, 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, 7.357, \n 9.828, 6.272, 3.758, 6.693, 0.993]'], {}), '([8.375, 7.545, 8.828, 8.5, 1.757, 5.928, 8.43, 7.78, 9.865, 5.878,\n 8.979, 4.732, 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04, 9.63, \n 7.712, 3.382, 4.489, 6.479, 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, \n 7.357, 9.828, 6.272, 3.758, 6.693, 0.993])\n', (113540, 113802), True, 'import numpy as np\n'), ((113911, 114033), 'numpy.array', 'np.array', (['[0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1,\n 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0]'], {}), '([0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1,\n 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0])\n', (113919, 114033), True, 'import numpy as np\n'), ((114268, 114306), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mXswapped[-1]', 'mX[:, -1]'], {}), '(mXswapped[-1], mX[:, -1])\n', (114280, 114306), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((114356, 114400), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mXXswapped.shape', '(2, 2, 3, 3)'], {}), '(mXXswapped.shape, (2, 2, 3, 3))\n', (114368, 114400), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((114460, 114504), 'numpy.ma.core.masked_array', 'masked_array', (['[10, 20, 30, 40]', '[0, 1, 0, 1]'], {}), '([10, 20, 30, 40], [0, 1, 0, 1])\n', (114472, 114504), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((114917, 114981), 'numpy.ma.core.array', 'array', (['[[10, 20, 30], [40, 50, 60]]'], {'mask': '[[0, 0, 1], [1, 0, 0]]'}), '([[10, 20, 30], [40, 50, 60]], mask=[[0, 0, 1], [1, 0, 0]])\n', (114922, 114981), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((115312, 115341), 'numpy.array', 'np.array', (['(40, 18, 37, 9, 22)'], {}), '((40, 18, 37, 9, 22))\n', (115320, 115341), True, 'import numpy as np\n'), ((115498, 115528), 'numpy.ma.core.take', 'take', (['a', 'mindices'], {'mode': '"""clip"""'}), "(a, mindices, mode='clip')\n", (115502, 115528), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((115544, 115618), 'numpy.ma.core.array', 'array', (['[[40, 18, 37], [18, 37, 9], [37, 9, 22], [9, 22, 22], [22, 22, 22]]'], {}), '([[40, 18, 37], [18, 37, 9], [37, 9, 22], [9, 22, 22], [22, 22, 22]])\n', (115549, 115618), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((115715, 115739), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'ctrl'], {}), '(test, ctrl)\n', (115727, 115739), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((115780, 115797), 'numpy.ma.core.take', 'take', (['a', 'mindices'], {}), '(a, mindices)\n', (115784, 115797), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((115813, 115887), 'numpy.ma.core.array', 'array', (['[[40, 18, 37], [18, 37, 9], [37, 9, 22], [9, 22, 40], [22, 40, 40]]'], {}), '([[40, 18, 37], [18, 37, 9], [37, 9, 22], [9, 22, 40], [22, 40, 40]])\n', (115818, 115887), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((116038, 116062), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'ctrl'], {}), '(test, ctrl)\n', (116050, 116062), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((116071, 116105), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'ctrl.mask'], {}), '(test.mask, ctrl.mask)\n', (116083, 116105), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((116158, 116206), 'numpy.ma.core.array', 'array', (['(40, 18, 37, 9, 22)'], {'mask': '(0, 1, 0, 0, 0)'}), '((40, 18, 37, 9, 22), mask=(0, 1, 0, 0, 0))\n', (116163, 116206), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((116222, 116239), 'numpy.ma.core.take', 'take', (['a', 'mindices'], {}), '(a, mindices)\n', (116226, 116239), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((116289, 116313), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'ctrl'], {}), '(test, ctrl)\n', (116301, 116313), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((116322, 116356), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'ctrl.mask'], {}), '(test.mask, ctrl.mask)\n', (116334, 116356), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((116747, 116786), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xlist[0]', '[0, None, 2, 3]'], {}), '(xlist[0], [0, None, 2, 3])\n', (116759, 116786), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((116795, 116831), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xlist[1]', '[4, 5, 6, 7]'], {}), '(xlist[1], [4, 5, 6, 7])\n', (116807, 116831), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((116840, 116880), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xlist[2]', '[8, 9, None, 11]'], {}), '(xlist[2], [8, 9, None, 11])\n', (116852, 116880), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((116889, 116914), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xlist', 'ctrl'], {}), '(xlist, ctrl)\n', (116901, 116914), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((117425, 117503), 'numpy.ma.core.array', 'array', (['[(1, 2), (3, 4)]'], {'mask': '[(0, 1), (0, 0)]', 'dtype': "[('a', int), ('b', int)]"}), "([(1, 2), (3, 4)], mask=[(0, 1), (0, 0)], dtype=[('a', int), ('b', int)])\n", (117430, 117503), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((117557, 117596), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[[1, None], [3, 4]]'], {}), '(test, [[1, None], [3, 4]])\n', (117569, 117596), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((117671, 117700), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[1, None]'], {}), '(test, [1, None])\n', (117683, 117700), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((117827, 117882), 'numpy.ma.core.array', 'array', (['[(0, 1), (2, 3)]'], {'dtype': "[('a', int), ('b', int)]"}), "([(0, 1), (2, 3)], dtype=[('a', int), ('b', int)])\n", (117832, 117882), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((118411, 118421), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (118417, 118421), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((118461, 118502), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["record['_data']", 'data._data'], {}), "(record['_data'], data._data)\n", (118473, 118502), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((118511, 118552), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["record['_mask']", 'data._mask'], {}), "(record['_mask'], data._mask)\n", (118523, 118552), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((118630, 118671), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["record['_data']", 'data._data'], {}), "(record['_data'], data._data)\n", (118642, 118671), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((118680, 118721), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["record['_mask']", 'data._mask'], {}), "(record['_mask'], data._mask)\n", (118692, 118721), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((119105, 119146), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["record['_data']", 'data._data'], {}), "(record['_data'], data._data)\n", (119117, 119146), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((119155, 119196), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["record['_mask']", 'data._mask'], {}), "(record['_mask'], data._mask)\n", (119167, 119196), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((119215, 119249), 'numpy.dtype', 'np.dtype', (['"""int, (2,3)float, float"""'], {}), "('int, (2,3)float, float')\n", (119223, 119249), True, 'import numpy as np\n'), ((119583, 119632), 'numpy.ma.testutils.assert_equal_records', 'assert_equal_records', (["record['_data']", 'data._data'], {}), "(record['_data'], data._data)\n", (119603, 119632), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((119641, 119690), 'numpy.ma.testutils.assert_equal_records', 'assert_equal_records', (["record['_mask']", 'data._mask'], {}), "(record['_mask'], data._mask)\n", (119661, 119690), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((119799, 119815), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (119804, 119815), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((119860, 119881), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'a'], {}), '(test, a)\n', (119872, 119881), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((119890, 119921), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'a.mask'], {}), '(test.mask, a.mask)\n', (119902, 119921), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((119935, 119967), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]'}), '([1, 2, 3], mask=[0, 0, 1])\n', (119940, 119967), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((120012, 120033), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'a'], {}), '(test, a)\n', (120024, 120033), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((120042, 120073), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'a.mask'], {}), '(test.mask, a.mask)\n', (120054, 120073), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((120087, 120194), 'numpy.ma.core.array', 'array', (['[(1, 1.0), (2, 2.0), (3, 3.0)]'], {'mask': '[(1, 0), (0, 0), (0, 1)]', 'dtype': "[('A', int), ('B', float)]"}), "([(1, 1.0), (2, 2.0), (3, 3.0)], mask=[(1, 0), (0, 0), (0, 1)], dtype=\n [('A', int), ('B', float)])\n", (120092, 120194), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((120249, 120270), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'a'], {}), '(test, a)\n', (120261, 120270), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((120279, 120310), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.data', 'a.data'], {}), '(test.data, a.data)\n', (120291, 120310), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((120405, 120458), 'numpy.ma.core.masked_array', 'masked_array', (['[[1, 2, 3, 4, 5]]'], {'mask': '[0, 0, 1, 0, 0]'}), '([[1, 2, 3, 4, 5]], mask=[0, 0, 1, 0, 0])\n', (120417, 120458), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((120477, 120538), 'numpy.ma.core.masked_array', 'masked_array', (['[[1], [2], [3], [4], [5]]'], {'mask': '[0, 0, 1, 0, 0]'}), '([[1], [2], [3], [4], [5]], mask=[0, 0, 1, 0, 0])\n', (120489, 120538), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((120578, 120609), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['marray.T', 'control'], {}), '(marray.T, control)\n', (120590, 120609), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((120846, 121116), 'numpy.array', 'np.array', (['[8.375, 7.545, 8.828, 8.5, 1.757, 5.928, 8.43, 7.78, 9.865, 5.878, 8.979, \n 4.732, 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04, 9.63, 7.712, \n 3.382, 4.489, 6.479, 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, 7.357, \n 9.828, 6.272, 3.758, 6.693, 0.993]'], {}), '([8.375, 7.545, 8.828, 8.5, 1.757, 5.928, 8.43, 7.78, 9.865, 5.878,\n 8.979, 4.732, 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04, 9.63, \n 7.712, 3.382, 4.489, 6.479, 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, \n 7.357, 9.828, 6.272, 3.758, 6.693, 0.993])\n', (120854, 121116), True, 'import numpy as np\n'), ((121289, 121411), 'numpy.array', 'np.array', (['[0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1,\n 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0]'], {}), '([0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1,\n 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0])\n', (121297, 121411), True, 'import numpy as np\n'), ((121526, 121547), 'numpy.ma.core.array', 'array', ([], {'data': 'x', 'mask': 'm'}), '(data=x, mask=m)\n', (121531, 121547), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((121669, 121791), 'numpy.array', 'np.array', (['[1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1,\n 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1]'], {}), '([1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,\n 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1])\n', (121677, 121791), True, 'import numpy as np\n'), ((121912, 121934), 'numpy.ma.core.array', 'array', ([], {'data': 'x', 'mask': 'm2'}), '(data=x, mask=m2)\n', (121917, 121934), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((123619, 123640), 'numpy.zeros', 'np.zeros', (['n', 'np.float'], {}), '(n, np.float)\n', (123627, 123640), True, 'import numpy as np\n'), ((123656, 123677), 'numpy.zeros', 'np.zeros', (['m', 'np.float'], {}), '(m, np.float)\n', (123664, 123677), True, 'import numpy as np\n'), ((123949, 124000), 'numpy.ma.core.masked_array', 'masked_array', (["['a', 'b']"], {'mask': '[1, 0]', 'dtype': 'object'}), "(['a', 'b'], mask=[1, 0], dtype=object)\n", (123961, 124000), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((124029, 124053), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y[1]', '"""bx"""'], {}), "(y[1], 'bx')\n", (124041, 124053), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((124062, 124080), 'numpy.ma.testutils.assert_', 'assert_', (['y.mask[0]'], {}), '(y.mask[0])\n', (124069, 124080), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((124160, 124216), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]', 'dtype': 'np.object'}), '([1, 2, 3], mask=[1, 0, 0], dtype=np.object)\n', (124172, 124216), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((124262, 124312), 'numpy.ma.core.masked_array', 'masked_array', (['[[1, 2, 3], [4, 5, 6]]'], {'dtype': 'object'}), '([[1, 2, 3], [4, 5, 6]], dtype=object)\n', (124274, 124312), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((124441, 124497), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]', 'dtype': 'np.object'}), '([1, 2, 3], mask=[1, 0, 0], dtype=np.object)\n', (124453, 124497), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((124548, 124598), 'numpy.ma.core.masked_array', 'masked_array', (['[[1, 2, 3], [4, 5, 6]]'], {'dtype': 'object'}), '([[1, 2, 3], [4, 5, 6]], dtype=object)\n', (124560, 124598), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((124739, 124779), 'numpy.ma.core.masked_array', 'masked_array', (['[1, 2, 3]'], {'dtype': 'np.object'}), '([1, 2, 3], dtype=np.object)\n', (124751, 124779), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((125525, 125550), 'numpy.ma.testutils.assert_', 'assert_', (['(r.mask is nomask)'], {}), '(r.mask is nomask)\n', (125532, 125550), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((125662, 125683), 'numpy.ma.testutils.assert_', 'assert_', (['r.mask[1, 3]'], {}), '(r.mask[1, 3])\n', (125669, 125683), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((125696, 125709), 'numpy.ma.core.empty_like', 'empty_like', (['r'], {}), '(r)\n', (125706, 125709), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((125745, 125771), 'numpy.ma.testutils.assert_almost_equal', 'assert_almost_equal', (['r', 'r1'], {}), '(r, r1)\n', (125764, 125771), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((125949, 125962), 'numpy.ma.core.empty_like', 'empty_like', (['r'], {}), '(r)\n', (125959, 125962), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((126000, 126026), 'numpy.ma.testutils.assert_almost_equal', 'assert_almost_equal', (['r', 'r1'], {}), '(r, r1)\n', (126019, 126026), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((126105, 126158), 'numpy.ma.core.masked_array', 'masked_array', (['[[1, 2], [3, 4]]'], {'mask': '[[0, 1], [0, 0]]'}), '([[1, 2], [3, 4]], mask=[[0, 1], [0, 0]])\n', (126117, 126158), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((126165, 126218), 'numpy.ma.core.masked_array', 'masked_array', (['[[1, 2], [3, 4]]'], {'mask': '[[0, 1], [0, 0]]'}), '([[1, 2], [3, 4]], mask=[[0, 1], [0, 0]])\n', (126177, 126218), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((126225, 126255), 'numpy.ma.core.masked_array', 'masked_array', (['[[0, 1], [3, 3]]'], {}), '([[0, 1], [3, 3]])\n', (126237, 126255), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((126346, 126391), 'numpy.ma.testutils.assert_almost_equal', 'assert_almost_equal', (['z.mask', '[[0, 1], [0, 0]]'], {}), '(z.mask, [[0, 1], [0, 0]])\n', (126365, 126391), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((127664, 127689), 'numpy.array', 'np.array', (['(-1)'], {'dtype': 'float'}), '(-1, dtype=float)\n', (127672, 127689), True, 'import numpy as np\n'), ((127705, 127727), 'numpy.ma.core.array', 'array', (['(-1)'], {'dtype': 'float'}), '(-1, dtype=float)\n', (127710, 127727), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((129161, 129219), 'numpy.ma.core.array', 'array', (['[[1, 1, 0], [1, 1, 0]]'], {'mask': '[[0, 0, 1], [0, 0, 1]]'}), '([[1, 1, 0], [1, 1, 0]], mask=[[0, 0, 1], [0, 0, 1]])\n', (129166, 129219), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((129313, 129347), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '[0, 0, 1]'], {}), '(test.mask, [0, 0, 1])\n', (129325, 129347), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((129441, 129475), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '[0, 0, 1]'], {}), '(test.mask, [0, 0, 1])\n', (129453, 129475), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((129569, 129603), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '[1, 1, 1]'], {}), '(test.mask, [1, 1, 1])\n', (129581, 129603), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((129727, 129737), 'numpy.diag', 'np.diag', (['x'], {}), '(x)\n', (129734, 129737), True, 'import numpy as np\n'), ((129746, 129774), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['out', '[0, 4, 8]'], {}), '(out, [0, 4, 8])\n', (129758, 129774), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((129789, 129796), 'numpy.ma.core.diag', 'diag', (['x'], {}), '(x)\n', (129793, 129796), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((129805, 129833), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['out', '[0, 4, 8]'], {}), '(out, [0, 4, 8])\n', (129817, 129833), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((129842, 129875), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['out.mask', '[0, 1, 0]'], {}), '(out.mask, [0, 1, 0])\n', (129854, 129875), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((129890, 129899), 'numpy.ma.core.diag', 'diag', (['out'], {}), '(out)\n', (129894, 129899), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((129918, 130003), 'numpy.ma.core.array', 'array', (['[[0, 0, 0], [0, 4, 0], [0, 0, 8]]'], {'mask': '[[0, 0, 0], [0, 1, 0], [0, 0, 0]]'}), '([[0, 0, 0], [0, 4, 0], [0, 0, 8]], mask=[[0, 0, 0], [0, 1, 0], [0, 0, 0]]\n )\n', (129923, 130003), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((130031, 130057), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['out', 'control'], {}), '(out, control)\n', (130043, 130057), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((130167, 130196), 'numpy.ma.core.array', 'array', (['[[1, 2, 3], [4, 5, 6]]'], {}), '([[1, 2, 3], [4, 5, 6]])\n', (130172, 130196), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((130871, 131150), 'numpy.array', 'np.array', (['[8.375j, 7.545j, 8.828j, 8.5j, 1.757j, 5.928, 8.43, 7.78, 9.865, 5.878, \n 8.979, 4.732, 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04, 9.63, \n 7.712, 3.382, 4.489, 6.479j, 7.189j, 9.645, 5.395, 4.961, 9.894, 2.893,\n 7.357, 9.828, 6.272, 3.758, 6.693, 0.993j]'], {}), '([8.375j, 7.545j, 8.828j, 8.5j, 1.757j, 5.928, 8.43, 7.78, 9.865, \n 5.878, 8.979, 4.732, 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04, \n 9.63, 7.712, 3.382, 4.489, 6.479j, 7.189j, 9.645, 5.395, 4.961, 9.894, \n 2.893, 7.357, 9.828, 6.272, 3.758, 6.693, 0.993j])\n', (130879, 131150), True, 'import numpy as np\n'), ((131322, 131444), 'numpy.array', 'np.array', (['[0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1,\n 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0]'], {}), '([0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1,\n 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0])\n', (131330, 131444), True, 'import numpy as np\n'), ((131559, 131580), 'numpy.ma.core.array', 'array', ([], {'data': 'x', 'mask': 'm'}), '(data=x, mask=m)\n', (131564, 131580), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((131702, 131824), 'numpy.array', 'np.array', (['[1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1,\n 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1]'], {}), '([1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,\n 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1])\n', (131710, 131824), True, 'import numpy as np\n'), ((131945, 131967), 'numpy.ma.core.array', 'array', ([], {'data': 'x', 'mask': 'm2'}), '(data=x, mask=m2)\n', (131950, 131967), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((133217, 133296), 'numpy.array', 'np.array', (['[1.0, 1.0, 1.0, -2.0, pi / 2.0, 4.0, 5.0, -10.0, 10.0, 1.0, 2.0, 3.0]'], {}), '([1.0, 1.0, 1.0, -2.0, pi / 2.0, 4.0, 5.0, -10.0, 10.0, 1.0, 2.0, 3.0])\n', (133225, 133296), True, 'import numpy as np\n'), ((133296, 133371), 'numpy.array', 'np.array', (['[5.0, 0.0, 3.0, 2.0, -1.0, -4.0, 0.0, -10.0, 10.0, 1.0, 0.0, 3.0]'], {}), '([5.0, 0.0, 3.0, 2.0, -1.0, -4.0, 0.0, -10.0, 10.0, 1.0, 0.0, 3.0])\n', (133304, 133371), True, 'import numpy as np\n'), ((133473, 133497), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {'mask': 'm1'}), '(x, mask=m1)\n', (133485, 133497), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((133511, 133535), 'numpy.ma.core.masked_array', 'masked_array', (['y'], {'mask': 'm2'}), '(y, mask=m2)\n', (133523, 133535), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((133668, 133690), 'numpy.ma.core.masked_where', 'masked_where', (['(False)', 'x'], {}), '(False, x)\n', (133680, 133690), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((133699, 133722), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y', '[1, 2]'], {}), '(y, [1, 2])\n', (133711, 133722), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((133731, 133752), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y[1]', '(2)'], {}), '(y[1], 2)\n', (133743, 133752), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((133828, 133846), 'numpy.ma.core.masked_equal', 'masked_equal', (['x', '(3)'], {}), '(x, 3)\n', (133840, 133846), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((133855, 133874), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mx', 'x'], {}), '(mx, x)\n', (133867, 133874), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((133883, 133916), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mx._mask', '[0, 0, 1]'], {}), '(mx._mask, [0, 0, 1])\n', (133895, 133916), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((133930, 133952), 'numpy.ma.core.masked_not_equal', 'masked_not_equal', (['x', '(3)'], {}), '(x, 3)\n', (133946, 133952), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((133961, 133980), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mx', 'x'], {}), '(mx, x)\n', (133973, 133980), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((133989, 134022), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mx._mask', '[1, 1, 0]'], {}), '(mx._mask, [1, 1, 0])\n', (134001, 134022), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((134103, 134121), 'numpy.ma.core.masked_equal', 'masked_equal', (['x', '(3)'], {}), '(x, 3)\n', (134115, 134121), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134130, 134163), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mx._mask', '[0, 0, 1]'], {}), '(mx._mask, [0, 0, 1])\n', (134142, 134163), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((134172, 134202), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mx.fill_value', '(3)'], {}), '(mx.fill_value, 3)\n', (134184, 134202), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((134294, 134326), 'numpy.ma.core.array', 'array', (['[1.0, 2.0, 3.0, 4.0, 5.0]'], {}), '([1.0, 2.0, 3.0, 4.0, 5.0])\n', (134299, 134326), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((135134, 135165), 'numpy.ma.core.ones', 'ones', (['(10, 10, 10)'], {'dtype': 'float'}), '((10, 10, 10), dtype=float)\n', (135138, 135165), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((135182, 135210), 'numpy.ma.core.zeros', 'zeros', (['atest.shape', 'MaskType'], {}), '(atest.shape, MaskType)\n', (135187, 135210), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((135227, 135253), 'numpy.ma.core.masked_where', 'masked_where', (['btest', 'atest'], {}), '(btest, atest)\n', (135239, 135253), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((135262, 135288), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['atest', 'ctest'], {}), '(atest, ctest)\n', (135274, 135288), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((135352, 135362), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (135358, 135362), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((135545, 135563), 'numpy.ma.core.masked_equal', 'masked_equal', (['a', '(1)'], {}), '(a, 1)\n', (135557, 135563), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((135572, 135627), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '[0, 1, 0, 0, 0, 0, 0, 0, 0, 0]'], {}), '(test.mask, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0])\n', (135584, 135627), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((135791, 135839), 'numpy.zeros', 'np.zeros', (['(10)'], {'dtype': "[('A', '<f2'), ('B', '<f4')]"}), "(10, dtype=[('A', '<f2'), ('B', '<f4')])\n", (135799, 135839), True, 'import numpy as np\n'), ((135853, 135886), 'numpy.ma.masked_where', 'np.ma.masked_where', (["(a['A'] < 5)", 'a'], {}), "(a['A'] < 5, a)\n", (135871, 135886), True, 'import numpy as np\n'), ((135895, 135944), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['am.mask.dtype.names', 'am.dtype.names'], {}), '(am.mask.dtype.names, am.dtype.names)\n', (135907, 135944), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((136991, 137064), 'numpy.ma.core.array', 'array', (['[1.23456, 2.34567, 3.45678, 4.56789, 5.6789]'], {'mask': '[0, 1, 0, 0, 0]'}), '([1.23456, 2.34567, 3.45678, 4.56789, 5.6789], mask=[0, 1, 0, 0, 0])\n', (136996, 137064), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((137280, 137293), 'numpy.ma.core.empty_like', 'empty_like', (['a'], {}), '(a)\n', (137290, 137293), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((137325, 137367), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b', '[1.0, 2.0, 3.0, 5.0, 6.0]'], {}), '(b, [1.0, 2.0, 3.0, 5.0, 6.0])\n', (137337, 137367), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((137376, 137408), 'numpy.ma.core.array', 'array', (['[1.0, 2.0, 3.0, 4.0, 5.0]'], {}), '([1.0, 2.0, 3.0, 4.0, 5.0])\n', (137381, 137408), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((137416, 137438), 'numpy.ma.core.array', 'array', (['[1, 1, 1, 0, 0]'], {}), '([1, 1, 1, 0, 0])\n', (137421, 137438), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((137473, 137488), 'numpy.ma.core.where', 'where', (['c', 'x', '(-x)'], {}), '(c, x, -x)\n', (137478, 137488), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((137497, 137539), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[1.0, 2.0, 0.0, -4.0, -5]'], {}), '(z, [1.0, 2.0, 0.0, -4.0, -5])\n', (137509, 137539), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((137570, 137585), 'numpy.ma.core.where', 'where', (['c', 'x', '(-x)'], {}), '(c, x, -x)\n', (137575, 137585), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((137594, 137636), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[1.0, 2.0, 0.0, -4.0, -5]'], {}), '(z, [1.0, 2.0, 0.0, -4.0, -5])\n', (137606, 137636), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((137641, 137664), 'numpy.ma.testutils.assert_', 'assert_', (['(z[0] is masked)'], {}), '(z[0] is masked)\n', (137648, 137664), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((137673, 137700), 'numpy.ma.testutils.assert_', 'assert_', (['(z[1] is not masked)'], {}), '(z[1] is not masked)\n', (137680, 137700), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((137709, 137732), 'numpy.ma.testutils.assert_', 'assert_', (['(z[2] is masked)'], {}), '(z[2] is masked)\n', (137716, 137732), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((137987, 138016), 'numpy.empty', 'np.empty', (['(3, 4)'], {'dtype': 'float'}), '((3, 4), dtype=float)\n', (137995, 138016), True, 'import numpy as np\n'), ((138061, 138097), 'numpy.round', 'np.round', (['xm'], {'decimals': '(2)', 'out': 'output'}), '(xm, decimals=2, out=output)\n', (138069, 138097), True, 'import numpy as np\n'), ((138273, 138299), 'numpy.ma.core.empty', 'empty', (['(3, 4)'], {'dtype': 'float'}), '((3, 4), dtype=float)\n', (138278, 138299), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((138524, 138548), 'numpy.ma.core.array', 'array', (['(1.1)'], {'mask': '[False]'}), '(1.1, mask=[False])\n', (138529, 138548), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((138597, 138620), 'numpy.ma.core.array', 'array', (['(1.1)'], {'mask': '[True]'}), '(1.1, mask=[True])\n', (138602, 138620), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((138671, 138695), 'numpy.ma.core.array', 'array', (['(1.1)'], {'mask': '[False]'}), '(1.1, mask=[False])\n', (138676, 138695), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((138713, 138737), 'numpy.empty', 'np.empty', (['(1)'], {'dtype': 'float'}), '(1, dtype=float)\n', (138721, 138737), True, 'import numpy as np\n'), ((138801, 138824), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['output', '(1)'], {}), '(output, 1)\n', (138813, 138824), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((138838, 138862), 'numpy.ma.core.array', 'array', (['(1.1)'], {'mask': '[False]'}), '(1.1, mask=[False])\n', (138843, 138862), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((138880, 138907), 'numpy.ma.core.array', 'array', (['(-9999.0)'], {'mask': '[True]'}), '(-9999.0, mask=[True])\n', (138885, 138907), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((138943, 138970), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['output[()]', '(1)'], {}), '(output[()], 1)\n', (138955, 138970), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((138984, 139007), 'numpy.ma.core.array', 'array', (['(1.1)'], {'mask': '[True]'}), '(1.1, mask=[True])\n', (138989, 139007), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((139025, 139053), 'numpy.ma.core.array', 'array', (['(-9999.0)'], {'mask': '[False]'}), '(-9999.0, mask=[False])\n', (139030, 139053), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((139089, 139118), 'numpy.ma.testutils.assert_', 'assert_', (['(output[()] is masked)'], {}), '(output[()] is masked)\n', (139096, 139118), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((139161, 139172), 'numpy.ma.core.identity', 'identity', (['(5)'], {}), '(5)\n', (139169, 139172), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((139421, 139455), 'numpy.ma.core.array', 'array', (['[-1.1, -1.1, 1.1, 1.1, 0.0]'], {}), '([-1.1, -1.1, 1.1, 1.1, 0.0])\n', (139426, 139455), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((139467, 139522), 'numpy.ma.core.array', 'array', (['[0.5, 2.0, 0.5, 2.0, -1.0]'], {'mask': '[0, 0, 0, 0, 1]'}), '([0.5, 2.0, 0.5, 2.0, -1.0], mask=[0, 0, 0, 0, 1])\n', (139472, 139522), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((139532, 139543), 'numpy.ma.core.power', 'power', (['x', 'b'], {}), '(x, b)\n', (139537, 139543), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((139552, 139611), 'numpy.ma.testutils.assert_almost_equal', 'assert_almost_equal', (['y', '[0, 1.21, 1.04880884817, 1.21, 0.0]'], {}), '(y, [0, 1.21, 1.04880884817, 1.21, 0.0])\n', (139571, 139611), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((139619, 139657), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y._mask', '[1, 0, 0, 0, 1]'], {}), '(y._mask, [1, 0, 0, 0, 1])\n', (139631, 139657), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((139694, 139705), 'numpy.ma.core.power', 'power', (['x', 'b'], {}), '(x, b)\n', (139699, 139705), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((139714, 139752), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['y._mask', '[1, 0, 0, 0, 1]'], {}), '(y._mask, [1, 0, 0, 0, 1])\n', (139726, 139752), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((139780, 139810), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z._mask', 'y._mask'], {}), '(z._mask, y._mask)\n', (139792, 139810), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((139819, 139844), 'numpy.ma.testutils.assert_almost_equal', 'assert_almost_equal', (['z', 'y'], {}), '(z, y)\n', (139838, 139844), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((139853, 139890), 'numpy.ma.testutils.assert_almost_equal', 'assert_almost_equal', (['z._data', 'y._data'], {}), '(z._data, y._data)\n', (139872, 139890), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((139915, 139945), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x._mask', 'y._mask'], {}), '(x._mask, y._mask)\n', (139927, 139945), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((139954, 139979), 'numpy.ma.testutils.assert_almost_equal', 'assert_almost_equal', (['x', 'y'], {}), '(x, y)\n', (139973, 139979), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((139988, 140025), 'numpy.ma.testutils.assert_almost_equal', 'assert_almost_equal', (['x._data', 'y._data'], {}), '(x._data, y._data)\n', (140007, 140025), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((140118, 140162), 'numpy.array', 'np.array', (['[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]'], {}), '([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])\n', (140126, 140162), True, 'import numpy as np\n'), ((140171, 140209), 'numpy.ma.core.array', 'array', (['a2'], {'mask': '[[1, 0, 0], [0, 0, 1]]'}), '(a2, mask=[[1, 0, 0], [0, 0, 1]])\n', (140176, 140209), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((140223, 140242), 'numpy.array', 'np.array', (['[2, 4, 3]'], {}), '([2, 4, 3])\n', (140231, 140242), True, 'import numpy as np\n'), ((140256, 140274), 'numpy.array', 'np.array', (['[b1, b1]'], {}), '([b1, b1])\n', (140264, 140274), True, 'import numpy as np\n'), ((140289, 140327), 'numpy.ma.core.array', 'array', (['b2'], {'mask': '[[0, 1, 0], [0, 1, 0]]'}), '(b2, mask=[[0, 1, 0], [0, 1, 0]])\n', (140294, 140327), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((140344, 140436), 'numpy.ma.core.array', 'array', (['[[1 ** 2, 2 ** 4, 3 ** 3], [4 ** 2, 5 ** 4, 6 ** 3]]'], {'mask': '[[1, 1, 0], [0, 1, 1]]'}), '([[1 ** 2, 2 ** 4, 3 ** 3], [4 ** 2, 5 ** 4, 6 ** 3]], mask=[[1, 1, 0],\n [0, 1, 1]])\n', (140349, 140436), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((140534, 140558), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'ctrl'], {}), '(test, ctrl)\n', (140546, 140558), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((140567, 140601), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'ctrl.mask'], {}), '(test.mask, ctrl.mask)\n', (140579, 140601), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((140689, 140713), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'ctrl'], {}), '(test, ctrl)\n', (140701, 140713), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((140722, 140755), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'a2m.mask'], {}), '(test.mask, a2m.mask)\n', (140734, 140755), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((140843, 140867), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'ctrl'], {}), '(test, ctrl)\n', (140855, 140867), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((140876, 140909), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'b2m.mask'], {}), '(test.mask, b2m.mask)\n', (140888, 140909), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((140926, 141018), 'numpy.ma.core.array', 'array', (['[[2 ** 2, 4 ** 4, 3 ** 3], [2 ** 2, 4 ** 4, 3 ** 3]]'], {'mask': '[[0, 1, 0], [0, 1, 0]]'}), '([[2 ** 2, 4 ** 4, 3 ** 3], [2 ** 2, 4 ** 4, 3 ** 3]], mask=[[0, 1, 0],\n [0, 1, 0]])\n', (140931, 141018), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((141069, 141093), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'ctrl'], {}), '(test, ctrl)\n', (141081, 141093), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((141102, 141136), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'ctrl.mask'], {}), '(test.mask, ctrl.mask)\n', (141114, 141136), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((141170, 141194), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'ctrl'], {}), '(test, ctrl)\n', (141182, 141194), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((141203, 141237), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'ctrl.mask'], {}), '(test.mask, ctrl.mask)\n', (141215, 141237), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((141311, 141390), 'numpy.array', 'np.array', (['[1.0, 1.0, 1.0, -2.0, pi / 2.0, 4.0, 5.0, -10.0, 10.0, 1.0, 2.0, 3.0]'], {}), '([1.0, 1.0, 1.0, -2.0, pi / 2.0, 4.0, 5.0, -10.0, 10.0, 1.0, 2.0, 3.0])\n', (141319, 141390), True, 'import numpy as np\n'), ((141390, 141465), 'numpy.array', 'np.array', (['[5.0, 0.0, 3.0, 2.0, -1.0, -4.0, 0.0, -10.0, 10.0, 1.0, 0.0, 3.0]'], {}), '([5.0, 0.0, 3.0, 2.0, -1.0, -4.0, 0.0, -10.0, 10.0, 1.0, 0.0, 3.0])\n', (141398, 141465), True, 'import numpy as np\n'), ((141567, 141591), 'numpy.ma.core.masked_array', 'masked_array', (['x'], {'mask': 'm1'}), '(x, mask=m1)\n', (141579, 141591), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((141605, 141629), 'numpy.ma.core.masked_array', 'masked_array', (['y'], {'mask': 'm2'}), '(y, mask=m2)\n', (141617, 141629), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((141676, 141697), 'numpy.ma.core.where', 'where', (['(xm > 2)', 'xm', '(-9)'], {}), '(xm > 2, xm, -9)\n', (141681, 141697), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((141706, 141797), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['d', '[-9.0, -9.0, -9.0, -9.0, -9.0, 4.0, -9.0, -9.0, 10.0, -9.0, -9.0, 3.0]'], {}), '(d, [-9.0, -9.0, -9.0, -9.0, -9.0, 4.0, -9.0, -9.0, 10.0, -9.0,\n -9.0, 3.0])\n', (141718, 141797), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((141815, 141846), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['d._mask', 'xm._mask'], {}), '(d._mask, xm._mask)\n', (141827, 141846), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((141859, 141880), 'numpy.ma.core.where', 'where', (['(xm > 2)', '(-9)', 'ym'], {}), '(xm > 2, -9, ym)\n', (141864, 141880), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((141889, 141978), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['d', '[5.0, 0.0, 3.0, 2.0, -1.0, -9.0, -9.0, -10.0, -9.0, 1.0, 0.0, -9.0]'], {}), '(d, [5.0, 0.0, 3.0, 2.0, -1.0, -9.0, -9.0, -10.0, -9.0, 1.0, \n 0.0, -9.0])\n', (141901, 141978), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((141995, 142054), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['d._mask', '[1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0]'], {}), '(d._mask, [1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0])\n', (142007, 142054), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((142067, 142092), 'numpy.ma.core.where', 'where', (['(xm > 2)', 'xm', 'masked'], {}), '(xm > 2, xm, masked)\n', (142072, 142092), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((142101, 142192), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['d', '[-9.0, -9.0, -9.0, -9.0, -9.0, 4.0, -9.0, -9.0, 10.0, -9.0, -9.0, 3.0]'], {}), '(d, [-9.0, -9.0, -9.0, -9.0, -9.0, 4.0, -9.0, -9.0, 10.0, -9.0,\n -9.0, 3.0])\n', (142113, 142192), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((142283, 142309), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['d._mask', 'tmp'], {}), '(d._mask, tmp)\n', (142295, 142309), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((142352, 142379), 'numpy.ma.core.where', 'where', (['(ixm > 2)', 'ixm', 'masked'], {}), '(ixm > 2, ixm, masked)\n', (142357, 142379), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((142388, 142451), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['d', '[-9, -9, -9, -9, -9, 4, -9, -9, 10, -9, -9, 3]'], {}), '(d, [-9, -9, -9, -9, -9, 4, -9, -9, 10, -9, -9, 3])\n', (142400, 142451), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((142460, 142492), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['d.dtype', 'ixm.dtype'], {}), '(d.dtype, ixm.dtype)\n', (142472, 142492), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((142539, 142553), 'numpy.array', 'np.array', (['None'], {}), '(None)\n', (142547, 142553), True, 'import numpy as np\n'), ((142566, 142584), 'numpy.ma.core.masked_array', 'masked_array', (['None'], {}), '(None)\n', (142578, 142584), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((142762, 142772), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (142768, 142772), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((142856, 142875), 'numpy.ma.core.where', 'where', (['c', 'x', 'masked'], {}), '(c, x, masked)\n', (142861, 142875), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((142884, 142911), 'numpy.ma.testutils.assert_', 'assert_', (['(z.dtype is x.dtype)'], {}), '(z.dtype is x.dtype)\n', (142891, 142911), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((142920, 142943), 'numpy.ma.testutils.assert_', 'assert_', (['(z[3] is masked)'], {}), '(z[3] is masked)\n', (142927, 142943), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((142952, 142975), 'numpy.ma.testutils.assert_', 'assert_', (['(z[4] is masked)'], {}), '(z[4] is masked)\n', (142959, 142975), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((142984, 143007), 'numpy.ma.testutils.assert_', 'assert_', (['(z[7] is masked)'], {}), '(z[7] is masked)\n', (142991, 143007), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143016, 143043), 'numpy.ma.testutils.assert_', 'assert_', (['(z[8] is not masked)'], {}), '(z[8] is not masked)\n', (143023, 143043), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143052, 143079), 'numpy.ma.testutils.assert_', 'assert_', (['(z[9] is not masked)'], {}), '(z[9] is not masked)\n', (143059, 143079), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143088, 143106), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', 'z'], {}), '(x, z)\n', (143100, 143106), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143148, 143167), 'numpy.ma.core.where', 'where', (['c', 'masked', 'x'], {}), '(c, masked, x)\n', (143153, 143167), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((143176, 143203), 'numpy.ma.testutils.assert_', 'assert_', (['(z.dtype is x.dtype)'], {}), '(z.dtype is x.dtype)\n', (143183, 143203), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143212, 143235), 'numpy.ma.testutils.assert_', 'assert_', (['(z[3] is masked)'], {}), '(z[3] is masked)\n', (143219, 143235), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143244, 143271), 'numpy.ma.testutils.assert_', 'assert_', (['(z[4] is not masked)'], {}), '(z[4] is not masked)\n', (143251, 143271), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143280, 143307), 'numpy.ma.testutils.assert_', 'assert_', (['(z[7] is not masked)'], {}), '(z[7] is not masked)\n', (143287, 143307), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143316, 143339), 'numpy.ma.testutils.assert_', 'assert_', (['(z[8] is masked)'], {}), '(z[8] is masked)\n', (143323, 143339), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143348, 143371), 'numpy.ma.testutils.assert_', 'assert_', (['(z[9] is masked)'], {}), '(z[9] is masked)\n', (143355, 143371), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143433, 143465), 'numpy.ma.core.array', 'array', (['[1.0, 2.0, 3.0, 4.0, 5.0]'], {}), '([1.0, 2.0, 3.0, 4.0, 5.0])\n', (143438, 143465), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((143473, 143495), 'numpy.ma.core.array', 'array', (['[1, 1, 1, 0, 0]'], {}), '([1, 1, 1, 0, 0])\n', (143478, 143495), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((143530, 143545), 'numpy.ma.core.where', 'where', (['c', 'x', '(-x)'], {}), '(c, x, -x)\n', (143535, 143545), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((143554, 143596), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[1.0, 2.0, 0.0, -4.0, -5]'], {}), '(z, [1.0, 2.0, 0.0, -4.0, -5])\n', (143566, 143596), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143627, 143642), 'numpy.ma.core.where', 'where', (['c', 'x', '(-x)'], {}), '(c, x, -x)\n', (143632, 143642), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((143651, 143693), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[1.0, 2.0, 0.0, -4.0, -5]'], {}), '(z, [1.0, 2.0, 0.0, -4.0, -5])\n', (143663, 143693), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143698, 143721), 'numpy.ma.testutils.assert_', 'assert_', (['(z[0] is masked)'], {}), '(z[0] is masked)\n', (143705, 143721), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143730, 143757), 'numpy.ma.testutils.assert_', 'assert_', (['(z[1] is not masked)'], {}), '(z[1] is not masked)\n', (143737, 143757), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143766, 143789), 'numpy.ma.testutils.assert_', 'assert_', (['(z[2] is masked)'], {}), '(z[2] is masked)\n', (143773, 143789), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((143803, 143815), 'numpy.ma.core.arange', 'arange', (['(1)', '(6)'], {}), '(1, 6)\n', (143809, 143815), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((143903, 143947), 'numpy.ma.core.array', 'array', (['[1, 1, 1, 0, 0]'], {'mask': '[1, 0, 0, 0, 0]'}), '([1, 1, 1, 0, 0], mask=[1, 0, 0, 0, 0])\n', (143908, 143947), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((143985, 143999), 'numpy.ma.core.where', 'where', (['c', 'x', 'y'], {}), '(c, x, y)\n', (143990, 143999), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((144013, 144028), 'numpy.ma.core.where', 'where', (['cm', 'x', 'y'], {}), '(cm, x, y)\n', (144018, 144028), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((144037, 144056), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', 'zm'], {}), '(z, zm)\n', (144049, 144056), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((144104, 144139), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['zm', '[1, 2, 3, 40, 50]'], {}), '(zm, [1, 2, 3, 40, 50])\n', (144116, 144139), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((144152, 144171), 'numpy.ma.core.where', 'where', (['c', 'masked', '(1)'], {}), '(c, masked, 1)\n', (144157, 144171), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((144180, 144215), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[99, 99, 99, 1, 1]'], {}), '(z, [99, 99, 99, 1, 1])\n', (144192, 144215), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((144228, 144247), 'numpy.ma.core.where', 'where', (['c', '(1)', 'masked'], {}), '(c, 1, masked)\n', (144233, 144247), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((144256, 144291), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['z', '[99, 1, 1, 99, 99]'], {}), '(z, [99, 1, 1, 99, 99])\n', (144268, 144291), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((144384, 144412), 'numpy.arange', 'np.arange', (['(4)'], {'dtype': 'np.int32'}), '(4, dtype=np.int32)\n', (144393, 144412), True, 'import numpy as np\n'), ((144522, 144569), 'numpy.find_common_type', 'np.find_common_type', (['[np.int32, np.float32]', '[]'], {}), '([np.int32, np.float32], [])\n', (144541, 144569), True, 'import numpy as np\n'), ((144578, 144605), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (144590, 144605), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((144779, 144808), 'numpy.ma.core.choose', 'choose', (['[2, 3, 1, 0]', 'choices'], {}), '([2, 3, 1, 0], choices)\n', (144785, 144808), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((144879, 144921), 'numpy.ma.core.choose', 'choose', (['[2, 4, 1, 0]', 'choices'], {'mode': '"""clip"""'}), "([2, 4, 1, 0], choices, mode='clip')\n", (144885, 144921), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((144992, 145034), 'numpy.ma.core.choose', 'choose', (['[2, 4, 1, 0]', 'choices'], {'mode': '"""wrap"""'}), "([2, 4, 1, 0], choices, mode='wrap')\n", (144998, 145034), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((145147, 145185), 'numpy.ma.core.array', 'array', (['[2, 4, 1, 0]'], {'mask': '[1, 0, 0, 1]'}), '([2, 4, 1, 0], mask=[1, 0, 0, 1])\n', (145152, 145185), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((145203, 145241), 'numpy.ma.core.choose', 'choose', (['indices_', 'choices'], {'mode': '"""wrap"""'}), "(indices_, choices, mode='wrap')\n", (145209, 145241), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((145303, 145342), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['chosen.mask', '[1, 0, 0, 1]'], {}), '(chosen.mask, [1, 0, 0, 1])\n', (145315, 145342), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((145402, 145479), 'numpy.ma.core.array', 'array', (['choices'], {'mask': '[[0, 0, 0, 1], [1, 1, 0, 1], [1, 0, 0, 0], [0, 0, 0, 0]]'}), '(choices, mask=[[0, 0, 0, 1], [1, 1, 0, 1], [1, 0, 0, 0], [0, 0, 0, 0]])\n', (145407, 145479), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((145568, 145606), 'numpy.ma.core.choose', 'choose', (['indices_', 'choices'], {'mode': '"""wrap"""'}), "(indices_, choices, mode='wrap')\n", (145574, 145606), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((145668, 145707), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['chosen.mask', '[1, 0, 0, 1]'], {}), '(chosen.mask, [1, 0, 0, 1])\n', (145680, 145707), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((145918, 145937), 'numpy.ma.core.empty', 'empty', (['(4)'], {'dtype': 'int'}), '(4, dtype=int)\n', (145923, 145937), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((145955, 145995), 'numpy.ma.core.choose', 'choose', (['[2, 3, 1, 0]', 'choices'], {'out': 'store'}), '([2, 3, 1, 0], choices, out=store)\n', (145961, 145995), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146152, 146171), 'numpy.ma.core.empty', 'empty', (['(4)'], {'dtype': 'int'}), '(4, dtype=int)\n', (146157, 146171), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146191, 146229), 'numpy.ma.core.array', 'array', (['[2, 3, 1, 0]'], {'mask': '[1, 0, 0, 1]'}), '([2, 3, 1, 0], mask=[1, 0, 0, 1])\n', (146196, 146229), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146247, 146296), 'numpy.ma.core.choose', 'choose', (['indices_', 'choices'], {'mode': '"""wrap"""', 'out': 'store'}), "(indices_, choices, mode='wrap', out=store)\n", (146253, 146296), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146358, 146396), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['store.mask', '[1, 0, 0, 1]'], {}), '(store.mask, [1, 0, 0, 1])\n', (146370, 146396), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((146476, 146553), 'numpy.ma.core.array', 'array', (['choices'], {'mask': '[[0, 0, 0, 1], [1, 1, 0, 1], [1, 0, 0, 0], [0, 0, 0, 0]]'}), '(choices, mask=[[0, 0, 0, 1], [1, 1, 0, 1], [1, 0, 0, 0], [0, 0, 0, 0]])\n', (146481, 146553), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146692, 146741), 'numpy.ma.core.choose', 'choose', (['indices_', 'choices'], {'mode': '"""wrap"""', 'out': 'store'}), "(indices_, choices, mode='wrap', out=store)\n", (146698, 146741), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146844, 146854), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (146850, 146854), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146941, 146970), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.shape', '(5, 2)'], {}), '(b.shape, (5, 2))\n', (146953, 146970), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((147097, 147126), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.shape', '(5, 2)'], {}), '(b.shape, (5, 2))\n', (147109, 147126), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((147237, 147266), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.shape', '(5, 2)'], {}), '(b.shape, (5, 2))\n', (147249, 147266), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((147375, 147404), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['b.shape', '(5, 2)'], {}), '(b.shape, (5, 2))\n', (147387, 147404), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((147456, 147477), 'numpy.reshape', 'np.reshape', (['a', '(2, 5)'], {}), '(a, (2, 5))\n', (147466, 147477), True, 'import numpy as np\n'), ((147538, 147567), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['c.shape', '(2, 5)'], {}), '(c.shape, (2, 5))\n', (147550, 147567), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((147802, 147824), 'numpy.ma.core.make_mask_descr', 'make_mask_descr', (['ntype'], {}), '(ntype)\n', (147817, 147824), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((147833, 147885), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', "[('a', np.bool), ('b', np.bool)]"], {}), "(test, [('a', np.bool), ('b', np.bool)])\n", (147845, 147885), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((147959, 147981), 'numpy.ma.core.make_mask_descr', 'make_mask_descr', (['ntype'], {}), '(ntype)\n', (147974, 147981), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((147990, 148022), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '(np.bool, 2)'], {}), '(test, (np.bool, 2))\n', (148002, 148022), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((148091, 148113), 'numpy.ma.core.make_mask_descr', 'make_mask_descr', (['ntype'], {}), '(ntype)\n', (148106, 148113), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((148271, 148293), 'numpy.ma.core.make_mask_descr', 'make_mask_descr', (['ntype'], {}), '(ntype)\n', (148286, 148293), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((148312, 148372), 'numpy.dtype', 'np.dtype', (["[('a', 'b1'), ('b', [('ba', 'b1'), ('bb', 'b1')])]"], {}), "([('a', 'b1'), ('b', [('ba', 'b1'), ('bb', 'b1')])])\n", (148320, 148372), True, 'import numpy as np\n'), ((148381, 148408), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (148393, 148408), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((148486, 148508), 'numpy.ma.core.make_mask_descr', 'make_mask_descr', (['ntype'], {}), '(ntype)\n', (148501, 148508), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((148640, 148662), 'numpy.ma.core.make_mask_descr', 'make_mask_descr', (['ntype'], {}), '(ntype)\n', (148655, 148662), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((148847, 148862), 'numpy.ma.core.make_mask', 'make_mask', (['mask'], {}), '(mask)\n', (148856, 148862), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((148871, 148905), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.dtype', 'MaskType'], {}), '(test.dtype, MaskType)\n', (148883, 148905), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((148914, 148940), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[0, 1]'], {}), '(test, [0, 1])\n', (148926, 148940), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((148991, 149022), 'numpy.array', 'np.array', (['[0, 1]'], {'dtype': 'np.bool'}), '([0, 1], dtype=np.bool)\n', (148999, 149022), True, 'import numpy as np\n'), ((149038, 149053), 'numpy.ma.core.make_mask', 'make_mask', (['mask'], {}), '(mask)\n', (149047, 149053), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((149062, 149096), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.dtype', 'MaskType'], {}), '(test.dtype, MaskType)\n', (149074, 149096), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((149105, 149131), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[0, 1]'], {}), '(test, [0, 1])\n', (149117, 149131), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((149260, 149300), 'numpy.array', 'np.array', (['[(0, 0), (0, 1)]'], {'dtype': 'mdtype'}), '([(0, 0), (0, 1)], dtype=mdtype)\n', (149268, 149300), True, 'import numpy as np\n'), ((149316, 149331), 'numpy.ma.core.make_mask', 'make_mask', (['mask'], {}), '(mask)\n', (149325, 149331), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((149340, 149374), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.dtype', 'MaskType'], {}), '(test.dtype, MaskType)\n', (149352, 149374), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((149383, 149409), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '[1, 1]'], {}), '(test, [1, 1])\n', (149395, 149409), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((149542, 149582), 'numpy.array', 'np.array', (['[(0, 0), (0, 1)]'], {'dtype': 'mdtype'}), '([(0, 0), (0, 1)], dtype=mdtype)\n', (149550, 149582), True, 'import numpy as np\n'), ((149598, 149631), 'numpy.ma.core.make_mask', 'make_mask', (['mask'], {'dtype': 'mask.dtype'}), '(mask, dtype=mask.dtype)\n', (149607, 149631), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((149640, 149672), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.dtype', 'mdtype'], {}), '(test.dtype, mdtype)\n', (149652, 149672), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((149681, 149705), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'mask'], {}), '(test, mask)\n', (149693, 149705), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((149890, 149930), 'numpy.array', 'np.array', (['[(0, 0), (0, 1)]'], {'dtype': 'mdtype'}), '([(0, 0), (0, 1)], dtype=mdtype)\n', (149898, 149930), True, 'import numpy as np\n'), ((149946, 149979), 'numpy.ma.core.make_mask', 'make_mask', (['mask'], {'dtype': 'mask.dtype'}), '(mask, dtype=mask.dtype)\n', (149955, 149979), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((149988, 150020), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.dtype', 'bdtype'], {}), '(test.dtype, bdtype)\n', (150000, 150020), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((150295, 150334), 'itertools.product', 'itertools.product', (['bools', 'bools', 'dtypes'], {}), '(bools, bools, dtypes)\n', (150312, 150334), False, 'import itertools\n'), ((150582, 150637), 'numpy.array', 'np.array', (['[(0, 0), (0, 1), (1, 0), (0, 0)]'], {'dtype': 'mtype'}), '([(0, 0), (0, 1), (1, 0), (0, 0)], dtype=mtype)\n', (150590, 150637), True, 'import numpy as np\n'), ((150690, 150711), 'numpy.ma.core.mask_or', 'mask_or', (['mask', 'nomask'], {}), '(mask, nomask)\n', (150697, 150711), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((150720, 150744), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'mask'], {}), '(test, mask)\n', (150732, 150744), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((150760, 150781), 'numpy.ma.core.mask_or', 'mask_or', (['nomask', 'mask'], {}), '(nomask, mask)\n', (150767, 150781), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((150790, 150814), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'mask'], {}), '(test, mask)\n', (150802, 150814), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((150861, 150881), 'numpy.ma.core.mask_or', 'mask_or', (['mask', '(False)'], {}), '(mask, False)\n', (150868, 150881), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((150890, 150914), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'mask'], {}), '(test, mask)\n', (150902, 150914), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((150980, 151035), 'numpy.array', 'np.array', (['[(0, 1), (0, 1), (0, 1), (0, 1)]'], {'dtype': 'mtype'}), '([(0, 1), (0, 1), (0, 1), (0, 1)], dtype=mtype)\n', (150988, 151035), True, 'import numpy as np\n'), ((151051, 151071), 'numpy.ma.core.mask_or', 'mask_or', (['mask', 'other'], {}), '(mask, other)\n', (151058, 151071), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((151090, 151145), 'numpy.array', 'np.array', (['[(0, 1), (0, 1), (1, 1), (0, 1)]'], {'dtype': 'mtype'}), '([(0, 1), (0, 1), (1, 1), (0, 1)], dtype=mtype)\n', (151098, 151145), True, 'import numpy as np\n'), ((151154, 151181), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (151166, 151181), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((151303, 151362), 'numpy.array', 'np.array', (['[(0, 1), (0, 1), (0, 1), (0, 1)]'], {'dtype': 'othertype'}), '([(0, 1), (0, 1), (0, 1), (0, 1)], dtype=othertype)\n', (151311, 151362), True, 'import numpy as np\n'), ((151582, 151631), 'numpy.array', 'np.array', (['[(0, (1, 0)), (0, (1, 0))]'], {'dtype': 'dtype'}), '([(0, (1, 0)), (0, (1, 0))], dtype=dtype)\n', (151590, 151631), True, 'import numpy as np\n'), ((151648, 151697), 'numpy.array', 'np.array', (['[(1, (0, 1)), (0, (0, 0))]'], {'dtype': 'dtype'}), '([(1, (0, 1)), (0, (0, 0))], dtype=dtype)\n', (151656, 151697), True, 'import numpy as np\n'), ((151714, 151763), 'numpy.array', 'np.array', (['[(1, (1, 1)), (0, (1, 0))]'], {'dtype': 'dtype'}), '([(1, (1, 1)), (0, (1, 0))], dtype=dtype)\n', (151722, 151763), True, 'import numpy as np\n'), ((151918, 151952), 'numpy.array', 'np.array', (['[0, 0, 1]'], {'dtype': 'np.bool'}), '([0, 0, 1], dtype=np.bool)\n', (151926, 151952), True, 'import numpy as np\n'), ((152040, 152100), 'numpy.array', 'np.array', (['[(0, 0), (0, 1)]'], {'dtype': "[('a', bool), ('b', bool)]"}), "([(0, 0), (0, 1)], dtype=[('a', bool), ('b', bool)])\n", (152048, 152100), True, 'import numpy as np\n'), ((152116, 152134), 'numpy.ma.core.flatten_mask', 'flatten_mask', (['mask'], {}), '(mask)\n', (152128, 152134), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((152153, 152187), 'numpy.array', 'np.array', (['[0, 0, 0, 1]'], {'dtype': 'bool'}), '([0, 0, 0, 1], dtype=bool)\n', (152161, 152187), True, 'import numpy as np\n'), ((152196, 152223), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (152208, 152223), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((152350, 152378), 'numpy.array', 'np.array', (['data'], {'dtype': 'mdtype'}), '(data, dtype=mdtype)\n', (152358, 152378), True, 'import numpy as np\n'), ((152394, 152412), 'numpy.ma.core.flatten_mask', 'flatten_mask', (['mask'], {}), '(mask)\n', (152406, 152412), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((152431, 152471), 'numpy.array', 'np.array', (['[0, 0, 0, 0, 0, 1]'], {'dtype': 'bool'}), '([0, 0, 0, 0, 0, 1], dtype=bool)\n', (152439, 152471), True, 'import numpy as np\n'), ((152480, 152507), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (152492, 152507), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((152589, 152611), 'numpy.array', 'np.array', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (152597, 152611), True, 'import numpy as np\n'), ((152624, 152644), 'numpy.ma.core.array', 'array', (['a'], {'mask': '(False)'}), '(a, mask=False)\n', (152629, 152644), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((152660, 152667), 'numpy.ma.core.anom', 'anom', (['a'], {}), '(a)\n', (152664, 152667), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((152720, 152738), 'numpy.ma.core.reshape', 'reshape', (['a', '(2, 2)'], {}), '(a, (2, 2))\n', (152727, 152738), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((152920, 152932), 'numpy.arange', 'np.arange', (['(8)'], {}), '(8)\n', (152929, 152932), True, 'import numpy as np\n'), ((152973, 153008), 'numpy.array', 'np.array', (['[True, False, True, True]'], {}), '([True, False, True, True])\n', (152981, 153008), True, 'import numpy as np\n'), ((153057, 153090), 'numpy.ma.compress', 'np.ma.compress', (['cond', 'arr'], {'axis': '(0)'}), '(cond, arr, axis=0)\n', (153071, 153090), True, 'import numpy as np\n'), ((153099, 153126), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (153111, 153126), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((153142, 153158), 'numpy.ma.array', 'np.ma.array', (['arr'], {}), '(arr)\n', (153153, 153158), True, 'import numpy as np\n'), ((153174, 153208), 'numpy.ma.compress', 'np.ma.compress', (['cond', 'marr'], {'axis': '(0)'}), '(cond, marr, axis=0)\n', (153188, 153208), True, 'import numpy as np\n'), ((153217, 153244), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (153229, 153244), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((153354, 153373), 'numpy.ma.array', 'np.ma.array', (['[1, 2]'], {}), '([1, 2])\n', (153365, 153373), True, 'import numpy as np\n'), ((153389, 153408), 'numpy.ma.compressed', 'np.ma.compressed', (['a'], {}), '(a)\n', (153405, 153408), True, 'import numpy as np\n'), ((153606, 153625), 'numpy.ma.compressed', 'np.ma.compressed', (['a'], {}), '(a)\n', (153622, 153625), True, 'import numpy as np\n'), ((153713, 153741), 'numpy.ma.compressed', 'np.ma.compressed', (['[[1], [2]]'], {}), '([[1], [2]])\n', (153729, 153741), True, 'import numpy as np\n'), ((153749, 153775), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.ndim', '(1)'], {}), '(test.ndim, 1)\n', (153761, 153775), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((153791, 153820), 'numpy.ma.compressed', 'np.ma.compressed', (['[[[[[1]]]]]'], {}), '([[[[[1]]]]])\n', (153807, 153820), True, 'import numpy as np\n'), ((153829, 153855), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.ndim', '(1)'], {}), '(test.ndim, 1)\n', (153841, 153855), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((154018, 154044), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.ndim', '(1)'], {}), '(test.ndim, 1)\n', (154030, 154044), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((154235, 154257), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', '(42)'], {}), '(test, 42)\n', (154247, 154257), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((155793, 155824), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base_a.dtype', 'int'], {}), '(base_a.dtype, int)\n', (155805, 155824), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((155833, 155876), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base_a._data', '[3, 2, 3, 4, 5]'], {}), '(base_a._data, [3, 2, 3, 4, 5])\n', (155845, 155876), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((155886, 155919), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base_b.dtype', 'float'], {}), '(base_b.dtype, float)\n', (155898, 155919), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((155928, 155980), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base_b._data', '[pi, 2.2, 3.3, 4.4, 5.5]'], {}), '(base_b._data, [pi, 2.2, 3.3, 4.4, 5.5])\n', (155940, 155980), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((155990, 156023), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base_c.dtype', '"""|S8"""'], {}), "(base_c.dtype, '|S8')\n", (156002, 156023), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((156319, 156350), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base_a.dtype', 'int'], {}), '(base_a.dtype, int)\n', (156331, 156350), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((156359, 156402), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base_a._data', '[3, 3, 3, 4, 5]'], {}), '(base_a._data, [3, 3, 3, 4, 5])\n', (156371, 156402), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((156412, 156445), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base_b.dtype', 'float'], {}), '(base_b.dtype, float)\n', (156424, 156445), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((156454, 156504), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base_b._data', '[pi, pi, pi, 4.4, 5.5]'], {}), '(base_b._data, [pi, pi, pi, 4.4, 5.5])\n', (156466, 156504), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((156514, 156547), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base_c.dtype', '"""|S8"""'], {}), "(base_c.dtype, '|S8')\n", (156526, 156547), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((157063, 157085), 'numpy.ma.core.empty', 'empty', (['(3)'], {'dtype': 'ndtype'}), '(3, dtype=ndtype)\n', (157068, 157085), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((157582, 157600), 'numpy.array', 'np.array', (['iterator'], {}), '(iterator)\n', (157590, 157600), True, 'import numpy as np\n'), ((157613, 157664), 'numpy.ma.core.array', 'array', (['iterator'], {'dtype': "[('a', float), ('b', float)]"}), "(iterator, dtype=[('a', float), ('b', float)])\n", (157618, 157664), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((157714, 157750), 'numpy.array', 'np.array', (['([1] + 19 * [0])'], {'dtype': 'bool'}), '([1] + 19 * [0], dtype=bool)\n', (157722, 157750), True, 'import numpy as np\n'), ((157874, 157910), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'controlmask'], {}), '(test.mask, controlmask)\n', (157886, 157910), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((157989, 158013), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'data'], {}), '(test, data)\n', (158001, 158013), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((158128, 158152), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'data'], {}), '(test, data)\n', (158140, 158152), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((158720, 158764), 'numpy.ma.testutils.assert_equal_records', 'assert_equal_records', (['a[0]._data', 'a._data[0]'], {}), '(a[0]._data, a._data[0])\n', (158740, 158764), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((158773, 158817), 'numpy.ma.testutils.assert_equal_records', 'assert_equal_records', (['a[0]._mask', 'a._mask[0]'], {}), '(a[0]._mask, a._mask[0])\n', (158793, 158817), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((158911, 158957), 'numpy.ma.testutils.assert_equal_records', 'assert_equal_records', (['a[-2]._data', 'a._data[-2]'], {}), '(a[-2]._data, a._data[-2])\n', (158931, 158957), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((158966, 159012), 'numpy.ma.testutils.assert_equal_records', 'assert_equal_records', (['a[-2]._mask', 'a._mask[-2]'], {}), '(a[-2]._mask, a._mask[-2])\n', (158986, 159012), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((159172, 159208), 'numpy.dtype', 'np.dtype', (["[('a', float), ('b', int)]"], {}), "([('a', float), ('b', int)])\n", (159180, 159208), True, 'import numpy as np\n'), ((159222, 159275), 'numpy.ma.MaskedArray', 'np.ma.MaskedArray', (['[(1.0, 1), (2.0, 2)]'], {'dtype': 'ndtype'}), '([(1.0, 1), (2.0, 2)], dtype=ndtype)\n', (159239, 159275), True, 'import numpy as np\n'), ((159468, 159504), 'numpy.dtype', 'np.dtype', (["[('a', bool), ('b', bool)]"], {}), "([('a', bool), ('b', bool)])\n", (159476, 159504), True, 'import numpy as np\n'), ((159543, 159596), 'numpy.array', 'np.array', (['[(False, True), (True, True)]'], {'dtype': 'mdtype'}), '([(False, True), (True, True)], dtype=mdtype)\n', (159551, 159596), True, 'import numpy as np\n'), ((159609, 159645), 'numpy.ma.masked_all', 'np.ma.masked_all', (['(2,)'], {'dtype': 'ndtype'}), '((2,), dtype=ndtype)\n', (159625, 159645), True, 'import numpy as np\n'), ((159676, 159705), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', 'control'], {}), '(a.mask, control)\n', (159688, 159705), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((159718, 159754), 'numpy.ma.masked_all', 'np.ma.masked_all', (['(2,)'], {'dtype': 'ndtype'}), '((2,), dtype=ndtype)\n', (159734, 159754), True, 'import numpy as np\n'), ((159785, 159814), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', 'control'], {}), '(a.mask, control)\n', (159797, 159814), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((159853, 159905), 'numpy.array', 'np.array', (['[(True, True), (True, True)]'], {'dtype': 'mdtype'}), '([(True, True), (True, True)], dtype=mdtype)\n', (159861, 159905), True, 'import numpy as np\n'), ((159918, 159954), 'numpy.ma.masked_all', 'np.ma.masked_all', (['(2,)'], {'dtype': 'ndtype'}), '((2,), dtype=ndtype)\n', (159934, 159954), True, 'import numpy as np\n'), ((160009, 160038), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', 'control'], {}), '(a.mask, control)\n', (160021, 160038), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((160051, 160087), 'numpy.ma.masked_all', 'np.ma.masked_all', (['(2,)'], {'dtype': 'ndtype'}), '((2,), dtype=ndtype)\n', (160067, 160087), True, 'import numpy as np\n'), ((160142, 160171), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', 'control'], {}), '(a.mask, control)\n', (160154, 160171), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((160502, 160520), 'numpy.array', 'np.array', (['iterator'], {}), '(iterator)\n', (160510, 160520), True, 'import numpy as np\n'), ((160533, 160584), 'numpy.ma.core.array', 'array', (['iterator'], {'dtype': "[('a', float), ('b', float)]"}), "(iterator, dtype=[('a', float), ('b', float)])\n", (160538, 160584), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((160634, 160670), 'numpy.array', 'np.array', (['([1] + 19 * [0])'], {'dtype': 'bool'}), '([1] + 19 * [0], dtype=bool)\n', (160642, 160670), True, 'import numpy as np\n'), ((160881, 160914), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test._data', 'a._data'], {}), '(test._data, a._data)\n', (160893, 160914), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((160923, 160956), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test._mask', 'a._mask'], {}), '(test._mask, a._mask)\n', (160935, 160956), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((161135, 161162), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'a._data'], {}), '(test, a._data)\n', (161147, 161162), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((161470, 161506), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', 'controlmask'], {}), '(test.mask, controlmask)\n', (161482, 161506), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((161655, 161702), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask.dtype.names', "('A', 'B')"], {}), "(test.mask.dtype.names, ('A', 'B'))\n", (161667, 161702), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((161711, 161742), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["test['A']", "a['a']"], {}), "(test['A'], a['a'])\n", (161723, 161742), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((161751, 161782), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["test['B']", "a['b']"], {}), "(test['B'], a['b'])\n", (161763, 161782), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((161902, 161949), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask.dtype.names', "('A', 'B')"], {}), "(test.mask.dtype.names, ('A', 'B'))\n", (161914, 161949), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((161958, 161992), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["test['A']", "a['a'][0]"], {}), "(test['A'], a['a'][0])\n", (161970, 161992), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((162001, 162035), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["test['B']", "a['b'][0]"], {}), "(test['B'], a['b'][0])\n", (162013, 162035), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((162156, 162198), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.dtype.names', "('A', 'B')"], {}), "(test.dtype.names, ('A', 'B'))\n", (162168, 162198), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((162207, 162242), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["test['A']", "a['a'][-1]"], {}), "(test['A'], a['a'][-1])\n", (162219, 162242), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((162251, 162286), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["test['B']", "a['b'][-1]"], {}), "(test['B'], a['b'][-1])\n", (162263, 162286), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((162489, 162513), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'data'], {}), '(test, data)\n', (162501, 162513), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((162709, 162736), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'data[0]'], {}), '(test, data[0])\n', (162721, 162736), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((162745, 162776), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test.mask', '(1, 0)'], {}), '(test.mask, (1, 0))\n', (162757, 162776), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((162915, 162943), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'data[-1]'], {}), '(test, data[-1])\n', (162927, 162943), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((163085, 163109), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'data'], {}), '(test, data)\n', (163097, 163109), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((163555, 163577), 'numpy.ma.array', 'np.ma.array', (['d'], {'mask': 'm'}), '(d, mask=m)\n', (163566, 163577), True, 'import numpy as np\n'), ((164876, 164898), 'numpy.ma.array', 'np.ma.array', (['d'], {'mask': 'm'}), '(d, mask=m)\n', (164887, 164898), True, 'import numpy as np\n'), ((165196, 165218), 'numpy.ma.array', 'np.ma.array', (['d'], {'mask': 'm'}), '(d, mask=m)\n', (165207, 165218), True, 'import numpy as np\n'), ((165639, 165687), 'numpy.testing.assert_raises', 'assert_raises', (['ValueError', 'count', 'a'], {'axis': '(1, 1)'}), '(ValueError, count, a, axis=(1, 1))\n', (165652, 165687), False, 'from numpy.testing import TestCase, run_module_suite, assert_raises\n'), ((165695, 165738), 'numpy.testing.assert_raises', 'assert_raises', (['ValueError', 'count', 'a'], {'axis': '(3)'}), '(ValueError, count, a, axis=3)\n', (165708, 165738), False, 'from numpy.testing import TestCase, run_module_suite, assert_raises\n'), ((165786, 165813), 'numpy.ma.array', 'np.ma.array', (['d'], {'mask': 'nomask'}), '(d, mask=nomask)\n', (165797, 165813), True, 'import numpy as np\n'), ((166234, 166282), 'numpy.testing.assert_raises', 'assert_raises', (['ValueError', 'count', 'a'], {'axis': '(1, 1)'}), '(ValueError, count, a, axis=(1, 1))\n', (166247, 166282), False, 'from numpy.testing import TestCase, run_module_suite, assert_raises\n'), ((166290, 166333), 'numpy.testing.assert_raises', 'assert_raises', (['ValueError', 'count', 'a'], {'axis': '(3)'}), '(ValueError, count, a, axis=3)\n', (166303, 166333), False, 'from numpy.testing import TestCase, run_module_suite, assert_raises\n'), ((166631, 166645), 'numpy.argwhere', 'np.argwhere', (['a'], {}), '(a)\n', (166642, 166645), True, 'import numpy as np\n'), ((3560, 3577), 'numpy.ma.core.isMaskedArray', 'isMaskedArray', (['xm'], {}), '(xm)\n', (3573, 3577), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((3735, 3747), 'numpy.shape', 'np.shape', (['xm'], {}), '(xm)\n', (3743, 3747), True, 'import numpy as np\n'), ((3896, 3925), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 's'], {}), '(lambda x, y: x * y, s)\n', (3902, 3925), False, 'from functools import reduce\n'), ((3947, 3956), 'numpy.ma.core.count', 'count', (['xm'], {}), '(xm)\n', (3952, 3956), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((4061, 4078), 'numpy.ma.core.filled', 'filled', (['xm', '(1e+20)'], {}), '(xm, 1e+20)\n', (4067, 4078), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((4581, 4606), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm.shape', 's'], {}), '(xm.shape, s)\n', (4593, 4606), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((4760, 4780), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', 'xf'], {}), '(xm, xf)\n', (4772, 4780), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((4841, 4860), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', 'xm'], {}), '(x, xm)\n', (4853, 4860), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((5039, 5061), 'numpy.concatenate', 'np.concatenate', (['(x, y)'], {}), '((x, y))\n', (5053, 5061), True, 'import numpy as np\n'), ((5063, 5084), 'numpy.ma.core.concatenate', 'concatenate', (['(xm, ym)'], {}), '((xm, ym))\n', (5074, 5084), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((5107, 5129), 'numpy.concatenate', 'np.concatenate', (['(x, y)'], {}), '((x, y))\n', (5121, 5129), True, 'import numpy as np\n'), ((5131, 5150), 'numpy.ma.core.concatenate', 'concatenate', (['(x, y)'], {}), '((x, y))\n', (5142, 5150), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((5173, 5195), 'numpy.concatenate', 'np.concatenate', (['(x, y)'], {}), '((x, y))\n', (5187, 5195), True, 'import numpy as np\n'), ((5197, 5217), 'numpy.ma.core.concatenate', 'concatenate', (['(xm, y)'], {}), '((xm, y))\n', (5208, 5217), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((5240, 5265), 'numpy.concatenate', 'np.concatenate', (['(x, y, x)'], {}), '((x, y, x))\n', (5254, 5265), True, 'import numpy as np\n'), ((5267, 5290), 'numpy.ma.core.concatenate', 'concatenate', (['(x, ym, x)'], {}), '((x, ym, x))\n', (5278, 5290), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((5562, 5579), 'numpy.reshape', 'np.reshape', (['m1', 's'], {}), '(m1, s)\n', (5572, 5579), True, 'import numpy as np\n'), ((5611, 5628), 'numpy.reshape', 'np.reshape', (['m2', 's'], {}), '(m2, s)\n', (5621, 5628), True, 'import numpy as np\n'), ((5691, 5716), 'numpy.concatenate', 'np.concatenate', (['(x, y)', '(1)'], {}), '((x, y), 1)\n', (5705, 5716), True, 'import numpy as np\n'), ((5745, 5782), 'numpy.concatenate', 'np.concatenate', (['(xm.mask, ym.mask)', '(1)'], {}), '((xm.mask, ym.mask), 1)\n', (5759, 5782), True, 'import numpy as np\n'), ((5836, 5843), 'numpy.ma.core.ones', 'ones', (['(2)'], {}), '(2)\n', (5840, 5843), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((7766, 7801), 'numpy.may_share_memory', 'np.may_share_memory', (['x.mask', 'y.mask'], {}), '(x.mask, y.mask)\n', (7785, 7801), True, 'import numpy as np\n'), ((8058, 8070), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (8067, 8070), True, 'import numpy as np\n'), ((8865, 8874), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (8871, 8874), True, 'import numpy as np\n'), ((9083, 9092), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (9089, 9092), True, 'import numpy as np\n'), ((9307, 9336), 'numpy.errstate', 'np.errstate', ([], {'invalid': '"""ignore"""'}), "(invalid='ignore')\n", (9318, 9336), True, 'import numpy as np\n'), ((9357, 9405), 'numpy.ma.core.masked_array', 'masked_array', (['[np.nan, 0.0, 1.0]'], {'mask': '[0, 0, 1]'}), '([np.nan, 0.0, 1.0], mask=[0, 0, 1])\n', (9369, 9405), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((9429, 9446), 'numpy.ma.core.fix_invalid', 'fix_invalid', (['data'], {}), '(data)\n', (9440, 9446), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((9459, 9518), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['data_fixed._data', '[data.fill_value, 0.0, 1.0]'], {}), '(data_fixed._data, [data.fill_value, 0.0, 1.0])\n', (9471, 9518), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((9529, 9576), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['data_fixed._mask', '[1.0, 0.0, 1.0]'], {}), '(data_fixed._mask, [1.0, 0.0, 1.0])\n', (9541, 9576), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((9792, 9807), 'numpy.ma.core.filled', 'filled', (['x[1]', '(0)'], {}), '(x[1], 0)\n', (9798, 9807), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((10488, 10499), 'numpy.sort', 'np.sort', (['x1'], {}), '(x1)\n', (10495, 10499), True, 'import numpy as np\n'), ((10501, 10524), 'numpy.ma.core.sort', 'sort', (['x2'], {'endwith': '(False)'}), '(x2, endwith=False)\n', (10505, 10524), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11451, 11463), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (11460, 11463), True, 'import numpy as np\n'), ((13981, 14002), 'numpy.ma.core.allequal', 'allequal', (['x1', 'y1.data'], {}), '(x1, y1.data)\n', (13989, 14002), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((14657, 14677), 'numpy.ma.core.allequal', 'allequal', (['y2.mask', '(0)'], {}), '(y2.mask, 0)\n', (14665, 14677), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((14877, 14898), 'numpy.ma.core.concatenate', 'concatenate', (['[x4, x4]'], {}), '([x4, x4])\n', (14888, 14898), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((14925, 14936), 'numpy.ma.core.getmask', 'getmask', (['y4'], {}), '(y4)\n', (14932, 14936), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((18721, 18736), 'pickle.dumps', 'pickle.dumps', (['b'], {}), '(b)\n', (18733, 18736), False, 'import pickle\n'), ((19361, 19374), 'numpy.ma.core.array', 'array', (['[1, 1]'], {}), '([1, 1])\n', (19366, 19374), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((19390, 19415), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (19413, 19415), False, 'import warnings\n'), ((19429, 19473), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'UserWarning'], {}), "('ignore', UserWarning)\n", (19450, 19473), False, 'import warnings\n'), ((22022, 22066), 'numpy.array', 'np.array', (["[(1, '1', 1.0)]"], {'dtype': 'flexi.dtype'}), "([(1, '1', 1.0)], dtype=flexi.dtype)\n", (22030, 22066), True, 'import numpy as np\n'), ((23650, 23693), 'numpy.array', 'np.array', (['[(0, 1, 2), (4, 5, 6)]'], {'order': '"""F"""'}), "([(0, 1, 2), (4, 5, 6)], order='F')\n", (23658, 23693), True, 'import numpy as np\n'), ((27014, 27046), 'numpy.array', 'np.array', (['[(1, 2)]'], {'dtype': 'ndtype'}), '([(1, 2)], dtype=ndtype)\n', (27022, 27046), True, 'import numpy as np\n'), ((27123, 27174), 'numpy.ma.core.masked_array', 'masked_array', (['[(1, 2)]'], {'mask': '[(1, 0)]', 'dtype': 'ndtype'}), '([(1, 2)], mask=[(1, 0)], dtype=ndtype)\n', (27135, 27174), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((28189, 28247), 'numpy.ma.core.masked_array', 'masked_array', ([], {'data': '[0, 1]', 'mask': '[True, False]', 'dtype': '""">i2"""'}), "(data=[0, 1], mask=[True, False], dtype='>i2')\n", (28201, 28247), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((29062, 29106), 'numpy.ma.core.masked_print_option.set_display', 'masked_print_option.set_display', (['ini_display'], {}), '(ini_display)\n', (29093, 29106), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((31160, 31190), 'numpy.all', 'np.all', (['(mx[1].data == mx2.data)'], {}), '(mx[1].data == mx2.data)\n', (31166, 31190), True, 'import numpy as np\n'), ((31208, 31226), 'numpy.all', 'np.all', (['mx[1].mask'], {}), '(mx[1].mask)\n', (31214, 31226), True, 'import numpy as np\n'), ((32734, 32755), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(-x)', '(-xm)'], {}), '(-x, -xm)\n', (32746, 32755), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((32768, 32796), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(x + y)', '(xm + ym)'], {}), '(x + y, xm + ym)\n', (32780, 32796), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((32809, 32837), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(x - y)', '(xm - ym)'], {}), '(x - y, xm - ym)\n', (32821, 32837), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((32850, 32878), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(x * y)', '(xm * ym)'], {}), '(x * y, xm * ym)\n', (32862, 32878), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((32891, 32919), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(x / y)', '(xm / ym)'], {}), '(x / y, xm / ym)\n', (32903, 32919), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((32932, 32963), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a10 + y)', '(a10 + ym)'], {}), '(a10 + y, a10 + ym)\n', (32944, 32963), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((32976, 33007), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a10 - y)', '(a10 - ym)'], {}), '(a10 - y, a10 - ym)\n', (32988, 33007), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33020, 33051), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a10 * y)', '(a10 * ym)'], {}), '(a10 * y, a10 * ym)\n', (33032, 33051), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33064, 33095), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(a10 / y)', '(a10 / ym)'], {}), '(a10 / y, a10 / ym)\n', (33076, 33095), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33108, 33139), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(x + a10)', '(xm + a10)'], {}), '(x + a10, xm + a10)\n', (33120, 33139), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33152, 33183), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(x - a10)', '(xm - a10)'], {}), '(x - a10, xm - a10)\n', (33164, 33183), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33196, 33227), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(x * a10)', '(xm * a10)'], {}), '(x * a10, xm * a10)\n', (33208, 33227), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33240, 33271), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(x / a10)', '(xm / a10)'], {}), '(x / a10, xm / a10)\n', (33252, 33271), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33284, 33313), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(x ** 2)', '(xm ** 2)'], {}), '(x ** 2, xm ** 2)\n', (33296, 33313), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((33382, 33412), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['(x ** y)', '(xm ** ym)'], {}), '(x ** y, xm ** ym)\n', (33394, 33412), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((34523, 34538), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (34531, 34538), True, 'import numpy as np\n'), ((34606, 34625), 'numpy.ma.core.getmaskarray', 'getmaskarray', (['(a / 2)'], {}), '(a / 2)\n', (34618, 34625), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((34659, 34678), 'numpy.ma.core.getmaskarray', 'getmaskarray', (['(2 / a)'], {}), '(2 / a)\n', (34671, 34678), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36285, 36298), 'numpy.ma.core.array', 'array', (['(0, 0)'], {}), '((0, 0))\n', (36290, 36298), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36541, 36550), 'numpy.cos', 'np.cos', (['x'], {}), '(x)\n', (36547, 36550), True, 'import numpy as np\n'), ((36552, 36559), 'numpy.ma.core.cos', 'cos', (['xm'], {}), '(xm)\n', (36555, 36559), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36582, 36592), 'numpy.cosh', 'np.cosh', (['x'], {}), '(x)\n', (36589, 36592), True, 'import numpy as np\n'), ((36594, 36602), 'numpy.ma.core.cosh', 'cosh', (['xm'], {}), '(xm)\n', (36598, 36602), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36625, 36634), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (36631, 36634), True, 'import numpy as np\n'), ((36636, 36643), 'numpy.ma.core.sin', 'sin', (['xm'], {}), '(xm)\n', (36639, 36643), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36666, 36676), 'numpy.sinh', 'np.sinh', (['x'], {}), '(x)\n', (36673, 36676), True, 'import numpy as np\n'), ((36678, 36686), 'numpy.ma.core.sinh', 'sinh', (['xm'], {}), '(xm)\n', (36682, 36686), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36709, 36718), 'numpy.tan', 'np.tan', (['x'], {}), '(x)\n', (36715, 36718), True, 'import numpy as np\n'), ((36720, 36727), 'numpy.ma.core.tan', 'tan', (['xm'], {}), '(xm)\n', (36723, 36727), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36750, 36760), 'numpy.tanh', 'np.tanh', (['x'], {}), '(x)\n', (36757, 36760), True, 'import numpy as np\n'), ((36762, 36770), 'numpy.ma.core.tanh', 'tanh', (['xm'], {}), '(xm)\n', (36766, 36770), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36810, 36818), 'numpy.ma.core.sqrt', 'sqrt', (['xm'], {}), '(xm)\n', (36814, 36818), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36857, 36864), 'numpy.ma.core.log', 'log', (['xm'], {}), '(xm)\n', (36860, 36864), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36905, 36914), 'numpy.ma.core.log10', 'log10', (['xm'], {}), '(xm)\n', (36910, 36914), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36937, 36946), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (36943, 36946), True, 'import numpy as np\n'), ((36948, 36955), 'numpy.ma.core.exp', 'exp', (['xm'], {}), '(xm)\n', (36951, 36955), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36978, 36990), 'numpy.arcsin', 'np.arcsin', (['z'], {}), '(z)\n', (36987, 36990), True, 'import numpy as np\n'), ((36992, 37002), 'numpy.ma.core.arcsin', 'arcsin', (['zm'], {}), '(zm)\n', (36998, 37002), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37025, 37037), 'numpy.arccos', 'np.arccos', (['z'], {}), '(z)\n', (37034, 37037), True, 'import numpy as np\n'), ((37039, 37049), 'numpy.ma.core.arccos', 'arccos', (['zm'], {}), '(zm)\n', (37045, 37049), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37072, 37084), 'numpy.arctan', 'np.arctan', (['z'], {}), '(z)\n', (37081, 37084), True, 'import numpy as np\n'), ((37086, 37096), 'numpy.ma.core.arctan', 'arctan', (['zm'], {}), '(zm)\n', (37092, 37096), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37119, 37135), 'numpy.arctan2', 'np.arctan2', (['x', 'y'], {}), '(x, y)\n', (37129, 37135), True, 'import numpy as np\n'), ((37137, 37152), 'numpy.ma.core.arctan2', 'arctan2', (['xm', 'ym'], {}), '(xm, ym)\n', (37144, 37152), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37175, 37189), 'numpy.absolute', 'np.absolute', (['x'], {}), '(x)\n', (37186, 37189), True, 'import numpy as np\n'), ((37191, 37203), 'numpy.ma.core.absolute', 'absolute', (['xm'], {}), '(xm)\n', (37199, 37203), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37226, 37248), 'numpy.angle', 'np.angle', (['(x + 1.0j * y)'], {}), '(x + 1.0j * y)\n', (37234, 37248), True, 'import numpy as np\n'), ((37246, 37267), 'numpy.ma.core.angle', 'angle', (['(xm + 1.0j * ym)'], {}), '(xm + 1.0j * ym)\n', (37251, 37267), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37286, 37318), 'numpy.angle', 'np.angle', (['(x + 1.0j * y)'], {'deg': '(True)'}), '(x + 1.0j * y, deg=True)\n', (37294, 37318), True, 'import numpy as np\n'), ((37316, 37347), 'numpy.ma.core.angle', 'angle', (['(xm + 1.0j * ym)'], {'deg': '(True)'}), '(xm + 1.0j * ym, deg=True)\n', (37321, 37347), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37366, 37380), 'numpy.equal', 'np.equal', (['x', 'y'], {}), '(x, y)\n', (37374, 37380), True, 'import numpy as np\n'), ((37382, 37395), 'numpy.ma.core.equal', 'equal', (['xm', 'ym'], {}), '(xm, ym)\n', (37387, 37395), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37418, 37436), 'numpy.not_equal', 'np.not_equal', (['x', 'y'], {}), '(x, y)\n', (37430, 37436), True, 'import numpy as np\n'), ((37438, 37455), 'numpy.ma.core.not_equal', 'not_equal', (['xm', 'ym'], {}), '(xm, ym)\n', (37447, 37455), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37478, 37491), 'numpy.less', 'np.less', (['x', 'y'], {}), '(x, y)\n', (37485, 37491), True, 'import numpy as np\n'), ((37493, 37505), 'numpy.ma.core.less', 'less', (['xm', 'ym'], {}), '(xm, ym)\n', (37497, 37505), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37528, 37544), 'numpy.greater', 'np.greater', (['x', 'y'], {}), '(x, y)\n', (37538, 37544), True, 'import numpy as np\n'), ((37546, 37561), 'numpy.ma.core.greater', 'greater', (['xm', 'ym'], {}), '(xm, ym)\n', (37553, 37561), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37584, 37603), 'numpy.less_equal', 'np.less_equal', (['x', 'y'], {}), '(x, y)\n', (37597, 37603), True, 'import numpy as np\n'), ((37605, 37623), 'numpy.ma.core.less_equal', 'less_equal', (['xm', 'ym'], {}), '(xm, ym)\n', (37615, 37623), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37646, 37668), 'numpy.greater_equal', 'np.greater_equal', (['x', 'y'], {}), '(x, y)\n', (37662, 37668), True, 'import numpy as np\n'), ((37670, 37691), 'numpy.ma.core.greater_equal', 'greater_equal', (['xm', 'ym'], {}), '(xm, ym)\n', (37683, 37691), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37714, 37729), 'numpy.conjugate', 'np.conjugate', (['x'], {}), '(x)\n', (37726, 37729), True, 'import numpy as np\n'), ((37731, 37744), 'numpy.ma.core.conjugate', 'conjugate', (['xm'], {}), '(xm)\n', (37740, 37744), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37824, 37832), 'numpy.ma.core.count', 'count', (['(1)'], {}), '(1)\n', (37829, 37832), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((37858, 37876), 'numpy.ma.core.array', 'array', (['(1)'], {'mask': '[1]'}), '(1, mask=[1])\n', (37863, 37876), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38821, 38828), 'numpy.ma.core.max', 'max', (['xr'], {}), '(xr)\n', (38824, 38828), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38830, 38842), 'numpy.ma.core.maximum', 'maximum', (['xmr'], {}), '(xmr)\n', (38837, 38842), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38865, 38872), 'numpy.ma.core.min', 'min', (['xr'], {}), '(xr)\n', (38868, 38872), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38874, 38886), 'numpy.ma.core.minimum', 'minimum', (['xmr'], {}), '(xmr)\n', (38881, 38886), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38910, 38939), 'numpy.ma.core.minimum', 'minimum', (['[1, 2, 3]', '[4, 0, 9]'], {}), '([1, 2, 3], [4, 0, 9])\n', (38917, 38939), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38973, 39002), 'numpy.ma.core.maximum', 'maximum', (['[1, 2, 3]', '[4, 0, 9]'], {}), '([1, 2, 3], [4, 0, 9])\n', (38980, 39002), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39049, 39058), 'numpy.ma.core.arange', 'arange', (['(5)'], {}), '(5)\n', (39055, 39058), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39128, 39141), 'numpy.ma.core.minimum', 'minimum', (['x', 'y'], {}), '(x, y)\n', (39135, 39141), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39189, 39202), 'numpy.ma.core.maximum', 'maximum', (['x', 'y'], {}), '(x, y)\n', (39196, 39202), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39383, 39393), 'numpy.ma.core.maximum', 'maximum', (['x'], {}), '(x)\n', (39390, 39393), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39590, 39606), 'numpy.minimum', 'np.minimum', (['a', 'a'], {}), '(a, a)\n', (39600, 39606), True, 'import numpy as np\n'), ((39738, 39760), 'numpy.minimum.outer', 'np.minimum.outer', (['a', 'a'], {}), '(a, a)\n', (39754, 39760), True, 'import numpy as np\n'), ((39886, 39902), 'numpy.maximum', 'np.maximum', (['a', 'a'], {}), '(a, a)\n', (39896, 39902), True, 'import numpy as np\n'), ((40034, 40056), 'numpy.maximum.outer', 'np.maximum.outer', (['a', 'a'], {}), '(a, a)\n', (40050, 40056), True, 'import numpy as np\n'), ((40442, 40470), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(10)', '(12)'], {}), '(0, 10, 12)\n', (40459, 40470), True, 'import numpy as np\n'), ((40723, 40748), 'numpy.empty', 'np.empty', (['(4,)'], {'dtype': 'int'}), '((4,), dtype=int)\n', (40731, 40748), True, 'import numpy as np\n'), ((40890, 40917), 'numpy.empty', 'np.empty', (['(4,)'], {'dtype': 'float'}), '((4,), dtype=float)\n', (40898, 40917), True, 'import numpy as np\n'), ((42174, 42190), 'numpy.add.reduce', 'np.add.reduce', (['x'], {}), '(x)\n', (42187, 42190), True, 'import numpy as np\n'), ((42192, 42205), 'numpy.ma.core.add.reduce', 'add.reduce', (['x'], {}), '(x)\n', (42202, 42205), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42228, 42248), 'numpy.add.accumulate', 'np.add.accumulate', (['x'], {}), '(x)\n', (42245, 42248), True, 'import numpy as np\n'), ((42250, 42267), 'numpy.ma.core.add.accumulate', 'add.accumulate', (['x'], {}), '(x)\n', (42264, 42267), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42384, 42401), 'numpy.sum', 'np.sum', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (42390, 42401), True, 'import numpy as np\n'), ((42403, 42417), 'numpy.ma.core.sum', 'sum', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (42406, 42417), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42471, 42486), 'numpy.ma.core.sum', 'sum', (['xm'], {'axis': '(0)'}), '(xm, axis=0)\n', (42474, 42486), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42509, 42521), 'numpy.sum', 'np.sum', (['x', '(0)'], {}), '(x, 0)\n', (42515, 42521), True, 'import numpy as np\n'), ((42523, 42532), 'numpy.ma.core.sum', 'sum', (['x', '(0)'], {}), '(x, 0)\n', (42526, 42532), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42555, 42576), 'numpy.product', 'np.product', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (42565, 42576), True, 'import numpy as np\n'), ((42578, 42596), 'numpy.ma.core.product', 'product', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (42585, 42596), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42619, 42635), 'numpy.product', 'np.product', (['x', '(0)'], {}), '(x, 0)\n', (42629, 42635), True, 'import numpy as np\n'), ((42637, 42650), 'numpy.ma.core.product', 'product', (['x', '(0)'], {}), '(x, 0)\n', (42644, 42650), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42708, 42727), 'numpy.ma.core.product', 'product', (['xm'], {'axis': '(0)'}), '(xm, axis=0)\n', (42715, 42727), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((46806, 46815), 'numpy.ma.core.mod', 'mod', (['x', 'y'], {}), '(x, y)\n', (46809, 46815), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((46817, 46828), 'numpy.ma.core.mod', 'mod', (['xm', 'ym'], {}), '(xm, ym)\n', (46820, 46828), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((46884, 46898), 'numpy.mod', 'np.mod', (['ym', 'xm'], {}), '(ym, xm)\n', (46890, 46898), True, 'import numpy as np\n'), ((46932, 46957), 'numpy.ma.core.mask_or', 'mask_or', (['xm.mask', 'ym.mask'], {}), '(xm.mask, ym.mask)\n', (46939, 46957), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47013, 47027), 'numpy.mod', 'np.mod', (['xm', 'ym'], {}), '(xm, ym)\n', (47019, 47027), True, 'import numpy as np\n'), ((47366, 47392), 'numpy.transpose', 'np.transpose', (['y', '(2, 0, 1)'], {}), '(y, (2, 0, 1))\n', (47378, 47392), True, 'import numpy as np\n'), ((47394, 47417), 'numpy.ma.core.transpose', 'transpose', (['x', '(2, 0, 1)'], {}), '(x, (2, 0, 1))\n', (47403, 47417), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47440, 47464), 'numpy.take', 'np.take', (['y', '(2, 0, 1)', '(1)'], {}), '(y, (2, 0, 1), 1)\n', (47447, 47464), True, 'import numpy as np\n'), ((47466, 47487), 'numpy.ma.core.take', 'take', (['x', '(2, 0, 1)', '(1)'], {}), '(x, (2, 0, 1), 1)\n', (47470, 47487), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47569, 47580), 'numpy.ma.core.inner', 'inner', (['x', 'y'], {}), '(x, y)\n', (47574, 47580), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47662, 47673), 'numpy.ma.core.outer', 'outer', (['x', 'y'], {}), '(x, y)\n', (47667, 47673), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((48681, 48705), 'numpy.empty', 'np.empty', (['(4)'], {'dtype': 'float'}), '(4, dtype=float)\n', (48689, 48705), True, 'import numpy as np\n'), ((48857, 48882), 'numpy.ma.testutils.assert_', 'assert_', (['(result is output)'], {}), '(result is output)\n', (48864, 48882), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((48966, 48985), 'numpy.ma.core.empty', 'empty', (['(4)'], {'dtype': 'int'}), '(4, dtype=int)\n', (48971, 48985), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((49046, 49071), 'numpy.ma.testutils.assert_', 'assert_', (['(result is output)'], {}), '(result is output)\n', (49053, 49071), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((49084, 49112), 'numpy.ma.testutils.assert_', 'assert_', (['(output[0] is masked)'], {}), '(output[0] is masked)\n', (49091, 49112), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((49181, 49208), 'numpy.matrix', 'np.matrix', (['[[1, 2], [3, 4]]'], {}), '([[1, 2], [3, 4]])\n', (49190, 49208), True, 'import numpy as np\n'), ((54524, 54545), 'numpy.ma.core.filled', 'filled', (['(xh > 1)', '(False)'], {}), '(xh > 1, False)\n', (54530, 54545), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((54972, 54993), 'numpy.ma.core.filled', 'filled', (['(xh < 5)', '(False)'], {}), '(xh < 5, False)\n', (54978, 54993), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((55713, 55745), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]'}), '([1, 2, 3], mask=[1, 0, 0])\n', (55718, 55745), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((55843, 55875), 'numpy.ma.core.array', 'array', (['[0, 2, 3]'], {'mask': '[0, 0, 0]'}), '([0, 2, 3], mask=[0, 0, 0])\n', (55848, 55875), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((56174, 56183), 'numpy.ma.core.zeros', 'zeros', (['(10)'], {}), '(10)\n', (56179, 56183), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((56539, 56561), 'numpy.matrix', 'np.matrix', (['[[1, 2, 3]]'], {}), '([[1, 2, 3]])\n', (56548, 56561), True, 'import numpy as np\n'), ((56684, 56722), 'numpy.all', 'np.all', (['(test.flat[0:2] == test[0, 0:2])'], {}), '(test.flat[0:2] == test[0, 0:2])\n', (56690, 56722), True, 'import numpy as np\n'), ((56791, 56813), 'numpy.matrix', 'np.matrix', (['[[1, 2, 3]]'], {}), '([[1, 2, 3]])\n', (56800, 56813), True, 'import numpy as np\n'), ((56922, 56944), 'numpy.matrix', 'np.matrix', (['[[3, 2, 1]]'], {}), '([[3, 2, 1]])\n', (56931, 56944), True, 'import numpy as np\n'), ((57049, 57071), 'numpy.matrix', 'np.matrix', (['[[1, 2, 3]]'], {}), '([[1, 2, 3]])\n', (57058, 57071), True, 'import numpy as np\n'), ((58115, 58140), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xf', 'x[j, i]'], {}), '(xf, x[j, i])\n', (58127, 58140), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((58423, 58442), 'numpy.ma.core.array', 'array', (['[[1.0, 0.0]]'], {}), '([[1.0, 0.0]])\n', (58428, 58442), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((58473, 58496), 'numpy.ma.core.array', 'array', (['[[False, False]]'], {}), '([[False, False]])\n', (58478, 58496), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((58760, 58774), 'numpy.dtype', 'np.dtype', (['"""f4"""'], {}), "('f4')\n", (58768, 58774), True, 'import numpy as np\n'), ((58911, 58925), 'numpy.ma.array', 'np.ma.array', (['a'], {}), '(a)\n', (58922, 58925), True, 'import numpy as np\n'), ((58948, 58962), 'numpy.dtype', 'np.dtype', (['"""f8"""'], {}), "('f8')\n", (58956, 58962), True, 'import numpy as np\n'), ((59102, 59116), 'numpy.dtype', 'np.dtype', (['"""f4"""'], {}), "('f4')\n", (59110, 59116), True, 'import numpy as np\n'), ((59289, 59306), 'numpy.dtype', 'np.dtype', (['"""f4,i4"""'], {}), "('f4,i4')\n", (59297, 59306), True, 'import numpy as np\n'), ((59691, 59712), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0)'], {}), '(0)\n', (59709, 59712), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((59785, 59797), 'numpy.compat.asbytes', 'asbytes', (['"""0"""'], {}), "('0')\n", (59792, 59797), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((59872, 59903), 'numpy.ma.core.default_fill_value', 'default_fill_value', (["b'camelot!'"], {}), "(b'camelot!')\n", (59890, 59903), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((61952, 61966), 'numpy.compat.asbytes', 'asbytes', (['"""???"""'], {}), "('???')\n", (61959, 61966), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((62984, 63015), 'numpy.compat.asbytes_nested', 'asbytes_nested', (["['3', '4', '5']"], {}), "(['3', '4', '5'])\n", (62998, 63015), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((63176, 63197), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0)'], {}), '(0)\n', (63194, 63197), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((63310, 63333), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0.0)'], {}), '(0.0)\n', (63328, 63333), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((63437, 63458), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0)'], {}), '(0)\n', (63455, 63458), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((64163, 64177), 'numpy.compat.asbytes', 'asbytes', (['"""999"""'], {}), "('999')\n", (64170, 64177), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((64360, 64374), 'numpy.compat.asbytes', 'asbytes', (['"""???"""'], {}), "('???')\n", (64367, 64374), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((64572, 64587), 'numpy.array', 'np.array', (['(999.0)'], {}), '(999.0)\n', (64580, 64587), True, 'import numpy as np\n'), ((66612, 66639), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (66624, 66639), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((66786, 66813), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['test', 'control'], {}), '(test, control)\n', (66798, 66813), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((67090, 67116), 'numpy.ma.core.default_fill_value', 'default_fill_value', (["a['A']"], {}), "(a['A'])\n", (67108, 67116), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67156, 67188), 'numpy.ma.core.default_fill_value', 'default_fill_value', (["a['B']['BA']"], {}), "(a['B']['BA'])\n", (67174, 67188), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67228, 67260), 'numpy.ma.core.default_fill_value', 'default_fill_value', (["a['B']['BB']"], {}), "(a['B']['BB'])\n", (67246, 67260), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67330, 67356), 'numpy.ma.core.minimum_fill_value', 'minimum_fill_value', (["a['A']"], {}), "(a['A'])\n", (67348, 67356), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67391, 67423), 'numpy.ma.core.minimum_fill_value', 'minimum_fill_value', (["a['B']['BA']"], {}), "(a['B']['BA'])\n", (67409, 67423), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67458, 67490), 'numpy.ma.core.minimum_fill_value', 'minimum_fill_value', (["a['B']['BB']"], {}), "(a['B']['BB'])\n", (67476, 67490), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67522, 67548), 'numpy.ma.core.minimum_fill_value', 'minimum_fill_value', (["a['B']"], {}), "(a['B'])\n", (67540, 67548), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67618, 67644), 'numpy.ma.core.maximum_fill_value', 'maximum_fill_value', (["a['A']"], {}), "(a['A'])\n", (67636, 67644), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67679, 67711), 'numpy.ma.core.maximum_fill_value', 'maximum_fill_value', (["a['B']['BA']"], {}), "(a['B']['BA'])\n", (67697, 67711), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67746, 67778), 'numpy.ma.core.maximum_fill_value', 'maximum_fill_value', (["a['B']['BB']"], {}), "(a['B']['BB'])\n", (67764, 67778), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((67810, 67836), 'numpy.ma.core.maximum_fill_value', 'maximum_fill_value', (["a['B']"], {}), "(a['B'])\n", (67828, 67836), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((68209, 68221), 'numpy.array', 'np.array', (['(10)'], {}), '(10)\n', (68217, 68221), True, 'import numpy as np\n'), ((68544, 68556), 'numpy.array', 'np.array', (['(10)'], {}), '(10)\n', (68552, 68556), True, 'import numpy as np\n'), ((69115, 69129), 'numpy.isnan', 'np.isnan', (['f[0]'], {}), '(f[0])\n', (69123, 69129), True, 'import numpy as np\n'), ((69159, 69182), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(1.0)'], {}), '(1.0)\n', (69177, 69182), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((71976, 72003), 'numpy.ma.core.default_fill_value', 'default_fill_value', (["b'spam'"], {}), "(b'spam')\n", (71994, 72003), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((72046, 72072), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['"""eggs"""'], {}), "('eggs')\n", (72064, 72072), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((72240, 72294), 'numpy.ma.core.array', 'array', (['([1.0, 0, -1, pi / 2] * 2)'], {'mask': '([0, 1] + [0] * 6)'}), '([1.0, 0, -1, pi / 2] * 2, mask=[0, 1] + [0] * 6)\n', (72245, 72294), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((72314, 72368), 'numpy.ma.core.array', 'array', (['([1.0, 0, -1, pi / 2] * 2)'], {'mask': '([1, 0] + [0] * 6)'}), '([1.0, 0, -1, pi / 2] * 2, mask=[1, 0] + [0] * 6)\n', (72319, 72368), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((73699, 73745), 'numpy.ma.testutils.assert_mask_equal', 'assert_mask_equal', (['ur.mask', 'mr.mask'], {'err_msg': 'f'}), '(ur.mask, mr.mask, err_msg=f)\n', (73716, 73745), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((73908, 73927), 'numpy.ma.core.sometrue', 'sometrue', (['a'], {'axis': '(0)'}), '(a, axis=0)\n', (73916, 73927), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((73950, 73968), 'numpy.ma.core.sum', 'sum', (['a[:3]'], {'axis': '(0)'}), '(a[:3], axis=0)\n', (73953, 73968), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((73994, 74012), 'numpy.ma.core.product', 'product', (['a'], {'axis': '(0)'}), '(a, axis=0)\n', (74001, 74012), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((74038, 74051), 'numpy.ma.core.add.reduce', 'add.reduce', (['a'], {}), '(a)\n', (74048, 74051), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76452, 76477), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (76475, 76477), False, 'import warnings\n'), ((76491, 76523), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""error"""'], {}), "('error')\n", (76514, 76523), False, 'import warnings\n'), ((76580, 76586), 'numpy.ma.core.exp', 'exp', (['m'], {}), '(m)\n', (76583, 76586), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76599, 76608), 'numpy.ma.core.add', 'add', (['m', '(1)'], {}), '(m, 1)\n', (76602, 76608), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76683, 76690), 'numpy.ma.core.sqrt', 'sqrt', (['m'], {}), '(m)\n', (76687, 76690), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76703, 76709), 'numpy.ma.core.log', 'log', (['m'], {}), '(m)\n', (76706, 76709), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76722, 76728), 'numpy.ma.core.tan', 'tan', (['m'], {}), '(m)\n', (76725, 76728), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76741, 76750), 'numpy.ma.core.arcsin', 'arcsin', (['m'], {}), '(m)\n', (76747, 76750), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76763, 76772), 'numpy.ma.core.arccos', 'arccos', (['m'], {}), '(m)\n', (76769, 76772), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76785, 76795), 'numpy.ma.core.arccosh', 'arccosh', (['m'], {}), '(m)\n', (76792, 76795), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76843, 76855), 'numpy.ma.core.divide', 'divide', (['m', '(2)'], {}), '(m, 2)\n', (76849, 76855), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76941, 76957), 'numpy.ma.core.allclose', 'allclose', (['m', '(0.5)'], {}), '(m, 0.5)\n', (76949, 76957), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((78270, 78288), 'numpy.ma.core.mask_or', 'mask_or', (['m', 'a.mask'], {}), '(m, a.mask)\n', (78277, 78288), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((78830, 78848), 'numpy.ma.core.mask_or', 'mask_or', (['m', 'a.mask'], {}), '(m, a.mask)\n', (78837, 78848), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((79406, 79424), 'numpy.ma.core.mask_or', 'mask_or', (['m', 'a.mask'], {}), '(m, a.mask)\n', (79413, 79424), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((79556, 79566), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (79562, 79566), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((79584, 79594), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (79590, 79594), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((79932, 79943), 'numpy.ma.core.ones', 'ones', (['(10,)'], {}), '((10,))\n', (79936, 79943), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((81557, 81589), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]'}), '([1, 2, 3], mask=[1, 0, 0])\n', (81562, 81589), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((82398, 82430), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[1, 0, 0]'}), '([1, 2, 3], mask=[1, 0, 0])\n', (82403, 82430), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((83242, 83277), 'numpy.ma.core.array', 'array', (['[10, 20, 30]'], {'mask': '[1, 0, 0]'}), '([10, 20, 30], mask=[1, 0, 0])\n', (83247, 83277), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((84116, 84157), 'numpy.ma.core.array', 'array', (['[10.0, 20.0, 30.0]'], {'mask': '[1, 0, 0]'}), '([10.0, 20.0, 30.0], mask=[1, 0, 0])\n', (84121, 84157), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((85098, 85136), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[[0, 0], [0, 0]]'], {}), '(a.mask, [[0, 0], [0, 0]])\n', (85110, 85136), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((85539, 85577), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[[0, 0], [0, 0]]'], {}), '(a.mask, [[0, 0], [0, 0]])\n', (85551, 85577), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((85980, 86018), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['a.mask', '[[0, 0], [0, 0]]'], {}), '(a.mask, [[0, 0], [0, 0]])\n', (85992, 86018), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((97406, 97420), 'numpy.ma.core.allclose', 'allclose', (['a', 'b'], {}), '(a, b)\n', (97414, 97420), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((97566, 97580), 'numpy.ma.core.allclose', 'allclose', (['a', 'b'], {}), '(a, b)\n', (97574, 97580), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((97691, 97724), 'numpy.ma.core.allclose', 'allclose', (['a', 'b'], {'masked_equal': '(True)'}), '(a, b, masked_equal=True)\n', (97699, 97724), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((97885, 97918), 'numpy.ma.core.allclose', 'allclose', (['a', '(0)'], {'masked_equal': '(True)'}), '(a, 0, masked_equal=True)\n', (97893, 97918), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((98082, 98096), 'numpy.ma.core.allclose', 'allclose', (['a', 'a'], {}), '(a, a)\n', (98090, 98096), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((99703, 99734), 'numpy.matrix', 'np.matrix', (['[False, False, True]'], {}), '([False, False, True])\n', (99712, 99734), True, 'import numpy as np\n'), ((99841, 99872), 'numpy.matrix', 'np.matrix', (['[False, False, True]'], {}), '([False, False, True])\n', (99850, 99872), True, 'import numpy as np\n'), ((100059, 100089), 'numpy.matrix', 'np.matrix', (['[True, True, False]'], {}), '([True, True, False])\n', (100068, 100089), True, 'import numpy as np\n'), ((100201, 100231), 'numpy.matrix', 'np.matrix', (['[True, True, False]'], {}), '([True, True, False])\n', (100210, 100231), True, 'import numpy as np\n'), ((103960, 103983), 'numpy.matrix', 'np.matrix', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (103969, 103983), True, 'import numpy as np\n'), ((104975, 105010), 'numpy.may_share_memory', 'np.may_share_memory', (['a.mask', 'b.mask'], {}), '(a.mask, b.mask)\n', (104994, 105010), True, 'import numpy as np\n'), ((105425, 105435), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (105431, 105435), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((105543, 105582), 'numpy.ma.core.asarray', 'asarray', (['[6, 1, 4, 3, 2, 5, 0, 7, 8, 9]'], {}), '([6, 1, 4, 3, 2, 5, 0, 7, 8, 9])\n', (105550, 105582), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((105664, 105704), 'numpy.ma.core.masked_array', 'masked_array', (['[0, 2, 4, 6]', '[1, 0, 1, 0]'], {}), '([0, 2, 4, 6], [1, 0, 1, 0])\n', (105676, 105704), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((105857, 105867), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (105863, 105867), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((105951, 105990), 'numpy.ma.core.asarray', 'asarray', (['[6, 1, 4, 3, 2, 5, 0, 7, 8, 9]'], {}), '([6, 1, 4, 3, 2, 5, 0, 7, 8, 9])\n', (105958, 105990), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((106073, 106113), 'numpy.ma.core.masked_array', 'masked_array', (['[0, 2, 4, 6]', '[1, 0, 1, 0]'], {}), '([0, 2, 4, 6], [1, 0, 1, 0])\n', (106085, 106113), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((106999, 107008), 'numpy.ma.core.arange', 'arange', (['(6)'], {}), '(6)\n', (107005, 107008), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((108407, 108433), 'numpy.matrix', 'np.matrix', (['[1, 2, 3, 4, 5]'], {}), '([1, 2, 3, 4, 5])\n', (108416, 108433), True, 'import numpy as np\n'), ((113022, 113035), 'numpy.argsort', 'np.argsort', (['a'], {}), '(a)\n', (113032, 113035), True, 'import numpy as np\n'), ((113037, 113047), 'numpy.ma.core.argsort', 'argsort', (['a'], {}), '(a)\n', (113044, 113047), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((114545, 114582), 'numpy.ma.core.masked_array', 'masked_array', (['[10, 10, 40]', '[0, 0, 1]'], {}), '([10, 10, 40], [0, 0, 1])\n', (114557, 114582), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((114706, 114758), 'numpy.ma.core.masked_array', 'masked_array', (['[[10, 20], [10, 20]]', '[[0, 1], [0, 1]]'], {}), '([[10, 20], [10, 20]], [[0, 1], [0, 1]])\n', (114718, 114758), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((115050, 115100), 'numpy.ma.core.array', 'array', (['[[10, 30], [40, 60]]'], {'mask': '[[0, 1], [1, 0]]'}), '([[10, 30], [40, 60]], mask=[[0, 1], [1, 0]])\n', (115055, 115100), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((115123, 115146), 'numpy.ma.core.take', 'take', (['x', '[0, 2]'], {'axis': '(1)'}), '(x, [0, 2], axis=1)\n', (115127, 115146), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((115169, 115219), 'numpy.ma.core.array', 'array', (['[[10, 30], [40, 60]]'], {'mask': '[[0, 1], [1, 0]]'}), '([[10, 30], [40, 60]], mask=[[0, 1], [1, 0]])\n', (115174, 115219), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((116447, 116460), 'numpy.arange', 'np.arange', (['(12)'], {}), '(12)\n', (116456, 116460), True, 'import numpy as np\n'), ((120682, 120713), 'numpy.ma.core.MaskedArray.cumsum', 'MaskedArray.cumsum', (['marray.T', '(0)'], {}), '(marray.T, 0)\n', (120700, 120713), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((122986, 123015), 'numpy.empty', 'np.empty', (['(3, 4)'], {'dtype': 'float'}), '((3, 4), dtype=float)\n', (122994, 123015), True, 'import numpy as np\n'), ((123284, 123308), 'numpy.ma.core.empty', 'empty', (['(3, 4)'], {'dtype': 'int'}), '((3, 4), dtype=int)\n', (123289, 123308), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((125267, 125279), 'numpy.trace', 'np.trace', (['mX'], {}), '(mX)\n', (125275, 125279), True, 'import numpy as np\n'), ((127747, 127757), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (127753, 127757), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((128242, 128271), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mout.mask', '(True)'], {}), '(mout.mask, True)\n', (128254, 128271), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((128509, 128519), 'numpy.ma.core.arange', 'arange', (['(10)'], {}), '(10)\n', (128515, 128519), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((128956, 128985), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['mout.mask', '(True)'], {}), '(mout.mask, True)\n', (128968, 128985), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((134397, 134417), 'numpy.ma.core.masked_greater', 'masked_greater', (['x', '(2)'], {}), '(x, 2)\n', (134411, 134417), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134499, 134525), 'numpy.ma.core.masked_greater_equal', 'masked_greater_equal', (['x', '(2)'], {}), '(x, 2)\n', (134519, 134525), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134577, 134594), 'numpy.ma.core.masked_less', 'masked_less', (['x', '(2)'], {}), '(x, 2)\n', (134588, 134594), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134673, 134696), 'numpy.ma.core.masked_less_equal', 'masked_less_equal', (['x', '(2)'], {}), '(x, 2)\n', (134690, 134696), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134753, 134775), 'numpy.ma.core.masked_not_equal', 'masked_not_equal', (['x', '(2)'], {}), '(x, 2)\n', (134769, 134775), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134828, 134846), 'numpy.ma.core.masked_equal', 'masked_equal', (['x', '(2)'], {}), '(x, 2)\n', (134840, 134846), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134903, 134925), 'numpy.ma.core.masked_not_equal', 'masked_not_equal', (['x', '(2)'], {}), '(x, 2)\n', (134919, 134925), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134948, 134994), 'numpy.ma.core.masked_where', 'masked_where', (['[1, 1, 0, 0, 0]', '[1, 2, 3, 4, 5]'], {}), '([1, 1, 0, 0, 0], [1, 2, 3, 4, 5])\n', (134960, 134994), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((135395, 135413), 'numpy.ma.core.masked_equal', 'masked_equal', (['(1)', 'a'], {}), '(1, a)\n', (135407, 135413), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((139249, 139263), 'numpy.identity', 'np.identity', (['(5)'], {}), '(5)\n', (139260, 139263), True, 'import numpy as np\n'), ((139337, 139350), 'numpy.ma.core.power', 'power', (['x', '(2.0)'], {}), '(x, 2.0)\n', (139342, 139350), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((142627, 142650), 'numpy.ma.where', 'np.ma.where', (['(True)', 'a', 'a'], {}), '(True, a, a)\n', (142638, 142650), True, 'import numpy as np\n'), ((142676, 142699), 'numpy.ma.where', 'np.ma.where', (['(True)', 'b', 'b'], {}), '(True, b, b)\n', (142687, 142699), True, 'import numpy as np\n'), ((143851, 143863), 'numpy.ma.core.arange', 'arange', (['(1)', '(6)'], {}), '(1, 6)\n', (143857, 143863), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((144425, 144455), 'numpy.arange', 'np.arange', (['(4)'], {'dtype': 'np.float32'}), '(4, dtype=np.float32)\n', (144434, 144455), True, 'import numpy as np\n'), ((144477, 144497), 'numpy.ma.core.where', 'where', (['(x > 1.5)', 'y', 'x'], {}), '(x > 1.5, y, x)\n', (144482, 144497), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((144838, 144860), 'numpy.ma.core.array', 'array', (['[20, 31, 12, 3]'], {}), '([20, 31, 12, 3])\n', (144843, 144860), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((144951, 144973), 'numpy.ma.core.array', 'array', (['[20, 31, 12, 3]'], {}), '([20, 31, 12, 3])\n', (144956, 144973), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((145064, 145085), 'numpy.ma.core.array', 'array', (['[20, 1, 12, 3]'], {}), '([20, 1, 12, 3])\n', (145069, 145085), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((145271, 145293), 'numpy.ma.core.array', 'array', (['[99, 1, 12, 99]'], {}), '([99, 1, 12, 99])\n', (145276, 145293), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((145636, 145658), 'numpy.ma.core.array', 'array', (['[20, 31, 12, 3]'], {}), '([20, 31, 12, 3])\n', (145641, 145658), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146024, 146046), 'numpy.ma.core.array', 'array', (['[20, 31, 12, 3]'], {}), '([20, 31, 12, 3])\n', (146029, 146046), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146325, 146348), 'numpy.ma.core.array', 'array', (['[99, 31, 12, 99]'], {}), '([99, 31, 12, 99])\n', (146330, 146348), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146770, 146801), 'numpy.ma.core.array', 'array', (['[999999, 31, 12, 999999]'], {}), '([999999, 31, 12, 999999])\n', (146775, 146801), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((148141, 148158), 'numpy.dtype', 'np.dtype', (['np.bool'], {}), '(np.bool)\n', (148149, 148158), True, 'import numpy as np\n'), ((148536, 148567), 'numpy.dtype', 'np.dtype', (["[('a', (np.bool, 2))]"], {}), "([('a', (np.bool, 2))])\n", (148544, 148567), True, 'import numpy as np\n'), ((148690, 148720), 'numpy.dtype', 'np.dtype', (["[(('A', 'a'), bool)]"], {}), "([(('A', 'a'), bool)])\n", (148698, 148720), True, 'import numpy as np\n'), ((150048, 150088), 'numpy.array', 'np.array', (['[(0, 0), (0, 1)]'], {'dtype': 'bdtype'}), '([(0, 0), (0, 1)], dtype=bdtype)\n', (150056, 150088), True, 'import numpy as np\n'), ((150354, 150403), 'numpy.ma.core.make_mask', 'make_mask', (['nomask'], {'copy': 'cpy', 'shrink': 'shr', 'dtype': 'dt'}), '(nomask, copy=cpy, shrink=shr, dtype=dt)\n', (150363, 150403), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((150416, 150466), 'numpy.ma.testutils.assert_', 'assert_', (['(res is nomask)', '(msgformat % (cpy, shr, dt))'], {}), '(res is nomask, msgformat % (cpy, shr, dt))\n', (150423, 150466), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((151395, 151415), 'numpy.ma.core.mask_or', 'mask_or', (['mask', 'other'], {}), '(mask, other)\n', (151402, 151415), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((151785, 151806), 'numpy.ma.core.mask_or', 'mask_or', (['amask', 'bmask'], {}), '(amask, bmask)\n', (151792, 151806), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((151974, 151992), 'numpy.ma.core.flatten_mask', 'flatten_mask', (['mask'], {}), '(mask)\n', (151986, 151992), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((154958, 154992), 'numpy.zeros', 'np.zeros', (['base.shape'], {'dtype': 'mdtype'}), '(base.shape, dtype=mdtype)\n', (154966, 154992), True, 'import numpy as np\n'), ((155062, 155095), 'numpy.ones', 'np.ones', (['base.shape'], {'dtype': 'mdtype'}), '(base.shape, dtype=mdtype)\n', (155069, 155095), True, 'import numpy as np\n'), ((155196, 155230), 'numpy.zeros', 'np.zeros', (['base.shape'], {'dtype': 'mdtype'}), '(base.shape, dtype=mdtype)\n', (155204, 155230), True, 'import numpy as np\n'), ((155298, 155331), 'numpy.ones', 'np.ones', (['base.shape'], {'dtype': 'mdtype'}), '(base.shape, dtype=mdtype)\n', (155305, 155331), True, 'import numpy as np\n'), ((155461, 155521), 'numpy.array', 'np.array', (['[(x, x, x) for x in [0, 0, 0, 1, 1]]'], {'dtype': 'mdtype'}), '([(x, x, x) for x in [0, 0, 0, 1, 1]], dtype=mdtype)\n', (155469, 155521), True, 'import numpy as np\n'), ((156080, 156134), 'numpy.compat.asbytes_nested', 'asbytes_nested', (["['pi', 'two', 'three', 'four', 'five']"], {}), "(['pi', 'two', 'three', 'four', 'five'])\n", (156094, 156134), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((156604, 156654), 'numpy.compat.asbytes_nested', 'asbytes_nested', (["['pi', 'pi', 'pi', 'four', 'five']"], {}), "(['pi', 'pi', 'pi', 'four', 'five'])\n", (156618, 156654), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((156825, 156868), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base[n].mask', '[1, 1, 0, 0, 1]'], {}), '(base[n].mask, [1, 1, 0, 0, 1])\n', (156837, 156868), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((156881, 156923), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['base[n]._data', 'base._data[n]'], {}), '(base[n]._data, base._data[n])\n', (156893, 156923), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((157107, 157125), 'numpy.ma.core.getmaskarray', 'getmaskarray', (['test'], {}), '(test)\n', (157119, 157125), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((157148, 157218), 'numpy.array', 'np.array', (['[(0, 0), (0, 0), (0, 0)]'], {'dtype': "[('a', '|b1'), ('b', '|b1')]"}), "([(0, 0), (0, 0), (0, 0)], dtype=[('a', '|b1'), ('b', '|b1')])\n", (157156, 157218), True, 'import numpy as np\n'), ((157296, 157314), 'numpy.ma.core.getmaskarray', 'getmaskarray', (['test'], {}), '(test)\n', (157308, 157314), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((157337, 157407), 'numpy.array', 'np.array', (['[(1, 1), (1, 1), (1, 1)]'], {'dtype': "[('a', '|b1'), ('b', '|b1')]"}), "([(1, 1), (1, 1), (1, 1)], dtype=[('a', '|b1'), ('b', '|b1')])\n", (157345, 157407), True, 'import numpy as np\n'), ((159331, 159351), 'numpy.array', 'np.array', (['[1.0, 3.0]'], {}), '([1.0, 3.0])\n', (159339, 159351), True, 'import numpy as np\n'), ((159408, 159428), 'numpy.array', 'np.array', (['[1.0, 4.0]'], {}), '([1.0, 4.0])\n', (159416, 159428), True, 'import numpy as np\n'), ((163677, 163702), 'numpy.ma.__getattribute__', 'np.ma.__getattribute__', (['f'], {}), '(f)\n', (163699, 163702), True, 'import numpy as np\n'), ((164028, 164053), 'numpy.ma.__getattribute__', 'np.ma.__getattribute__', (['f'], {}), '(f)\n', (164050, 164053), True, 'import numpy as np\n'), ((165241, 165249), 'numpy.ma.core.count', 'count', (['a'], {}), '(a)\n', (165246, 165249), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165276, 165292), 'numpy.ma.core.count', 'count', (['a'], {'axis': '(1)'}), '(a, axis=1)\n', (165281, 165292), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165330, 165351), 'numpy.ma.core.count', 'count', (['a'], {'axis': '(0, 1)'}), '(a, axis=(0, 1))\n', (165335, 165351), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165387, 165410), 'numpy.ma.core.count', 'count', (['a'], {'keepdims': '(True)'}), '(a, keepdims=True)\n', (165392, 165410), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165451, 165482), 'numpy.ma.core.count', 'count', (['a'], {'axis': '(1)', 'keepdims': '(True)'}), '(a, axis=1, keepdims=True)\n', (165456, 165482), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165522, 165558), 'numpy.ma.core.count', 'count', (['a'], {'axis': '(0, 1)', 'keepdims': '(True)'}), '(a, axis=(0, 1), keepdims=True)\n', (165527, 165558), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165597, 165614), 'numpy.ma.core.count', 'count', (['a'], {'axis': '(-2)'}), '(a, axis=-2)\n', (165602, 165614), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165836, 165844), 'numpy.ma.core.count', 'count', (['a'], {}), '(a)\n', (165841, 165844), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165871, 165887), 'numpy.ma.core.count', 'count', (['a'], {'axis': '(1)'}), '(a, axis=1)\n', (165876, 165887), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165925, 165946), 'numpy.ma.core.count', 'count', (['a'], {'axis': '(0, 1)'}), '(a, axis=(0, 1))\n', (165930, 165946), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165982, 166005), 'numpy.ma.core.count', 'count', (['a'], {'keepdims': '(True)'}), '(a, keepdims=True)\n', (165987, 166005), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((166046, 166077), 'numpy.ma.core.count', 'count', (['a'], {'axis': '(1)', 'keepdims': '(True)'}), '(a, axis=1, keepdims=True)\n', (166051, 166077), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((166117, 166153), 'numpy.ma.core.count', 'count', (['a'], {'axis': '(0, 1)', 'keepdims': '(True)'}), '(a, axis=(0, 1), keepdims=True)\n', (166122, 166153), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((166192, 166209), 'numpy.ma.core.count', 'count', (['a'], {'axis': '(-2)'}), '(a, axis=-2)\n', (166197, 166209), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((166395, 166414), 'numpy.ma.core.count', 'count', (['np.ma.masked'], {}), '(np.ma.masked)\n', (166400, 166414), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((166510, 166524), 'numpy.ma.array', 'np.ma.array', (['(1)'], {}), '(1)\n', (166521, 166524), True, 'import numpy as np\n'), ((168100, 168128), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(1 + 1.0j)'], {}), '(1 + 1.0j)\n', (168118, 168128), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((3518, 3534), 'numpy.ma.core.isMaskedArray', 'isMaskedArray', (['x'], {}), '(x)\n', (3531, 3534), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((3968, 3998), 'functools.reduce', 'reduce', (['(lambda x, y: x + y)', 'm1'], {}), '(lambda x, y: x + y, m1)\n', (3974, 3998), False, 'from functools import reduce\n'), ((4511, 4528), 'numpy.ma.core.isMaskedArray', 'isMaskedArray', (['xm'], {}), '(xm)\n', (4524, 4528), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((4555, 4564), 'numpy.ma.core.shape', 'shape', (['xm'], {}), '(xm)\n', (4560, 4564), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((4641, 4670), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 's'], {}), '(lambda x, y: x * y, s)\n', (4647, 4670), False, 'from functools import reduce\n'), ((4696, 4705), 'numpy.ma.core.count', 'count', (['xm'], {}), '(xm)\n', (4701, 4705), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((4806, 4823), 'numpy.ma.core.filled', 'filled', (['xm', '(1e+20)'], {}), '(xm, 1e+20)\n', (4812, 4823), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((7877, 7912), 'numpy.may_share_memory', 'np.may_share_memory', (['x.mask', 'y.mask'], {}), '(x.mask, y.mask)\n', (7896, 7912), True, 'import numpy as np\n'), ((11118, 11129), 'numpy.ma.core.getmask', 'getmask', (['x2'], {}), '(x2)\n', (11125, 11129), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11131, 11150), 'numpy.ma.core.array', 'array', (['[0, 1, 0, 0]'], {}), '([0, 1, 0, 0])\n', (11136, 11150), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11235, 11246), 'numpy.ma.core.getmask', 'getmask', (['x3'], {}), '(x3)\n', (11242, 11246), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11248, 11267), 'numpy.ma.core.array', 'array', (['[0, 1, 1, 0]'], {}), '([0, 1, 1, 0])\n', (11253, 11267), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11352, 11363), 'numpy.ma.core.getmask', 'getmask', (['x4'], {}), '(x4)\n', (11359, 11363), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11365, 11384), 'numpy.ma.core.array', 'array', (['[0, 1, 1, 0]'], {}), '([0, 1, 1, 0])\n', (11370, 11384), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11416, 11435), 'numpy.ma.core.array', 'array', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (11421, 11435), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((11560, 11592), 'numpy.ma.core.array', 'array', (['[0, 0, 0, 1, 0]', 'MaskType'], {}), '([0, 0, 0, 1, 0], MaskType)\n', (11565, 11592), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((12949, 12960), 'numpy.ma.core.getmask', 'getmask', (['x2'], {}), '(x2)\n', (12956, 12960), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((12962, 12994), 'numpy.array', 'np.array', (['[[0, 1, 0], [0, 1, 0]]'], {}), '([[0, 1, 0], [0, 1, 0]])\n', (12970, 12994), True, 'import numpy as np\n'), ((13092, 13108), 'numpy.ma.core.array', 'array', (['[1, 1, 0]'], {}), '([1, 1, 0])\n', (13097, 13108), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13136, 13150), 'numpy.ma.core.getmask', 'getmask', (['x3[1]'], {}), '(x3[1])\n', (13143, 13150), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13152, 13168), 'numpy.ma.core.array', 'array', (['[1, 1, 0]'], {}), '([1, 1, 0])\n', (13157, 13168), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13250, 13264), 'numpy.ma.core.getmask', 'getmask', (['x4[1]'], {}), '(x4[1])\n', (13257, 13264), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13266, 13282), 'numpy.ma.core.array', 'array', (['[1, 1, 0]'], {}), '([1, 1, 0])\n', (13271, 13282), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13317, 13333), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (13322, 13333), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((13359, 13371), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (13368, 13371), True, 'import numpy as np\n'), ((13469, 13501), 'numpy.ma.core.array', 'array', (['[0, 0, 0, 1, 0]', 'MaskType'], {}), '([0, 0, 0, 1, 0], MaskType)\n', (13474, 13501), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((19171, 19179), 'numpy.ma.core.array', 'array', (['(1)'], {}), '(1)\n', (19176, 19179), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((19214, 19222), 'numpy.ma.core.array', 'array', (['(1)'], {}), '(1)\n', (19219, 19222), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((19253, 19267), 'numpy.ma.core.array', 'array', (['[[[1]]]'], {}), '([[[1]]])\n', (19258, 19267), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((19302, 19314), 'numpy.ma.core.array', 'array', (['[[1]]'], {}), '([[1]])\n', (19307, 19314), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((22329, 22352), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(1.0)'], {}), '(1.0)\n', (22347, 22352), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((23718, 23761), 'numpy.array', 'np.array', (['[(0, 0, 1), (1, 0, 0)]'], {'order': '"""F"""'}), "([(0, 0, 1), (1, 0, 0)], order='F')\n", (23726, 23761), True, 'import numpy as np\n'), ((33438, 33450), 'numpy.add', 'np.add', (['x', 'y'], {}), '(x, y)\n', (33444, 33450), True, 'import numpy as np\n'), ((33452, 33463), 'numpy.ma.core.add', 'add', (['xm', 'ym'], {}), '(xm, ym)\n', (33455, 33463), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((33490, 33507), 'numpy.subtract', 'np.subtract', (['x', 'y'], {}), '(x, y)\n', (33501, 33507), True, 'import numpy as np\n'), ((33509, 33525), 'numpy.ma.core.subtract', 'subtract', (['xm', 'ym'], {}), '(xm, ym)\n', (33517, 33525), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((33552, 33569), 'numpy.multiply', 'np.multiply', (['x', 'y'], {}), '(x, y)\n', (33563, 33569), True, 'import numpy as np\n'), ((33571, 33587), 'numpy.ma.core.multiply', 'multiply', (['xm', 'ym'], {}), '(xm, ym)\n', (33579, 33587), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((33614, 33629), 'numpy.divide', 'np.divide', (['x', 'y'], {}), '(x, y)\n', (33623, 33629), True, 'import numpy as np\n'), ((33631, 33645), 'numpy.ma.core.divide', 'divide', (['xm', 'ym'], {}), '(xm, ym)\n', (33637, 33645), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((35034, 35049), 'numpy.ma.core.maximum', 'maximum', (['xm', 'xm'], {}), '(xm, xm)\n', (35041, 35049), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((35080, 35095), 'numpy.ma.core.minimum', 'minimum', (['xm', 'xm'], {}), '(xm, xm)\n', (35087, 35095), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36801, 36807), 'numpy.ma.core.abs', 'abs', (['x'], {}), '(x)\n', (36804, 36807), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36848, 36854), 'numpy.ma.core.abs', 'abs', (['x'], {}), '(x)\n', (36851, 36854), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((36896, 36902), 'numpy.ma.core.abs', 'abs', (['x'], {}), '(x)\n', (36899, 36902), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((38293, 38305), 'numpy.ma.core.getmask', 'getmask', (['res'], {}), '(res)\n', (38300, 38305), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39149, 39159), 'numpy.ma.core.less', 'less', (['x', 'y'], {}), '(x, y)\n', (39153, 39159), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39210, 39223), 'numpy.ma.core.greater', 'greater', (['x', 'y'], {}), '(x, y)\n', (39217, 39223), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39248, 39258), 'numpy.ma.core.minimum', 'minimum', (['x'], {}), '(x)\n', (39255, 39258), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39281, 39291), 'numpy.ma.core.maximum', 'maximum', (['x'], {}), '(x)\n', (39288, 39291), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((39311, 39320), 'numpy.ma.core.arange', 'arange', (['(4)'], {}), '(4)\n', (39317, 39320), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((40396, 40414), 'numpy.random.rand', 'np.random.rand', (['(12)'], {}), '(12)\n', (40410, 40414), True, 'import numpy as np\n'), ((42297, 42305), 'numpy.ma.core.array', 'array', (['(4)'], {}), '(4)\n', (42302, 42305), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42344, 42352), 'numpy.ma.core.array', 'array', (['(4)'], {}), '(4)\n', (42349, 42352), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42447, 42460), 'numpy.ma.core.filled', 'filled', (['xm', '(0)'], {}), '(xm, 0)\n', (42453, 42460), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42684, 42697), 'numpy.ma.core.filled', 'filled', (['xm', '(1)'], {}), '(xm, 1)\n', (42690, 42697), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42848, 42873), 'numpy.concatenate', 'np.concatenate', (['(x, y)', '(1)'], {}), '((x, y), 1)\n', (42862, 42873), True, 'import numpy as np\n'), ((42875, 42899), 'numpy.ma.core.concatenate', 'concatenate', (['(xm, ym)', '(1)'], {}), '((xm, ym), 1)\n', (42886, 42899), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42926, 42945), 'numpy.add.reduce', 'np.add.reduce', (['x', '(1)'], {}), '(x, 1)\n', (42939, 42945), True, 'import numpy as np\n'), ((42947, 42963), 'numpy.ma.core.add.reduce', 'add.reduce', (['x', '(1)'], {}), '(x, 1)\n', (42957, 42963), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((42990, 43002), 'numpy.sum', 'np.sum', (['x', '(1)'], {}), '(x, 1)\n', (42996, 43002), True, 'import numpy as np\n'), ((43004, 43013), 'numpy.ma.core.sum', 'sum', (['x', '(1)'], {}), '(x, 1)\n', (43007, 43013), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((43040, 43056), 'numpy.product', 'np.product', (['x', '(1)'], {}), '(x, 1)\n', (43050, 43056), True, 'import numpy as np\n'), ((43058, 43071), 'numpy.ma.core.product', 'product', (['x', '(1)'], {}), '(x, 1)\n', (43065, 43071), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47069, 47094), 'numpy.ma.core.mask_or', 'mask_or', (['xm.mask', 'ym.mask'], {}), '(xm.mask, ym.mask)\n', (47076, 47094), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47519, 47531), 'numpy.ma.core.filled', 'filled', (['x', '(0)'], {}), '(x, 0)\n', (47525, 47531), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47533, 47545), 'numpy.ma.core.filled', 'filled', (['y', '(0)'], {}), '(y, 0)\n', (47539, 47545), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47612, 47624), 'numpy.ma.core.filled', 'filled', (['x', '(0)'], {}), '(x, 0)\n', (47618, 47624), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((47626, 47638), 'numpy.ma.core.filled', 'filled', (['y', '(0)'], {}), '(y, 0)\n', (47632, 47638), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((49212, 49228), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {}), '((2, 2))\n', (49220, 49228), True, 'import numpy as np\n'), ((52105, 52114), 'numpy.log', 'np.log', (['(2)'], {}), '(2)\n', (52111, 52114), True, 'import numpy as np\n'), ((58333, 58342), 'numpy.eye', 'np.eye', (['(2)'], {}), '(2)\n', (58339, 58342), True, 'import numpy as np\n'), ((60474, 60488), 'numpy.compat.asbytes', 'asbytes', (['"""???"""'], {}), "('???')\n", (60481, 60488), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((60677, 60698), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0)'], {}), '(0)\n', (60695, 60698), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((60735, 60758), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0.0)'], {}), '(0.0)\n', (60753, 60758), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((61119, 61133), 'numpy.compat.asbytes', 'asbytes', (['"""???"""'], {}), "('???')\n", (61126, 61133), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((61776, 61790), 'numpy.compat.asbytes', 'asbytes', (['"""???"""'], {}), "('???')\n", (61783, 61790), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((62124, 62138), 'numpy.compat.asbytes', 'asbytes', (['"""???"""'], {}), "('???')\n", (62131, 62138), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((64061, 64075), 'numpy.compat.asbytes', 'asbytes', (['"""999"""'], {}), "('999')\n", (64068, 64075), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((64260, 64274), 'numpy.compat.asbytes', 'asbytes', (['"""???"""'], {}), "('???')\n", (64267, 64274), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((64456, 64480), 'numpy.asarray', 'np.asarray', (['x.fill_value'], {}), '(x.fill_value)\n', (64466, 64480), True, 'import numpy as np\n'), ((64823, 64844), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0)'], {}), '(0)\n', (64841, 64844), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((64874, 64897), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['"""0"""'], {}), "('0')\n", (64892, 64897), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((64927, 64950), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0.0)'], {}), '(0.0)\n', (64945, 64950), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((65335, 65372), 'numpy.array', 'np.array', (['(0,)'], {'dtype': "[('f0', float)]"}), "((0,), dtype=[('f0', float)])\n", (65343, 65372), True, 'import numpy as np\n'), ((65828, 65874), 'numpy.array', 'np.array', (['(0, 0, 0)'], {'dtype': '"""int, float, float"""'}), "((0, 0, 0), dtype='int, float, float')\n", (65836, 65874), True, 'import numpy as np\n'), ((68605, 68626), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0)'], {}), '(0)\n', (68623, 68626), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((68925, 68943), 'numpy.dtype', 'np.dtype', (['[adtype]'], {}), '([adtype])\n', (68933, 68943), True, 'import numpy as np\n'), ((73864, 73882), 'numpy.ma.core.alltrue', 'alltrue', (['a'], {'axis': '(0)'}), '(a, axis=0)\n', (73871, 73882), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((74138, 74151), 'numpy.ma.core.arange', 'arange', (['(1)', '(13)'], {}), '(1, 13)\n', (74144, 74151), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((74718, 74728), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (74725, 74728), True, 'import numpy as np\n'), ((77379, 77390), 'numpy.dtype', 'np.dtype', (['_'], {}), '(_)\n', (77387, 77390), True, 'import numpy as np\n'), ((80277, 80295), 'numpy.ma.core.mask_or', 'mask_or', (['m', 'a.mask'], {}), '(m, a.mask)\n', (80284, 80295), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((86336, 86372), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (86359, 86372), False, 'import warnings\n'), ((86395, 86428), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (86418, 86428), False, 'import warnings\n'), ((86868, 86904), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (86891, 86904), False, 'import warnings\n'), ((86927, 86960), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (86950, 86960), False, 'import warnings\n'), ((87076, 87095), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 't'}), '(10, dtype=t)\n', (87082, 87095), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((87190, 87212), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y + a)'], {}), '(x, y + a)\n', (87202, 87212), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((87229, 87252), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y + a)'], {}), '(xm, y + a)\n', (87241, 87252), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((87521, 87557), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (87544, 87557), False, 'import warnings\n'), ((87580, 87613), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (87603, 87613), False, 'import warnings\n'), ((88028, 88064), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (88051, 88064), False, 'import warnings\n'), ((88087, 88120), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (88110, 88120), False, 'import warnings\n'), ((88236, 88255), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 't'}), '(10, dtype=t)\n', (88242, 88255), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((88350, 88372), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y - a)'], {}), '(x, y - a)\n', (88362, 88372), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((88389, 88412), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y - a)'], {}), '(xm, y - a)\n', (88401, 88412), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((88686, 88722), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (88709, 88722), False, 'import warnings\n'), ((88745, 88778), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (88768, 88778), False, 'import warnings\n'), ((89198, 89234), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (89221, 89234), False, 'import warnings\n'), ((89257, 89290), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (89280, 89290), False, 'import warnings\n'), ((89406, 89425), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 't'}), '(10, dtype=t)\n', (89412, 89425), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((89520, 89542), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y * a)'], {}), '(x, y * a)\n', (89532, 89542), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((89559, 89582), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y * a)'], {}), '(xm, y * a)\n', (89571, 89582), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((89850, 89886), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (89873, 89886), False, 'import warnings\n'), ((89909, 89942), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (89932, 89942), False, 'import warnings\n'), ((90207, 90225), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', 'y'], {}), '(x, y)\n', (90219, 90225), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((90242, 90261), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', 'y'], {}), '(xm, y)\n', (90254, 90261), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((90470, 90506), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (90493, 90506), False, 'import warnings\n'), ((90529, 90562), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (90552, 90562), False, 'import warnings\n'), ((90678, 90697), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 't'}), '(10, dtype=t)\n', (90684, 90697), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((90794, 90817), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y // a)'], {}), '(x, y // a)\n', (90806, 90817), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((90834, 90858), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y // a)'], {}), '(xm, y // a)\n', (90846, 90858), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((91200, 91236), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (91223, 91236), False, 'import warnings\n'), ((91259, 91292), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (91282, 91292), False, 'import warnings\n'), ((92732, 92768), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (92755, 92768), False, 'import warnings\n'), ((92791, 92824), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (92814, 92824), False, 'import warnings\n'), ((92940, 92959), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 't'}), '(10, dtype=t)\n', (92946, 92959), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((94394, 94430), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (94417, 94430), False, 'import warnings\n'), ((94453, 94486), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (94476, 94486), False, 'import warnings\n'), ((94544, 94585), 'numpy.ma.core.array', 'array', (['[1, 2, 3]'], {'mask': '[0, 0, 1]', 'dtype': 't'}), '([1, 2, 3], mask=[0, 0, 1], dtype=t)\n', (94549, 94585), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((94640, 94686), 'numpy.ma.core.array', 'array', (['[1, 2 ** 2, 3]'], {'mask': '[0, 0, 1]', 'dtype': 't'}), '([1, 2 ** 2, 3], mask=[0, 0, 1], dtype=t)\n', (94645, 94686), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((94703, 94735), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.data', 'xx_r.data'], {}), '(xx.data, xx_r.data)\n', (94715, 94735), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((94752, 94784), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xx.mask', 'xx_r.mask'], {}), '(xx.mask, xx_r.mask)\n', (94764, 94784), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((94866, 94897), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.data', 'xx_r.data'], {}), '(x.data, xx_r.data)\n', (94878, 94897), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((94914, 94945), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x.mask', 'xx_r.mask'], {}), '(x.mask, xx_r.mask)\n', (94926, 94945), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((97356, 97374), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (97370, 97374), True, 'import numpy as np\n'), ((97504, 97518), 'numpy.ma.core.allclose', 'allclose', (['a', 'b'], {}), '(a, b)\n', (97512, 97518), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((97754, 97788), 'numpy.ma.core.allclose', 'allclose', (['a', 'b'], {'masked_equal': '(False)'}), '(a, b, masked_equal=False)\n', (97762, 97788), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((99771, 99802), 'numpy.matrix', 'np.matrix', (['[False, False, True]'], {}), '([False, False, True])\n', (99780, 99802), True, 'import numpy as np\n'), ((99909, 99938), 'numpy.matrix', 'np.matrix', (['[True, True, True]'], {}), '([True, True, True])\n', (99918, 99938), True, 'import numpy as np\n'), ((100128, 100160), 'numpy.matrix', 'np.matrix', (['[False, False, False]'], {}), '([False, False, False])\n', (100137, 100160), True, 'import numpy as np\n'), ((100270, 100300), 'numpy.matrix', 'np.matrix', (['[True, True, False]'], {}), '([True, True, False])\n', (100279, 100300), True, 'import numpy as np\n'), ((104889, 104924), 'numpy.may_share_memory', 'np.may_share_memory', (['a.mask', 'b.mask'], {}), '(a.mask, b.mask)\n', (104908, 104924), True, 'import numpy as np\n'), ((114153, 114169), 'numpy.ma.core.array', 'array', (['x'], {'mask': 'm'}), '(x, mask=m)\n', (114158, 114169), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((115360, 115372), 'numpy.arange', 'np.arange', (['(3)'], {}), '(3)\n', (115369, 115372), True, 'import numpy as np\n'), ((115383, 115395), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (115392, 115395), True, 'import numpy as np\n'), ((127489, 127507), 'numpy.sqrt', 'np.sqrt', (['mXvar0[k]'], {}), '(mXvar0[k])\n', (127496, 127507), True, 'import numpy as np\n'), ((128074, 128099), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (128097, 128099), False, 'import warnings\n'), ((128117, 128148), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (128138, 128148), False, 'import warnings\n'), ((128338, 128363), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (128361, 128363), False, 'import warnings\n'), ((128381, 128412), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (128402, 128412), False, 'import warnings\n'), ((128474, 128488), 'numpy.isnan', 'np.isnan', (['nout'], {}), '(nout)\n', (128482, 128488), True, 'import numpy as np\n'), ((129100, 129114), 'numpy.isnan', 'np.isnan', (['nout'], {}), '(nout)\n', (129108, 129114), True, 'import numpy as np\n'), ((129662, 129671), 'numpy.ma.core.arange', 'arange', (['(9)'], {}), '(9)\n', (129668, 129671), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((133012, 133030), 'numpy.sqrt', 'np.sqrt', (['mXvar0[k]'], {}), '(mXvar0[k])\n', (133019, 133030), True, 'import numpy as np\n'), ((134378, 134391), 'numpy.ma.core.greater', 'greater', (['x', '(2)'], {}), '(x, 2)\n', (134385, 134391), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134453, 134472), 'numpy.ma.core.greater_equal', 'greater_equal', (['x', '(2)'], {}), '(x, 2)\n', (134466, 134472), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134561, 134571), 'numpy.ma.core.less', 'less', (['x', '(2)'], {}), '(x, 2)\n', (134565, 134571), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134630, 134646), 'numpy.ma.core.less_equal', 'less_equal', (['x', '(2)'], {}), '(x, 2)\n', (134640, 134646), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134732, 134747), 'numpy.ma.core.not_equal', 'not_equal', (['x', '(2)'], {}), '(x, 2)\n', (134741, 134747), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134811, 134822), 'numpy.ma.core.equal', 'equal', (['x', '(2)'], {}), '(x, 2)\n', (134816, 134822), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((134882, 134897), 'numpy.ma.core.not_equal', 'not_equal', (['x', '(2)'], {}), '(x, 2)\n', (134891, 134897), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((136014, 136026), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (136022, 136026), True, 'import numpy as np\n'), ((136028, 136039), 'numpy.ones', 'np.ones', (['(10)'], {}), '(10)\n', (136035, 136039), True, 'import numpy as np\n'), ((139381, 139397), 'numpy.ma.core.power', 'power', (['x', 'masked'], {}), '(x, masked)\n', (139386, 139397), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((144073, 144084), 'numpy.ma.core.getmask', 'getmask', (['zm'], {}), '(zm)\n', (144080, 144084), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((146641, 146660), 'numpy.ma.core.empty', 'empty', (['(4)'], {'dtype': 'int'}), '(4, dtype=int)\n', (146646, 146660), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((157531, 157544), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (157540, 157544), True, 'import numpy as np\n'), ((157546, 157564), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (157560, 157564), True, 'import numpy as np\n'), ((160451, 160464), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (160460, 160464), True, 'import numpy as np\n'), ((160466, 160484), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (160480, 160484), True, 'import numpy as np\n'), ((163381, 163396), 'numpy.arange', 'np.arange', (['(24.0)'], {}), '(24.0)\n', (163390, 163396), True, 'import numpy as np\n'), ((163426, 163450), 'numpy.zeros', 'np.zeros', (['(24)'], {'dtype': 'bool'}), '(24, dtype=bool)\n', (163434, 163450), True, 'import numpy as np\n'), ((165073, 165088), 'numpy.arange', 'np.arange', (['(24.0)'], {}), '(24.0)\n', (165082, 165088), True, 'import numpy as np\n'), ((165118, 165142), 'numpy.zeros', 'np.zeros', (['(24)'], {'dtype': 'bool'}), '(24, dtype=bool)\n', (165126, 165142), True, 'import numpy as np\n'), ((165296, 165308), 'numpy.ma.core.ones', 'ones', (['(2, 4)'], {}), '((2, 4))\n', (165300, 165308), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165354, 165364), 'numpy.ma.core.ones', 'ones', (['(4,)'], {}), '((4,))\n', (165358, 165364), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165415, 165430), 'numpy.ma.core.ones', 'ones', (['(1, 1, 1)'], {}), '((1, 1, 1))\n', (165419, 165430), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165486, 165501), 'numpy.ma.core.ones', 'ones', (['(2, 1, 4)'], {}), '((2, 1, 4))\n', (165490, 165501), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165561, 165576), 'numpy.ma.core.ones', 'ones', (['(1, 1, 4)'], {}), '((1, 1, 4))\n', (165565, 165576), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165618, 165630), 'numpy.ma.core.ones', 'ones', (['(2, 4)'], {}), '((2, 4))\n', (165622, 165630), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165891, 165903), 'numpy.ma.core.ones', 'ones', (['(2, 4)'], {}), '((2, 4))\n', (165895, 165903), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((165949, 165959), 'numpy.ma.core.ones', 'ones', (['(4,)'], {}), '((4,))\n', (165953, 165959), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((166010, 166025), 'numpy.ma.core.ones', 'ones', (['(1, 1, 1)'], {}), '((1, 1, 1))\n', (166014, 166025), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((166081, 166096), 'numpy.ma.core.ones', 'ones', (['(2, 1, 4)'], {}), '((2, 1, 4))\n', (166085, 166096), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((166156, 166171), 'numpy.ma.core.ones', 'ones', (['(1, 1, 4)'], {}), '((1, 1, 4))\n', (166160, 166171), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((166213, 166225), 'numpy.ma.core.ones', 'ones', (['(2, 4)'], {}), '((2, 4))\n', (166217, 166225), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((4465, 4481), 'numpy.ma.core.isMaskedArray', 'isMaskedArray', (['x'], {}), '(x)\n', (4478, 4481), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((4717, 4747), 'functools.reduce', 'reduce', (['(lambda x, y: x + y)', 'm1'], {}), '(lambda x, y: x + y, m1)\n', (4723, 4747), False, 'from functools import reduce\n'), ((6278, 6296), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (6292, 6296), True, 'import numpy as np\n'), ((6335, 6348), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (6344, 6348), True, 'import numpy as np\n'), ((13076, 13087), 'numpy.ma.core.getmask', 'getmask', (['x3'], {}), '(x3)\n', (13083, 13087), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((14741, 14751), 'numpy.ma.core.filled', 'filled', (['y3'], {}), '(y3)\n', (14747, 14751), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((20149, 20161), 'numpy.ma.core.conjugate', 'conjugate', (['z'], {}), '(z)\n', (20158, 20161), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((20337, 20361), 'numpy.ma.core.where', 'where', (['c', 'masked', 'masked'], {}), '(c, masked, masked)\n', (20342, 20361), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((20391, 20415), 'numpy.ma.core.where', 'where', (['c', 'masked', 'masked'], {}), '(c, masked, masked)\n', (20396, 20415), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((33339, 33345), 'numpy.ma.core.abs', 'abs', (['x'], {}), '(x)\n', (33342, 33345), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((33354, 33361), 'numpy.ma.core.abs', 'abs', (['xm'], {}), '(xm)\n', (33357, 33361), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((34919, 34927), 'numpy.ma.core.array', 'array', (['(0)'], {}), '(0)\n', (34924, 34927), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((48326, 48354), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(10)', '(12)'], {}), '(0, 10, 12)\n', (48343, 48354), True, 'import numpy as np\n'), ((60802, 60825), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['"""0"""'], {}), "('0')\n", (60820, 60825), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((76036, 76061), 'numpy.ma.core.multiply.outer', 'multiply.outer', (['a', 'me_too'], {}), '(a, me_too)\n', (76050, 76061), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((87291, 87309), 'numpy.ma.core.mask_or', 'mask_or', (['m', 'a.mask'], {}), '(m, a.mask)\n', (87298, 87309), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((88451, 88469), 'numpy.ma.core.mask_or', 'mask_or', (['m', 'a.mask'], {}), '(m, a.mask)\n', (88458, 88469), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((89621, 89639), 'numpy.ma.core.mask_or', 'mask_or', (['m', 'a.mask'], {}), '(m, a.mask)\n', (89628, 89639), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((90030, 90049), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 't'}), '(10, dtype=t)\n', (90036, 90049), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((90078, 90097), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 't'}), '(10, dtype=t)\n', (90084, 90097), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((91380, 91399), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 't'}), '(10, dtype=t)\n', (91386, 91399), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((91428, 91447), 'numpy.ma.core.arange', 'arange', (['(10)'], {'dtype': 't'}), '(10, dtype=t)\n', (91434, 91447), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((92071, 92089), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', 'y'], {}), '(x, y)\n', (92083, 92089), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((92265, 92284), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', 'y'], {}), '(xm, y)\n', (92277, 92284), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((93573, 93595), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['x', '(y / a)'], {}), '(x, y / a)\n', (93585, 93595), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((93768, 93791), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['xm', '(y / a)'], {}), '(xm, y / a)\n', (93780, 93791), False, 'from numpy.ma.testutils import assert_, assert_array_equal, assert_equal, assert_almost_equal, assert_equal_records, fail_if_equal, assert_not_equal, assert_mask_equal\n'), ((98019, 98036), 'numpy.iinfo', 'np.iinfo', (['np.int_'], {}), '(np.int_)\n', (98027, 98036), True, 'import numpy as np\n'), ((117254, 117268), 'numpy.compat.asbytes', 'asbytes', (['"""one"""'], {}), "('one')\n", (117261, 117268), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((117302, 117316), 'numpy.compat.asbytes', 'asbytes', (['"""two"""'], {}), "('two')\n", (117309, 117316), False, 'from numpy.compat import asbytes, asbytes_nested\n'), ((122697, 122725), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(10)', '(12)'], {}), '(0, 10, 12)\n', (122714, 122725), True, 'import numpy as np\n'), ((136815, 136859), 'numpy.ma.core.array', 'array', (['[2, 2, 1, 2, 1]'], {'mask': '[1, 0, 0, 0, 0]'}), '([2, 2, 1, 2, 1], mask=[1, 0, 0, 0, 0])\n', (136820, 136859), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((137840, 137868), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(10)', '(12)'], {}), '(0, 10, 12)\n', (137857, 137868), True, 'import numpy as np\n'), ((158308, 158326), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (158322, 158326), True, 'import numpy as np\n'), ((158328, 158341), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (158337, 158341), True, 'import numpy as np\n'), ((19509, 19529), 'numpy.ma.core.array', 'array', (['[1]'], {'mask': '[1]'}), '([1], mask=[1])\n', (19514, 19529), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((21778, 21799), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0)'], {}), '(0)\n', (21796, 21799), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((21833, 21856), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['"""0"""'], {}), "('0')\n", (21851, 21856), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((21890, 21913), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0.0)'], {}), '(0.0)\n', (21908, 21913), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((65163, 65186), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0.0)'], {}), '(0.0)\n', (65181, 65186), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((65529, 65550), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0)'], {}), '(0)\n', (65547, 65550), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((65580, 65603), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0.0)'], {}), '(0.0)\n', (65598, 65603), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((65632, 65655), 'numpy.ma.core.default_fill_value', 'default_fill_value', (['(0.0)'], {}), '(0.0)\n', (65650, 65655), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((90946, 90964), 'numpy.ma.core.mask_or', 'mask_or', (['m', 'a.mask'], {}), '(m, a.mask)\n', (90953, 90964), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n'), ((118834, 118847), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (118843, 118847), True, 'import numpy as np\n'), ((118972, 118990), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (118986, 118990), True, 'import numpy as np\n'), ((119305, 119318), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (119314, 119318), True, 'import numpy as np\n'), ((119375, 119393), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (119389, 119393), True, 'import numpy as np\n'), ((119450, 119468), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (119464, 119468), True, 'import numpy as np\n'), ((164825, 164838), 'numpy.arange', 'np.arange', (['(24)'], {}), '(24)\n', (164834, 164838), True, 'import numpy as np\n'), ((93891, 93909), 'numpy.ma.core.mask_or', 'mask_or', (['m', 'a.mask'], {}), '(m, a.mask)\n', (93898, 93909), False, 'from numpy.ma.core import MAError, MaskError, MaskType, MaskedArray, abs, absolute, add, all, allclose, allequal, alltrue, angle, anom, arange, arccos, arccosh, arctan2, arcsin, arctan, argsort, array, asarray, choose, concatenate, conjugate, cos, cosh, count, default_fill_value, diag, divide, empty, empty_like, equal, exp, flatten_mask, filled, fix_invalid, flatten_structured_array, fromflex, getmask, getmaskarray, greater, greater_equal, identity, inner, isMaskedArray, less, less_equal, log, log10, make_mask, make_mask_descr, mask_or, masked, masked_array, masked_equal, masked_greater, masked_greater_equal, masked_inside, masked_less, masked_less_equal, masked_not_equal, masked_outside, masked_print_option, masked_values, masked_where, max, maximum, maximum_fill_value, min, minimum, minimum_fill_value, mod, multiply, mvoid, nomask, not_equal, ones, outer, power, product, put, putmask, ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt, subtract, sum, take, tan, tanh, transpose, where, zeros\n')]
|
import os
from unittest import TestCase, skipIf
from app.main import ALLOWED_TASKS
from app.validation import ffmpeg_read
from starlette.testclient import TestClient
from tests.test_api import TESTABLE_MODELS
@skipIf(
"text-to-speech" not in ALLOWED_TASKS,
"text-to-speech not implemented",
)
class AudioSourceSeparationTestCase(TestCase):
def setUp(self):
model_id = TESTABLE_MODELS["text-to-speech"]
self.old_model_id = os.getenv("MODEL_ID")
self.old_task = os.getenv("TASK")
os.environ["MODEL_ID"] = model_id
os.environ["TASK"] = "text-to-speech"
from app.main import app
self.app = app
def tearDown(self):
os.environ["MODEL_ID"] = self.old_model_id
os.environ["TASK"] = self.old_task
def test_simple(self):
with TestClient(self.app) as client:
response = client.post("/", json={"inputs": "This is some text"})
self.assertEqual(
response.status_code,
200,
)
self.assertEqual(response.header["content-type"], "audio/wav")
audio = ffmpeg_read(response.content)
self.assertEqual(audio.shape, (10,))
def test_malformed_input(self):
with TestClient(self.app) as client:
response = client.post("/", data=b"This is some test")
self.assertEqual(
response.status_code,
400,
)
self.assertEqual(response.content, b'{"error":"Malformed soundfile"}')
|
[
"starlette.testclient.TestClient",
"unittest.skipIf",
"os.getenv",
"app.validation.ffmpeg_read"
] |
[((213, 292), 'unittest.skipIf', 'skipIf', (["('text-to-speech' not in ALLOWED_TASKS)", '"""text-to-speech not implemented"""'], {}), "('text-to-speech' not in ALLOWED_TASKS, 'text-to-speech not implemented')\n", (219, 292), False, 'from unittest import TestCase, skipIf\n'), ((453, 474), 'os.getenv', 'os.getenv', (['"""MODEL_ID"""'], {}), "('MODEL_ID')\n", (462, 474), False, 'import os\n'), ((499, 516), 'os.getenv', 'os.getenv', (['"""TASK"""'], {}), "('TASK')\n", (508, 516), False, 'import os\n'), ((1107, 1136), 'app.validation.ffmpeg_read', 'ffmpeg_read', (['response.content'], {}), '(response.content)\n', (1118, 1136), False, 'from app.validation import ffmpeg_read\n'), ((822, 842), 'starlette.testclient.TestClient', 'TestClient', (['self.app'], {}), '(self.app)\n', (832, 842), False, 'from starlette.testclient import TestClient\n'), ((1232, 1252), 'starlette.testclient.TestClient', 'TestClient', (['self.app'], {}), '(self.app)\n', (1242, 1252), False, 'from starlette.testclient import TestClient\n')]
|
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
# -----------------------------------------------------------------------------
try:
basestring # Python 3
except NameError:
basestring = str # Python 2
import hashlib
import math
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import ExchangeNotAvailable
class exx (Exchange):
def describe(self):
return self.deep_extend(super(exx, self).describe(), {
'id': 'exx',
'name': 'EXX',
'countries': ['CN'],
'rateLimit': 1000 / 10,
'has': {
'fetchOrder': True,
'fetchTickers': True,
'fetchOpenOrders': True,
},
'urls': {
'logo': 'https://user-images.githubusercontent.com/1294454/37770292-fbf613d0-2de4-11e8-9f79-f2dc451b8ccb.jpg',
'api': {
'public': 'https://api.exx.com/data/v1',
'private': 'https://trade.exx.com/api',
},
'www': 'https://www.exx.com/',
'doc': 'https://www.exx.com/help/restApi',
'fees': 'https://www.exx.com/help/rate',
},
'api': {
'public': {
'get': [
'markets',
'tickers',
'ticker',
'depth',
'trades',
],
},
'private': {
'get': [
'order',
'cancel',
'getOrder',
'getOpenOrders',
'getBalance',
],
},
},
'fees': {
'trading': {
'maker': 0.1 / 100,
'taker': 0.1 / 100,
},
'funding': {
'withdraw': {
'BCC': 0.0003,
'BCD': 0.0,
'BOT': 10.0,
'BTC': 0.001,
'BTG': 0.0,
'BTM': 25.0,
'BTS': 3.0,
'EOS': 1.0,
'ETC': 0.01,
'ETH': 0.01,
'ETP': 0.012,
'HPY': 0.0,
'HSR': 0.001,
'INK': 20.0,
'LTC': 0.005,
'MCO': 0.6,
'MONA': 0.01,
'QASH': 5.0,
'QCASH': 5.0,
'QTUM': 0.01,
'USDT': 5.0,
},
},
},
'commonCurrencies': {
'CAN': 'Content and AD Network',
},
'exceptions': {
'103': AuthenticationError,
},
})
def fetch_markets(self):
markets = self.publicGetMarkets()
ids = list(markets.keys())
result = []
for i in range(0, len(ids)):
id = ids[i]
market = markets[id]
baseId, quoteId = id.split('_')
upper = id.upper()
base, quote = upper.split('_')
base = self.common_currency_code(base)
quote = self.common_currency_code(quote)
symbol = base + '/' + quote
active = market['isOpen'] is True
precision = {
'amount': int(market['amountScale']),
'price': int(market['priceScale']),
}
lot = math.pow(10, -precision['amount'])
result.append({
'id': id,
'symbol': symbol,
'base': base,
'quote': quote,
'baseId': baseId,
'quoteId': quoteId,
'active': active,
'lot': lot,
'precision': precision,
'limits': {
'amount': {
'min': lot,
'max': math.pow(10, precision['amount']),
},
'price': {
'min': math.pow(10, -precision['price']),
'max': math.pow(10, precision['price']),
},
'cost': {
'min': None,
'max': None,
},
},
'info': market,
})
return result
def parse_ticker(self, ticker, market=None):
symbol = market['symbol']
timestamp = int(ticker['date'])
ticker = ticker['ticker']
last = self.safe_float(ticker, 'last')
return {
'symbol': symbol,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'high': self.safe_float(ticker, 'high'),
'low': self.safe_float(ticker, 'low'),
'bid': self.safe_float(ticker, 'buy'),
'bidVolume': None,
'ask': self.safe_float(ticker, 'sell'),
'askVolume': None,
'vwap': None,
'open': None,
'close': last,
'last': last,
'previousClose': None,
'change': self.safe_float(ticker, 'riseRate'),
'percentage': None,
'average': None,
'baseVolume': self.safe_float(ticker, 'vol'),
'quoteVolume': None,
'info': ticker,
}
def fetch_ticker(self, symbol, params={}):
self.load_markets()
market = self.market(symbol)
ticker = self.publicGetTicker(self.extend({
'currency': market['id'],
}, params))
return self.parse_ticker(ticker, market)
def fetch_tickers(self, symbols=None, params={}):
self.load_markets()
tickers = self.publicGetTickers(params)
result = {}
timestamp = self.milliseconds()
ids = list(tickers.keys())
for i in range(0, len(ids)):
id = ids[i]
if not(id in list(self.marketsById.keys())):
continue
market = self.marketsById[id]
symbol = market['symbol']
ticker = {
'date': timestamp,
'ticker': tickers[id],
}
result[symbol] = self.parse_ticker(ticker, market)
return result
def fetch_order_book(self, symbol, limit=None, params={}):
self.load_markets()
orderbook = self.publicGetDepth(self.extend({
'currency': self.market_id(symbol),
}, params))
return self.parse_order_book(orderbook, orderbook['timestamp'])
def parse_trade(self, trade, market=None):
timestamp = trade['date'] * 1000
price = self.safe_float(trade, 'price')
amount = self.safe_float(trade, 'amount')
symbol = market['symbol']
cost = self.cost_to_precision(symbol, price * amount)
return {
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'symbol': symbol,
'id': self.safe_string(trade, 'tid'),
'order': None,
'type': 'limit',
'side': trade['type'],
'price': price,
'amount': amount,
'cost': cost,
'fee': None,
'info': trade,
}
def fetch_trades(self, symbol, since=None, limit=None, params={}):
self.load_markets()
market = self.market(symbol)
trades = self.publicGetTrades(self.extend({
'currency': market['id'],
}, params))
return self.parse_trades(trades, market, since, limit)
def fetch_balance(self, params={}):
self.load_markets()
balances = self.privateGetGetBalance(params)
result = {'info': balances}
balances = balances['funds']
currencies = list(balances.keys())
for i in range(0, len(currencies)):
id = currencies[i]
balance = balances[id]
currency = self.common_currency_code(id)
account = {
'free': float(balance['balance']),
'used': float(balance['freeze']),
'total': float(balance['total']),
}
result[currency] = account
return self.parse_balance(result)
def parse_order(self, order, market=None):
symbol = market['symbol']
timestamp = int(order['trade_date'])
price = self.safe_float(order, 'price')
cost = self.safe_float(order, 'trade_money')
amount = self.safe_float(order, 'total_amount')
filled = self.safe_float(order, 'trade_amount', 0.0)
remaining = self.amount_to_precision(symbol, amount - filled)
status = self.safe_integer(order, 'status')
if status == 1:
status = 'canceled'
elif status == 2:
status = 'closed'
else:
status = 'open'
fee = None
if 'fees' in order:
fee = {
'cost': self.safe_float(order, 'fees'),
'currency': market['quote'],
}
return {
'id': self.safe_string(order, 'id'),
'datetime': self.iso8601(timestamp),
'timestamp': timestamp,
'lastTradeTimestamp': None,
'status': 'open',
'symbol': symbol,
'type': 'limit',
'side': order['type'],
'price': price,
'cost': cost,
'amount': amount,
'filled': filled,
'remaining': remaining,
'trades': None,
'fee': fee,
'info': order,
}
def create_order(self, symbol, type, side, amount, price=None, params={}):
self.load_markets()
market = self.market(symbol)
response = self.privateGetOrder(self.extend({
'currency': market['id'],
'type': side,
'price': price,
'amount': amount,
}, params))
id = response['id']
order = self.parse_order({
'id': id,
'trade_date': self.milliseconds(),
'total_amount': amount,
'price': price,
'type': side,
'info': response,
}, market)
self.orders[id] = order
return order
def cancel_order(self, id, symbol=None, params={}):
self.load_markets()
market = self.market(symbol)
result = self.privateGetCancel(self.extend({
'id': id,
'currency': market['id'],
}, params))
return result
def fetch_order(self, id, symbol=None, params={}):
self.load_markets()
market = self.market(symbol)
order = self.privateGetGetOrder(self.extend({
'id': id,
'currency': market['id'],
}, params))
return self.parse_order(order, market)
def fetch_open_orders(self, symbol=None, since=None, limit=None, params={}):
self.load_markets()
market = self.market(symbol)
orders = self.privateGetOpenOrders(self.extend({
'currency': market['id'],
}, params))
return self.parse_orders(orders, market, since, limit)
def nonce(self):
return self.milliseconds()
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
url = self.urls['api'][api] + '/' + path
if api == 'public':
if params:
url += '?' + self.urlencode(params)
else:
self.check_required_credentials()
query = self.urlencode(self.keysort(self.extend({
'accesskey': self.apiKey,
'nonce': self.nonce(),
}, params)))
signature = self.hmac(self.encode(query), self.encode(self.secret), hashlib.sha512)
url += '?' + query + '&signature=' + signature
return {'url': url, 'method': method, 'body': body, 'headers': headers}
def handle_errors(self, httpCode, reason, url, method, headers, body):
if not isinstance(body, basestring):
return # fallback to default error handler
if len(body) < 2:
return # fallback to default error handler
if (body[0] == '{') or (body[0] == '['):
response = json.loads(body)
#
# {"result":false,"message":"服务端忙碌"}
# ... and other formats
#
code = self.safe_string(response, 'code')
message = self.safe_string(response, 'message')
feedback = self.id + ' ' + self.json(response)
if code == '100':
return
if code is not None:
exceptions = self.exceptions
if code in exceptions:
raise exceptions[code](feedback)
raise ExchangeError(feedback)
result = self.safe_value(response, 'result')
if result is not None:
if not result:
if message == u'服务端忙碌':
raise ExchangeNotAvailable(feedback)
else:
raise ExchangeError(feedback)
|
[
"ccxt.base.errors.ExchangeError",
"ccxt.base.errors.ExchangeNotAvailable",
"json.loads",
"math.pow"
] |
[((3970, 4004), 'math.pow', 'math.pow', (['(10)', "(-precision['amount'])"], {}), "(10, -precision['amount'])\n", (3978, 4004), False, 'import math\n'), ((12813, 12829), 'json.loads', 'json.loads', (['body'], {}), '(body)\n', (12823, 12829), False, 'import json\n'), ((13363, 13386), 'ccxt.base.errors.ExchangeError', 'ExchangeError', (['feedback'], {}), '(feedback)\n', (13376, 13386), False, 'from ccxt.base.errors import ExchangeError\n'), ((13584, 13614), 'ccxt.base.errors.ExchangeNotAvailable', 'ExchangeNotAvailable', (['feedback'], {}), '(feedback)\n', (13604, 13614), False, 'from ccxt.base.errors import ExchangeNotAvailable\n'), ((13671, 13694), 'ccxt.base.errors.ExchangeError', 'ExchangeError', (['feedback'], {}), '(feedback)\n', (13684, 13694), False, 'from ccxt.base.errors import ExchangeError\n'), ((4454, 4487), 'math.pow', 'math.pow', (['(10)', "precision['amount']"], {}), "(10, precision['amount'])\n", (4462, 4487), False, 'import math\n'), ((4574, 4607), 'math.pow', 'math.pow', (['(10)', "(-precision['price'])"], {}), "(10, -precision['price'])\n", (4582, 4607), False, 'import math\n'), ((4640, 4672), 'math.pow', 'math.pow', (['(10)', "precision['price']"], {}), "(10, precision['price'])\n", (4648, 4672), False, 'import math\n')]
|
from timeit import timeit
from planar import Vec2
from planar.c import Polygon
from random import random
import itertools
def rand_pt(span=10):
return Vec2(random() * span - 0.5, random() * span - 0.5)
tris = [Polygon([rand_pt(), rand_pt(), rand_pt()]) for i in range(100)]
pts = [rand_pt(20) for i in range(1000)]
ins = count = 0
# confirm the two algorithms agree
for tri in tris:
winding_test = tri._pnp_winding_test
bary_test = tri._pnp_triangle_test
for p in pts:
cross = winding_test(p)
bary = bary_test(p)
ins += bary
count += 1
assert cross == bary, (count, list(tri), p, cross, bary)
print("ins", ins)
print("outs", len(tris)*len(pts) - ins)
times = 10
def test_null():
for tri in tris:
winding_test = tri._pnp_winding_test
for p in pts:
pass
null = timeit(test_null, number=times)
def test_winding():
for tri in tris:
winding_test = tri._pnp_winding_test
for p in pts:
winding_test(p)
print("winding", timeit(test_winding, number=times) - null)
def test_bary():
for tri in tris:
bary_test = tri._pnp_triangle_test
for p in pts:
bary_test(p)
print("bary", timeit(test_bary, number=times) - null)
|
[
"random.random",
"timeit.timeit"
] |
[((788, 819), 'timeit.timeit', 'timeit', (['test_null'], {'number': 'times'}), '(test_null, number=times)\n', (794, 819), False, 'from timeit import timeit\n'), ((951, 985), 'timeit.timeit', 'timeit', (['test_winding'], {'number': 'times'}), '(test_winding, number=times)\n', (957, 985), False, 'from timeit import timeit\n'), ((1114, 1145), 'timeit.timeit', 'timeit', (['test_bary'], {'number': 'times'}), '(test_bary, number=times)\n', (1120, 1145), False, 'from timeit import timeit\n'), ((158, 166), 'random.random', 'random', ([], {}), '()\n', (164, 166), False, 'from random import random\n'), ((181, 189), 'random.random', 'random', ([], {}), '()\n', (187, 189), False, 'from random import random\n')]
|
from aiocqhttp import CQHttp, ApiError, jsonify, request
import os
import random
from Repeater import Repeater
import logging
import asyncio
import time
from util import load_json, purgeMsg
from datetime import datetime, timezone, timedelta
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from apscheduler.triggers.cron import CronTrigger
from queue import Queue
logging.basicConfig(
level=logging.INFO,
format=
'%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
filename=os.path.join(os.path.abspath(os.path.dirname(__file__)),
'coolq.log'),
filemode='w+')
bot = CQHttp(api_root='http://127.0.0.1:5700/')
GroupDict = dict()
SETTINGS = load_json('settings.json')
REPLY = load_json('data/reply.json')
msgQueue = Queue()
# app = bot.server_app
# @app.route('/danmu/coolq')
# async def danmu():
# if request.remote_addr and request.remote_addr != '127.0.0.1':
# return None
# re = []
# while not msgQueue.empty():
# re.append(msgQueue.get())
# return jsonify(re)
@bot.on_message('private')
async def handle_private(context):
await bot.send(context, message=context['message'])
if context['user_id'] in SETTINGS['ADMIN']:
for group_id in SETTINGS['REPOST_GROUP']:
await bot.send({'group_id': group_id}, message=context['message'])
@bot.on_message('group')
async def handle_msg(context):
groupId = context['group_id']
if groupId in SETTINGS['DANMU_GROUP']:
msgQueue.put({
'sender': context['user_id'],
'msg': context['message']
# 'msg': purgeMsg(context['message'])
})
if groupId not in SETTINGS['ALLOW_GROUP']:
return
global GroupDict
try:
if (GroupDict.get(groupId) == None):
GroupDict[groupId] = Repeater()
re = await GroupDict[groupId].responseMsg(context)
print({"msg": context['message'], "ans": re})
await bot.send({'group_id': groupId}, message=re) if (len(re) > 0) else 0
except Exception as e:
print({"msg": context['message'], "ans": "ERROR"})
logging.exception(e)
@bot.on_notice('group_increase')
async def handle_group_increase(context):
if context['group_id'] not in SETTINGS['ALLOW_GROUP']:
return
re = random.choice(REPLY['on_group_increase'])
await bot.send(context, message=re, auto_escape=True)
@bot.on_request('group', 'friend')
async def handle_group_request(context):
return {'approve': True}
async def send_early_msg():
await asyncio.sleep(int(random.random() * 60 * 60) + 900)
time_format = '%Y-%m-%d %H:%M:%S'
bj_offset = timezone(timedelta(hours=8))
bj_datetime = datetime.now(bj_offset)
re = random.choice(REPLY['on_early'])
for group_id in SETTINGS['MEMTION_GROUP']:
await bot.send({'group_id': group_id}, message=re)
async def send_new_day_msg():
for group_id in SETTINGS['MEMTION_GROUP']:
re = random.choice(REPLY['on_new_day'])
await bot.send({'group_id': group_id}, message=re)
def sche():
scheduler = AsyncIOScheduler()
# TODO: fit for all environments with different timezone, this is for 0 timezone
scheduler.add_job(send_early_msg, 'cron', hour='3', minute='0')
scheduler.add_job(send_new_day_msg, 'cron', hour='0', minute='0')
scheduler.start()
if __name__ == '__main__':
sche()
bot.run(host='0.0.0.0', port=8090)
|
[
"Repeater.Repeater",
"logging.exception",
"os.path.dirname",
"util.load_json",
"random.choice",
"aiocqhttp.CQHttp",
"random.random",
"datetime.timedelta",
"apscheduler.schedulers.asyncio.AsyncIOScheduler",
"datetime.datetime.now",
"queue.Queue"
] |
[((677, 718), 'aiocqhttp.CQHttp', 'CQHttp', ([], {'api_root': '"""http://127.0.0.1:5700/"""'}), "(api_root='http://127.0.0.1:5700/')\n", (683, 718), False, 'from aiocqhttp import CQHttp, ApiError, jsonify, request\n'), ((750, 776), 'util.load_json', 'load_json', (['"""settings.json"""'], {}), "('settings.json')\n", (759, 776), False, 'from util import load_json, purgeMsg\n'), ((785, 813), 'util.load_json', 'load_json', (['"""data/reply.json"""'], {}), "('data/reply.json')\n", (794, 813), False, 'from util import load_json, purgeMsg\n'), ((825, 832), 'queue.Queue', 'Queue', ([], {}), '()\n', (830, 832), False, 'from queue import Queue\n'), ((2354, 2395), 'random.choice', 'random.choice', (["REPLY['on_group_increase']"], {}), "(REPLY['on_group_increase'])\n", (2367, 2395), False, 'import random\n'), ((2754, 2777), 'datetime.datetime.now', 'datetime.now', (['bj_offset'], {}), '(bj_offset)\n', (2766, 2777), False, 'from datetime import datetime, timezone, timedelta\n'), ((2787, 2819), 'random.choice', 'random.choice', (["REPLY['on_early']"], {}), "(REPLY['on_early'])\n", (2800, 2819), False, 'import random\n'), ((3142, 3160), 'apscheduler.schedulers.asyncio.AsyncIOScheduler', 'AsyncIOScheduler', ([], {}), '()\n', (3158, 3160), False, 'from apscheduler.schedulers.asyncio import AsyncIOScheduler\n'), ((2716, 2734), 'datetime.timedelta', 'timedelta', ([], {'hours': '(8)'}), '(hours=8)\n', (2725, 2734), False, 'from datetime import datetime, timezone, timedelta\n'), ((3018, 3052), 'random.choice', 'random.choice', (["REPLY['on_new_day']"], {}), "(REPLY['on_new_day'])\n", (3031, 3052), False, 'import random\n'), ((1873, 1883), 'Repeater.Repeater', 'Repeater', ([], {}), '()\n', (1881, 1883), False, 'from Repeater import Repeater\n'), ((2173, 2193), 'logging.exception', 'logging.exception', (['e'], {}), '(e)\n', (2190, 2193), False, 'import logging\n'), ((583, 608), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (598, 608), False, 'import os\n'), ((2619, 2634), 'random.random', 'random.random', ([], {}), '()\n', (2632, 2634), False, 'import random\n')]
|
"""Build Environment used for isolation during sdist building
"""
import logging
import os
import sys
import textwrap
from collections import OrderedDict
from distutils.sysconfig import get_python_lib
from sysconfig import get_paths
from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet
from pip import __file__ as pip_location
from pip._internal.utils.misc import call_subprocess
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.utils.ui import open_spinner
if MYPY_CHECK_RUNNING:
from typing import Tuple, Set, Iterable, Optional, List # noqa: F401
from pip._internal.index import PackageFinder # noqa: F401
logger = logging.getLogger(__name__)
class _Prefix:
def __init__(self, path):
# type: (str) -> None
self.path = path
self.setup = False
self.bin_dir = get_paths(
'nt' if os.name == 'nt' else 'posix_prefix',
vars={'base': path, 'platbase': path}
)['scripts']
# Note: prefer distutils' sysconfig to get the
# library paths so PyPy is correctly supported.
purelib = get_python_lib(plat_specific=False, prefix=path)
platlib = get_python_lib(plat_specific=True, prefix=path)
if purelib == platlib:
self.lib_dirs = [purelib]
else:
self.lib_dirs = [purelib, platlib]
class BuildEnvironment(object):
"""Creates and manages an isolated environment to install build deps
"""
def __init__(self):
# type: () -> None
self._temp_dir = TempDirectory(kind="build-env")
self._temp_dir.create()
self._prefixes = OrderedDict((
(name, _Prefix(os.path.join(self._temp_dir.path, name)))
for name in ('normal', 'overlay')
))
self._bin_dirs = [] # type: List[str]
self._lib_dirs = [] # type: List[str]
for prefix in reversed(list(self._prefixes.values())):
self._bin_dirs.append(prefix.bin_dir)
self._lib_dirs.extend(prefix.lib_dirs)
# Customize site to:
# - ensure .pth files are honored
# - prevent access to system site packages
system_sites = {
os.path.normcase(site) for site in (
get_python_lib(plat_specific=False),
get_python_lib(plat_specific=True),
)
}
self._site_dir = os.path.join(self._temp_dir.path, 'site')
if not os.path.exists(self._site_dir):
os.mkdir(self._site_dir)
with open(os.path.join(self._site_dir, 'sitecustomize.py'), 'w') as fp:
fp.write(textwrap.dedent(
'''
import os, site, sys
# First, drop system-sites related paths.
original_sys_path = sys.path[:]
known_paths = set()
for path in {system_sites!r}:
site.addsitedir(path, known_paths=known_paths)
system_paths = set(
os.path.normcase(path)
for path in sys.path[len(original_sys_path):]
)
original_sys_path = [
path for path in original_sys_path
if os.path.normcase(path) not in system_paths
]
sys.path = original_sys_path
# Second, add lib directories.
# ensuring .pth file are processed.
for path in {lib_dirs!r}:
assert not path in sys.path
site.addsitedir(path)
'''
).format(system_sites=system_sites, lib_dirs=self._lib_dirs))
def __enter__(self):
self._save_env = {
name: os.environ.get(name, None)
for name in ('PATH', 'PYTHONNOUSERSITE', 'PYTHONPATH')
}
path = self._bin_dirs[:]
old_path = self._save_env['PATH']
if old_path:
path.extend(old_path.split(os.pathsep))
pythonpath = [self._site_dir]
os.environ.update({
'PATH': os.pathsep.join(path),
'PYTHONNOUSERSITE': '1',
'PYTHONPATH': os.pathsep.join(pythonpath),
})
def __exit__(self, exc_type, exc_val, exc_tb):
for varname, old_value in self._save_env.items():
if old_value is None:
os.environ.pop(varname, None)
else:
os.environ[varname] = old_value
def cleanup(self):
# type: () -> None
self._temp_dir.cleanup()
def check_requirements(self, reqs):
# type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]]
"""Return 2 sets:
- conflicting requirements: set of (installed, wanted) reqs tuples
- missing requirements: set of reqs
"""
missing = set()
conflicting = set()
if reqs:
ws = WorkingSet(self._lib_dirs)
for req in reqs:
try:
if ws.find(Requirement.parse(req)) is None:
missing.add(req)
except VersionConflict as e:
conflicting.add((str(e.args[0].as_requirement()),
str(e.args[1])))
return conflicting, missing
def install_requirements(
self,
finder, # type: PackageFinder
requirements, # type: Iterable[str]
prefix_as_string, # type: str
message # type: Optional[str]
):
# type: (...) -> None
prefix = self._prefixes[prefix_as_string]
assert not prefix.setup
prefix.setup = True
if not requirements:
return
args = [
sys.executable, os.path.dirname(pip_location), 'install',
'--ignore-installed', '--no-user', '--prefix', prefix.path,
'--no-warn-script-location',
] # type: List[str]
if logger.getEffectiveLevel() <= logging.DEBUG:
args.append('-v')
for format_control in ('no_binary', 'only_binary'):
formats = getattr(finder.format_control, format_control)
args.extend(('--' + format_control.replace('_', '-'),
','.join(sorted(formats or {':none:'}))))
if finder.index_urls:
args.extend(['-i', finder.index_urls[0]])
for extra_index in finder.index_urls[1:]:
args.extend(['--extra-index-url', extra_index])
else:
args.append('--no-index')
for link in finder.find_links:
args.extend(['--find-links', link])
for _, host, _ in finder.secure_origins:
args.extend(['--trusted-host', host])
if finder.allow_all_prereleases:
args.append('--pre')
args.append('--')
args.extend(requirements)
with open_spinner(message) as spinner:
call_subprocess(args, show_stdout=False, spinner=spinner)
class NoOpBuildEnvironment(BuildEnvironment):
"""A no-op drop-in replacement for BuildEnvironment
"""
def __init__(self):
pass
def __enter__(self):
pass
def __exit__(self, exc_type, exc_val, exc_tb):
pass
def cleanup(self):
pass
def install_requirements(self, finder, requirements, prefix, message):
raise NotImplementedError()
|
[
"textwrap.dedent",
"os.mkdir",
"pip._internal.utils.misc.call_subprocess",
"pip._vendor.pkg_resources.Requirement.parse",
"os.pathsep.join",
"pip._vendor.pkg_resources.WorkingSet",
"distutils.sysconfig.get_python_lib",
"os.path.dirname",
"os.path.exists",
"pip._internal.utils.ui.open_spinner",
"os.environ.get",
"sysconfig.get_paths",
"os.path.normcase",
"os.environ.pop",
"os.path.join",
"logging.getLogger",
"pip._internal.utils.temp_dir.TempDirectory"
] |
[((742, 769), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (759, 769), False, 'import logging\n'), ((1191, 1239), 'distutils.sysconfig.get_python_lib', 'get_python_lib', ([], {'plat_specific': '(False)', 'prefix': 'path'}), '(plat_specific=False, prefix=path)\n', (1205, 1239), False, 'from distutils.sysconfig import get_python_lib\n'), ((1258, 1305), 'distutils.sysconfig.get_python_lib', 'get_python_lib', ([], {'plat_specific': '(True)', 'prefix': 'path'}), '(plat_specific=True, prefix=path)\n', (1272, 1305), False, 'from distutils.sysconfig import get_python_lib\n'), ((1628, 1659), 'pip._internal.utils.temp_dir.TempDirectory', 'TempDirectory', ([], {'kind': '"""build-env"""'}), "(kind='build-env')\n", (1641, 1659), False, 'from pip._internal.utils.temp_dir import TempDirectory\n'), ((2468, 2509), 'os.path.join', 'os.path.join', (['self._temp_dir.path', '"""site"""'], {}), "(self._temp_dir.path, 'site')\n", (2480, 2509), False, 'import os\n'), ((923, 1020), 'sysconfig.get_paths', 'get_paths', (["('nt' if os.name == 'nt' else 'posix_prefix')"], {'vars': "{'base': path, 'platbase': path}"}), "('nt' if os.name == 'nt' else 'posix_prefix', vars={'base': path,\n 'platbase': path})\n", (932, 1020), False, 'from sysconfig import get_paths\n'), ((2277, 2299), 'os.path.normcase', 'os.path.normcase', (['site'], {}), '(site)\n', (2293, 2299), False, 'import os\n'), ((2525, 2555), 'os.path.exists', 'os.path.exists', (['self._site_dir'], {}), '(self._site_dir)\n', (2539, 2555), False, 'import os\n'), ((2569, 2593), 'os.mkdir', 'os.mkdir', (['self._site_dir'], {}), '(self._site_dir)\n', (2577, 2593), False, 'import os\n'), ((3807, 3833), 'os.environ.get', 'os.environ.get', (['name', 'None'], {}), '(name, None)\n', (3821, 3833), False, 'import os\n'), ((4979, 5005), 'pip._vendor.pkg_resources.WorkingSet', 'WorkingSet', (['self._lib_dirs'], {}), '(self._lib_dirs)\n', (4989, 5005), False, 'from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet\n'), ((5833, 5862), 'os.path.dirname', 'os.path.dirname', (['pip_location'], {}), '(pip_location)\n', (5848, 5862), False, 'import os\n'), ((6952, 6973), 'pip._internal.utils.ui.open_spinner', 'open_spinner', (['message'], {}), '(message)\n', (6964, 6973), False, 'from pip._internal.utils.ui import open_spinner\n'), ((6998, 7055), 'pip._internal.utils.misc.call_subprocess', 'call_subprocess', (['args'], {'show_stdout': '(False)', 'spinner': 'spinner'}), '(args, show_stdout=False, spinner=spinner)\n', (7013, 7055), False, 'from pip._internal.utils.misc import call_subprocess\n'), ((2612, 2660), 'os.path.join', 'os.path.join', (['self._site_dir', '"""sitecustomize.py"""'], {}), "(self._site_dir, 'sitecustomize.py')\n", (2624, 2660), False, 'import os\n'), ((4148, 4169), 'os.pathsep.join', 'os.pathsep.join', (['path'], {}), '(path)\n', (4163, 4169), False, 'import os\n'), ((4234, 4261), 'os.pathsep.join', 'os.pathsep.join', (['pythonpath'], {}), '(pythonpath)\n', (4249, 4261), False, 'import os\n'), ((4434, 4463), 'os.environ.pop', 'os.environ.pop', (['varname', 'None'], {}), '(varname, None)\n', (4448, 4463), False, 'import os\n'), ((2330, 2365), 'distutils.sysconfig.get_python_lib', 'get_python_lib', ([], {'plat_specific': '(False)'}), '(plat_specific=False)\n', (2344, 2365), False, 'from distutils.sysconfig import get_python_lib\n'), ((2383, 2417), 'distutils.sysconfig.get_python_lib', 'get_python_lib', ([], {'plat_specific': '(True)'}), '(plat_specific=True)\n', (2397, 2417), False, 'from distutils.sysconfig import get_python_lib\n'), ((1759, 1798), 'os.path.join', 'os.path.join', (['self._temp_dir.path', 'name'], {}), '(self._temp_dir.path, name)\n', (1771, 1798), False, 'import os\n'), ((2695, 3655), 'textwrap.dedent', 'textwrap.dedent', (['"""\n import os, site, sys\n\n # First, drop system-sites related paths.\n original_sys_path = sys.path[:]\n known_paths = set()\n for path in {system_sites!r}:\n site.addsitedir(path, known_paths=known_paths)\n system_paths = set(\n os.path.normcase(path)\n for path in sys.path[len(original_sys_path):]\n )\n original_sys_path = [\n path for path in original_sys_path\n if os.path.normcase(path) not in system_paths\n ]\n sys.path = original_sys_path\n\n # Second, add lib directories.\n # ensuring .pth file are processed.\n for path in {lib_dirs!r}:\n assert not path in sys.path\n site.addsitedir(path)\n """'], {}), '(\n """\n import os, site, sys\n\n # First, drop system-sites related paths.\n original_sys_path = sys.path[:]\n known_paths = set()\n for path in {system_sites!r}:\n site.addsitedir(path, known_paths=known_paths)\n system_paths = set(\n os.path.normcase(path)\n for path in sys.path[len(original_sys_path):]\n )\n original_sys_path = [\n path for path in original_sys_path\n if os.path.normcase(path) not in system_paths\n ]\n sys.path = original_sys_path\n\n # Second, add lib directories.\n # ensuring .pth file are processed.\n for path in {lib_dirs!r}:\n assert not path in sys.path\n site.addsitedir(path)\n """\n )\n', (2710, 3655), False, 'import textwrap\n'), ((5087, 5109), 'pip._vendor.pkg_resources.Requirement.parse', 'Requirement.parse', (['req'], {}), '(req)\n', (5104, 5109), False, 'from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet\n')]
|
#!/usr/bin/env python
# add-issue-id-hook version 1.1.0
#
# Created by <NAME>
# https://github.com/pbetkier/add-issue-id-hook
# customize the final commit message using placeholders:
# - {issue_id} replaced with discovered issue id
# - {user_message} replaced with message provided by the user
commit_message_format = '{issue_id} {user_message}'
# you may set this to your custom JIRA project key format
# or explicitly specify a single project name, e.g. 'EXAMPLE'
project_format = '[A-Z][A-Z]+'
# if not using JIRA, set this to your ticket system's issue pattern
issue_pattern = '{}-[\d]+'.format(project_format)
import subprocess
import sys
import re
def read_current_message():
with open(sys.argv[1], 'r') as f:
return f.read()
def write_message(message):
with open(sys.argv[1], 'w') as f:
f.write(message)
def contains_message(message):
return message and not message.isspace()
def remove_editor_help_message(message):
return message[:message.find("# Please enter the commit message for your changes.")].rstrip()
def read_branch_or_exit():
try:
current_ref = subprocess.check_output('git symbolic-ref HEAD', shell=True).decode()
return current_ref[len('refs/heads/'):]
except subprocess.CalledProcessError:
print("add-issue-id-hook: Adding issue id failed. Are you in detached HEAD state?")
sys.exit()
issue_id_match = re.search(issue_pattern, read_branch_or_exit())
if issue_id_match:
found_issue_id = issue_id_match.group()
user_message = remove_editor_help_message(read_current_message())
if contains_message(user_message) and found_issue_id not in user_message:
write_message(commit_message_format.format(issue_id=found_issue_id, user_message=user_message))
|
[
"subprocess.check_output",
"sys.exit"
] |
[((1383, 1393), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1391, 1393), False, 'import sys\n'), ((1123, 1183), 'subprocess.check_output', 'subprocess.check_output', (['"""git symbolic-ref HEAD"""'], {'shell': '(True)'}), "('git symbolic-ref HEAD', shell=True)\n", (1146, 1183), False, 'import subprocess\n')]
|
import jieba.analyse as jba
import re
class Text(object):
'''
## 初始化
- text_data: 文本
- words_libs: 词库文件路径列表
## 方法
- getText() 获取文本
- getWordsLibs() 获取词库文件路径列表
- getKeywords() 提取文本关键词
- getCategories() 提取文本分类
'''
def __init__(self, text_data, words_libs):
self.data = str(text_data)
self.wordsLibs = list(words_libs)
def getText(self):
return self.data or ''
def getWordsLibs(self):
return self.wordsLibs
def getKeywords(self, num=10):
'''
# 提取文本关键词
## 参数
- int num : 输出的关键词数
## 算法选择
判断文本长度,选则使用 TF-IDF 或 TextRank 算法:
- 短文本,使用 TextRank 算法
- 长文本,使用 TF-IDF 算法
## 输出
```
# jba.textrank(data, topK=num, withWeight=True)
[('关键词', 权重), ...]
# jba.textrank(data, topK=num)
['关键词', ...]
```
现采用第二种策略
'''
length = len(self.getText())
if length < 50: # 短文本,使用 TextRank 算法
res = jba.textrank(self.getText(), topK=num)
else: # 长文本,使用 TF-IDF 算法
res = jba.extract_tags(self.getText(), topK=num)
return res
def getCategories(self):
'''
遍历词库,寻找合适的分类
'''
libs = self.getWordsLibs()
keys = self.getKeywords()
res = []
for lib in libs:
with open(lib) as f:
for libWord in f:
for keyWord in keys:
if libWord.split() == keyWord.split():
category = re.findall('【(.*?)】', lib)[0]
if category not in res:
res.append(category)
return res
if __name__ == "__main__":
with open('test_text/b.txt') as f:
data = f.read()
wordslib = []
with open('words_lib/index.txt') as f:
for line in f:
wordslib.append('words_lib/' + line.split()[0])
t = Text(data, wordslib)
print('Keywords:', t.getKeywords())
print('Categories:', t.getCategories())
|
[
"re.findall"
] |
[((1632, 1658), 're.findall', 're.findall', (['"""【(.*?)】"""', 'lib'], {}), "('【(.*?)】', lib)\n", (1642, 1658), False, 'import re\n')]
|
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Mimic pyquick exercise -- optional extra exercise.
Google's Python Class
Read in the file specified on the command line.
Do a simple split() on whitespace to obtain all the words in the file.
Rather than read the file line by line, it's easier to read
it into one giant string and split it once.
Build a "mimic" dict that maps each word that appears in the file
to a list of all the words that immediately follow that word in the file.
The list of words can be in any order and should include
duplicates. So for example the key "and" might have the list
["then", "best", "then", "after", ...] listing
all the words which came after "and" in the text.
We'll say that the empty string is what comes before
the first word in the file.
With the mimic dict, it's fairly easy to emit random
text that mimics the original. Print a word, then look
up what words might come next and pick one at random as
the next work.
Use the empty string as the first word to prime things.
If we ever get stuck with a word that is not in the dict,
go back to the empty string to keep things moving.
Note: the standard python module 'random' includes a
random.choice(list) method which picks a random element
from a non-empty list.
For fun, feed your program to itself as input.
Could work on getting it to put in linebreaks around 70
columns, so the output looks better.
"""
import random
import sys
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
word_dict = dict()
with open(filename, 'r') as file:
read_data = file.read()
content = read_data.replace('\n', ' ')
word_list = content.split()
word_dict[''] = [word_list[0]]
idx = 0
fix_idx = 0
for word in word_list:
# print(word_list)
# if word in word_list[fix_idx:]:
# idx = word_list.index(word, fix_idx)
idx = word_list.index(word)
# print("====>>> PALAVRA {} ".format(word))
fix_idx = idx
if word in word_dict.keys():
continue
for next_word in word_list[fix_idx:]:
# print("next word {} e fix idx {}".format(next_word, fix_idx))
if next_word == word:
if fix_idx+1 < len(word_list):
if next_word not in word_dict:
# print("## NOVO add next word idx {} : {} ".format(fix_idx+1, word_list[fix_idx+1]))
word_dict[word] = [word_list[fix_idx+1]]
else:
# print("00 VELHO add next word idx {} : {} ".format(fix_idx+1, word_list[fix_idx+1]))
word_dict[word].append(word_list[fix_idx+1])
fix_idx += 1
idx += 1
# for k, v in word_dict.items():
# print(k, v)
return word_dict
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
random_text = list()
count = 200
while count > 0:
if word in mimic_dict:
word = random.choice(mimic_dict[word])
else:
word = random.choice(mimic_dict[''])
random_text.append(word)
random_text.append(' ')
count -= 1
print(''.join(random_text))
return
# Provided main(), calls mimic_dict() and mimic()
def main():
if len(sys.argv) != 2:
print('usage: ./mimic.py file-to-read')
sys.exit(1)
dict = mimic_dict(sys.argv[1])
print_mimic(dict, 'we')
if __name__ == '__main__':
main()
|
[
"random.choice",
"sys.exit"
] |
[((3720, 3731), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (3728, 3731), False, 'import sys\n'), ((3360, 3391), 'random.choice', 'random.choice', (['mimic_dict[word]'], {}), '(mimic_dict[word])\n', (3373, 3391), False, 'import random\n'), ((3425, 3454), 'random.choice', 'random.choice', (["mimic_dict['']"], {}), "(mimic_dict[''])\n", (3438, 3454), False, 'import random\n')]
|
r"""
Finite dimensional graded commutative algebras
AUTHORS:
- <NAME> (2021): initial version
"""
#*****************************************************************************
# Copyright (C) 2021 <NAME> <m.jung at vu.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from sage.combinat.free_module import CombinatorialFreeModule
from sage.categories.algebras import Algebras
from sage.misc.cachefunc import cached_method
from sage.combinat.integer_vector_weighted import WeightedIntegerVectors
from sage.rings.ring import Algebra
from sage.misc.functional import is_odd, is_even
from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets
from sage.sets.condition_set import ConditionSet
from sage.rings.integer_ring import ZZ
class FiniteGCAlgebra(CombinatorialFreeModule, Algebra):
r"""
Finite dimensional graded commutative algebras.
A finite dimensional graded commutative algebra `A` is an integer-graded
algebra satisfying the super-algebra relation w.r.t. the degree modulo 2.
More precisely, `A` has a graded ring structure
.. MATH::
A = \bigoplus_{i=0}^n A_i,
where `n \in \NN` is the finite maximal degree, and the multiplication
satisfies
.. MATH::
A_i \cdot A_j \subset \begin{cases}A_{i+j} & \text{if $i+j\leq n$}, \\
0 & \text{if $i+j > n$},\end{cases}
as well as the super-algebra relation
.. MATH::
x y = (-1)^{ij} y x
for all homogeneous elements `x \in A_i` and `y \in A_j`.
Such an algebra is multiplicatively generated by a set of single monomials
`\{ x_1, \ldots, x_k \}`, where each `x_i` is given a certain degree
`\mathrm{deg}(x_i)`. To that end, this algebra can be given a vector
space basis, and the basis vectors are of the form `x_1^{w_1} \cdots x_n^{
w_k}`, where `\sum_{i=1}^k \mathrm{deg}(x_i) \, w_i \leq n` and
.. MATH::
w_i \in \begin{cases} \ZZ_2 & \text{if $\mathrm{deg}(x_i)$ is odd}, \\
\NN & \text{if $\mathrm{deg}(x_i)$ is even}. \end{cases}
Typical examples of finite dimensional graded commutative algebras are
cohomology rings over finite dimensional CW-complexes.
INPUT:
- ``base`` -- the base field
- ``names`` -- (optional) names of the generators: a list of
strings or a single string with the names separated by
commas. If not specified, the generators are named "x0", "x1",...
- ``degrees`` -- (optional) a tuple or list specifying the degrees
of the generators; if omitted, each generator is given degree
1, and if both ``names`` and ``degrees`` are omitted, an error is
raised.
- ``max_degree`` -- the maximal degree of the graded algebra.
- ``mul_symbol`` -- (optional) symbol used for multiplication. If omitted,
the string "*" is used.
- ``mul_latex_symbol`` -- (optional) latex symbol used for multiplication.
If omitted, the empty string is used.
EXAMPLES::
sage: A.<x,y,z,t> = GradedCommutativeAlgebra(QQ, degrees=(1,2,2,3), max_degree=6)
sage: A
Graded commutative algebra with generators ('x', 'y', 'z', 't') in degrees (1, 2, 2, 3) with maximal degree 6
sage: t*x + x*t
0
sage: x^2
0
sage: x*t^2
0
sage: x*y^2+z*t
x*y^2 + z*t
The generators can be returned with :meth:`algebra_generators`::
sage: F = A.algebra_generators(); F
Family (x, y, z, t)
sage: [g.degree() for g in F]
[1, 2, 2, 3]
We can also return the basis::
sage: list(A.basis())
[1, x, z, y, t, x*z, x*y, x*t, z^2, y*z, y^2, z*t, y*t, x*z^2, x*y*z, x*y^2]
Depending on the context, the multiplication can be given a different
symbol::
sage: A.<x,y,z,t> = GradedCommutativeAlgebra(QQ, degrees=(1,2,6,6), max_degree=10, mul_symbol='⌣', mul_latex_symbol=r'\smile')
sage: x*y^2 + x*t
x⌣y^2 + x⌣t
sage: latex(x*y^2 - z*x)
x\smile y^{2} - x\smile z
.. NOTE::
Notice, when the argument ``max_degree`` in the global namespace is
omitted, an instance of the class
:class:`sage.algebras.commutative_dga.GCAlgebra` is created instead::
sage: A.<x,y,z,t> = GradedCommutativeAlgebra(QQ, degrees=(1,2,6,6))
sage: type(A)
<class 'sage.algebras.commutative_dga.GCAlgebra_with_category'>
"""
@staticmethod
def __classcall_private__(cls, base, names=None, degrees=None,
max_degree=None, category=None, **kwargs):
r"""
Normalize the input for the :meth:`__init__` method and the
unique representation.
INPUT:
- ``base`` -- the base ring of the algebra
- ``max_degree`` -- the maximal degree of the algebra
- ``names`` -- the names of the variables; by default, set to ``x1``,
``x2``, etc.
- ``degrees`` -- the degrees of the generators; by default, set to 1
TESTS::
sage: A1 = GradedCommutativeAlgebra(GF(2), 'x,y', (3, 6), max_degree=12)
sage: A2 = GradedCommutativeAlgebra(GF(2), ['x', 'y'], [3, 6], max_degree=12)
sage: A1 is A2
True
"""
if max_degree is None:
raise TypeError("max_degree must be specified")
if names is None:
if degrees is None:
raise ValueError("You must specify names or degrees")
else:
n = len(degrees)
names = tuple('x{}'.format(i) for i in range(n))
elif isinstance(names, str):
names = tuple(names.split(','))
n = len(names)
else:
n = len(names)
names = tuple(names)
if degrees is None:
degrees = tuple([1 for _ in range(n)])
else:
degrees = tuple(degrees)
return super().__classcall__(cls, base=base, names=names,
degrees=degrees, max_degree=max_degree,
category=category, **kwargs)
def __init__(self, base, names, degrees, max_degree,
category=None, **kwargs):
r"""
Construct a commutative graded algebra with finite degree.
TESTS::
sage: A.<x,y,z,t> = GradedCommutativeAlgebra(QQ, max_degree=6)
sage: TestSuite(A).run()
sage: A = GradedCommutativeAlgebra(QQ, ('x','y','z'), [2,3,4], max_degree=8)
sage: TestSuite(A).run()
sage: A = GradedCommutativeAlgebra(QQ, ('x','y','z','t'), [1,2,3,4], max_degree=10)
sage: TestSuite(A).run()
"""
from sage.arith.misc import gcd
if max_degree not in ZZ:
raise TypeError('max_degree must be an integer')
if max_degree < max(degrees):
raise ValueError(f'max_degree must not deceed {max(degrees)}')
self._names = names
self.__ngens = len(self._names)
self._degrees = degrees
self._max_deg = max_degree
self._weighted_vectors = WeightedIntegerVectors(degrees)
self._mul_symbol = kwargs.pop('mul_symbol', '*')
self._mul_latex_symbol = kwargs.pop('mul_latex_symbol', '')
step = gcd(degrees)
universe = DisjointUnionEnumeratedSets(self._weighted_vectors.subset(k)
for k in range(0, max_degree, step))
base_cat = Algebras(base).WithBasis().Super().Supercommutative().FiniteDimensional()
category = base_cat.or_subcategory(category, join=True)
indices = ConditionSet(universe, self._valid_index)
sorting_key = self._weighted_vectors.grading
CombinatorialFreeModule.__init__(self, base, indices,
sorting_key=sorting_key,
category=category)
def _valid_index(self, w):
r"""
Return whether ``w`` is a valid index; no multiple powers in odd
degrees.
TESTS::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,2,3), max_degree=8)
sage: w1 = A._weighted_vectors([1,2,1])
sage: w2 = A._weighted_vectors([1,2,2])
sage: A._valid_index(w1)
True
sage: A._valid_index(w2)
False
"""
return not any(i > 1 for i, d in zip(w, self._degrees) if is_odd(d))
def _repr_(self):
"""
Return the string representation of ``self``.
TESTS::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,2,3), max_degree=8)
sage: A._repr_()
"Graded commutative algebra with generators ('x', 'y', 'z') in degrees (1, 2, 3) with maximal degree 8"
sage: A # indirect doctest
Graded commutative algebra with generators ('x', 'y', 'z') in degrees (1, 2, 3) with maximal degree 8
"""
desc = f'Graded commutative algebra with generators {self._names} in '
desc += f'degrees {self._degrees} with maximal degree {self._max_deg}'
return desc
def ngens(self):
r"""
Return the number of generators of ``self``.
EXAMPLES::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(4,8,2), max_degree=10)
sage: A.ngens()
3
"""
return self.__ngens
@cached_method
def product_on_basis(self, w1, w2):
r"""
Return the product of two indices within the algebra.
EXAMPLES::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(4,8,2), max_degree=10)
sage: z*x
x*z
sage: x^3
0
sage: 5*z + 4*z*x
5*z + 4*x*z
::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,2,3), max_degree=5)
sage: 2*x*y
2*x*y
sage: x^2
0
sage: x*z
x*z
sage: z*x
-x*z
sage: x*y*z
0
TESTS::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(4,8,2), max_degree=10)
sage: weighted_vectors = A._weighted_vectors
sage: w1 = A._weighted_vectors([1,0,1])
sage: w2 = A._weighted_vectors([0,0,0])
sage: A.product_on_basis(w1, w2)
x*z
::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,2,3), max_degree=5)
sage: weighted_vectors = A._weighted_vectors
sage: w1 = A._weighted_vectors([1,0,0])
sage: w2 = A._weighted_vectors([0,0,1])
sage: A.product_on_basis(w1, w2)
x*z
sage: A.product_on_basis(w2, w1)
-x*z
::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,2,3), max_degree=10)
sage: weighted_vectors = A._weighted_vectors
sage: w1 = A._weighted_vectors([1,1,0])
sage: w2 = A._weighted_vectors([0,1,1])
sage: A.product_on_basis(w1, w2)
x*y^2*z
sage: A.product_on_basis(w2, w1)
-x*y^2*z
"""
grading = self._weighted_vectors.grading
deg_left = grading(w1)
deg_right = grading(w2)
deg_tot = deg_left + deg_right
if deg_tot > self._max_deg:
return self.zero()
w_tot = self._weighted_vectors([sum(w) for w in zip(w1, w2)])
if not self._valid_index(w_tot):
return self.zero()
# determine sign
n = self.__ngens
c = 0
for p, i, d in zip(reversed(range(n)), reversed(w1), reversed(self._degrees)):
if is_even(d) or i == 0:
continue
for q, j, b in zip(range(n), w2, self._degrees):
if q == p:
break
if j == 0 or is_even(b):
continue
c += 1
return (-1)**c * self.monomial(w_tot)
def degree_on_basis(self, i):
r"""
Return the degree of a homogeneous element with index `i`.
EXAMPLES::
sage: A.<a,b,c> = GradedCommutativeAlgebra(QQ, degrees=(2,4,6), max_degree=7)
sage: a.degree()
2
sage: (2*a*b).degree()
6
sage: (a+b).degree()
Traceback (most recent call last):
...
ValueError: element is not homogeneous
TESTS::
sage: A.<a,b,c> = GradedCommutativeAlgebra(QQ, degrees=(2,4,6), max_degree=7)
sage: weighted_vectors = A._weighted_vectors
sage: i = A._weighted_vectors([1,1,0])
sage: A.degree_on_basis(i)
6
"""
return self._weighted_vectors.grading(i)
def _repr_term(self, w):
r"""
Return the string representation of basis with index ``w``.
TESTS::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,2,3), max_degree=8)
sage: w = A._weighted_vectors([1,2,1])
sage: A._repr_term(w)
'x*y^2*z'
sage: x*y^2*z # indirect doctest
x*y^2*z
::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,2,3), max_degree=8, mul_symbol='⌣')
sage: w = A._weighted_vectors([1,2,1])
sage: A._repr_term(w)
'x⌣y^2⌣z'
sage: x*y^2*z # indirect doctest
x⌣y^2⌣z
"""
# Trivial case:
if sum(w) == 0:
return '1'
# Non-trivial case:
terms = []
for i in range(len(w)):
if w[i] == 0:
continue
elif w[i] == 1:
terms.append(self._names[i])
else:
terms.append(self._names[i] + f'^{w[i]}')
return self._mul_symbol.join(terms)
def _latex_term(self, w):
r"""
Return the LaTeX representation of basis with index ``w``.
TESTS::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,2,3), max_degree=8)
sage: w = A._weighted_vectors([1,2,1])
sage: A._latex_term(w)
'x y^{2} z'
sage: latex(x*y^2*z) # indirect doctest
x y^{2} z
::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,2,3), max_degree=8, mul_latex_symbol=r'\smile')
sage: A._latex_term(w)
'x\\smile y^{2}\\smile z'
sage: latex(x*y^2*z) # indirect doctest
x\smile y^{2}\smile z
"""
# Trivial case:
if sum(w) == 0:
return '1'
# Non-trivial case:
terms = []
for i in range(len(w)):
if w[i] == 0:
continue
elif w[i] == 1:
terms.append(self._names[i])
else:
terms.append(self._names[i] + '^{' + str(w[i]) + '}')
latex_mul = self._mul_latex_symbol + ' ' # add whitespace
return latex_mul.join(terms)
def algebra_generators(self):
r"""
Return the generators of ``self`` as a
:class:`sage.sets.family.TrivialFamily`.
EXAMPLES::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(4,8,2), max_degree=10)
sage: A.algebra_generators()
Family (x, y, z)
"""
from sage.sets.family import Family
return Family(self.gens())
@cached_method
def one_basis(self):
r"""
Return the index of the one element of ``self``.
EXAMPLES::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(4,8,2), max_degree=10)
sage: ind = A.one_basis(); ind
[0, 0, 0]
sage: A.monomial(ind)
1
sage: A.one() # indirect doctest
1
"""
n = len(self._degrees)
return self._weighted_vectors([0 for _ in range(n)])
def gens(self):
r"""
Return the generators of ``self`` as a list.
EXAMPLES::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(4,8,2), max_degree=10)
sage: A.gens()
[x, y, z]
"""
n = len(self._degrees)
zero = [0 for _ in range(n)]
indices = []
for k in range(n):
ind = list(zero)
ind[k] = 1
indices.append(self._weighted_vectors(ind))
return [self.monomial(ind) for ind in indices]
@cached_method
def gen(self, i):
r"""
Return the `i`-th generator of ``self``.
EXAMPLES::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(4,8,2), max_degree=10)
sage: A.gen(0)
x
sage: A.gen(1)
y
sage: A.gen(2)
z
"""
return self.gens()[i]
def maximal_degree(self):
r"""
Return the maximal degree of ``self``.
EXAMPLES::
sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,2,3), max_degree=8)
sage: A.maximal_degree()
8
"""
return self._max_deg
max_degree = maximal_degree
|
[
"sage.misc.functional.is_even",
"sage.arith.misc.gcd",
"sage.misc.functional.is_odd",
"sage.categories.algebras.Algebras",
"sage.sets.condition_set.ConditionSet",
"sage.combinat.integer_vector_weighted.WeightedIntegerVectors",
"sage.combinat.free_module.CombinatorialFreeModule.__init__"
] |
[((7473, 7504), 'sage.combinat.integer_vector_weighted.WeightedIntegerVectors', 'WeightedIntegerVectors', (['degrees'], {}), '(degrees)\n', (7495, 7504), False, 'from sage.combinat.integer_vector_weighted import WeightedIntegerVectors\n'), ((7645, 7657), 'sage.arith.misc.gcd', 'gcd', (['degrees'], {}), '(degrees)\n', (7648, 7657), False, 'from sage.arith.misc import gcd\n'), ((7997, 8038), 'sage.sets.condition_set.ConditionSet', 'ConditionSet', (['universe', 'self._valid_index'], {}), '(universe, self._valid_index)\n', (8009, 8038), False, 'from sage.sets.condition_set import ConditionSet\n'), ((8100, 8202), 'sage.combinat.free_module.CombinatorialFreeModule.__init__', 'CombinatorialFreeModule.__init__', (['self', 'base', 'indices'], {'sorting_key': 'sorting_key', 'category': 'category'}), '(self, base, indices, sorting_key=\n sorting_key, category=category)\n', (8132, 8202), False, 'from sage.combinat.free_module import CombinatorialFreeModule\n'), ((12120, 12130), 'sage.misc.functional.is_even', 'is_even', (['d'], {}), '(d)\n', (12127, 12130), False, 'from sage.misc.functional import is_odd, is_even\n'), ((12310, 12320), 'sage.misc.functional.is_even', 'is_even', (['b'], {}), '(b)\n', (12317, 12320), False, 'from sage.misc.functional import is_odd, is_even\n'), ((8815, 8824), 'sage.misc.functional.is_odd', 'is_odd', (['d'], {}), '(d)\n', (8821, 8824), False, 'from sage.misc.functional import is_odd, is_even\n'), ((7841, 7855), 'sage.categories.algebras.Algebras', 'Algebras', (['base'], {}), '(base)\n', (7849, 7855), False, 'from sage.categories.algebras import Algebras\n')]
|
from django.conf.urls.defaults import *
from livesettings import config_value, config_get_group
config = config_get_group('PAYMENT_CYBERSOURCE')
urlpatterns = patterns('',
(r'^$', 'payment.modules.cybersource.views.pay_ship_info', {'SSL':config.SSL.value}, 'CYBERSOURCE_satchmo_checkout-step2'),
(r'^confirm/$', 'payment.modules.cybersource.views.confirm_info', {'SSL':config.SSL.value}, 'CYBERSOURCE_satchmo_checkout-step3'),
(r'^success/$', 'payment.views.checkout.success', {'SSL':config.SSL.value}, 'CYBERSOURCE_satchmo_checkout-success'),
)
|
[
"livesettings.config_get_group"
] |
[((106, 145), 'livesettings.config_get_group', 'config_get_group', (['"""PAYMENT_CYBERSOURCE"""'], {}), "('PAYMENT_CYBERSOURCE')\n", (122, 145), False, 'from livesettings import config_value, config_get_group\n')]
|
"""COMMAND : .balaji"""
from telethon import events
import asyncio
@borg.on(events.NewMessage(pattern=r"\.(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
return
animation_interval = 5
animation_ttl = range(0, 15)
input_str = event.pattern_match.group(1)
if input_str == "balaji":
await event.edit(input_str)
animation_chars = [
"`Your bot is running\n\nTelethon version:` 1.9.0\n`Python:` 3.7.3\n`User:` @archernap\n`Database Status: Databases functioning normally!`",
"`Connecting To github.com...`",
"`Deleting Baalaji Repo....`",
"`Forking Uniborg... 0%\n\n⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️\n\nFile Size: 0 MiB / 108.7 MiB`",
"`Forking Uniborg... 4%\n\n⬛️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️\n\nFile Size: 22 MiB / 108.7 MiB`",
"`Forking Uniborg... 8%\n\n⬛️⬛️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️\n\nFile Size: 48 MiB / 108.7 MiB`",
"`Forking Uniborg... 20%\n\n⬛️⬛️⬛️⬛️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️\n\nFile Size: 55 MiB / 108.7 MiB`",
"`Forking Uniborg... 36%\n\n⬛️⬛️⬛️⬛️⬛️⬛️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️\n\nFile Size: 60 MiB / 108.7 MiB `",
"`Forking Uniborg... 52%\n\n⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬜️⬜️⬜️⬜️⬜️\n\nFile Size: 90.7 MiB / 108.7 MiB `",
"`Forking Uniborg... 84%\n\n⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬜️⬜️\n\nFile Size: 100.7 MiB / 108.7 MiB `",
"`Forking Uniborg... 100%\n\n⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️⬛️\n\nFile Size: 108.7 MiB / 108.7 MiB\n\nTask Completed... `",
"`Fork Deploying...`\n\n@UniBorg ( `Custom Built By` @Archer ) \n`Verified Account:` ☑️\n`Official Website:` N/A`Python` `Loading...`\n[GCC 7.4.0]\n`Telethon` `Loading...`\n\n`Custom Built Fork:` `Loading...`",
"`Fork Deployed...`\n\n@UniBorg ( `Custom Built By` @Archer ) \n`Verified Account:` ✅\n`Official Website:` N/A`Python` 3.7.4 (default, Sep 12 2019, 01:19:52)\n[GCC 7.4.0]\n`Telethon` 1.8.0\n\n`Custom Built Fork:` https://github.com/archertanu/ZenBot"
]
for i in animation_ttl:
await asyncio.sleep(animation_interval)
await event.edit(animation_chars[i % 15])
|
[
"telethon.events.NewMessage",
"asyncio.sleep"
] |
[((83, 134), 'telethon.events.NewMessage', 'events.NewMessage', ([], {'pattern': '"""\\\\.(.*)"""', 'outgoing': '(True)'}), "(pattern='\\\\.(.*)', outgoing=True)\n", (100, 134), False, 'from telethon import events\n'), ((2062, 2095), 'asyncio.sleep', 'asyncio.sleep', (['animation_interval'], {}), '(animation_interval)\n', (2075, 2095), False, 'import asyncio\n')]
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutronclient.common import exceptions as neutron_exceptions
from neutronclient.v2_0 import client as clientv20
from oslo_log import log
from oslo_utils import uuidutils
import retrying
from ironic.api.controllers.v1 import types
from ironic.common import context as ironic_context
from ironic.common import exception
from ironic.common.i18n import _
from ironic.common import keystone
from ironic.common.pxe_utils import DHCP_CLIENT_ID
from ironic.conf import CONF
from ironic import objects
LOG = log.getLogger(__name__)
# TODO(pas-ha) remove in Rocky, until then it is a default
# for CONF.neutron.url in noauth case when endpoint_override is not set
DEFAULT_NEUTRON_URL = 'http://%s:9696' % CONF.my_ip
_NEUTRON_SESSION = None
VNIC_BAREMETAL = 'baremetal'
VNIC_SMARTNIC = 'smart-nic'
PHYSNET_PARAM_NAME = 'provider:physical_network'
"""Name of the neutron network API physical network parameter."""
SEGMENTS_PARAM_NAME = 'segments'
"""Name of the neutron network API segments parameter."""
def _get_neutron_session():
global _NEUTRON_SESSION
if not _NEUTRON_SESSION:
_NEUTRON_SESSION = keystone.get_session(
'neutron',
# TODO(pas-ha) remove in Rocky
timeout=CONF.neutron.timeout or CONF.neutron.url_timeout)
return _NEUTRON_SESSION
# TODO(pas-ha) remove deprecated options handling in Rocky
# until then it might look ugly due to all if's.
def get_client(token=None, context=None):
if not context:
context = ironic_context.RequestContext(auth_token=token)
# NOTE(pas-ha) neutronclient supports passing both session
# and the auth to client separately, makes things easier
session = _get_neutron_session()
service_auth = keystone.get_auth('neutron')
# TODO(pas-ha) remove in Rocky, always simply load from config
# 'noauth' then would correspond to 'auth_type=none' and
# 'endpoint_override'
adapter_params = {}
if (CONF.neutron.auth_strategy == 'noauth'
and CONF.neutron.auth_type is None):
CONF.set_override('auth_type', 'none', group='neutron')
if not CONF.neutron.endpoint_override:
adapter_params['endpoint_override'] = (CONF.neutron.url
or DEFAULT_NEUTRON_URL)
else:
if CONF.neutron.url and not CONF.neutron.endpoint_override:
adapter_params['endpoint_override'] = CONF.neutron.url
adapter = keystone.get_adapter('neutron', session=session,
auth=service_auth, **adapter_params)
endpoint = adapter.get_endpoint()
user_auth = None
if CONF.neutron.auth_type != 'none' and context.auth_token:
user_auth = keystone.get_service_auth(context, endpoint, service_auth)
return clientv20.Client(session=session,
auth=user_auth or service_auth,
endpoint_override=endpoint,
retries=CONF.neutron.retries,
global_request_id=context.global_id)
def unbind_neutron_port(port_id, client=None, context=None):
"""Unbind a neutron port
Remove a neutron port's binding profile and host ID so that it returns to
an unbound state.
:param port_id: Neutron port ID.
:param client: Optional a Neutron client object.
:param context: request context
:type context: ironic.common.context.RequestContext
:raises: NetworkError
"""
if not client:
client = get_client(context=context)
body_unbind = {'port': {'binding:host_id': '',
'binding:profile': {}}}
body_reset_mac = {'port': {'mac_address': None}}
try:
client.update_port(port_id, body_unbind)
# NOTE(hjensas): We need to reset the mac address in a separate step.
# Exception PortBound will be raised by neutron as it refuses to
# update the mac address of a bound port if we attempt to unbind and
# reset the mac in the same call.
client.update_port(port_id, body_reset_mac)
# NOTE(vsaienko): Ignore if port was deleted before calling vif detach.
except neutron_exceptions.PortNotFoundClient:
LOG.info('Port %s was not found while unbinding.', port_id)
except neutron_exceptions.NeutronClientException as e:
msg = (_('Unable to clear binding profile for '
'neutron port %(port_id)s. Error: '
'%(err)s') % {'port_id': port_id, 'err': e})
LOG.exception(msg)
raise exception.NetworkError(msg)
def update_port_address(port_id, address, context=None):
"""Update a port's mac address.
:param port_id: Neutron port id.
:param address: new MAC address.
:param context: request context
:type context: ironic.common.context.RequestContext
:raises: FailedToUpdateMacOnPort
"""
client = get_client(context=context)
port_req_body = {'port': {'mac_address': address}}
try:
msg = (_("Failed to get the current binding on Neutron "
"port %s.") % port_id)
port = client.show_port(port_id).get('port', {})
binding_host_id = port.get('binding:host_id')
binding_profile = port.get('binding:profile')
if binding_host_id:
# Unbind port before we update it's mac address, because you can't
# change a bound port's mac address.
msg = (_("Failed to remove the current binding from "
"Neutron port %s, while updating its MAC "
"address.") % port_id)
unbind_neutron_port(port_id, client=client, context=context)
msg = (_("Failed to update MAC address on Neutron port %s.") % port_id)
client.update_port(port_id, port_req_body)
# Restore original binding:profile and host_id
if binding_host_id:
msg = (_("Failed to update binding:host_id and profile on Neutron "
"port %s.") % port_id)
port_req_body = {'port': {'binding:host_id': binding_host_id,
'binding:profile': binding_profile}}
client.update_port(port_id, port_req_body)
except (neutron_exceptions.NeutronClientException, exception.NetworkError):
LOG.exception(msg)
raise exception.FailedToUpdateMacOnPort(port_id=port_id)
def _verify_security_groups(security_groups, client):
"""Verify that the security groups exist.
:param security_groups: a list of security group UUIDs; may be None or
empty
:param client: Neutron client
:raises: NetworkError
"""
if not security_groups:
return
try:
neutron_sec_groups = (
client.list_security_groups().get('security_groups', []))
except neutron_exceptions.NeutronClientException as e:
msg = (_("Could not retrieve security groups from neutron: %(exc)s") %
{'exc': e})
LOG.exception(msg)
raise exception.NetworkError(msg)
existing_sec_groups = [sec_group['id'] for sec_group in neutron_sec_groups]
missing_sec_groups = set(security_groups) - set(existing_sec_groups)
if missing_sec_groups:
msg = (_('Could not find these security groups (specified via ironic '
'config) in neutron: %(ir-sg)s')
% {'ir-sg': list(missing_sec_groups)})
LOG.error(msg)
raise exception.NetworkError(msg)
def add_ports_to_network(task, network_uuid, security_groups=None):
"""Create neutron ports to boot the ramdisk.
Create neutron ports for each pxe_enabled port on task.node to boot
the ramdisk.
:param task: a TaskManager instance.
:param network_uuid: UUID of a neutron network where ports will be
created.
:param security_groups: List of Security Groups UUIDs to be used for
network.
:raises: NetworkError
:returns: a dictionary in the form {port.uuid: neutron_port['id']}
"""
client = get_client(context=task.context)
node = task.node
# If Security Groups are specified, verify that they exist
_verify_security_groups(security_groups, client)
LOG.debug('For node %(node)s, creating neutron ports on network '
'%(network_uuid)s using %(net_iface)s network interface.',
{'net_iface': task.driver.network.__class__.__name__,
'node': node.uuid, 'network_uuid': network_uuid})
body = {
'port': {
'network_id': network_uuid,
'admin_state_up': True,
'binding:vnic_type': VNIC_BAREMETAL,
'device_owner': 'baremetal:none',
'binding:host_id': node.uuid,
}
}
if security_groups:
body['port']['security_groups'] = security_groups
# Since instance_uuid will not be available during cleaning
# operations, we need to check that and populate them only when
# available
body['port']['device_id'] = node.instance_uuid or node.uuid
ports = {}
failures = []
portmap = get_node_portmap(task)
pxe_enabled_ports = [p for p in task.ports if p.pxe_enabled]
if not pxe_enabled_ports:
raise exception.NetworkError(_(
"No available PXE-enabled port on node %s.") % node.uuid)
for ironic_port in pxe_enabled_ports:
# Skip ports that are missing required information for deploy.
if not validate_port_info(node, ironic_port):
failures.append(ironic_port.uuid)
continue
body['port']['mac_address'] = ironic_port.address
binding_profile = {'local_link_information':
[portmap[ironic_port.uuid]]}
body['port']['binding:profile'] = binding_profile
is_smart_nic = is_smartnic_port(ironic_port)
if is_smart_nic:
link_info = binding_profile['local_link_information'][0]
LOG.debug('Setting hostname as host_id in case of Smart NIC, '
'port %(port_id)s, hostname %(hostname)s',
{'port_id': ironic_port.uuid,
'hostname': link_info['hostname']})
body['port']['binding:host_id'] = link_info['hostname']
# TODO(hamdyk): use portbindings.VNIC_SMARTNIC from neutron-lib
body['port']['binding:vnic_type'] = VNIC_SMARTNIC
client_id = ironic_port.extra.get('client-id')
if client_id:
client_id_opt = {'opt_name': DHCP_CLIENT_ID,
'opt_value': client_id}
extra_dhcp_opts = body['port'].get('extra_dhcp_opts', [])
extra_dhcp_opts.append(client_id_opt)
body['port']['extra_dhcp_opts'] = extra_dhcp_opts
try:
if is_smart_nic:
wait_for_host_agent(client, body['port']['binding:host_id'])
port = client.create_port(body)
if is_smart_nic:
wait_for_port_status(client, port['port']['id'], 'ACTIVE')
except neutron_exceptions.NeutronClientException as e:
failures.append(ironic_port.uuid)
LOG.warning("Could not create neutron port for node's "
"%(node)s port %(ir-port)s on the neutron "
"network %(net)s. %(exc)s",
{'net': network_uuid, 'node': node.uuid,
'ir-port': ironic_port.uuid, 'exc': e})
else:
ports[ironic_port.uuid] = port['port']['id']
if failures:
if len(failures) == len(pxe_enabled_ports):
rollback_ports(task, network_uuid)
raise exception.NetworkError(_(
"Failed to create neutron ports for any PXE enabled port "
"on node %s.") % node.uuid)
else:
LOG.warning("Some errors were encountered when updating "
"vif_port_id for node %(node)s on "
"the following ports: %(ports)s.",
{'node': node.uuid, 'ports': failures})
else:
LOG.info('For node %(node_uuid)s in network %(net)s, successfully '
'created ports (ironic ID: neutron ID): %(ports)s.',
{'node_uuid': node.uuid, 'net': network_uuid, 'ports': ports})
return ports
def remove_ports_from_network(task, network_uuid):
"""Deletes the neutron ports created for booting the ramdisk.
:param task: a TaskManager instance.
:param network_uuid: UUID of a neutron network ports will be deleted from.
:raises: NetworkError
"""
macs = [p.address for p in task.ports if p.pxe_enabled]
if macs:
params = {
'network_id': network_uuid,
'mac_address': macs,
}
LOG.debug("Removing ports on network %(net)s on node %(node)s.",
{'net': network_uuid, 'node': task.node.uuid})
remove_neutron_ports(task, params)
def remove_neutron_ports(task, params):
"""Deletes the neutron ports matched by params.
:param task: a TaskManager instance.
:param params: Dict of params to filter ports.
:raises: NetworkError
"""
client = get_client(context=task.context)
node_uuid = task.node.uuid
try:
response = client.list_ports(**params)
except neutron_exceptions.NeutronClientException as e:
msg = (_('Could not get given network VIF for %(node)s '
'from neutron, possible network issue. %(exc)s') %
{'node': node_uuid, 'exc': e})
LOG.exception(msg)
raise exception.NetworkError(msg)
ports = response.get('ports', [])
if not ports:
LOG.debug('No ports to remove for node %s', node_uuid)
return
for port in ports:
LOG.debug('Deleting neutron port %(vif_port_id)s of node '
'%(node_id)s.',
{'vif_port_id': port['id'], 'node_id': node_uuid})
if is_smartnic_port(port):
wait_for_host_agent(client, port['binding:host_id'])
try:
client.delete_port(port['id'])
# NOTE(mgoddard): Ignore if the port was deleted by nova.
except neutron_exceptions.PortNotFoundClient:
LOG.info('Port %s was not found while deleting.', port['id'])
except neutron_exceptions.NeutronClientException as e:
msg = (_('Could not remove VIF %(vif)s of node %(node)s, possibly '
'a network issue: %(exc)s') %
{'vif': port['id'], 'node': node_uuid, 'exc': e})
LOG.exception(msg)
raise exception.NetworkError(msg)
LOG.info('Successfully removed node %(node_uuid)s neutron ports.',
{'node_uuid': node_uuid})
def get_node_portmap(task):
"""Extract the switch port information for the node.
The information is returned in the form of::
{
port.uuid: {
'switch_id': 'abc',
'port_id': 'Po0/1',
'other_llc_key': 'val'
}
}
:param task: a task containing the Node object.
:returns: port information as a dict
"""
portmap = {}
for port in task.ports:
portmap[port.uuid] = port.local_link_connection
return portmap
# TODO(jroll) raise InvalidParameterValue if a port doesn't have the
# necessary info? (probably)
def get_local_group_information(task, portgroup):
"""Extract the portgroup information.
The information is returned in the form of::
{
'id': portgroup.uuid,
'name': portgroup.name,
'bond_mode': portgroup.mode,
'bond_properties': {
'bond_propertyA': 'valueA',
'bond_propertyB': 'valueB',
}
}
:param task: a task containing the Node object.
:param portgroup: Ironic portgroup object to extract data for.
:returns: port group information as a dict
"""
portgroup_properties = {}
for prop, value in portgroup.properties.items():
# These properties are the bonding driver options described
# at https://www.kernel.org/doc/Documentation/networking/bonding.txt .
# cloud-init checks the same way, parameter name has to start with
# 'bond'. Keep this structure when passing properties to neutron ML2
# drivers.
key = prop if prop.startswith('bond') else 'bond_%s' % prop
portgroup_properties[key] = value
return {
'id': portgroup.uuid,
'name': portgroup.name,
'bond_mode': portgroup.mode,
'bond_properties': portgroup_properties
}
def rollback_ports(task, network_uuid):
"""Attempts to delete any ports created by cleaning/provisioning
Purposefully will not raise any exceptions so error handling can
continue.
:param task: a TaskManager instance.
:param network_uuid: UUID of a neutron network.
"""
try:
remove_ports_from_network(task, network_uuid)
except exception.NetworkError:
# Only log the error
LOG.exception('Failed to rollback port changes for '
'node %(node)s on network %(network)s',
{'node': task.node.uuid, 'network': network_uuid})
def validate_network(uuid_or_name, net_type=_('network'), context=None):
"""Check that the given network is present.
:param uuid_or_name: network UUID or name
:param net_type: human-readable network type for error messages
:param context: request context
:type context: ironic.common.context.RequestContext
:return: network UUID
:raises: MissingParameterValue if uuid_or_name is empty
:raises: NetworkError on failure to contact Neutron
:raises: InvalidParameterValue for missing or duplicated network
"""
if not uuid_or_name:
raise exception.MissingParameterValue(
_('UUID or name of %s is not set in configuration') % net_type)
client = get_client(context=context)
network = _get_network_by_uuid_or_name(client, uuid_or_name,
net_type=net_type, fields=['id'])
return network['id']
def validate_port_info(node, port):
"""Check that port contains enough information for deploy.
Neutron network interface requires that local_link_information field is
filled before we can use this port.
:param node: Ironic node object.
:param port: Ironic port object.
:returns: True if port info is valid, False otherwise.
"""
# Note(moshele): client-id in the port extra field indicates an InfiniBand
# port. In this case we don't require local_link_connection to be
# populated because the network topology is discoverable by the Infiniband
# Subnet Manager.
if port.extra.get('client-id'):
return True
if (node.network_interface == 'neutron'
and not port.local_link_connection):
LOG.warning("The local_link_connection is required for "
"'neutron' network interface and is not present "
"in the nodes %(node)s port %(port)s",
{'node': node.uuid, 'port': port.uuid})
return False
if (port.is_smartnic and not types.locallinkconnectiontype
.validate_for_smart_nic(port.local_link_connection)):
LOG.error("Smart NIC port must have port_id and hostname in "
"local_link_connection, port: %s", port['id'])
return False
if (not port.is_smartnic and types.locallinkconnectiontype
.validate_for_smart_nic(port.local_link_connection)):
LOG.error("Only Smart NIC ports can have port_id and hostname "
"in local_link_connection, port: %s", port['id'])
return False
return True
def _validate_agent(client, **kwargs):
"""Check that the given neutron agent is alive
:param client: Neutron client
:param kwargs: Additional parameters to pass to the neutron client
list_agents method.
:returns: A boolean to describe the agent status, if more than one agent
returns by the client then return True if at least one of them is
alive.
:raises: NetworkError in case of failure contacting Neutron.
"""
try:
agents = client.list_agents(**kwargs)['agents']
for agent in agents:
if agent['alive']:
return True
return False
except neutron_exceptions.NeutronClientException:
raise exception.NetworkError('Failed to contact Neutron server')
def is_smartnic_port(port_data):
"""Check that the port is Smart NIC port
:param port_data: an instance of ironic.objects.port.Port
or port data as dict.
:returns: A boolean to indicate port as Smart NIC port.
"""
if isinstance(port_data, objects.Port):
return port_data.supports_is_smartnic() and port_data.is_smartnic
if isinstance(port_data, dict):
return port_data.get('is_smartnic', False)
LOG.warning('Unknown port data type: %(type)s', {'type': type(port_data)})
return False
def _get_network_by_uuid_or_name(client, uuid_or_name, net_type=_('network'),
**params):
"""Return a neutron network by UUID or name.
:param client: A Neutron client object.
:param uuid_or_name: network UUID or name
:param net_type: human-readable network type for error messages
:param params: Additional parameters to pass to the neutron client
list_networks method.
:returns: A dict describing the neutron network.
:raises: NetworkError on failure to contact Neutron
:raises: InvalidParameterValue for missing or duplicated network
"""
if uuidutils.is_uuid_like(uuid_or_name):
params['id'] = uuid_or_name
else:
params['name'] = uuid_or_name
try:
networks = client.list_networks(**params)
except neutron_exceptions.NeutronClientException as exc:
raise exception.NetworkError(_('Could not retrieve network list: %s') %
exc)
LOG.debug('Got list of networks matching %(cond)s: %(result)s',
{'cond': params, 'result': networks})
networks = networks.get('networks', [])
if not networks:
raise exception.InvalidParameterValue(
_('%(type)s with name or UUID %(uuid_or_name)s was not found') %
{'type': net_type, 'uuid_or_name': uuid_or_name})
elif len(networks) > 1:
network_ids = [n['id'] for n in networks]
raise exception.InvalidParameterValue(
_('More than one %(type)s was found for name %(name)s: %(nets)s') %
{'name': uuid_or_name, 'nets': ', '.join(network_ids),
'type': net_type})
return networks[0]
def _get_port_by_uuid(client, port_uuid, **params):
"""Return a neutron port by UUID.
:param client: A Neutron client object.
:param port_uuid: UUID of a Neutron port to query.
:param params: Additional parameters to pass to the neutron client
show_port method.
:returns: A dict describing the neutron port.
:raises: InvalidParameterValue if the port does not exist.
:raises: NetworkError on failure to contact Neutron.
"""
try:
port = client.show_port(port_uuid, **params)
except neutron_exceptions.PortNotFoundClient:
raise exception.InvalidParameterValue(
_('Neutron port %(port_uuid)s was not found') %
{'port_uuid': port_uuid})
except neutron_exceptions.NeutronClientException as exc:
raise exception.NetworkError(_('Could not retrieve neutron port: %s') %
exc)
return port['port']
def get_physnets_by_port_uuid(client, port_uuid):
"""Return the set of physical networks associated with a neutron port.
Query the network to which the port is attached and return the set of
physical networks associated with the segments in that network.
:param client: A Neutron client object.
:param port_uuid: UUID of a Neutron port to query.
:returns: A set of physical networks.
:raises: NetworkError if the network query fails.
:raises: InvalidParameterValue for missing network.
"""
port = _get_port_by_uuid(client, port_uuid, fields=['network_id'])
network_uuid = port['network_id']
fields = [PHYSNET_PARAM_NAME, SEGMENTS_PARAM_NAME]
network = _get_network_by_uuid_or_name(client, network_uuid, fields=fields)
if SEGMENTS_PARAM_NAME in network:
# A network with multiple segments will have a 'segments' parameter
# which will contain a list of segments. Each segment should have a
# 'provider:physical_network' parameter which contains the physical
# network of the segment.
segments = network[SEGMENTS_PARAM_NAME]
else:
# A network with a single segment will have a
# 'provider:physical_network' parameter which contains the network's
# physical network.
segments = [network]
return set(segment[PHYSNET_PARAM_NAME]
for segment in segments
if segment[PHYSNET_PARAM_NAME])
@retrying.retry(
stop_max_attempt_number=CONF.agent.neutron_agent_max_attempts,
retry_on_exception=lambda e: isinstance(e, exception.NetworkError),
wait_fixed=CONF.agent.neutron_agent_wait_time_seconds * 1000
)
def wait_for_host_agent(client, host_id, target_state='up'):
"""Wait for neutron agent to become target state
:param client: A Neutron client object.
:param host_id: Agent host_id
:param target_state: up: wait for up status,
down: wait for down status
:returns: boolean indicates the agent state matches
param value target_state_up.
:raises: exception.NetworkError if host status didn't match the required
status after max retry attempts.
"""
if target_state not in ['up', 'down']:
raise exception.Invalid(
'Invalid requested agent state to validate, accepted values: '
'up, down. Requested state: %(target_state)s' % {
'target_state': target_state})
LOG.debug('Validating host %(host_id)s agent is %(status)s',
{'host_id': host_id,
'status': target_state})
is_alive = _validate_agent(client, host=host_id)
LOG.debug('Agent on host %(host_id)s is %(status)s',
{'host_id': host_id,
'status': 'up' if is_alive else 'down'})
if ((target_state == 'up' and is_alive) or
(target_state == 'down' and not is_alive)):
return True
raise exception.NetworkError(
'Agent on host %(host)s failed to reach state %(state)s' % {
'host': host_id, 'state': target_state})
@retrying.retry(
stop_max_attempt_number=CONF.agent.neutron_agent_max_attempts,
retry_on_exception=lambda e: isinstance(e, exception.NetworkError),
wait_fixed=CONF.agent.neutron_agent_wait_time_seconds * 1000
)
def wait_for_port_status(client, port_id, status):
"""Wait for port status to be the desired status
:param client: A Neutron client object.
:param port_id: Neutron port_id
:param status: Port's target status, can be ACTIVE, DOWN ... etc.
:returns: boolean indicates that the port status matches the
required value passed by param status.
:raises: exception.NetworkError if port status didn't match
the required status after max retry attempts.
"""
LOG.debug('Validating Port %(port_id)s status is %(status)s',
{'port_id': port_id, 'status': status})
port_info = _get_port_by_uuid(client, port_id)
LOG.debug('Port %(port_id)s status is: %(status)s',
{'port_id': port_id, 'status': port_info['status']})
if port_info['status'] == status:
return True
raise exception.NetworkError(
'Port %(port_id)s failed to reach status %(status)s' % {
'port_id': port_id, 'status': status})
class NeutronNetworkInterfaceMixin(object):
def get_cleaning_network_uuid(self, task):
cleaning_network = (
task.node.driver_info.get('cleaning_network')
or CONF.neutron.cleaning_network
)
return validate_network(
cleaning_network, _('cleaning network'),
context=task.context)
def get_provisioning_network_uuid(self, task):
provisioning_network = (
task.node.driver_info.get('provisioning_network')
or CONF.neutron.provisioning_network
)
return validate_network(
provisioning_network, _('provisioning network'),
context=task.context)
# TODO(stendulker): FlatNetwork should not use this method.
# FlatNetwork uses tenant network for rescue operation.
def get_rescuing_network_uuid(self, task):
rescuing_network = (
task.node.driver_info.get('rescuing_network')
or CONF.neutron.rescuing_network
)
return validate_network(
rescuing_network, _('rescuing network'),
context=task.context)
|
[
"ironic.common.exception.Invalid",
"oslo_log.log.getLogger",
"ironic.conf.CONF.set_override",
"ironic.common.exception.FailedToUpdateMacOnPort",
"ironic.common.i18n._",
"neutronclient.v2_0.client.Client",
"ironic.common.context.RequestContext",
"oslo_utils.uuidutils.is_uuid_like",
"ironic.common.keystone.get_auth",
"ironic.api.controllers.v1.types.locallinkconnectiontype.validate_for_smart_nic",
"ironic.common.keystone.get_service_auth",
"ironic.common.exception.NetworkError",
"ironic.common.keystone.get_adapter",
"ironic.common.keystone.get_session"
] |
[((1052, 1075), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (1065, 1075), False, 'from oslo_log import log\n'), ((2269, 2297), 'ironic.common.keystone.get_auth', 'keystone.get_auth', (['"""neutron"""'], {}), "('neutron')\n", (2286, 2297), False, 'from ironic.common import keystone\n'), ((2986, 3076), 'ironic.common.keystone.get_adapter', 'keystone.get_adapter', (['"""neutron"""'], {'session': 'session', 'auth': 'service_auth'}), "('neutron', session=session, auth=service_auth, **\n adapter_params)\n", (3006, 3076), False, 'from ironic.common import keystone\n'), ((3321, 3489), 'neutronclient.v2_0.client.Client', 'clientv20.Client', ([], {'session': 'session', 'auth': '(user_auth or service_auth)', 'endpoint_override': 'endpoint', 'retries': 'CONF.neutron.retries', 'global_request_id': 'context.global_id'}), '(session=session, auth=user_auth or service_auth,\n endpoint_override=endpoint, retries=CONF.neutron.retries,\n global_request_id=context.global_id)\n', (3337, 3489), True, 'from neutronclient.v2_0 import client as clientv20\n'), ((17807, 17819), 'ironic.common.i18n._', '_', (['"""network"""'], {}), "('network')\n", (17808, 17819), False, 'from ironic.common.i18n import _\n'), ((21678, 21690), 'ironic.common.i18n._', '_', (['"""network"""'], {}), "('network')\n", (21679, 21690), False, 'from ironic.common.i18n import _\n'), ((22238, 22274), 'oslo_utils.uuidutils.is_uuid_like', 'uuidutils.is_uuid_like', (['uuid_or_name'], {}), '(uuid_or_name)\n', (22260, 22274), False, 'from oslo_utils import uuidutils\n'), ((27142, 27274), 'ironic.common.exception.NetworkError', 'exception.NetworkError', (["('Agent on host %(host)s failed to reach state %(state)s' % {'host':\n host_id, 'state': target_state})"], {}), "(\n 'Agent on host %(host)s failed to reach state %(state)s' % {'host':\n host_id, 'state': target_state})\n", (27164, 27274), False, 'from ironic.common import exception\n'), ((28368, 28489), 'ironic.common.exception.NetworkError', 'exception.NetworkError', (["('Port %(port_id)s failed to reach status %(status)s' % {'port_id': port_id,\n 'status': status})"], {}), "('Port %(port_id)s failed to reach status %(status)s' %\n {'port_id': port_id, 'status': status})\n", (28390, 28489), False, 'from ironic.common import exception\n'), ((1665, 1759), 'ironic.common.keystone.get_session', 'keystone.get_session', (['"""neutron"""'], {'timeout': '(CONF.neutron.timeout or CONF.neutron.url_timeout)'}), "('neutron', timeout=CONF.neutron.timeout or CONF.\n neutron.url_timeout)\n", (1685, 1759), False, 'from ironic.common import keystone\n'), ((2041, 2088), 'ironic.common.context.RequestContext', 'ironic_context.RequestContext', ([], {'auth_token': 'token'}), '(auth_token=token)\n', (2070, 2088), True, 'from ironic.common import context as ironic_context\n'), ((2581, 2636), 'ironic.conf.CONF.set_override', 'CONF.set_override', (['"""auth_type"""', '"""none"""'], {'group': '"""neutron"""'}), "('auth_type', 'none', group='neutron')\n", (2598, 2636), False, 'from ironic.conf import CONF\n'), ((3251, 3309), 'ironic.common.keystone.get_service_auth', 'keystone.get_service_auth', (['context', 'endpoint', 'service_auth'], {}), '(context, endpoint, service_auth)\n', (3276, 3309), False, 'from ironic.common import keystone\n'), ((7959, 7986), 'ironic.common.exception.NetworkError', 'exception.NetworkError', (['msg'], {}), '(msg)\n', (7981, 7986), False, 'from ironic.common import exception\n'), ((20020, 20105), 'ironic.api.controllers.v1.types.locallinkconnectiontype.validate_for_smart_nic', 'types.locallinkconnectiontype.validate_for_smart_nic', (['port.local_link_connection'], {}), '(port.local_link_connection\n )\n', (20072, 20105), False, 'from ironic.api.controllers.v1 import types\n'), ((26464, 26631), 'ironic.common.exception.Invalid', 'exception.Invalid', (["('Invalid requested agent state to validate, accepted values: up, down. Requested state: %(target_state)s'\n % {'target_state': target_state})"], {}), "(\n 'Invalid requested agent state to validate, accepted values: up, down. Requested state: %(target_state)s'\n % {'target_state': target_state})\n", (26481, 26631), False, 'from ironic.common import exception\n'), ((5078, 5105), 'ironic.common.exception.NetworkError', 'exception.NetworkError', (['msg'], {}), '(msg)\n', (5100, 5105), False, 'from ironic.common import exception\n'), ((5534, 5592), 'ironic.common.i18n._', '_', (['"""Failed to get the current binding on Neutron port %s."""'], {}), "('Failed to get the current binding on Neutron port %s.')\n", (5535, 5592), False, 'from ironic.common.i18n import _\n'), ((6209, 6262), 'ironic.common.i18n._', '_', (['"""Failed to update MAC address on Neutron port %s."""'], {}), "('Failed to update MAC address on Neutron port %s.')\n", (6210, 6262), False, 'from ironic.common.i18n import _\n'), ((6859, 6909), 'ironic.common.exception.FailedToUpdateMacOnPort', 'exception.FailedToUpdateMacOnPort', ([], {'port_id': 'port_id'}), '(port_id=port_id)\n', (6892, 6909), False, 'from ironic.common import exception\n'), ((7530, 7557), 'ironic.common.exception.NetworkError', 'exception.NetworkError', (['msg'], {}), '(msg)\n', (7552, 7557), False, 'from ironic.common import exception\n'), ((7754, 7852), 'ironic.common.i18n._', '_', (['"""Could not find these security groups (specified via ironic config) in neutron: %(ir-sg)s"""'], {}), "('Could not find these security groups (specified via ironic config) in neutron: %(ir-sg)s'\n )\n", (7755, 7852), False, 'from ironic.common.i18n import _\n'), ((14080, 14107), 'ironic.common.exception.NetworkError', 'exception.NetworkError', (['msg'], {}), '(msg)\n', (14102, 14107), False, 'from ironic.common import exception\n'), ((19735, 19820), 'ironic.api.controllers.v1.types.locallinkconnectiontype.validate_for_smart_nic', 'types.locallinkconnectiontype.validate_for_smart_nic', (['port.local_link_connection'], {}), '(port.local_link_connection\n )\n', (19787, 19820), False, 'from ironic.api.controllers.v1 import types\n'), ((21009, 21067), 'ironic.common.exception.NetworkError', 'exception.NetworkError', (['"""Failed to contact Neutron server"""'], {}), "('Failed to contact Neutron server')\n", (21031, 21067), False, 'from ironic.common import exception\n'), ((28807, 28828), 'ironic.common.i18n._', '_', (['"""cleaning network"""'], {}), "('cleaning network')\n", (28808, 28828), False, 'from ironic.common.i18n import _\n'), ((29137, 29162), 'ironic.common.i18n._', '_', (['"""provisioning network"""'], {}), "('provisioning network')\n", (29138, 29162), False, 'from ironic.common.i18n import _\n'), ((29575, 29596), 'ironic.common.i18n._', '_', (['"""rescuing network"""'], {}), "('rescuing network')\n", (29576, 29596), False, 'from ironic.common.i18n import _\n'), ((4881, 4967), 'ironic.common.i18n._', '_', (['"""Unable to clear binding profile for neutron port %(port_id)s. Error: %(err)s"""'], {}), "('Unable to clear binding profile for neutron port %(port_id)s. Error: %(err)s'\n )\n", (4882, 4967), False, 'from ironic.common.i18n import _\n'), ((5965, 6065), 'ironic.common.i18n._', '_', (['"""Failed to remove the current binding from Neutron port %s, while updating its MAC address."""'], {}), "('Failed to remove the current binding from Neutron port %s, while updating its MAC address.'\n )\n", (5966, 6065), False, 'from ironic.common.i18n import _\n'), ((6428, 6497), 'ironic.common.i18n._', '_', (['"""Failed to update binding:host_id and profile on Neutron port %s."""'], {}), "('Failed to update binding:host_id and profile on Neutron port %s.')\n", (6429, 6497), False, 'from ironic.common.i18n import _\n'), ((7398, 7459), 'ironic.common.i18n._', '_', (['"""Could not retrieve security groups from neutron: %(exc)s"""'], {}), "('Could not retrieve security groups from neutron: %(exc)s')\n", (7399, 7459), False, 'from ironic.common.i18n import _\n'), ((9741, 9787), 'ironic.common.i18n._', '_', (['"""No available PXE-enabled port on node %s."""'], {}), "('No available PXE-enabled port on node %s.')\n", (9742, 9787), False, 'from ironic.common.i18n import _\n'), ((13875, 13975), 'ironic.common.i18n._', '_', (['"""Could not get given network VIF for %(node)s from neutron, possible network issue. %(exc)s"""'], {}), "('Could not get given network VIF for %(node)s from neutron, possible network issue. %(exc)s'\n )\n", (13876, 13975), False, 'from ironic.common.i18n import _\n'), ((15100, 15127), 'ironic.common.exception.NetworkError', 'exception.NetworkError', (['msg'], {}), '(msg)\n', (15122, 15127), False, 'from ironic.common import exception\n'), ((18394, 18445), 'ironic.common.i18n._', '_', (['"""UUID or name of %s is not set in configuration"""'], {}), "('UUID or name of %s is not set in configuration')\n", (18395, 18445), False, 'from ironic.common.i18n import _\n'), ((22848, 22910), 'ironic.common.i18n._', '_', (['"""%(type)s with name or UUID %(uuid_or_name)s was not found"""'], {}), "('%(type)s with name or UUID %(uuid_or_name)s was not found')\n", (22849, 22910), False, 'from ironic.common.i18n import _\n'), ((12172, 12244), 'ironic.common.i18n._', '_', (['"""Failed to create neutron ports for any PXE enabled port on node %s."""'], {}), "('Failed to create neutron ports for any PXE enabled port on node %s.')\n", (12173, 12244), False, 'from ironic.common.i18n import _\n'), ((14870, 14960), 'ironic.common.i18n._', '_', (['"""Could not remove VIF %(vif)s of node %(node)s, possibly a network issue: %(exc)s"""'], {}), "('Could not remove VIF %(vif)s of node %(node)s, possibly a network issue: %(exc)s'\n )\n", (14871, 14960), False, 'from ironic.common.i18n import _\n'), ((22518, 22558), 'ironic.common.i18n._', '_', (['"""Could not retrieve network list: %s"""'], {}), "('Could not retrieve network list: %s')\n", (22519, 22558), False, 'from ironic.common.i18n import _\n'), ((23112, 23177), 'ironic.common.i18n._', '_', (['"""More than one %(type)s was found for name %(name)s: %(nets)s"""'], {}), "('More than one %(type)s was found for name %(name)s: %(nets)s')\n", (23113, 23177), False, 'from ironic.common.i18n import _\n'), ((23940, 23985), 'ironic.common.i18n._', '_', (['"""Neutron port %(port_uuid)s was not found"""'], {}), "('Neutron port %(port_uuid)s was not found')\n", (23941, 23985), False, 'from ironic.common.i18n import _\n'), ((24124, 24164), 'ironic.common.i18n._', '_', (['"""Could not retrieve neutron port: %s"""'], {}), "('Could not retrieve neutron port: %s')\n", (24125, 24164), False, 'from ironic.common.i18n import _\n')]
|
import nltk
nltk.download('punkt')
tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
def get_sentence_list_from_corpus(text_path):
output_list = []
with open(text_path, 'r') as f:
f_as_string = f.read().replace("\n", " ")
output_list = tokenizer.tokenize(f_as_string)
return output_list
def get_sentence_list_from_string(input_string):
return tokenizer.tokenize(input_string)
if __name__ == "__main__":
path = "/Users/andreynovichkov/Desktop/Make-School/Term-2/CS1_2/10.21/CS-1.2-Intro-Data-Structures/Tweet_generator/static/text/treasure_island.txt"
listt = get_sentence_list_from_corpus(path)
print(listt)
|
[
"nltk.download",
"nltk.data.load"
] |
[((12, 34), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (25, 34), False, 'import nltk\n'), ((47, 96), 'nltk.data.load', 'nltk.data.load', (['"""tokenizers/punkt/english.pickle"""'], {}), "('tokenizers/punkt/english.pickle')\n", (61, 96), False, 'import nltk\n')]
|
"""
Support to trigger Maker IFTTT recipes.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/ifttt/
"""
import logging
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['pyfttt==0.3']
_LOGGER = logging.getLogger(__name__)
ATTR_EVENT = 'event'
ATTR_VALUE1 = 'value1'
ATTR_VALUE2 = 'value2'
ATTR_VALUE3 = 'value3'
CONF_KEY = 'key'
DOMAIN = 'ifttt'
SERVICE_TRIGGER = 'trigger'
SERVICE_TRIGGER_SCHEMA = vol.Schema({
vol.Required(ATTR_EVENT): cv.string,
vol.Optional(ATTR_VALUE1): cv.string,
vol.Optional(ATTR_VALUE2): cv.string,
vol.Optional(ATTR_VALUE3): cv.string,
})
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
vol.Required(CONF_KEY): cv.string,
}),
}, extra=vol.ALLOW_EXTRA)
def trigger(hass, event, value1=None, value2=None, value3=None):
"""Trigger a Maker IFTTT recipe."""
data = {
ATTR_EVENT: event,
ATTR_VALUE1: value1,
ATTR_VALUE2: value2,
ATTR_VALUE3: value3,
}
hass.services.call(DOMAIN, SERVICE_TRIGGER, data)
def setup(hass, config):
"""Set up the IFTTT service component."""
key = config[DOMAIN][CONF_KEY]
def trigger_service(call):
"""Handle IFTTT trigger service calls."""
event = call.data[ATTR_EVENT]
value1 = call.data.get(ATTR_VALUE1)
value2 = call.data.get(ATTR_VALUE2)
value3 = call.data.get(ATTR_VALUE3)
try:
import pyfttt as pyfttt
pyfttt.send_event(key, event, value1, value2, value3)
except requests.exceptions.RequestException:
_LOGGER.exception("Error communicating with IFTTT")
hass.services.register(DOMAIN, SERVICE_TRIGGER, trigger_service,
schema=SERVICE_TRIGGER_SCHEMA)
return True
|
[
"pyfttt.send_event",
"voluptuous.Required",
"voluptuous.Optional",
"logging.getLogger"
] |
[((323, 350), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (340, 350), False, 'import logging\n'), ((550, 574), 'voluptuous.Required', 'vol.Required', (['ATTR_EVENT'], {}), '(ATTR_EVENT)\n', (562, 574), True, 'import voluptuous as vol\n'), ((591, 616), 'voluptuous.Optional', 'vol.Optional', (['ATTR_VALUE1'], {}), '(ATTR_VALUE1)\n', (603, 616), True, 'import voluptuous as vol\n'), ((633, 658), 'voluptuous.Optional', 'vol.Optional', (['ATTR_VALUE2'], {}), '(ATTR_VALUE2)\n', (645, 658), True, 'import voluptuous as vol\n'), ((675, 700), 'voluptuous.Optional', 'vol.Optional', (['ATTR_VALUE3'], {}), '(ATTR_VALUE3)\n', (687, 700), True, 'import voluptuous as vol\n'), ((1564, 1617), 'pyfttt.send_event', 'pyfttt.send_event', (['key', 'event', 'value1', 'value2', 'value3'], {}), '(key, event, value1, value2, value3)\n', (1581, 1617), True, 'import pyfttt as pyfttt\n'), ((779, 801), 'voluptuous.Required', 'vol.Required', (['CONF_KEY'], {}), '(CONF_KEY)\n', (791, 801), True, 'import voluptuous as vol\n')]
|
import unittest
from align.jaccard import *
from align.roc import *
import numpy as np
from PIL import Image
class JaccardIndexTest(unittest.TestCase):
def setUp(self):
self.y_true = np.ones((10, 3, 100, 100))
self.y_pred = np.zeros((10, 3, 100, 100))
self.y_pred[1] = np.ones((3,100,100))
def test_jaccard(self):
scores = jaccard_index(self.y_true, self.y_pred)
assert scores.mean() == 0.1
precision_recalls = precision_recall(self.y_true, self.y_pred, iou=0.05)
print ("AP@0.05:{}".format(compute_ap(precision_recalls)))
print("mAP@0.05:0.95:0.05={}".format(compute_map(self.y_true, self.y_pred)))
def test_jaccard_2(self):
y_true = np.array(Image.open('data/label.png').convert('L'), dtype=np.float32)[np.newaxis,...] / 255.
y_pred = np.array(Image.open('data/generation.png').convert('L'), dtype=np.float32)[np.newaxis,...] / 255.
print('Jaccard Index: {}'.format(jaccard_index(y_true, y_pred)))
print("mAP@0.05:0.95:0.05={}".format(compute_map(y_true, y_pred)))
if __name__ == '__main__':
unittest.main()
|
[
"unittest.main",
"numpy.zeros",
"numpy.ones",
"PIL.Image.open"
] |
[((1114, 1129), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1127, 1129), False, 'import unittest\n'), ((197, 223), 'numpy.ones', 'np.ones', (['(10, 3, 100, 100)'], {}), '((10, 3, 100, 100))\n', (204, 223), True, 'import numpy as np\n'), ((246, 273), 'numpy.zeros', 'np.zeros', (['(10, 3, 100, 100)'], {}), '((10, 3, 100, 100))\n', (254, 273), True, 'import numpy as np\n'), ((299, 321), 'numpy.ones', 'np.ones', (['(3, 100, 100)'], {}), '((3, 100, 100))\n', (306, 321), True, 'import numpy as np\n'), ((736, 764), 'PIL.Image.open', 'Image.open', (['"""data/label.png"""'], {}), "('data/label.png')\n", (746, 764), False, 'from PIL import Image\n'), ((846, 879), 'PIL.Image.open', 'Image.open', (['"""data/generation.png"""'], {}), "('data/generation.png')\n", (856, 879), False, 'from PIL import Image\n')]
|
#!/usr/bin/env python
#
import sys
from cbapi.response.models import Sensor
from cbapi.example_helpers import build_cli_parser, get_cb_response_object
import logging
import csv
import traceback
log = logging.getLogger(__name__)
def export_sensors(cb, export_file_name, export_fields, query):
print("Starting CbR Sensor Export")
if query:
sensors = list(cb.select(Sensor).where(query).all())
else:
sensors = list(cb.select(Sensor))
with open(export_file_name, "w", encoding="utf8") as csv_file:
csv_writer = csv.writer(csv_file, delimiter=',', lineterminator='\n')
csv_writer.writerow(export_fields)
for sensor in sensors:
try:
row = [getattr(sensor, field) for field in export_fields]
csv_writer.writerow(row)
except Exception as e:
print("Exception {1} caused sensor export to fail for {0}".format(sensor.hostname, str(e)))
traceback.format_exc(0)
print("Export finished, exported {0} sensors to {1}".format(len(sensors), export_file_name))
def main():
parser = build_cli_parser(description="Export CbR Sensors from your environment as CSV")
parser.add_argument("--output", "-o", dest="exportfile", help="The file to export to", required=True)
parser.add_argument("--fields", "-f", dest="exportfields", help="The fields to export",
default="id,hostname,group_id,network_interfaces,os_environment_display_string,"
"build_version_string,network_isolation_enabled,last_checkin_time",
required=False)
parser.add_argument("--query", "-q", dest="query", help="optional query to filter exported sensors", required=False)
args = parser.parse_args()
cb = get_cb_response_object(args)
export_fields = args.exportfields.split(",")
return export_sensors(cb, export_file_name=args.exportfile, export_fields=export_fields, query=args.query)
if __name__ == "__main__":
sys.exit(main())
|
[
"csv.writer",
"cbapi.example_helpers.build_cli_parser",
"traceback.format_exc",
"cbapi.example_helpers.get_cb_response_object",
"logging.getLogger"
] |
[((202, 229), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (219, 229), False, 'import logging\n'), ((1121, 1200), 'cbapi.example_helpers.build_cli_parser', 'build_cli_parser', ([], {'description': '"""Export CbR Sensors from your environment as CSV"""'}), "(description='Export CbR Sensors from your environment as CSV')\n", (1137, 1200), False, 'from cbapi.example_helpers import build_cli_parser, get_cb_response_object\n'), ((1797, 1825), 'cbapi.example_helpers.get_cb_response_object', 'get_cb_response_object', (['args'], {}), '(args)\n', (1819, 1825), False, 'from cbapi.example_helpers import build_cli_parser, get_cb_response_object\n'), ((551, 607), 'csv.writer', 'csv.writer', (['csv_file'], {'delimiter': '""","""', 'lineterminator': '"""\n"""'}), "(csv_file, delimiter=',', lineterminator='\\n')\n", (561, 607), False, 'import csv\n'), ((973, 996), 'traceback.format_exc', 'traceback.format_exc', (['(0)'], {}), '(0)\n', (993, 996), False, 'import traceback\n')]
|
"""
This module contains functions to retrieve platform dependent locations to store app
data. It supports macOS and Linux.
"""
# system imports
import os
import platform
from os import path as osp
from typing import Optional
__all__ = [
"get_log_path",
"get_cache_path",
"get_autostart_path",
"get_runtime_path",
"get_conf_path",
"get_home_dir",
"get_data_path",
]
def to_full_path(
path: str, subfolder: Optional[str], filename: Optional[str], create: bool
) -> str:
if subfolder:
path = osp.join(path, subfolder)
if create:
os.makedirs(path, exist_ok=True)
if filename:
path = osp.join(path, filename)
return path
def get_home_dir() -> str:
"""
Returns user home directory. This will be determined from the first
valid result out of (osp.expanduser("~"), $HOME, $USERPROFILE, $TMP).
"""
try:
# expanduser() returns a raw byte string which needs to be
# decoded with the codec that the OS is using to represent
# file paths.
path = osp.expanduser("~")
except Exception:
path = ""
if osp.isdir(path):
return path
# get home from alternative locations
for env_var in ("HOME", "USERPROFILE", "TMP"):
# os.environ.get() returns a raw byte string which needs to be
# decoded with the codec that the OS is using to represent
# environment variables.
path = os.environ.get(env_var, "")
if osp.isdir(path):
return path
else:
path = ""
if not path:
raise RuntimeError(
"Please set the environment variable HOME to your user/home directory."
)
return path
home_dir = get_home_dir()
def get_conf_path(
subfolder: Optional[str] = None, filename: Optional[str] = None, create: bool = True
) -> str:
"""
Returns the default config path for the platform. This will be:
- macOS: "~/Library/Application Support/<subfolder>/<filename>."
- Linux: ``XDG_CONFIG_HOME/<subfolder>/<filename>"
- other: "~/.config/<subfolder>/<filename>"
:param subfolder: The subfolder for the app.
:param filename: The filename to append for the app.
:param create: If ``True``, the folder ``subfolder`` will be created on-demand.
"""
if platform.system() == "Darwin":
conf_path = osp.join(get_home_dir(), "Library", "Application Support")
elif platform.system() == "Linux":
fallback = osp.join(get_home_dir(), ".config")
conf_path = os.environ.get("XDG_CONFIG_HOME", fallback)
else:
raise RuntimeError("Platform not supported")
return to_full_path(conf_path, subfolder, filename, create)
def get_data_path(
subfolder: Optional[str] = None, filename: Optional[str] = None, create: bool = True
) -> str:
"""
Returns the default path to save application data for the platform. This will be:
- macOS: "~/Library/Application Support/SUBFOLDER/FILENAME"
- Linux: "$XDG_DATA_DIR/SUBFOLDER/FILENAME"
- fallback: "$HOME/.local/share/SUBFOLDER/FILENAME"
Note: We do not use "~/Library/Saved Application State" on macOS since this folder
is reserved for user interface state and can be cleared by the user / system.
:param subfolder: The subfolder for the app.
:param filename: The filename to append for the app.
:param create: If ``True``, the folder ``subfolder`` will be created on-demand.
"""
if platform.system() == "Darwin":
state_path = osp.join(get_home_dir(), "Library", "Application Support")
elif platform.system() == "Linux":
fallback = osp.join(get_home_dir(), ".local", "share")
state_path = os.environ.get("XDG_DATA_HOME", fallback)
else:
raise RuntimeError("Platform not supported")
return to_full_path(state_path, subfolder, filename, create)
def get_cache_path(
subfolder: Optional[str] = None, filename: Optional[str] = None, create: bool = True
) -> str:
"""
Returns the default cache path for the platform. This will be:
- macOS: "~/Library/Caches/SUBFOLDER/FILENAME"
- Linux: "$XDG_CACHE_HOME/SUBFOLDER/FILENAME"
- fallback: "$HOME/.cache/SUBFOLDER/FILENAME"
:param subfolder: The subfolder for the app.
:param filename: The filename to append for the app.
:param create: If ``True``, the folder ``subfolder`` will be created on-demand.
"""
if platform.system() == "Darwin":
cache_path = osp.join(home_dir, "Library", "Caches")
elif platform.system() == "Linux":
fallback = osp.join(home_dir, ".cache")
cache_path = os.environ.get("XDG_CACHE_HOME", fallback)
else:
raise RuntimeError("Platform not supported")
return to_full_path(cache_path, subfolder, filename, create)
def get_log_path(
subfolder: Optional[str] = None, filename: Optional[str] = None, create: bool = True
) -> str:
"""
Returns the default log path for the platform. This will be:
- macOS: "~/Library/Logs/SUBFOLDER/FILENAME"
- Linux: "$XDG_CACHE_HOME/SUBFOLDER/FILENAME"
- fallback: "$HOME/.cache/SUBFOLDER/FILENAME"
:param subfolder: The subfolder for the app.
:param filename: The filename to append for the app.
:param create: If ``True``, the folder ``subfolder`` will be created on-demand.
"""
if platform.system() == "Darwin":
log_path = osp.join(home_dir, "Library", "Logs")
elif platform.system() == "Linux":
log_path = get_cache_path(create=False)
else:
raise RuntimeError("Platform not supported")
return to_full_path(log_path, subfolder, filename, create)
def get_autostart_path(filename: Optional[str] = None, create: bool = True) -> str:
"""
Returns the default path for login items for the platform. This will be:
- macOS: "~/Library/LaunchAgents/FILENAME"
- Linux: "$XDG_CONFIG_HOME/autostart/FILENAME"
- fallback: "$HOME/.config/autostart/FILENAME"
:param filename: The filename to append for the app.
:param create: If ``True``, the folder ``subfolder`` will be created on-demand.
"""
if platform.system() == "Darwin":
autostart_path = osp.join(home_dir, "Library", "LaunchAgents")
elif platform.system() == "Linux":
autostart_path = get_conf_path("autostart", create=create)
else:
raise RuntimeError("Platform not supported")
if filename:
autostart_path = osp.join(autostart_path, filename)
return autostart_path
def get_runtime_path(
subfolder: Optional[str] = None, filename: Optional[str] = None, create: bool = True
) -> str:
"""
Returns the default runtime path for the platform. This will be:
- macOS: "~/Library/Application Support/SUBFOLDER/FILENAME"
- Linux: "$XDG_RUNTIME_DIR/SUBFOLDER/FILENAME"
- fallback: "$HOME/.cache/SUBFOLDER/FILENAME"
:param subfolder: The subfolder for the app.
:param filename: The filename to append for the app.
:param create: If ``True``, the folder ``subfolder`` will be created on-demand.
"""
if platform.system() == "Darwin":
runtime_path = get_conf_path(create=False)
elif platform.system() == "Linux":
fallback = get_cache_path(create=False)
runtime_path = os.environ.get("XDG_RUNTIME_DIR", fallback)
else:
raise RuntimeError("Platform not supported")
return to_full_path(runtime_path, subfolder, filename, create)
|
[
"os.path.expanduser",
"os.makedirs",
"os.path.isdir",
"os.environ.get",
"platform.system",
"os.path.join"
] |
[((1137, 1152), 'os.path.isdir', 'osp.isdir', (['path'], {}), '(path)\n', (1146, 1152), True, 'from os import path as osp\n'), ((540, 565), 'os.path.join', 'osp.join', (['path', 'subfolder'], {}), '(path, subfolder)\n', (548, 565), True, 'from os import path as osp\n'), ((590, 622), 'os.makedirs', 'os.makedirs', (['path'], {'exist_ok': '(True)'}), '(path, exist_ok=True)\n', (601, 622), False, 'import os\n'), ((656, 680), 'os.path.join', 'osp.join', (['path', 'filename'], {}), '(path, filename)\n', (664, 680), True, 'from os import path as osp\n'), ((1069, 1088), 'os.path.expanduser', 'osp.expanduser', (['"""~"""'], {}), "('~')\n", (1083, 1088), True, 'from os import path as osp\n'), ((1454, 1481), 'os.environ.get', 'os.environ.get', (['env_var', '""""""'], {}), "(env_var, '')\n", (1468, 1481), False, 'import os\n'), ((1493, 1508), 'os.path.isdir', 'osp.isdir', (['path'], {}), '(path)\n', (1502, 1508), True, 'from os import path as osp\n'), ((2342, 2359), 'platform.system', 'platform.system', ([], {}), '()\n', (2357, 2359), False, 'import platform\n'), ((3509, 3526), 'platform.system', 'platform.system', ([], {}), '()\n', (3524, 3526), False, 'import platform\n'), ((4480, 4497), 'platform.system', 'platform.system', ([], {}), '()\n', (4495, 4497), False, 'import platform\n'), ((4532, 4571), 'os.path.join', 'osp.join', (['home_dir', '"""Library"""', '"""Caches"""'], {}), "(home_dir, 'Library', 'Caches')\n", (4540, 4571), True, 'from os import path as osp\n'), ((5413, 5430), 'platform.system', 'platform.system', ([], {}), '()\n', (5428, 5430), False, 'import platform\n'), ((5463, 5500), 'os.path.join', 'osp.join', (['home_dir', '"""Library"""', '"""Logs"""'], {}), "(home_dir, 'Library', 'Logs')\n", (5471, 5500), True, 'from os import path as osp\n'), ((6205, 6222), 'platform.system', 'platform.system', ([], {}), '()\n', (6220, 6222), False, 'import platform\n'), ((6261, 6306), 'os.path.join', 'osp.join', (['home_dir', '"""Library"""', '"""LaunchAgents"""'], {}), "(home_dir, 'Library', 'LaunchAgents')\n", (6269, 6306), True, 'from os import path as osp\n'), ((6519, 6553), 'os.path.join', 'osp.join', (['autostart_path', 'filename'], {}), '(autostart_path, filename)\n', (6527, 6553), True, 'from os import path as osp\n'), ((7166, 7183), 'platform.system', 'platform.system', ([], {}), '()\n', (7181, 7183), False, 'import platform\n'), ((2461, 2478), 'platform.system', 'platform.system', ([], {}), '()\n', (2476, 2478), False, 'import platform\n'), ((2566, 2609), 'os.environ.get', 'os.environ.get', (['"""XDG_CONFIG_HOME"""', 'fallback'], {}), "('XDG_CONFIG_HOME', fallback)\n", (2580, 2609), False, 'import os\n'), ((3629, 3646), 'platform.system', 'platform.system', ([], {}), '()\n', (3644, 3646), False, 'import platform\n'), ((3743, 3784), 'os.environ.get', 'os.environ.get', (['"""XDG_DATA_HOME"""', 'fallback'], {}), "('XDG_DATA_HOME', fallback)\n", (3757, 3784), False, 'import os\n'), ((4581, 4598), 'platform.system', 'platform.system', ([], {}), '()\n', (4596, 4598), False, 'import platform\n'), ((4630, 4658), 'os.path.join', 'osp.join', (['home_dir', '""".cache"""'], {}), "(home_dir, '.cache')\n", (4638, 4658), True, 'from os import path as osp\n'), ((4680, 4722), 'os.environ.get', 'os.environ.get', (['"""XDG_CACHE_HOME"""', 'fallback'], {}), "('XDG_CACHE_HOME', fallback)\n", (4694, 4722), False, 'import os\n'), ((5510, 5527), 'platform.system', 'platform.system', ([], {}), '()\n', (5525, 5527), False, 'import platform\n'), ((6316, 6333), 'platform.system', 'platform.system', ([], {}), '()\n', (6331, 6333), False, 'import platform\n'), ((7257, 7274), 'platform.system', 'platform.system', ([], {}), '()\n', (7272, 7274), False, 'import platform\n'), ((7358, 7401), 'os.environ.get', 'os.environ.get', (['"""XDG_RUNTIME_DIR"""', 'fallback'], {}), "('XDG_RUNTIME_DIR', fallback)\n", (7372, 7401), False, 'import os\n')]
|
# Generated by Django 3.0.4 on 2020-03-26 22:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("budget", "0001_initial"),
]
operations = [
migrations.RenameField(
model_name="budget", old_name="budget", new_name="balance",
),
]
|
[
"django.db.migrations.RenameField"
] |
[((215, 302), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""budget"""', 'old_name': '"""budget"""', 'new_name': '"""balance"""'}), "(model_name='budget', old_name='budget', new_name=\n 'balance')\n", (237, 302), False, 'from django.db import migrations\n')]
|
import re
from collections import namedtuple
from .exceptions import ParseError, ExpressionNotClosed
from .exceptions import NotClosedError, StatementNotFound
from .exceptions import StatementNotAllowed, UnexpectedClosingFound
from .registry import Registry
class Node:
def __init__(self, parent=None):
self.code = ""
self.parent = parent
def render(self, context):
return self.code
def __str__(self):
return "Plain node ----\n{}\n----\n".format(self.code)
class TextNode(Node):
def __init__(self, text, parent=None):
super().__init__(parent=parent)
self.text = text
def render(self, context):
return self.text
def __str__(self):
return "Text node ----\n{}\n----\n".format(self.text)
class ExpressionNode(Node):
def __init__(self, expression, parent=None):
super().__init__(parent=parent)
self.expression = expression
def render(self, context):
return str(context.eval(self.expression))
def __str__(self):
return "Statement node ----\n{}\n----\n".format(self.expression)
class StatementNode(Node):
open = ''
def __init__(self, type, expression="", parent=None):
super().__init__(parent=parent)
self.type = type
self.expression = expression
def compile(self, code, index=0):
return index
class CommentNode(StatementNode):
def __init__(self, expression="", parent=None):
super().__init__("comment", expression=expression, parent=parent)
class BlockStatementNode(StatementNode):
closing = None
has_block = True
def __init__(self, type, expression="", nodes=None, parent=None):
super().__init__(type, expression, parent=parent)
self.nodes = nodes or []
def render(self, context):
# The blockstatement itself will probably render to nothing
# so just include the childnodes
res = []
for node in self.nodes:
res.append(node.render(context))
return res
def __str__(self):
return "BlockStatement node {}----\n{}\n----\n".format(
self.type, self.code)
def __iter__(self):
return self.nodes
def find_start_block(self, code):
""" find the start of the nearest block: {{ {% or {# """
indexes = []
for start in ('{%', '{{', '{#'):
index = code.find(start)
if index != -1:
indexes.append(index)
if indexes:
return min(indexes)
return -1
def compile(self, pc, index=0):
res = []
code = pc.code
closing = self.closing
closing_found = closing is None
while index < len(code):
first_marker = self.find_start_block(code[index:])
if first_marker == -1:
res.append(TextNode(code[index:]))
index = len(code)
break
if first_marker > 0:
# Is there any text to put in a node?
res.append(TextNode(code[index:index + first_marker]))
index += first_marker
if closing and re.match("{{%\s*{}\s*%}}".format(closing),
code[index:]):
closing_found = True
index += code[index:].find("%}") + 2
break
node, skip = CompileStatement(pc[index:], parent=self)
res.append(node)
index += skip
if not closing_found:
raise ParseError("Closing tag {} not found".format(closing),
pc)
self.nodes = res
self.code = code[:index]
return index
class MainNode(BlockStatementNode):
pass
class FillBlockStatementNode(BlockStatementNode):
open = 'fill'
closing = 'endfill'
class ForBlockStatementNode(BlockStatementNode):
open = 'for'
closing = 'endfor'
def looper(self, sequence):
looptype = namedtuple("Loop", ["index", "index0", "first", "last"])
l = len(sequence)
for i, v in enumerate(sequence):
yield looptype(i, i + 1, i == 0, i == l - 1), v
def render(self, context):
var, _in, expr = self.expression.partition(" in ")
var = var.strip()
seq = context.eval(expr.strip())
res = []
for loop, element in self.looper(seq):
context.push({var: element, 'loop': loop})
for node in self.nodes:
res.append(node.render(context))
context.pop()
return res
class IfBlockStatementNode(BlockStatementNode):
open = 'if'
closing = 'endif'
def render(self, context):
res = []
t, f = [], []
current = t
for node in self.nodes:
if isinstance(node, ElseInIfStatementNode):
current = f
else:
current.append(node)
if context.eval(self.expression):
for node in t:
res.append(node.render(context))
else:
for node in f:
res.append(node.render(context))
return res
class ElseInIfStatementNode(StatementNode):
""" Should only be allowed inside if blockstatement """
open = 'else'
class SlotStatementNode(BlockStatementNode):
open = 'slot'
closing = 'endslot'
def render(self, context):
res = []
blockname = self.expression or "main"
block_found = False
# is there a child to pop? E.g. rendering base template directly
if context.child():
with context.popchild() as tpl:
for node in tpl.mainnode.nodes:
if isinstance(node, FillBlockStatementNode):
block_found = True
if node.expression == blockname:
res.append(node.render(context))
break
else:
if not block_found:
# use entire template as matching block
block_found = True
res.append(tpl.render_with_context(
context,
start_at_parent=False))
else:
# render the body of the block
for node in self.nodes:
res.append(node.render(context))
else:
# render the body of the block
for node in self.nodes:
res.append(node.render(context))
return res
registry = Registry()
registry.register('for', ForBlockStatementNode, MainNode)
registry.register('if', IfBlockStatementNode, MainNode)
registry.register('else', ElseInIfStatementNode,
IfBlockStatementNode, direct=True)
# registry.register('else', ForBlockStatementNode, direct=True)
registry.register('slot', SlotStatementNode, MainNode)
registry.register('fill', FillBlockStatementNode, MainNode)
def parse_expression(code, start="{{", end="}}"):
""" parse any expression surrounded by start/end,
supporting string expressions containing start/end
markers. Code may contain trailing code
return index where parsing ends including parsing of endmarker
"""
assert code[:2] == start
escape_mode = False
string_mode = '' # can be ' " or empty
res = ''
for index in range(2, len(code)):
c = code[index]
if string_mode:
if not escape_mode:
if c == string_mode:
string_mode = False
if c == '\\':
escape_mode = True
else:
escape_mode = False
elif c in "'\"":
string_mode = c
elif code[index:index + 2] == end:
# 'end' ends the expression and we're not inside a string
index += 1 # we read one } ahead (assume end is 2 characters)
break
res += c
else:
raise ExpressionNotClosed()
return res, index + 1
def parse_statement(code):
""" parse
{% stmnt expr %}
where "expr" may contain a string containing '%}'
"""
r = parse_expression(code, start='{%', end='%}')
return r
def parse_comment(code):
r = parse_expression(code, start='{#', end='#}')
return r
def CompileStatement(pc, parent=None):
""" Either a block statement {% or expression statement {{
has started. Figure out what it is and parse it
"""
parent = parent or MainNode("main")
# we have a parse context. catch errors and add line numbers etc?
if pc.code[1] == '{': # expression statement
try:
expr, end = parse_expression(pc.code)
except ExpressionNotClosed as e:
raise ParseError("Expression not closed", pc) from e
return ExpressionNode(expr), end
if pc.code[1] == '#': # comment
try:
expr, end = parse_comment(pc.code)
except ExpressionNotClosed as e:
raise ParseError("Comment not closed", pc) from e
return CommentNode(expr), end
try:
statement, end = parse_statement(pc.code)
except ExpressionNotClosed as e:
raise ParseError("Statement not closed", pc) from e
statement = statement.strip()
main, _, expr = statement.partition(" ")
pc.tag = main
try:
klass = registry.find(main, parent)
except NotClosedError as e:
raise ParseError("Statement not closed", pc) from e
except StatementNotFound as e:
raise ParseError("Statement not found", pc) from e
except StatementNotAllowed as e:
raise ParseError("Statement not allowed", pc) from e
except UnexpectedClosingFound as e:
raise ParseError("Unexpected closing statement found", pc) from e
node = klass(main, expr, parent=parent)
pc.node = node
end = node.compile(pc, end)
# No node is inserted, it purely returns body
return node, end
|
[
"collections.namedtuple"
] |
[((4002, 4058), 'collections.namedtuple', 'namedtuple', (['"""Loop"""', "['index', 'index0', 'first', 'last']"], {}), "('Loop', ['index', 'index0', 'first', 'last'])\n", (4012, 4058), False, 'from collections import namedtuple\n')]
|
import theano
import theano.tensor as T
import numpy as np
from itertools import chain, izip
from learntools.libs.logger import log_me
from learntools.libs.auc import auc
from learntools.model.mlp import ConvolutionalMLP
from learntools.model.theano_utils import make_shared
from learntools.model import Model, gen_batches_by_size
from learntools.model.math import sigmoid
class ConvEmotiv(Model):
@log_me('...building ConvEmotiv')
def __init__(self, prepared_data, batch_size=30, L1_reg=0., L2_reg=0.,
field_width=20, ds_factor=2, rng_seed=42, dropout_p=0.5,
learning_rate=0.02, **kwargs):
"""
Args:
prepared_data : (Dataset, [int], [int])
a tuple that holds the data to be used, the row indices of the
training set, and the row indices of the validation set
batch_size : int
The size of the batches used to train
"""
# 1: Organize data into batches
ds, train_idx, valid_idx = prepared_data
input_size = ds.get_data('eeg').shape[1]
self._xs = make_shared(ds.get_data('eeg'), name='eeg')
self._ys = make_shared(ds.get_data('condition'), to_int=True, name='condition')
self.train_batches = gen_batches_by_size(train_idx, batch_size)
self.valid_batches = gen_batches_by_size(valid_idx, batch_size)
# 2: Connect the model
rng = np.random.RandomState(rng_seed)
t_dropout = T.scalar('dropout')
classifier = ConvolutionalMLP(rng=rng,
n_in=input_size,
size=[input_size],
n_out=2,
field_width=field_width,
ds_factor=ds_factor,
dropout=t_dropout)
input_idxs = T.ivector('input_idxs')
classifier_input = self._xs[input_idxs]
classifier_input.name = 'classifier_input'
pY = classifier.instance(classifier_input)
true_y = self._ys[input_idxs]
true_y.name = 'true_y'
# 3: Create theano functions
loss = -T.mean(T.log(pY)[T.arange(input_idxs.shape[0]), true_y])
loss.name = 'loss'
subnets = [classifier]
cost = (
loss
+ L1_reg * sum([net.L1 for net in subnets])
+ L2_reg * sum([net.L2_sqr for net in subnets])
)
cost.name = 'overall_cost'
# compute parameter updates
training_updates = []
params = list(chain.from_iterable(net.params for net in subnets))
deltas = [T.grad(cost, param) for param in params]
update_parameters = [(param, param - learning_rate * delta)
for param, delta in izip(params, deltas)]
training_updates += update_parameters
common_args = {
'inputs': [input_idxs],
'outputs': [loss, pY[:, 1] - pY[:, 0], input_idxs],
'allow_input_downcast': True,
}
self._tf_valid = theano.function(givens={t_dropout: 0.}, **common_args)
self._tf_train = theano.function(
updates=training_updates,
givens={t_dropout: dropout_p},
**common_args)
def evaluate(self, idxs, pred):
y = self._ys.owner.inputs[0].get_value(borrow=True)[idxs]
return auc(y[:len(pred)], pred, pos_label=1)
def validate(self, idxs, **kwargs):
res = self._tf_valid(idxs)
return res[:3]
def train(self, idxs, **kwargs):
res = self._tf_train(idxs)
return res[:3]
|
[
"itertools.chain.from_iterable",
"theano.tensor.log",
"learntools.model.mlp.ConvolutionalMLP",
"learntools.libs.logger.log_me",
"theano.function",
"learntools.model.gen_batches_by_size",
"theano.tensor.ivector",
"numpy.random.RandomState",
"theano.tensor.grad",
"itertools.izip",
"theano.tensor.arange",
"theano.tensor.scalar"
] |
[((407, 439), 'learntools.libs.logger.log_me', 'log_me', (['"""...building ConvEmotiv"""'], {}), "('...building ConvEmotiv')\n", (413, 439), False, 'from learntools.libs.logger import log_me\n'), ((1281, 1323), 'learntools.model.gen_batches_by_size', 'gen_batches_by_size', (['train_idx', 'batch_size'], {}), '(train_idx, batch_size)\n', (1300, 1323), False, 'from learntools.model import Model, gen_batches_by_size\n'), ((1353, 1395), 'learntools.model.gen_batches_by_size', 'gen_batches_by_size', (['valid_idx', 'batch_size'], {}), '(valid_idx, batch_size)\n', (1372, 1395), False, 'from learntools.model import Model, gen_batches_by_size\n'), ((1442, 1473), 'numpy.random.RandomState', 'np.random.RandomState', (['rng_seed'], {}), '(rng_seed)\n', (1463, 1473), True, 'import numpy as np\n'), ((1494, 1513), 'theano.tensor.scalar', 'T.scalar', (['"""dropout"""'], {}), "('dropout')\n", (1502, 1513), True, 'import theano.tensor as T\n'), ((1536, 1675), 'learntools.model.mlp.ConvolutionalMLP', 'ConvolutionalMLP', ([], {'rng': 'rng', 'n_in': 'input_size', 'size': '[input_size]', 'n_out': '(2)', 'field_width': 'field_width', 'ds_factor': 'ds_factor', 'dropout': 't_dropout'}), '(rng=rng, n_in=input_size, size=[input_size], n_out=2,\n field_width=field_width, ds_factor=ds_factor, dropout=t_dropout)\n', (1552, 1675), False, 'from learntools.model.mlp import ConvolutionalMLP\n'), ((1844, 1867), 'theano.tensor.ivector', 'T.ivector', (['"""input_idxs"""'], {}), "('input_idxs')\n", (1853, 1867), True, 'import theano.tensor as T\n'), ((3038, 3093), 'theano.function', 'theano.function', ([], {'givens': '{t_dropout: 0.0}'}), '(givens={t_dropout: 0.0}, **common_args)\n', (3053, 3093), False, 'import theano\n'), ((3118, 3210), 'theano.function', 'theano.function', ([], {'updates': 'training_updates', 'givens': '{t_dropout: dropout_p}'}), '(updates=training_updates, givens={t_dropout: dropout_p}, **\n common_args)\n', (3133, 3210), False, 'import theano\n'), ((2540, 2590), 'itertools.chain.from_iterable', 'chain.from_iterable', (['(net.params for net in subnets)'], {}), '(net.params for net in subnets)\n', (2559, 2590), False, 'from itertools import chain, izip\n'), ((2610, 2629), 'theano.tensor.grad', 'T.grad', (['cost', 'param'], {}), '(cost, param)\n', (2616, 2629), True, 'import theano.tensor as T\n'), ((2768, 2788), 'itertools.izip', 'izip', (['params', 'deltas'], {}), '(params, deltas)\n', (2772, 2788), False, 'from itertools import chain, izip\n'), ((2148, 2157), 'theano.tensor.log', 'T.log', (['pY'], {}), '(pY)\n', (2153, 2157), True, 'import theano.tensor as T\n'), ((2158, 2187), 'theano.tensor.arange', 'T.arange', (['input_idxs.shape[0]'], {}), '(input_idxs.shape[0])\n', (2166, 2187), True, 'import theano.tensor as T\n')]
|
import random
from abc import ABCMeta, abstractmethod
from enum import Enum
from mockquitto.client.exceptions import GeneratorCreationError
from mockquitto.client.generator.laws import LawGeneration
class FrequencyType(Enum):
CONSTANT = 0
RANDOM = 1
class GenerationType(Enum):
FINITE = 0
INFINITE = 1
class ValuePair:
"""
Wrapper for return values
Attributes:
time: time for sleep (for asyncio event loop)
value: returning value
"""
permissible_indexes = (0, 1)
def __init__(self, time=None, value=None):
self.time = time
self.value = value
self._dict = {
0: self.time,
1: self.value
}
def __getitem__(self, item):
if item not in self.permissible_indexes:
raise IndexError
elif not isinstance(item, int):
raise TypeError
else:
return self._dict.get(item)
def __iadd__(self, other):
if self.time is None:
self.time = other.time
else:
self.time += other.time
if self.value is None:
self.value = other.value
else:
if isinstance(self.value, list) and isinstance(other.value, list):
self.value.extend(other.value)
elif isinstance(self.value, list) and not isinstance(other.value, list):
self.value.append(other.value)
elif not isinstance(self.value, list) and isinstance(other.value, list):
self.value = [self.value]
self.value.extend(other.value)
elif not isinstance(self.value, list) and not isinstance(other.value, list):
self.value = [self.value]
self.value.append(other.value)
return self
def __str__(self) -> str:
return "{} {}".format(self.time, self.value)
class Generator(metaclass=ABCMeta):
"""
Base generator object for generating values
"""
def __init__(self, value_cls, gen_law, freq_type: FrequencyType=FrequencyType.CONSTANT, generator_name=None,
**kwargs):
"""
Initializing generator object
:param start_value:
:param gen_law: tuple, list of LawGeneration derived objects or one instance of it
:param freq_type: distribution of time, which async task will sleep until next request of generation
:param kwargs:
"""
self.gen_law_list = gen_law if isinstance(gen_law, (list, tuple)) else tuple([gen_law])
self.freq_type = freq_type
if freq_type is FrequencyType.CONSTANT and 'freq_value' in kwargs:
self.freq_value = kwargs['freq_value']
elif freq_type is FrequencyType.RANDOM and 'freq_range' in kwargs:
self.freq_range = kwargs['freq_range']
else:
raise GeneratorCreationError()
self._generation_flag = False
self._generator_obj = self._generator_impl()
self._value_cls = value_cls
self._name = generator_name
@property
def name(self) -> str:
return self._name
@name.setter
def name(self, new_name):
self._name = new_name
@property
def value_cls(self):
return self._value_cls
def get_gen_obj(self):
return self._generator_obj
@abstractmethod
def _generator_impl(self):
pass
def next(self):
"""
Calls __next__ method of Generator object
:return: next value from generator
"""
return next(self._generator_obj)
def stop(self):
self._generation_flag = False
def delay(self):
if self.freq_type is FrequencyType.CONSTANT:
return self.freq_value
elif self.freq_type is FrequencyType.RANDOM:
return random.uniform(*self.freq_range)
def get_value_pair(self) -> ValuePair:
return ValuePair(self.delay(), self._value_cls([gen_law.get_next() for gen_law in self.gen_law_list]))
class GeneratorFinite(Generator):
def __init__(self, value_cls, gen_law, *args, **kwargs):
super().__init__(value_cls, gen_law, *args, **kwargs)
self._gen_type = GenerationType.FINITE
self._stop_value = kwargs.get('stop_value')
self._iters = kwargs.get('iters')
def _generator_impl(self):
if self._stop_value:
value = self.get_value_pair()
yield value[1]
while value[1] != self._stop_value and self._generation_flag:
value = self.get_value_pair()
yield value
elif self._iters:
for x in range(self._iters):
yield self.get_value_pair()
class GeneratorInfinite(Generator):
def __init__(self, value_cls, gen_law, *args, **kwargs):
super().__init__(value_cls, gen_law, *args, **kwargs)
self._gen_type = GenerationType.INFINITE
def _generator_impl(self):
self._generation_flag = True
while self._generation_flag:
yield self.get_value_pair()
|
[
"mockquitto.client.exceptions.GeneratorCreationError",
"random.uniform"
] |
[((2858, 2882), 'mockquitto.client.exceptions.GeneratorCreationError', 'GeneratorCreationError', ([], {}), '()\n', (2880, 2882), False, 'from mockquitto.client.exceptions import GeneratorCreationError\n'), ((3812, 3844), 'random.uniform', 'random.uniform', (['*self.freq_range'], {}), '(*self.freq_range)\n', (3826, 3844), False, 'import random\n')]
|
# -*- coding: utf-8 -*-
# Copyright CERN since 2014
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import itertools
from typing import TYPE_CHECKING
from flask import Flask, Blueprint, request, redirect
from werkzeug.datastructures import Headers
from rucio.api.replica import list_replicas
from rucio.common.exception import DataIdentifierNotFound, ReplicaNotFound
from rucio.core.replica_sorter import site_selector, sort_replicas
from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_name, try_stream, \
extract_vo, generate_http_error_flask, ErrorHandlingMethodView
if TYPE_CHECKING:
from typing import Optional
from rucio.web.rest.flaskapi.v1.common import HeadersType
class MetaLinkRedirector(ErrorHandlingMethodView):
def get_headers(self) -> "Optional[HeadersType]":
headers = Headers()
headers.set('Access-Control-Allow-Origin', request.environ.get('HTTP_ORIGIN'))
headers.set('Access-Control-Allow-Headers', request.environ.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS'))
headers.set('Access-Control-Allow-Methods', '*')
headers.set('Access-Control-Allow-Credentials', 'true')
return headers
@check_accept_header_wrapper_flask(['application/metalink4+xml'])
def get(self, scope_name):
"""
---
summary: Metalink redirect
description: Get Metalink redirect.
tags:
- Redirect
parameters:
- name: scope_name
in: path
description: The data identifier (scope)/(name).
schema:
type: string
style: simple
- name: ip
in: query
description: The client ip.
schema:
type: string
style: simple
required: false
- name: fqdn
in: query
schema:
type: string
style: simple
required: false
- name: site
in: query
schema:
type: string
style: simple
required: false
- name: schemes
in: query
schema:
type: array
style: simple
required: false
- name: select
in: query
schema:
type: string
style: simple
required: false
- name: sort
in: query
schema:
type: string
style: simple
required: false
responses:
200:
description: OK
content:
application/metalink4+xml:
schema:
description: The metalink file.
type: string
401:
description: Invalid Auth Token
404:
description: Rse or did not found
406:
description: Not acceptable
"""
headers = self.get_headers()
try:
scope, name = parse_scope_name(scope_name, extract_vo(request.headers))
except ValueError as error:
return generate_http_error_flask(400, error, headers=headers)
# set the correct client IP
client_ip = request.headers.get('X-Forwarded-For', default=request.remote_addr)
client_location = {
'ip': request.args.get('ip', default=client_ip),
'fqdn': request.args.get('fqdn', default=None),
'site': request.args.get('site', default=None),
}
dids = [{'scope': scope, 'name': name}]
schemes = request.args.getlist('schemes') or ['http', 'https', 'root', 'gsiftp', 'srm', 'davs']
sortby = request.args.get('select', default=None)
sortby = request.args.get('sort', default=sortby)
# get vo if given
vo = extract_vo(request.headers)
try:
replicas_iter = list_replicas(dids=dids, schemes=schemes, client_location=client_location, vo=vo)
try:
first = next(replicas_iter)
except StopIteration:
return 'no redirection possible - cannot find the DID', 404
def generate():
# first, set the appropriate content type, and stream the header
yield '<?xml version="1.0" encoding="UTF-8"?>\n<metalink xmlns="urn:ietf:params:xml:ns:metalink">\n'
# iteratively stream the XML per file
for rfile in itertools.chain((first,), replicas_iter):
replicas = []
dictreplica = {}
for rse in rfile['rses']:
for replica in rfile['rses'][rse]:
replicas.append(replica)
dictreplica[replica] = rse
# stream metadata
yield ' <file name="' + rfile['name'] + '">\n'
yield ' <identity>' + rfile['scope'] + ':' + rfile['name'] + '</identity>\n'
if rfile['adler32'] is not None:
yield ' <hash type="adler32">' + rfile['adler32'] + '</hash>\n'
if rfile['md5'] is not None:
yield ' <hash type="md5">' + rfile['md5'] + '</hash>\n'
yield ' <size>' + str(rfile['bytes']) + '</size>\n'
yield f' <glfn name="/atlas/rucio/{rfile["scope"]}:{rfile["name"]}">'
yield '</glfn>\n'
replicas = sort_replicas(dictreplica, client_location, selection=sortby)
# stream URLs
idx = 1
for replica in replicas:
yield ' <url location="' + str(dictreplica[replica]) + '" priority="' + str(idx) + '">' + replica + '</url>\n'
idx += 1
yield ' </file>\n'
# don't forget to send the metalink footer
yield '</metalink>\n'
return try_stream(generate(), content_type='application/metalink4+xml')
except (DataIdentifierNotFound, ReplicaNotFound) as error:
return generate_http_error_flask(404, error, headers=headers)
class HeaderRedirector(ErrorHandlingMethodView):
def get_headers(self) -> "Optional[HeadersType]":
headers = Headers()
headers.set('Access-Control-Allow-Origin', request.environ.get('HTTP_ORIGIN'))
headers.set('Access-Control-Allow-Headers', request.environ.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS'))
headers.set('Access-Control-Allow-Methods', '*')
headers.set('Access-Control-Allow-Credentials', 'true')
return headers
def get(self, scope_name):
"""
---
summary: Header redirect
description: Get the header redirect.
tags:
- Redirect
parameters:
- name: scope_name
in: path
description: The data identifier (scope)/(name).
schema:
type: string
style: simple
- name: ip
in: query
description: The client ip.
schema:
type: string
style: simple
required: false
- name: fqdn
in: query
schema:
type: string
style: simple
required: false
- name: site
in: query
schema:
type: string
style: simple
required: false
- name: schemes
in: query
schema:
type: array
style: simple
required: false
- name: select
in: query
schema:
type: string
style: simple
required: false
- name: sort
in: query
schema:
type: string
style: simple
required: false
- name: rse
in: query
schema:
type: string
style: simple
required: false
responses:
303:
description: OK
content:
application/json:
schema:
description: The redirect url.
type: string
401:
description: Invalid Auth Token
404:
description: Rse or did not found
"""
headers = self.get_headers()
try:
scope, name = parse_scope_name(scope_name, extract_vo(request.headers))
except ValueError as error:
return generate_http_error_flask(400, error, headers=headers)
try:
client_ip = request.headers.get('X-Forwarded-For', default=request.remote_addr)
client_location = {
'ip': request.args.get('ip', default=client_ip),
'fqdn': request.args.get('fqdn', default=None),
'site': request.args.get('site', default=None),
}
# use the default HTTP protocols if no scheme is given
schemes = request.args.getlist('schemes') or ['davs', 'https', 's3']
sortby = request.args.get('select', default='random')
sortby = request.args.get('sort', default=sortby)
rse = request.args.get('rse', default=None)
site = request.args.get('site', default=None)
# correctly forward the schemes and select to potential metalink followups
cleaned_url = request.environ.get('REQUEST_URI').split('?')[0]
headers.set('Link', f'<{cleaned_url}/metalink?schemes={",".join(schemes)}&select={sortby}>; rel=describedby; type="application/metalink+xml"')
# get vo if given
vo = extract_vo(request.headers)
replicas = list(
list_replicas(
dids=[{'scope': scope, 'name': name, 'type': 'FILE'}],
schemes=schemes,
client_location=client_location,
vo=vo
)
)
selected_url = None
for r in replicas:
if r['rses']:
dictreplica = {}
if rse:
if rse in r['rses'] and r['rses'][rse]:
selected_url = r['rses'][rse][0]
else:
return 'no redirection possible - no valid RSE for HTTP redirection found', 404, headers
else:
for rep in r['rses']:
for replica in r['rses'][rep]:
# since this is HTTP-only redirection, and to ensure compatibility with as many http clients as possible
# forcibly replacement davs and s3 URLs to https
replica = replica.replace('davs://', 'https://').replace('s3://', 'https://')
dictreplica[replica] = rep
if not dictreplica:
return 'no redirection possible - no valid RSE for HTTP redirection found', 404, headers
elif site:
rep = site_selector(dictreplica, site, vo)
if rep:
selected_url = rep[0]
else:
return 'no redirection possible - no valid RSE for HTTP redirection found', 404, headers
else:
rep = sort_replicas(dictreplica, client_location, selection=sortby)
selected_url = rep[0]
if selected_url:
response = redirect(selected_url, code=303)
response.headers.extend(headers)
return response
return 'no redirection possible - file does not exist', 404, headers
except ReplicaNotFound as error:
return generate_http_error_flask(404, error, headers=headers)
def blueprint(no_doc=True):
bp = Blueprint('redirect', __name__, url_prefix='/redirect')
metalink_redirector_view = MetaLinkRedirector.as_view('metalink_redirector')
bp.add_url_rule('/<path:scope_name>/metalink', view_func=metalink_redirector_view, methods=['get', ])
header_redirector_view = HeaderRedirector.as_view('header_redirector')
bp.add_url_rule('/<path:scope_name>', view_func=header_redirector_view, methods=['get', ])
if no_doc:
bp.add_url_rule('/<path:scope_name>/', view_func=header_redirector_view, methods=['get', ])
return bp
def make_doc():
""" Only used for sphinx documentation """
doc_app = Flask(__name__)
doc_app.register_blueprint(blueprint(no_doc=False))
return doc_app
|
[
"rucio.web.rest.flaskapi.v1.common.check_accept_header_wrapper_flask",
"rucio.core.replica_sorter.sort_replicas",
"flask.Blueprint",
"flask.request.args.get",
"flask.request.headers.get",
"flask.redirect",
"flask.Flask",
"werkzeug.datastructures.Headers",
"rucio.core.replica_sorter.site_selector",
"flask.request.environ.get",
"rucio.api.replica.list_replicas",
"flask.request.args.getlist",
"rucio.web.rest.flaskapi.v1.common.generate_http_error_flask",
"rucio.web.rest.flaskapi.v1.common.extract_vo",
"itertools.chain"
] |
[((1712, 1776), 'rucio.web.rest.flaskapi.v1.common.check_accept_header_wrapper_flask', 'check_accept_header_wrapper_flask', (["['application/metalink4+xml']"], {}), "(['application/metalink4+xml'])\n", (1745, 1776), False, 'from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_name, try_stream, extract_vo, generate_http_error_flask, ErrorHandlingMethodView\n'), ((12548, 12603), 'flask.Blueprint', 'Blueprint', (['"""redirect"""', '__name__'], {'url_prefix': '"""/redirect"""'}), "('redirect', __name__, url_prefix='/redirect')\n", (12557, 12603), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((13171, 13186), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (13176, 13186), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((1353, 1362), 'werkzeug.datastructures.Headers', 'Headers', ([], {}), '()\n', (1360, 1362), False, 'from werkzeug.datastructures import Headers\n'), ((3700, 3767), 'flask.request.headers.get', 'request.headers.get', (['"""X-Forwarded-For"""'], {'default': 'request.remote_addr'}), "('X-Forwarded-For', default=request.remote_addr)\n", (3719, 3767), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((4158, 4198), 'flask.request.args.get', 'request.args.get', (['"""select"""'], {'default': 'None'}), "('select', default=None)\n", (4174, 4198), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((4216, 4256), 'flask.request.args.get', 'request.args.get', (['"""sort"""'], {'default': 'sortby'}), "('sort', default=sortby)\n", (4232, 4256), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((4297, 4324), 'rucio.web.rest.flaskapi.v1.common.extract_vo', 'extract_vo', (['request.headers'], {}), '(request.headers)\n', (4307, 4324), False, 'from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_name, try_stream, extract_vo, generate_http_error_flask, ErrorHandlingMethodView\n'), ((6797, 6806), 'werkzeug.datastructures.Headers', 'Headers', ([], {}), '()\n', (6804, 6806), False, 'from werkzeug.datastructures import Headers\n'), ((1414, 1448), 'flask.request.environ.get', 'request.environ.get', (['"""HTTP_ORIGIN"""'], {}), "('HTTP_ORIGIN')\n", (1433, 1448), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((1502, 1560), 'flask.request.environ.get', 'request.environ.get', (['"""HTTP_ACCESS_CONTROL_REQUEST_HEADERS"""'], {}), "('HTTP_ACCESS_CONTROL_REQUEST_HEADERS')\n", (1521, 1560), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((3815, 3856), 'flask.request.args.get', 'request.args.get', (['"""ip"""'], {'default': 'client_ip'}), "('ip', default=client_ip)\n", (3831, 3856), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((3878, 3916), 'flask.request.args.get', 'request.args.get', (['"""fqdn"""'], {'default': 'None'}), "('fqdn', default=None)\n", (3894, 3916), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((3938, 3976), 'flask.request.args.get', 'request.args.get', (['"""site"""'], {'default': 'None'}), "('site', default=None)\n", (3954, 3976), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((4055, 4086), 'flask.request.args.getlist', 'request.args.getlist', (['"""schemes"""'], {}), "('schemes')\n", (4075, 4086), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((4367, 4452), 'rucio.api.replica.list_replicas', 'list_replicas', ([], {'dids': 'dids', 'schemes': 'schemes', 'client_location': 'client_location', 'vo': 'vo'}), '(dids=dids, schemes=schemes, client_location=client_location,\n vo=vo)\n', (4380, 4452), False, 'from rucio.api.replica import list_replicas\n'), ((6858, 6892), 'flask.request.environ.get', 'request.environ.get', (['"""HTTP_ORIGIN"""'], {}), "('HTTP_ORIGIN')\n", (6877, 6892), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((6946, 7004), 'flask.request.environ.get', 'request.environ.get', (['"""HTTP_ACCESS_CONTROL_REQUEST_HEADERS"""'], {}), "('HTTP_ACCESS_CONTROL_REQUEST_HEADERS')\n", (6965, 7004), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((9123, 9190), 'flask.request.headers.get', 'request.headers.get', (['"""X-Forwarded-For"""'], {'default': 'request.remote_addr'}), "('X-Forwarded-For', default=request.remote_addr)\n", (9142, 9190), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((9600, 9644), 'flask.request.args.get', 'request.args.get', (['"""select"""'], {'default': '"""random"""'}), "('select', default='random')\n", (9616, 9644), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((9666, 9706), 'flask.request.args.get', 'request.args.get', (['"""sort"""'], {'default': 'sortby'}), "('sort', default=sortby)\n", (9682, 9706), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((9725, 9762), 'flask.request.args.get', 'request.args.get', (['"""rse"""'], {'default': 'None'}), "('rse', default=None)\n", (9741, 9762), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((9782, 9820), 'flask.request.args.get', 'request.args.get', (['"""site"""'], {'default': 'None'}), "('site', default=None)\n", (9798, 9820), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((10188, 10215), 'rucio.web.rest.flaskapi.v1.common.extract_vo', 'extract_vo', (['request.headers'], {}), '(request.headers)\n', (10198, 10215), False, 'from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_name, try_stream, extract_vo, generate_http_error_flask, ErrorHandlingMethodView\n'), ((3504, 3531), 'rucio.web.rest.flaskapi.v1.common.extract_vo', 'extract_vo', (['request.headers'], {}), '(request.headers)\n', (3514, 3531), False, 'from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_name, try_stream, extract_vo, generate_http_error_flask, ErrorHandlingMethodView\n'), ((3588, 3642), 'rucio.web.rest.flaskapi.v1.common.generate_http_error_flask', 'generate_http_error_flask', (['(400)', 'error'], {'headers': 'headers'}), '(400, error, headers=headers)\n', (3613, 3642), False, 'from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_name, try_stream, extract_vo, generate_http_error_flask, ErrorHandlingMethodView\n'), ((4931, 4971), 'itertools.chain', 'itertools.chain', (['(first,)', 'replicas_iter'], {}), '((first,), replicas_iter)\n', (4946, 4971), False, 'import itertools\n'), ((6618, 6672), 'rucio.web.rest.flaskapi.v1.common.generate_http_error_flask', 'generate_http_error_flask', (['(404)', 'error'], {'headers': 'headers'}), '(404, error, headers=headers)\n', (6643, 6672), False, 'from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_name, try_stream, extract_vo, generate_http_error_flask, ErrorHandlingMethodView\n'), ((8946, 8973), 'rucio.web.rest.flaskapi.v1.common.extract_vo', 'extract_vo', (['request.headers'], {}), '(request.headers)\n', (8956, 8973), False, 'from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_name, try_stream, extract_vo, generate_http_error_flask, ErrorHandlingMethodView\n'), ((9030, 9084), 'rucio.web.rest.flaskapi.v1.common.generate_http_error_flask', 'generate_http_error_flask', (['(400)', 'error'], {'headers': 'headers'}), '(400, error, headers=headers)\n', (9055, 9084), False, 'from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_name, try_stream, extract_vo, generate_http_error_flask, ErrorHandlingMethodView\n'), ((9246, 9287), 'flask.request.args.get', 'request.args.get', (['"""ip"""'], {'default': 'client_ip'}), "('ip', default=client_ip)\n", (9262, 9287), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((9313, 9351), 'flask.request.args.get', 'request.args.get', (['"""fqdn"""'], {'default': 'None'}), "('fqdn', default=None)\n", (9329, 9351), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((9377, 9415), 'flask.request.args.get', 'request.args.get', (['"""site"""'], {'default': 'None'}), "('site', default=None)\n", (9393, 9415), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((9520, 9551), 'flask.request.args.getlist', 'request.args.getlist', (['"""schemes"""'], {}), "('schemes')\n", (9540, 9551), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((10262, 10391), 'rucio.api.replica.list_replicas', 'list_replicas', ([], {'dids': "[{'scope': scope, 'name': name, 'type': 'FILE'}]", 'schemes': 'schemes', 'client_location': 'client_location', 'vo': 'vo'}), "(dids=[{'scope': scope, 'name': name, 'type': 'FILE'}],\n schemes=schemes, client_location=client_location, vo=vo)\n", (10275, 10391), False, 'from rucio.api.replica import list_replicas\n'), ((12198, 12230), 'flask.redirect', 'redirect', (['selected_url'], {'code': '(303)'}), '(selected_url, code=303)\n', (12206, 12230), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((12454, 12508), 'rucio.web.rest.flaskapi.v1.common.generate_http_error_flask', 'generate_http_error_flask', (['(404)', 'error'], {'headers': 'headers'}), '(404, error, headers=headers)\n', (12479, 12508), False, 'from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_name, try_stream, extract_vo, generate_http_error_flask, ErrorHandlingMethodView\n'), ((5970, 6031), 'rucio.core.replica_sorter.sort_replicas', 'sort_replicas', (['dictreplica', 'client_location'], {'selection': 'sortby'}), '(dictreplica, client_location, selection=sortby)\n', (5983, 6031), False, 'from rucio.core.replica_sorter import site_selector, sort_replicas\n'), ((9935, 9969), 'flask.request.environ.get', 'request.environ.get', (['"""REQUEST_URI"""'], {}), "('REQUEST_URI')\n", (9954, 9969), False, 'from flask import Flask, Blueprint, request, redirect\n'), ((11683, 11719), 'rucio.core.replica_sorter.site_selector', 'site_selector', (['dictreplica', 'site', 'vo'], {}), '(dictreplica, site, vo)\n', (11696, 11719), False, 'from rucio.core.replica_sorter import site_selector, sort_replicas\n'), ((12029, 12090), 'rucio.core.replica_sorter.sort_replicas', 'sort_replicas', (['dictreplica', 'client_location'], {'selection': 'sortby'}), '(dictreplica, client_location, selection=sortby)\n', (12042, 12090), False, 'from rucio.core.replica_sorter import site_selector, sort_replicas\n')]
|
"""
Celery base task aimed at longish-running jobs that return a result.
``AwesomeResultTask`` adds thundering herd avoidance, result caching, progress
reporting, error fallback and JSON encoding of results.
"""
from __future__ import division
import logging
import simplejson
import time
from contextlib import contextmanager
from hashlib import md5
from uuid import uuid4
from celery import states
from celery.backends import default_backend
from celery.task import Task
from celery.result import BaseAsyncResult
from celery.signals import task_prerun, task_postrun
from djcelery.models import TaskMeta
from johnny.middleware import QueryCacheMiddleware, LocalStoreClearMiddleware
from django.conf import settings
from django.core.cache import cache
def task_prerun_handler(*args, **kwargs):
"""
Before each Task is ran, we have to instantiate Johnny's query cache
monkey patch. This will make sure that any table writes invalidate table
caches, and reads pull from any existing caches.
"""
QueryCacheMiddleware()
task_prerun.connect(task_prerun_handler)
def task_postrun_handler(*args, **kwargs):
"""
After each task is ran, the LocalStore cache (similar to threadlocals) is
cleared, as is the case with views (instead of celery tasks).
"""
clear_middleware = LocalStoreClearMiddleware()
clear_middleware.process_response(None, None)
task_postrun.connect(task_postrun_handler)
@contextmanager
def acquire_lock(lock_name):
for _ in range(10):
try:
value = cache.incr(lock_name)
except ValueError:
cache.set(lock_name, 0)
value = cache.incr(lock_name)
if value == 1:
break
else:
cache.decr(lock_name)
else:
yield
cache.set(lock_name, 0)
return
yield
cache.decr(lock_name)
def get_task_meta_error(exception):
"""
Take an exception and turn it in to a Celery result tombstone that mimics
what would happen if that error were thrown during a Task run.
This is copy/pasted from pstat.core.utils
"""
# Need to return an object that has a uuid attribute, and need to store the
# result in the cache
fake_result = TaskMeta()
task_id = str(uuid4())
fake_result.task_id = task_id
default_backend.store_result(task_id, exception, status=states.FAILURE)
return fake_result
class AwesomeResultTask(Task):
"""
A base ``Celery.Task`` class that provides some common niceties for running
tasks that return some kind of result for which you need to wait.
To create a task that uses these helpers, use ``AwesomeResultTask`` as a
subclass and define a ``calculate_result`` method which returns a
dictionary to be turned in to JSON. You will also need to define the
following class variables:
* ``cache_prefix`` A unique string representing this task. Eg.
``foo.bar.tasks.BazzTask``
* ``significant_kwargs`` The kwarg values that will be converted to strings
and hashed to determine if two versions of the same task are equivelent.
This is a list of 2-tuples with the first item being the kwarg string and
the second being a callable that converts the value to a hashable string.
If no second item is given, it's assumed that calling ``str()`` on the
value works just fine.
* ``herd_avoidance_timeout`` Number of seconds to hold a lock on this task
for other equivelant runs. Generally, this should be set to the longest
estimated amount of time the task could consume.
* ``cache_duration`` The number of seconds for which the result of this
task should be cached, meaning subsequent equivelant runs will skip
computation. Set this to ``-1`` to disable caching.
Provided are helpers for:
1. Handling failures to connect the task broker by either directly
running the task (`delay_or_run`) or by returning a task that
contains the connection error (`delay_or_fail`). This minimizes
the user-facing impact of a dead task broker.
2. Defeating any thundering herd issues by ensuring only one of a task with
specific arguments can be running at a time by directing subsequent calls
to latch on to the appropriate result.
3. Caching the final result for a designated time period so that subsequent
equivelant calls return quickly.
4. Returning the results as JSON, so that they can be processed easily by
client-side javascript.
5. Returning time-based, continually updating progress estimates to
front-end code so that users know what to expect.
"""
def delay_or_run(self, *args, **kwargs):
"""
Attempt to call self.delay, or if that fails, call self.run.
Returns a tuple, (result, fallback). ``result`` is the result of
calling delay or run. ``fallback`` is a boolean that is True when
self.run was called instead of self.delay.
"""
try:
result = self.delay(*args, **kwargs)
fallback = False
except IOError:
result = self.run(*args, **kwargs)
fallback = True
return result, fallback
def delay_or_fail(self, *args, **kwargs):
"""
Attempt to call self.delay, but if that fails with an exception, we
fake the task completion using the exception as the result. This allows
us to seamlessly handle errors on task creation the same way we handle
errors when a task runs, simplifying the user interface.
Returns a ``TaskMeta`` object that is either the result of calling
delay or the faked task result.
"""
try:
return self.delay(*args, **kwargs)
except IOError as e:
return get_task_meta_error(e)
def delay(self, *args, **kwargs):
"""
Put this task on the Celery queue as a singleton. Only one of this type
of task with its distinguishing args/kwargs will be allowed on the
queue at a time. Subsequent duplicate tasks called while this task is
still running will just latch on to the results of the running task by
synchronizing the task uuid. Additionally, identical task calls will
return those results for the next ``cache_duration`` seconds.
Passing a ``cache_duration`` keyword argument controls how long
identical task calls will latch on to previously cached results.
"""
self._validate_required_class_vars()
cache_key = self._get_cache_key(**kwargs)
# Check for an already-computed and cached result
task_id = cache.get(cache_key) # Check for the cached result
if task_id:
# We've already built this result, just latch on to the task that
# did the work
logging.info(
'Found existing cached and completed task: %s', task_id)
return BaseAsyncResult(task_id, self.backend)
# Check for an in-progress equivelant task to avoid duplicating work
task_id = cache.get('herd:%s' % cache_key)
if task_id:
logging.info('Found existing in-progress task: %s', task_id)
return BaseAsyncResult(task_id, self.backend)
# It's not cached and it's not already running. Use an atomic lock to
# start the task, ensuring there isn't a race condition that could
# result in multiple identical tasks being fired at once.
with acquire_lock('lock:%s' % cache_key):
task_meta = super(AwesomeResultTask, self).delay(
*args, **kwargs)
logging.info('Current status: %s', task_meta.status)
if task_meta.status in ['PROGRESS', 'PENDING']:
cache.set(
'herd:%s' % cache_key,
task_meta.task_id,
timeout=self.herd_avoidance_timeout)
logging.info(
'Setting herd-avoidance cache for task: %s', cache_key)
return task_meta
def calc_progress(self, completed_count, total_count):
"""
Calculate the percentage progress and estimated remaining time based on
the current number of items completed of the total.
Returns a tuple of ``(percentage_complete, seconds_remaining)``.
"""
self.logger.debug(
"calc_progress(%s, %s)",
completed_count,
total_count,
)
current_time = time.time()
time_spent = current_time - self.start_time
self.logger.debug("Progress time spent: %s", time_spent)
if total_count == 0:
return 100, 1
completion_fraction = completed_count / total_count
if completion_fraction == 0:
completion_fraction = 1
total_time = 0
total_time = time_spent / completion_fraction
time_remaining = total_time - time_spent
completion_display = completion_fraction * 100
if completion_display == 100:
return 100, 1 # 1 second to finish up
return completion_display, time_remaining
def update_progress(self, completed_count, total_count):
"""
Update the task backend with both an estimated percentage complete and
number of seconds remaining until completion.
``completed_count`` Number of task "units" that have been completed out
of ``total_count`` total "units."
"""
# Store progress for display
progress_percent, time_remaining = self.calc_progress(
completed_count, total_count)
self.logger.info(
"Updating progress: %s percent, %s remaining",
progress_percent,
time_remaining)
self.backend.store_result(
self.task_id,
result={
"progress_percent": progress_percent,
"time_remaining": time_remaining,
},
status="PROGRESS")
def run(self, *args, **kwargs):
self.logger = self.get_logger(**kwargs)
self.logger.info("Starting %s", self.__class__.__name__)
self.cache_key = self._get_cache_key(**kwargs)
# Record start time to give estimated time remaining estimates
self.start_time = time.time()
# Report to the backend that work has been started.
self.task_id = kwargs.get('task_id', None)
self.backend.store_result(
self.task_id,
result={
"progress_percent": 0,
"time_remaining": -1,
},
status="PROGRESS",
)
self.logger.info("Calculating result")
try:
result = self.calculate_result(*args, **kwargs)
except Exception:
# Don't want other tasks waiting for this task to finish, since it
# won't
self._break_thundering_herd_cache()
raise # We can use normal celery exception handling for this
self.logger.info("Serializing result")
json_result = simplejson.dumps(result)
if self.cache_duration >= 0:
# If we're configured to cache this result, do so.
cache.set(self.cache_key, self.task_id, self.cache_duration)
# Now that the task is finished, we can stop all of the thundering herd
# avoidance
self._break_thundering_herd_cache()
return json_result
def _validate_required_class_vars(self):
"""
Ensure that this subclass has defined all of the required class
variables.
"""
required_members = [
'cache_prefix',
'significant_kwargs',
'herd_avoidance_timeout',
'cache_duration',
]
for required_member in required_members:
if not hasattr(self, required_member):
raise Exception(
"AwesomeResultTask's must define a %s" % required_member)
def on_success(self, retval, task_id, args, kwargs):
"""
Store results in the backend even if we're always eager. This helps for
testing.
"""
if getattr(settings, 'CELERY_ALWAYS_EAGER', False):
# Store the result because celery wouldn't otherwise
self.backend.store_result(task_id, retval, status=states.SUCCESS)
def _break_thundering_herd_cache(self):
cache.delete('herd:%s' % self.cache_key)
def _get_cache_key(self, **kwargs):
"""
Take this task's configured ``significant_kwargs`` and build a hash
that all equivelant task calls will match.
Takes in kwargs and returns a string.
To change the way the cache key is generated or do more in-depth
processing, override this method.
"""
m = md5()
for significant_kwarg in self.significant_kwargs:
key, to_str = significant_kwarg
m.update(to_str(kwargs[key]))
return '%s:%s' % (self.cache_prefix, m.hexdigest())
|
[
"djcelery.models.TaskMeta",
"uuid.uuid4",
"hashlib.md5",
"johnny.middleware.LocalStoreClearMiddleware",
"django.core.cache.cache.set",
"celery.signals.task_prerun.connect",
"simplejson.dumps",
"django.core.cache.cache.incr",
"django.core.cache.cache.get",
"time.time",
"logging.info",
"celery.result.BaseAsyncResult",
"johnny.middleware.QueryCacheMiddleware",
"django.core.cache.cache.delete",
"celery.backends.default_backend.store_result",
"celery.signals.task_postrun.connect",
"django.core.cache.cache.decr"
] |
[((1046, 1086), 'celery.signals.task_prerun.connect', 'task_prerun.connect', (['task_prerun_handler'], {}), '(task_prerun_handler)\n', (1065, 1086), False, 'from celery.signals import task_prerun, task_postrun\n'), ((1393, 1435), 'celery.signals.task_postrun.connect', 'task_postrun.connect', (['task_postrun_handler'], {}), '(task_postrun_handler)\n', (1413, 1435), False, 'from celery.signals import task_prerun, task_postrun\n'), ((1023, 1045), 'johnny.middleware.QueryCacheMiddleware', 'QueryCacheMiddleware', ([], {}), '()\n', (1043, 1045), False, 'from johnny.middleware import QueryCacheMiddleware, LocalStoreClearMiddleware\n'), ((1315, 1342), 'johnny.middleware.LocalStoreClearMiddleware', 'LocalStoreClearMiddleware', ([], {}), '()\n', (1340, 1342), False, 'from johnny.middleware import QueryCacheMiddleware, LocalStoreClearMiddleware\n'), ((1841, 1862), 'django.core.cache.cache.decr', 'cache.decr', (['lock_name'], {}), '(lock_name)\n', (1851, 1862), False, 'from django.core.cache import cache\n'), ((2233, 2243), 'djcelery.models.TaskMeta', 'TaskMeta', ([], {}), '()\n', (2241, 2243), False, 'from djcelery.models import TaskMeta\n'), ((2310, 2381), 'celery.backends.default_backend.store_result', 'default_backend.store_result', (['task_id', 'exception'], {'status': 'states.FAILURE'}), '(task_id, exception, status=states.FAILURE)\n', (2338, 2381), False, 'from celery.backends import default_backend\n'), ((1788, 1811), 'django.core.cache.cache.set', 'cache.set', (['lock_name', '(0)'], {}), '(lock_name, 0)\n', (1797, 1811), False, 'from django.core.cache import cache\n'), ((2262, 2269), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (2267, 2269), False, 'from uuid import uuid4\n'), ((6674, 6694), 'django.core.cache.cache.get', 'cache.get', (['cache_key'], {}), '(cache_key)\n', (6683, 6694), False, 'from django.core.cache import cache\n'), ((7104, 7136), 'django.core.cache.cache.get', 'cache.get', (["('herd:%s' % cache_key)"], {}), "('herd:%s' % cache_key)\n", (7113, 7136), False, 'from django.core.cache import cache\n'), ((8524, 8535), 'time.time', 'time.time', ([], {}), '()\n', (8533, 8535), False, 'import time\n'), ((10330, 10341), 'time.time', 'time.time', ([], {}), '()\n', (10339, 10341), False, 'import time\n'), ((11107, 11131), 'simplejson.dumps', 'simplejson.dumps', (['result'], {}), '(result)\n', (11123, 11131), False, 'import simplejson\n'), ((12455, 12495), 'django.core.cache.cache.delete', 'cache.delete', (["('herd:%s' % self.cache_key)"], {}), "('herd:%s' % self.cache_key)\n", (12467, 12495), False, 'from django.core.cache import cache\n'), ((12863, 12868), 'hashlib.md5', 'md5', ([], {}), '()\n', (12866, 12868), False, 'from hashlib import md5\n'), ((1540, 1561), 'django.core.cache.cache.incr', 'cache.incr', (['lock_name'], {}), '(lock_name)\n', (1550, 1561), False, 'from django.core.cache import cache\n'), ((1734, 1755), 'django.core.cache.cache.decr', 'cache.decr', (['lock_name'], {}), '(lock_name)\n', (1744, 1755), False, 'from django.core.cache import cache\n'), ((6863, 6932), 'logging.info', 'logging.info', (['"""Found existing cached and completed task: %s"""', 'task_id'], {}), "('Found existing cached and completed task: %s', task_id)\n", (6875, 6932), False, 'import logging\n'), ((6969, 7007), 'celery.result.BaseAsyncResult', 'BaseAsyncResult', (['task_id', 'self.backend'], {}), '(task_id, self.backend)\n', (6984, 7007), False, 'from celery.result import BaseAsyncResult\n'), ((7169, 7229), 'logging.info', 'logging.info', (['"""Found existing in-progress task: %s"""', 'task_id'], {}), "('Found existing in-progress task: %s', task_id)\n", (7181, 7229), False, 'import logging\n'), ((7249, 7287), 'celery.result.BaseAsyncResult', 'BaseAsyncResult', (['task_id', 'self.backend'], {}), '(task_id, self.backend)\n', (7264, 7287), False, 'from celery.result import BaseAsyncResult\n'), ((7665, 7717), 'logging.info', 'logging.info', (['"""Current status: %s"""', 'task_meta.status'], {}), "('Current status: %s', task_meta.status)\n", (7677, 7717), False, 'import logging\n'), ((11245, 11305), 'django.core.cache.cache.set', 'cache.set', (['self.cache_key', 'self.task_id', 'self.cache_duration'], {}), '(self.cache_key, self.task_id, self.cache_duration)\n', (11254, 11305), False, 'from django.core.cache import cache\n'), ((1601, 1624), 'django.core.cache.cache.set', 'cache.set', (['lock_name', '(0)'], {}), '(lock_name, 0)\n', (1610, 1624), False, 'from django.core.cache import cache\n'), ((1645, 1666), 'django.core.cache.cache.incr', 'cache.incr', (['lock_name'], {}), '(lock_name)\n', (1655, 1666), False, 'from django.core.cache import cache\n'), ((7794, 7887), 'django.core.cache.cache.set', 'cache.set', (["('herd:%s' % cache_key)", 'task_meta.task_id'], {'timeout': 'self.herd_avoidance_timeout'}), "('herd:%s' % cache_key, task_meta.task_id, timeout=self.\n herd_avoidance_timeout)\n", (7803, 7887), False, 'from django.core.cache import cache\n'), ((7960, 8028), 'logging.info', 'logging.info', (['"""Setting herd-avoidance cache for task: %s"""', 'cache_key'], {}), "('Setting herd-avoidance cache for task: %s', cache_key)\n", (7972, 8028), False, 'import logging\n')]
|
from __future__ import print_function, division
"""
@ About :
@ Author : <NAME>
@ ref. : https://labrosa.ee.columbia.edu/matlab/rastamat/
"""
import warnings
import librosa
import scipy.fftpack as fft
import numpy as np
import spectrum
from scipy import signal
def specgram(x, nfft=256, fs=8000, window=np.array([]), overlap=None):
"""
input:
x - input audio_array
nfft - # fft points [default : 256]
fs - sampling frequency [default : 8000]
window - window to FFT analysis [default : hanning(nfft)]
overlap - overlap for FFT analysis ( overlap = window_length - hop_length ) [default : nfft/2]
"""
nsamples = x.shape[0]
if type(window) == int:
window = np.hanning(window)
if overlap == None:
overlap = np.ceil(nfft/2).astype(int)
if window.shape[0] == 0:
window = np.hanning(nfft);
if (nsamples <= nfft):
raise AssertionError("expected nframes > nfft.")
# compute window offsets
win_size = window.shape[0];
if win_size > nfft:
nfft = win_size
warnings.warn("fft points adjusted to win_size as win_size > nfft")
win_step = win_size - overlap
# build matrix of windowed data slices
offset = list(range(0,(nsamples-win_size), win_step))
npad = (nsamples - offset[-1])+1
if npad > 0:
x = np.concatenate((x,np.zeros(npad)))
S = []
for i in offset:
S.append((x[i:i+win_size]*window)[np.newaxis,:])
S=np.concatenate(S)
S = np.fft.fft(S,nfft)
# extract the positive frequency components
ret_n = int(nfft/2);
if nfft%2==1:
ret_n = int((nfft+1)/2);
S = S[:, 0:ret_n];
f = np.array(range(ret_n))*fs/nfft;
t = np.array(offset)/fs;
return (S, f, t)
def powspec(x, fs = 8000,
winlen_in_sec = 0.025, hoplen_in_sec = 0.010,
dither = 0
):
"""
pow_spec, e = powspec(x, sr, winlen_in_sec, hoplen_in_sec, dither)
where x : audio array
sr : sampling rate
winlen_in_sec : window length for audio analysis ()
compute the powerspectrum and frame energy of the input signal.
basically outputs a power spectrogram
each column represents a power spectrum for a given frame
each row represents a frequency
"""
# sec2sample
win_length = int(np.round(winlen_in_sec * fs))
hop_length = int(np.round(hoplen_in_sec * fs))
# next power of two of window length is NFFT
nfft = int(np.power(2, np.ceil(np.log2(winlen_in_sec * fs))))
specgm,f,t = specgram(x, nfft=nfft, fs=fs, overlap = win_length-hop_length, window=np.hamming(win_length))
pow_spec = np.power(np.abs(specgm), 2)
if dither:
pow_spec = np.add(pow_spec, win_length)
# Calculate log energy - after windowing
e = np.log(np.sum(pow_spec, axis = 0))
return pow_spec, e
def hz2bark(f):
"""
@About: Converts frequencies Hertz (Hz) to Bark
It uses;
Traunmueller-formula for f > 200 Hz
linear mapping for f <= 200 Hz
z_gt_200 = 26.81 .* f ./ (1960 + f) - 0.53;
z_le_200 = f ./ 102.9;
z = (f>200) .* z_gt_200 + (f<=200) .* z_le_200;
@ Author: Kyrill, Oct. 1996
Kyrill, March 1997 (linear mapping added)
"""
# Inverse of Hynek's formula (see bark2hz)
# z = 6 * log(f/600 + sqrt(1+ ((f/600).^2)));
# z = 6 * asinh(f/600); # (matlab equivalent)
z = np.multiply(6.0, np.arcsinh(np.divide(f, 600.0)))
return z
def bark2hz(z):
"""
@Author: Converts frequencies Bark to Hertz (Hz)
It uses;
Traunmueller-formula for z > 2 Bark
linear mapping for z <= 2 Bark
hz_gt_2 = 1960 .* (z + 0.53) ./ (26.28 - z);
hz_le_2 = z .* 102.9;
hz = (z>2) .* hz_gt_2 + (z<=2) .* hz_le_2;
@Author: Kyrill, Oct. 1996
Kyrill, March 1997 (linear mapping added)
"""
hz = np.multiply(600.0, np.sinh(np.divide(z, 6.0)))
return hz
def fft2barkmx(
nfft, sr, nfilts = 0,
band_width = 1, min_freq = 0.0,
max_freq = 0.0
):
"""
@About: Generate a matrix of weights to combine FFT bins into Bark bins
weights = fft2barkmx(nfft, sr, nfilts, width, minfreq, maxfreq)
where, nfft : source FFT size
sr : sampling frequency (Hz)
nfilts : number of output bands required (else per one bark).
band_width : a constant width of each band in Bark
weights : It nfft columns, the second half are all zero.
Note: Bark spectrum is fft2barkmx(nfft,sr)*abs(fft(xincols,nfft));
2004-09-05 <EMAIL> based on rastamat/audspec.m
"""
if max_freq == 0:
max_freq = sr / 2.0
min_bark = hz2bark(min_freq)
nyqbark = hz2bark(max_freq) - min_bark
if nfilts == 0 :
nfilts = np.add(np.ceil(nyqbark), 1)
weights = np.zeros((int(nfilts), int(nfft)))
step_barks = np.divide(nyqbark, np.subtract(nfilts, 1))
binbarks = hz2bark(np.multiply(np.arange(0, np.add(np.divide(nfft, 2),1)), np.divide(sr, nfft)))
for i in range (int(nfilts)):
f_bark_mid = min_bark + np.multiply(i, step_barks)
# Linear slopes in log-space (i.e. dB) intersect to trapezoidal window
lof = np.subtract(np.subtract(binbarks, f_bark_mid), 0.5)
hif = np.add(np.subtract(binbarks, f_bark_mid), 0.5)
weights[i, 0 : int(nfft / 2) + 1] = np.power(10, np.minimum(0, np.divide(np.minimum(hif, np.multiply(-2.5, lof)), band_width)))
return weights
def rastafilt(x):
"""
y = rastafilt(x)
xrow, xcol = x.shape()
where, x : input signal
xrow : critical bands
xcol : no of frames
y : rasta filtered signal
"""
# rasta filter
numer = np.arange(-2, 3)
numer = np.divide(-1.0*numer,sum(np.power(numer,2)))
denom = np.array([1, -0.94])
"""
Initialize the state.
This avoids a big spike at the beginning resulting from the dc offset level in each band.
"""
zi = signal.lfilter_zi(numer,1)
y = np.zeros((x.shape))
for i in range(x.shape[0]):
# FIR for initial state response compuation
y1, zi = signal.lfilter(numer, 1, x[i, 0:4], axis = 0, zi = zi * x[i, 0])
y1 = y1*0
# IIR
y2, _ = signal.lfilter(numer, denom, x[i, 4:x.shape[1]], axis = 0, zi = zi)
y[i, :] = np.append(y1, y2)
return y
def dolpc(x, modelorder = 8):
"""
y = dolpc(x,modelorder)
@About: compute autoregressive model from spectral magnitude samples
where, x : input signal
row_x, col_x = x.shape()
row_x : critical band
col_y : nframes
modelorder : order of model, defaults to 8
y : lpc coeff.
row_y, col_y = y.shape()
row_y :
"""
nbands, nframes = x.shape
ncorr = 2 * (nbands - 1)
# @TO-DO : This need optimisation
R = np.zeros((ncorr, nframes))
R[0:nbands, :] = x
for i in range(nbands - 1):
R[i + nbands - 1, :] = x[nbands - (i + 1), :]
# Calculate autocorrelation
r = fft.ifft(R.T).real.T
# First half only
r = r[0:nbands, :]
y = np.ones((nframes, modelorder + 1))
e = np.zeros((nframes, 1))
# Find LPC coeffs by durbin
if modelorder == 0:
for i in range(nframes):
_ , e_tmp, _ = spectrum.LEVINSON(r[:, i], modelorder, allow_singularity = True)
e[i, 0] = e_tmp
else:
for i in range(nframes):
y_tmp, e_tmp, _ = spectrum.LEVINSON(r[:, i], modelorder, allow_singularity = True)
y[i, 1:modelorder + 1] = y_tmp
e[i, 0] = e_tmp
# Normalize each poly by gain
y = np.divide(y.T, np.add(np.tile(e.T, (modelorder + 1, 1)), 1e-8))
return y
def lpc2cep(a, nout = 0):
"""
cep = lpc2cep(lpcas,nout)
where, lpcas = lp coeff.
nout = number of cepstra to produce, defaults to size(lpcas,1)
"""
nin, ncol = a.shape
order = nin - 1
if nout == 0:
nout = order + 1
# First cep is log(Error) from Durbin
cep = np.zeros((nout, ncol))
cep[0, :] = -np.log(a[0, :])
# Renormalize lpc A coeffs
norm_a = np.divide(a, np.add(np.tile(a[0, :], (nin, 1)), 1e-8))
for n in range(1, nout):
sum = 0
for m in range(1, n):
sum = np.add(sum, np.multiply(np.multiply((n - m), norm_a[m, :]), cep[(n - m), :]))
cep[n, :] = -np.add(norm_a[n, :], np.divide(sum, n))
return cep
def lifter(x, lift = 0.6, invs = False):
"""
@About : Apply lifter to matrix of cepstra
y = lifter(x, lift, invs)
lift = exponent of x i^n liftering or, as a negative integer, the length of HTK-style sin-curve liftering.
If inverse == True (default False), undo the liftering.
"""
ncep = x.shape[0]
if lift == 0:
y = x
else:
if lift < 0:
warnings.warn('HTK liftering does not support yet; default liftering')
lift = 0.6
lift_weights = np.power(np.arange(1, ncep), lift)
lift_weights = np.append(1, lift_weights)
if (invs):
lift_weights = np.divide(1, lift_weights)
y = np.matmul(np.diag(lift_weights), x)
return y
def hz2mel(f, htk = False):
"""
@About : Convert frequencies in Hz to mel 'scale'.
z = hz2mel(f,htk)
where, f : frequency in Hz
htk : True uses the mel axis defined in the HTKBook otherwise use Slaney's formula
"""
if htk:
z = np.multiply(2595, np.log10(np.add(1, np.divide(f, 700))))
else:
f_0 = 0.0 # 133.33333;
f_sp = 200.0 / 3 # 66.66667;
brkfrq = 1000.0
# starting mel value for log region
brkpt = (brkfrq - f_0) / f_sp
# the magic 1.0711703 which is the ratio needed to get from 1000 Hz to 6400 Hz in 27 steps, and is *almost* the ratio between 1000 Hz and the preceding linear filter center at 933.33333 Hz (actually 1000/933.33333 = 1.07142857142857 and exp(log(6.4)/27) = 1.07117028749447)
logstep = np.exp(np.log(6.4) / 27.0)
f = np.array(f, ndmin = 1)
z = np.zeros((f.shape[0], ))
# fill in parts separately
for i in range(f.shape[0]):
if f[i] < brkpt:
z[i] = (f[i] - f_0) / f_sp
else:
z[i] = brkpt + (np.log(f[i] / brkfrq) / np.log(logstep))
return z
def mel2hz(z, htk = False):
"""
@About : Converts 'mel scale' into Frequency in Hz
f = mel2hz(z, htk)
where, z : frequency in mel scale
htk : "True" means use the HTK formula else use the formula from Slaney's mfcc
f : frequency in Hz
"""
if htk:
f = np.multiply(700, np.subtract(np.power(10, np.divide(z, 2595)), 1))
else:
f_0 = 0.0 # 133.33333;
f_sp = 200.0/3 # 66.66667;
brkfrq = 1000.0
brkpt = (brkfrq - f_0) / f_sp # starting mel value for log region
logstep = np.exp(np.log(6.4) / 27.0) # the magic 1.0711703 which is the ratio needed to get from 1000 Hz to 6400 Hz in 27 steps, and is *almost* the ratio between 1000 Hz and the preceding linear filter center at 933.33333 Hz (actually 1000/933.33333 = 1.07142857142857 and exp(log(6.4)/27) = 1.07117028749447)
z = np.array(z, ndmin = 1)
f = np.zeros((z.shape[0], ))
# fill in parts separately
for i in range(z.shape[0]):
if z[i] < brkpt:
f[i] = f_0 + f_sp * z[i]
else:
f[i] = brkfrq * np.exp(np.log(logstep) * (z[i] - brkpt))
return f
def fft2melmx(
nfft, sr=8000, nfilts = 0,
band_width = 1, min_freq = 0.0,
max_freq = 0.0, htkmel = False,
constamp = False
):
"""
@About : Generate a matrix of weights to combine FFT bins into Mel
bins.
[weights, binfrqs] = fft2melmx(nfft, sr, nfilts, width, min_freq, max_freq, htkmel, constamp)
where, nfft : no of FFT point considered for given sampling rate.
sr : sampling rate.
nfilts : number of output bands required (else one per "mel/width")
width : the constant width of each band relative to standard Mel (default 1).
minfrq : frequency (in Hz) of the lowest band edge;
maxfrq : frequency (in Hz) of upper edge; default sr/2.
htkmel : "True" means use HTK's version of the mel curve, not Slaney's.
constamp : "True" means make integration windows peak at 1, not sum to 1.
weights : output model weights. weight has nfft columns, the second half are all zero.
binfrqs : returns bin center frequencies.
Note: You can exactly duplicate the mel matrix in Slaney's mfcc.m
as fft2melmx(512, 8000, 40, 1, 133.33, 6855.5, 0);
"""
if nfilts == 0 :
nfilts = np.ceil(hz2mel(max_freq, htkmel) / 2)
if max_freq == 0:
max_freq = sr / 2.0
weights = np.zeros((int(nfilts), int(nfft)))
# Center freqs of each FFT bin
fftfrqs = np.multiply(np.divide(np.arange(0,nfft / 2 + 1), nfft), sr)
# 'Center freqs' of mel bands - uniformly spaced between limits
min_mel = hz2mel(min_freq, htkmel)
max_mel = hz2mel(max_freq, htkmel)
binfrqs = mel2hz(np.add(min_mel, np.multiply(np.arange(0, nfilts + 2),
(max_mel - min_mel) / (nfilts + 1))), htkmel)
for i in range (int(nfilts)):
freq_tmp = binfrqs[np.add(np.arange(0,3), i)]
# scale by width
freq_tmp = np.add(freq_tmp[1], np.multiply(band_width, np.subtract(freq_tmp, freq_tmp[1])))
# lower and upper slopes for all bins
loslope = np.divide(np.subtract(fftfrqs, freq_tmp[0]), np.subtract(freq_tmp[1], freq_tmp[0]))
hislope = np.divide(np.subtract(freq_tmp[2], fftfrqs), np.subtract(freq_tmp[2], freq_tmp[1]))
weights[i, 0 : int(nfft / 2) + 1] = np.maximum(0, np.minimum(loslope, hislope))
if constamp == False:
# Slaney-style mel is scaled to be approx constant E per channel
weights = np.matmul(np.diag(np.divide(2, np.subtract(binfrqs[2 : int(nfilts) + 2],
binfrqs[0 : int(nfilts)]))), weights)
return weights, binfrqs
def audspec(p_spectrum,
fs = 8000, nfilts = 0, fbtype = 'bark',
min_freq = 0, max_freq = 0, sumpower = 1,
band_width = 1
):
"""
@About: Performs critical band analysis on power spectrogram (see PLP)
[aspectrum,weights] = audspec(pspectrum, sr, nfilts, fbtype, minfreq, maxfreq, sumpower, bwidth)
where, pspectrum : power spectrogram
sr : sampling frequency
nfilts : number of output bands required
fbtype : filterbank type
minfrq : frequency (in Hz) of the lowest band edge;
maxfrq : frequency (in Hz) of upper edge; default sr/2.
sumpower :
band_width : the constant width of each band relative to standard Mel (default 1).
aspectrum : spectrogram aftar band analysis
weight : output model weights
"""
if nfilts == 0:
np.add(np.ceil(hz2bark(fs / 2)), 1)
if max_freq == 0:
max_freq = fs / 2
nframes, nfreqs = p_spectrum.shape
# print("nfreq: ", nfreqs, p_spectrum.shape, type(nfreqs))
nfft = (int(nfreqs) - 1) * 2
weights = None
binfrqs = None
if fbtype == 'bark':
weights = fft2barkmx(nfft, fs, nfilts, band_width, min_freq, max_freq)
elif fbtype == 'mel':
weights,binfrqs = fft2melmx(nfft, fs, nfilts, band_width, min_freq, max_freq)
elif fbtype == 'htkmel':
weights,binfrqs = fft2melmx(nfft, fs, nfilts, band_width, min_freq, max_freq, htkmel = True, constamp = True)
elif fbtype == 'fcmel':
weights,binfrqs = fft2melmx(nfft, fs, nfilts, band_width, min_freq, max_freq, htkmel = True, constamp = False)
else:
raise TypeError("fbtype is not recognised. choose from 'bark', 'mel', 'htkmel', 'fcmel'")
weights = weights[:, 0 : nfreqs]
# Integrate FFT bins into Mel bins, in abs or abs^2 domains:
if sumpower:
aspectrum = weights.dot(p_spectrum.T).T
else:
aspectrum = np.power(weights.dot(np.sqrt(p_spectrum.T)).T, 2)
return aspectrum, weights
def postaud(x, fmax, fbtype = 'bark', broaden = 0):
nbands, nframes = x.shape
# print("postaud :: ",nbands, nframes)
nfpts = int(nbands + 2 * broaden)
if fbtype == 'bark':
bandcfhz = bark2hz(np.linspace(0, hz2bark(fmax), nfpts))
elif fbtype == 'mel':
bandcfhz = mel2hz(np.linspace(0, hz2mel(fmax), nfpts))
elif fbtype == 'htkmel' or fbtype == 'fcmel':
bandcfhz = mel2hz(np.linspace(0, hz2mel(fmax, htk = True), nfpts), htk = True)
bandcfhz = bandcfhz[broaden : (nfpts - broaden)]
# Hynek's magic equal-loudness-curve formula
fsq = np.power(bandcfhz, 2)
ftmp = np.add(fsq, 1.6e5)
eql = np.multiply(np.power(np.divide(fsq, ftmp), 2), np.divide(np.add(fsq, 1.44e6), np.add(fsq, 9.61e6)))
# weight the critical bands
z = np.multiply(np.tile(eql, (nframes, 1)).T, x)
# cube root compress
z = np.power(z, 0.33)
# replicate first and last band (because they are unreliable as calculated)
if broaden:
y = np.zeros((z.shape[0] + 2, z.shape[1]))
y[0, :] = z[0, :]
y[1:nbands + 1, :] = z
y[nbands + 1, :] = z[z.shape[0] - 1, :]
else:
y = np.zeros((z.shape[0], z.shape[1]))
y[0, :] = z[1, :]
y[1:nbands - 1, :] = z[1:z.shape[0] - 1, :]
y[nbands - 1, :] = z[z.shape[0] - 2, :]
return y.T
def spec2cep(spec, ncep=13, dcttype=2):
nrow, ncol = spec.shape[0], spec.shape[1]
dctm = np.zeros((ncep, nrow))
if dcttype == 2 or dcttype == 3:
for i in range(ncep):
dctm[i, :] = np.multiply(np.cos(i*np.arange(1, 2 * nrow, 2)/(2 * nrow)*np.pi), np.sqrt(2 / nrow))
if dcttype == 2:
dctm[0, :] = np.divide(dctm[0, :], np.sqrt(2))
elif dcttype == 4:
for i in range(ncep):
dctm[i, :] = np.multiply(np.cos(np.multiply(np.divide(np.multiply(i, np.arange(1, nrow + 1)), (nrow + 1)), np.pi)), 2)
dctm[i, 0] = np.add(dctm[i, 0], 1)
dctm[i, int(nrow - 1)] = np.multiply(dctm[i, int(nrow - 1)], np.power(-1, i))
dctm = np.divide(dctm, 2 * (nrow + 1))
else:
for i in range(ncep):
dctm[i, :] = np.divide(np.multiply(np.cos(np.multiply(np.divide(np.multiply(i, np.arange(0, nrow)), (nrow - 1)), np.pi)), 2), 2 * (nrow - 1))
dctm[:, 0] = np.divide(dctm[:, 0], 2)
dctm[:, int(nrow - 1)] = np.divide(dctm[:, int(nrow - 1)], 2)
# cep = np.matmul(dctm, np.log(np.add(spec, 1e-8)))
cep = dctm.dot(np.log(np.add(spec, 1e-8)))
return cep.T, dctm
def lpc2spec(lpcas, nout = 17, FMout = False):
rows, cols = lpcas.shape
order = rows - 1
gg = lpcas[0, :]
aa = np.divide(lpcas, np.tile(gg, (rows, 1)))
# Calculate the actual z-plane polyvals: nout points around unit circle
tmp_1 = np.array(np.arange(0, nout), ndmin = 2).T
tmp_1 = np.divide(np.multiply(-1j, np.multiply(tmp_1, np.pi)), (nout - 1))
tmp_2 = np.array(np.arange(0, order + 1), ndmin = 2)
zz = np.exp(np.matmul(tmp_1, tmp_2))
# Actual polyvals, in power (mag^2)
features = np.divide(np.power(np.divide(1, np.abs(np.matmul(zz, aa))), 2), np.tile(gg, (nout, 1)))
F = np.zeros((cols, int(np.ceil(rows / 2))))
M = F
if FMout == True:
for c in range(cols):
aaa = aa[:, c]
rr = np.roots(aaa)
ff_tmp = np.angle(rr)
ff = np.array(ff_tmp, ndmin = 2).T
zz = np.exp(np.multiply(1j, np.matmul(ff, np.array(np.arange(0, aaa.shape[0]), ndmin = 2))))
mags = np.sqrt(np.divide(np.power(np.divide(1, np.abs(np.matmul(zz, np.array(aaa, ndmin = 2).T))), 2), gg[c]))
ix = np.argsort(ff_tmp)
dummy = np.sort(ff_tmp)
tmp_F_list = []
tmp_M_list = []
for i in range(ff.shape[0]):
if dummy[i] > 0:
tmp_F_list = np.append(tmp_F_list, dummy[i])
tmp_M_list = np.append(tmp_M_list, mags[ix[i]])
M[c, 0 : tmp_M_list.shape[0]] = tmp_M_list
F[c, 0 : tmp_F_list.shape[0]] = tmp_F_list
return features, F, M
def deltas(x, w = 9):
rows, cols = x.shape
hlen = np.floor(w / 2)
win = np.arange(hlen,-(hlen + 1),-1, dtype = 'float32')
xx = np.append(np.append(np.tile(x[:, 0], (int(hlen), 1)).T, x, axis = 1),
np.tile(x[:, cols - 1], (int(hlen), 1)).T, axis = 1)
d = signal.lfilter(win, 1, xx, axis = 1)
d = d[:, int(2 * hlen) : int(2 * hlen + cols)]
return d
def cep2spec(cep, nfreq, dcttype = 2):
ncep, ncol = cep.shape
dctm = np.zeros((ncep, nfreq))
idctm = np.zeros((nfreq, ncep))
if dcttype == 2 or dcttype == 3:
for i in range(ncep):
dctm[i, :] = np.multiply(np.cos(np.multiply(np.divide(np.multiply(i, np.arange(1, 2 * nfreq, 2)),
(2 * nfreq)), np.pi)), np.sqrt(2 / nfreq))
if dcttype == 2:
dctm[0, :] = np.divide(dctm[0, :], np.sqrt(2))
else:
dctm[0, :] = np.divide(dctm[0, :], 2)
idctm = dctm.T
elif dcttype == 4:
for i in range(ncep):
idctm[:, i] = np.multiply(np.cos(np.multiply(np.divide(np.multiply(i, np.arange(1, nfreq + 1).T), (nfreq + 1)), np.pi)), 2)
idctm[:, 0:ncep] = np.divide(idctm[:, 0:ncep], 2)
else:
for i in range(ncep):
idctm[:, i] = np.multiply(np.cos(np.multiply(np.divide(np.multiply(i, np.arange(0, nfreq).T), (nfreq - 1)), np.pi)), 2)
idctm[:, [0, -1]] = np.divide(idctm[:, [0, -1]], 2)
spec = np.exp(np.matmul(idctm, cep))
return spec, idctm
def invpostaud(y, fmax, fbtype = 'bark', broaden = 0):
nbands, nframes = y.shape
if fbtype == 'bark':
bandcfhz = bark2hz(np.linspace(0, hz2bark(fmax), nbands))
elif fbtype == 'mel':
bandcfhz = mel2hz(np.linspace(0, hz2mel(fmax), nbands))
elif fbtype == 'htkmel' or fbtype == 'fcmel':
bandcfhz = mel2hz(np.linspace(0, hz2mel(fmax, htk = True), nbands), htk = True)
bandcfhz = bandcfhz[broaden : (nbands - broaden)]
fsq = np.power(bandcfhz, 2)
ftmp = np.add(fsq, 1.6e5)
eql = np.multiply(np.power(np.divide(fsq, ftmp), 2),
np.divide(np.add(fsq, 1.44e6), np.add(fsq, 9.61e6)))
x = np.power(y, np.divide(1, 0.33))
if eql[0] == 0:
eql[0] = eql[1]
eql[-1] = eql[-2]
x = np.divide(x[broaden : (nbands - broaden + 1), :], np.add(np.tile(eql.T, (nframes, 1)).T, 1e-8))
return x, eql
def invpowspec(y, fs, win_time, hoplen_in_sec, excit = []):
nrow, ncol = y.shape
r = excit
winpts = int(np.round(np.multiply(win_time, fs)))
steppts = int(np.round(np.multiply(hoplen_in_sec, fs)))
nfft = int(np.power(2, np.ceil(np.divide(np.log(winpts), np.log(2)))))
# Can't predict librosa stft length...
tmp = librosa.istft(y, hop_length = steppts, win_length = winpts,
window='hann', center = False)
xlen = len(tmp)
# xlen = int(np.add(winpts, np.multiply(steppts, np.subtract(ncol, 1))))
# xlen = int(np.multiply(steppts, np.subtract(ncol, 1)))
if len(r) == 0:
r = np.squeeze(np.random.randn(xlen, 1))
r = r[0:xlen]
R = librosa.stft(np.divide(r, 32768 * 12), n_fft = nfft, hop_length = steppts,
win_length = winpts, window = 'hann', center = False)
R = np.multiply(R, np.sqrt(y))
x = librosa.istft(R, hop_length = steppts, win_length = winpts,
window = 'hann', center = False)
return x
def invaudspec(aspectrum, fs = 16000, nfft = 512, fbtype = 'bark',
min_freq = 0, max_freq = 0, sumpower = True, band_width = 1):
if max_freq == 0:
max_freq = fs / 2
nfilts, nframes = aspectrum.shape
if fbtype == 'bark':
weights = fft2barkmx(nfft, fs, nfilts, band_width, min_freq, max_freq)
elif fbtype == 'mel':
weights = fft2melmx(nfft, fs, nfilts, band_width, min_freq, max_freq)
elif fbtype == 'htkmel':
weights = fft2melmx(nfft, fs, nfilts, band_width, min_freq, max_freq, htkmel = True, constamp = True)
elif fbtype == 'fcmel':
weights = fft2melmx(nfft, fs, nfilts, band_width, min_freq, max_freq, htkmel = True, constamp = False)
weights = weights[:, 0:int(nfft / 2 + 1)]
ww = np.matmul(weights.T, weights)
itws = np.divide(weights.T, np.tile(np.maximum(np.divide(np.mean(np.diag(ww)), 100),
np.sum(ww, axis = 0)), (nfilts, 1)).T)
if sumpower == True:
spec = np.matmul(itws, aspectrum)
else:
spec = np.power(np.matmul(itws, np.sqrt(aspectrum)))
return spec, weights, itws
def delta_voicebox(CepCoeff, d):
"""
delta_coeff = mfcc2delta(CepCoeff,d);
Input:
CepCoeff: Cepstral Coefficient (Row Represents a feature vector for a frame)
d : Lag size for delta feature computation
Output:
delta_coeff: Output delta coefficient
Ref . http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
"""
vf = np.arange(d,-(d+1),-1)
vf=vf/sum(vf**2);
ww=np.ones((d,1));
NoOfFrame, NoOfCoeff = CepCoeff.shape
cx = np.concatenate(
(np.concatenate(CepCoeff[(ww-1).astype(int)]),
CepCoeff ,
np.concatenate(CepCoeff[(ww*NoOfFrame-1).astype(int)]))
)
cx_r, cx_c = cx.shape
cx_col = cx.T.reshape(cx_r*cx_c)
vx = signal.lfilter(vf,1,cx_col.T).reshape((cx_r,cx_c), order='F')
delta_coeff=vx[2*d::,:]
return delta_coeff
def sdc(CepCoeff, N=7, D=1, P=3, K=7):
"""
About: Shifted Delta Coefficient Computation.
Usage: sdc_coeff = mfcc2sdc(CepCoeff,N,d,P,k)
input:
CepCoeff : MFCC Coefficients stored in row-wise
N: NoOfCepstrum i.e. no of column of CepCoeff
d: Amount of shift for delta computation
P: Amount of shift for next frame whose deltas are to be computed.
K: No of frame whose deltas are to be stacked.
output:
sdc_coeff: Shifted delta coefficient of CepCoeff.
Dimension of the output: NumberOfFrame x N*K
Ref. <NAME>, J.P.Campbell, <NAME>, <NAME>, <NAME>, Support
vector machines for speaker and language recognition,
Computer Speech & Language, Volume 20, Issues 2-3,
Odyssey 2004: The speaker and Language Recognition
Workshop - Odyssey-04, April-July 2006, Pages 210-229.
"""
nframe, ncoeff = CepCoeff.shape
CepCoeff = np.concatenate((CepCoeff,CepCoeff[0:P*(K-1),:]))
NoOfFrame, NoOfCoeff = CepCoeff.shape
delta_coeff = delta_voicebox(CepCoeff,D).T
sdc_coeff = []
for i in range(K):
temp=(delta_coeff[:,P*i::])[:,0:nframe]
sdc_coeff.append(temp)
sdc_coeff = np.concatenate(sdc_coeff)
return sdc_coeff
|
[
"numpy.roots",
"numpy.abs",
"numpy.sum",
"numpy.angle",
"numpy.floor",
"numpy.ones",
"numpy.argsort",
"librosa.istft",
"numpy.arange",
"numpy.tile",
"numpy.diag",
"numpy.round",
"spectrum.LEVINSON",
"numpy.multiply",
"numpy.random.randn",
"scipy.signal.lfilter",
"numpy.fft.fft",
"numpy.power",
"numpy.append",
"numpy.hanning",
"numpy.add",
"numpy.divide",
"numpy.minimum",
"numpy.ceil",
"numpy.hamming",
"numpy.log2",
"scipy.fftpack.ifft",
"numpy.sort",
"numpy.concatenate",
"scipy.signal.lfilter_zi",
"numpy.subtract",
"numpy.log",
"numpy.zeros",
"numpy.array",
"numpy.matmul",
"warnings.warn",
"numpy.sqrt"
] |
[((305, 317), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (313, 317), True, 'import numpy as np\n'), ((1490, 1507), 'numpy.concatenate', 'np.concatenate', (['S'], {}), '(S)\n', (1504, 1507), True, 'import numpy as np\n'), ((1516, 1535), 'numpy.fft.fft', 'np.fft.fft', (['S', 'nfft'], {}), '(S, nfft)\n', (1526, 1535), True, 'import numpy as np\n'), ((5823, 5839), 'numpy.arange', 'np.arange', (['(-2)', '(3)'], {}), '(-2, 3)\n', (5832, 5839), True, 'import numpy as np\n'), ((5909, 5929), 'numpy.array', 'np.array', (['[1, -0.94]'], {}), '([1, -0.94])\n', (5917, 5929), True, 'import numpy as np\n'), ((6076, 6103), 'scipy.signal.lfilter_zi', 'signal.lfilter_zi', (['numer', '(1)'], {}), '(numer, 1)\n', (6093, 6103), False, 'from scipy import signal\n'), ((6111, 6128), 'numpy.zeros', 'np.zeros', (['x.shape'], {}), '(x.shape)\n', (6119, 6128), True, 'import numpy as np\n'), ((7008, 7034), 'numpy.zeros', 'np.zeros', (['(ncorr, nframes)'], {}), '((ncorr, nframes))\n', (7016, 7034), True, 'import numpy as np\n'), ((7260, 7294), 'numpy.ones', 'np.ones', (['(nframes, modelorder + 1)'], {}), '((nframes, modelorder + 1))\n', (7267, 7294), True, 'import numpy as np\n'), ((7303, 7325), 'numpy.zeros', 'np.zeros', (['(nframes, 1)'], {}), '((nframes, 1))\n', (7311, 7325), True, 'import numpy as np\n'), ((8198, 8220), 'numpy.zeros', 'np.zeros', (['(nout, ncol)'], {}), '((nout, ncol))\n', (8206, 8220), True, 'import numpy as np\n'), ((17097, 17118), 'numpy.power', 'np.power', (['bandcfhz', '(2)'], {}), '(bandcfhz, 2)\n', (17105, 17118), True, 'import numpy as np\n'), ((17130, 17151), 'numpy.add', 'np.add', (['fsq', '(160000.0)'], {}), '(fsq, 160000.0)\n', (17136, 17151), True, 'import numpy as np\n'), ((17379, 17396), 'numpy.power', 'np.power', (['z', '(0.33)'], {}), '(z, 0.33)\n', (17387, 17396), True, 'import numpy as np\n'), ((17947, 17969), 'numpy.zeros', 'np.zeros', (['(ncep, nrow)'], {}), '((ncep, nrow))\n', (17955, 17969), True, 'import numpy as np\n'), ((20683, 20698), 'numpy.floor', 'np.floor', (['(w / 2)'], {}), '(w / 2)\n', (20691, 20698), True, 'import numpy as np\n'), ((20709, 20758), 'numpy.arange', 'np.arange', (['hlen', '(-(hlen + 1))', '(-1)'], {'dtype': '"""float32"""'}), "(hlen, -(hlen + 1), -1, dtype='float32')\n", (20718, 20758), True, 'import numpy as np\n'), ((20916, 20950), 'scipy.signal.lfilter', 'signal.lfilter', (['win', '(1)', 'xx'], {'axis': '(1)'}), '(win, 1, xx, axis=1)\n', (20930, 20950), False, 'from scipy import signal\n'), ((21097, 21120), 'numpy.zeros', 'np.zeros', (['(ncep, nfreq)'], {}), '((ncep, nfreq))\n', (21105, 21120), True, 'import numpy as np\n'), ((21133, 21156), 'numpy.zeros', 'np.zeros', (['(nfreq, ncep)'], {}), '((nfreq, ncep))\n', (21141, 21156), True, 'import numpy as np\n'), ((22639, 22660), 'numpy.power', 'np.power', (['bandcfhz', '(2)'], {}), '(bandcfhz, 2)\n', (22647, 22660), True, 'import numpy as np\n'), ((22672, 22693), 'numpy.add', 'np.add', (['fsq', '(160000.0)'], {}), '(fsq, 160000.0)\n', (22678, 22693), True, 'import numpy as np\n'), ((23403, 23491), 'librosa.istft', 'librosa.istft', (['y'], {'hop_length': 'steppts', 'win_length': 'winpts', 'window': '"""hann"""', 'center': '(False)'}), "(y, hop_length=steppts, win_length=winpts, window='hann',\n center=False)\n", (23416, 23491), False, 'import librosa\n'), ((23965, 24053), 'librosa.istft', 'librosa.istft', (['R'], {'hop_length': 'steppts', 'win_length': 'winpts', 'window': '"""hann"""', 'center': '(False)'}), "(R, hop_length=steppts, win_length=winpts, window='hann',\n center=False)\n", (23978, 24053), False, 'import librosa\n'), ((24870, 24899), 'numpy.matmul', 'np.matmul', (['weights.T', 'weights'], {}), '(weights.T, weights)\n', (24879, 24899), True, 'import numpy as np\n'), ((25630, 25656), 'numpy.arange', 'np.arange', (['d', '(-(d + 1))', '(-1)'], {}), '(d, -(d + 1), -1)\n', (25639, 25656), True, 'import numpy as np\n'), ((25682, 25697), 'numpy.ones', 'np.ones', (['(d, 1)'], {}), '((d, 1))\n', (25689, 25697), True, 'import numpy as np\n'), ((27037, 27091), 'numpy.concatenate', 'np.concatenate', (['(CepCoeff, CepCoeff[0:P * (K - 1), :])'], {}), '((CepCoeff, CepCoeff[0:P * (K - 1), :]))\n', (27051, 27091), True, 'import numpy as np\n'), ((27312, 27337), 'numpy.concatenate', 'np.concatenate', (['sdc_coeff'], {}), '(sdc_coeff)\n', (27326, 27337), True, 'import numpy as np\n'), ((725, 743), 'numpy.hanning', 'np.hanning', (['window'], {}), '(window)\n', (735, 743), True, 'import numpy as np\n'), ((862, 878), 'numpy.hanning', 'np.hanning', (['nfft'], {}), '(nfft)\n', (872, 878), True, 'import numpy as np\n'), ((1088, 1155), 'warnings.warn', 'warnings.warn', (['"""fft points adjusted to win_size as win_size > nfft"""'], {}), "('fft points adjusted to win_size as win_size > nfft')\n", (1101, 1155), False, 'import warnings\n'), ((1732, 1748), 'numpy.array', 'np.array', (['offset'], {}), '(offset)\n', (1740, 1748), True, 'import numpy as np\n'), ((2354, 2382), 'numpy.round', 'np.round', (['(winlen_in_sec * fs)'], {}), '(winlen_in_sec * fs)\n', (2362, 2382), True, 'import numpy as np\n'), ((2405, 2433), 'numpy.round', 'np.round', (['(hoplen_in_sec * fs)'], {}), '(hoplen_in_sec * fs)\n', (2413, 2433), True, 'import numpy as np\n'), ((2688, 2702), 'numpy.abs', 'np.abs', (['specgm'], {}), '(specgm)\n', (2694, 2702), True, 'import numpy as np\n'), ((2741, 2769), 'numpy.add', 'np.add', (['pow_spec', 'win_length'], {}), '(pow_spec, win_length)\n', (2747, 2769), True, 'import numpy as np\n'), ((2831, 2855), 'numpy.sum', 'np.sum', (['pow_spec'], {'axis': '(0)'}), '(pow_spec, axis=0)\n', (2837, 2855), True, 'import numpy as np\n'), ((4992, 5014), 'numpy.subtract', 'np.subtract', (['nfilts', '(1)'], {}), '(nfilts, 1)\n', (5003, 5014), True, 'import numpy as np\n'), ((6232, 6292), 'scipy.signal.lfilter', 'signal.lfilter', (['numer', '(1)', 'x[i, 0:4]'], {'axis': '(0)', 'zi': '(zi * x[i, 0])'}), '(numer, 1, x[i, 0:4], axis=0, zi=zi * x[i, 0])\n', (6246, 6292), False, 'from scipy import signal\n'), ((6346, 6409), 'scipy.signal.lfilter', 'signal.lfilter', (['numer', 'denom', 'x[i, 4:x.shape[1]]'], {'axis': '(0)', 'zi': 'zi'}), '(numer, denom, x[i, 4:x.shape[1]], axis=0, zi=zi)\n', (6360, 6409), False, 'from scipy import signal\n'), ((6432, 6449), 'numpy.append', 'np.append', (['y1', 'y2'], {}), '(y1, y2)\n', (6441, 6449), True, 'import numpy as np\n'), ((8238, 8253), 'numpy.log', 'np.log', (['a[0, :]'], {}), '(a[0, :])\n', (8244, 8253), True, 'import numpy as np\n'), ((9184, 9210), 'numpy.append', 'np.append', (['(1)', 'lift_weights'], {}), '(1, lift_weights)\n', (9193, 9210), True, 'import numpy as np\n'), ((10216, 10236), 'numpy.array', 'np.array', (['f'], {'ndmin': '(1)'}), '(f, ndmin=1)\n', (10224, 10236), True, 'import numpy as np\n'), ((10251, 10274), 'numpy.zeros', 'np.zeros', (['(f.shape[0],)'], {}), '((f.shape[0],))\n', (10259, 10274), True, 'import numpy as np\n'), ((11419, 11439), 'numpy.array', 'np.array', (['z'], {'ndmin': '(1)'}), '(z, ndmin=1)\n', (11427, 11439), True, 'import numpy as np\n'), ((11454, 11477), 'numpy.zeros', 'np.zeros', (['(z.shape[0],)'], {}), '((z.shape[0],))\n', (11462, 11477), True, 'import numpy as np\n'), ((17506, 17544), 'numpy.zeros', 'np.zeros', (['(z.shape[0] + 2, z.shape[1])'], {}), '((z.shape[0] + 2, z.shape[1]))\n', (17514, 17544), True, 'import numpy as np\n'), ((17672, 17706), 'numpy.zeros', 'np.zeros', (['(z.shape[0], z.shape[1])'], {}), '((z.shape[0], z.shape[1]))\n', (17680, 17706), True, 'import numpy as np\n'), ((19188, 19210), 'numpy.tile', 'np.tile', (['gg', '(rows, 1)'], {}), '(gg, (rows, 1))\n', (19195, 19210), True, 'import numpy as np\n'), ((19446, 19469), 'numpy.arange', 'np.arange', (['(0)', '(order + 1)'], {}), '(0, order + 1)\n', (19455, 19469), True, 'import numpy as np\n'), ((19498, 19521), 'numpy.matmul', 'np.matmul', (['tmp_1', 'tmp_2'], {}), '(tmp_1, tmp_2)\n', (19507, 19521), True, 'import numpy as np\n'), ((19646, 19668), 'numpy.tile', 'np.tile', (['gg', '(nout, 1)'], {}), '(gg, (nout, 1))\n', (19653, 19668), True, 'import numpy as np\n'), ((22119, 22140), 'numpy.matmul', 'np.matmul', (['idctm', 'cep'], {}), '(idctm, cep)\n', (22128, 22140), True, 'import numpy as np\n'), ((22844, 22862), 'numpy.divide', 'np.divide', (['(1)', '(0.33)'], {}), '(1, 0.33)\n', (22853, 22862), True, 'import numpy as np\n'), ((23784, 23808), 'numpy.divide', 'np.divide', (['r', '(32768 * 12)'], {}), '(r, 32768 * 12)\n', (23793, 23808), True, 'import numpy as np\n'), ((23945, 23955), 'numpy.sqrt', 'np.sqrt', (['y'], {}), '(y)\n', (23952, 23955), True, 'import numpy as np\n'), ((25115, 25141), 'numpy.matmul', 'np.matmul', (['itws', 'aspectrum'], {}), '(itws, aspectrum)\n', (25124, 25141), True, 'import numpy as np\n'), ((2639, 2661), 'numpy.hamming', 'np.hamming', (['win_length'], {}), '(win_length)\n', (2649, 2661), True, 'import numpy as np\n'), ((3489, 3508), 'numpy.divide', 'np.divide', (['f', '(600.0)'], {}), '(f, 600.0)\n', (3498, 3508), True, 'import numpy as np\n'), ((3987, 4004), 'numpy.divide', 'np.divide', (['z', '(6.0)'], {}), '(z, 6.0)\n', (3996, 4004), True, 'import numpy as np\n'), ((4885, 4901), 'numpy.ceil', 'np.ceil', (['nyqbark'], {}), '(nyqbark)\n', (4892, 4901), True, 'import numpy as np\n'), ((5095, 5114), 'numpy.divide', 'np.divide', (['sr', 'nfft'], {}), '(sr, nfft)\n', (5104, 5114), True, 'import numpy as np\n'), ((5184, 5210), 'numpy.multiply', 'np.multiply', (['i', 'step_barks'], {}), '(i, step_barks)\n', (5195, 5210), True, 'import numpy as np\n'), ((5317, 5350), 'numpy.subtract', 'np.subtract', (['binbarks', 'f_bark_mid'], {}), '(binbarks, f_bark_mid)\n', (5328, 5350), True, 'import numpy as np\n'), ((5378, 5411), 'numpy.subtract', 'np.subtract', (['binbarks', 'f_bark_mid'], {}), '(binbarks, f_bark_mid)\n', (5389, 5411), True, 'import numpy as np\n'), ((5877, 5895), 'numpy.power', 'np.power', (['numer', '(2)'], {}), '(numer, 2)\n', (5885, 5895), True, 'import numpy as np\n'), ((7185, 7198), 'scipy.fftpack.ifft', 'fft.ifft', (['R.T'], {}), '(R.T)\n', (7193, 7198), True, 'import scipy.fftpack as fft\n'), ((7443, 7505), 'spectrum.LEVINSON', 'spectrum.LEVINSON', (['r[:, i]', 'modelorder'], {'allow_singularity': '(True)'}), '(r[:, i], modelorder, allow_singularity=True)\n', (7460, 7505), False, 'import spectrum\n'), ((7609, 7671), 'spectrum.LEVINSON', 'spectrum.LEVINSON', (['r[:, i]', 'modelorder'], {'allow_singularity': '(True)'}), '(r[:, i], modelorder, allow_singularity=True)\n', (7626, 7671), False, 'import spectrum\n'), ((7810, 7843), 'numpy.tile', 'np.tile', (['e.T', '(modelorder + 1, 1)'], {}), '(e.T, (modelorder + 1, 1))\n', (7817, 7843), True, 'import numpy as np\n'), ((8319, 8345), 'numpy.tile', 'np.tile', (['a[0, :]', '(nin, 1)'], {}), '(a[0, :], (nin, 1))\n', (8326, 8345), True, 'import numpy as np\n'), ((9009, 9079), 'warnings.warn', 'warnings.warn', (['"""HTK liftering does not support yet; default liftering"""'], {}), "('HTK liftering does not support yet; default liftering')\n", (9022, 9079), False, 'import warnings\n'), ((9135, 9153), 'numpy.arange', 'np.arange', (['(1)', 'ncep'], {}), '(1, ncep)\n', (9144, 9153), True, 'import numpy as np\n'), ((9258, 9284), 'numpy.divide', 'np.divide', (['(1)', 'lift_weights'], {}), '(1, lift_weights)\n', (9267, 9284), True, 'import numpy as np\n'), ((9308, 9329), 'numpy.diag', 'np.diag', (['lift_weights'], {}), '(lift_weights)\n', (9315, 9329), True, 'import numpy as np\n'), ((13243, 13269), 'numpy.arange', 'np.arange', (['(0)', '(nfft / 2 + 1)'], {}), '(0, nfft / 2 + 1)\n', (13252, 13269), True, 'import numpy as np\n'), ((13846, 13879), 'numpy.subtract', 'np.subtract', (['fftfrqs', 'freq_tmp[0]'], {}), '(fftfrqs, freq_tmp[0])\n', (13857, 13879), True, 'import numpy as np\n'), ((13881, 13918), 'numpy.subtract', 'np.subtract', (['freq_tmp[1]', 'freq_tmp[0]'], {}), '(freq_tmp[1], freq_tmp[0])\n', (13892, 13918), True, 'import numpy as np\n'), ((13948, 13981), 'numpy.subtract', 'np.subtract', (['freq_tmp[2]', 'fftfrqs'], {}), '(freq_tmp[2], fftfrqs)\n', (13959, 13981), True, 'import numpy as np\n'), ((13983, 14020), 'numpy.subtract', 'np.subtract', (['freq_tmp[2]', 'freq_tmp[1]'], {}), '(freq_tmp[2], freq_tmp[1])\n', (13994, 14020), True, 'import numpy as np\n'), ((14080, 14108), 'numpy.minimum', 'np.minimum', (['loslope', 'hislope'], {}), '(loslope, hislope)\n', (14090, 14108), True, 'import numpy as np\n'), ((17180, 17200), 'numpy.divide', 'np.divide', (['fsq', 'ftmp'], {}), '(fsq, ftmp)\n', (17189, 17200), True, 'import numpy as np\n'), ((17216, 17238), 'numpy.add', 'np.add', (['fsq', '(1440000.0)'], {}), '(fsq, 1440000.0)\n', (17222, 17238), True, 'import numpy as np\n'), ((17237, 17259), 'numpy.add', 'np.add', (['fsq', '(9610000.0)'], {}), '(fsq, 9610000.0)\n', (17243, 17259), True, 'import numpy as np\n'), ((17312, 17338), 'numpy.tile', 'np.tile', (['eql', '(nframes, 1)'], {}), '(eql, (nframes, 1))\n', (17319, 17338), True, 'import numpy as np\n'), ((18570, 18601), 'numpy.divide', 'np.divide', (['dctm', '(2 * (nrow + 1))'], {}), '(dctm, 2 * (nrow + 1))\n', (18579, 18601), True, 'import numpy as np\n'), ((18818, 18842), 'numpy.divide', 'np.divide', (['dctm[:, 0]', '(2)'], {}), '(dctm[:, 0], 2)\n', (18827, 18842), True, 'import numpy as np\n'), ((18996, 19015), 'numpy.add', 'np.add', (['spec', '(1e-08)'], {}), '(spec, 1e-08)\n', (19002, 19015), True, 'import numpy as np\n'), ((19313, 19331), 'numpy.arange', 'np.arange', (['(0)', 'nout'], {}), '(0, nout)\n', (19322, 19331), True, 'import numpy as np\n'), ((19385, 19410), 'numpy.multiply', 'np.multiply', (['tmp_1', 'np.pi'], {}), '(tmp_1, np.pi)\n', (19396, 19410), True, 'import numpy as np\n'), ((19826, 19839), 'numpy.roots', 'np.roots', (['aaa'], {}), '(aaa)\n', (19834, 19839), True, 'import numpy as np\n'), ((19861, 19873), 'numpy.angle', 'np.angle', (['rr'], {}), '(rr)\n', (19869, 19873), True, 'import numpy as np\n'), ((20167, 20185), 'numpy.argsort', 'np.argsort', (['ff_tmp'], {}), '(ff_tmp)\n', (20177, 20185), True, 'import numpy as np\n'), ((20206, 20221), 'numpy.sort', 'np.sort', (['ff_tmp'], {}), '(ff_tmp)\n', (20213, 20221), True, 'import numpy as np\n'), ((21568, 21592), 'numpy.divide', 'np.divide', (['dctm[0, :]', '(2)'], {}), '(dctm[0, :], 2)\n', (21577, 21592), True, 'import numpy as np\n'), ((21835, 21865), 'numpy.divide', 'np.divide', (['idctm[:, 0:ncep]', '(2)'], {}), '(idctm[:, 0:ncep], 2)\n', (21844, 21865), True, 'import numpy as np\n'), ((22068, 22099), 'numpy.divide', 'np.divide', (['idctm[:, [0, -1]]', '(2)'], {}), '(idctm[:, [0, -1]], 2)\n', (22077, 22099), True, 'import numpy as np\n'), ((22722, 22742), 'numpy.divide', 'np.divide', (['fsq', 'ftmp'], {}), '(fsq, ftmp)\n', (22731, 22742), True, 'import numpy as np\n'), ((22780, 22802), 'numpy.add', 'np.add', (['fsq', '(1440000.0)'], {}), '(fsq, 1440000.0)\n', (22786, 22802), True, 'import numpy as np\n'), ((22801, 22823), 'numpy.add', 'np.add', (['fsq', '(9610000.0)'], {}), '(fsq, 9610000.0)\n', (22807, 22823), True, 'import numpy as np\n'), ((23186, 23211), 'numpy.multiply', 'np.multiply', (['win_time', 'fs'], {}), '(win_time, fs)\n', (23197, 23211), True, 'import numpy as np\n'), ((23241, 23271), 'numpy.multiply', 'np.multiply', (['hoplen_in_sec', 'fs'], {}), '(hoplen_in_sec, fs)\n', (23252, 23271), True, 'import numpy as np\n'), ((23718, 23742), 'numpy.random.randn', 'np.random.randn', (['xlen', '(1)'], {}), '(xlen, 1)\n', (23733, 23742), True, 'import numpy as np\n'), ((25985, 26016), 'scipy.signal.lfilter', 'signal.lfilter', (['vf', '(1)', 'cx_col.T'], {}), '(vf, 1, cx_col.T)\n', (25999, 26016), False, 'from scipy import signal\n'), ((787, 804), 'numpy.ceil', 'np.ceil', (['(nfft / 2)'], {}), '(nfft / 2)\n', (794, 804), True, 'import numpy as np\n'), ((1377, 1391), 'numpy.zeros', 'np.zeros', (['npad'], {}), '(npad)\n', (1385, 1391), True, 'import numpy as np\n'), ((2520, 2547), 'numpy.log2', 'np.log2', (['(winlen_in_sec * fs)'], {}), '(winlen_in_sec * fs)\n', (2527, 2547), True, 'import numpy as np\n'), ((8569, 8586), 'numpy.divide', 'np.divide', (['sum', 'n'], {}), '(sum, n)\n', (8578, 8586), True, 'import numpy as np\n'), ((10183, 10194), 'numpy.log', 'np.log', (['(6.4)'], {}), '(6.4)\n', (10189, 10194), True, 'import numpy as np\n'), ((11111, 11122), 'numpy.log', 'np.log', (['(6.4)'], {}), '(6.4)\n', (11117, 11122), True, 'import numpy as np\n'), ((13477, 13501), 'numpy.arange', 'np.arange', (['(0)', '(nfilts + 2)'], {}), '(0, nfilts + 2)\n', (13486, 13501), True, 'import numpy as np\n'), ((13626, 13641), 'numpy.arange', 'np.arange', (['(0)', '(3)'], {}), '(0, 3)\n', (13635, 13641), True, 'import numpy as np\n'), ((13735, 13769), 'numpy.subtract', 'np.subtract', (['freq_tmp', 'freq_tmp[1]'], {}), '(freq_tmp, freq_tmp[1])\n', (13746, 13769), True, 'import numpy as np\n'), ((18129, 18146), 'numpy.sqrt', 'np.sqrt', (['(2 / nrow)'], {}), '(2 / nrow)\n', (18136, 18146), True, 'import numpy as np\n'), ((18221, 18231), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (18228, 18231), True, 'import numpy as np\n'), ((18443, 18464), 'numpy.add', 'np.add', (['dctm[i, 0]', '(1)'], {}), '(dctm[i, 0], 1)\n', (18449, 18464), True, 'import numpy as np\n'), ((19698, 19715), 'numpy.ceil', 'np.ceil', (['(rows / 2)'], {}), '(rows / 2)\n', (19705, 19715), True, 'import numpy as np\n'), ((19891, 19916), 'numpy.array', 'np.array', (['ff_tmp'], {'ndmin': '(2)'}), '(ff_tmp, ndmin=2)\n', (19899, 19916), True, 'import numpy as np\n'), ((21424, 21442), 'numpy.sqrt', 'np.sqrt', (['(2 / nfreq)'], {}), '(2 / nfreq)\n', (21431, 21442), True, 'import numpy as np\n'), ((21517, 21527), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (21524, 21527), True, 'import numpy as np\n'), ((23001, 23029), 'numpy.tile', 'np.tile', (['eql.T', '(nframes, 1)'], {}), '(eql.T, (nframes, 1))\n', (23008, 23029), True, 'import numpy as np\n'), ((25192, 25210), 'numpy.sqrt', 'np.sqrt', (['aspectrum'], {}), '(aspectrum)\n', (25199, 25210), True, 'import numpy as np\n'), ((5071, 5089), 'numpy.divide', 'np.divide', (['nfft', '(2)'], {}), '(nfft, 2)\n', (5080, 5089), True, 'import numpy as np\n'), ((8472, 8504), 'numpy.multiply', 'np.multiply', (['(n - m)', 'norm_a[m, :]'], {}), '(n - m, norm_a[m, :])\n', (8483, 8504), True, 'import numpy as np\n'), ((9670, 9687), 'numpy.divide', 'np.divide', (['f', '(700)'], {}), '(f, 700)\n', (9679, 9687), True, 'import numpy as np\n'), ((10887, 10905), 'numpy.divide', 'np.divide', (['z', '(2595)'], {}), '(z, 2595)\n', (10896, 10905), True, 'import numpy as np\n'), ((16442, 16463), 'numpy.sqrt', 'np.sqrt', (['p_spectrum.T'], {}), '(p_spectrum.T)\n', (16449, 16463), True, 'import numpy as np\n'), ((18538, 18553), 'numpy.power', 'np.power', (['(-1)', 'i'], {}), '(-1, i)\n', (18546, 18553), True, 'import numpy as np\n'), ((19621, 19638), 'numpy.matmul', 'np.matmul', (['zz', 'aa'], {}), '(zz, aa)\n', (19630, 19638), True, 'import numpy as np\n'), ((20386, 20417), 'numpy.append', 'np.append', (['tmp_F_list', 'dummy[i]'], {}), '(tmp_F_list, dummy[i])\n', (20395, 20417), True, 'import numpy as np\n'), ((20451, 20485), 'numpy.append', 'np.append', (['tmp_M_list', 'mags[ix[i]]'], {}), '(tmp_M_list, mags[ix[i]])\n', (20460, 20485), True, 'import numpy as np\n'), ((23319, 23333), 'numpy.log', 'np.log', (['winpts'], {}), '(winpts)\n', (23325, 23333), True, 'import numpy as np\n'), ((23335, 23344), 'numpy.log', 'np.log', (['(2)'], {}), '(2)\n', (23341, 23344), True, 'import numpy as np\n'), ((25036, 25054), 'numpy.sum', 'np.sum', (['ww'], {'axis': '(0)'}), '(ww, axis=0)\n', (25042, 25054), True, 'import numpy as np\n'), ((5515, 5537), 'numpy.multiply', 'np.multiply', (['(-2.5)', 'lof'], {}), '(-2.5, lof)\n', (5526, 5537), True, 'import numpy as np\n'), ((10470, 10491), 'numpy.log', 'np.log', (['(f[i] / brkfrq)'], {}), '(f[i] / brkfrq)\n', (10476, 10491), True, 'import numpy as np\n'), ((10494, 10509), 'numpy.log', 'np.log', (['logstep'], {}), '(logstep)\n', (10500, 10509), True, 'import numpy as np\n'), ((11678, 11693), 'numpy.log', 'np.log', (['logstep'], {}), '(logstep)\n', (11684, 11693), True, 'import numpy as np\n'), ((19984, 20010), 'numpy.arange', 'np.arange', (['(0)', 'aaa.shape[0]'], {}), '(0, aaa.shape[0])\n', (19993, 20010), True, 'import numpy as np\n'), ((24969, 24980), 'numpy.diag', 'np.diag', (['ww'], {}), '(ww)\n', (24976, 24980), True, 'import numpy as np\n'), ((18084, 18109), 'numpy.arange', 'np.arange', (['(1)', '(2 * nrow)', '(2)'], {}), '(1, 2 * nrow, 2)\n', (18093, 18109), True, 'import numpy as np\n'), ((21306, 21332), 'numpy.arange', 'np.arange', (['(1)', '(2 * nfreq)', '(2)'], {}), '(1, 2 * nfreq, 2)\n', (21315, 21332), True, 'import numpy as np\n'), ((18368, 18390), 'numpy.arange', 'np.arange', (['(1)', '(nrow + 1)'], {}), '(1, nrow + 1)\n', (18377, 18390), True, 'import numpy as np\n'), ((18734, 18752), 'numpy.arange', 'np.arange', (['(0)', 'nrow'], {}), '(0, nrow)\n', (18743, 18752), True, 'import numpy as np\n'), ((20106, 20128), 'numpy.array', 'np.array', (['aaa'], {'ndmin': '(2)'}), '(aaa, ndmin=2)\n', (20114, 20128), True, 'import numpy as np\n'), ((21753, 21776), 'numpy.arange', 'np.arange', (['(1)', '(nfreq + 1)'], {}), '(1, nfreq + 1)\n', (21762, 21776), True, 'import numpy as np\n'), ((21989, 22008), 'numpy.arange', 'np.arange', (['(0)', 'nfreq'], {}), '(0, nfreq)\n', (21998, 22008), True, 'import numpy as np\n')]
|
from flask import Flask
import calculate
app = Flask(__name__)
@app.route("/")
def index():
important_facility_data = [["site office", 10, 0, 500, 500, 0, 0], ["labour shed", 5, 0, 10000, 500, 0, 0],
["security shed", 5, 0, 200, 0, 0, 0], ["Batching plant", 10, 100, 20000, 1000, 2, 2],
["Warehouse", 10, 500, 10000, 1000, 7, 1], ["QC lab", 10, 0, 500, 500, 0, 0]]
less_important_facility_data = [("site canteen", 5, 0, 10000, 0, 0, 0), ("Toilets", 5, 0, 200, 0, 0, 0),
("watertank", 2, 100, 5000, 200, 1, 2), ("Power house", 1, 0, 1000, 1000, 0, 0),
("Parking", 3, 0, 200, 0, 0, 0)]
return str(calculate.main(important_facility_data,less_important_facility_data))
app.run()
|
[
"flask.Flask",
"calculate.main"
] |
[((49, 64), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (54, 64), False, 'from flask import Flask\n'), ((745, 814), 'calculate.main', 'calculate.main', (['important_facility_data', 'less_important_facility_data'], {}), '(important_facility_data, less_important_facility_data)\n', (759, 814), False, 'import calculate\n')]
|
import numpy as np
initial_state = globals().copy()
non_element_functions = ['element_metadata',
'initial_state',
'non_element_functions',
'typeChecker',
'circuit_elements']
# populated at the end of the file -
# this maps ex. 'R' to the function R to always give us a list of
# active elements in any context
circuit_elements = {}
def element_metadata(num_params, units):
""" decorator to store metadata for a circuit element
Parameters
----------
num_params : int
number of parameters for an element
units : list of str
list of units for the element parameters
"""
def decorator(func):
def wrapper(p, f):
typeChecker(p, f, func.__name__, num_params)
return func(p, f)
wrapper.num_params = num_params
wrapper.units = units
wrapper.__name__ = func.__name__
wrapper.__doc__ = func.__doc__
return wrapper
return decorator
def s(series):
""" sums elements in series
Notes
---------
.. math::
Z = Z_1 + Z_2 + ... + Z_n
"""
z = len(series[0])*[0 + 0*1j]
for elem in series:
z += elem
return z
def p(parallel):
""" adds elements in parallel
Notes
---------
.. math::
Z = \\frac{1}{\\frac{1}{Z_1} + \\frac{1}{Z_2} + ... + \\frac{1}{Z_n}}
"""
z = len(parallel[0])*[0 + 0*1j]
for elem in parallel:
z += 1/elem
return 1/z
@element_metadata(num_params=1, units=['Ohm'])
def R(p, f):
""" defines a resistor
Notes
---------
.. math::
Z = R
"""
return np.array(len(f)*[p[0]])
@element_metadata(num_params=1, units=['F'])
def C(p, f):
""" defines a capacitor
.. math::
Z = \\frac{1}{C \\times j 2 \\pi f}
"""
omega = 2*np.pi*np.array(f)
return 1.0/(p[0]*1j*omega)
@element_metadata(num_params=1, units=['H'])
def L(p, f):
""" defines an inductor
.. math::
Z = L \\times j 2 \\pi f
"""
omega = 2*np.pi*np.array(f)
return p[0]*1j*omega
@element_metadata(num_params=1, units=['Ohm sec^-1/2'])
def W(p, f):
""" defines a semi-infinite Warburg element
Notes
-----
.. math::
Z = \\frac{A_W}{\\sqrt{ 2 \\pi f}} (1-j)
"""
omega = 2*np.pi*np.array(f)
Aw = p[0]
Zw = Aw*(1-1j)/np.sqrt(omega)
return Zw
@element_metadata(num_params=2, units=['Ohm', 'sec'])
def Wo(p, f):
""" defines an open (finite-space) Warburg element
Notes
---------
.. math::
Z = \\frac{Z_0}{\\sqrt{ j \\omega \\tau }}
\\coth{\\sqrt{j \\omega \\tau }}
where :math:`Z_0` = p[0] (Ohms) and
:math:`\\tau` = p[1] (sec) = :math:`\\frac{L^2}{D}`
"""
omega = 2*np.pi*np.array(f)
Z0, tau = p[0], p[1]
Z = Z0/(np.sqrt(1j*omega*tau)*np.tanh(np.sqrt(1j*omega*tau)))
return Z # Zw(omega)
@element_metadata(num_params=2, units=['Ohm', 'sec'])
def Ws(p, f):
""" defines a short (finite-length) Warburg element
Notes
---------
.. math::
Z = \\frac{Z_0}{\\sqrt{ j \\omega \\tau }}
\\tanh{\\sqrt{j \\omega \\tau }}
where :math:`Z_0` = p[0] (Ohms) and
:math:`\\tau` = p[1] (sec) = :math:`\\frac{L^2}{D}`
"""
omega = 2*np.pi*np.array(f)
Z0, tau = p[0], p[1]
Z = Z0*np.tanh(np.sqrt(1j*omega*tau))/np.sqrt(1j*omega*tau)
return Z
@element_metadata(num_params=2, units=['Ohm^-1 sec^a', ''])
def CPE(p, f):
""" defines a constant phase element
Notes
-----
.. math::
Z = \\frac{1}{Q \\times (j 2 \\pi f)^\\alpha}
where :math:`Q` = p[0] and :math:`\\alpha` = p[1].
"""
omega = 2*np.pi*np.array(f)
Q, alpha = p
return 1.0/(Q*(1j*omega)**alpha)
@element_metadata(num_params=2, units=['Ohm', 'sec'])
def G(p, f):
""" defines a Gerischer Element as represented in [1]
Notes
---------
.. math::
Z = \\frac{R_G}{\\sqrt{1 + j \\, 2 \\pi f \\, t_G}}
where :math:`R_G` = p[0] and :math:`t_G` = p[1]
Gerischer impedance is also commonly represented as [2]:
.. math::
Z = \\frac{Z_o}{\\sqrt{K+ j \\, 2 \\pi f}}
where :math:`Z_o = \\frac{R_G}{\\sqrt{t_G}}`
and :math:`K = \\frac{1}{t_G}`
with units :math:`\\Omega sec^{1/2}` and
:math:`sec^{-1}` , respectively.
[1] <NAME>, <NAME>, and <NAME>,
Journal of The Electrochemical Society, 156, B513-B525 (2009)
`doi:10.1149/1.3079337
<https://doi.org/10.1149/1.3079337>`_.
[2] <NAME>, <NAME>, <NAME>,
<NAME>, and <NAME>, <NAME>, 1,
256-264 (2001) `doi:10.1016/0013-4686(93)85083-B
<https://doi.org/10.1016/0013-4686(93)85083-B>`_.
"""
omega = 2*np.pi*np.array(f)
R_G, t_G = p
return R_G/np.sqrt(1 + 1j*omega*t_G)
@element_metadata(num_params=3, units=['Ohm', 'sec', ''])
def Gs(p, f):
""" defines a finite-length Gerischer Element as represented in [1]
Notes
---------
.. math::
Z = \\frac{R_G}{\\sqrt{1 + j \\, 2 \\pi f \\, t_G} \\,
tanh(\\phi \\sqrt{1 + j \\, 2 \\pi f \\, t_G})}
where :math:`R_G` = p[0], :math:`t_G` = p[1] and :math:`\\phi` = p[2]
[1] <NAME>, <NAME>, and <NAME>,
Solid State Ionics, 179, 647-660 (2008)
`doi:10.1016/j.ssi.2008.04.024
<https://doi.org/10.1016/j.ssi.2008.04.024>`_.
"""
omega = 2*np.pi*np.array(f)
R_G, t_G, phi = p
Z = R_G/(np.sqrt(1 + 1j*omega*t_G) *
np.tanh(phi * np.sqrt(1 + 1j*omega*t_G)))
return Z
@element_metadata(num_params=2, units=['Ohm', 'sec'])
def K(p, f):
""" An RC element for use in lin-KK model
Notes
-----
.. math::
Z = \\frac{R}{1 + j \\omega \\tau_k}
"""
omega = 2*np.pi*np.array(f)
return p[0]/(1 + 1j*omega*p[1])
@element_metadata(num_params=4, units=['Ohm-m^2', 'Ohm-m^2', '', 'sec'])
def T(p, f):
""" A macrohomogeneous porous electrode model from Paasch et al. [1]
Notes
-----
.. math::
Z = A\\frac{\\coth{\\beta}}{\\beta} + B\\frac{1}{\\beta\\sinh{\\beta}}
where
.. math::
A = d\\frac{\\rho_1^2 + \\rho_2^2}{\\rho_1 + \\rho_2} \\quad
B = d\\frac{2 \\rho_1 \\rho_2}{\\rho_1 + \\rho_2}
and
.. math::
\\beta = (a + j \\omega b)^{1/2} \\quad
a = \\frac{k d^2}{K} \\quad b = \\frac{d^2}{K}
[1] <NAME>, <NAME>, and <NAME>,
Electrochimica Acta, 38, 2653–2662 (1993)
`doi: 10.1016/0013-4686(93)85083-B
<https://doi.org/10.1016/0013-4686(93)85083-B>`_.
"""
omega = 2*np.pi*np.array(f)
A, B, a, b = p
beta = (a + 1j*omega*b)**(1/2)
sinh = []
for x in beta:
if x < 100:
sinh.append(np.sinh(x))
else:
sinh.append(1e10)
return A/(beta*np.tanh(beta)) + B/(beta*np.array(sinh))
circuit_elements = {key: eval(key) for key in set(globals())-set(initial_state)
if key not in non_element_functions}
def get_element_from_name(name):
excluded_chars = '0123456789_'
return ''.join(char for char in name if char not in excluded_chars)
def typeChecker(p, f, name, length):
assert isinstance(p, list), \
'in {}, input must be of type list'.format(name)
for i in p:
assert isinstance(i, (float, int, np.int32, np.float64)), \
'in {}, value {} in {} is not a number'.format(name, i, p)
for i in f:
assert isinstance(i, (float, int, np.int32, np.float64)), \
'in {}, value {} in {} is not a number'.format(name, i, f)
assert len(p) == length, \
'in {}, input list must be length {}'.format(name, length)
return
|
[
"numpy.sinh",
"numpy.array",
"numpy.tanh",
"numpy.sqrt"
] |
[((1933, 1944), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (1941, 1944), True, 'import numpy as np\n'), ((2143, 2154), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (2151, 2154), True, 'import numpy as np\n'), ((2412, 2423), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (2420, 2423), True, 'import numpy as np\n'), ((2457, 2471), 'numpy.sqrt', 'np.sqrt', (['omega'], {}), '(omega)\n', (2464, 2471), True, 'import numpy as np\n'), ((2868, 2879), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (2876, 2879), True, 'import numpy as np\n'), ((3382, 3393), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (3390, 3393), True, 'import numpy as np\n'), ((3462, 3489), 'numpy.sqrt', 'np.sqrt', (['(1.0j * omega * tau)'], {}), '(1.0j * omega * tau)\n', (3469, 3489), True, 'import numpy as np\n'), ((3790, 3801), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (3798, 3801), True, 'import numpy as np\n'), ((4809, 4820), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (4817, 4820), True, 'import numpy as np\n'), ((4853, 4884), 'numpy.sqrt', 'np.sqrt', (['(1 + 1.0j * omega * t_G)'], {}), '(1 + 1.0j * omega * t_G)\n', (4860, 4884), True, 'import numpy as np\n'), ((5455, 5466), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (5463, 5466), True, 'import numpy as np\n'), ((5824, 5835), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (5832, 5835), True, 'import numpy as np\n'), ((6635, 6646), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (6643, 6646), True, 'import numpy as np\n'), ((2918, 2945), 'numpy.sqrt', 'np.sqrt', (['(1.0j * omega * tau)'], {}), '(1.0j * omega * tau)\n', (2925, 2945), True, 'import numpy as np\n'), ((5503, 5534), 'numpy.sqrt', 'np.sqrt', (['(1 + 1.0j * omega * t_G)'], {}), '(1 + 1.0j * omega * t_G)\n', (5510, 5534), True, 'import numpy as np\n'), ((2948, 2975), 'numpy.sqrt', 'np.sqrt', (['(1.0j * omega * tau)'], {}), '(1.0j * omega * tau)\n', (2955, 2975), True, 'import numpy as np\n'), ((3439, 3466), 'numpy.sqrt', 'np.sqrt', (['(1.0j * omega * tau)'], {}), '(1.0j * omega * tau)\n', (3446, 3466), True, 'import numpy as np\n'), ((6779, 6789), 'numpy.sinh', 'np.sinh', (['x'], {}), '(x)\n', (6786, 6789), True, 'import numpy as np\n'), ((6855, 6868), 'numpy.tanh', 'np.tanh', (['beta'], {}), '(beta)\n', (6862, 6868), True, 'import numpy as np\n'), ((6880, 6894), 'numpy.array', 'np.array', (['sinh'], {}), '(sinh)\n', (6888, 6894), True, 'import numpy as np\n'), ((5558, 5589), 'numpy.sqrt', 'np.sqrt', (['(1 + 1.0j * omega * t_G)'], {}), '(1 + 1.0j * omega * t_G)\n', (5565, 5589), True, 'import numpy as np\n')]
|
#!/usr/bin/env python
#
# Copyright 2012-2015 clowwindy
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import absolute_import, division, print_function, \
with_statement
import os
import sys
import hashlib
import logging
from shadowsocks import common, lru_cache
#from shadowsocks.crypto import rc4_md5, openssl, sodium, table
from shadowsocks.crypto import rc4_md5, openssl, table
method_supported = {}
method_supported.update(rc4_md5.ciphers)
method_supported.update(openssl.ciphers)
#method_supported.update(sodium.ciphers)
method_supported.update(table.ciphers)
def random_string(length):
try:
return os.urandom(length)
except NotImplementedError as e:
return openssl.rand_bytes(length)
cached_keys = lru_cache.LRUCache(timeout=180)
def try_cipher(key, method=None):
Encryptor(key, method)
def EVP_BytesToKey(password, key_len, iv_len, cache):
# equivalent to OpenSSL's EVP_BytesToKey() with count 1
# so that we make the same key and iv as nodejs version
cached_key = '%s-%d-%d' % (password, key_len, iv_len)
r = cached_keys.get(cached_key, None)
if r:
return r
m = []
i = 0
while len(b''.join(m)) < (key_len + iv_len):
md5 = hashlib.md5()
data = password
if i > 0:
data = m[i - 1] + password
md5.update(data)
m.append(md5.digest())
i += 1
ms = b''.join(m)
key = ms[:key_len]
iv = ms[key_len:key_len + iv_len]
if cache:
cached_keys[cached_key] = (key, iv)
cached_keys.sweep()
return key, iv
class Encryptor(object):
def __init__(self, key, method, iv = None, cache = False):
self.key = key
self.method = method
self.iv = None
self.iv_sent = False
self.cipher_iv = b''
self.iv_buf = b''
self.cipher_key = b''
self.decipher = None
self.cache = cache
method = method.lower()
self._method_info = self.get_method_info(method)
if self._method_info:
if iv is None or len(iv) != self._method_info[1]:
self.cipher = self.get_cipher(key, method, 1,
random_string(self._method_info[1]))
else:
self.cipher = self.get_cipher(key, method, 1, iv)
else:
logging.error('method %s not supported' % method)
sys.exit(1)
def get_method_info(self, method):
method = method.lower()
m = method_supported.get(method)
return m
def iv_len(self):
return len(self.cipher_iv)
def get_cipher(self, password, method, op, iv):
password = common.to_bytes(password)
m = self._method_info
if m[0] > 0:
key, iv_ = EVP_BytesToKey(password, m[0], m[1], self.cache)
else:
# key_length == 0 indicates we should use the key directly
key, iv = password, b''
iv = iv[:m[1]]
if op == 1:
# this iv is for cipher not decipher
self.cipher_iv = iv[:m[1]]
self.cipher_key = key
return m[2](method, key, iv, op)
def encrypt(self, buf):
if len(buf) == 0:
if not self.iv_sent:
self.iv_sent = True
return self.cipher_iv
return buf
if self.iv_sent:
return self.cipher.update(buf)
else:
self.iv_sent = True
return self.cipher_iv + self.cipher.update(buf)
def decrypt(self, buf):
if len(buf) == 0:
return buf
if self.decipher is not None: #optimize
return self.decipher.update(buf)
decipher_iv_len = self._method_info[1]
if len(self.iv_buf) <= decipher_iv_len:
self.iv_buf += buf
if len(self.iv_buf) > decipher_iv_len:
decipher_iv = self.iv_buf[:decipher_iv_len]
self.decipher = self.get_cipher(self.key, self.method, 0,
iv=decipher_iv)
buf = self.iv_buf[decipher_iv_len:]
del self.iv_buf
return self.decipher.update(buf)
else:
return b''
def dispose(self):
if self.decipher is not None:
self.decipher.clean()
self.decipher = None
def encrypt_all(password, method, op, data):
result = []
method = method.lower()
(key_len, iv_len, m) = method_supported[method]
if key_len > 0:
key, _ = EVP_BytesToKey(password, key_len, iv_len, True)
else:
key = password
if op:
iv = random_string(iv_len)
result.append(iv)
else:
iv = data[:iv_len]
data = data[iv_len:]
cipher = m(method, key, iv, op)
result.append(cipher.update(data))
return b''.join(result)
def encrypt_key(password, method):
method = method.lower()
(key_len, iv_len, m) = method_supported[method]
if key_len > 0:
key, _ = EVP_BytesToKey(password, key_len, iv_len, True)
else:
key = password
return key
def encrypt_iv_len(method):
method = method.lower()
(key_len, iv_len, m) = method_supported[method]
return iv_len
def encrypt_new_iv(method):
method = method.lower()
(key_len, iv_len, m) = method_supported[method]
return random_string(iv_len)
def encrypt_all_iv(key, method, op, data, ref_iv):
result = []
method = method.lower()
(key_len, iv_len, m) = method_supported[method]
if op:
iv = ref_iv[0]
result.append(iv)
else:
iv = data[:iv_len]
data = data[iv_len:]
ref_iv[0] = iv
cipher = m(method, key, iv, op)
result.append(cipher.update(data))
return b''.join(result)
CIPHERS_TO_TEST = [
'aes-128-cfb',
'aes-256-cfb',
'rc4-md5',
'salsa20',
'chacha20',
'table',
]
def test_encryptor():
from os import urandom
plain = urandom(10240)
for method in CIPHERS_TO_TEST:
logging.warn(method)
encryptor = Encryptor(b'key', method)
decryptor = Encryptor(b'key', method)
cipher = encryptor.encrypt(plain)
plain2 = decryptor.decrypt(cipher)
assert plain == plain2
def test_encrypt_all():
from os import urandom
plain = urandom(10240)
for method in CIPHERS_TO_TEST:
logging.warn(method)
cipher = encrypt_all(b'key', method, 1, plain)
plain2 = encrypt_all(b'key', method, 0, cipher)
assert plain == plain2
if __name__ == '__main__':
test_encrypt_all()
test_encryptor()
|
[
"logging.error",
"hashlib.md5",
"logging.warn",
"shadowsocks.crypto.openssl.rand_bytes",
"shadowsocks.common.to_bytes",
"shadowsocks.lru_cache.LRUCache",
"os.urandom",
"sys.exit"
] |
[((1256, 1287), 'shadowsocks.lru_cache.LRUCache', 'lru_cache.LRUCache', ([], {'timeout': '(180)'}), '(timeout=180)\n', (1274, 1287), False, 'from shadowsocks import common, lru_cache\n'), ((6445, 6459), 'os.urandom', 'urandom', (['(10240)'], {}), '(10240)\n', (6452, 6459), False, 'from os import urandom\n'), ((6797, 6811), 'os.urandom', 'urandom', (['(10240)'], {}), '(10240)\n', (6804, 6811), False, 'from os import urandom\n'), ((1143, 1161), 'os.urandom', 'os.urandom', (['length'], {}), '(length)\n', (1153, 1161), False, 'import os\n'), ((1738, 1751), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (1749, 1751), False, 'import hashlib\n'), ((3192, 3217), 'shadowsocks.common.to_bytes', 'common.to_bytes', (['password'], {}), '(password)\n', (3207, 3217), False, 'from shadowsocks import common, lru_cache\n'), ((6503, 6523), 'logging.warn', 'logging.warn', (['method'], {}), '(method)\n', (6515, 6523), False, 'import logging\n'), ((6855, 6875), 'logging.warn', 'logging.warn', (['method'], {}), '(method)\n', (6867, 6875), False, 'import logging\n'), ((1214, 1240), 'shadowsocks.crypto.openssl.rand_bytes', 'openssl.rand_bytes', (['length'], {}), '(length)\n', (1232, 1240), False, 'from shadowsocks.crypto import rc4_md5, openssl, table\n'), ((2858, 2907), 'logging.error', 'logging.error', (["('method %s not supported' % method)"], {}), "('method %s not supported' % method)\n", (2871, 2907), False, 'import logging\n'), ((2920, 2931), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (2928, 2931), False, 'import sys\n')]
|
import builtins
import copyreg
import gc
import itertools
import math
import pickle
import sys
import types
import unittest
import weakref
from copy import deepcopy
from test import support
class OperatorsTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
self.binops = {
'add': '+',
'sub': '-',
'mul': '*',
'matmul': '@',
'truediv': '/',
'floordiv': '//',
'divmod': 'divmod',
'pow': '**',
'lshift': '<<',
'rshift': '>>',
'and': '&',
'xor': '^',
'or': '|',
'cmp': 'cmp',
'lt': '<',
'le': '<=',
'eq': '==',
'ne': '!=',
'gt': '>',
'ge': '>=',
}
for name, expr in list(self.binops.items()):
if expr.islower():
expr = expr + "(a, b)"
else:
expr = 'a %s b' % expr
self.binops[name] = expr
self.unops = {
'pos': '+',
'neg': '-',
'abs': 'abs',
'invert': '~',
'int': 'int',
'float': 'float',
}
for name, expr in list(self.unops.items()):
if expr.islower():
expr = expr + "(a)"
else:
expr = '%s a' % expr
self.unops[name] = expr
def unop_test(self, a, res, expr="len(a)", meth="__len__"):
d = {'a': a}
self.assertEqual(eval(expr, d), res)
t = type(a)
m = getattr(t, meth)
# Find method in parent class
while meth not in t.__dict__:
t = t.__bases__[0]
# in some implementations (e.g. PyPy), 'm' can be a regular unbound
# method object; the getattr() below obtains its underlying function.
self.assertEqual(getattr(m, 'im_func', m), t.__dict__[meth])
self.assertEqual(m(a), res)
bm = getattr(a, meth)
self.assertEqual(bm(), res)
def binop_test(self, a, b, res, expr="a+b", meth="__add__"):
d = {'a': a, 'b': b}
self.assertEqual(eval(expr, d), res)
t = type(a)
m = getattr(t, meth)
while meth not in t.__dict__:
t = t.__bases__[0]
# in some implementations (e.g. PyPy), 'm' can be a regular unbound
# method object; the getattr() below obtains its underlying function.
self.assertEqual(getattr(m, 'im_func', m), t.__dict__[meth])
self.assertEqual(m(a, b), res)
bm = getattr(a, meth)
self.assertEqual(bm(b), res)
def sliceop_test(self, a, b, c, res, expr="a[b:c]", meth="__getitem__"):
d = {'a': a, 'b': b, 'c': c}
self.assertEqual(eval(expr, d), res)
t = type(a)
m = getattr(t, meth)
while meth not in t.__dict__:
t = t.__bases__[0]
# in some implementations (e.g. PyPy), 'm' can be a regular unbound
# method object; the getattr() below obtains its underlying function.
self.assertEqual(getattr(m, 'im_func', m), t.__dict__[meth])
self.assertEqual(m(a, slice(b, c)), res)
bm = getattr(a, meth)
self.assertEqual(bm(slice(b, c)), res)
def setop_test(self, a, b, res, stmt="a+=b", meth="__iadd__"):
d = {'a': deepcopy(a), 'b': b}
exec(stmt, d)
self.assertEqual(d['a'], res)
t = type(a)
m = getattr(t, meth)
while meth not in t.__dict__:
t = t.__bases__[0]
# in some implementations (e.g. PyPy), 'm' can be a regular unbound
# method object; the getattr() below obtains its underlying function.
self.assertEqual(getattr(m, 'im_func', m), t.__dict__[meth])
d['a'] = deepcopy(a)
m(d['a'], b)
self.assertEqual(d['a'], res)
d['a'] = deepcopy(a)
bm = getattr(d['a'], meth)
bm(b)
self.assertEqual(d['a'], res)
def set2op_test(self, a, b, c, res, stmt="a[b]=c", meth="__setitem__"):
d = {'a': deepcopy(a), 'b': b, 'c': c}
exec(stmt, d)
self.assertEqual(d['a'], res)
t = type(a)
m = getattr(t, meth)
while meth not in t.__dict__:
t = t.__bases__[0]
# in some implementations (e.g. PyPy), 'm' can be a regular unbound
# method object; the getattr() below obtains its underlying function.
self.assertEqual(getattr(m, 'im_func', m), t.__dict__[meth])
d['a'] = deepcopy(a)
m(d['a'], b, c)
self.assertEqual(d['a'], res)
d['a'] = deepcopy(a)
bm = getattr(d['a'], meth)
bm(b, c)
self.assertEqual(d['a'], res)
def setsliceop_test(self, a, b, c, d, res, stmt="a[b:c]=d", meth="__setitem__"):
dictionary = {'a': deepcopy(a), 'b': b, 'c': c, 'd': d}
exec(stmt, dictionary)
self.assertEqual(dictionary['a'], res)
t = type(a)
while meth not in t.__dict__:
t = t.__bases__[0]
m = getattr(t, meth)
# in some implementations (e.g. PyPy), 'm' can be a regular unbound
# method object; the getattr() below obtains its underlying function.
self.assertEqual(getattr(m, 'im_func', m), t.__dict__[meth])
dictionary['a'] = deepcopy(a)
m(dictionary['a'], slice(b, c), d)
self.assertEqual(dictionary['a'], res)
dictionary['a'] = deepcopy(a)
bm = getattr(dictionary['a'], meth)
bm(slice(b, c), d)
self.assertEqual(dictionary['a'], res)
def test_lists(self):
# Testing list operations...
# Asserts are within individual test methods
self.binop_test([1], [2], [1,2], "a+b", "__add__")
self.binop_test([1,2,3], 2, 1, "b in a", "__contains__")
self.binop_test([1,2,3], 4, 0, "b in a", "__contains__")
self.binop_test([1,2,3], 1, 2, "a[b]", "__getitem__")
self.sliceop_test([1,2,3], 0, 2, [1,2], "a[b:c]", "__getitem__")
self.setop_test([1], [2], [1,2], "a+=b", "__iadd__")
self.setop_test([1,2], 3, [1,2,1,2,1,2], "a*=b", "__imul__")
self.unop_test([1,2,3], 3, "len(a)", "__len__")
self.binop_test([1,2], 3, [1,2,1,2,1,2], "a*b", "__mul__")
self.binop_test([1,2], 3, [1,2,1,2,1,2], "b*a", "__rmul__")
self.set2op_test([1,2], 1, 3, [1,3], "a[b]=c", "__setitem__")
self.setsliceop_test([1,2,3,4], 1, 3, [5,6], [1,5,6,4], "a[b:c]=d",
"__setitem__")
def test_dicts(self):
# Testing dict operations...
self.binop_test({1:2,3:4}, 1, 1, "b in a", "__contains__")
self.binop_test({1:2,3:4}, 2, 0, "b in a", "__contains__")
self.binop_test({1:2,3:4}, 1, 2, "a[b]", "__getitem__")
d = {1:2, 3:4}
l1 = []
for i in list(d.keys()):
l1.append(i)
l = []
for i in iter(d):
l.append(i)
self.assertEqual(l, l1)
l = []
for i in d.__iter__():
l.append(i)
self.assertEqual(l, l1)
l = []
for i in dict.__iter__(d):
l.append(i)
self.assertEqual(l, l1)
d = {1:2, 3:4}
self.unop_test(d, 2, "len(a)", "__len__")
self.assertEqual(eval(repr(d), {}), d)
self.assertEqual(eval(d.__repr__(), {}), d)
self.set2op_test({1:2,3:4}, 2, 3, {1:2,2:3,3:4}, "a[b]=c",
"__setitem__")
# Tests for unary and binary operators
def number_operators(self, a, b, skip=[]):
dict = {'a': a, 'b': b}
for name, expr in self.binops.items():
if name not in skip:
name = "__%s__" % name
if hasattr(a, name):
res = eval(expr, dict)
self.binop_test(a, b, res, expr, name)
for name, expr in list(self.unops.items()):
if name not in skip:
name = "__%s__" % name
if hasattr(a, name):
res = eval(expr, dict)
self.unop_test(a, res, expr, name)
def test_ints(self):
# Testing int operations...
self.number_operators(100, 3)
# The following crashes in Python 2.2
self.assertEqual((1).__bool__(), 1)
self.assertEqual((0).__bool__(), 0)
# This returns 'NotImplemented' in Python 2.2
class C(int):
def __add__(self, other):
return NotImplemented
self.assertEqual(C(5), 5)
try:
C() + ""
except TypeError:
pass
else:
self.fail("NotImplemented should have caused TypeError")
def test_floats(self):
# Testing float operations...
self.number_operators(100.0, 3.0)
def test_complexes(self):
# Testing complex operations...
self.number_operators(100.0j, 3.0j, skip=['lt', 'le', 'gt', 'ge',
'int', 'float',
'floordiv', 'divmod', 'mod'])
class Number(complex):
__slots__ = ['prec']
def __new__(cls, *args, **kwds):
result = complex.__new__(cls, *args)
result.prec = kwds.get('prec', 12)
return result
def __repr__(self):
prec = self.prec
if self.imag == 0.0:
return "%.*g" % (prec, self.real)
if self.real == 0.0:
return "%.*gj" % (prec, self.imag)
return "(%.*g+%.*gj)" % (prec, self.real, prec, self.imag)
__str__ = __repr__
a = Number(3.14, prec=6)
self.assertEqual(repr(a), "3.14")
self.assertEqual(a.prec, 6)
a = Number(a, prec=2)
self.assertEqual(repr(a), "3.1")
self.assertEqual(a.prec, 2)
a = Number(234.5)
self.assertEqual(repr(a), "234.5")
self.assertEqual(a.prec, 12)
def test_explicit_reverse_methods(self):
# see issue 9930
self.assertEqual(complex.__radd__(3j, 4.0), complex(4.0, 3.0))
self.assertEqual(float.__rsub__(3.0, 1), -2.0)
@support.impl_detail("the module 'xxsubtype' is internal")
def test_spam_lists(self):
# Testing spamlist operations...
import copy, xxsubtype as spam
def spamlist(l, memo=None):
import xxsubtype as spam
return spam.spamlist(l)
# This is an ugly hack:
copy._deepcopy_dispatch[spam.spamlist] = spamlist
self.binop_test(spamlist([1]), spamlist([2]), spamlist([1,2]), "a+b",
"__add__")
self.binop_test(spamlist([1,2,3]), 2, 1, "b in a", "__contains__")
self.binop_test(spamlist([1,2,3]), 4, 0, "b in a", "__contains__")
self.binop_test(spamlist([1,2,3]), 1, 2, "a[b]", "__getitem__")
self.sliceop_test(spamlist([1,2,3]), 0, 2, spamlist([1,2]), "a[b:c]",
"__getitem__")
self.setop_test(spamlist([1]), spamlist([2]), spamlist([1,2]), "a+=b",
"__iadd__")
self.setop_test(spamlist([1,2]), 3, spamlist([1,2,1,2,1,2]), "a*=b",
"__imul__")
self.unop_test(spamlist([1,2,3]), 3, "len(a)", "__len__")
self.binop_test(spamlist([1,2]), 3, spamlist([1,2,1,2,1,2]), "a*b",
"__mul__")
self.binop_test(spamlist([1,2]), 3, spamlist([1,2,1,2,1,2]), "b*a",
"__rmul__")
self.set2op_test(spamlist([1,2]), 1, 3, spamlist([1,3]), "a[b]=c",
"__setitem__")
self.setsliceop_test(spamlist([1,2,3,4]), 1, 3, spamlist([5,6]),
spamlist([1,5,6,4]), "a[b:c]=d", "__setitem__")
# Test subclassing
class C(spam.spamlist):
def foo(self): return 1
a = C()
self.assertEqual(a, [])
self.assertEqual(a.foo(), 1)
a.append(100)
self.assertEqual(a, [100])
self.assertEqual(a.getstate(), 0)
a.setstate(42)
self.assertEqual(a.getstate(), 42)
@support.impl_detail("the module 'xxsubtype' is internal")
def test_spam_dicts(self):
# Testing spamdict operations...
import copy, xxsubtype as spam
def spamdict(d, memo=None):
import xxsubtype as spam
sd = spam.spamdict()
for k, v in list(d.items()):
sd[k] = v
return sd
# This is an ugly hack:
copy._deepcopy_dispatch[spam.spamdict] = spamdict
self.binop_test(spamdict({1:2,3:4}), 1, 1, "b in a", "__contains__")
self.binop_test(spamdict({1:2,3:4}), 2, 0, "b in a", "__contains__")
self.binop_test(spamdict({1:2,3:4}), 1, 2, "a[b]", "__getitem__")
d = spamdict({1:2,3:4})
l1 = []
for i in list(d.keys()):
l1.append(i)
l = []
for i in iter(d):
l.append(i)
self.assertEqual(l, l1)
l = []
for i in d.__iter__():
l.append(i)
self.assertEqual(l, l1)
l = []
for i in type(spamdict({})).__iter__(d):
l.append(i)
self.assertEqual(l, l1)
straightd = {1:2, 3:4}
spamd = spamdict(straightd)
self.unop_test(spamd, 2, "len(a)", "__len__")
self.unop_test(spamd, repr(straightd), "repr(a)", "__repr__")
self.set2op_test(spamdict({1:2,3:4}), 2, 3, spamdict({1:2,2:3,3:4}),
"a[b]=c", "__setitem__")
# Test subclassing
class C(spam.spamdict):
def foo(self): return 1
a = C()
self.assertEqual(list(a.items()), [])
self.assertEqual(a.foo(), 1)
a['foo'] = 'bar'
self.assertEqual(list(a.items()), [('foo', 'bar')])
self.assertEqual(a.getstate(), 0)
a.setstate(100)
self.assertEqual(a.getstate(), 100)
class ClassPropertiesAndMethods(unittest.TestCase):
def assertHasAttr(self, obj, name):
self.assertTrue(hasattr(obj, name),
'%r has no attribute %r' % (obj, name))
def assertNotHasAttr(self, obj, name):
self.assertFalse(hasattr(obj, name),
'%r has unexpected attribute %r' % (obj, name))
def test_python_dicts(self):
# Testing Python subclass of dict...
self.assertTrue(issubclass(dict, dict))
self.assertIsInstance({}, dict)
d = dict()
self.assertEqual(d, {})
self.assertIs(d.__class__, dict)
self.assertIsInstance(d, dict)
class C(dict):
state = -1
def __init__(self_local, *a, **kw):
if a:
self.assertEqual(len(a), 1)
self_local.state = a[0]
if kw:
for k, v in list(kw.items()):
self_local[v] = k
def __getitem__(self, key):
return self.get(key, 0)
def __setitem__(self_local, key, value):
self.assertIsInstance(key, type(0))
dict.__setitem__(self_local, key, value)
def setstate(self, state):
self.state = state
def getstate(self):
return self.state
self.assertTrue(issubclass(C, dict))
a1 = C(12)
self.assertEqual(a1.state, 12)
a2 = C(foo=1, bar=2)
self.assertEqual(a2[1] == 'foo' and a2[2], 'bar')
a = C()
self.assertEqual(a.state, -1)
self.assertEqual(a.getstate(), -1)
a.setstate(0)
self.assertEqual(a.state, 0)
self.assertEqual(a.getstate(), 0)
a.setstate(10)
self.assertEqual(a.state, 10)
self.assertEqual(a.getstate(), 10)
self.assertEqual(a[42], 0)
a[42] = 24
self.assertEqual(a[42], 24)
N = 50
for i in range(N):
a[i] = C()
for j in range(N):
a[i][j] = i*j
for i in range(N):
for j in range(N):
self.assertEqual(a[i][j], i*j)
def test_python_lists(self):
# Testing Python subclass of list...
class C(list):
def __getitem__(self, i):
if isinstance(i, slice):
return i.start, i.stop
return list.__getitem__(self, i) + 100
a = C()
a.extend([0,1,2])
self.assertEqual(a[0], 100)
self.assertEqual(a[1], 101)
self.assertEqual(a[2], 102)
self.assertEqual(a[100:200], (100,200))
def test_metaclass(self):
# Testing metaclasses...
class C(metaclass=type):
def __init__(self):
self.__state = 0
def getstate(self):
return self.__state
def setstate(self, state):
self.__state = state
a = C()
self.assertEqual(a.getstate(), 0)
a.setstate(10)
self.assertEqual(a.getstate(), 10)
class _metaclass(type):
def myself(cls): return cls
class D(metaclass=_metaclass):
pass
self.assertEqual(D.myself(), D)
d = D()
self.assertEqual(d.__class__, D)
class M1(type):
def __new__(cls, name, bases, dict):
dict['__spam__'] = 1
return type.__new__(cls, name, bases, dict)
class C(metaclass=M1):
pass
self.assertEqual(C.__spam__, 1)
c = C()
self.assertEqual(c.__spam__, 1)
class _instance(object):
pass
class M2(object):
@staticmethod
def __new__(cls, name, bases, dict):
self = object.__new__(cls)
self.name = name
self.bases = bases
self.dict = dict
return self
def __call__(self):
it = _instance()
# Early binding of methods
for key in self.dict:
if key.startswith("__"):
continue
setattr(it, key, self.dict[key].__get__(it, self))
return it
class C(metaclass=M2):
def spam(self):
return 42
self.assertEqual(C.name, 'C')
self.assertEqual(C.bases, ())
self.assertIn('spam', C.dict)
c = C()
self.assertEqual(c.spam(), 42)
# More metaclass examples
class autosuper(type):
# Automatically add __super to the class
# This trick only works for dynamic classes
def __new__(metaclass, name, bases, dict):
cls = super(autosuper, metaclass).__new__(metaclass,
name, bases, dict)
# Name mangling for __super removes leading underscores
while name[:1] == "_":
name = name[1:]
if name:
name = "_%s__super" % name
else:
name = "__super"
setattr(cls, name, super(cls))
return cls
class A(metaclass=autosuper):
def meth(self):
return "A"
class B(A):
def meth(self):
return "B" + self.__super.meth()
class C(A):
def meth(self):
return "C" + self.__super.meth()
class D(C, B):
def meth(self):
return "D" + self.__super.meth()
self.assertEqual(D().meth(), "DCBA")
class E(B, C):
def meth(self):
return "E" + self.__super.meth()
self.assertEqual(E().meth(), "EBCA")
class autoproperty(type):
# Automatically create property attributes when methods
# named _get_x and/or _set_x are found
def __new__(metaclass, name, bases, dict):
hits = {}
for key, val in dict.items():
if key.startswith("_get_"):
key = key[5:]
get, set = hits.get(key, (None, None))
get = val
hits[key] = get, set
elif key.startswith("_set_"):
key = key[5:]
get, set = hits.get(key, (None, None))
set = val
hits[key] = get, set
for key, (get, set) in hits.items():
dict[key] = property(get, set)
return super(autoproperty, metaclass).__new__(metaclass,
name, bases, dict)
class A(metaclass=autoproperty):
def _get_x(self):
return -self.__x
def _set_x(self, x):
self.__x = -x
a = A()
self.assertNotHasAttr(a, "x")
a.x = 12
self.assertEqual(a.x, 12)
self.assertEqual(a._A__x, -12)
class multimetaclass(autoproperty, autosuper):
# Merge of multiple cooperating metaclasses
pass
class A(metaclass=multimetaclass):
def _get_x(self):
return "A"
class B(A):
def _get_x(self):
return "B" + self.__super._get_x()
class C(A):
def _get_x(self):
return "C" + self.__super._get_x()
class D(C, B):
def _get_x(self):
return "D" + self.__super._get_x()
self.assertEqual(D().x, "DCBA")
# Make sure type(x) doesn't call x.__class__.__init__
class T(type):
counter = 0
def __init__(self, *args):
T.counter += 1
class C(metaclass=T):
pass
self.assertEqual(T.counter, 1)
a = C()
self.assertEqual(type(a), C)
self.assertEqual(T.counter, 1)
class C(object): pass
c = C()
try: c()
except TypeError: pass
else: self.fail("calling object w/o call method should raise "
"TypeError")
# Testing code to find most derived baseclass
class A(type):
def __new__(*args, **kwargs):
return type.__new__(*args, **kwargs)
class B(object):
pass
class C(object, metaclass=A):
pass
# The most derived metaclass of D is A rather than type.
class D(B, C):
pass
self.assertIs(A, type(D))
# issue1294232: correct metaclass calculation
new_calls = [] # to check the order of __new__ calls
class AMeta(type):
@staticmethod
def __new__(mcls, name, bases, ns):
new_calls.append('AMeta')
return super().__new__(mcls, name, bases, ns)
@classmethod
def __prepare__(mcls, name, bases):
return {}
class BMeta(AMeta):
@staticmethod
def __new__(mcls, name, bases, ns):
new_calls.append('BMeta')
return super().__new__(mcls, name, bases, ns)
@classmethod
def __prepare__(mcls, name, bases):
ns = super().__prepare__(name, bases)
ns['BMeta_was_here'] = True
return ns
class A(metaclass=AMeta):
pass
self.assertEqual(['AMeta'], new_calls)
new_calls.clear()
class B(metaclass=BMeta):
pass
# BMeta.__new__ calls AMeta.__new__ with super:
self.assertEqual(['BMeta', 'AMeta'], new_calls)
new_calls.clear()
class C(A, B):
pass
# The most derived metaclass is BMeta:
self.assertEqual(['BMeta', 'AMeta'], new_calls)
new_calls.clear()
# BMeta.__prepare__ should've been called:
self.assertIn('BMeta_was_here', C.__dict__)
# The order of the bases shouldn't matter:
class C2(B, A):
pass
self.assertEqual(['BMeta', 'AMeta'], new_calls)
new_calls.clear()
self.assertIn('BMeta_was_here', C2.__dict__)
# Check correct metaclass calculation when a metaclass is declared:
class D(C, metaclass=type):
pass
self.assertEqual(['BMeta', 'AMeta'], new_calls)
new_calls.clear()
self.assertIn('BMeta_was_here', D.__dict__)
class E(C, metaclass=AMeta):
pass
self.assertEqual(['BMeta', 'AMeta'], new_calls)
new_calls.clear()
self.assertIn('BMeta_was_here', E.__dict__)
# Special case: the given metaclass isn't a class,
# so there is no metaclass calculation.
marker = object()
def func(*args, **kwargs):
return marker
class X(metaclass=func):
pass
class Y(object, metaclass=func):
pass
class Z(D, metaclass=func):
pass
self.assertIs(marker, X)
self.assertIs(marker, Y)
self.assertIs(marker, Z)
# The given metaclass is a class,
# but not a descendant of type.
prepare_calls = [] # to track __prepare__ calls
class ANotMeta:
def __new__(mcls, *args, **kwargs):
new_calls.append('ANotMeta')
return super().__new__(mcls)
@classmethod
def __prepare__(mcls, name, bases):
prepare_calls.append('ANotMeta')
return {}
class BNotMeta(ANotMeta):
def __new__(mcls, *args, **kwargs):
new_calls.append('BNotMeta')
return super().__new__(mcls)
@classmethod
def __prepare__(mcls, name, bases):
prepare_calls.append('BNotMeta')
return super().__prepare__(name, bases)
class A(metaclass=ANotMeta):
pass
self.assertIs(ANotMeta, type(A))
self.assertEqual(['ANotMeta'], prepare_calls)
prepare_calls.clear()
self.assertEqual(['ANotMeta'], new_calls)
new_calls.clear()
class B(metaclass=BNotMeta):
pass
self.assertIs(BNotMeta, type(B))
self.assertEqual(['BNotMeta', 'ANotMeta'], prepare_calls)
prepare_calls.clear()
self.assertEqual(['BNotMeta', 'ANotMeta'], new_calls)
new_calls.clear()
class C(A, B):
pass
self.assertIs(BNotMeta, type(C))
self.assertEqual(['BNotMeta', 'ANotMeta'], new_calls)
new_calls.clear()
self.assertEqual(['BNotMeta', 'ANotMeta'], prepare_calls)
prepare_calls.clear()
class C2(B, A):
pass
self.assertIs(BNotMeta, type(C2))
self.assertEqual(['BNotMeta', 'ANotMeta'], new_calls)
new_calls.clear()
self.assertEqual(['BNotMeta', 'ANotMeta'], prepare_calls)
prepare_calls.clear()
# This is a TypeError, because of a metaclass conflict:
# BNotMeta is neither a subclass, nor a superclass of type
with self.assertRaises(TypeError):
class D(C, metaclass=type):
pass
class E(C, metaclass=ANotMeta):
pass
self.assertIs(BNotMeta, type(E))
self.assertEqual(['BNotMeta', 'ANotMeta'], new_calls)
new_calls.clear()
self.assertEqual(['BNotMeta', 'ANotMeta'], prepare_calls)
prepare_calls.clear()
class F(object(), C):
pass
self.assertIs(BNotMeta, type(F))
self.assertEqual(['BNotMeta', 'ANotMeta'], new_calls)
new_calls.clear()
self.assertEqual(['BNotMeta', 'ANotMeta'], prepare_calls)
prepare_calls.clear()
class F2(C, object()):
pass
self.assertIs(BNotMeta, type(F2))
self.assertEqual(['BNotMeta', 'ANotMeta'], new_calls)
new_calls.clear()
self.assertEqual(['BNotMeta', 'ANotMeta'], prepare_calls)
prepare_calls.clear()
# TypeError: BNotMeta is neither a
# subclass, nor a superclass of int
with self.assertRaises(TypeError):
class X(C, int()):
pass
with self.assertRaises(TypeError):
class X(int(), C):
pass
def test_module_subclasses(self):
# Testing Python subclass of module...
log = []
MT = type(sys)
class MM(MT):
def __init__(self, name):
MT.__init__(self, name)
def __getattribute__(self, name):
log.append(("getattr", name))
return MT.__getattribute__(self, name)
def __setattr__(self, name, value):
log.append(("setattr", name, value))
MT.__setattr__(self, name, value)
def __delattr__(self, name):
log.append(("delattr", name))
MT.__delattr__(self, name)
a = MM("a")
a.foo = 12
x = a.foo
del a.foo
self.assertEqual(log, [("setattr", "foo", 12),
("getattr", "foo"),
("delattr", "foo")])
# http://python.org/sf/1174712
try:
class Module(types.ModuleType, str):
pass
except TypeError:
pass
else:
self.fail("inheriting from ModuleType and str at the same time "
"should fail")
def test_multiple_inheritance(self):
# Testing multiple inheritance...
class C(object):
def __init__(self):
self.__state = 0
def getstate(self):
return self.__state
def setstate(self, state):
self.__state = state
a = C()
self.assertEqual(a.getstate(), 0)
a.setstate(10)
self.assertEqual(a.getstate(), 10)
class D(dict, C):
def __init__(self):
type({}).__init__(self)
C.__init__(self)
d = D()
self.assertEqual(list(d.keys()), [])
d["hello"] = "world"
self.assertEqual(list(d.items()), [("hello", "world")])
self.assertEqual(d["hello"], "world")
self.assertEqual(d.getstate(), 0)
d.setstate(10)
self.assertEqual(d.getstate(), 10)
self.assertEqual(D.__mro__, (D, dict, C, object))
# SF bug #442833
class Node(object):
def __int__(self):
return int(self.foo())
def foo(self):
return "23"
class Frag(Node, list):
def foo(self):
return "42"
self.assertEqual(Node().__int__(), 23)
self.assertEqual(int(Node()), 23)
self.assertEqual(Frag().__int__(), 42)
self.assertEqual(int(Frag()), 42)
def test_diamond_inheritence(self):
# Testing multiple inheritance special cases...
class A(object):
def spam(self): return "A"
self.assertEqual(A().spam(), "A")
class B(A):
def boo(self): return "B"
def spam(self): return "B"
self.assertEqual(B().spam(), "B")
self.assertEqual(B().boo(), "B")
class C(A):
def boo(self): return "C"
self.assertEqual(C().spam(), "A")
self.assertEqual(C().boo(), "C")
class D(B, C): pass
self.assertEqual(D().spam(), "B")
self.assertEqual(D().boo(), "B")
self.assertEqual(D.__mro__, (D, B, C, A, object))
class E(C, B): pass
self.assertEqual(E().spam(), "B")
self.assertEqual(E().boo(), "C")
self.assertEqual(E.__mro__, (E, C, B, A, object))
# MRO order disagreement
try:
class F(D, E): pass
except TypeError:
pass
else:
self.fail("expected MRO order disagreement (F)")
try:
class G(E, D): pass
except TypeError:
pass
else:
self.fail("expected MRO order disagreement (G)")
# see thread python-dev/2002-October/029035.html
def test_ex5_from_c3_switch(self):
# Testing ex5 from C3 switch discussion...
class A(object): pass
class B(object): pass
class C(object): pass
class X(A): pass
class Y(A): pass
class Z(X,B,Y,C): pass
self.assertEqual(Z.__mro__, (Z, X, B, Y, A, C, object))
# see "A Monotonic Superclass Linearization for Dylan",
# by <NAME> et al. (OOPSLA 1996)
def test_monotonicity(self):
# Testing MRO monotonicity...
class Boat(object): pass
class DayBoat(Boat): pass
class WheelBoat(Boat): pass
class EngineLess(DayBoat): pass
class SmallMultihull(DayBoat): pass
class PedalWheelBoat(EngineLess,WheelBoat): pass
class SmallCatamaran(SmallMultihull): pass
class Pedalo(PedalWheelBoat,SmallCatamaran): pass
self.assertEqual(PedalWheelBoat.__mro__,
(PedalWheelBoat, EngineLess, DayBoat, WheelBoat, Boat, object))
self.assertEqual(SmallCatamaran.__mro__,
(SmallCatamaran, SmallMultihull, DayBoat, Boat, object))
self.assertEqual(Pedalo.__mro__,
(Pedalo, PedalWheelBoat, EngineLess, SmallCatamaran,
SmallMultihull, DayBoat, WheelBoat, Boat, object))
# see "A Monotonic Superclass Linearization for Dylan",
# by <NAME> et al. (OOPSLA 1996)
def test_consistency_with_epg(self):
# Testing consistency with EPG...
class Pane(object): pass
class ScrollingMixin(object): pass
class EditingMixin(object): pass
class ScrollablePane(Pane,ScrollingMixin): pass
class EditablePane(Pane,EditingMixin): pass
class EditableScrollablePane(ScrollablePane,EditablePane): pass
self.assertEqual(EditableScrollablePane.__mro__,
(EditableScrollablePane, ScrollablePane, EditablePane, Pane,
ScrollingMixin, EditingMixin, object))
def test_mro_disagreement(self):
# Testing error messages for MRO disagreement...
mro_err_msg = """Cannot create a consistent method resolution
order (MRO) for bases """
def raises(exc, expected, callable, *args):
try:
callable(*args)
except exc as msg:
# the exact msg is generally considered an impl detail
if support.check_impl_detail():
if not str(msg).startswith(expected):
self.fail("Message %r, expected %r" %
(str(msg), expected))
else:
self.fail("Expected %s" % exc)
class A(object): pass
class B(A): pass
class C(object): pass
# Test some very simple errors
raises(TypeError, "duplicate base class A",
type, "X", (A, A), {})
raises(TypeError, mro_err_msg,
type, "X", (A, B), {})
raises(TypeError, mro_err_msg,
type, "X", (A, C, B), {})
# Test a slightly more complex error
class GridLayout(object): pass
class HorizontalGrid(GridLayout): pass
class VerticalGrid(GridLayout): pass
class HVGrid(HorizontalGrid, VerticalGrid): pass
class VHGrid(VerticalGrid, HorizontalGrid): pass
raises(TypeError, mro_err_msg,
type, "ConfusedGrid", (HVGrid, VHGrid), {})
def test_object_class(self):
# Testing object class...
a = object()
self.assertEqual(a.__class__, object)
self.assertEqual(type(a), object)
b = object()
self.assertNotEqual(a, b)
self.assertNotHasAttr(a, "foo")
try:
a.foo = 12
except (AttributeError, TypeError):
pass
else:
self.fail("object() should not allow setting a foo attribute")
self.assertNotHasAttr(object(), "__dict__")
class Cdict(object):
pass
x = Cdict()
self.assertEqual(x.__dict__, {})
x.foo = 1
self.assertEqual(x.foo, 1)
self.assertEqual(x.__dict__, {'foo': 1})
def test_object_class_assignment_between_heaptypes_and_nonheaptypes(self):
class SubType(types.ModuleType):
a = 1
m = types.ModuleType("m")
self.assertTrue(m.__class__ is types.ModuleType)
self.assertFalse(hasattr(m, "a"))
m.__class__ = SubType
self.assertTrue(m.__class__ is SubType)
self.assertTrue(hasattr(m, "a"))
m.__class__ = types.ModuleType
self.assertTrue(m.__class__ is types.ModuleType)
self.assertFalse(hasattr(m, "a"))
# Make sure that builtin immutable objects don't support __class__
# assignment, because the object instances may be interned.
# We set __slots__ = () to ensure that the subclasses are
# memory-layout compatible, and thus otherwise reasonable candidates
# for __class__ assignment.
# The following types have immutable instances, but are not
# subclassable and thus don't need to be checked:
# NoneType, bool
class MyInt(int):
__slots__ = ()
with self.assertRaises(TypeError):
(1).__class__ = MyInt
class MyFloat(float):
__slots__ = ()
with self.assertRaises(TypeError):
(1.0).__class__ = MyFloat
class MyComplex(complex):
__slots__ = ()
with self.assertRaises(TypeError):
(1 + 2j).__class__ = MyComplex
class MyStr(str):
__slots__ = ()
with self.assertRaises(TypeError):
"a".__class__ = MyStr
class MyBytes(bytes):
__slots__ = ()
with self.assertRaises(TypeError):
b"a".__class__ = MyBytes
class MyTuple(tuple):
__slots__ = ()
with self.assertRaises(TypeError):
().__class__ = MyTuple
class MyFrozenSet(frozenset):
__slots__ = ()
with self.assertRaises(TypeError):
frozenset().__class__ = MyFrozenSet
def test_slots(self):
# Testing __slots__...
class C0(object):
__slots__ = []
x = C0()
self.assertNotHasAttr(x, "__dict__")
self.assertNotHasAttr(x, "foo")
class C1(object):
__slots__ = ['a']
x = C1()
self.assertNotHasAttr(x, "__dict__")
self.assertNotHasAttr(x, "a")
x.a = 1
self.assertEqual(x.a, 1)
x.a = None
self.assertEqual(x.a, None)
del x.a
self.assertNotHasAttr(x, "a")
class C3(object):
__slots__ = ['a', 'b', 'c']
x = C3()
self.assertNotHasAttr(x, "__dict__")
self.assertNotHasAttr(x, 'a')
self.assertNotHasAttr(x, 'b')
self.assertNotHasAttr(x, 'c')
x.a = 1
x.b = 2
x.c = 3
self.assertEqual(x.a, 1)
self.assertEqual(x.b, 2)
self.assertEqual(x.c, 3)
class C4(object):
"""Validate name mangling"""
__slots__ = ['__a']
def __init__(self, value):
self.__a = value
def get(self):
return self.__a
x = C4(5)
self.assertNotHasAttr(x, '__dict__')
self.assertNotHasAttr(x, '__a')
self.assertEqual(x.get(), 5)
try:
x.__a = 6
except AttributeError:
pass
else:
self.fail("Double underscored names not mangled")
# Make sure slot names are proper identifiers
try:
class C(object):
__slots__ = [None]
except TypeError:
pass
else:
self.fail("[None] slots not caught")
try:
class C(object):
__slots__ = ["foo bar"]
except TypeError:
pass
else:
self.fail("['foo bar'] slots not caught")
try:
class C(object):
__slots__ = ["foo\0bar"]
except TypeError:
pass
else:
self.fail("['foo\\0bar'] slots not caught")
try:
class C(object):
__slots__ = ["1"]
except TypeError:
pass
else:
self.fail("['1'] slots not caught")
try:
class C(object):
__slots__ = [""]
except TypeError:
pass
else:
self.fail("[''] slots not caught")
class C(object):
__slots__ = ["a", "a_b", "_a", "A0123456789Z"]
# XXX(nnorwitz): was there supposed to be something tested
# from the class above?
# Test a single string is not expanded as a sequence.
class C(object):
__slots__ = "abc"
c = C()
c.abc = 5
self.assertEqual(c.abc, 5)
# Test unicode slot names
# Test a single unicode string is not expanded as a sequence.
class C(object):
__slots__ = "abc"
c = C()
c.abc = 5
self.assertEqual(c.abc, 5)
# _unicode_to_string used to modify slots in certain circumstances
slots = ("foo", "bar")
class C(object):
__slots__ = slots
x = C()
x.foo = 5
self.assertEqual(x.foo, 5)
self.assertIs(type(slots[0]), str)
# this used to leak references
try:
class C(object):
__slots__ = [chr(128)]
except (TypeError, UnicodeEncodeError):
pass
else:
self.fail("[chr(128)] slots not caught")
# Test leaks
class Counted(object):
counter = 0 # counts the number of instances alive
def __init__(self):
Counted.counter += 1
def __del__(self):
Counted.counter -= 1
class C(object):
__slots__ = ['a', 'b', 'c']
x = C()
x.a = Counted()
x.b = Counted()
x.c = Counted()
self.assertEqual(Counted.counter, 3)
del x
support.gc_collect()
self.assertEqual(Counted.counter, 0)
class D(C):
pass
x = D()
x.a = Counted()
x.z = Counted()
self.assertEqual(Counted.counter, 2)
del x
support.gc_collect()
self.assertEqual(Counted.counter, 0)
class E(D):
__slots__ = ['e']
x = E()
x.a = Counted()
x.z = Counted()
x.e = Counted()
self.assertEqual(Counted.counter, 3)
del x
support.gc_collect()
self.assertEqual(Counted.counter, 0)
# Test cyclical leaks [SF bug 519621]
class F(object):
__slots__ = ['a', 'b']
s = F()
s.a = [Counted(), s]
self.assertEqual(Counted.counter, 1)
s = None
support.gc_collect()
self.assertEqual(Counted.counter, 0)
# Test lookup leaks [SF bug 572567]
if hasattr(gc, 'get_objects'):
class G(object):
def __eq__(self, other):
return False
g = G()
orig_objects = len(gc.get_objects())
for i in range(10):
g==g
new_objects = len(gc.get_objects())
self.assertEqual(orig_objects, new_objects)
class H(object):
__slots__ = ['a', 'b']
def __init__(self):
self.a = 1
self.b = 2
def __del__(self_):
self.assertEqual(self_.a, 1)
self.assertEqual(self_.b, 2)
with support.captured_output('stderr') as s:
h = H()
del h
self.assertEqual(s.getvalue(), '')
class X(object):
__slots__ = "a"
with self.assertRaises(AttributeError):
del X().a
def test_slots_special(self):
# Testing __dict__ and __weakref__ in __slots__...
class D(object):
__slots__ = ["__dict__"]
a = D()
self.assertHasAttr(a, "__dict__")
self.assertNotHasAttr(a, "__weakref__")
a.foo = 42
self.assertEqual(a.__dict__, {"foo": 42})
class W(object):
__slots__ = ["__weakref__"]
a = W()
self.assertHasAttr(a, "__weakref__")
self.assertNotHasAttr(a, "__dict__")
try:
a.foo = 42
except AttributeError:
pass
else:
self.fail("shouldn't be allowed to set a.foo")
class C1(W, D):
__slots__ = []
a = C1()
self.assertHasAttr(a, "__dict__")
self.assertHasAttr(a, "__weakref__")
a.foo = 42
self.assertEqual(a.__dict__, {"foo": 42})
class C2(D, W):
__slots__ = []
a = C2()
self.assertHasAttr(a, "__dict__")
self.assertHasAttr(a, "__weakref__")
a.foo = 42
self.assertEqual(a.__dict__, {"foo": 42})
def test_slots_descriptor(self):
# Issue2115: slot descriptors did not correctly check
# the type of the given object
import abc
class MyABC(metaclass=abc.ABCMeta):
__slots__ = "a"
class Unrelated(object):
pass
MyABC.register(Unrelated)
u = Unrelated()
self.assertIsInstance(u, MyABC)
# This used to crash
self.assertRaises(TypeError, MyABC.a.__set__, u, 3)
def test_dynamics(self):
# Testing class attribute propagation...
class D(object):
pass
class E(D):
pass
class F(D):
pass
D.foo = 1
self.assertEqual(D.foo, 1)
# Test that dynamic attributes are inherited
self.assertEqual(E.foo, 1)
self.assertEqual(F.foo, 1)
# Test dynamic instances
class C(object):
pass
a = C()
self.assertNotHasAttr(a, "foobar")
C.foobar = 2
self.assertEqual(a.foobar, 2)
C.method = lambda self: 42
self.assertEqual(a.method(), 42)
C.__repr__ = lambda self: "C()"
self.assertEqual(repr(a), "C()")
C.__int__ = lambda self: 100
self.assertEqual(int(a), 100)
self.assertEqual(a.foobar, 2)
self.assertNotHasAttr(a, "spam")
def mygetattr(self, name):
if name == "spam":
return "spam"
raise AttributeError
C.__getattr__ = mygetattr
self.assertEqual(a.spam, "spam")
a.new = 12
self.assertEqual(a.new, 12)
def mysetattr(self, name, value):
if name == "spam":
raise AttributeError
return object.__setattr__(self, name, value)
C.__setattr__ = mysetattr
try:
a.spam = "not spam"
except AttributeError:
pass
else:
self.fail("expected AttributeError")
self.assertEqual(a.spam, "spam")
class D(C):
pass
d = D()
d.foo = 1
self.assertEqual(d.foo, 1)
# Test handling of int*seq and seq*int
class I(int):
pass
self.assertEqual("a"*I(2), "aa")
self.assertEqual(I(2)*"a", "aa")
self.assertEqual(2*I(3), 6)
self.assertEqual(I(3)*2, 6)
self.assertEqual(I(3)*I(2), 6)
# Test comparison of classes with dynamic metaclasses
class dynamicmetaclass(type):
pass
class someclass(metaclass=dynamicmetaclass):
pass
self.assertNotEqual(someclass, object)
def test_errors(self):
# Testing errors...
try:
class C(list, dict):
pass
except TypeError:
pass
else:
self.fail("inheritance from both list and dict should be illegal")
try:
class C(object, None):
pass
except TypeError:
pass
else:
self.fail("inheritance from non-type should be illegal")
class Classic:
pass
try:
class C(type(len)):
pass
except TypeError:
pass
else:
self.fail("inheritance from CFunction should be illegal")
try:
class C(object):
__slots__ = 1
except TypeError:
pass
else:
self.fail("__slots__ = 1 should be illegal")
try:
class C(object):
__slots__ = [1]
except TypeError:
pass
else:
self.fail("__slots__ = [1] should be illegal")
class M1(type):
pass
class M2(type):
pass
class A1(object, metaclass=M1):
pass
class A2(object, metaclass=M2):
pass
try:
class B(A1, A2):
pass
except TypeError:
pass
else:
self.fail("finding the most derived metaclass should have failed")
def test_classmethods(self):
# Testing class methods...
class C(object):
def foo(*a): return a
goo = classmethod(foo)
c = C()
self.assertEqual(C.goo(1), (C, 1))
self.assertEqual(c.goo(1), (C, 1))
self.assertEqual(c.foo(1), (c, 1))
class D(C):
pass
d = D()
self.assertEqual(D.goo(1), (D, 1))
self.assertEqual(d.goo(1), (D, 1))
self.assertEqual(d.foo(1), (d, 1))
self.assertEqual(D.foo(d, 1), (d, 1))
# Test for a specific crash (SF bug 528132)
def f(cls, arg): return (cls, arg)
ff = classmethod(f)
self.assertEqual(ff.__get__(0, int)(42), (int, 42))
self.assertEqual(ff.__get__(0)(42), (int, 42))
# Test super() with classmethods (SF bug 535444)
self.assertEqual(C.goo.__self__, C)
self.assertEqual(D.goo.__self__, D)
self.assertEqual(super(D,D).goo.__self__, D)
self.assertEqual(super(D,d).goo.__self__, D)
self.assertEqual(super(D,D).goo(), (D,))
self.assertEqual(super(D,d).goo(), (D,))
# Verify that a non-callable will raise
meth = classmethod(1).__get__(1)
self.assertRaises(TypeError, meth)
# Verify that classmethod() doesn't allow keyword args
try:
classmethod(f, kw=1)
except TypeError:
pass
else:
self.fail("classmethod shouldn't accept keyword args")
cm = classmethod(f)
self.assertEqual(cm.__dict__, {})
cm.x = 42
self.assertEqual(cm.x, 42)
self.assertEqual(cm.__dict__, {"x" : 42})
del cm.x
self.assertNotHasAttr(cm, "x")
@support.impl_detail("the module 'xxsubtype' is internal")
def test_classmethods_in_c(self):
# Testing C-based class methods...
import xxsubtype as spam
a = (1, 2, 3)
d = {'abc': 123}
x, a1, d1 = spam.spamlist.classmeth(*a, **d)
self.assertEqual(x, spam.spamlist)
self.assertEqual(a, a1)
self.assertEqual(d, d1)
x, a1, d1 = spam.spamlist().classmeth(*a, **d)
self.assertEqual(x, spam.spamlist)
self.assertEqual(a, a1)
self.assertEqual(d, d1)
spam_cm = spam.spamlist.__dict__['classmeth']
x2, a2, d2 = spam_cm(spam.spamlist, *a, **d)
self.assertEqual(x2, spam.spamlist)
self.assertEqual(a2, a1)
self.assertEqual(d2, d1)
class SubSpam(spam.spamlist): pass
x2, a2, d2 = spam_cm(SubSpam, *a, **d)
self.assertEqual(x2, SubSpam)
self.assertEqual(a2, a1)
self.assertEqual(d2, d1)
with self.assertRaises(TypeError):
spam_cm()
with self.assertRaises(TypeError):
spam_cm(spam.spamlist())
with self.assertRaises(TypeError):
spam_cm(list)
def test_staticmethods(self):
# Testing static methods...
class C(object):
def foo(*a): return a
goo = staticmethod(foo)
c = C()
self.assertEqual(C.goo(1), (1,))
self.assertEqual(c.goo(1), (1,))
self.assertEqual(c.foo(1), (c, 1,))
class D(C):
pass
d = D()
self.assertEqual(D.goo(1), (1,))
self.assertEqual(d.goo(1), (1,))
self.assertEqual(d.foo(1), (d, 1))
self.assertEqual(D.foo(d, 1), (d, 1))
sm = staticmethod(None)
self.assertEqual(sm.__dict__, {})
sm.x = 42
self.assertEqual(sm.x, 42)
self.assertEqual(sm.__dict__, {"x" : 42})
del sm.x
self.assertNotHasAttr(sm, "x")
@support.impl_detail("the module 'xxsubtype' is internal")
def test_staticmethods_in_c(self):
# Testing C-based static methods...
import xxsubtype as spam
a = (1, 2, 3)
d = {"abc": 123}
x, a1, d1 = spam.spamlist.staticmeth(*a, **d)
self.assertEqual(x, None)
self.assertEqual(a, a1)
self.assertEqual(d, d1)
x, a1, d2 = spam.spamlist().staticmeth(*a, **d)
self.assertEqual(x, None)
self.assertEqual(a, a1)
self.assertEqual(d, d1)
def test_classic(self):
# Testing classic classes...
class C:
def foo(*a): return a
goo = classmethod(foo)
c = C()
self.assertEqual(C.goo(1), (C, 1))
self.assertEqual(c.goo(1), (C, 1))
self.assertEqual(c.foo(1), (c, 1))
class D(C):
pass
d = D()
self.assertEqual(D.goo(1), (D, 1))
self.assertEqual(d.goo(1), (D, 1))
self.assertEqual(d.foo(1), (d, 1))
self.assertEqual(D.foo(d, 1), (d, 1))
class E: # *not* subclassing from C
foo = C.foo
self.assertEqual(E().foo.__func__, C.foo) # i.e., unbound
self.assertTrue(repr(C.foo.__get__(C())).startswith("<bound method "))
def test_compattr(self):
# Testing computed attributes...
class C(object):
class computed_attribute(object):
def __init__(self, get, set=None, delete=None):
self.__get = get
self.__set = set
self.__delete = delete
def __get__(self, obj, type=None):
return self.__get(obj)
def __set__(self, obj, value):
return self.__set(obj, value)
def __delete__(self, obj):
return self.__delete(obj)
def __init__(self):
self.__x = 0
def __get_x(self):
x = self.__x
self.__x = x+1
return x
def __set_x(self, x):
self.__x = x
def __delete_x(self):
del self.__x
x = computed_attribute(__get_x, __set_x, __delete_x)
a = C()
self.assertEqual(a.x, 0)
self.assertEqual(a.x, 1)
a.x = 10
self.assertEqual(a.x, 10)
self.assertEqual(a.x, 11)
del a.x
self.assertNotHasAttr(a, 'x')
def test_newslots(self):
# Testing __new__ slot override...
class C(list):
def __new__(cls):
self = list.__new__(cls)
self.foo = 1
return self
def __init__(self):
self.foo = self.foo + 2
a = C()
self.assertEqual(a.foo, 3)
self.assertEqual(a.__class__, C)
class D(C):
pass
b = D()
self.assertEqual(b.foo, 3)
self.assertEqual(b.__class__, D)
def test_altmro(self):
# Testing mro() and overriding it...
class A(object):
def f(self): return "A"
class B(A):
pass
class C(A):
def f(self): return "C"
class D(B, C):
pass
self.assertEqual(D.mro(), [D, B, C, A, object])
self.assertEqual(D.__mro__, (D, B, C, A, object))
self.assertEqual(D().f(), "C")
class PerverseMetaType(type):
def mro(cls):
L = type.mro(cls)
L.reverse()
return L
class X(D,B,C,A, metaclass=PerverseMetaType):
pass
self.assertEqual(X.__mro__, (object, A, C, B, D, X))
self.assertEqual(X().f(), "A")
try:
class _metaclass(type):
def mro(self):
return [self, dict, object]
class X(object, metaclass=_metaclass):
pass
# In CPython, the class creation above already raises
# TypeError, as a protection against the fact that
# instances of X would segfault it. In other Python
# implementations it would be ok to let the class X
# be created, but instead get a clean TypeError on the
# __setitem__ below.
x = object.__new__(X)
x[5] = 6
except TypeError:
pass
else:
self.fail("devious mro() return not caught")
try:
class _metaclass(type):
def mro(self):
return [1]
class X(object, metaclass=_metaclass):
pass
except TypeError:
pass
else:
self.fail("non-class mro() return not caught")
try:
class _metaclass(type):
def mro(self):
return 1
class X(object, metaclass=_metaclass):
pass
except TypeError:
pass
else:
self.fail("non-sequence mro() return not caught")
def test_overloading(self):
# Testing operator overloading...
class B(object):
"Intermediate class because object doesn't have a __setattr__"
class C(B):
def __getattr__(self, name):
if name == "foo":
return ("getattr", name)
else:
raise AttributeError
def __setattr__(self, name, value):
if name == "foo":
self.setattr = (name, value)
else:
return B.__setattr__(self, name, value)
def __delattr__(self, name):
if name == "foo":
self.delattr = name
else:
return B.__delattr__(self, name)
def __getitem__(self, key):
return ("getitem", key)
def __setitem__(self, key, value):
self.setitem = (key, value)
def __delitem__(self, key):
self.delitem = key
a = C()
self.assertEqual(a.foo, ("getattr", "foo"))
a.foo = 12
self.assertEqual(a.setattr, ("foo", 12))
del a.foo
self.assertEqual(a.delattr, "foo")
self.assertEqual(a[12], ("getitem", 12))
a[12] = 21
self.assertEqual(a.setitem, (12, 21))
del a[12]
self.assertEqual(a.delitem, 12)
self.assertEqual(a[0:10], ("getitem", slice(0, 10)))
a[0:10] = "foo"
self.assertEqual(a.setitem, (slice(0, 10), "foo"))
del a[0:10]
self.assertEqual(a.delitem, (slice(0, 10)))
def test_methods(self):
# Testing methods...
class C(object):
def __init__(self, x):
self.x = x
def foo(self):
return self.x
c1 = C(1)
self.assertEqual(c1.foo(), 1)
class D(C):
boo = C.foo
goo = c1.foo
d2 = D(2)
self.assertEqual(d2.foo(), 2)
self.assertEqual(d2.boo(), 2)
self.assertEqual(d2.goo(), 1)
class E(object):
foo = C.foo
self.assertEqual(E().foo.__func__, C.foo) # i.e., unbound
self.assertTrue(repr(C.foo.__get__(C(1))).startswith("<bound method "))
def test_special_method_lookup(self):
# The lookup of special methods bypasses __getattr__ and
# __getattribute__, but they still can be descriptors.
def run_context(manager):
with manager:
pass
def iden(self):
return self
def hello(self):
return b"hello"
def empty_seq(self):
return []
def zero(self):
return 0
def complex_num(self):
return 1j
def stop(self):
raise StopIteration
def return_true(self, thing=None):
return True
def do_isinstance(obj):
return isinstance(int, obj)
def do_issubclass(obj):
return issubclass(int, obj)
def do_dict_missing(checker):
class DictSub(checker.__class__, dict):
pass
self.assertEqual(DictSub()["hi"], 4)
def some_number(self_, key):
self.assertEqual(key, "hi")
return 4
def swallow(*args): pass
def format_impl(self, spec):
return "hello"
# It would be nice to have every special method tested here, but I'm
# only listing the ones I can remember outside of typeobject.c, since it
# does it right.
specials = [
("__bytes__", bytes, hello, set(), {}),
("__reversed__", reversed, empty_seq, set(), {}),
("__length_hint__", list, zero, set(),
{"__iter__" : iden, "__next__" : stop}),
("__sizeof__", sys.getsizeof, zero, set(), {}),
("__instancecheck__", do_isinstance, return_true, set(), {}),
("__missing__", do_dict_missing, some_number,
set(("__class__",)), {}),
("__subclasscheck__", do_issubclass, return_true,
set(("__bases__",)), {}),
("__enter__", run_context, iden, set(), {"__exit__" : swallow}),
("__exit__", run_context, swallow, set(), {"__enter__" : iden}),
("__complex__", complex, complex_num, set(), {}),
("__format__", format, format_impl, set(), {}),
("__floor__", math.floor, zero, set(), {}),
("__trunc__", math.trunc, zero, set(), {}),
("__trunc__", int, zero, set(), {}),
("__ceil__", math.ceil, zero, set(), {}),
("__dir__", dir, empty_seq, set(), {}),
("__round__", round, zero, set(), {}),
]
class Checker(object):
def __getattr__(self, attr, test=self):
test.fail("__getattr__ called with {0}".format(attr))
def __getattribute__(self, attr, test=self):
if attr not in ok:
test.fail("__getattribute__ called with {0}".format(attr))
return object.__getattribute__(self, attr)
class SpecialDescr(object):
def __init__(self, impl):
self.impl = impl
def __get__(self, obj, owner):
record.append(1)
return self.impl.__get__(obj, owner)
class MyException(Exception):
pass
class ErrDescr(object):
def __get__(self, obj, owner):
raise MyException
for name, runner, meth_impl, ok, env in specials:
class X(Checker):
pass
for attr, obj in env.items():
setattr(X, attr, obj)
setattr(X, name, meth_impl)
runner(X())
record = []
class X(Checker):
pass
for attr, obj in env.items():
setattr(X, attr, obj)
setattr(X, name, SpecialDescr(meth_impl))
runner(X())
self.assertEqual(record, [1], name)
class X(Checker):
pass
for attr, obj in env.items():
setattr(X, attr, obj)
setattr(X, name, ErrDescr())
self.assertRaises(MyException, runner, X())
def test_specials(self):
# Testing special operators...
# Test operators like __hash__ for which a built-in default exists
# Test the default behavior for static classes
class C(object):
def __getitem__(self, i):
if 0 <= i < 10: return i
raise IndexError
c1 = C()
c2 = C()
self.assertFalse(not c1)
self.assertNotEqual(id(c1), id(c2))
hash(c1)
hash(c2)
self.assertEqual(c1, c1)
self.assertTrue(c1 != c2)
self.assertFalse(c1 != c1)
self.assertFalse(c1 == c2)
# Note that the module name appears in str/repr, and that varies
# depending on whether this test is run standalone or from a framework.
self.assertGreaterEqual(str(c1).find('C object at '), 0)
self.assertEqual(str(c1), repr(c1))
self.assertNotIn(-1, c1)
for i in range(10):
self.assertIn(i, c1)
self.assertNotIn(10, c1)
# Test the default behavior for dynamic classes
class D(object):
def __getitem__(self, i):
if 0 <= i < 10: return i
raise IndexError
d1 = D()
d2 = D()
self.assertFalse(not d1)
self.assertNotEqual(id(d1), id(d2))
hash(d1)
hash(d2)
self.assertEqual(d1, d1)
self.assertNotEqual(d1, d2)
self.assertFalse(d1 != d1)
self.assertFalse(d1 == d2)
# Note that the module name appears in str/repr, and that varies
# depending on whether this test is run standalone or from a framework.
self.assertGreaterEqual(str(d1).find('D object at '), 0)
self.assertEqual(str(d1), repr(d1))
self.assertNotIn(-1, d1)
for i in range(10):
self.assertIn(i, d1)
self.assertNotIn(10, d1)
# Test overridden behavior
class Proxy(object):
def __init__(self, x):
self.x = x
def __bool__(self):
return not not self.x
def __hash__(self):
return hash(self.x)
def __eq__(self, other):
return self.x == other
def __ne__(self, other):
return self.x != other
def __ge__(self, other):
return self.x >= other
def __gt__(self, other):
return self.x > other
def __le__(self, other):
return self.x <= other
def __lt__(self, other):
return self.x < other
def __str__(self):
return "Proxy:%s" % self.x
def __repr__(self):
return "Proxy(%r)" % self.x
def __contains__(self, value):
return value in self.x
p0 = Proxy(0)
p1 = Proxy(1)
p_1 = Proxy(-1)
self.assertFalse(p0)
self.assertFalse(not p1)
self.assertEqual(hash(p0), hash(0))
self.assertEqual(p0, p0)
self.assertNotEqual(p0, p1)
self.assertFalse(p0 != p0)
self.assertEqual(not p0, p1)
self.assertTrue(p0 < p1)
self.assertTrue(p0 <= p1)
self.assertTrue(p1 > p0)
self.assertTrue(p1 >= p0)
self.assertEqual(str(p0), "Proxy:0")
self.assertEqual(repr(p0), "Proxy(0)")
p10 = Proxy(range(10))
self.assertNotIn(-1, p10)
for i in range(10):
self.assertIn(i, p10)
self.assertNotIn(10, p10)
def test_weakrefs(self):
# Testing weak references...
import weakref
class C(object):
pass
c = C()
r = weakref.ref(c)
self.assertEqual(r(), c)
del c
support.gc_collect()
self.assertEqual(r(), None)
del r
class NoWeak(object):
__slots__ = ['foo']
no = NoWeak()
try:
weakref.ref(no)
except TypeError as msg:
self.assertIn("weak reference", str(msg))
else:
self.fail("weakref.ref(no) should be illegal")
class Weak(object):
__slots__ = ['foo', '__weakref__']
yes = Weak()
r = weakref.ref(yes)
self.assertEqual(r(), yes)
del yes
support.gc_collect()
self.assertEqual(r(), None)
del r
def test_properties(self):
# Testing property...
class C(object):
def getx(self):
return self.__x
def setx(self, value):
self.__x = value
def delx(self):
del self.__x
x = property(getx, setx, delx, doc="I'm the x property.")
a = C()
self.assertNotHasAttr(a, "x")
a.x = 42
self.assertEqual(a._C__x, 42)
self.assertEqual(a.x, 42)
del a.x
self.assertNotHasAttr(a, "x")
self.assertNotHasAttr(a, "_C__x")
C.x.__set__(a, 100)
self.assertEqual(C.x.__get__(a), 100)
C.x.__delete__(a)
self.assertNotHasAttr(a, "x")
raw = C.__dict__['x']
self.assertIsInstance(raw, property)
attrs = dir(raw)
self.assertIn("__doc__", attrs)
self.assertIn("fget", attrs)
self.assertIn("fset", attrs)
self.assertIn("fdel", attrs)
self.assertEqual(raw.__doc__, "I'm the x property.")
self.assertIs(raw.fget, C.__dict__['getx'])
self.assertIs(raw.fset, C.__dict__['setx'])
self.assertIs(raw.fdel, C.__dict__['delx'])
for attr in "fget", "fset", "fdel":
try:
setattr(raw, attr, 42)
except AttributeError as msg:
if str(msg).find('readonly') < 0:
self.fail("when setting readonly attr %r on a property, "
"got unexpected AttributeError msg %r" % (attr, str(msg)))
else:
self.fail("expected AttributeError from trying to set readonly %r "
"attr on a property" % attr)
raw.__doc__ = 42
self.assertEqual(raw.__doc__, 42)
class D(object):
__getitem__ = property(lambda s: 1/0)
d = D()
try:
for i in d:
str(i)
except ZeroDivisionError:
pass
else:
self.fail("expected ZeroDivisionError from bad property")
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_properties_doc_attrib(self):
class E(object):
def getter(self):
"getter method"
return 0
def setter(self_, value):
"setter method"
pass
prop = property(getter)
self.assertEqual(prop.__doc__, "getter method")
prop2 = property(fset=setter)
self.assertEqual(prop2.__doc__, None)
@support.cpython_only
def test_testcapi_no_segfault(self):
# this segfaulted in 2.5b2
try:
import _testcapi
except ImportError:
pass
else:
class X(object):
p = property(_testcapi.test_with_docstring)
def test_properties_plus(self):
class C(object):
foo = property(doc="hello")
@foo.getter
def foo(self):
return self._foo
@foo.setter
def foo(self, value):
self._foo = abs(value)
@foo.deleter
def foo(self):
del self._foo
c = C()
self.assertEqual(C.foo.__doc__, "hello")
self.assertNotHasAttr(c, "foo")
c.foo = -42
self.assertHasAttr(c, '_foo')
self.assertEqual(c._foo, 42)
self.assertEqual(c.foo, 42)
del c.foo
self.assertNotHasAttr(c, '_foo')
self.assertNotHasAttr(c, "foo")
class D(C):
@C.foo.deleter
def foo(self):
try:
del self._foo
except AttributeError:
pass
d = D()
d.foo = 24
self.assertEqual(d.foo, 24)
del d.foo
del d.foo
class E(object):
@property
def foo(self):
return self._foo
@foo.setter
def foo(self, value):
raise RuntimeError
@foo.setter
def foo(self, value):
self._foo = abs(value)
@foo.deleter
def foo(self, value=None):
del self._foo
e = E()
e.foo = -42
self.assertEqual(e.foo, 42)
del e.foo
class F(E):
@E.foo.deleter
def foo(self):
del self._foo
@foo.setter
def foo(self, value):
self._foo = max(0, value)
f = F()
f.foo = -10
self.assertEqual(f.foo, 0)
del f.foo
def test_dict_constructors(self):
# Testing dict constructor ...
d = dict()
self.assertEqual(d, {})
d = dict({})
self.assertEqual(d, {})
d = dict({1: 2, 'a': 'b'})
self.assertEqual(d, {1: 2, 'a': 'b'})
self.assertEqual(d, dict(list(d.items())))
self.assertEqual(d, dict(iter(d.items())))
d = dict({'one':1, 'two':2})
self.assertEqual(d, dict(one=1, two=2))
self.assertEqual(d, dict(**d))
self.assertEqual(d, dict({"one": 1}, two=2))
self.assertEqual(d, dict([("two", 2)], one=1))
self.assertEqual(d, dict([("one", 100), ("two", 200)], **d))
self.assertEqual(d, dict(**d))
for badarg in 0, 0, 0j, "0", [0], (0,):
try:
dict(badarg)
except TypeError:
pass
except ValueError:
if badarg == "0":
# It's a sequence, and its elements are also sequences (gotta
# love strings <wink>), but they aren't of length 2, so this
# one seemed better as a ValueError than a TypeError.
pass
else:
self.fail("no TypeError from dict(%r)" % badarg)
else:
self.fail("no TypeError from dict(%r)" % badarg)
try:
dict({}, {})
except TypeError:
pass
else:
self.fail("no TypeError from dict({}, {})")
class Mapping:
# Lacks a .keys() method; will be added later.
dict = {1:2, 3:4, 'a':1j}
try:
dict(Mapping())
except TypeError:
pass
else:
self.fail("no TypeError from dict(incomplete mapping)")
Mapping.keys = lambda self: list(self.dict.keys())
Mapping.__getitem__ = lambda self, i: self.dict[i]
d = dict(Mapping())
self.assertEqual(d, Mapping.dict)
# Init from sequence of iterable objects, each producing a 2-sequence.
class AddressBookEntry:
def __init__(self, first, last):
self.first = first
self.last = last
def __iter__(self):
return iter([self.first, self.last])
d = dict([AddressBookEntry('Tim', 'Warsaw'),
AddressBookEntry('Barry', 'Peters'),
AddressBookEntry('Tim', 'Peters'),
AddressBookEntry('Barry', 'Warsaw')])
self.assertEqual(d, {'Barry': 'Warsaw', 'Tim': 'Peters'})
d = dict(zip(range(4), range(1, 5)))
self.assertEqual(d, dict([(i, i+1) for i in range(4)]))
# Bad sequence lengths.
for bad in [('tooshort',)], [('too', 'long', 'by 1')]:
try:
dict(bad)
except ValueError:
pass
else:
self.fail("no ValueError from dict(%r)" % bad)
def test_dir(self):
# Testing dir() ...
junk = 12
self.assertEqual(dir(), ['junk', 'self'])
del junk
# Just make sure these don't blow up!
for arg in 2, 2, 2j, 2e0, [2], "2", b"2", (2,), {2:2}, type, self.test_dir:
dir(arg)
# Test dir on new-style classes. Since these have object as a
# base class, a lot more gets sucked in.
def interesting(strings):
return [s for s in strings if not s.startswith('_')]
class C(object):
Cdata = 1
def Cmethod(self): pass
cstuff = ['Cdata', 'Cmethod']
self.assertEqual(interesting(dir(C)), cstuff)
c = C()
self.assertEqual(interesting(dir(c)), cstuff)
## self.assertIn('__self__', dir(C.Cmethod))
c.cdata = 2
c.cmethod = lambda self: 0
self.assertEqual(interesting(dir(c)), cstuff + ['cdata', 'cmethod'])
## self.assertIn('__self__', dir(c.Cmethod))
class A(C):
Adata = 1
def Amethod(self): pass
astuff = ['Adata', 'Amethod'] + cstuff
self.assertEqual(interesting(dir(A)), astuff)
## self.assertIn('__self__', dir(A.Amethod))
a = A()
self.assertEqual(interesting(dir(a)), astuff)
a.adata = 42
a.amethod = lambda self: 3
self.assertEqual(interesting(dir(a)), astuff + ['adata', 'amethod'])
## self.assertIn('__self__', dir(a.Amethod))
# Try a module subclass.
class M(type(sys)):
pass
minstance = M("m")
minstance.b = 2
minstance.a = 1
default_attributes = ['__name__', '__doc__', '__package__',
'__loader__', '__spec__']
names = [x for x in dir(minstance) if x not in default_attributes]
self.assertEqual(names, ['a', 'b'])
class M2(M):
def getdict(self):
return "Not a dict!"
__dict__ = property(getdict)
m2instance = M2("m2")
m2instance.b = 2
m2instance.a = 1
self.assertEqual(m2instance.__dict__, "Not a dict!")
try:
dir(m2instance)
except TypeError:
pass
# Two essentially featureless objects, just inheriting stuff from
# object.
self.assertEqual(dir(NotImplemented), dir(Ellipsis))
# Nasty test case for proxied objects
class Wrapper(object):
def __init__(self, obj):
self.__obj = obj
def __repr__(self):
return "Wrapper(%s)" % repr(self.__obj)
def __getitem__(self, key):
return Wrapper(self.__obj[key])
def __len__(self):
return len(self.__obj)
def __getattr__(self, name):
return Wrapper(getattr(self.__obj, name))
class C(object):
def __getclass(self):
return Wrapper(type(self))
__class__ = property(__getclass)
dir(C()) # This used to segfault
def test_supers(self):
# Testing super...
class A(object):
def meth(self, a):
return "A(%r)" % a
self.assertEqual(A().meth(1), "A(1)")
class B(A):
def __init__(self):
self.__super = super(B, self)
def meth(self, a):
return "B(%r)" % a + self.__super.meth(a)
self.assertEqual(B().meth(2), "B(2)A(2)")
class C(A):
def meth(self, a):
return "C(%r)" % a + self.__super.meth(a)
C._C__super = super(C)
self.assertEqual(C().meth(3), "C(3)A(3)")
class D(C, B):
def meth(self, a):
return "D(%r)" % a + super(D, self).meth(a)
self.assertEqual(D().meth(4), "D(4)C(4)B(4)A(4)")
# Test for subclassing super
class mysuper(super):
def __init__(self, *args):
return super(mysuper, self).__init__(*args)
class E(D):
def meth(self, a):
return "E(%r)" % a + mysuper(E, self).meth(a)
self.assertEqual(E().meth(5), "E(5)D(5)C(5)B(5)A(5)")
class F(E):
def meth(self, a):
s = self.__super # == mysuper(F, self)
return "F(%r)[%s]" % (a, s.__class__.__name__) + s.meth(a)
F._F__super = mysuper(F)
self.assertEqual(F().meth(6), "F(6)[mysuper]E(6)D(6)C(6)B(6)A(6)")
# Make sure certain errors are raised
try:
super(D, 42)
except TypeError:
pass
else:
self.fail("shouldn't allow super(D, 42)")
try:
super(D, C())
except TypeError:
pass
else:
self.fail("shouldn't allow super(D, C())")
try:
super(D).__get__(12)
except TypeError:
pass
else:
self.fail("shouldn't allow super(D).__get__(12)")
try:
super(D).__get__(C())
except TypeError:
pass
else:
self.fail("shouldn't allow super(D).__get__(C())")
# Make sure data descriptors can be overridden and accessed via super
# (new feature in Python 2.3)
class DDbase(object):
def getx(self): return 42
x = property(getx)
class DDsub(DDbase):
def getx(self): return "hello"
x = property(getx)
dd = DDsub()
self.assertEqual(dd.x, "hello")
self.assertEqual(super(DDsub, dd).x, 42)
# Ensure that super() lookup of descriptor from classmethod
# works (SF ID# 743627)
class Base(object):
aProp = property(lambda self: "foo")
class Sub(Base):
@classmethod
def test(klass):
return super(Sub,klass).aProp
self.assertEqual(Sub.test(), Base.aProp)
# Verify that super() doesn't allow keyword args
try:
super(Base, kw=1)
except TypeError:
pass
else:
self.assertEqual("super shouldn't accept keyword args")
def test_basic_inheritance(self):
# Testing inheritance from basic types...
class hexint(int):
def __repr__(self):
return hex(self)
def __add__(self, other):
return hexint(int.__add__(self, other))
# (Note that overriding __radd__ doesn't work,
# because the int type gets first dibs.)
self.assertEqual(repr(hexint(7) + 9), "0x10")
self.assertEqual(repr(hexint(1000) + 7), "0x3ef")
a = hexint(12345)
self.assertEqual(a, 12345)
self.assertEqual(int(a), 12345)
self.assertIs(int(a).__class__, int)
self.assertEqual(hash(a), hash(12345))
self.assertIs((+a).__class__, int)
self.assertIs((a >> 0).__class__, int)
self.assertIs((a << 0).__class__, int)
self.assertIs((hexint(0) << 12).__class__, int)
self.assertIs((hexint(0) >> 12).__class__, int)
class octlong(int):
__slots__ = []
def __str__(self):
return oct(self)
def __add__(self, other):
return self.__class__(super(octlong, self).__add__(other))
__radd__ = __add__
self.assertEqual(str(octlong(3) + 5), "0o10")
# (Note that overriding __radd__ here only seems to work
# because the example uses a short int left argument.)
self.assertEqual(str(5 + octlong(3000)), "0o5675")
a = octlong(12345)
self.assertEqual(a, 12345)
self.assertEqual(int(a), 12345)
self.assertEqual(hash(a), hash(12345))
self.assertIs(int(a).__class__, int)
self.assertIs((+a).__class__, int)
self.assertIs((-a).__class__, int)
self.assertIs((-octlong(0)).__class__, int)
self.assertIs((a >> 0).__class__, int)
self.assertIs((a << 0).__class__, int)
self.assertIs((a - 0).__class__, int)
self.assertIs((a * 1).__class__, int)
self.assertIs((a ** 1).__class__, int)
self.assertIs((a // 1).__class__, int)
self.assertIs((1 * a).__class__, int)
self.assertIs((a | 0).__class__, int)
self.assertIs((a ^ 0).__class__, int)
self.assertIs((a & -1).__class__, int)
self.assertIs((octlong(0) << 12).__class__, int)
self.assertIs((octlong(0) >> 12).__class__, int)
self.assertIs(abs(octlong(0)).__class__, int)
# Because octlong overrides __add__, we can't check the absence of +0
# optimizations using octlong.
class longclone(int):
pass
a = longclone(1)
self.assertIs((a + 0).__class__, int)
self.assertIs((0 + a).__class__, int)
# Check that negative clones don't segfault
a = longclone(-1)
self.assertEqual(a.__dict__, {})
self.assertEqual(int(a), -1) # self.assertTrue PyNumber_Long() copies the sign bit
class precfloat(float):
__slots__ = ['prec']
def __init__(self, value=0.0, prec=12):
self.prec = int(prec)
def __repr__(self):
return "%.*g" % (self.prec, self)
self.assertEqual(repr(precfloat(1.1)), "1.1")
a = precfloat(12345)
self.assertEqual(a, 12345.0)
self.assertEqual(float(a), 12345.0)
self.assertIs(float(a).__class__, float)
self.assertEqual(hash(a), hash(12345.0))
self.assertIs((+a).__class__, float)
class madcomplex(complex):
def __repr__(self):
return "%.17gj%+.17g" % (self.imag, self.real)
a = madcomplex(-3, 4)
self.assertEqual(repr(a), "4j-3")
base = complex(-3, 4)
self.assertEqual(base.__class__, complex)
self.assertEqual(a, base)
self.assertEqual(complex(a), base)
self.assertEqual(complex(a).__class__, complex)
a = madcomplex(a) # just trying another form of the constructor
self.assertEqual(repr(a), "4j-3")
self.assertEqual(a, base)
self.assertEqual(complex(a), base)
self.assertEqual(complex(a).__class__, complex)
self.assertEqual(hash(a), hash(base))
self.assertEqual((+a).__class__, complex)
self.assertEqual((a + 0).__class__, complex)
self.assertEqual(a + 0, base)
self.assertEqual((a - 0).__class__, complex)
self.assertEqual(a - 0, base)
self.assertEqual((a * 1).__class__, complex)
self.assertEqual(a * 1, base)
self.assertEqual((a / 1).__class__, complex)
self.assertEqual(a / 1, base)
class madtuple(tuple):
_rev = None
def rev(self):
if self._rev is not None:
return self._rev
L = list(self)
L.reverse()
self._rev = self.__class__(L)
return self._rev
a = madtuple((1,2,3,4,5,6,7,8,9,0))
self.assertEqual(a, (1,2,3,4,5,6,7,8,9,0))
self.assertEqual(a.rev(), madtuple((0,9,8,7,6,5,4,3,2,1)))
self.assertEqual(a.rev().rev(), madtuple((1,2,3,4,5,6,7,8,9,0)))
for i in range(512):
t = madtuple(range(i))
u = t.rev()
v = u.rev()
self.assertEqual(v, t)
a = madtuple((1,2,3,4,5))
self.assertEqual(tuple(a), (1,2,3,4,5))
self.assertIs(tuple(a).__class__, tuple)
self.assertEqual(hash(a), hash((1,2,3,4,5)))
self.assertIs(a[:].__class__, tuple)
self.assertIs((a * 1).__class__, tuple)
self.assertIs((a * 0).__class__, tuple)
self.assertIs((a + ()).__class__, tuple)
a = madtuple(())
self.assertEqual(tuple(a), ())
self.assertIs(tuple(a).__class__, tuple)
self.assertIs((a + a).__class__, tuple)
self.assertIs((a * 0).__class__, tuple)
self.assertIs((a * 1).__class__, tuple)
self.assertIs((a * 2).__class__, tuple)
self.assertIs(a[:].__class__, tuple)
class madstring(str):
_rev = None
def rev(self):
if self._rev is not None:
return self._rev
L = list(self)
L.reverse()
self._rev = self.__class__("".join(L))
return self._rev
s = madstring("abcdefghijklmnopqrstuvwxyz")
self.assertEqual(s, "abcdefghijklmnopqrstuvwxyz")
self.assertEqual(s.rev(), madstring("zyxwvutsrqponmlkjihgfedcba"))
self.assertEqual(s.rev().rev(), madstring("abcdefghijklmnopqrstuvwxyz"))
for i in range(256):
s = madstring("".join(map(chr, range(i))))
t = s.rev()
u = t.rev()
self.assertEqual(u, s)
s = madstring("12345")
self.assertEqual(str(s), "12345")
self.assertIs(str(s).__class__, str)
base = "\x00" * 5
s = madstring(base)
self.assertEqual(s, base)
self.assertEqual(str(s), base)
self.assertIs(str(s).__class__, str)
self.assertEqual(hash(s), hash(base))
self.assertEqual({s: 1}[base], 1)
self.assertEqual({base: 1}[s], 1)
self.assertIs((s + "").__class__, str)
self.assertEqual(s + "", base)
self.assertIs(("" + s).__class__, str)
self.assertEqual("" + s, base)
self.assertIs((s * 0).__class__, str)
self.assertEqual(s * 0, "")
self.assertIs((s * 1).__class__, str)
self.assertEqual(s * 1, base)
self.assertIs((s * 2).__class__, str)
self.assertEqual(s * 2, base + base)
self.assertIs(s[:].__class__, str)
self.assertEqual(s[:], base)
self.assertIs(s[0:0].__class__, str)
self.assertEqual(s[0:0], "")
self.assertIs(s.strip().__class__, str)
self.assertEqual(s.strip(), base)
self.assertIs(s.lstrip().__class__, str)
self.assertEqual(s.lstrip(), base)
self.assertIs(s.rstrip().__class__, str)
self.assertEqual(s.rstrip(), base)
identitytab = {}
self.assertIs(s.translate(identitytab).__class__, str)
self.assertEqual(s.translate(identitytab), base)
self.assertIs(s.replace("x", "x").__class__, str)
self.assertEqual(s.replace("x", "x"), base)
self.assertIs(s.ljust(len(s)).__class__, str)
self.assertEqual(s.ljust(len(s)), base)
self.assertIs(s.rjust(len(s)).__class__, str)
self.assertEqual(s.rjust(len(s)), base)
self.assertIs(s.center(len(s)).__class__, str)
self.assertEqual(s.center(len(s)), base)
self.assertIs(s.lower().__class__, str)
self.assertEqual(s.lower(), base)
class madunicode(str):
_rev = None
def rev(self):
if self._rev is not None:
return self._rev
L = list(self)
L.reverse()
self._rev = self.__class__("".join(L))
return self._rev
u = madunicode("ABCDEF")
self.assertEqual(u, "ABCDEF")
self.assertEqual(u.rev(), madunicode("FEDCBA"))
self.assertEqual(u.rev().rev(), madunicode("ABCDEF"))
base = "12345"
u = madunicode(base)
self.assertEqual(str(u), base)
self.assertIs(str(u).__class__, str)
self.assertEqual(hash(u), hash(base))
self.assertEqual({u: 1}[base], 1)
self.assertEqual({base: 1}[u], 1)
self.assertIs(u.strip().__class__, str)
self.assertEqual(u.strip(), base)
self.assertIs(u.lstrip().__class__, str)
self.assertEqual(u.lstrip(), base)
self.assertIs(u.rstrip().__class__, str)
self.assertEqual(u.rstrip(), base)
self.assertIs(u.replace("x", "x").__class__, str)
self.assertEqual(u.replace("x", "x"), base)
self.assertIs(u.replace("xy", "xy").__class__, str)
self.assertEqual(u.replace("xy", "xy"), base)
self.assertIs(u.center(len(u)).__class__, str)
self.assertEqual(u.center(len(u)), base)
self.assertIs(u.ljust(len(u)).__class__, str)
self.assertEqual(u.ljust(len(u)), base)
self.assertIs(u.rjust(len(u)).__class__, str)
self.assertEqual(u.rjust(len(u)), base)
self.assertIs(u.lower().__class__, str)
self.assertEqual(u.lower(), base)
self.assertIs(u.upper().__class__, str)
self.assertEqual(u.upper(), base)
self.assertIs(u.capitalize().__class__, str)
self.assertEqual(u.capitalize(), base)
self.assertIs(u.title().__class__, str)
self.assertEqual(u.title(), base)
self.assertIs((u + "").__class__, str)
self.assertEqual(u + "", base)
self.assertIs(("" + u).__class__, str)
self.assertEqual("" + u, base)
self.assertIs((u * 0).__class__, str)
self.assertEqual(u * 0, "")
self.assertIs((u * 1).__class__, str)
self.assertEqual(u * 1, base)
self.assertIs((u * 2).__class__, str)
self.assertEqual(u * 2, base + base)
self.assertIs(u[:].__class__, str)
self.assertEqual(u[:], base)
self.assertIs(u[0:0].__class__, str)
self.assertEqual(u[0:0], "")
class sublist(list):
pass
a = sublist(range(5))
self.assertEqual(a, list(range(5)))
a.append("hello")
self.assertEqual(a, list(range(5)) + ["hello"])
a[5] = 5
self.assertEqual(a, list(range(6)))
a.extend(range(6, 20))
self.assertEqual(a, list(range(20)))
a[-5:] = []
self.assertEqual(a, list(range(15)))
del a[10:15]
self.assertEqual(len(a), 10)
self.assertEqual(a, list(range(10)))
self.assertEqual(list(a), list(range(10)))
self.assertEqual(a[0], 0)
self.assertEqual(a[9], 9)
self.assertEqual(a[-10], 0)
self.assertEqual(a[-1], 9)
self.assertEqual(a[:5], list(range(5)))
## class CountedInput(file):
## """Counts lines read by self.readline().
##
## self.lineno is the 0-based ordinal of the last line read, up to
## a maximum of one greater than the number of lines in the file.
##
## self.ateof is true if and only if the final "" line has been read,
## at which point self.lineno stops incrementing, and further calls
## to readline() continue to return "".
## """
##
## lineno = 0
## ateof = 0
## def readline(self):
## if self.ateof:
## return ""
## s = file.readline(self)
## # Next line works too.
## # s = super(CountedInput, self).readline()
## self.lineno += 1
## if s == "":
## self.ateof = 1
## return s
##
## f = file(name=support.TESTFN, mode='w')
## lines = ['a\n', 'b\n', 'c\n']
## try:
## f.writelines(lines)
## f.close()
## f = CountedInput(support.TESTFN)
## for (i, expected) in zip(range(1, 5) + [4], lines + 2 * [""]):
## got = f.readline()
## self.assertEqual(expected, got)
## self.assertEqual(f.lineno, i)
## self.assertEqual(f.ateof, (i > len(lines)))
## f.close()
## finally:
## try:
## f.close()
## except:
## pass
## support.unlink(support.TESTFN)
def test_keywords(self):
# Testing keyword args to basic type constructors ...
self.assertEqual(int(x=1), 1)
self.assertEqual(float(x=2), 2.0)
self.assertEqual(int(x=3), 3)
self.assertEqual(complex(imag=42, real=666), complex(666, 42))
self.assertEqual(str(object=500), '500')
self.assertEqual(str(object=b'abc', errors='strict'), 'abc')
self.assertEqual(tuple(sequence=range(3)), (0, 1, 2))
self.assertEqual(list(sequence=(0, 1, 2)), list(range(3)))
# note: as of Python 2.3, dict() no longer has an "items" keyword arg
for constructor in (int, float, int, complex, str, str,
tuple, list):
try:
constructor(bogus_keyword_arg=1)
except TypeError:
pass
else:
self.fail("expected TypeError from bogus keyword argument to %r"
% constructor)
def test_str_subclass_as_dict_key(self):
# Testing a str subclass used as dict key ..
class cistr(str):
"""Sublcass of str that computes __eq__ case-insensitively.
Also computes a hash code of the string in canonical form.
"""
def __init__(self, value):
self.canonical = value.lower()
self.hashcode = hash(self.canonical)
def __eq__(self, other):
if not isinstance(other, cistr):
other = cistr(other)
return self.canonical == other.canonical
def __hash__(self):
return self.hashcode
self.assertEqual(cistr('ABC'), 'abc')
self.assertEqual('aBc', cistr('ABC'))
self.assertEqual(str(cistr('ABC')), 'ABC')
d = {cistr('one'): 1, cistr('two'): 2, cistr('tHree'): 3}
self.assertEqual(d[cistr('one')], 1)
self.assertEqual(d[cistr('tWo')], 2)
self.assertEqual(d[cistr('THrEE')], 3)
self.assertIn(cistr('ONe'), d)
self.assertEqual(d.get(cistr('thrEE')), 3)
def test_classic_comparisons(self):
# Testing classic comparisons...
class classic:
pass
for base in (classic, int, object):
class C(base):
def __init__(self, value):
self.value = int(value)
def __eq__(self, other):
if isinstance(other, C):
return self.value == other.value
if isinstance(other, int) or isinstance(other, int):
return self.value == other
return NotImplemented
def __ne__(self, other):
if isinstance(other, C):
return self.value != other.value
if isinstance(other, int) or isinstance(other, int):
return self.value != other
return NotImplemented
def __lt__(self, other):
if isinstance(other, C):
return self.value < other.value
if isinstance(other, int) or isinstance(other, int):
return self.value < other
return NotImplemented
def __le__(self, other):
if isinstance(other, C):
return self.value <= other.value
if isinstance(other, int) or isinstance(other, int):
return self.value <= other
return NotImplemented
def __gt__(self, other):
if isinstance(other, C):
return self.value > other.value
if isinstance(other, int) or isinstance(other, int):
return self.value > other
return NotImplemented
def __ge__(self, other):
if isinstance(other, C):
return self.value >= other.value
if isinstance(other, int) or isinstance(other, int):
return self.value >= other
return NotImplemented
c1 = C(1)
c2 = C(2)
c3 = C(3)
self.assertEqual(c1, 1)
c = {1: c1, 2: c2, 3: c3}
for x in 1, 2, 3:
for y in 1, 2, 3:
for op in "<", "<=", "==", "!=", ">", ">=":
self.assertEqual(eval("c[x] %s c[y]" % op),
eval("x %s y" % op),
"x=%d, y=%d" % (x, y))
self.assertEqual(eval("c[x] %s y" % op),
eval("x %s y" % op),
"x=%d, y=%d" % (x, y))
self.assertEqual(eval("x %s c[y]" % op),
eval("x %s y" % op),
"x=%d, y=%d" % (x, y))
def test_rich_comparisons(self):
# Testing rich comparisons...
class Z(complex):
pass
z = Z(1)
self.assertEqual(z, 1+0j)
self.assertEqual(1+0j, z)
class ZZ(complex):
def __eq__(self, other):
try:
return abs(self - other) <= 1e-6
except:
return NotImplemented
zz = ZZ(1.0000003)
self.assertEqual(zz, 1+0j)
self.assertEqual(1+0j, zz)
class classic:
pass
for base in (classic, int, object, list):
class C(base):
def __init__(self, value):
self.value = int(value)
def __cmp__(self_, other):
self.fail("shouldn't call __cmp__")
def __eq__(self, other):
if isinstance(other, C):
return self.value == other.value
if isinstance(other, int) or isinstance(other, int):
return self.value == other
return NotImplemented
def __ne__(self, other):
if isinstance(other, C):
return self.value != other.value
if isinstance(other, int) or isinstance(other, int):
return self.value != other
return NotImplemented
def __lt__(self, other):
if isinstance(other, C):
return self.value < other.value
if isinstance(other, int) or isinstance(other, int):
return self.value < other
return NotImplemented
def __le__(self, other):
if isinstance(other, C):
return self.value <= other.value
if isinstance(other, int) or isinstance(other, int):
return self.value <= other
return NotImplemented
def __gt__(self, other):
if isinstance(other, C):
return self.value > other.value
if isinstance(other, int) or isinstance(other, int):
return self.value > other
return NotImplemented
def __ge__(self, other):
if isinstance(other, C):
return self.value >= other.value
if isinstance(other, int) or isinstance(other, int):
return self.value >= other
return NotImplemented
c1 = C(1)
c2 = C(2)
c3 = C(3)
self.assertEqual(c1, 1)
c = {1: c1, 2: c2, 3: c3}
for x in 1, 2, 3:
for y in 1, 2, 3:
for op in "<", "<=", "==", "!=", ">", ">=":
self.assertEqual(eval("c[x] %s c[y]" % op),
eval("x %s y" % op),
"x=%d, y=%d" % (x, y))
self.assertEqual(eval("c[x] %s y" % op),
eval("x %s y" % op),
"x=%d, y=%d" % (x, y))
self.assertEqual(eval("x %s c[y]" % op),
eval("x %s y" % op),
"x=%d, y=%d" % (x, y))
def test_descrdoc(self):
# Testing descriptor doc strings...
from _io import FileIO
def check(descr, what):
self.assertEqual(descr.__doc__, what)
check(FileIO.closed, "True if the file is closed") # getset descriptor
check(complex.real, "the real part of a complex number") # member descriptor
def test_doc_descriptor(self):
# Testing __doc__ descriptor...
# SF bug 542984
class DocDescr(object):
def __get__(self, object, otype):
if object:
object = object.__class__.__name__ + ' instance'
if otype:
otype = otype.__name__
return 'object=%s; type=%s' % (object, otype)
class OldClass:
__doc__ = DocDescr()
class NewClass(object):
__doc__ = DocDescr()
self.assertEqual(OldClass.__doc__, 'object=None; type=OldClass')
self.assertEqual(OldClass().__doc__, 'object=OldClass instance; type=OldClass')
self.assertEqual(NewClass.__doc__, 'object=None; type=NewClass')
self.assertEqual(NewClass().__doc__, 'object=NewClass instance; type=NewClass')
def test_set_class(self):
# Testing __class__ assignment...
class C(object): pass
class D(object): pass
class E(object): pass
class F(D, E): pass
for cls in C, D, E, F:
for cls2 in C, D, E, F:
x = cls()
x.__class__ = cls2
self.assertIs(x.__class__, cls2)
x.__class__ = cls
self.assertIs(x.__class__, cls)
def cant(x, C):
try:
x.__class__ = C
except TypeError:
pass
else:
self.fail("shouldn't allow %r.__class__ = %r" % (x, C))
try:
delattr(x, "__class__")
except (TypeError, AttributeError):
pass
else:
self.fail("shouldn't allow del %r.__class__" % x)
cant(C(), list)
cant(list(), C)
cant(C(), 1)
cant(C(), object)
cant(object(), list)
cant(list(), object)
class Int(int): __slots__ = []
cant(True, int)
cant(2, bool)
o = object()
cant(o, type(1))
cant(o, type(None))
del o
class G(object):
__slots__ = ["a", "b"]
class H(object):
__slots__ = ["b", "a"]
class I(object):
__slots__ = ["a", "b"]
class J(object):
__slots__ = ["c", "b"]
class K(object):
__slots__ = ["a", "b", "d"]
class L(H):
__slots__ = ["e"]
class M(I):
__slots__ = ["e"]
class N(J):
__slots__ = ["__weakref__"]
class P(J):
__slots__ = ["__dict__"]
class Q(J):
pass
class R(J):
__slots__ = ["__dict__", "__weakref__"]
for cls, cls2 in ((G, H), (G, I), (I, H), (Q, R), (R, Q)):
x = cls()
x.a = 1
x.__class__ = cls2
self.assertIs(x.__class__, cls2,
"assigning %r as __class__ for %r silently failed" % (cls2, x))
self.assertEqual(x.a, 1)
x.__class__ = cls
self.assertIs(x.__class__, cls,
"assigning %r as __class__ for %r silently failed" % (cls, x))
self.assertEqual(x.a, 1)
for cls in G, J, K, L, M, N, P, R, list, Int:
for cls2 in G, J, K, L, M, N, P, R, list, Int:
if cls is cls2:
continue
cant(cls(), cls2)
# Issue5283: when __class__ changes in __del__, the wrong
# type gets DECREF'd.
class O(object):
pass
class A(object):
def __del__(self):
self.__class__ = O
l = [A() for x in range(100)]
del l
def test_set_dict(self):
# Testing __dict__ assignment...
class C(object): pass
a = C()
a.__dict__ = {'b': 1}
self.assertEqual(a.b, 1)
def cant(x, dict):
try:
x.__dict__ = dict
except (AttributeError, TypeError):
pass
else:
self.fail("shouldn't allow %r.__dict__ = %r" % (x, dict))
cant(a, None)
cant(a, [])
cant(a, 1)
del a.__dict__ # Deleting __dict__ is allowed
class Base(object):
pass
def verify_dict_readonly(x):
"""
x has to be an instance of a class inheriting from Base.
"""
cant(x, {})
try:
del x.__dict__
except (AttributeError, TypeError):
pass
else:
self.fail("shouldn't allow del %r.__dict__" % x)
dict_descr = Base.__dict__["__dict__"]
try:
dict_descr.__set__(x, {})
except (AttributeError, TypeError):
pass
else:
self.fail("dict_descr allowed access to %r's dict" % x)
# Classes don't allow __dict__ assignment and have readonly dicts
class Meta1(type, Base):
pass
class Meta2(Base, type):
pass
class D(object, metaclass=Meta1):
pass
class E(object, metaclass=Meta2):
pass
for cls in C, D, E:
verify_dict_readonly(cls)
class_dict = cls.__dict__
try:
class_dict["spam"] = "eggs"
except TypeError:
pass
else:
self.fail("%r's __dict__ can be modified" % cls)
# Modules also disallow __dict__ assignment
class Module1(types.ModuleType, Base):
pass
class Module2(Base, types.ModuleType):
pass
for ModuleType in Module1, Module2:
mod = ModuleType("spam")
verify_dict_readonly(mod)
mod.__dict__["spam"] = "eggs"
# Exception's __dict__ can be replaced, but not deleted
# (at least not any more than regular exception's __dict__ can
# be deleted; on CPython it is not the case, whereas on PyPy they
# can, just like any other new-style instance's __dict__.)
def can_delete_dict(e):
try:
del e.__dict__
except (TypeError, AttributeError):
return False
else:
return True
class Exception1(Exception, Base):
pass
class Exception2(Base, Exception):
pass
for ExceptionType in Exception, Exception1, Exception2:
e = ExceptionType()
e.__dict__ = {"a": 1}
self.assertEqual(e.a, 1)
self.assertEqual(can_delete_dict(e), can_delete_dict(ValueError()))
def test_binary_operator_override(self):
# Testing overrides of binary operations...
class I(int):
def __repr__(self):
return "I(%r)" % int(self)
def __add__(self, other):
return I(int(self) + int(other))
__radd__ = __add__
def __pow__(self, other, mod=None):
if mod is None:
return I(pow(int(self), int(other)))
else:
return I(pow(int(self), int(other), int(mod)))
def __rpow__(self, other, mod=None):
if mod is None:
return I(pow(int(other), int(self), mod))
else:
return I(pow(int(other), int(self), int(mod)))
self.assertEqual(repr(I(1) + I(2)), "I(3)")
self.assertEqual(repr(I(1) + 2), "I(3)")
self.assertEqual(repr(1 + I(2)), "I(3)")
self.assertEqual(repr(I(2) ** I(3)), "I(8)")
self.assertEqual(repr(2 ** I(3)), "I(8)")
self.assertEqual(repr(I(2) ** 3), "I(8)")
self.assertEqual(repr(pow(I(2), I(3), I(5))), "I(3)")
class S(str):
def __eq__(self, other):
return self.lower() == other.lower()
def test_subclass_propagation(self):
# Testing propagation of slot functions to subclasses...
class A(object):
pass
class B(A):
pass
class C(A):
pass
class D(B, C):
pass
d = D()
orig_hash = hash(d) # related to id(d) in platform-dependent ways
A.__hash__ = lambda self: 42
self.assertEqual(hash(d), 42)
C.__hash__ = lambda self: 314
self.assertEqual(hash(d), 314)
B.__hash__ = lambda self: 144
self.assertEqual(hash(d), 144)
D.__hash__ = lambda self: 100
self.assertEqual(hash(d), 100)
D.__hash__ = None
self.assertRaises(TypeError, hash, d)
del D.__hash__
self.assertEqual(hash(d), 144)
B.__hash__ = None
self.assertRaises(TypeError, hash, d)
del B.__hash__
self.assertEqual(hash(d), 314)
C.__hash__ = None
self.assertRaises(TypeError, hash, d)
del C.__hash__
self.assertEqual(hash(d), 42)
A.__hash__ = None
self.assertRaises(TypeError, hash, d)
del A.__hash__
self.assertEqual(hash(d), orig_hash)
d.foo = 42
d.bar = 42
self.assertEqual(d.foo, 42)
self.assertEqual(d.bar, 42)
def __getattribute__(self, name):
if name == "foo":
return 24
return object.__getattribute__(self, name)
A.__getattribute__ = __getattribute__
self.assertEqual(d.foo, 24)
self.assertEqual(d.bar, 42)
def __getattr__(self, name):
if name in ("spam", "foo", "bar"):
return "hello"
raise AttributeError(name)
B.__getattr__ = __getattr__
self.assertEqual(d.spam, "hello")
self.assertEqual(d.foo, 24)
self.assertEqual(d.bar, 42)
del A.__getattribute__
self.assertEqual(d.foo, 42)
del d.foo
self.assertEqual(d.foo, "hello")
self.assertEqual(d.bar, 42)
del B.__getattr__
try:
d.foo
except AttributeError:
pass
else:
self.fail("d.foo should be undefined now")
# Test a nasty bug in recurse_down_subclasses()
class A(object):
pass
class B(A):
pass
del B
support.gc_collect()
A.__setitem__ = lambda *a: None # crash
def test_buffer_inheritance(self):
# Testing that buffer interface is inherited ...
import binascii
# SF bug [#470040] ParseTuple t# vs subclasses.
class MyBytes(bytes):
pass
base = b'abc'
m = MyBytes(base)
# b2a_hex uses the buffer interface to get its argument's value, via
# PyArg_ParseTuple 't#' code.
self.assertEqual(binascii.b2a_hex(m), binascii.b2a_hex(base))
class MyInt(int):
pass
m = MyInt(42)
try:
binascii.b2a_hex(m)
self.fail('subclass of int should not have a buffer interface')
except TypeError:
pass
def test_str_of_str_subclass(self):
# Testing __str__ defined in subclass of str ...
import binascii
import io
class octetstring(str):
def __str__(self):
return binascii.b2a_hex(self.encode('ascii')).decode("ascii")
def __repr__(self):
return self + " repr"
o = octetstring('A')
self.assertEqual(type(o), octetstring)
self.assertEqual(type(str(o)), str)
self.assertEqual(type(repr(o)), str)
self.assertEqual(ord(o), 0x41)
self.assertEqual(str(o), '41')
self.assertEqual(repr(o), 'A repr')
self.assertEqual(o.__str__(), '41')
self.assertEqual(o.__repr__(), 'A repr')
capture = io.StringIO()
# Calling str() or not exercises different internal paths.
print(o, file=capture)
print(str(o), file=capture)
self.assertEqual(capture.getvalue(), '41\n41\n')
capture.close()
def test_keyword_arguments(self):
# Testing keyword arguments to __init__, __call__...
def f(a): return a
self.assertEqual(f.__call__(a=42), 42)
a = []
list.__init__(a, sequence=[0, 1, 2])
self.assertEqual(a, [0, 1, 2])
def test_recursive_call(self):
# Testing recursive __call__() by setting to instance of class...
class A(object):
pass
A.__call__ = A()
try:
A()()
except RecursionError:
pass
else:
self.fail("Recursion limit should have been reached for __call__()")
def test_delete_hook(self):
# Testing __del__ hook...
log = []
class C(object):
def __del__(self):
log.append(1)
c = C()
self.assertEqual(log, [])
del c
support.gc_collect()
self.assertEqual(log, [1])
class D(object): pass
d = D()
try: del d[0]
except TypeError: pass
else: self.fail("invalid del() didn't raise TypeError")
def test_hash_inheritance(self):
# Testing hash of mutable subclasses...
class mydict(dict):
pass
d = mydict()
try:
hash(d)
except TypeError:
pass
else:
self.fail("hash() of dict subclass should fail")
class mylist(list):
pass
d = mylist()
try:
hash(d)
except TypeError:
pass
else:
self.fail("hash() of list subclass should fail")
def test_str_operations(self):
try: 'a' + 5
except TypeError: pass
else: self.fail("'' + 5 doesn't raise TypeError")
try: ''.split('')
except ValueError: pass
else: self.fail("''.split('') doesn't raise ValueError")
try: ''.join([0])
except TypeError: pass
else: self.fail("''.join([0]) doesn't raise TypeError")
try: ''.rindex('5')
except ValueError: pass
else: self.fail("''.rindex('5') doesn't raise ValueError")
try: '%(n)s' % None
except TypeError: pass
else: self.fail("'%(n)s' % None doesn't raise TypeError")
try: '%(n' % {}
except ValueError: pass
else: self.fail("'%(n' % {} '' doesn't raise ValueError")
try: '%*s' % ('abc')
except TypeError: pass
else: self.fail("'%*s' % ('abc') doesn't raise TypeError")
try: '%*.*s' % ('abc', 5)
except TypeError: pass
else: self.fail("'%*.*s' % ('abc', 5) doesn't raise TypeError")
try: '%s' % (1, 2)
except TypeError: pass
else: self.fail("'%s' % (1, 2) doesn't raise TypeError")
try: '%' % None
except ValueError: pass
else: self.fail("'%' % None doesn't raise ValueError")
self.assertEqual('534253'.isdigit(), 1)
self.assertEqual('534253x'.isdigit(), 0)
self.assertEqual('%c' % 5, '\x05')
self.assertEqual('%c' % '5', '5')
def test_deepcopy_recursive(self):
# Testing deepcopy of recursive objects...
class Node:
pass
a = Node()
b = Node()
a.b = b
b.a = a
z = deepcopy(a) # This blew up before
def test_uninitialized_modules(self):
# Testing uninitialized module objects...
from types import ModuleType as M
m = M.__new__(M)
str(m)
self.assertNotHasAttr(m, "__name__")
self.assertNotHasAttr(m, "__file__")
self.assertNotHasAttr(m, "foo")
self.assertFalse(m.__dict__) # None or {} are both reasonable answers
m.foo = 1
self.assertEqual(m.__dict__, {"foo": 1})
def test_funny_new(self):
# Testing __new__ returning something unexpected...
class C(object):
def __new__(cls, arg):
if isinstance(arg, str): return [1, 2, 3]
elif isinstance(arg, int): return object.__new__(D)
else: return object.__new__(cls)
class D(C):
def __init__(self, arg):
self.foo = arg
self.assertEqual(C("1"), [1, 2, 3])
self.assertEqual(D("1"), [1, 2, 3])
d = D(None)
self.assertEqual(d.foo, None)
d = C(1)
self.assertIsInstance(d, D)
self.assertEqual(d.foo, 1)
d = D(1)
self.assertIsInstance(d, D)
self.assertEqual(d.foo, 1)
def test_imul_bug(self):
# Testing for __imul__ problems...
# SF bug 544647
class C(object):
def __imul__(self, other):
return (self, other)
x = C()
y = x
y *= 1.0
self.assertEqual(y, (x, 1.0))
y = x
y *= 2
self.assertEqual(y, (x, 2))
y = x
y *= 3
self.assertEqual(y, (x, 3))
y = x
y *= 1<<100
self.assertEqual(y, (x, 1<<100))
y = x
y *= None
self.assertEqual(y, (x, None))
y = x
y *= "foo"
self.assertEqual(y, (x, "foo"))
def test_copy_setstate(self):
# Testing that copy.*copy() correctly uses __setstate__...
import copy
class C(object):
def __init__(self, foo=None):
self.foo = foo
self.__foo = foo
def setfoo(self, foo=None):
self.foo = foo
def getfoo(self):
return self.__foo
def __getstate__(self):
return [self.foo]
def __setstate__(self_, lst):
self.assertEqual(len(lst), 1)
self_.__foo = self_.foo = lst[0]
a = C(42)
a.setfoo(24)
self.assertEqual(a.foo, 24)
self.assertEqual(a.getfoo(), 42)
b = copy.copy(a)
self.assertEqual(b.foo, 24)
self.assertEqual(b.getfoo(), 24)
b = copy.deepcopy(a)
self.assertEqual(b.foo, 24)
self.assertEqual(b.getfoo(), 24)
def test_slices(self):
# Testing cases with slices and overridden __getitem__ ...
# Strings
self.assertEqual("hello"[:4], "hell")
self.assertEqual("hello"[slice(4)], "hell")
self.assertEqual(str.__getitem__("hello", slice(4)), "hell")
class S(str):
def __getitem__(self, x):
return str.__getitem__(self, x)
self.assertEqual(S("hello")[:4], "hell")
self.assertEqual(S("hello")[slice(4)], "hell")
self.assertEqual(S("hello").__getitem__(slice(4)), "hell")
# Tuples
self.assertEqual((1,2,3)[:2], (1,2))
self.assertEqual((1,2,3)[slice(2)], (1,2))
self.assertEqual(tuple.__getitem__((1,2,3), slice(2)), (1,2))
class T(tuple):
def __getitem__(self, x):
return tuple.__getitem__(self, x)
self.assertEqual(T((1,2,3))[:2], (1,2))
self.assertEqual(T((1,2,3))[slice(2)], (1,2))
self.assertEqual(T((1,2,3)).__getitem__(slice(2)), (1,2))
# Lists
self.assertEqual([1,2,3][:2], [1,2])
self.assertEqual([1,2,3][slice(2)], [1,2])
self.assertEqual(list.__getitem__([1,2,3], slice(2)), [1,2])
class L(list):
def __getitem__(self, x):
return list.__getitem__(self, x)
self.assertEqual(L([1,2,3])[:2], [1,2])
self.assertEqual(L([1,2,3])[slice(2)], [1,2])
self.assertEqual(L([1,2,3]).__getitem__(slice(2)), [1,2])
# Now do lists and __setitem__
a = L([1,2,3])
a[slice(1, 3)] = [3,2]
self.assertEqual(a, [1,3,2])
a[slice(0, 2, 1)] = [3,1]
self.assertEqual(a, [3,1,2])
a.__setitem__(slice(1, 3), [2,1])
self.assertEqual(a, [3,2,1])
a.__setitem__(slice(0, 2, 1), [2,3])
self.assertEqual(a, [2,3,1])
def test_subtype_resurrection(self):
# Testing resurrection of new-style instance...
class C(object):
container = []
def __del__(self):
# resurrect the instance
C.container.append(self)
c = C()
c.attr = 42
# The most interesting thing here is whether this blows up, due to
# flawed GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1
# bug).
del c
support.gc_collect()
self.assertEqual(len(C.container), 1)
# Make c mortal again, so that the test framework with -l doesn't report
# it as a leak.
del C.__del__
def test_slots_trash(self):
# Testing slot trash...
# Deallocating deeply nested slotted trash caused stack overflows
class trash(object):
__slots__ = ['x']
def __init__(self, x):
self.x = x
o = None
for i in range(50000):
o = trash(o)
del o
def test_slots_multiple_inheritance(self):
# SF bug 575229, multiple inheritance w/ slots dumps core
class A(object):
__slots__=()
class B(object):
pass
class C(A,B) :
__slots__=()
if support.check_impl_detail():
self.assertEqual(C.__basicsize__, B.__basicsize__)
self.assertHasAttr(C, '__dict__')
self.assertHasAttr(C, '__weakref__')
C().x = 2
def test_rmul(self):
# Testing correct invocation of __rmul__...
# SF patch 592646
class C(object):
def __mul__(self, other):
return "mul"
def __rmul__(self, other):
return "rmul"
a = C()
self.assertEqual(a*2, "mul")
self.assertEqual(a*2.2, "mul")
self.assertEqual(2*a, "rmul")
self.assertEqual(2.2*a, "rmul")
def test_ipow(self):
# Testing correct invocation of __ipow__...
# [SF bug 620179]
class C(object):
def __ipow__(self, other):
pass
a = C()
a **= 2
def test_mutable_bases(self):
# Testing mutable bases...
# stuff that should work:
class C(object):
pass
class C2(object):
def __getattribute__(self, attr):
if attr == 'a':
return 2
else:
return super(C2, self).__getattribute__(attr)
def meth(self):
return 1
class D(C):
pass
class E(D):
pass
d = D()
e = E()
D.__bases__ = (C,)
D.__bases__ = (C2,)
self.assertEqual(d.meth(), 1)
self.assertEqual(e.meth(), 1)
self.assertEqual(d.a, 2)
self.assertEqual(e.a, 2)
self.assertEqual(C2.__subclasses__(), [D])
try:
del D.__bases__
except (TypeError, AttributeError):
pass
else:
self.fail("shouldn't be able to delete .__bases__")
try:
D.__bases__ = ()
except TypeError as msg:
if str(msg) == "a new-style class can't have only classic bases":
self.fail("wrong error message for .__bases__ = ()")
else:
self.fail("shouldn't be able to set .__bases__ to ()")
try:
D.__bases__ = (D,)
except TypeError:
pass
else:
# actually, we'll have crashed by here...
self.fail("shouldn't be able to create inheritance cycles")
try:
D.__bases__ = (C, C)
except TypeError:
pass
else:
self.fail("didn't detect repeated base classes")
try:
D.__bases__ = (E,)
except TypeError:
pass
else:
self.fail("shouldn't be able to create inheritance cycles")
def test_builtin_bases(self):
# Make sure all the builtin types can have their base queried without
# segfaulting. See issue #5787.
builtin_types = [tp for tp in builtins.__dict__.values()
if isinstance(tp, type)]
for tp in builtin_types:
object.__getattribute__(tp, "__bases__")
if tp is not object:
self.assertEqual(len(tp.__bases__), 1, tp)
class L(list):
pass
class C(object):
pass
class D(C):
pass
try:
L.__bases__ = (dict,)
except TypeError:
pass
else:
self.fail("shouldn't turn list subclass into dict subclass")
try:
list.__bases__ = (dict,)
except TypeError:
pass
else:
self.fail("shouldn't be able to assign to list.__bases__")
try:
D.__bases__ = (C, list)
except TypeError:
pass
else:
assert 0, "best_base calculation found wanting"
def test_unsubclassable_types(self):
with self.assertRaises(TypeError):
class X(type(None)):
pass
with self.assertRaises(TypeError):
class X(object, type(None)):
pass
with self.assertRaises(TypeError):
class X(type(None), object):
pass
class O(object):
pass
with self.assertRaises(TypeError):
class X(O, type(None)):
pass
with self.assertRaises(TypeError):
class X(type(None), O):
pass
class X(object):
pass
with self.assertRaises(TypeError):
X.__bases__ = type(None),
with self.assertRaises(TypeError):
X.__bases__ = object, type(None)
with self.assertRaises(TypeError):
X.__bases__ = type(None), object
with self.assertRaises(TypeError):
X.__bases__ = O, type(None)
with self.assertRaises(TypeError):
X.__bases__ = type(None), O
def test_mutable_bases_with_failing_mro(self):
# Testing mutable bases with failing mro...
class WorkOnce(type):
def __new__(self, name, bases, ns):
self.flag = 0
return super(WorkOnce, self).__new__(WorkOnce, name, bases, ns)
def mro(self):
if self.flag > 0:
raise RuntimeError("bozo")
else:
self.flag += 1
return type.mro(self)
class WorkAlways(type):
def mro(self):
# this is here to make sure that .mro()s aren't called
# with an exception set (which was possible at one point).
# An error message will be printed in a debug build.
# What's a good way to test for this?
return type.mro(self)
class C(object):
pass
class C2(object):
pass
class D(C):
pass
class E(D):
pass
class F(D, metaclass=WorkOnce):
pass
class G(D, metaclass=WorkAlways):
pass
# Immediate subclasses have their mro's adjusted in alphabetical
# order, so E's will get adjusted before adjusting F's fails. We
# check here that E's gets restored.
E_mro_before = E.__mro__
D_mro_before = D.__mro__
try:
D.__bases__ = (C2,)
except RuntimeError:
self.assertEqual(E.__mro__, E_mro_before)
self.assertEqual(D.__mro__, D_mro_before)
else:
self.fail("exception not propagated")
def test_mutable_bases_catch_mro_conflict(self):
# Testing mutable bases catch mro conflict...
class A(object):
pass
class B(object):
pass
class C(A, B):
pass
class D(A, B):
pass
class E(C, D):
pass
try:
C.__bases__ = (B, A)
except TypeError:
pass
else:
self.fail("didn't catch MRO conflict")
def test_mutable_names(self):
# Testing mutable names...
class C(object):
pass
# C.__module__ could be 'test_descr' or '__main__'
mod = C.__module__
C.__name__ = 'D'
self.assertEqual((C.__module__, C.__name__), (mod, 'D'))
C.__name__ = 'D.E'
self.assertEqual((C.__module__, C.__name__), (mod, 'D.E'))
def test_evil_type_name(self):
# A badly placed Py_DECREF in type_set_name led to arbitrary code
# execution while the type structure was not in a sane state, and a
# possible segmentation fault as a result. See bug #16447.
class Nasty(str):
def __del__(self):
C.__name__ = "other"
class C:
pass
C.__name__ = Nasty("abc")
C.__name__ = "normal"
def test_subclass_right_op(self):
# Testing correct dispatch of subclass overloading __r<op>__...
# This code tests various cases where right-dispatch of a subclass
# should be preferred over left-dispatch of a base class.
# Case 1: subclass of int; this tests code in abstract.c::binary_op1()
class B(int):
def __floordiv__(self, other):
return "B.__floordiv__"
def __rfloordiv__(self, other):
return "B.__rfloordiv__"
self.assertEqual(B(1) // 1, "B.__floordiv__")
self.assertEqual(1 // B(1), "B.__rfloordiv__")
# Case 2: subclass of object; this is just the baseline for case 3
class C(object):
def __floordiv__(self, other):
return "C.__floordiv__"
def __rfloordiv__(self, other):
return "C.__rfloordiv__"
self.assertEqual(C() // 1, "C.__floordiv__")
self.assertEqual(1 // C(), "C.__rfloordiv__")
# Case 3: subclass of new-style class; here it gets interesting
class D(C):
def __floordiv__(self, other):
return "D.__floordiv__"
def __rfloordiv__(self, other):
return "D.__rfloordiv__"
self.assertEqual(D() // C(), "D.__floordiv__")
self.assertEqual(C() // D(), "D.__rfloordiv__")
# Case 4: this didn't work right in 2.2.2 and 2.3a1
class E(C):
pass
self.assertEqual(E.__rfloordiv__, C.__rfloordiv__)
self.assertEqual(E() // 1, "C.__floordiv__")
self.assertEqual(1 // E(), "C.__rfloordiv__")
self.assertEqual(E() // C(), "C.__floordiv__")
self.assertEqual(C() // E(), "C.__floordiv__") # This one would fail
@support.impl_detail("testing an internal kind of method object")
def test_meth_class_get(self):
# Testing __get__ method of METH_CLASS C methods...
# Full coverage of descrobject.c::classmethod_get()
# Baseline
arg = [1, 2, 3]
res = {1: None, 2: None, 3: None}
self.assertEqual(dict.fromkeys(arg), res)
self.assertEqual({}.fromkeys(arg), res)
# Now get the descriptor
descr = dict.__dict__["fromkeys"]
# More baseline using the descriptor directly
self.assertEqual(descr.__get__(None, dict)(arg), res)
self.assertEqual(descr.__get__({})(arg), res)
# Now check various error cases
try:
descr.__get__(None, None)
except TypeError:
pass
else:
self.fail("shouldn't have allowed descr.__get__(None, None)")
try:
descr.__get__(42)
except TypeError:
pass
else:
self.fail("shouldn't have allowed descr.__get__(42)")
try:
descr.__get__(None, 42)
except TypeError:
pass
else:
self.fail("shouldn't have allowed descr.__get__(None, 42)")
try:
descr.__get__(None, int)
except TypeError:
pass
else:
self.fail("shouldn't have allowed descr.__get__(None, int)")
def test_isinst_isclass(self):
# Testing proxy isinstance() and isclass()...
class Proxy(object):
def __init__(self, obj):
self.__obj = obj
def __getattribute__(self, name):
if name.startswith("_Proxy__"):
return object.__getattribute__(self, name)
else:
return getattr(self.__obj, name)
# Test with a classic class
class C:
pass
a = C()
pa = Proxy(a)
self.assertIsInstance(a, C) # Baseline
self.assertIsInstance(pa, C) # Test
# Test with a classic subclass
class D(C):
pass
a = D()
pa = Proxy(a)
self.assertIsInstance(a, C) # Baseline
self.assertIsInstance(pa, C) # Test
# Test with a new-style class
class C(object):
pass
a = C()
pa = Proxy(a)
self.assertIsInstance(a, C) # Baseline
self.assertIsInstance(pa, C) # Test
# Test with a new-style subclass
class D(C):
pass
a = D()
pa = Proxy(a)
self.assertIsInstance(a, C) # Baseline
self.assertIsInstance(pa, C) # Test
def test_proxy_super(self):
# Testing super() for a proxy object...
class Proxy(object):
def __init__(self, obj):
self.__obj = obj
def __getattribute__(self, name):
if name.startswith("_Proxy__"):
return object.__getattribute__(self, name)
else:
return getattr(self.__obj, name)
class B(object):
def f(self):
return "B.f"
class C(B):
def f(self):
return super(C, self).f() + "->C.f"
obj = C()
p = Proxy(obj)
self.assertEqual(C.__dict__["f"](p), "B.f->C.f")
def test_carloverre(self):
# Testing prohibition of Carlo Verre's hack...
try:
object.__setattr__(str, "foo", 42)
except TypeError:
pass
else:
self.fail("Carlo Verre __setattr__ succeeded!")
try:
object.__delattr__(str, "lower")
except TypeError:
pass
else:
self.fail("Carlo Verre __delattr__ succeeded!")
def test_weakref_segfault(self):
# Testing weakref segfault...
# SF 742911
import weakref
class Provoker:
def __init__(self, referrent):
self.ref = weakref.ref(referrent)
def __del__(self):
x = self.ref()
class Oops(object):
pass
o = Oops()
o.whatever = Provoker(o)
del o
def test_wrapper_segfault(self):
# SF 927248: deeply nested wrappers could cause stack overflow
f = lambda:None
for i in range(1000000):
f = f.__call__
f = None
def test_file_fault(self):
# Testing sys.stdout is changed in getattr...
test_stdout = sys.stdout
class StdoutGuard:
def __getattr__(self, attr):
sys.stdout = sys.__stdout__
raise RuntimeError("Premature access to sys.stdout.%s" % attr)
sys.stdout = StdoutGuard()
try:
print("Oops!")
except RuntimeError:
pass
finally:
sys.stdout = test_stdout
def test_vicious_descriptor_nonsense(self):
# Testing vicious_descriptor_nonsense...
# A potential segfault spotted by <NAME> in mail to
# python-dev 2003-04-17, turned into an example & fixed by Michael
# Hudson just less than four months later...
class Evil(object):
def __hash__(self):
return hash('attr')
def __eq__(self, other):
del C.attr
return 0
class Descr(object):
def __get__(self, ob, type=None):
return 1
class C(object):
attr = Descr()
c = C()
c.__dict__[Evil()] = 0
self.assertEqual(c.attr, 1)
# this makes a crash more likely:
support.gc_collect()
self.assertNotHasAttr(c, 'attr')
def test_init(self):
# SF 1155938
class Foo(object):
def __init__(self):
return 10
try:
Foo()
except TypeError:
pass
else:
self.fail("did not test __init__() for None return")
def test_method_wrapper(self):
# Testing method-wrapper objects...
# <type 'method-wrapper'> did not support any reflection before 2.5
# XXX should methods really support __eq__?
l = []
self.assertEqual(l.__add__, l.__add__)
self.assertEqual(l.__add__, [].__add__)
self.assertNotEqual(l.__add__, [5].__add__)
self.assertNotEqual(l.__add__, l.__mul__)
self.assertEqual(l.__add__.__name__, '__add__')
if hasattr(l.__add__, '__self__'):
# CPython
self.assertIs(l.__add__.__self__, l)
self.assertIs(l.__add__.__objclass__, list)
else:
# Python implementations where [].__add__ is a normal bound method
self.assertIs(l.__add__.im_self, l)
self.assertIs(l.__add__.im_class, list)
self.assertEqual(l.__add__.__doc__, list.__add__.__doc__)
try:
hash(l.__add__)
except TypeError:
pass
else:
self.fail("no TypeError from hash([].__add__)")
t = ()
t += (7,)
self.assertEqual(t.__add__, (7,).__add__)
self.assertEqual(hash(t.__add__), hash((7,).__add__))
def test_not_implemented(self):
# Testing NotImplemented...
# all binary methods should be able to return a NotImplemented
import operator
def specialmethod(self, other):
return NotImplemented
def check(expr, x, y):
try:
exec(expr, {'x': x, 'y': y, 'operator': operator})
except TypeError:
pass
else:
self.fail("no TypeError from %r" % (expr,))
N1 = sys.maxsize + 1 # might trigger OverflowErrors instead of
# TypeErrors
N2 = sys.maxsize # if sizeof(int) < sizeof(long), might trigger
# ValueErrors instead of TypeErrors
for name, expr, iexpr in [
('__add__', 'x + y', 'x += y'),
('__sub__', 'x - y', 'x -= y'),
('__mul__', 'x * y', 'x *= y'),
('__matmul__', 'x @ y', 'x @= y'),
('__truediv__', 'x / y', 'x /= y'),
('__floordiv__', 'x // y', 'x //= y'),
('__mod__', 'x % y', 'x %= y'),
('__divmod__', 'divmod(x, y)', None),
('__pow__', 'x ** y', 'x **= y'),
('__lshift__', 'x << y', 'x <<= y'),
('__rshift__', 'x >> y', 'x >>= y'),
('__and__', 'x & y', 'x &= y'),
('__or__', 'x | y', 'x |= y'),
('__xor__', 'x ^ y', 'x ^= y')]:
rname = '__r' + name[2:]
A = type('A', (), {name: specialmethod})
a = A()
check(expr, a, a)
check(expr, a, N1)
check(expr, a, N2)
if iexpr:
check(iexpr, a, a)
check(iexpr, a, N1)
check(iexpr, a, N2)
iname = '__i' + name[2:]
C = type('C', (), {iname: specialmethod})
c = C()
check(iexpr, c, a)
check(iexpr, c, N1)
check(iexpr, c, N2)
def test_assign_slice(self):
# ceval.c's assign_slice used to check for
# tp->tp_as_sequence->sq_slice instead of
# tp->tp_as_sequence->sq_ass_slice
class C(object):
def __setitem__(self, idx, value):
self.value = value
c = C()
c[1:2] = 3
self.assertEqual(c.value, 3)
def test_set_and_no_get(self):
# See
# http://mail.python.org/pipermail/python-dev/2010-January/095637.html
class Descr(object):
def __init__(self, name):
self.name = name
def __set__(self, obj, value):
obj.__dict__[self.name] = value
descr = Descr("a")
class X(object):
a = descr
x = X()
self.assertIs(x.a, descr)
x.a = 42
self.assertEqual(x.a, 42)
# Also check type_getattro for correctness.
class Meta(type):
pass
class X(metaclass=Meta):
pass
X.a = 42
Meta.a = Descr("a")
self.assertEqual(X.a, 42)
def test_getattr_hooks(self):
# issue 4230
class Descriptor(object):
counter = 0
def __get__(self, obj, objtype=None):
def getter(name):
self.counter += 1
raise AttributeError(name)
return getter
descr = Descriptor()
class A(object):
__getattribute__ = descr
class B(object):
__getattr__ = descr
class C(object):
__getattribute__ = descr
__getattr__ = descr
self.assertRaises(AttributeError, getattr, A(), "attr")
self.assertEqual(descr.counter, 1)
self.assertRaises(AttributeError, getattr, B(), "attr")
self.assertEqual(descr.counter, 2)
self.assertRaises(AttributeError, getattr, C(), "attr")
self.assertEqual(descr.counter, 4)
class EvilGetattribute(object):
# This used to segfault
def __getattr__(self, name):
raise AttributeError(name)
def __getattribute__(self, name):
del EvilGetattribute.__getattr__
for i in range(5):
gc.collect()
raise AttributeError(name)
self.assertRaises(AttributeError, getattr, EvilGetattribute(), "attr")
def test_type___getattribute__(self):
self.assertRaises(TypeError, type.__getattribute__, list, type)
def test_abstractmethods(self):
# type pretends not to have __abstractmethods__.
self.assertRaises(AttributeError, getattr, type, "__abstractmethods__")
class meta(type):
pass
self.assertRaises(AttributeError, getattr, meta, "__abstractmethods__")
class X(object):
pass
with self.assertRaises(AttributeError):
del X.__abstractmethods__
def test_proxy_call(self):
class FakeStr:
__class__ = str
fake_str = FakeStr()
# isinstance() reads __class__
self.assertIsInstance(fake_str, str)
# call a method descriptor
with self.assertRaises(TypeError):
str.split(fake_str)
# call a slot wrapper descriptor
with self.assertRaises(TypeError):
str.__add__(fake_str, "abc")
def test_repr_as_str(self):
# Issue #11603: crash or infinite loop when rebinding __str__ as
# __repr__.
class Foo:
pass
Foo.__repr__ = Foo.__str__
foo = Foo()
self.assertRaises(RecursionError, str, foo)
self.assertRaises(RecursionError, repr, foo)
def test_mixing_slot_wrappers(self):
class X(dict):
__setattr__ = dict.__setitem__
x = X()
x.y = 42
self.assertEqual(x["y"], 42)
def test_slot_shadows_class_variable(self):
with self.assertRaises(ValueError) as cm:
class X:
__slots__ = ["foo"]
foo = None
m = str(cm.exception)
self.assertEqual("'foo' in __slots__ conflicts with class variable", m)
def test_set_doc(self):
class X:
"elephant"
X.__doc__ = "banana"
self.assertEqual(X.__doc__, "banana")
with self.assertRaises(TypeError) as cm:
type(list).__dict__["__doc__"].__set__(list, "blah")
self.assertIn("can't set list.__doc__", str(cm.exception))
with self.assertRaises(TypeError) as cm:
type(X).__dict__["__doc__"].__delete__(X)
self.assertIn("can't delete X.__doc__", str(cm.exception))
self.assertEqual(X.__doc__, "banana")
def test_qualname(self):
descriptors = [str.lower, complex.real, float.real, int.__add__]
types = ['method', 'member', 'getset', 'wrapper']
# make sure we have an example of each type of descriptor
for d, n in zip(descriptors, types):
self.assertEqual(type(d).__name__, n + '_descriptor')
for d in descriptors:
qualname = d.__objclass__.__qualname__ + '.' + d.__name__
self.assertEqual(d.__qualname__, qualname)
self.assertEqual(str.lower.__qualname__, 'str.lower')
self.assertEqual(complex.real.__qualname__, 'complex.real')
self.assertEqual(float.real.__qualname__, 'float.real')
self.assertEqual(int.__add__.__qualname__, 'int.__add__')
class X:
pass
with self.assertRaises(TypeError):
del X.__qualname__
self.assertRaises(TypeError, type.__dict__['__qualname__'].__set__,
str, 'Oink')
global Y
class Y:
class Inside:
pass
self.assertEqual(Y.__qualname__, 'Y')
self.assertEqual(Y.Inside.__qualname__, 'Y.Inside')
def test_qualname_dict(self):
ns = {'__qualname__': 'some.name'}
tp = type('Foo', (), ns)
self.assertEqual(tp.__qualname__, 'some.name')
self.assertNotIn('__qualname__', tp.__dict__)
self.assertEqual(ns, {'__qualname__': 'some.name'})
ns = {'__qualname__': 1}
self.assertRaises(TypeError, type, 'Foo', (), ns)
def test_cycle_through_dict(self):
# See bug #1469629
class X(dict):
def __init__(self):
dict.__init__(self)
self.__dict__ = self
x = X()
x.attr = 42
wr = weakref.ref(x)
del x
support.gc_collect()
self.assertIsNone(wr())
for o in gc.get_objects():
self.assertIsNot(type(o), X)
def test_object_new_and_init_with_parameters(self):
# See issue #1683368
class OverrideNeither:
pass
self.assertRaises(TypeError, OverrideNeither, 1)
self.assertRaises(TypeError, OverrideNeither, kw=1)
class OverrideNew:
def __new__(cls, foo, kw=0, *args, **kwds):
return object.__new__(cls, *args, **kwds)
class OverrideInit:
def __init__(self, foo, kw=0, *args, **kwargs):
return object.__init__(self, *args, **kwargs)
class OverrideBoth(OverrideNew, OverrideInit):
pass
for case in OverrideNew, OverrideInit, OverrideBoth:
case(1)
case(1, kw=2)
self.assertRaises(TypeError, case, 1, 2, 3)
self.assertRaises(TypeError, case, 1, 2, foo=3)
def test_subclassing_does_not_duplicate_dict_descriptors(self):
class Base:
pass
class Sub(Base):
pass
self.assertIn("__dict__", Base.__dict__)
self.assertNotIn("__dict__", Sub.__dict__)
def test_bound_method_repr(self):
class Foo:
def method(self):
pass
self.assertRegex(repr(Foo().method),
r"<bound method .*Foo\.method of <.*Foo object at .*>>")
class Base:
def method(self):
pass
class Derived1(Base):
pass
class Derived2(Base):
def method(self):
pass
base = Base()
derived1 = Derived1()
derived2 = Derived2()
super_d2 = super(Derived2, derived2)
self.assertRegex(repr(base.method),
r"<bound method .*Base\.method of <.*Base object at .*>>")
self.assertRegex(repr(derived1.method),
r"<bound method .*Base\.method of <.*Derived1 object at .*>>")
self.assertRegex(repr(derived2.method),
r"<bound method .*Derived2\.method of <.*Derived2 object at .*>>")
self.assertRegex(repr(super_d2.method),
r"<bound method .*Base\.method of <.*Derived2 object at .*>>")
class Foo:
@classmethod
def method(cls):
pass
foo = Foo()
self.assertRegex(repr(foo.method), # access via instance
r"<bound method .*Foo\.method of <class '.*Foo'>>")
self.assertRegex(repr(Foo.method), # access via the class
r"<bound method .*Foo\.method of <class '.*Foo'>>")
class MyCallable:
def __call__(self, arg):
pass
func = MyCallable() # func has no __name__ or __qualname__ attributes
instance = object()
method = types.MethodType(func, instance)
self.assertRegex(repr(method),
r"<bound method \? of <object object at .*>>")
func.__name__ = "name"
self.assertRegex(repr(method),
r"<bound method name of <object object at .*>>")
func.__qualname__ = "qualname"
self.assertRegex(repr(method),
r"<bound method qualname of <object object at .*>>")
class DictProxyTests(unittest.TestCase):
def setUp(self):
class C(object):
def meth(self):
pass
self.C = C
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
'trace function introduces __local__')
def test_iter_keys(self):
# Testing dict-proxy keys...
it = self.C.__dict__.keys()
self.assertNotIsInstance(it, list)
keys = list(it)
keys.sort()
self.assertEqual(keys, ['__dict__', '__doc__', '__module__',
'__weakref__', 'meth'])
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
'trace function introduces __local__')
def test_iter_values(self):
# Testing dict-proxy values...
it = self.C.__dict__.values()
self.assertNotIsInstance(it, list)
values = list(it)
self.assertEqual(len(values), 5)
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
'trace function introduces __local__')
def test_iter_items(self):
# Testing dict-proxy iteritems...
it = self.C.__dict__.items()
self.assertNotIsInstance(it, list)
keys = [item[0] for item in it]
keys.sort()
self.assertEqual(keys, ['__dict__', '__doc__', '__module__',
'__weakref__', 'meth'])
def test_dict_type_with_metaclass(self):
# Testing type of __dict__ when metaclass set...
class B(object):
pass
class M(type):
pass
class C(metaclass=M):
# In 2.3a1, C.__dict__ was a real dict rather than a dict proxy
pass
self.assertEqual(type(C.__dict__), type(B.__dict__))
def test_repr(self):
# Testing mappingproxy.__repr__.
# We can't blindly compare with the repr of another dict as ordering
# of keys and values is arbitrary and may differ.
r = repr(self.C.__dict__)
self.assertTrue(r.startswith('mappingproxy('), r)
self.assertTrue(r.endswith(')'), r)
for k, v in self.C.__dict__.items():
self.assertIn('{!r}: {!r}'.format(k, v), r)
class PTypesLongInitTest(unittest.TestCase):
# This is in its own TestCase so that it can be run before any other tests.
def test_pytype_long_ready(self):
# Testing SF bug 551412 ...
# This dumps core when SF bug 551412 isn't fixed --
# but only when test_descr.py is run separately.
# (That can't be helped -- as soon as PyType_Ready()
# is called for PyLong_Type, the bug is gone.)
class UserLong(object):
def __pow__(self, *args):
pass
try:
pow(0, UserLong(), 0)
except:
pass
# Another segfault only when run early
# (before PyType_Ready(tuple) is called)
type.mro(tuple)
class MiscTests(unittest.TestCase):
def test_type_lookup_mro_reference(self):
# Issue #14199: _PyType_Lookup() has to keep a strong reference to
# the type MRO because it may be modified during the lookup, if
# __bases__ is set during the lookup for example.
class MyKey(object):
def __hash__(self):
return hash('mykey')
def __eq__(self, other):
X.__bases__ = (Base2,)
class Base(object):
mykey = 'from Base'
mykey2 = 'from Base'
class Base2(object):
mykey = 'from Base2'
mykey2 = 'from Base2'
X = type('X', (Base,), {MyKey(): 5})
# mykey is read from Base
self.assertEqual(X.mykey, 'from Base')
# mykey2 is read from Base2 because MyKey.__eq__ has set __bases__
self.assertEqual(X.mykey2, 'from Base2')
class PicklingTests(unittest.TestCase):
def _check_reduce(self, proto, obj, args=(), kwargs={}, state=None,
listitems=None, dictitems=None):
if proto >= 2:
reduce_value = obj.__reduce_ex__(proto)
if kwargs:
self.assertEqual(reduce_value[0], copyreg.__newobj_ex__)
self.assertEqual(reduce_value[1], (type(obj), args, kwargs))
else:
self.assertEqual(reduce_value[0], copyreg.__newobj__)
self.assertEqual(reduce_value[1], (type(obj),) + args)
self.assertEqual(reduce_value[2], state)
if listitems is not None:
self.assertListEqual(list(reduce_value[3]), listitems)
else:
self.assertIsNone(reduce_value[3])
if dictitems is not None:
self.assertDictEqual(dict(reduce_value[4]), dictitems)
else:
self.assertIsNone(reduce_value[4])
else:
base_type = type(obj).__base__
reduce_value = (copyreg._reconstructor,
(type(obj),
base_type,
None if base_type is object else base_type(obj)))
if state is not None:
reduce_value += (state,)
self.assertEqual(obj.__reduce_ex__(proto), reduce_value)
self.assertEqual(obj.__reduce__(), reduce_value)
def test_reduce(self):
protocols = range(pickle.HIGHEST_PROTOCOL + 1)
args = (-101, "spam")
kwargs = {'bacon': -201, 'fish': -301}
state = {'cheese': -401}
class C1:
def __getnewargs__(self):
return args
obj = C1()
for proto in protocols:
self._check_reduce(proto, obj, args)
for name, value in state.items():
setattr(obj, name, value)
for proto in protocols:
self._check_reduce(proto, obj, args, state=state)
class C2:
def __getnewargs__(self):
return "bad args"
obj = C2()
for proto in protocols:
if proto >= 2:
with self.assertRaises(TypeError):
obj.__reduce_ex__(proto)
class C3:
def __getnewargs_ex__(self):
return (args, kwargs)
obj = C3()
for proto in protocols:
if proto >= 2:
self._check_reduce(proto, obj, args, kwargs)
class C4:
def __getnewargs_ex__(self):
return (args, "bad dict")
class C5:
def __getnewargs_ex__(self):
return ("bad tuple", kwargs)
class C6:
def __getnewargs_ex__(self):
return ()
class C7:
def __getnewargs_ex__(self):
return "bad args"
for proto in protocols:
for cls in C4, C5, C6, C7:
obj = cls()
if proto >= 2:
with self.assertRaises((TypeError, ValueError)):
obj.__reduce_ex__(proto)
class C9:
def __getnewargs_ex__(self):
return (args, {})
obj = C9()
for proto in protocols:
self._check_reduce(proto, obj, args)
class C10:
def __getnewargs_ex__(self):
raise IndexError
obj = C10()
for proto in protocols:
if proto >= 2:
with self.assertRaises(IndexError):
obj.__reduce_ex__(proto)
class C11:
def __getstate__(self):
return state
obj = C11()
for proto in protocols:
self._check_reduce(proto, obj, state=state)
class C12:
def __getstate__(self):
return "not dict"
obj = C12()
for proto in protocols:
self._check_reduce(proto, obj, state="not dict")
class C13:
def __getstate__(self):
raise IndexError
obj = C13()
for proto in protocols:
with self.assertRaises(IndexError):
obj.__reduce_ex__(proto)
if proto < 2:
with self.assertRaises(IndexError):
obj.__reduce__()
class C14:
__slots__ = tuple(state)
def __init__(self):
for name, value in state.items():
setattr(self, name, value)
obj = C14()
for proto in protocols:
if proto >= 2:
self._check_reduce(proto, obj, state=(None, state))
else:
with self.assertRaises(TypeError):
obj.__reduce_ex__(proto)
with self.assertRaises(TypeError):
obj.__reduce__()
class C15(dict):
pass
obj = C15({"quebec": -601})
for proto in protocols:
self._check_reduce(proto, obj, dictitems=dict(obj))
class C16(list):
pass
obj = C16(["yukon"])
for proto in protocols:
self._check_reduce(proto, obj, listitems=list(obj))
def test_special_method_lookup(self):
protocols = range(pickle.HIGHEST_PROTOCOL + 1)
class Picky:
def __getstate__(self):
return {}
def __getattr__(self, attr):
if attr in ("__getnewargs__", "__getnewargs_ex__"):
raise AssertionError(attr)
return None
for protocol in protocols:
state = {} if protocol >= 2 else None
self._check_reduce(protocol, Picky(), state=state)
def _assert_is_copy(self, obj, objcopy, msg=None):
"""Utility method to verify if two objects are copies of each others.
"""
if msg is None:
msg = "{!r} is not a copy of {!r}".format(obj, objcopy)
if type(obj).__repr__ is object.__repr__:
# We have this limitation for now because we use the object's repr
# to help us verify that the two objects are copies. This allows
# us to delegate the non-generic verification logic to the objects
# themselves.
raise ValueError("object passed to _assert_is_copy must " +
"override the __repr__ method.")
self.assertIsNot(obj, objcopy, msg=msg)
self.assertIs(type(obj), type(objcopy), msg=msg)
if hasattr(obj, '__dict__'):
self.assertDictEqual(obj.__dict__, objcopy.__dict__, msg=msg)
self.assertIsNot(obj.__dict__, objcopy.__dict__, msg=msg)
if hasattr(obj, '__slots__'):
self.assertListEqual(obj.__slots__, objcopy.__slots__, msg=msg)
for slot in obj.__slots__:
self.assertEqual(
hasattr(obj, slot), hasattr(objcopy, slot), msg=msg)
self.assertEqual(getattr(obj, slot, None),
getattr(objcopy, slot, None), msg=msg)
self.assertEqual(repr(obj), repr(objcopy), msg=msg)
@staticmethod
def _generate_pickle_copiers():
"""Utility method to generate the many possible pickle configurations.
"""
class PickleCopier:
"This class copies object using pickle."
def __init__(self, proto, dumps, loads):
self.proto = proto
self.dumps = dumps
self.loads = loads
def copy(self, obj):
return self.loads(self.dumps(obj, self.proto))
def __repr__(self):
# We try to be as descriptive as possible here since this is
# the string which we will allow us to tell the pickle
# configuration we are using during debugging.
return ("PickleCopier(proto={}, dumps={}.{}, loads={}.{})"
.format(self.proto,
self.dumps.__module__, self.dumps.__qualname__,
self.loads.__module__, self.loads.__qualname__))
return (PickleCopier(*args) for args in
itertools.product(range(pickle.HIGHEST_PROTOCOL + 1),
{pickle.dumps, pickle._dumps},
{pickle.loads, pickle._loads}))
def test_pickle_slots(self):
# Tests pickling of classes with __slots__.
# Pickling of classes with __slots__ but without __getstate__ should
# fail (if using protocol 0 or 1)
global C
class C:
__slots__ = ['a']
with self.assertRaises(TypeError):
pickle.dumps(C(), 0)
global D
class D(C):
pass
with self.assertRaises(TypeError):
pickle.dumps(D(), 0)
class C:
"A class with __getstate__ and __setstate__ implemented."
__slots__ = ['a']
def __getstate__(self):
state = getattr(self, '__dict__', {}).copy()
for cls in type(self).__mro__:
for slot in cls.__dict__.get('__slots__', ()):
try:
state[slot] = getattr(self, slot)
except AttributeError:
pass
return state
def __setstate__(self, state):
for k, v in state.items():
setattr(self, k, v)
def __repr__(self):
return "%s()<%r>" % (type(self).__name__, self.__getstate__())
class D(C):
"A subclass of a class with slots."
pass
global E
class E(C):
"A subclass with an extra slot."
__slots__ = ['b']
# Now it should work
for pickle_copier in self._generate_pickle_copiers():
with self.subTest(pickle_copier=pickle_copier):
x = C()
y = pickle_copier.copy(x)
self._assert_is_copy(x, y)
x.a = 42
y = pickle_copier.copy(x)
self._assert_is_copy(x, y)
x = D()
x.a = 42
x.b = 100
y = pickle_copier.copy(x)
self._assert_is_copy(x, y)
x = E()
x.a = 42
x.b = "foo"
y = pickle_copier.copy(x)
self._assert_is_copy(x, y)
def test_reduce_copying(self):
# Tests pickling and copying new-style classes and objects.
global C1
class C1:
"The state of this class is copyable via its instance dict."
ARGS = (1, 2)
NEED_DICT_COPYING = True
def __init__(self, a, b):
super().__init__()
self.a = a
self.b = b
def __repr__(self):
return "C1(%r, %r)" % (self.a, self.b)
global C2
class C2(list):
"A list subclass copyable via __getnewargs__."
ARGS = (1, 2)
NEED_DICT_COPYING = False
def __new__(cls, a, b):
self = super().__new__(cls)
self.a = a
self.b = b
return self
def __init__(self, *args):
super().__init__()
# This helps testing that __init__ is not called during the
# unpickling process, which would cause extra appends.
self.append("cheese")
@classmethod
def __getnewargs__(cls):
return cls.ARGS
def __repr__(self):
return "C2(%r, %r)<%r>" % (self.a, self.b, list(self))
global C3
class C3(list):
"A list subclass copyable via __getstate__."
ARGS = (1, 2)
NEED_DICT_COPYING = False
def __init__(self, a, b):
self.a = a
self.b = b
# This helps testing that __init__ is not called during the
# unpickling process, which would cause extra appends.
self.append("cheese")
@classmethod
def __getstate__(cls):
return cls.ARGS
def __setstate__(self, state):
a, b = state
self.a = a
self.b = b
def __repr__(self):
return "C3(%r, %r)<%r>" % (self.a, self.b, list(self))
global C4
class C4(int):
"An int subclass copyable via __getnewargs__."
ARGS = ("hello", "world", 1)
NEED_DICT_COPYING = False
def __new__(cls, a, b, value):
self = super().__new__(cls, value)
self.a = a
self.b = b
return self
@classmethod
def __getnewargs__(cls):
return cls.ARGS
def __repr__(self):
return "C4(%r, %r)<%r>" % (self.a, self.b, int(self))
global C5
class C5(int):
"An int subclass copyable via __getnewargs_ex__."
ARGS = (1, 2)
KWARGS = {'value': 3}
NEED_DICT_COPYING = False
def __new__(cls, a, b, *, value=0):
self = super().__new__(cls, value)
self.a = a
self.b = b
return self
@classmethod
def __getnewargs_ex__(cls):
return (cls.ARGS, cls.KWARGS)
def __repr__(self):
return "C5(%r, %r)<%r>" % (self.a, self.b, int(self))
test_classes = (C1, C2, C3, C4, C5)
# Testing copying through pickle
pickle_copiers = self._generate_pickle_copiers()
for cls, pickle_copier in itertools.product(test_classes, pickle_copiers):
with self.subTest(cls=cls, pickle_copier=pickle_copier):
kwargs = getattr(cls, 'KWARGS', {})
obj = cls(*cls.ARGS, **kwargs)
proto = pickle_copier.proto
objcopy = pickle_copier.copy(obj)
self._assert_is_copy(obj, objcopy)
# For test classes that supports this, make sure we didn't go
# around the reduce protocol by simply copying the attribute
# dictionary. We clear attributes using the previous copy to
# not mutate the original argument.
if proto >= 2 and not cls.NEED_DICT_COPYING:
objcopy.__dict__.clear()
objcopy2 = pickle_copier.copy(objcopy)
self._assert_is_copy(obj, objcopy2)
# Testing copying through copy.deepcopy()
for cls in test_classes:
with self.subTest(cls=cls):
kwargs = getattr(cls, 'KWARGS', {})
obj = cls(*cls.ARGS, **kwargs)
objcopy = deepcopy(obj)
self._assert_is_copy(obj, objcopy)
# For test classes that supports this, make sure we didn't go
# around the reduce protocol by simply copying the attribute
# dictionary. We clear attributes using the previous copy to
# not mutate the original argument.
if not cls.NEED_DICT_COPYING:
objcopy.__dict__.clear()
objcopy2 = deepcopy(objcopy)
self._assert_is_copy(obj, objcopy2)
def test_issue24097(self):
# Slot name is freed inside __getattr__ and is later used.
class S(str): # Not interned
pass
class A:
__slotnames__ = [S('spam')]
def __getattr__(self, attr):
if attr == 'spam':
A.__slotnames__[:] = [S('spam')]
return 42
else:
raise AttributeError
import copyreg
expected = (copyreg.__newobj__, (A,), (None, {'spam': 42}), None, None)
self.assertEqual(A().__reduce__(2), expected) # Shouldn't crash
class SharedKeyTests(unittest.TestCase):
@support.cpython_only
def test_subclasses(self):
# Verify that subclasses can share keys (per PEP 412)
class A:
pass
class B(A):
pass
a, b = A(), B()
self.assertEqual(sys.getsizeof(vars(a)), sys.getsizeof(vars(b)))
self.assertLess(sys.getsizeof(vars(a)), sys.getsizeof({}))
a.x, a.y, a.z, a.w = range(4)
self.assertNotEqual(sys.getsizeof(vars(a)), sys.getsizeof(vars(b)))
a2 = A()
self.assertEqual(sys.getsizeof(vars(a)), sys.getsizeof(vars(a2)))
self.assertLess(sys.getsizeof(vars(a)), sys.getsizeof({}))
b.u, b.v, b.w, b.t = range(4)
self.assertLess(sys.getsizeof(vars(b)), sys.getsizeof({}))
class DebugHelperMeta(type):
"""
Sets default __doc__ and simplifies repr() output.
"""
def __new__(mcls, name, bases, attrs):
if attrs.get('__doc__') is None:
attrs['__doc__'] = name # helps when debugging with gdb
return type.__new__(mcls, name, bases, attrs)
def __repr__(cls):
return repr(cls.__name__)
class MroTest(unittest.TestCase):
"""
Regressions for some bugs revealed through
mcsl.mro() customization (typeobject.c: mro_internal()) and
cls.__bases__ assignment (typeobject.c: type_set_bases()).
"""
def setUp(self):
self.step = 0
self.ready = False
def step_until(self, limit):
ret = (self.step < limit)
if ret:
self.step += 1
return ret
def test_incomplete_set_bases_on_self(self):
"""
type_set_bases must be aware that type->tp_mro can be NULL.
"""
class M(DebugHelperMeta):
def mro(cls):
if self.step_until(1):
assert cls.__mro__ is None
cls.__bases__ += ()
return type.mro(cls)
class A(metaclass=M):
pass
def test_reent_set_bases_on_base(self):
"""
Deep reentrancy must not over-decref old_mro.
"""
class M(DebugHelperMeta):
def mro(cls):
if cls.__mro__ is not None and cls.__name__ == 'B':
# 4-5 steps are usually enough to make it crash somewhere
if self.step_until(10):
A.__bases__ += ()
return type.mro(cls)
class A(metaclass=M):
pass
class B(A):
pass
B.__bases__ += ()
def test_reent_set_bases_on_direct_base(self):
"""
Similar to test_reent_set_bases_on_base, but may crash differently.
"""
class M(DebugHelperMeta):
def mro(cls):
base = cls.__bases__[0]
if base is not object:
if self.step_until(5):
base.__bases__ += ()
return type.mro(cls)
class A(metaclass=M):
pass
class B(A):
pass
class C(B):
pass
def test_reent_set_bases_tp_base_cycle(self):
"""
type_set_bases must check for an inheritance cycle not only through
MRO of the type, which may be not yet updated in case of reentrance,
but also through tp_base chain, which is assigned before diving into
inner calls to mro().
Otherwise, the following snippet can loop forever:
do {
// ...
type = type->tp_base;
} while (type != NULL);
Functions that rely on tp_base (like solid_base and PyType_IsSubtype)
would not be happy in that case, causing a stack overflow.
"""
class M(DebugHelperMeta):
def mro(cls):
if self.ready:
if cls.__name__ == 'B1':
B2.__bases__ = (B1,)
if cls.__name__ == 'B2':
B1.__bases__ = (B2,)
return type.mro(cls)
class A(metaclass=M):
pass
class B1(A):
pass
class B2(A):
pass
self.ready = True
with self.assertRaises(TypeError):
B1.__bases__ += ()
def test_tp_subclasses_cycle_in_update_slots(self):
"""
type_set_bases must check for reentrancy upon finishing its job
by updating tp_subclasses of old/new bases of the type.
Otherwise, an implicit inheritance cycle through tp_subclasses
can break functions that recurse on elements of that field
(like recurse_down_subclasses and mro_hierarchy) eventually
leading to a stack overflow.
"""
class M(DebugHelperMeta):
def mro(cls):
if self.ready and cls.__name__ == 'C':
self.ready = False
C.__bases__ = (B2,)
return type.mro(cls)
class A(metaclass=M):
pass
class B1(A):
pass
class B2(A):
pass
class C(A):
pass
self.ready = True
C.__bases__ = (B1,)
B1.__bases__ = (C,)
self.assertEqual(C.__bases__, (B2,))
self.assertEqual(B2.__subclasses__(), [C])
self.assertEqual(B1.__subclasses__(), [])
self.assertEqual(B1.__bases__, (C,))
self.assertEqual(C.__subclasses__(), [B1])
def test_tp_subclasses_cycle_error_return_path(self):
"""
The same as test_tp_subclasses_cycle_in_update_slots, but tests
a code path executed on error (goto bail).
"""
class E(Exception):
pass
class M(DebugHelperMeta):
def mro(cls):
if self.ready and cls.__name__ == 'C':
if C.__bases__ == (B2,):
self.ready = False
else:
C.__bases__ = (B2,)
raise E
return type.mro(cls)
class A(metaclass=M):
pass
class B1(A):
pass
class B2(A):
pass
class C(A):
pass
self.ready = True
with self.assertRaises(E):
C.__bases__ = (B1,)
B1.__bases__ = (C,)
self.assertEqual(C.__bases__, (B2,))
self.assertEqual(C.__mro__, tuple(type.mro(C)))
def test_incomplete_extend(self):
"""
Extending an unitialized type with type->tp_mro == NULL must
throw a reasonable TypeError exception, instead of failing
with PyErr_BadInternalCall.
"""
class M(DebugHelperMeta):
def mro(cls):
if cls.__mro__ is None and cls.__name__ != 'X':
with self.assertRaises(TypeError):
class X(cls):
pass
return type.mro(cls)
class A(metaclass=M):
pass
def test_incomplete_super(self):
"""
Attrubute lookup on a super object must be aware that
its target type can be uninitialized (type->tp_mro == NULL).
"""
class M(DebugHelperMeta):
def mro(cls):
if cls.__mro__ is None:
with self.assertRaises(AttributeError):
super(cls, cls).xxx
return type.mro(cls)
class A(metaclass=M):
pass
def test_main():
# Run all local test cases, with PTypesLongInitTest first.
support.run_unittest(PTypesLongInitTest, OperatorsTest,
ClassPropertiesAndMethods, DictProxyTests,
MiscTests, PicklingTests, SharedKeyTests,
MroTest)
if __name__ == "__main__":
test_main()
|
[
"gc.collect",
"sys.getsizeof",
"weakref.ref",
"sys.gettrace",
"unittest.skipIf",
"xxsubtype.spamdict",
"types.MethodType",
"test.support.gc_collect",
"test.support.check_impl_detail",
"itertools.product",
"test.support.run_unittest",
"builtins.__dict__.values",
"unittest.TestCase.__init__",
"xxsubtype.spamlist.classmeth",
"test.support.impl_detail",
"copy.deepcopy",
"io.StringIO",
"test.support.captured_output",
"types.ModuleType.__new__",
"gc.get_objects",
"xxsubtype.spamlist.staticmeth",
"xxsubtype.spamlist",
"binascii.b2a_hex",
"copy.copy",
"types.ModuleType"
] |
[((10263, 10320), 'test.support.impl_detail', 'support.impl_detail', (['"""the module \'xxsubtype\' is internal"""'], {}), '("the module \'xxsubtype\' is internal")\n', (10282, 10320), False, 'from test import support\n'), ((12220, 12277), 'test.support.impl_detail', 'support.impl_detail', (['"""the module \'xxsubtype\' is internal"""'], {}), '("the module \'xxsubtype\' is internal")\n', (12239, 12277), False, 'from test import support\n'), ((51164, 51221), 'test.support.impl_detail', 'support.impl_detail', (['"""the module \'xxsubtype\' is internal"""'], {}), '("the module \'xxsubtype\' is internal")\n', (51183, 51221), False, 'from test import support\n'), ((53101, 53158), 'test.support.impl_detail', 'support.impl_detail', (['"""the module \'xxsubtype\' is internal"""'], {}), '("the module \'xxsubtype\' is internal")\n', (53120, 53158), False, 'from test import support\n'), ((70893, 70982), 'unittest.skipIf', 'unittest.skipIf', (['(sys.flags.optimize >= 2)', '"""Docstrings are omitted with -O2 and above"""'], {}), "(sys.flags.optimize >= 2,\n 'Docstrings are omitted with -O2 and above')\n", (70908, 70982), False, 'import unittest\n'), ((135953, 136017), 'test.support.impl_detail', 'support.impl_detail', (['"""testing an internal kind of method object"""'], {}), "('testing an internal kind of method object')\n", (135972, 136017), False, 'from test import support\n'), ((182908, 183065), 'test.support.run_unittest', 'support.run_unittest', (['PTypesLongInitTest', 'OperatorsTest', 'ClassPropertiesAndMethods', 'DictProxyTests', 'MiscTests', 'PicklingTests', 'SharedKeyTests', 'MroTest'], {}), '(PTypesLongInitTest, OperatorsTest,\n ClassPropertiesAndMethods, DictProxyTests, MiscTests, PicklingTests,\n SharedKeyTests, MroTest)\n', (182928, 183065), False, 'from test import support\n'), ((283, 332), 'unittest.TestCase.__init__', 'unittest.TestCase.__init__', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (309, 332), False, 'import unittest\n'), ((3849, 3860), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (3857, 3860), False, 'from copy import deepcopy\n'), ((3937, 3948), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (3945, 3948), False, 'from copy import deepcopy\n'), ((4578, 4589), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (4586, 4589), False, 'from copy import deepcopy\n'), ((4669, 4680), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (4677, 4680), False, 'from copy import deepcopy\n'), ((5366, 5377), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (5374, 5377), False, 'from copy import deepcopy\n'), ((5494, 5505), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (5502, 5505), False, 'from copy import deepcopy\n'), ((36569, 36590), 'types.ModuleType', 'types.ModuleType', (['"""m"""'], {}), "('m')\n", (36585, 36590), False, 'import types\n'), ((42442, 42462), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (42460, 42462), False, 'from test import support\n'), ((42676, 42696), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (42694, 42696), False, 'from test import support\n'), ((42947, 42967), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (42965, 42967), False, 'from test import support\n'), ((43235, 43255), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (43253, 43255), False, 'from test import support\n'), ((51403, 51435), 'xxsubtype.spamlist.classmeth', 'spam.spamlist.classmeth', (['*a'], {}), '(*a, **d)\n', (51426, 51435), True, 'import xxsubtype as spam\n'), ((53342, 53375), 'xxsubtype.spamlist.staticmeth', 'spam.spamlist.staticmeth', (['*a'], {}), '(*a, **d)\n', (53366, 53375), True, 'import xxsubtype as spam\n'), ((68143, 68157), 'weakref.ref', 'weakref.ref', (['c'], {}), '(c)\n', (68154, 68157), False, 'import weakref\n'), ((68213, 68233), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (68231, 68233), False, 'from test import support\n'), ((68677, 68693), 'weakref.ref', 'weakref.ref', (['yes'], {}), '(yes)\n', (68688, 68693), False, 'import weakref\n'), ((68753, 68773), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (68771, 68773), False, 'from test import support\n'), ((78047, 78053), 'types.ModuleType', 'M', (['"""m"""'], {}), "('m')\n", (78048, 78053), True, 'from types import ModuleType as M\n'), ((115435, 115455), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (115453, 115455), False, 'from test import support\n'), ((116945, 116958), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (116956, 116958), False, 'import io\n'), ((118041, 118061), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (118059, 118061), False, 'from test import support\n'), ((120455, 120466), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (120463, 120466), False, 'from copy import deepcopy\n'), ((120636, 120648), 'types.ModuleType.__new__', 'M.__new__', (['M'], {}), '(M)\n', (120645, 120648), True, 'from types import ModuleType as M\n'), ((123032, 123044), 'copy.copy', 'copy.copy', (['a'], {}), '(a)\n', (123041, 123044), False, 'import copy\n'), ((123134, 123150), 'copy.deepcopy', 'copy.deepcopy', (['a'], {}), '(a)\n', (123147, 123150), False, 'import copy\n'), ((125568, 125588), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (125586, 125588), False, 'from test import support\n'), ((126375, 126402), 'test.support.check_impl_detail', 'support.check_impl_detail', ([], {}), '()\n', (126400, 126402), False, 'from test import support\n'), ((141594, 141614), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (141612, 141614), False, 'from test import support\n'), ((152003, 152017), 'weakref.ref', 'weakref.ref', (['x'], {}), '(x)\n', (152014, 152017), False, 'import weakref\n'), ((152040, 152060), 'test.support.gc_collect', 'support.gc_collect', ([], {}), '()\n', (152058, 152060), False, 'from test import support\n'), ((152110, 152126), 'gc.get_objects', 'gc.get_objects', ([], {}), '()\n', (152124, 152126), False, 'import gc\n'), ((154876, 154908), 'types.MethodType', 'types.MethodType', (['func', 'instance'], {}), '(func, instance)\n', (154892, 154908), False, 'import types\n'), ((173066, 173113), 'itertools.product', 'itertools.product', (['test_classes', 'pickle_copiers'], {}), '(test_classes, pickle_copiers)\n', (173083, 173113), False, 'import itertools\n'), ((3410, 3421), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (3418, 3421), False, 'from copy import deepcopy\n'), ((4131, 4142), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (4139, 4142), False, 'from copy import deepcopy\n'), ((4884, 4895), 'copy.deepcopy', 'deepcopy', (['a'], {}), '(a)\n', (4892, 4895), False, 'from copy import deepcopy\n'), ((10525, 10541), 'xxsubtype.spamlist', 'spam.spamlist', (['l'], {}), '(l)\n', (10538, 10541), True, 'import xxsubtype as spam\n'), ((12479, 12494), 'xxsubtype.spamdict', 'spam.spamdict', ([], {}), '()\n', (12492, 12494), True, 'import xxsubtype as spam\n'), ((43996, 44029), 'test.support.captured_output', 'support.captured_output', (['"""stderr"""'], {}), "('stderr')\n", (44019, 44029), False, 'from test import support\n'), ((68393, 68408), 'weakref.ref', 'weakref.ref', (['no'], {}), '(no)\n', (68404, 68408), False, 'import weakref\n'), ((115918, 115937), 'binascii.b2a_hex', 'binascii.b2a_hex', (['m'], {}), '(m)\n', (115934, 115937), False, 'import binascii\n'), ((115939, 115961), 'binascii.b2a_hex', 'binascii.b2a_hex', (['base'], {}), '(base)\n', (115955, 115961), False, 'import binascii\n'), ((116054, 116073), 'binascii.b2a_hex', 'binascii.b2a_hex', (['m'], {}), '(m)\n', (116070, 116073), False, 'import binascii\n'), ((155489, 155503), 'sys.gettrace', 'sys.gettrace', ([], {}), '()\n', (155501, 155503), False, 'import sys\n'), ((155934, 155948), 'sys.gettrace', 'sys.gettrace', ([], {}), '()\n', (155946, 155948), False, 'import sys\n'), ((156283, 156297), 'sys.gettrace', 'sys.gettrace', ([], {}), '()\n', (156295, 156297), False, 'import sys\n'), ((175717, 175734), 'sys.getsizeof', 'sys.getsizeof', (['{}'], {}), '({})\n', (175730, 175734), False, 'import sys\n'), ((175989, 176006), 'sys.getsizeof', 'sys.getsizeof', (['{}'], {}), '({})\n', (176002, 176006), False, 'import sys\n'), ((176094, 176111), 'sys.getsizeof', 'sys.getsizeof', (['{}'], {}), '({})\n', (176107, 176111), False, 'import sys\n'), ((43539, 43555), 'gc.get_objects', 'gc.get_objects', ([], {}), '()\n', (43553, 43555), False, 'import gc\n'), ((43640, 43656), 'gc.get_objects', 'gc.get_objects', ([], {}), '()\n', (43654, 43656), False, 'import gc\n'), ((51563, 51578), 'xxsubtype.spamlist', 'spam.spamlist', ([], {}), '()\n', (51576, 51578), True, 'import xxsubtype as spam\n'), ((52244, 52259), 'xxsubtype.spamlist', 'spam.spamlist', ([], {}), '()\n', (52257, 52259), True, 'import xxsubtype as spam\n'), ((53494, 53509), 'xxsubtype.spamlist', 'spam.spamlist', ([], {}), '()\n', (53507, 53509), True, 'import xxsubtype as spam\n'), ((129246, 129272), 'builtins.__dict__.values', 'builtins.__dict__.values', ([], {}), '()\n', (129270, 129272), False, 'import builtins\n'), ((139938, 139960), 'weakref.ref', 'weakref.ref', (['referrent'], {}), '(referrent)\n', (139949, 139960), False, 'import weakref\n'), ((174182, 174195), 'copy.deepcopy', 'deepcopy', (['obj'], {}), '(obj)\n', (174190, 174195), False, 'from copy import deepcopy\n'), ((34666, 34693), 'test.support.check_impl_detail', 'support.check_impl_detail', ([], {}), '()\n', (34691, 34693), False, 'from test import support\n'), ((147774, 147786), 'gc.collect', 'gc.collect', ([], {}), '()\n', (147784, 147786), False, 'import gc\n'), ((174653, 174670), 'copy.deepcopy', 'deepcopy', (['objcopy'], {}), '(objcopy)\n', (174661, 174670), False, 'from copy import deepcopy\n')]
|
#!/usr/bin/env python
import os
import requests
import time
import sys
from . import github
from .utils import update_conda_forge_config
# https://circleci.com/docs/api#add-environment-variable
# curl -X POST --header "Content-Type: application/json" -d '{"name":"foo", "value":"bar"}'
# https://circleci.com/api/v1/project/:username/:project/envvar?circle-token=:token
try:
with open(os.path.expanduser("~/.conda-smithy/circle.token"), "r") as fh:
circle_token = fh.read().strip()
if not circle_token:
raise ValueError()
except (IOError, ValueError):
print(
"No circle token. Create a token at https://circleci.com/account/api and\n"
"put it in ~/.conda-smithy/circle.token"
)
try:
with open(os.path.expanduser("~/.conda-smithy/appveyor.token"), "r") as fh:
appveyor_token = fh.read().strip()
if not appveyor_token:
raise ValueError()
except (IOError, ValueError):
print(
"No appveyor token. Create a token at https://ci.appveyor.com/api-token and\n"
"Put one in ~/.conda-smithy/appveyor.token"
)
try:
anaconda_token = os.environ["BINSTAR_TOKEN"]
except KeyError:
try:
with open(
os.path.expanduser("~/.conda-smithy/anaconda.token"), "r"
) as fh:
anaconda_token = fh.read().strip()
if not anaconda_token:
raise ValueError()
except (IOError, ValueError):
print(
"No anaconda token. Create a token via\n"
' anaconda auth --create --name conda-smithy --scopes "repos conda api"\n'
"and put it in ~/.conda-smithy/anaconda.token"
)
travis_endpoint = "https://api.travis-ci.org"
def travis_headers():
headers = {
# If the user-agent isn't defined correctly, we will recieve a 403.
"User-Agent": "Travis/1.0",
"Accept": "application/json",
"Content-Type": "application/json",
"Travis-API-Version": "3",
}
travis_token = os.path.expanduser("~/.conda-smithy/travis.token")
try:
with open(travis_token, "r") as fh:
token = fh.read().strip()
if not token:
raise ValueError
except (IOError, ValueError):
# We generally want the V3 API, but can currently only auth with V2:
# https://github.com/travis-ci/travis-ci/issues/9273#issuecomment-370474214
v2_headers = headers.copy()
v2_headers["Accept"] = "application/vnd.travis-ci.2+json"
del v2_headers["Travis-API-Version"]
url = "{}/auth/github".format(travis_endpoint)
data = {"github_token": github.gh_token()}
response = requests.post(url, json=data, headers=v2_headers)
if response.status_code != 201:
response.raise_for_status()
token = response.json()["access_token"]
with open(travis_token, "w") as fh:
fh.write(token)
# TODO: Set the permissions on the file.
headers["Authorization"] = "token {}".format(token)
return headers
def add_token_to_circle(user, project):
url_template = (
"https://circleci.com/api/v1.1/project/github/{user}/{project}/envvar?"
"circle-token={token}"
)
url = url_template.format(token=circle_token, user=user, project=project)
data = {"name": "BINSTAR_TOKEN", "value": anaconda_token}
response = requests.post(url, data)
if response.status_code != 201:
raise ValueError(response)
def add_project_to_circle(user, project):
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
url_template = (
"https://circleci.com/api/v1.1/project/github/{component}?"
"circle-token={token}"
)
# Note, we used to check to see whether the project was already registered, but it started
# timing out once we had too many repos, so now the approach is simply "add it always".
url = url_template.format(
component="{}/{}/follow".format(user, project).lower(),
token=circle_token,
)
response = requests.post(url, headers={})
# It is a strange response code, but is doing what was asked...
if response.status_code != 400:
response.raise_for_status()
# Note, here we are using a non-public part of the API and may change
# Enable building PRs from forks
url = url_template.format(
component="{}/{}/settings".format(user, project).lower(),
token=circle_token,
)
# Disable CircleCI secrets in builds of forked PRs explicitly.
response = requests.put(
url,
headers=headers,
json={"feature_flags": {"forks-receive-secret-env-vars": False}},
)
if response.status_code != 200:
response.raise_for_status()
# Enable CircleCI builds on forked PRs.
response = requests.put(
url, headers=headers, json={"feature_flags": {"build-fork-prs": True}}
)
if response.status_code != 200:
response.raise_for_status()
print(" * {}/{} enabled on CircleCI".format(user, project))
def add_project_to_azure(user, project):
from . import azure_ci_utils
if azure_ci_utils.repo_registered(user, project):
print(
" * {}/{} already enabled on azure pipelines".format(user, project)
)
else:
azure_ci_utils.register_repo(user, project)
print(
" * {}/{} has been enabled on azure pipelines".format(
user, project
)
)
def add_project_to_appveyor(user, project):
headers = {"Authorization": "Bearer {}".format(appveyor_token)}
url = "https://ci.appveyor.com/api/projects"
response = requests.get(url, headers=headers)
if response.status_code != 201:
response.raise_for_status()
repos = [repo["repositoryName"].lower() for repo in response.json()]
if "{}/{}".format(user, project).lower() in repos:
print(" * {}/{} already enabled on appveyor".format(user, project))
else:
data = {
"repositoryProvider": "gitHub",
"repositoryName": "{}/{}".format(user, project),
}
response = requests.post(url, headers=headers, data=data)
if response.status_code != 201:
response.raise_for_status()
print(" * {}/{} has been enabled on appveyor".format(user, project))
def appveyor_encrypt_binstar_token(feedstock_directory, user, project):
headers = {"Authorization": "Bearer {}".format(appveyor_token)}
url = "https://ci.appveyor.com/api/account/encrypt"
response = requests.post(
url, headers=headers, data={"plainValue": anaconda_token}
)
if response.status_code != 200:
raise ValueError(response)
with update_conda_forge_config(feedstock_directory) as code:
code.setdefault("appveyor", {}).setdefault("secure", {})[
"BINSTAR_TOKEN"
] = response.content.decode("utf-8")
def appveyor_configure(user, project):
"""Configure appveyor so that it skips building if there is no appveyor.yml present."""
headers = {"Authorization": "Bearer {}".format(appveyor_token)}
# I have reasons to believe this is all AppVeyor is doing to the API URL.
if project.startswith("_"):
project = project[1:]
project = project.replace("_", "-").replace(".", "-")
url = "https://ci.appveyor.com/api/projects/{}/{}/settings".format(
user, project
)
response = requests.get(url, headers=headers)
if response.status_code != 200:
raise ValueError(response)
content = response.json()
settings = content["settings"]
for required_setting in (
u"skipBranchesWithoutAppveyorYml",
u"rollingBuildsOnlyForPullRequests",
u"rollingBuilds",
):
if not settings[required_setting]:
print(
"{: <30}: Current setting for {} = {}."
"".format(
project, required_setting, settings[required_setting]
)
)
settings[required_setting] = True
url = "https://ci.appveyor.com/api/projects"
response = requests.put(url, headers=headers, json=settings)
if response.status_code != 204:
raise ValueError(response)
def travis_wait_until_synced(ignore=False):
headers = travis_headers()
is_sync_url = "{}/user".format(travis_endpoint)
for _ in range(20):
response = requests.get(is_sync_url, headers=headers)
content = response.json()
print(".", end="")
sys.stdout.flush()
if "is_syncing" in content and content["is_syncing"] == False:
break
time.sleep(6)
else:
if ignore:
print(" * Travis is being synced by somebody else. Ignoring")
else:
raise RuntimeError("Syncing has not finished for two minutes now.")
print("")
return content
def travis_repo_writable(repo_info):
if "@permissions" not in repo_info:
return False
permissions = repo_info["@permissions"]
if "admin" not in permissions or not permissions["admin"]:
return False
return True
def travis_get_repo_info(user, project, show_error=False):
headers = travis_headers()
url = "{}/repo/{user}%2F{project}".format(
travis_endpoint, user=user, project=project
)
response = requests.get(url, headers=headers)
try:
response.raise_for_status()
content = response.json()
return content
except requests.HTTPError as e:
if show_error:
print(e)
return {}
def add_project_to_travis(user, project):
# Make sure the travis-ci user has accepted all invitations
if os.getenv("GH_TRAVIS_TOKEN"):
gh = github.Github(os.getenv("GH_TRAVIS_TOKEN"))
github.accept_all_repository_invitations(gh)
headers = travis_headers()
repo_info = travis_get_repo_info(user, project, show_error=False)
if not travis_repo_writable(repo_info):
# Travis needs syncing. Wait until other syncs are finished.
print(" * Travis: checking if there's a syncing already", end="")
sys.stdout.flush()
user_info = travis_wait_until_synced(ignore=True)
repo_info = travis_get_repo_info(user, project, show_error=False)
if not travis_repo_writable(repo_info):
if not repo_info:
print(
" * Travis doesn't know about the repo, syncing (takes a few seconds).",
end="",
)
else:
print(
" * Travis repo settings are not writable, syncing (takes a few seconds).",
end="",
)
sys.stdout.flush()
sync_url = "{}/user/{}/sync".format(
travis_endpoint, user_info["id"]
)
response = requests.post(sync_url, headers=headers)
if response.status_code != 409:
# 409 status code is for indicating that another synching might be happening at the
# same time. This can happen in conda-forge/staged-recipes when two master builds
# start at the same time
response.raise_for_status()
travis_wait_until_synced(ignore=False)
repo_info = travis_get_repo_info(user, project)
if not repo_info:
msg = (
"Unable to register the repo on Travis\n"
'(Is it down? Is the "{}/{}" name spelt correctly? [note: case sensitive])'
)
raise RuntimeError(msg.format(user, project))
if not travis_repo_writable(repo_info):
msg = "Access denied for the repo {}/{}"
raise RuntimeError(msg.format(user, project))
if repo_info["active"] is True:
print(" * {}/{} already enabled on travis-ci".format(user, project))
else:
repo_id = repo_info["id"]
url = "{}/repo/{}/activate".format(travis_endpoint, repo_id)
response = requests.post(url, headers=headers)
response.raise_for_status()
print(" * {}/{} registered on travis-ci".format(user, project))
def travis_token_update_conda_forge_config(feedstock_directory, user, project):
item = 'BINSTAR_TOKEN="{}"'.format(anaconda_token)
slug = "{}%2F{}".format(user, project)
with update_conda_forge_config(feedstock_directory) as code:
code.setdefault("travis", {}).setdefault("secure", {})[
"BINSTAR_TOKEN"
] = travis_encrypt_binstar_token(slug, item)
def travis_encrypt_binstar_token(repo, string_to_encrypt):
# Copyright 2014 <NAME> <<EMAIL>>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5
import base64
keyurl = "https://api.travis-ci.org/repo/{0}/key_pair/generated".format(
repo
)
r = requests.get(keyurl, headers=travis_headers())
r.raise_for_status()
public_key = r.json()["public_key"]
key = RSA.importKey(public_key)
cipher = PKCS1_v1_5.new(key)
return base64.b64encode(cipher.encrypt(string_to_encrypt.encode())).decode(
"utf-8"
)
def travis_configure(user, project):
"""Configure travis so that it skips building if there is no .travis.yml present."""
headers = travis_headers()
repo_info = travis_get_repo_info(user, project)
repo_id = repo_info["id"]
if repo_info["active"] is not True:
raise ValueError(
"Repo {user}/{project} is not active on Travis CI".format(
user=user, project=project
)
)
settings = [
("builds_only_with_travis_yml", True),
("auto_cancel_pull_requests", True),
]
for name, value in settings:
url = "{}/repo/{repo_id}/setting/{name}".format(
travis_endpoint, repo_id=repo_id, name=name
)
data = {"setting.value": value}
response = requests.patch(url, json=data, headers=headers)
if response.status_code != 204:
response.raise_for_status()
def travis_cleanup(org, project):
if os.getenv("GH_TRAVIS_TOKEN"):
gh = github.Github(os.getenv("GH_TRAVIS_TOKEN"))
github.remove_from_project(gh, org, project)
def get_conda_hook_info(hook_url, events):
payload = {
"name": "web",
"active": True,
"events": events,
"config": {"url": hook_url, "content_type": "json"},
}
return hook_url, payload
def add_conda_forge_webservice_hooks(user, repo):
if user != "conda-forge":
print(
"Unable to register {}/{} for conda-linting at this time as only "
"conda-forge repos are supported.".format(user, repo)
)
headers = {"Authorization": "token {}".format(github.gh_token())}
url = "https://api.github.com/repos/{}/{}/hooks".format(user, repo)
# Get the current hooks to determine if anything needs doing.
response = requests.get(url, headers=headers)
response.raise_for_status()
registered = response.json()
hook_by_url = {
hook["config"].get("url"): hook
for hook in registered
if "url" in hook["config"]
}
hooks = [
get_conda_hook_info(
"https://conda-forge.herokuapp.com/conda-linting/hook",
["pull_request"],
),
get_conda_hook_info(
"https://conda-forge.herokuapp.com/conda-forge-feedstocks/hook",
["push", "repository"],
),
get_conda_hook_info(
"https://conda-forge.herokuapp.com/conda-forge-teams/hook",
["push", "repository"],
),
get_conda_hook_info(
"https://conda-forge.herokuapp.com/conda-forge-command/hook",
[
"pull_request_review",
"pull_request",
"pull_request_review_comment",
"issue_comment",
"issues",
],
),
]
for hook in hooks:
hook_url, payload = hook
if hook_url not in hook_by_url:
response = requests.post(url, json=payload, headers=headers)
if response.status_code != 200:
response.raise_for_status()
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("user")
parser.add_argument("project")
args = parser.parse_args()
# add_project_to_circle(args.user, args.project)
# add_project_to_appveyor(args.user, args.project)
# add_project_to_travis(args.user, args.project)
# appveyor_encrypt_binstar_token('../udunits-delme-feedstock', args.user, args.project)
# appveyor_configure('conda-forge', 'glpk-feedstock')
# travis_token_update_conda_forge_config('../udunits-delme-feedstock', args.user, args.project)
add_conda_forge_webservice_hooks(args.user, args.project)
print("Done")
|
[
"Crypto.Cipher.PKCS1_v1_5.new",
"requests.patch",
"argparse.ArgumentParser",
"time.sleep",
"Crypto.PublicKey.RSA.importKey",
"sys.stdout.flush",
"requests.get",
"requests.put",
"requests.post",
"os.path.expanduser",
"os.getenv"
] |
[((1998, 2048), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.conda-smithy/travis.token"""'], {}), "('~/.conda-smithy/travis.token')\n", (2016, 2048), False, 'import os\n'), ((3369, 3393), 'requests.post', 'requests.post', (['url', 'data'], {}), '(url, data)\n', (3382, 3393), False, 'import requests\n'), ((4072, 4102), 'requests.post', 'requests.post', (['url'], {'headers': '{}'}), '(url, headers={})\n', (4085, 4102), False, 'import requests\n'), ((4568, 4673), 'requests.put', 'requests.put', (['url'], {'headers': 'headers', 'json': "{'feature_flags': {'forks-receive-secret-env-vars': False}}"}), "(url, headers=headers, json={'feature_flags': {\n 'forks-receive-secret-env-vars': False}})\n", (4580, 4673), False, 'import requests\n'), ((4831, 4919), 'requests.put', 'requests.put', (['url'], {'headers': 'headers', 'json': "{'feature_flags': {'build-fork-prs': True}}"}), "(url, headers=headers, json={'feature_flags': {'build-fork-prs':\n True}})\n", (4843, 4919), False, 'import requests\n'), ((5680, 5714), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (5692, 5714), False, 'import requests\n'), ((6570, 6642), 'requests.post', 'requests.post', (['url'], {'headers': 'headers', 'data': "{'plainValue': anaconda_token}"}), "(url, headers=headers, data={'plainValue': anaconda_token})\n", (6583, 6642), False, 'import requests\n'), ((7447, 7481), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (7459, 7481), False, 'import requests\n'), ((8127, 8176), 'requests.put', 'requests.put', (['url'], {'headers': 'headers', 'json': 'settings'}), '(url, headers=headers, json=settings)\n', (8139, 8176), False, 'import requests\n'), ((9348, 9382), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (9360, 9382), False, 'import requests\n'), ((9694, 9722), 'os.getenv', 'os.getenv', (['"""GH_TRAVIS_TOKEN"""'], {}), "('GH_TRAVIS_TOKEN')\n", (9703, 9722), False, 'import os\n'), ((13597, 13622), 'Crypto.PublicKey.RSA.importKey', 'RSA.importKey', (['public_key'], {}), '(public_key)\n', (13610, 13622), False, 'from Crypto.PublicKey import RSA\n'), ((13636, 13655), 'Crypto.Cipher.PKCS1_v1_5.new', 'PKCS1_v1_5.new', (['key'], {}), '(key)\n', (13650, 13655), False, 'from Crypto.Cipher import PKCS1_v1_5\n'), ((14707, 14735), 'os.getenv', 'os.getenv', (['"""GH_TRAVIS_TOKEN"""'], {}), "('GH_TRAVIS_TOKEN')\n", (14716, 14735), False, 'import os\n'), ((15555, 15589), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (15567, 15589), False, 'import requests\n'), ((16888, 16913), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (16911, 16913), False, 'import argparse\n'), ((6153, 6199), 'requests.post', 'requests.post', (['url'], {'headers': 'headers', 'data': 'data'}), '(url, headers=headers, data=data)\n', (6166, 6199), False, 'import requests\n'), ((8420, 8462), 'requests.get', 'requests.get', (['is_sync_url'], {'headers': 'headers'}), '(is_sync_url, headers=headers)\n', (8432, 8462), False, 'import requests\n'), ((8532, 8550), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (8548, 8550), False, 'import sys\n'), ((8648, 8661), 'time.sleep', 'time.sleep', (['(6)'], {}), '(6)\n', (8658, 8661), False, 'import time\n'), ((10132, 10150), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (10148, 10150), False, 'import sys\n'), ((11990, 12025), 'requests.post', 'requests.post', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (12003, 12025), False, 'import requests\n'), ((14536, 14583), 'requests.patch', 'requests.patch', (['url'], {'json': 'data', 'headers': 'headers'}), '(url, json=data, headers=headers)\n', (14550, 14583), False, 'import requests\n'), ((394, 444), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.conda-smithy/circle.token"""'], {}), "('~/.conda-smithy/circle.token')\n", (412, 444), False, 'import os\n'), ((752, 804), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.conda-smithy/appveyor.token"""'], {}), "('~/.conda-smithy/appveyor.token')\n", (770, 804), False, 'import os\n'), ((2659, 2708), 'requests.post', 'requests.post', (['url'], {'json': 'data', 'headers': 'v2_headers'}), '(url, json=data, headers=v2_headers)\n', (2672, 2708), False, 'import requests\n'), ((9751, 9779), 'os.getenv', 'os.getenv', (['"""GH_TRAVIS_TOKEN"""'], {}), "('GH_TRAVIS_TOKEN')\n", (9760, 9779), False, 'import os\n'), ((10718, 10736), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (10734, 10736), False, 'import sys\n'), ((10872, 10912), 'requests.post', 'requests.post', (['sync_url'], {'headers': 'headers'}), '(sync_url, headers=headers)\n', (10885, 10912), False, 'import requests\n'), ((14764, 14792), 'os.getenv', 'os.getenv', (['"""GH_TRAVIS_TOKEN"""'], {}), "('GH_TRAVIS_TOKEN')\n", (14773, 14792), False, 'import os\n'), ((16687, 16736), 'requests.post', 'requests.post', (['url'], {'json': 'payload', 'headers': 'headers'}), '(url, json=payload, headers=headers)\n', (16700, 16736), False, 'import requests\n'), ((1213, 1265), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.conda-smithy/anaconda.token"""'], {}), "('~/.conda-smithy/anaconda.token')\n", (1231, 1265), False, 'import os\n')]
|
from urlparse import urlparse
import os
from flask import Blueprint, request, redirect, session
from flask_login import logout_user
from onelogin.saml2.auth import OneLogin_Saml2_Auth
from onelogin.saml2.utils import OneLogin_Saml2_Utils
from web.views.helpers import prevent_csrf
from web.auth.saml.user_management import authenticate
auth = Blueprint('auth', __name__, template_folder='templates')
def init_saml_auth(req):
saml_auth = OneLogin_Saml2_Auth(req, custom_base_path=os.path.join(os.path.dirname(os.path.dirname(__file__)), 'saml/config'))
return saml_auth
def prepare_auth_request(request):
url_data = urlparse(request.url)
return {
"https": 'on',
'http_host': request.host,
'server_port': url_data.port,
'script_name': request.path,
'get_data': request.args.copy(),
'post_data': request.form.copy(),
# Uncomment if using ADFS as IdP, https://github.com/onelogin/python-saml/pull/144
# 'lowercase_urlencoding': True,
'query_string': request.query_string
}
@auth.route('/saml/acs', methods=['GET', 'POST'])
def acs():
req = prepare_auth_request(request)
saml_auth = init_saml_auth(req)
saml_auth.process_response()
errors = saml_auth.get_errors()
if len(errors) == 0: # No errors, let's authenticate the user
session['samlUserdata'] = saml_auth.get_attributes()
session['samlNameId'] = saml_auth.get_nameid()
session['samlSessionIndex'] = saml_auth.get_session_index()
authenticate(session)
self_url = OneLogin_Saml2_Utils.get_self_url(req)
if 'RelayState' in request.form and self_url != request.form['RelayState']:
return redirect(saml_auth.redirect_to(request.form['RelayState']))
@auth.route('/login', methods=['GET', 'POST'])
@prevent_csrf
def login():
req = prepare_auth_request(request)
saml_auth = init_saml_auth(req)
redir = request.args.get('next', '/')
if "/login" in redir:
redir = '/'
return redirect(saml_auth.login(redir))
@auth.route('/logout')
def logout():
req = prepare_auth_request(request)
saml_auth = init_saml_auth(req)
logout_user()
return redirect(saml_auth.logout(name_id=session['samlNameId'], session_index=session['samlSessionIndex']))
|
[
"flask.Blueprint",
"flask.request.args.get",
"os.path.dirname",
"web.auth.saml.user_management.authenticate",
"flask_login.logout_user",
"flask.request.form.copy",
"urlparse.urlparse",
"onelogin.saml2.utils.OneLogin_Saml2_Utils.get_self_url",
"flask.request.args.copy"
] |
[((347, 403), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {'template_folder': '"""templates"""'}), "('auth', __name__, template_folder='templates')\n", (356, 403), False, 'from flask import Blueprint, request, redirect, session\n'), ((635, 656), 'urlparse.urlparse', 'urlparse', (['request.url'], {}), '(request.url)\n', (643, 656), False, 'from urlparse import urlparse\n'), ((1946, 1975), 'flask.request.args.get', 'request.args.get', (['"""next"""', '"""/"""'], {}), "('next', '/')\n", (1962, 1975), False, 'from flask import Blueprint, request, redirect, session\n'), ((2187, 2200), 'flask_login.logout_user', 'logout_user', ([], {}), '()\n', (2198, 2200), False, 'from flask_login import logout_user\n'), ((823, 842), 'flask.request.args.copy', 'request.args.copy', ([], {}), '()\n', (840, 842), False, 'from flask import Blueprint, request, redirect, session\n'), ((865, 884), 'flask.request.form.copy', 'request.form.copy', ([], {}), '()\n', (882, 884), False, 'from flask import Blueprint, request, redirect, session\n'), ((1537, 1558), 'web.auth.saml.user_management.authenticate', 'authenticate', (['session'], {}), '(session)\n', (1549, 1558), False, 'from web.auth.saml.user_management import authenticate\n'), ((1578, 1616), 'onelogin.saml2.utils.OneLogin_Saml2_Utils.get_self_url', 'OneLogin_Saml2_Utils.get_self_url', (['req'], {}), '(req)\n', (1611, 1616), False, 'from onelogin.saml2.utils import OneLogin_Saml2_Utils\n'), ((518, 543), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (533, 543), False, 'import os\n')]
|
import random
import time
from copy import deepcopy
import gym
import networkx as nx
import numpy as np
from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple
class MyTestEnv(gym.Env):
"""This is a "going right" task. The task is to go right ``size`` steps.
"""
def __init__(
self,
size,
sleep=0,
dict_state=False,
recurse_state=False,
ma_rew=0,
multidiscrete_action=False,
random_sleep=False,
array_state=False
):
assert dict_state + recurse_state + array_state <= 1, \
"dict_state / recurse_state / array_state can be only one true"
self.size = size
self.sleep = sleep
self.random_sleep = random_sleep
self.dict_state = dict_state
self.recurse_state = recurse_state
self.array_state = array_state
self.ma_rew = ma_rew
self._md_action = multidiscrete_action
# how many steps this env has stepped
self.steps = 0
if dict_state:
self.observation_space = Dict(
{
"index": Box(shape=(1, ), low=0, high=size - 1),
"rand": Box(shape=(1, ), low=0, high=1, dtype=np.float64)
}
)
elif recurse_state:
self.observation_space = Dict(
{
"index":
Box(shape=(1, ), low=0, high=size - 1),
"dict":
Dict(
{
"tuple":
Tuple(
(
Discrete(2),
Box(shape=(2, ), low=0, high=1, dtype=np.float64)
)
),
"rand":
Box(shape=(1, 2), low=0, high=1, dtype=np.float64)
}
)
}
)
elif array_state:
self.observation_space = Box(shape=(4, 84, 84), low=0, high=255)
else:
self.observation_space = Box(shape=(1, ), low=0, high=size - 1)
if multidiscrete_action:
self.action_space = MultiDiscrete([2, 2])
else:
self.action_space = Discrete(2)
self.done = False
self.index = 0
self.seed()
def seed(self, seed=0):
self.rng = np.random.RandomState(seed)
return [seed]
def reset(self, state=0):
self.done = False
self.do_sleep()
self.index = state
return self._get_state()
def _get_reward(self):
"""Generate a non-scalar reward if ma_rew is True."""
end_flag = int(self.done)
if self.ma_rew > 0:
return [end_flag] * self.ma_rew
return end_flag
def _get_state(self):
"""Generate state(observation) of MyTestEnv"""
if self.dict_state:
return {
'index': np.array([self.index], dtype=np.float32),
'rand': self.rng.rand(1)
}
elif self.recurse_state:
return {
'index': np.array([self.index], dtype=np.float32),
'dict': {
"tuple": (np.array([1], dtype=int), self.rng.rand(2)),
"rand": self.rng.rand(1, 2)
}
}
elif self.array_state:
img = np.zeros([4, 84, 84], int)
img[3, np.arange(84), np.arange(84)] = self.index
img[2, np.arange(84)] = self.index
img[1, :, np.arange(84)] = self.index
img[0] = self.index
return img
else:
return np.array([self.index], dtype=np.float32)
def do_sleep(self):
if self.sleep > 0:
sleep_time = random.random() if self.random_sleep else 1
sleep_time *= self.sleep
time.sleep(sleep_time)
def step(self, action):
self.steps += 1
if self._md_action:
action = action[0]
if self.done:
raise ValueError('step after done !!!')
self.do_sleep()
if self.index == self.size:
self.done = True
return self._get_state(), self._get_reward(), self.done, {}
if action == 0:
self.index = max(self.index - 1, 0)
return self._get_state(), self._get_reward(), self.done, \
{'key': 1, 'env': self} if self.dict_state else {}
elif action == 1:
self.index += 1
self.done = self.index == self.size
return self._get_state(), self._get_reward(), \
self.done, {'key': 1, 'env': self}
class NXEnv(gym.Env):
def __init__(self, size, obs_type, feat_dim=32):
self.size = size
self.feat_dim = feat_dim
self.graph = nx.Graph()
self.graph.add_nodes_from(list(range(size)))
assert obs_type in ["array", "object"]
self.obs_type = obs_type
def _encode_obs(self):
if self.obs_type == "array":
return np.stack([v["data"] for v in self.graph._node.values()])
return deepcopy(self.graph)
def reset(self):
graph_state = np.random.rand(self.size, self.feat_dim)
for i in range(self.size):
self.graph.nodes[i]["data"] = graph_state[i]
return self._encode_obs()
def step(self, action):
next_graph_state = np.random.rand(self.size, self.feat_dim)
for i in range(self.size):
self.graph.nodes[i]["data"] = next_graph_state[i]
return self._encode_obs(), 1.0, 0, {}
|
[
"copy.deepcopy",
"gym.spaces.Discrete",
"numpy.zeros",
"numpy.random.RandomState",
"gym.spaces.MultiDiscrete",
"time.sleep",
"random.random",
"networkx.Graph",
"numpy.array",
"gym.spaces.Box",
"numpy.arange",
"numpy.random.rand"
] |
[((2491, 2518), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (2512, 2518), True, 'import numpy as np\n'), ((4941, 4951), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (4949, 4951), True, 'import networkx as nx\n'), ((5241, 5261), 'copy.deepcopy', 'deepcopy', (['self.graph'], {}), '(self.graph)\n', (5249, 5261), False, 'from copy import deepcopy\n'), ((5306, 5346), 'numpy.random.rand', 'np.random.rand', (['self.size', 'self.feat_dim'], {}), '(self.size, self.feat_dim)\n', (5320, 5346), True, 'import numpy as np\n'), ((5529, 5569), 'numpy.random.rand', 'np.random.rand', (['self.size', 'self.feat_dim'], {}), '(self.size, self.feat_dim)\n', (5543, 5569), True, 'import numpy as np\n'), ((2294, 2315), 'gym.spaces.MultiDiscrete', 'MultiDiscrete', (['[2, 2]'], {}), '([2, 2])\n', (2307, 2315), False, 'from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple\n'), ((2362, 2373), 'gym.spaces.Discrete', 'Discrete', (['(2)'], {}), '(2)\n', (2370, 2373), False, 'from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple\n'), ((3991, 4013), 'time.sleep', 'time.sleep', (['sleep_time'], {}), '(sleep_time)\n', (4001, 4013), False, 'import time\n'), ((3058, 3098), 'numpy.array', 'np.array', (['[self.index]'], {'dtype': 'np.float32'}), '([self.index], dtype=np.float32)\n', (3066, 3098), True, 'import numpy as np\n'), ((3898, 3913), 'random.random', 'random.random', ([], {}), '()\n', (3911, 3913), False, 'import random\n'), ((1127, 1164), 'gym.spaces.Box', 'Box', ([], {'shape': '(1,)', 'low': '(0)', 'high': '(size - 1)'}), '(shape=(1,), low=0, high=size - 1)\n', (1130, 1164), False, 'from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple\n'), ((1195, 1243), 'gym.spaces.Box', 'Box', ([], {'shape': '(1,)', 'low': '(0)', 'high': '(1)', 'dtype': 'np.float64'}), '(shape=(1,), low=0, high=1, dtype=np.float64)\n', (1198, 1243), False, 'from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple\n'), ((2099, 2138), 'gym.spaces.Box', 'Box', ([], {'shape': '(4, 84, 84)', 'low': '(0)', 'high': '(255)'}), '(shape=(4, 84, 84), low=0, high=255)\n', (2102, 2138), False, 'from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple\n'), ((2190, 2227), 'gym.spaces.Box', 'Box', ([], {'shape': '(1,)', 'low': '(0)', 'high': '(size - 1)'}), '(shape=(1,), low=0, high=size - 1)\n', (2193, 2227), False, 'from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple\n'), ((3234, 3274), 'numpy.array', 'np.array', (['[self.index]'], {'dtype': 'np.float32'}), '([self.index], dtype=np.float32)\n', (3242, 3274), True, 'import numpy as np\n'), ((3506, 3532), 'numpy.zeros', 'np.zeros', (['[4, 84, 84]', 'int'], {}), '([4, 84, 84], int)\n', (3514, 3532), True, 'import numpy as np\n'), ((3780, 3820), 'numpy.array', 'np.array', (['[self.index]'], {'dtype': 'np.float32'}), '([self.index], dtype=np.float32)\n', (3788, 3820), True, 'import numpy as np\n'), ((1415, 1452), 'gym.spaces.Box', 'Box', ([], {'shape': '(1,)', 'low': '(0)', 'high': '(size - 1)'}), '(shape=(1,), low=0, high=size - 1)\n', (1418, 1452), False, 'from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple\n'), ((3332, 3356), 'numpy.array', 'np.array', (['[1]'], {'dtype': 'int'}), '([1], dtype=int)\n', (3340, 3356), True, 'import numpy as np\n'), ((3552, 3565), 'numpy.arange', 'np.arange', (['(84)'], {}), '(84)\n', (3561, 3565), True, 'import numpy as np\n'), ((3567, 3580), 'numpy.arange', 'np.arange', (['(84)'], {}), '(84)\n', (3576, 3580), True, 'import numpy as np\n'), ((3614, 3627), 'numpy.arange', 'np.arange', (['(84)'], {}), '(84)\n', (3623, 3627), True, 'import numpy as np\n'), ((3664, 3677), 'numpy.arange', 'np.arange', (['(84)'], {}), '(84)\n', (3673, 3677), True, 'import numpy as np\n'), ((1905, 1955), 'gym.spaces.Box', 'Box', ([], {'shape': '(1, 2)', 'low': '(0)', 'high': '(1)', 'dtype': 'np.float64'}), '(shape=(1, 2), low=0, high=1, dtype=np.float64)\n', (1908, 1955), False, 'from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple\n'), ((1677, 1688), 'gym.spaces.Discrete', 'Discrete', (['(2)'], {}), '(2)\n', (1685, 1688), False, 'from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple\n'), ((1726, 1774), 'gym.spaces.Box', 'Box', ([], {'shape': '(2,)', 'low': '(0)', 'high': '(1)', 'dtype': 'np.float64'}), '(shape=(2,), low=0, high=1, dtype=np.float64)\n', (1729, 1774), False, 'from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple\n')]
|
#! /usr/bin/env python3
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
from itertools import chain
from thrift_compiler import frontend
autogen_comment = '''Autogenerated by Thrift
DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
@''' 'generated'
class Generator(object):
'''
Base class for a thrift code generator. This class defines the basic
routines for code generation and contains the top level method that
dispatches code generation across various components.
'''
def __init__(self, program, out_path, flags):
assert(isinstance(program, frontend.t_program))
self._program = program
self._out_path = out_path
self._flags = flags
self._tmp = 0
if len(self._out_path) > 0:
if self._out_path[-1] in {"/", "\\"}:
self._out_path += "/"
def _flag(self, flag):
ret = self._flags.get(flag)
return ret if ret != '' else True
#Shorthand
def __getattr__(self, item):
# Only get the attributes that start with flag
if item.startswith('flag_'):
return self._flag(item[5:])
raise AttributeError("No such attribute '{0}' inside this t_generator"
.format(item))
def tmp(self, name):
'''
Creates a unique temporary variable name, which is just "name" with a
number appended to it (i.e. name35)
'''
txt = name + str(self._tmp)
self._tmp += 1
return txt
@property
def _autogen_comment(self):
return self._generate_comment(autogen_comment)
def generate_program(self):
'''
Top level program generation function. Calls the generator subclass methods
for preparing file streams etc. then iterates over all the parts of the
program to perform the correct actions.
@param program The thrift program to compile into C++ source
'''
self.init_generator()
# Generate them all by passing each object to self._generate
program = self.program
for item in chain(program.enums, program.typedefs, \
program.objects, program.services):
self._generate(item)
self._generate_consts(program.consts)
self.close_generator()
def init_generator(self):
raise NotImplementedError
def close_generator(self):
raise NotImplementedError
@property
def program(self):
return self._program
def _generate_consts(self, constants):
raise NotImplementedError
def _generate_fatal(self, program):
pass
def _generate(self, what):
'''
Generate some object
Switch on the type of what to decide what to generate
'''
raise NotImplementedError
def _generate_comment(self, text):
raise NotImplementedError
class GeneratorFactory:
'''
A factory for producing generator classes of a particular language.
An instance of this class is responsible for:
- Registering itself with the generator registry.
- Providing documentation for the generators it produces.
'''
def __init__(self, generator_class):
self._short_name = generator_class.short_name
self._long_name = generator_class.long_name
self._doc = generator_class.__doc__
self._supported_flags = generator_class.supported_flags
self._generator_class = generator_class
# register the generator
global registry
registry.register_generator(self)
@property
def short_name(self):
return self._short_name
@property
def long_name(self):
return self._long_name
@property
def documentation(self):
return self._doc
@property
def supported_flags(self):
return self._supported_flags
def get_generator(self, program, out_path, flags):
'Instantiate the generator_class using these parameters'
return self._generator_class(program, out_path, flags)
class GeneratorRegistry:
def __init__(self):
# str -> t_generator_factory
self.generator_factory_map = {}
self.reference = {}
def register_generator(self, factory):
gfmap = self.generator_factory_map
if factory.short_name in gfmap:
raise Exception('Duplicate generators for language "{0}"'.format(
factory.short_name
))
# Add it to the reference. This is used for autogenerating help
# messages
self.reference[factory.short_name] = dict(
long=factory.long_name,
options=factory.supported_flags
)
# add it to the map
gfmap[factory.short_name] = factory
def get_generator(self, program, out_path, language, flags):
gfmap = self.generator_factory_map
generator_factory = None
try:
generator_factory = gfmap[language]
except KeyError:
raise Exception('t_generator_registry: could not get_generator '
'for language {0}'.format(language))
return generator_factory.get_generator(program, out_path, flags)
# global
registry = GeneratorRegistry()
|
[
"itertools.chain"
] |
[((2834, 2907), 'itertools.chain', 'chain', (['program.enums', 'program.typedefs', 'program.objects', 'program.services'], {}), '(program.enums, program.typedefs, program.objects, program.services)\n', (2839, 2907), False, 'from itertools import chain\n')]
|
from django.contrib import admin
from .models import Task
@admin.register(Task)
class TaskAdmin(admin.ModelAdmin):
pass
|
[
"django.contrib.admin.register"
] |
[((62, 82), 'django.contrib.admin.register', 'admin.register', (['Task'], {}), '(Task)\n', (76, 82), False, 'from django.contrib import admin\n')]
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# "Fuzzing with Generators" - a chapter of "The Fuzzing Book"
# Web site: https://www.fuzzingbook.org/html/GeneratorGrammarFuzzer.html
# Last change: 2022-02-09 08:27:19+01:00
#
# Copyright (c) 2021 CISPA Helmholtz Center for Information Security
# Copyright (c) 2018-2020 Saarland University, authors, and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
r'''
The Fuzzing Book - Fuzzing with Generators
This file can be _executed_ as a script, running all experiments:
$ python GeneratorGrammarFuzzer.py
or _imported_ as a package, providing classes, functions, and constants:
>>> from fuzzingbook.GeneratorGrammarFuzzer import <identifier>
but before you do so, _read_ it and _interact_ with it at:
https://www.fuzzingbook.org/html/GeneratorGrammarFuzzer.html
This chapter introduces the ability to attach _functions_ to individual production rules:
* A `pre` function is executed _before_ the expansion takes place. Its result (typically a string) can _replace_ the actual expansion.
* A `post` function is executed _after_ the expansion has taken place. If it returns a string, the string replaces the expansion; it it returns `False`, it triggers a new expansion.
Both functions can return `None` to not interfere with grammar production at all.
To attach a function `F` to an individual expansion `S` in a grammar, replace `S` with a pair
(S, opts(pre=F)) # Set a function to be executed before expansion
or
(S, opts(post=F)) # Set a function to be executed after expansion
Here is an example, To take an area code from a list that is given programmatically, we can write:
>>> from Grammars import US_PHONE_GRAMMAR, extend_grammar, opts
>>> def pick_area_code():
>>> return random.choice(['555', '554', '553'])
>>> PICKED_US_PHONE_GRAMMAR = extend_grammar(US_PHONE_GRAMMAR,
>>> {
>>> "": [("", opts(pre=pick_area_code))]
>>> })
A `GeneratorGrammarFuzzer` will extract and interpret these options. Here is an example:
>>> picked_us_phone_fuzzer = GeneratorGrammarFuzzer(PICKED_US_PHONE_GRAMMAR)
>>> [picked_us_phone_fuzzer.fuzz() for i in range(5)]
['(553)200-6118',
'(553)889-0205',
'(555)317-0936',
'(553)455-2577',
'(553)263-8511']
As you can see, the area codes now all stem from `pick_area_code()`. Such definitions allow to closely tie program code (such as `pick_area_code()`) to grammars.
The `PGGCFuzzer` class incorporates all features from [the `GrammarFuzzer` class](GrammarFuzzer.ipynb) and its [coverage-based](GrammarCoverageFuzzer.ipynb), [probabilistic-based](ProbabilisticGrammarFuzzer.ipynb), and [generator-based](GeneratorGrammarFuzzer.ipynb) derivatives.
For more details, source, and documentation, see
"The Fuzzing Book - Fuzzing with Generators"
at https://www.fuzzingbook.org/html/GeneratorGrammarFuzzer.html
'''
# Allow to use 'from . import <module>' when run as script (cf. PEP 366)
if __name__ == '__main__' and __package__ is None:
__package__ = 'fuzzingbook'
# Fuzzing with Generators
# =======================
if __name__ == '__main__':
print('# Fuzzing with Generators')
if __name__ == '__main__':
from .bookutils import YouTubeVideo
YouTubeVideo('oeMxtboPD_s')
## Synopsis
## --------
if __name__ == '__main__':
print('\n## Synopsis')
## Example: Test a Credit Card System
## ----------------------------------
if __name__ == '__main__':
print('\n## Example: Test a Credit Card System')
if __name__ == '__main__':
# We use the same fixed seed as the notebook to ensure consistency
import random
random.seed(2001)
from typing import Callable, Set, List, Dict, Optional, Iterator, Any, Union, Tuple, cast
from .Fuzzer import Fuzzer
from .Grammars import EXPR_GRAMMAR, is_valid_grammar, is_nonterminal, extend_grammar
from .Grammars import opts, exp_opt, exp_string, crange, Grammar, Expansion
from .GrammarFuzzer import DerivationTree
CHARGE_GRAMMAR: Grammar = {
"<start>": ["Charge <amount> to my credit card <credit-card-number>"],
"<amount>": ["$<float>"],
"<float>": ["<integer>.<digit><digit>"],
"<integer>": ["<digit>", "<integer><digit>"],
"<digit>": crange('0', '9'),
"<credit-card-number>": ["<digits>"],
"<digits>": ["<digit-block><digit-block><digit-block><digit-block>"],
"<digit-block>": ["<digit><digit><digit><digit>"],
}
if __name__ == '__main__':
assert is_valid_grammar(CHARGE_GRAMMAR)
from .GrammarFuzzer import GrammarFuzzer, all_terminals
if __name__ == '__main__':
g = GrammarFuzzer(CHARGE_GRAMMAR)
[g.fuzz() for i in range(5)]
## Attaching Functions to Expansions
## ---------------------------------
if __name__ == '__main__':
print('\n## Attaching Functions to Expansions')
### Functions Called Before Expansion
if __name__ == '__main__':
print('\n### Functions Called Before Expansion')
import random
def high_charge() -> float:
return random.randint(10000000, 90000000) / 100.0
CHARGE_GRAMMAR.update({
"<float>": [("<integer>.<digit><digit>", opts(pre=high_charge))],
})
def apply_twice(function, x):
return function(function(x))
if __name__ == '__main__':
apply_twice(lambda x: x * x, 2)
CHARGE_GRAMMAR.update({
"<float>": [("<integer>.<digit><digit>",
opts(pre=lambda: random.randint(10000000, 90000000) / 100.0))]
})
### Functions Called After Expansion
if __name__ == '__main__':
print('\n### Functions Called After Expansion')
CHARGE_GRAMMAR.update({
"<credit-card-number>": [("<digits>", opts(post=lambda digits: check_credit_card(digits)))]
})
CHARGE_GRAMMAR.update({
"<credit-card-number>": [("<digits>", opts(post=lambda digits: fix_credit_card(digits)))]
})
def luhn_checksum(s: str) -> int:
"""Compute Luhn's check digit over a string of digits"""
LUHN_ODD_LOOKUP = (0, 2, 4, 6, 8, 1, 3, 5, 7,
9) # sum_of_digits (index * 2)
evens = sum(int(p) for p in s[-1::-2])
odds = sum(LUHN_ODD_LOOKUP[int(p)] for p in s[-2::-2])
return (evens + odds) % 10
def valid_luhn_checksum(s: str) -> bool:
"""Check whether the last digit is Luhn's checksum over the earlier digits"""
return luhn_checksum(s[:-1]) == int(s[-1])
def fix_luhn_checksum(s: str) -> str:
"""Return the given string of digits, with a fixed check digit"""
return s[:-1] + repr(luhn_checksum(s[:-1]))
if __name__ == '__main__':
luhn_checksum("123")
if __name__ == '__main__':
fix_luhn_checksum("123x")
if __name__ == '__main__':
check_credit_card: Callable[[str], bool] = valid_luhn_checksum
fix_credit_card: Callable[[str], str] = fix_luhn_checksum
if __name__ == '__main__':
fix_credit_card("1234567890123456")
## A Class for Integrating Constraints
## -----------------------------------
if __name__ == '__main__':
print('\n## A Class for Integrating Constraints')
if __name__ == '__main__':
g = GrammarFuzzer(CHARGE_GRAMMAR)
g.fuzz()
class GeneratorGrammarFuzzer(GrammarFuzzer):
def supported_opts(self) -> Set[str]:
return super().supported_opts() | {"pre", "post", "order"}
def exp_pre_expansion_function(expansion: Expansion) -> Optional[Callable]:
"""Return the specified pre-expansion function, or None if unspecified"""
return exp_opt(expansion, 'pre')
def exp_post_expansion_function(expansion: Expansion) -> Optional[Callable]:
"""Return the specified post-expansion function, or None if unspecified"""
return exp_opt(expansion, 'post')
## Generating Elements before Expansion
## ------------------------------------
if __name__ == '__main__':
print('\n## Generating Elements before Expansion')
import inspect
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
def process_chosen_children(self, children: List[DerivationTree],
expansion: Expansion) -> List[DerivationTree]:
function = exp_pre_expansion_function(expansion)
if function is None:
return children
assert callable(function)
if inspect.isgeneratorfunction(function):
# See "generators", below
result = self.run_generator(expansion, function)
else:
result = function()
if self.log:
print(repr(function) + "()", "=", repr(result))
return self.apply_result(result, children)
def run_generator(self, expansion: Expansion, function: Callable):
...
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
def apply_result(self, result: Any,
children: List[DerivationTree]) -> List[DerivationTree]:
if isinstance(result, str):
children = [(result, [])]
elif isinstance(result, list):
symbol_indexes = [i for i, c in enumerate(children)
if is_nonterminal(c[0])]
for index, value in enumerate(result):
if value is not None:
child_index = symbol_indexes[index]
if not isinstance(value, str):
value = repr(value)
if self.log:
print(
"Replacing", all_terminals(
children[child_index]), "by", value)
# children[child_index] = (value, [])
child_symbol, _ = children[child_index]
children[child_index] = (child_symbol, [(value, [])])
elif result is None:
pass
elif isinstance(result, bool):
pass
else:
if self.log:
print("Replacing", "".join(
[all_terminals(c) for c in children]), "by", result)
children = [(repr(result), [])]
return children
### Example: Numeric Ranges
if __name__ == '__main__':
print('\n### Example: Numeric Ranges')
if __name__ == '__main__':
charge_fuzzer = GeneratorGrammarFuzzer(CHARGE_GRAMMAR)
charge_fuzzer.fuzz()
if __name__ == '__main__':
amount_fuzzer = GeneratorGrammarFuzzer(
CHARGE_GRAMMAR, start_symbol="<amount>", log=True)
amount_fuzzer.fuzz()
### Example: More Numeric Ranges
if __name__ == '__main__':
print('\n### Example: More Numeric Ranges')
if __name__ == '__main__':
expr_100_200_grammar = extend_grammar(EXPR_GRAMMAR,
{
"<factor>": [
"+<factor>", "-<factor>", "(<expr>)",
# Generate only the integer part with a function;
# the fractional part comes from
# the grammar
("<integer>.<integer>", opts(
pre=lambda: [random.randint(100, 200), None])),
# Generate the entire integer
# from the function
("<integer>", opts(
pre=lambda: random.randint(100, 200))),
],
}
)
if __name__ == '__main__':
expr_100_200_fuzzer = GeneratorGrammarFuzzer(expr_100_200_grammar)
expr_100_200_fuzzer.fuzz()
### Support for Python Generators
if __name__ == '__main__':
print('\n### Support for Python Generators')
def iterate():
t = 0
while True:
t = t + 1
yield t
if __name__ == '__main__':
for i in iterate():
if i > 10:
break
print(i, end=" ")
if __name__ == '__main__':
iterate_grammar = extend_grammar(EXPR_GRAMMAR,
{
"<factor>": [
"+<factor>", "-<factor>", "(<expr>)",
# "<integer>.<integer>",
# Generate one integer after another
# from the function
("<integer>", opts(pre=iterate)),
],
})
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
def fuzz_tree(self) -> DerivationTree:
self.reset_generators()
return super().fuzz_tree()
def reset_generators(self) -> None:
self.generators: Dict[str, Iterator] = {}
def run_generator(self, expansion: Expansion,
function: Callable) -> Iterator:
key = repr((expansion, function))
if key not in self.generators:
self.generators[key] = function()
generator = self.generators[key]
return next(generator)
if __name__ == '__main__':
iterate_fuzzer = GeneratorGrammarFuzzer(iterate_grammar)
iterate_fuzzer.fuzz()
if __name__ == '__main__':
iterate_grammar = extend_grammar(EXPR_GRAMMAR,
{
"<factor>": [
"+<factor>", "-<factor>", "(<expr>)",
("<integer>", opts(pre=range(1, 1000))),
],
})
if __name__ == '__main__':
iterate_grammar = extend_grammar(EXPR_GRAMMAR,
{
"<factor>": [
"+<factor>", "-<factor>", "(<expr>)",
("<integer>", opts(
pre=(x for x in range(1, 1000)))),
],
})
## Checking and Repairing Elements after Expansion
## -----------------------------------------------
if __name__ == '__main__':
print('\n## Checking and Repairing Elements after Expansion')
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
def fuzz_tree(self) -> DerivationTree:
while True:
tree = super().fuzz_tree()
(symbol, children) = tree
result, new_children = self.run_post_functions(tree)
if not isinstance(result, bool) or result:
return (symbol, new_children)
self.restart_expansion()
def restart_expansion(self) -> None:
# To be overloaded in subclasses
self.reset_generators()
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
# Return True iff all constraints of grammar are satisfied in TREE
def run_post_functions(self, tree: DerivationTree,
depth: Union[int, float] = float("inf")) \
-> Tuple[bool, Optional[List[DerivationTree]]]:
symbol: str = tree[0]
children: List[DerivationTree] = cast(List[DerivationTree], tree[1])
if children == []:
return True, children # Terminal symbol
try:
expansion = self.find_expansion(tree)
except KeyError:
# Expansion (no longer) found - ignore
return True, children
result = True
function = exp_post_expansion_function(expansion)
if function is not None:
result = self.eval_function(tree, function)
if isinstance(result, bool) and not result:
if self.log:
print(
all_terminals(tree),
"did not satisfy",
symbol,
"constraint")
return False, children
children = self.apply_result(result, children)
if depth > 0:
for c in children:
result, _ = self.run_post_functions(c, depth - 1)
if isinstance(result, bool) and not result:
return False, children
return result, children
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
def find_expansion(self, tree):
symbol, children = tree
applied_expansion = \
"".join([child_symbol for child_symbol, _ in children])
for expansion in self.grammar[symbol]:
if exp_string(expansion) == applied_expansion:
return expansion
raise KeyError(
symbol +
": did not find expansion " +
repr(applied_expansion))
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
def eval_function(self, tree, function):
symbol, children = tree
assert callable(function)
args = []
for (symbol, exp) in children:
if exp != [] and exp is not None:
symbol_value = all_terminals((symbol, exp))
args.append(symbol_value)
result = function(*args)
if self.log:
print(repr(function) + repr(tuple(args)), "=", repr(result))
return result
### Example: Negative Expressions
if __name__ == '__main__':
print('\n### Example: Negative Expressions')
from .ExpectError import ExpectError
def eval_with_exception(s):
# Use "mute=True" to suppress all messages
with ExpectError(print_traceback=False):
return eval(s)
return False
if __name__ == '__main__':
negative_expr_grammar = extend_grammar(EXPR_GRAMMAR,
{
"<start>": [("<expr>", opts(post=lambda s: eval_with_exception(s) < 0))]
}
)
assert is_valid_grammar(negative_expr_grammar)
if __name__ == '__main__':
negative_expr_fuzzer = GeneratorGrammarFuzzer(negative_expr_grammar)
expr = negative_expr_fuzzer.fuzz()
expr
if __name__ == '__main__':
eval(expr)
### Example: Matching XML Tags
if __name__ == '__main__':
print('\n### Example: Matching XML Tags')
from .bookutils import HTML
if __name__ == '__main__':
HTML("<strong>A bold text</strong>")
XML_GRAMMAR: Grammar = {
"<start>": ["<xml-tree>"],
"<xml-tree>": ["<<id>><xml-content></<id>>"],
"<xml-content>": ["Text", "<xml-tree>"],
"<id>": ["<letter>", "<id><letter>"],
"<letter>": crange('a', 'z')
}
if __name__ == '__main__':
assert is_valid_grammar(XML_GRAMMAR)
if __name__ == '__main__':
xml_fuzzer = GrammarFuzzer(XML_GRAMMAR)
xml_fuzzer.fuzz()
XML_GRAMMAR.update({
"<xml-tree>": [("<<id>><xml-content></<id>>",
opts(post=lambda id1, content, id2: [None, None, id1])
)]
})
if __name__ == '__main__':
assert is_valid_grammar(XML_GRAMMAR)
if __name__ == '__main__':
xml_fuzzer = GeneratorGrammarFuzzer(XML_GRAMMAR)
xml_fuzzer.fuzz()
### Example: Checksums
if __name__ == '__main__':
print('\n### Example: Checksums')
if __name__ == '__main__':
credit_card_fuzzer = GeneratorGrammarFuzzer(
CHARGE_GRAMMAR, start_symbol="<credit-card-number>")
credit_card_number = credit_card_fuzzer.fuzz()
credit_card_number
if __name__ == '__main__':
assert valid_luhn_checksum(credit_card_number)
if __name__ == '__main__':
charge_fuzzer = GeneratorGrammarFuzzer(CHARGE_GRAMMAR)
charge_fuzzer.fuzz()
## Local Checking and Repairing
## ----------------------------
if __name__ == '__main__':
print('\n## Local Checking and Repairing')
if __name__ == '__main__':
binary_expr_grammar = extend_grammar(EXPR_GRAMMAR,
{
"<integer>": [("<digit><integer>", opts(post=lambda digit, _: digit in ["0", "1"])),
("<digit>", opts(post=lambda digit: digit in ["0", "1"]))]
}
)
if __name__ == '__main__':
assert is_valid_grammar(binary_expr_grammar)
if __name__ == '__main__':
binary_expr_fuzzer = GeneratorGrammarFuzzer(binary_expr_grammar)
binary_expr_fuzzer.fuzz()
class RestartExpansionException(Exception):
pass
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
def expand_tree_once(self, tree: DerivationTree) -> DerivationTree:
# Apply inherited method. This also calls `expand_tree_once()` on all
# subtrees.
new_tree: DerivationTree = super().expand_tree_once(tree)
(symbol, children) = new_tree
if all([exp_post_expansion_function(expansion)
is None for expansion in self.grammar[symbol]]):
# No constraints for this symbol
return new_tree
if self.any_possible_expansions(tree):
# Still expanding
return new_tree
return self.run_post_functions_locally(new_tree)
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
def run_post_functions_locally(self, new_tree: DerivationTree) -> DerivationTree:
symbol, _ = new_tree
result, children = self.run_post_functions(new_tree, depth=0)
if not isinstance(result, bool) or result:
# No constraints, or constraint satisfied
# children = self.apply_result(result, children)
new_tree = (symbol, children)
return new_tree
# Replace tree by unexpanded symbol and try again
if self.log:
print(
all_terminals(new_tree),
"did not satisfy",
symbol,
"constraint")
if self.replacement_attempts_counter > 0:
if self.log:
print("Trying another expansion")
self.replacement_attempts_counter -= 1
return (symbol, None)
if self.log:
print("Starting from scratch")
raise RestartExpansionException
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
def __init__(self, grammar: Grammar, replacement_attempts: int = 10,
**kwargs) -> None:
super().__init__(grammar, **kwargs)
self.replacement_attempts = replacement_attempts
def restart_expansion(self) -> None:
super().restart_expansion()
self.replacement_attempts_counter = self.replacement_attempts
def fuzz_tree(self) -> DerivationTree:
self.replacement_attempts_counter = self.replacement_attempts
while True:
try:
# This is fuzz_tree() as defined above
tree = super().fuzz_tree()
return tree
except RestartExpansionException:
self.restart_expansion()
if __name__ == '__main__':
binary_expr_fuzzer = GeneratorGrammarFuzzer(
binary_expr_grammar, replacement_attempts=100)
binary_expr_fuzzer.fuzz()
## Definitions and Uses
## --------------------
if __name__ == '__main__':
print('\n## Definitions and Uses')
import string
VAR_GRAMMAR: Grammar = {
'<start>': ['<statements>'],
'<statements>': ['<statement>;<statements>', '<statement>'],
'<statement>': ['<assignment>'],
'<assignment>': ['<identifier>=<expr>'],
'<identifier>': ['<word>'],
'<word>': ['<alpha><word>', '<alpha>'],
'<alpha>': list(string.ascii_letters),
'<expr>': ['<term>+<expr>', '<term>-<expr>', '<term>'],
'<term>': ['<factor>*<term>', '<factor>/<term>', '<factor>'],
'<factor>':
['+<factor>', '-<factor>', '(<expr>)', '<identifier>', '<number>'],
'<number>': ['<integer>.<integer>', '<integer>'],
'<integer>': ['<digit><integer>', '<digit>'],
'<digit>': crange('0', '9')
}
if __name__ == '__main__':
assert is_valid_grammar(VAR_GRAMMAR)
if __name__ == '__main__':
g = GrammarFuzzer(VAR_GRAMMAR)
for i in range(10):
print(g.fuzz())
SYMBOL_TABLE: Set[str] = set()
def define_id(id: str) -> None:
SYMBOL_TABLE.add(id)
def use_id() -> Union[bool, str]:
if len(SYMBOL_TABLE) == 0:
return False
id = random.choice(list(SYMBOL_TABLE))
return id
def clear_symbol_table() -> None:
global SYMBOL_TABLE
SYMBOL_TABLE = set()
CONSTRAINED_VAR_GRAMMAR = extend_grammar(VAR_GRAMMAR)
CONSTRAINED_VAR_GRAMMAR = extend_grammar(CONSTRAINED_VAR_GRAMMAR, {
"<assignment>": [("<identifier>=<expr>",
opts(post=lambda id, expr: define_id(id)))]
})
CONSTRAINED_VAR_GRAMMAR = extend_grammar(CONSTRAINED_VAR_GRAMMAR, {
"<factor>": ['+<factor>', '-<factor>', '(<expr>)',
("<identifier>", opts(post=lambda _: use_id())),
'<number>']
})
CONSTRAINED_VAR_GRAMMAR = extend_grammar(CONSTRAINED_VAR_GRAMMAR, {
"<start>": [("<statements>", opts(pre=clear_symbol_table))]
})
if __name__ == '__main__':
assert is_valid_grammar(CONSTRAINED_VAR_GRAMMAR)
if __name__ == '__main__':
var_grammar_fuzzer = GeneratorGrammarFuzzer(CONSTRAINED_VAR_GRAMMAR)
for i in range(10):
print(var_grammar_fuzzer.fuzz())
## Ordering Expansions
## -------------------
if __name__ == '__main__':
print('\n## Ordering Expansions')
if __name__ == '__main__':
var_grammar_fuzzer = GeneratorGrammarFuzzer(CONSTRAINED_VAR_GRAMMAR)
with ExpectError():
for i in range(100):
s = var_grammar_fuzzer.fuzz()
try:
exec(s, {}, {})
except SyntaxError:
continue
except ZeroDivisionError:
continue
print(s)
CONSTRAINED_VAR_GRAMMAR = extend_grammar(CONSTRAINED_VAR_GRAMMAR, {
"<statements>": [("<statement>;<statements>", opts(order=[1, 2])),
"<statement>"]
})
CONSTRAINED_VAR_GRAMMAR = extend_grammar(CONSTRAINED_VAR_GRAMMAR, {
"<assignment>": [("<identifier>=<expr>", opts(post=lambda id, expr: define_id(id),
order=[2, 1]))],
})
def exp_order(expansion):
"""Return the specified expansion ordering, or None if unspecified"""
return exp_opt(expansion, 'order')
class GeneratorGrammarFuzzer(GeneratorGrammarFuzzer):
def choose_tree_expansion(self, tree: DerivationTree,
expandable_children: List[DerivationTree]) \
-> int:
"""Return index of subtree in `expandable_children`
to be selected for expansion. Defaults to random."""
(symbol, tree_children) = tree
assert isinstance(tree_children, list)
if len(expandable_children) == 1:
# No choice
return super().choose_tree_expansion(tree, expandable_children)
expansion = self.find_expansion(tree)
given_order = exp_order(expansion)
if given_order is None:
# No order specified
return super().choose_tree_expansion(tree, expandable_children)
nonterminal_children = [c for c in tree_children if c[1] != []]
assert len(nonterminal_children) == len(given_order), \
"Order must have one element for each nonterminal"
# Find expandable child with lowest ordering
min_given_order = None
j = 0
for k, expandable_child in enumerate(expandable_children):
while j < len(
nonterminal_children) and expandable_child != nonterminal_children[j]:
j += 1
assert j < len(nonterminal_children), "Expandable child not found"
if self.log:
print("Expandable child #%d %s has order %d" %
(k, expandable_child[0], given_order[j]))
if min_given_order is None or given_order[j] < min_given_order:
min_given_order = k
assert min_given_order is not None
if self.log:
print("Returning expandable child #%d %s" %
(min_given_order, expandable_children[min_given_order][0]))
return min_given_order
if __name__ == '__main__':
var_grammar_fuzzer = GeneratorGrammarFuzzer(CONSTRAINED_VAR_GRAMMAR)
for i in range(100):
s = var_grammar_fuzzer.fuzz()
if i < 10:
print(s)
try:
exec(s, {}, {})
except SyntaxError:
continue
except ZeroDivisionError:
continue
## All Together
## ------------
if __name__ == '__main__':
print('\n## All Together')
### Generators and Probabilistic Fuzzing
if __name__ == '__main__':
print('\n### Generators and Probabilistic Fuzzing')
from .ProbabilisticGrammarFuzzer import ProbabilisticGrammarFuzzer # minor dependency
from .bookutils import inheritance_conflicts
if __name__ == '__main__':
inheritance_conflicts(ProbabilisticGrammarFuzzer, GeneratorGrammarFuzzer)
class ProbabilisticGeneratorGrammarFuzzer(GeneratorGrammarFuzzer,
ProbabilisticGrammarFuzzer):
"""Join the features of `GeneratorGrammarFuzzer`
and `ProbabilisticGrammarFuzzer`"""
def supported_opts(self) -> Set[str]:
return (super(GeneratorGrammarFuzzer, self).supported_opts() |
super(ProbabilisticGrammarFuzzer, self).supported_opts())
def __init__(self, grammar: Grammar, *, replacement_attempts: int = 10,
**kwargs):
"""Constructor.
`replacement_attempts` - see `GeneratorGrammarFuzzer` constructor.
All other keywords go into `ProbabilisticGrammarFuzzer`.
"""
super(GeneratorGrammarFuzzer, self).__init__(
grammar,
replacement_attempts=replacement_attempts)
super(ProbabilisticGrammarFuzzer, self).__init__(grammar, **kwargs)
CONSTRAINED_VAR_GRAMMAR.update({
'<word>': [('<alpha><word>', opts(prob=0.9)),
'<alpha>'],
})
if __name__ == '__main__':
pgg_fuzzer = ProbabilisticGeneratorGrammarFuzzer(CONSTRAINED_VAR_GRAMMAR)
pgg_fuzzer.supported_opts()
if __name__ == '__main__':
pgg_fuzzer.fuzz()
# Generators and Grammar Coverage
# ===============================
if __name__ == '__main__':
print('\n# Generators and Grammar Coverage')
from .ProbabilisticGrammarFuzzer import ProbabilisticGrammarCoverageFuzzer # minor dependency
from .GrammarCoverageFuzzer import GrammarCoverageFuzzer # minor dependency
if __name__ == '__main__':
inheritance_conflicts(ProbabilisticGrammarCoverageFuzzer,
GeneratorGrammarFuzzer)
import copy
class ProbabilisticGeneratorGrammarCoverageFuzzer(GeneratorGrammarFuzzer,
ProbabilisticGrammarCoverageFuzzer):
"""Join the features of `GeneratorGrammarFuzzer`
and `ProbabilisticGrammarCoverageFuzzer`"""
def supported_opts(self) -> Set[str]:
return (super(GeneratorGrammarFuzzer, self).supported_opts() |
super(ProbabilisticGrammarCoverageFuzzer, self).supported_opts())
def __init__(self, grammar: Grammar, *,
replacement_attempts: int = 10, **kwargs) -> None:
"""Constructor.
`replacement_attempts` - see `GeneratorGrammarFuzzer` constructor.
All other keywords go into `ProbabilisticGrammarFuzzer`.
"""
super(GeneratorGrammarFuzzer, self).__init__(
grammar,
replacement_attempts)
super(ProbabilisticGrammarCoverageFuzzer, self).__init__(
grammar,
**kwargs)
class ProbabilisticGeneratorGrammarCoverageFuzzer(
ProbabilisticGeneratorGrammarCoverageFuzzer):
def fuzz_tree(self) -> DerivationTree:
self.orig_covered_expansions = copy.deepcopy(self.covered_expansions)
tree = super().fuzz_tree()
self.covered_expansions = self.orig_covered_expansions
self.add_tree_coverage(tree)
return tree
def add_tree_coverage(self, tree: DerivationTree) -> None:
(symbol, children) = tree
assert isinstance(children, list)
if len(children) > 0:
flat_children: List[DerivationTree] = [
(child_symbol, None)
for (child_symbol, _) in children
]
self.add_coverage(symbol, flat_children)
for c in children:
self.add_tree_coverage(c)
class ProbabilisticGeneratorGrammarCoverageFuzzer(
ProbabilisticGeneratorGrammarCoverageFuzzer):
def restart_expansion(self) -> None:
super().restart_expansion()
self.covered_expansions = self.orig_covered_expansions
if __name__ == '__main__':
pggc_fuzzer = ProbabilisticGeneratorGrammarCoverageFuzzer(
CONSTRAINED_VAR_GRAMMAR)
pggc_fuzzer.fuzz()
if __name__ == '__main__':
pggc_fuzzer.expansion_coverage()
if __name__ == '__main__':
[pggc_fuzzer.fuzz() for i in range(10)]
class PGGCFuzzer(ProbabilisticGeneratorGrammarCoverageFuzzer):
"""The one grammar-based fuzzer that supports all fuzzingbook features"""
pass
## Synopsis
## --------
if __name__ == '__main__':
print('\n## Synopsis')
from .Grammars import US_PHONE_GRAMMAR, extend_grammar, opts
def pick_area_code():
return random.choice(['555', '554', '553'])
PICKED_US_PHONE_GRAMMAR = extend_grammar(US_PHONE_GRAMMAR,
{
"<area>": [("<lead-digit><digit><digit>", opts(pre=pick_area_code))]
})
if __name__ == '__main__':
picked_us_phone_fuzzer = GeneratorGrammarFuzzer(PICKED_US_PHONE_GRAMMAR)
[picked_us_phone_fuzzer.fuzz() for i in range(5)]
from .ClassDiagram import display_class_hierarchy
if __name__ == '__main__':
display_class_hierarchy([PGGCFuzzer],
public_methods=[
Fuzzer.run,
Fuzzer.runs,
GrammarFuzzer.__init__,
GrammarFuzzer.fuzz,
GrammarFuzzer.fuzz_tree,
GeneratorGrammarFuzzer.__init__,
GeneratorGrammarFuzzer.fuzz_tree,
GrammarCoverageFuzzer.__init__,
ProbabilisticGrammarFuzzer.__init__,
ProbabilisticGrammarCoverageFuzzer.__init__,
ProbabilisticGeneratorGrammarCoverageFuzzer.__init__,
ProbabilisticGeneratorGrammarCoverageFuzzer.fuzz_tree,
PGGCFuzzer.__init__,
],
types={
'DerivationTree': DerivationTree,
'Expansion': Expansion,
'Grammar': Grammar
},
project='fuzzingbook')
## Lessons Learned
## ---------------
if __name__ == '__main__':
print('\n## Lessons Learned')
## Next Steps
## ----------
if __name__ == '__main__':
print('\n## Next Steps')
## Background
## ----------
if __name__ == '__main__':
print('\n## Background')
## Exercises
## ---------
if __name__ == '__main__':
print('\n## Exercises')
### Exercise 1: Tree Processing
if __name__ == '__main__':
print('\n### Exercise 1: Tree Processing')
### Exercise 2: Attribute Grammars
if __name__ == '__main__':
print('\n### Exercise 2: Attribute Grammars')
ATTR_GRAMMAR = {
"<clause>": [("<xml-open>Text<xml-close>", opts(post=lambda x1, x2: [None, x1.name]))],
"<xml-open>": [("<<tag>>", opts(post=lambda tag: opts(name=...)))],
"<xml-close>": ["</<tag>>"]
}
|
[
"copy.deepcopy",
"random.randint",
"typing.cast",
"random.choice",
"inspect.isgeneratorfunction",
"random.seed"
] |
[((4615, 4632), 'random.seed', 'random.seed', (['(2001)'], {}), '(2001)\n', (4626, 4632), False, 'import random\n'), ((34447, 34483), 'random.choice', 'random.choice', (["['555', '554', '553']"], {}), "(['555', '554', '553'])\n", (34460, 34483), False, 'import random\n'), ((5955, 5989), 'random.randint', 'random.randint', (['(10000000)', '(90000000)'], {}), '(10000000, 90000000)\n', (5969, 5989), False, 'import random\n'), ((9072, 9109), 'inspect.isgeneratorfunction', 'inspect.isgeneratorfunction', (['function'], {}), '(function)\n', (9099, 9109), False, 'import inspect\n'), ((16245, 16280), 'typing.cast', 'cast', (['List[DerivationTree]', 'tree[1]'], {}), '(List[DerivationTree], tree[1])\n', (16249, 16280), False, 'from typing import Callable, Set, List, Dict, Optional, Iterator, Any, Union, Tuple, cast\n'), ((32944, 32982), 'copy.deepcopy', 'copy.deepcopy', (['self.covered_expansions'], {}), '(self.covered_expansions)\n', (32957, 32982), False, 'import copy\n'), ((6328, 6362), 'random.randint', 'random.randint', (['(10000000)', '(90000000)'], {}), '(10000000, 90000000)\n', (6342, 6362), False, 'import random\n'), ((12304, 12328), 'random.randint', 'random.randint', (['(100)', '(200)'], {}), '(100, 200)\n', (12318, 12328), False, 'import random\n'), ((11982, 12006), 'random.randint', 'random.randint', (['(100)', '(200)'], {}), '(100, 200)\n', (11996, 12006), False, 'import random\n')]
|
# -*- coding: iso-8859-1 -*-
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the useful functions provided by this module:
ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
isroutine() - check object types
getmembers() - get members of an object that satisfy a given condition
getfile(), getsourcefile(), getsource() - find an object's source code
getdoc(), getcomments() - get documentation on an object
getmodule() - determine the module that an object came from
getclasstree() - arrange classes so as to represent their hierarchy
getargspec(), getargvalues(), getcallargs() - get info about function arguments
formatargspec(), formatargvalues() - format an argument spec
getouterframes(), getinnerframes() - get info about frames
currentframe() - get the current stack frame
stack(), trace() - get info about frames on the stack or in a traceback
"""
# This module is in the public domain. No warranties.
__author__ = '<NAME> <<EMAIL>>'
__date__ = '1 Jan 2001'
import sys
import os
import types
import string
import re
import dis
import imp
import tokenize
import linecache
from operator import attrgetter
from collections import namedtuple
# These constants are from Include/code.h.
CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 0x1, 0x2, 0x4, 0x8
CO_NESTED, CO_GENERATOR, CO_NOFREE = 0x10, 0x20, 0x40
# See Include/object.h
TPFLAGS_IS_ABSTRACT = 1 << 20
# ----------------------------------------------------------- type-checking
def ismodule(object):
"""Return true if the object is a module.
Module objects provide these attributes:
__doc__ documentation string
__file__ filename (missing for built-in modules)"""
return isinstance(object, types.ModuleType)
def isclass(object):
"""Return true if the object is a class.
Class objects provide these attributes:
__doc__ documentation string
__module__ name of module in which this class was defined"""
return isinstance(object, (type, types.ClassType))
def ismethod(object):
"""Return true if the object is an instance method.
Instance method objects provide these attributes:
__doc__ documentation string
__name__ name with which this method was defined
im_class class object in which this method belongs
im_func function object containing implementation of method
im_self instance to which this method is bound, or None"""
return isinstance(object, types.MethodType)
def ismethoddescriptor(object):
"""Return true if the object is a method descriptor.
But not if ismethod() or isclass() or isfunction() are true.
This is new in Python 2.2, and, for example, is true of int.__add__.
An object passing this test has a __get__ attribute but not a __set__
attribute, but beyond that the set of attributes varies. __name__ is
usually sensible, and __doc__ often is.
Methods implemented via descriptors that also pass one of the other
tests return false from the ismethoddescriptor() test, simply because
the other tests promise more -- you can, e.g., count on having the
im_func attribute (etc) when an object passes ismethod()."""
return (hasattr(object, "__get__")
and not hasattr(object, "__set__") # else it's a data descriptor
and not ismethod(object) # mutual exclusion
and not isfunction(object)
and not isclass(object))
def isdatadescriptor(object):
"""Return true if the object is a data descriptor.
Data descriptors have both a __get__ and a __set__ attribute. Examples are
properties (defined in Python) and getsets and members (defined in C).
Typically, data descriptors will also have __name__ and __doc__ attributes
(properties, getsets, and members have both of these attributes), but this
is not guaranteed."""
return (hasattr(object, "__set__") and hasattr(object, "__get__"))
if hasattr(types, 'MemberDescriptorType'):
# CPython and equivalent
def ismemberdescriptor(object):
"""Return true if the object is a member descriptor.
Member descriptors are specialized descriptors defined in extension
modules."""
return isinstance(object, types.MemberDescriptorType)
else:
# Other implementations
def ismemberdescriptor(object):
"""Return true if the object is a member descriptor.
Member descriptors are specialized descriptors defined in extension
modules."""
return False
if hasattr(types, 'GetSetDescriptorType'):
# CPython and equivalent
def isgetsetdescriptor(object):
"""Return true if the object is a getset descriptor.
getset descriptors are specialized descriptors defined in extension
modules."""
return isinstance(object, types.GetSetDescriptorType)
else:
# Other implementations
def isgetsetdescriptor(object):
"""Return true if the object is a getset descriptor.
getset descriptors are specialized descriptors defined in extension
modules."""
return False
def isfunction(object):
"""Return true if the object is a user-defined function.
Function objects provide these attributes:
__doc__ documentation string
__name__ name with which this function was defined
func_code code object containing compiled function bytecode
func_defaults tuple of any default values for arguments
func_doc (same as __doc__)
func_globals global namespace in which this function was defined
func_name (same as __name__)"""
return isinstance(object, types.FunctionType)
def isgeneratorfunction(object):
"""Return true if the object is a user-defined generator function.
Generator function objects provide the same attributes as functions.
See help(isfunction) for a list of attributes."""
return bool((isfunction(object) or ismethod(object)) and
object.func_code.co_flags & CO_GENERATOR)
def isgenerator(object):
"""Return true if the object is a generator.
Generator objects provide these attributes:
__iter__ defined to support iteration over container
close raises a new GeneratorExit exception inside the
generator to terminate the iteration
gi_code code object
gi_frame frame object or possibly None once the generator has
been exhausted
gi_running set to 1 when generator is executing, 0 otherwise
next return the next item from the container
send resumes the generator and "sends" a value that becomes
the result of the current yield-expression
throw used to raise an exception inside the generator"""
return isinstance(object, types.GeneratorType)
def istraceback(object):
"""Return true if the object is a traceback.
Traceback objects provide these attributes:
tb_frame frame object at this level
tb_lasti index of last attempted instruction in bytecode
tb_lineno current line number in Python source code
tb_next next inner traceback object (called by this level)"""
return isinstance(object, types.TracebackType)
def isframe(object):
"""Return true if the object is a frame object.
Frame objects provide these attributes:
f_back next outer frame object (this frame's caller)
f_builtins built-in namespace seen by this frame
f_code code object being executed in this frame
f_exc_traceback traceback if raised in this frame, or None
f_exc_type exception type if raised in this frame, or None
f_exc_value exception value if raised in this frame, or None
f_globals global namespace seen by this frame
f_lasti index of last attempted instruction in bytecode
f_lineno current line number in Python source code
f_locals local namespace seen by this frame
f_restricted 0 or 1 if frame is in restricted execution mode
f_trace tracing function for this frame, or None"""
return isinstance(object, types.FrameType)
def iscode(object):
"""Return true if the object is a code object.
Code objects provide these attributes:
co_argcount number of arguments (not including * or ** args)
co_code string of raw compiled bytecode
co_consts tuple of constants used in the bytecode
co_filename name of file in which this code object was created
co_firstlineno number of first line in Python source code
co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
co_lnotab encoded mapping of line numbers to bytecode indices
co_name name with which this code object was defined
co_names tuple of names of local variables
co_nlocals number of local variables
co_stacksize virtual machine stack space required
co_varnames tuple of names of arguments and local variables"""
return isinstance(object, types.CodeType)
def isbuiltin(object):
"""Return true if the object is a built-in function or method.
Built-in functions and methods provide these attributes:
__doc__ documentation string
__name__ original name of this function or method
__self__ instance to which a method is bound, or None"""
return isinstance(object, types.BuiltinFunctionType)
def isroutine(object):
"""Return true if the object is any kind of function or method."""
return (isbuiltin(object)
or isfunction(object)
or ismethod(object)
or ismethoddescriptor(object))
def isabstract(object):
"""Return true if the object is an abstract base class (ABC)."""
return bool(isinstance(object, type) and object.__flags__ & TPFLAGS_IS_ABSTRACT)
def getmembers(object, predicate=None):
"""Return all members of an object as (name, value) pairs sorted by name.
Optionally, only return members that satisfy a given predicate."""
results = []
for key in dir(object):
try:
value = getattr(object, key)
except AttributeError:
continue
if not predicate or predicate(value):
results.append((key, value))
results.sort()
return results
Attribute = namedtuple('Attribute', 'name kind defining_class object')
def classify_class_attrs(cls):
"""Return list of attribute-descriptor tuples.
For each name in dir(cls), the return list contains a 4-tuple
with these elements:
0. The name (a string).
1. The kind of attribute this is, one of these strings:
'class method' created via classmethod()
'static method' created via staticmethod()
'property' created via property()
'method' any other flavor of method
'data' not a method
2. The class which defined this attribute (a class).
3. The object as obtained directly from the defining class's
__dict__, not via getattr. This is especially important for
data attributes: C.data is just a data object, but
C.__dict__['data'] may be a data descriptor with additional
info, like a __doc__ string.
"""
mro = getmro(cls)
names = dir(cls)
result = []
for name in names:
# Get the object associated with the name, and where it was defined.
# Getting an obj from the __dict__ sometimes reveals more than
# using getattr. Static and class methods are dramatic examples.
# Furthermore, some objects may raise an Exception when fetched with
# getattr(). This is the case with some descriptors (bug #1785).
# Thus, we only use getattr() as a last resort.
homecls = None
for base in (cls,) + mro:
if name in base.__dict__:
obj = base.__dict__[name]
homecls = base
break
else:
obj = getattr(cls, name)
homecls = getattr(obj, "__objclass__", homecls)
# Classify the object.
if isinstance(obj, staticmethod):
kind = "static method"
elif isinstance(obj, classmethod):
kind = "class method"
elif isinstance(obj, property):
kind = "property"
elif ismethoddescriptor(obj):
kind = "method"
elif isdatadescriptor(obj):
kind = "data"
else:
obj_via_getattr = getattr(cls, name)
if (ismethod(obj_via_getattr) or
ismethoddescriptor(obj_via_getattr)):
kind = "method"
else:
kind = "data"
obj = obj_via_getattr
result.append(Attribute(name, kind, homecls, obj))
return result
# ----------------------------------------------------------- class helpers
def _searchbases(cls, accum):
# Simulate the "classic class" search order.
if cls in accum:
return
accum.append(cls)
for base in cls.__bases__:
_searchbases(base, accum)
def getmro(cls):
"Return tuple of base classes (including cls) in method resolution order."
if hasattr(cls, "__mro__"):
return cls.__mro__
else:
result = []
_searchbases(cls, result)
return tuple(result)
# -------------------------------------------------- source code extraction
def indentsize(line):
"""Return the indent size, in spaces, at the start of a line of text."""
expline = string.expandtabs(line)
return len(expline) - len(string.lstrip(expline))
def getdoc(object):
"""Get the documentation string for an object.
All tabs are expanded to spaces. To clean up docstrings that are
indented to line up with blocks of code, any whitespace than can be
uniformly removed from the second line onwards is removed."""
try:
doc = object.__doc__
except AttributeError:
return None
if not isinstance(doc, types.StringTypes):
return None
return cleandoc(doc)
def cleandoc(doc):
"""Clean up indentation from docstrings.
Any whitespace that can be uniformly removed from the second line
onwards is removed."""
try:
lines = string.split(string.expandtabs(doc), '\n')
except UnicodeError:
return None
else:
# Find minimum indentation of any non-blank lines after first line.
margin = sys.maxint
for line in lines[1:]:
content = len(string.lstrip(line))
if content:
indent = len(line) - content
margin = min(margin, indent)
# Remove indentation.
if lines:
lines[0] = lines[0].lstrip()
if margin < sys.maxint:
for i in range(1, len(lines)): lines[i] = lines[i][margin:]
# Remove any trailing or leading blank lines.
while lines and not lines[-1]:
lines.pop()
while lines and not lines[0]:
lines.pop(0)
return string.join(lines, '\n')
def getfile(object):
"""Work out which source or compiled file an object was defined in."""
if ismodule(object):
if hasattr(object, '__file__'):
return object.__file__
raise TypeError('{!r} is a built-in module'.format(object))
if isclass(object):
object = sys.modules.get(object.__module__)
if hasattr(object, '__file__'):
return object.__file__
raise TypeError('{!r} is a built-in class'.format(object))
if ismethod(object):
object = object.im_func
if isfunction(object):
object = object.func_code
if istraceback(object):
object = object.tb_frame
if isframe(object):
object = object.f_code
if iscode(object):
return object.co_filename
raise TypeError('{!r} is not a module, class, method, '
'function, traceback, frame, or code object'.format(object))
ModuleInfo = namedtuple('ModuleInfo', 'name suffix mode module_type')
def getmoduleinfo(path):
"""Get the module name, suffix, mode, and module type for a given file."""
filename = os.path.basename(path)
suffixes = map(lambda info:
(-len(info[0]), info[0], info[1], info[2]),
imp.get_suffixes())
suffixes.sort() # try longest suffixes first, in case they overlap
for neglen, suffix, mode, mtype in suffixes:
if filename[neglen:] == suffix:
return ModuleInfo(filename[:neglen], suffix, mode, mtype)
def getmodulename(path):
"""Return the module name for a given file, or None."""
info = getmoduleinfo(path)
if info: return info[0]
def getsourcefile(object):
"""Return the filename that can be used to locate an object's source.
Return None if no way can be identified to get the source.
"""
filename = getfile(object)
if string.lower(filename[-4:]) in ('.pyc', '.pyo'):
filename = filename[:-4] + '.py'
for suffix, mode, kind in imp.get_suffixes():
if 'b' in mode and string.lower(filename[-len(suffix):]) == suffix:
# Looks like a binary file. We want to only return a text file.
return None
if os.path.exists(filename):
return filename
# only return a non-existent filename if the module has a PEP 302 loader
if hasattr(getmodule(object, filename), '__loader__'):
return filename
# or it is in the linecache
if filename in linecache.cache:
return filename
def getabsfile(object, _filename=None):
"""Return an absolute path to the source or compiled file for an object.
The idea is for each object to have a unique origin, so this routine
normalizes the result as much as possible."""
if _filename is None:
_filename = getsourcefile(object) or getfile(object)
return os.path.normcase(os.path.abspath(_filename))
modulesbyfile = {}
_filesbymodname = {}
def getmodule(object, _filename=None):
"""Return the module an object was defined in, or None if not found."""
if ismodule(object):
return object
if hasattr(object, '__module__'):
return sys.modules.get(object.__module__)
# Try the filename to modulename cache
if _filename is not None and _filename in modulesbyfile:
return sys.modules.get(modulesbyfile[_filename])
# Try the cache again with the absolute file name
try:
file = getabsfile(object, _filename)
except TypeError:
return None
if file in modulesbyfile:
return sys.modules.get(modulesbyfile[file])
# Update the filename to module name cache and check yet again
# Copy sys.modules in order to cope with changes while iterating
for modname, module in sys.modules.items():
if ismodule(module) and hasattr(module, '__file__'):
f = module.__file__
if f == _filesbymodname.get(modname, None):
# Have already mapped this module, so skip it
continue
_filesbymodname[modname] = f
f = getabsfile(module)
# Always map to the name the module knows itself by
modulesbyfile[f] = modulesbyfile[
os.path.realpath(f)] = module.__name__
if file in modulesbyfile:
return sys.modules.get(modulesbyfile[file])
# Check the main module
main = sys.modules['__main__']
if not hasattr(object, '__name__'):
return None
if hasattr(main, object.__name__):
mainobject = getattr(main, object.__name__)
if mainobject is object:
return main
# Check builtins
builtin = sys.modules['__builtin__']
if hasattr(builtin, object.__name__):
builtinobject = getattr(builtin, object.__name__)
if builtinobject is object:
return builtin
def findsource(object):
"""Return the entire source file and starting line number for an object.
The argument may be a module, class, method, function, traceback, frame,
or code object. The source code is returned as a list of all the lines
in the file and the line number indexes a line in that list. An IOError
is raised if the source code cannot be retrieved."""
file = getfile(object)
sourcefile = getsourcefile(object)
if not sourcefile and file[:1] + file[-1:] != '<>':
raise IOError('source code not available')
file = sourcefile if sourcefile else file
module = getmodule(object, file)
if module:
lines = linecache.getlines(file, module.__dict__)
else:
lines = linecache.getlines(file)
if not lines:
raise IOError('could not get source code')
if ismodule(object):
return lines, 0
if isclass(object):
name = object.__name__
pat = re.compile(r'^(\s*)class\s*' + name + r'\b')
# make some effort to find the best matching class definition:
# use the one with the least indentation, which is the one
# that's most probably not inside a function definition.
candidates = []
for i in range(len(lines)):
match = pat.match(lines[i])
if match:
# if it's at toplevel, it's already the best one
if lines[i][0] == 'c':
return lines, i
# else add whitespace to candidate list
candidates.append((match.group(1), i))
if candidates:
# this will sort by whitespace, and by line number,
# less whitespace first
candidates.sort()
return lines, candidates[0][1]
else:
raise IOError('could not find class definition')
if ismethod(object):
object = object.im_func
if isfunction(object):
object = object.func_code
if istraceback(object):
object = object.tb_frame
if isframe(object):
object = object.f_code
if iscode(object):
if not hasattr(object, 'co_firstlineno'):
raise IOError('could not find function definition')
lnum = object.co_firstlineno - 1
pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)')
while lnum > 0:
if pat.match(lines[lnum]): break
lnum = lnum - 1
return lines, lnum
raise IOError('could not find code object')
def getcomments(object):
"""Get lines of comments immediately preceding an object's source code.
Returns None when source can't be found.
"""
try:
lines, lnum = findsource(object)
except (IOError, TypeError):
return None
if ismodule(object):
# Look for a comment block at the top of the file.
start = 0
if lines and lines[0][:2] == '#!': start = 1
while start < len(lines) and string.strip(lines[start]) in ('', '#'):
start = start + 1
if start < len(lines) and lines[start][:1] == '#':
comments = []
end = start
while end < len(lines) and lines[end][:1] == '#':
comments.append(string.expandtabs(lines[end]))
end = end + 1
return string.join(comments, '')
# Look for a preceding block of comments at the same indentation.
elif lnum > 0:
indent = indentsize(lines[lnum])
end = lnum - 1
if end >= 0 and string.lstrip(lines[end])[:1] == '#' and \
indentsize(lines[end]) == indent:
comments = [string.lstrip(string.expandtabs(lines[end]))]
if end > 0:
end = end - 1
comment = string.lstrip(string.expandtabs(lines[end]))
while comment[:1] == '#' and indentsize(lines[end]) == indent:
comments[:0] = [comment]
end = end - 1
if end < 0: break
comment = string.lstrip(string.expandtabs(lines[end]))
while comments and string.strip(comments[0]) == '#':
comments[:1] = []
while comments and string.strip(comments[-1]) == '#':
comments[-1:] = []
return string.join(comments, '')
class EndOfBlock(Exception): pass
class BlockFinder:
"""Provide a tokeneater() method to detect the end of a code block."""
def __init__(self):
self.indent = 0
self.islambda = False
self.started = False
self.passline = False
self.last = 1
def tokeneater(self, type, token, srow_scol, erow_ecol, line):
srow, scol = srow_scol
erow, ecol = erow_ecol
if not self.started:
# look for the first "def", "class" or "lambda"
if token in ("def", "class", "lambda"):
if token == "lambda":
self.islambda = True
self.started = True
self.passline = True # skip to the end of the line
elif type == tokenize.NEWLINE:
self.passline = False # stop skipping when a NEWLINE is seen
self.last = srow
if self.islambda: # lambdas always end at the first NEWLINE
raise EndOfBlock
elif self.passline:
pass
elif type == tokenize.INDENT:
self.indent = self.indent + 1
self.passline = True
elif type == tokenize.DEDENT:
self.indent = self.indent - 1
# the end of matching indent/dedent pairs end a block
# (note that this only works for "def"/"class" blocks,
# not e.g. for "if: else:" or "try: finally:" blocks)
if self.indent <= 0:
raise EndOfBlock
elif self.indent == 0 and type not in (tokenize.COMMENT, tokenize.NL):
# any other token on the same indentation level end the previous
# block as well, except the pseudo-tokens COMMENT and NL.
raise EndOfBlock
def getblock(lines):
"""Extract the block of code at the top of the given list of lines."""
blockfinder = BlockFinder()
try:
tokenize.tokenize(iter(lines).next, blockfinder.tokeneater)
except (EndOfBlock, IndentationError):
pass
return lines[:blockfinder.last]
def getsourcelines(object):
"""Return a list of source lines and starting line number for an object.
The argument may be a module, class, method, function, traceback, frame,
or code object. The source code is returned as a list of the lines
corresponding to the object and the line number indicates where in the
original source file the first line of code was found. An IOError is
raised if the source code cannot be retrieved."""
lines, lnum = findsource(object)
if ismodule(object): return lines, 0
else: return getblock(lines[lnum:]), lnum + 1
def getsource(object):
"""Return the text of the source code for an object.
The argument may be a module, class, method, function, traceback, frame,
or code object. The source code is returned as a single string. An
IOError is raised if the source code cannot be retrieved."""
lines, lnum = getsourcelines(object)
return string.join(lines, '')
# --------------------------------------------------- class tree extraction
def walktree(classes, children, parent):
"""Recursive helper function for getclasstree()."""
results = []
classes.sort(key=attrgetter('__module__', '__name__'))
for c in classes:
results.append((c, c.__bases__))
if c in children:
results.append(walktree(children[c], children, c))
return results
def getclasstree(classes, unique=0):
"""Arrange the given list of classes into a hierarchy of nested lists.
Where a nested list appears, it contains classes derived from the class
whose entry immediately precedes the list. Each entry is a 2-tuple
containing a class and a tuple of its base classes. If the 'unique'
argument is true, exactly one entry appears in the returned structure
for each class in the given list. Otherwise, classes using multiple
inheritance and their descendants will appear multiple times."""
children = {}
roots = []
for c in classes:
if c.__bases__:
for parent in c.__bases__:
if not parent in children:
children[parent] = []
if c not in children[parent]:
children[parent].append(c)
if unique and parent in classes: break
elif c not in roots:
roots.append(c)
for parent in children:
if parent not in classes:
roots.append(parent)
return walktree(roots, children, None)
# ------------------------------------------------ argument list extraction
Arguments = namedtuple('Arguments', 'args varargs keywords')
def getargs(co):
"""Get information about the arguments accepted by a code object.
Three things are returned: (args, varargs, varkw), where 'args' is
a list of argument names (possibly containing nested lists), and
'varargs' and 'varkw' are the names of the * and ** arguments or None."""
if not iscode(co):
raise TypeError('{!r} is not a code object'.format(co))
nargs = co.co_argcount
names = co.co_varnames
args = list(names[:nargs])
step = 0
# The following acrobatics are for anonymous (tuple) arguments.
for i in range(nargs):
if args[i][:1] in ('', '.'):
stack, remain, count = [], [], []
while step < len(co.co_code):
op = ord(co.co_code[step])
step = step + 1
if op >= dis.HAVE_ARGUMENT:
opname = dis.opname[op]
value = ord(co.co_code[step]) + ord(co.co_code[step+1])*256
step = step + 2
if opname in ('UNPACK_TUPLE', 'UNPACK_SEQUENCE'):
remain.append(value)
count.append(value)
elif opname in ('STORE_FAST', 'STORE_DEREF'):
if opname == 'STORE_FAST':
stack.append(names[value])
else:
stack.append(co.co_cellvars[value])
# Special case for sublists of length 1: def foo((bar))
# doesn't generate the UNPACK_TUPLE bytecode, so if
# `remain` is empty here, we have such a sublist.
if not remain:
stack[0] = [stack[0]]
break
else:
remain[-1] = remain[-1] - 1
while remain[-1] == 0:
remain.pop()
size = count.pop()
stack[-size:] = [stack[-size:]]
if not remain: break
remain[-1] = remain[-1] - 1
if not remain: break
args[i] = stack[0]
varargs = None
if co.co_flags & CO_VARARGS:
varargs = co.co_varnames[nargs]
nargs = nargs + 1
varkw = None
if co.co_flags & CO_VARKEYWORDS:
varkw = co.co_varnames[nargs]
return Arguments(args, varargs, varkw)
ArgSpec = namedtuple('ArgSpec', 'args varargs keywords defaults')
def getargspec(func):
"""Get the names and default values of a function's arguments.
A tuple of four things is returned: (args, varargs, varkw, defaults).
'args' is a list of the argument names (it may contain nested lists).
'varargs' and 'varkw' are the names of the * and ** arguments or None.
'defaults' is an n-tuple of the default values of the last n arguments.
"""
if ismethod(func):
func = func.im_func
if not isfunction(func):
raise TypeError('{!r} is not a Python function'.format(func))
args, varargs, varkw = getargs(func.func_code)
return ArgSpec(args, varargs, varkw, func.func_defaults)
ArgInfo = namedtuple('ArgInfo', 'args varargs keywords locals')
def getargvalues(frame):
"""Get information about arguments passed into a particular frame.
A tuple of four things is returned: (args, varargs, varkw, locals).
'args' is a list of the argument names (it may contain nested lists).
'varargs' and 'varkw' are the names of the * and ** arguments or None.
'locals' is the locals dictionary of the given frame."""
args, varargs, varkw = getargs(frame.f_code)
return ArgInfo(args, varargs, varkw, frame.f_locals)
def joinseq(seq):
if len(seq) == 1:
return '(' + seq[0] + ',)'
else:
return '(' + string.join(seq, ', ') + ')'
def strseq(object, convert, join=joinseq):
"""Recursively walk a sequence, stringifying each element."""
if type(object) in (list, tuple):
return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object))
else:
return convert(object)
def formatargspec(args, varargs=None, varkw=None, defaults=None,
formatarg=str,
formatvarargs=lambda name: '*' + name,
formatvarkw=lambda name: '**' + name,
formatvalue=lambda value: '=' + repr(value),
join=joinseq):
"""Format an argument spec from the 4 values returned by getargspec.
The first four arguments are (args, varargs, varkw, defaults). The
other four arguments are the corresponding optional formatting functions
that are called to turn names and values into strings. The ninth
argument is an optional function to format the sequence of arguments."""
specs = []
if defaults:
firstdefault = len(args) - len(defaults)
for i, arg in enumerate(args):
spec = strseq(arg, formatarg, join)
if defaults and i >= firstdefault:
spec = spec + formatvalue(defaults[i - firstdefault])
specs.append(spec)
if varargs is not None:
specs.append(formatvarargs(varargs))
if varkw is not None:
specs.append(formatvarkw(varkw))
return '(' + string.join(specs, ', ') + ')'
def formatargvalues(args, varargs, varkw, locals,
formatarg=str,
formatvarargs=lambda name: '*' + name,
formatvarkw=lambda name: '**' + name,
formatvalue=lambda value: '=' + repr(value),
join=joinseq):
"""Format an argument spec from the 4 values returned by getargvalues.
The first four arguments are (args, varargs, varkw, locals). The
next four arguments are the corresponding optional formatting functions
that are called to turn names and values into strings. The ninth
argument is an optional function to format the sequence of arguments."""
def convert(name, locals=locals,
formatarg=formatarg, formatvalue=formatvalue):
return formatarg(name) + formatvalue(locals[name])
specs = []
for i in range(len(args)):
specs.append(strseq(args[i], convert, join))
if varargs:
specs.append(formatvarargs(varargs) + formatvalue(locals[varargs]))
if varkw:
specs.append(formatvarkw(varkw) + formatvalue(locals[varkw]))
return '(' + string.join(specs, ', ') + ')'
def getcallargs(func, *positional, **named):
"""Get the mapping of arguments to values.
A dict is returned, with keys the function argument names (including the
names of the * and ** arguments, if any), and values the respective bound
values from 'positional' and 'named'."""
args, varargs, varkw, defaults = getargspec(func)
f_name = func.__name__
arg2value = {}
# The following closures are basically because of tuple parameter unpacking.
assigned_tuple_params = []
def assign(arg, value):
if isinstance(arg, str):
arg2value[arg] = value
else:
assigned_tuple_params.append(arg)
value = iter(value)
for i, subarg in enumerate(arg):
try:
subvalue = next(value)
except StopIteration:
raise ValueError('need more than %d %s to unpack' %
(i, 'values' if i > 1 else 'value'))
assign(subarg,subvalue)
try:
next(value)
except StopIteration:
pass
else:
raise ValueError('too many values to unpack')
def is_assigned(arg):
if isinstance(arg,str):
return arg in arg2value
return arg in assigned_tuple_params
if ismethod(func) and func.im_self is not None:
# implicit 'self' (or 'cls' for classmethods) argument
positional = (func.im_self,) + positional
num_pos = len(positional)
num_total = num_pos + len(named)
num_args = len(args)
num_defaults = len(defaults) if defaults else 0
for arg, value in zip(args, positional):
assign(arg, value)
if varargs:
if num_pos > num_args:
assign(varargs, positional[-(num_pos-num_args):])
else:
assign(varargs, ())
elif 0 < num_args < num_pos:
raise TypeError('%s() takes %s %d %s (%d given)' % (
f_name, 'at most' if defaults else 'exactly', num_args,
'arguments' if num_args > 1 else 'argument', num_total))
elif num_args == 0 and num_total:
if varkw:
if num_pos:
# XXX: We should use num_pos, but Python also uses num_total:
raise TypeError('%s() takes exactly 0 arguments '
'(%d given)' % (f_name, num_total))
else:
raise TypeError('%s() takes no arguments (%d given)' %
(f_name, num_total))
for arg in args:
if isinstance(arg, str) and arg in named:
if is_assigned(arg):
raise TypeError("%s() got multiple values for keyword "
"argument '%s'" % (f_name, arg))
else:
assign(arg, named.pop(arg))
if defaults: # fill in any missing values with the defaults
for arg, value in zip(args[-num_defaults:], defaults):
if not is_assigned(arg):
assign(arg, value)
if varkw:
assign(varkw, named)
elif named:
unexpected = next(iter(named))
try:
unicode
except NameError:
pass
else:
if isinstance(unexpected, unicode):
unexpected = unexpected.encode(sys.getdefaultencoding(), 'replace')
raise TypeError("%s() got an unexpected keyword argument '%s'" %
(f_name, unexpected))
unassigned = num_args - len([arg for arg in args if is_assigned(arg)])
if unassigned:
num_required = num_args - num_defaults
raise TypeError('%s() takes %s %d %s (%d given)' % (
f_name, 'at least' if defaults else 'exactly', num_required,
'arguments' if num_required > 1 else 'argument', num_total))
return arg2value
# -------------------------------------------------- stack frame extraction
Traceback = namedtuple('Traceback', 'filename lineno function code_context index')
def getframeinfo(frame, context=1):
"""Get information about a frame or traceback object.
A tuple of five things is returned: the filename, the line number of
the current line, the function name, a list of lines of context from
the source code, and the index of the current line within that list.
The optional second argument specifies the number of lines of context
to return, which are centered around the current line."""
if istraceback(frame):
lineno = frame.tb_lineno
frame = frame.tb_frame
else:
lineno = frame.f_lineno
if not isframe(frame):
raise TypeError('{!r} is not a frame or traceback object'.format(frame))
filename = getsourcefile(frame) or getfile(frame)
if context > 0:
start = lineno - 1 - context//2
try:
lines, lnum = findsource(frame)
except IOError:
lines = index = None
else:
start = max(start, 1)
start = max(0, min(start, len(lines) - context))
lines = lines[start:start+context]
index = lineno - 1 - start
else:
lines = index = None
return Traceback(filename, lineno, frame.f_code.co_name, lines, index)
def getlineno(frame):
"""Get the line number from a frame object, allowing for optimization."""
# FrameType.f_lineno is now a descriptor that grovels co_lnotab
return frame.f_lineno
def getouterframes(frame, context=1):
"""Get a list of records for a frame and all higher (calling) frames.
Each record contains a frame object, filename, line number, function
name, a list of lines of context, and index within the context."""
framelist = []
while frame:
framelist.append((frame,) + getframeinfo(frame, context))
frame = frame.f_back
return framelist
def getinnerframes(tb, context=1):
"""Get a list of records for a traceback's frame and all lower frames.
Each record contains a frame object, filename, line number, function
name, a list of lines of context, and index within the context."""
framelist = []
while tb:
framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
tb = tb.tb_next
return framelist
if hasattr(sys, '_getframe'):
currentframe = sys._getframe
else:
currentframe = lambda _=None: None
def stack(context=1):
"""Return a list of records for the stack above the caller's frame."""
return getouterframes(sys._getframe(1), context)
def trace(context=1):
"""Return a list of records for the stack below the current exception."""
return getinnerframes(sys.exc_info()[2], context)
|
[
"string.lower",
"imp.get_suffixes",
"sys.getdefaultencoding",
"string.expandtabs",
"sys.exc_info",
"sys.modules.get",
"string.join",
"os.path.abspath",
"os.path.exists",
"string.lstrip",
"linecache.getlines",
"string.strip",
"os.path.basename",
"os.path.realpath",
"sys._getframe",
"operator.attrgetter",
"re.compile",
"sys.modules.items",
"collections.namedtuple"
] |
[((11019, 11077), 'collections.namedtuple', 'namedtuple', (['"""Attribute"""', '"""name kind defining_class object"""'], {}), "('Attribute', 'name kind defining_class object')\n", (11029, 11077), False, 'from collections import namedtuple\n'), ((16747, 16803), 'collections.namedtuple', 'namedtuple', (['"""ModuleInfo"""', '"""name suffix mode module_type"""'], {}), "('ModuleInfo', 'name suffix mode module_type')\n", (16757, 16803), False, 'from collections import namedtuple\n'), ((29543, 29591), 'collections.namedtuple', 'namedtuple', (['"""Arguments"""', '"""args varargs keywords"""'], {}), "('Arguments', 'args varargs keywords')\n", (29553, 29591), False, 'from collections import namedtuple\n'), ((32120, 32175), 'collections.namedtuple', 'namedtuple', (['"""ArgSpec"""', '"""args varargs keywords defaults"""'], {}), "('ArgSpec', 'args varargs keywords defaults')\n", (32130, 32175), False, 'from collections import namedtuple\n'), ((32848, 32901), 'collections.namedtuple', 'namedtuple', (['"""ArgInfo"""', '"""args varargs keywords locals"""'], {}), "('ArgInfo', 'args varargs keywords locals')\n", (32858, 32901), False, 'from collections import namedtuple\n'), ((40046, 40116), 'collections.namedtuple', 'namedtuple', (['"""Traceback"""', '"""filename lineno function code_context index"""'], {}), "('Traceback', 'filename lineno function code_context index')\n", (40056, 40116), False, 'from collections import namedtuple\n'), ((14287, 14310), 'string.expandtabs', 'string.expandtabs', (['line'], {}), '(line)\n', (14304, 14310), False, 'import string\n'), ((16924, 16946), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (16940, 16946), False, 'import os\n'), ((17788, 17806), 'imp.get_suffixes', 'imp.get_suffixes', ([], {}), '()\n', (17804, 17806), False, 'import imp\n'), ((17992, 18016), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (18006, 18016), False, 'import os\n'), ((19527, 19546), 'sys.modules.items', 'sys.modules.items', ([], {}), '()\n', (19544, 19546), False, 'import sys\n'), ((27913, 27935), 'string.join', 'string.join', (['lines', '""""""'], {}), "(lines, '')\n", (27924, 27935), False, 'import string\n'), ((15793, 15817), 'string.join', 'string.join', (['lines', '"""\n"""'], {}), "(lines, '\\n')\n", (15804, 15817), False, 'import string\n'), ((16124, 16158), 'sys.modules.get', 'sys.modules.get', (['object.__module__'], {}), '(object.__module__)\n', (16139, 16158), False, 'import sys\n'), ((17062, 17080), 'imp.get_suffixes', 'imp.get_suffixes', ([], {}), '()\n', (17078, 17080), False, 'import imp\n'), ((17668, 17695), 'string.lower', 'string.lower', (['filename[-4:]'], {}), '(filename[-4:])\n', (17680, 17695), False, 'import string\n'), ((18651, 18677), 'os.path.abspath', 'os.path.abspath', (['_filename'], {}), '(_filename)\n', (18666, 18677), False, 'import os\n'), ((18936, 18970), 'sys.modules.get', 'sys.modules.get', (['object.__module__'], {}), '(object.__module__)\n', (18951, 18970), False, 'import sys\n'), ((19090, 19131), 'sys.modules.get', 'sys.modules.get', (['modulesbyfile[_filename]'], {}), '(modulesbyfile[_filename])\n', (19105, 19131), False, 'import sys\n'), ((19327, 19363), 'sys.modules.get', 'sys.modules.get', (['modulesbyfile[file]'], {}), '(modulesbyfile[file])\n', (19342, 19363), False, 'import sys\n'), ((20070, 20106), 'sys.modules.get', 'sys.modules.get', (['modulesbyfile[file]'], {}), '(modulesbyfile[file])\n', (20085, 20106), False, 'import sys\n'), ((21282, 21323), 'linecache.getlines', 'linecache.getlines', (['file', 'module.__dict__'], {}), '(file, module.__dict__)\n', (21300, 21323), False, 'import linecache\n'), ((21350, 21374), 'linecache.getlines', 'linecache.getlines', (['file'], {}), '(file)\n', (21368, 21374), False, 'import linecache\n'), ((21564, 21609), 're.compile', 're.compile', (["('^(\\\\s*)class\\\\s*' + name + '\\\\b')"], {}), "('^(\\\\s*)class\\\\s*' + name + '\\\\b')\n", (21574, 21609), False, 'import re\n'), ((22883, 22945), 're.compile', 're.compile', (['"""^(\\\\s*def\\\\s)|(.*(?<!\\\\w)lambda(:|\\\\s))|^(\\\\s*@)"""'], {}), "('^(\\\\s*def\\\\s)|(.*(?<!\\\\w)lambda(:|\\\\s))|^(\\\\s*@)')\n", (22893, 22945), False, 'import re\n'), ((42589, 42605), 'sys._getframe', 'sys._getframe', (['(1)'], {}), '(1)\n', (42602, 42605), False, 'import sys\n'), ((14341, 14363), 'string.lstrip', 'string.lstrip', (['expline'], {}), '(expline)\n', (14354, 14363), False, 'import string\n'), ((15024, 15046), 'string.expandtabs', 'string.expandtabs', (['doc'], {}), '(doc)\n', (15041, 15046), False, 'import string\n'), ((23920, 23945), 'string.join', 'string.join', (['comments', '""""""'], {}), "(comments, '')\n", (23931, 23945), False, 'import string\n'), ((28148, 28184), 'operator.attrgetter', 'attrgetter', (['"""__module__"""', '"""__name__"""'], {}), "('__module__', '__name__')\n", (28158, 28184), False, 'from operator import attrgetter\n'), ((34923, 34947), 'string.join', 'string.join', (['specs', '""", """'], {}), "(specs, ', ')\n", (34934, 34947), False, 'import string\n'), ((36077, 36101), 'string.join', 'string.join', (['specs', '""", """'], {}), "(specs, ', ')\n", (36088, 36101), False, 'import string\n'), ((42743, 42757), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (42755, 42757), False, 'import sys\n'), ((15270, 15289), 'string.lstrip', 'string.lstrip', (['line'], {}), '(line)\n', (15283, 15289), False, 'import string\n'), ((19986, 20005), 'os.path.realpath', 'os.path.realpath', (['f'], {}), '(f)\n', (20002, 20005), False, 'import os\n'), ((23566, 23592), 'string.strip', 'string.strip', (['lines[start]'], {}), '(lines[start])\n', (23578, 23592), False, 'import string\n'), ((24898, 24923), 'string.join', 'string.join', (['comments', '""""""'], {}), "(comments, '')\n", (24909, 24923), False, 'import string\n'), ((33495, 33517), 'string.join', 'string.join', (['seq', '""", """'], {}), "(seq, ', ')\n", (33506, 33517), False, 'import string\n'), ((23840, 23869), 'string.expandtabs', 'string.expandtabs', (['lines[end]'], {}), '(lines[end])\n', (23857, 23869), False, 'import string\n'), ((24124, 24149), 'string.lstrip', 'string.lstrip', (['lines[end]'], {}), '(lines[end])\n', (24137, 24149), False, 'import string\n'), ((24251, 24280), 'string.expandtabs', 'string.expandtabs', (['lines[end]'], {}), '(lines[end])\n', (24268, 24280), False, 'import string\n'), ((24377, 24406), 'string.expandtabs', 'string.expandtabs', (['lines[end]'], {}), '(lines[end])\n', (24394, 24406), False, 'import string\n'), ((24710, 24735), 'string.strip', 'string.strip', (['comments[0]'], {}), '(comments[0])\n', (24722, 24735), False, 'import string\n'), ((24809, 24835), 'string.strip', 'string.strip', (['comments[-1]'], {}), '(comments[-1])\n', (24821, 24835), False, 'import string\n'), ((39431, 39455), 'sys.getdefaultencoding', 'sys.getdefaultencoding', ([], {}), '()\n', (39453, 39455), False, 'import sys\n'), ((24648, 24677), 'string.expandtabs', 'string.expandtabs', (['lines[end]'], {}), '(lines[end])\n', (24665, 24677), False, 'import string\n')]
|
# Based on https://colab.research.google.com/github/reiinakano/neural-painters/blob/master/notebooks/generate_stroke_examples.ipynb
from lib import surface, tiledsurface, brush
import torch
import numpy as np
from PIL import Image
def point_on_curve_1(t, cx, cy, sx, sy, x1, y1, x2, y2):
ratio = t / 100.0
x3, y3 = multiply_add(sx, sy, x1, y1, ratio)
x4, y4 = multiply_add(cx, cy, x2, y2, ratio)
x5, y5 = difference(x3, y3, x4, y4)
x, y = multiply_add(x3, y3, x5, y5, ratio)
return x, y
def length_and_normal(x1, y1, x2, y2):
x, y = difference(x1, y1, x2, y2)
length = np.sqrt(x * x + y * y)
if length == 0.0:
x, y = 0.0, 0.0
else:
x, y = x / length, y / length
return length, x, y
def multiply_add(x1, y1, x2, y2, d):
x3, y3 = multiply(x2, y2, d)
x, y = add(x1, y1, x3, y3)
return x, y
def multiply(x, y, d):
# Multiply vector
x = x * d
y = y * d
return x, y
def add(x1, y1, x2, y2):
# Add vectors
x = x1 + x2
y = y1 + y2
return x, y
def difference(x1, y1, x2, y2):
# Difference in x and y between two points
x = x2 - x1
y = y2 - y1
return x, y
def midpoint(x1, y1, x2, y2):
# Midpoint between 2 points
x = (x1 + x2) / 2.0
y = (y1 + y2) / 2.0
return x, y
class MyPaintImagesDataLoader:
def __init__(self, H=32, W=32):
self.rng = np.random.default_rng(42)
self.head = 0.25
self.tail = 0.75
self.surface = tiledsurface.Surface()
with open("gan_stroke_generator/brushes/classic/dry_brush.myb") as brush_file:
self.brush_info = brush.BrushInfo(brush_file.read())
self.brush = brush.Brush(self.brush_info)
self.H = H
self.W = W
self.num_action = 9
self.num_images = int(10e9)
def _stroke_to(self, x, y, pressure):
duration = 0.1
self.brush.stroke_to(
self.surface.backend, x, y, pressure, 0.0, 0.0, duration, 0.0, 0.0, 0.0
)
self.surface.end_atomic()
self.surface.begin_atomic()
def _line_settings(self, entry_pressure, pressure):
p2 = (entry_pressure + pressure) / 2
prange1 = p2 - entry_pressure
prange2 = pressure - p2
return p2, prange1, prange2
def curve(
self, control_x, control_y, start_x, start_y, ex, ey, entry_pressure, pressure
):
(
midpoint_p,
prange1,
prange2,
) = self._line_settings(entry_pressure, pressure)
points_in_curve = 100
mx, my = midpoint(start_x, start_y, ex, ey)
length, nx, ny = length_and_normal(mx, my, control_x, control_y)
cx, cy = multiply_add(mx, my, nx, ny, length * 2)
x1, y1 = difference(start_x, start_y, cx, cy)
x2, y2 = difference(cx, cy, ex, ey)
head = points_in_curve * self.head
head_range = int(head) + 1
tail = points_in_curve * self.tail
tail_range = int(tail) + 1
tail_length = points_in_curve - tail
# Beginning
px, py = point_on_curve_1(1, cx, cy, start_x, start_y, x1, y1, x2, y2)
length, nx, ny = length_and_normal(start_x, start_y, px, py)
bx, by = multiply_add(start_x, start_y, nx, ny, 0.25)
self._stroke_to(bx, by, entry_pressure)
pressure = abs(1 / head * prange1 + entry_pressure)
self._stroke_to(px, py, pressure)
for i in range(2, head_range):
px, py = point_on_curve_1(i, cx, cy, start_x, start_y, x1, y1, x2, y2)
pressure = abs(i / head * prange1 + entry_pressure)
self._stroke_to(px, py, pressure)
# Middle
for i in range(head_range, tail_range):
px, py = point_on_curve_1(i, cx, cy, start_x, start_y, x1, y1, x2, y2)
self._stroke_to(px, py, midpoint_p)
# End
for i in range(tail_range, points_in_curve + 1):
px, py = point_on_curve_1(i, cx, cy, start_x, start_y, x1, y1, x2, y2)
pressure = abs((i - tail) / tail_length * prange2 + midpoint_p)
self._stroke_to(px, py, pressure)
return pressure
def draw_stroke(
self,
start_x,
start_y,
end_x,
end_y,
control_x,
control_y,
entry_pressure,
pressure,
size,
color_rgb,
):
start_x = start_x * self.H
start_y = start_y * self.W
end_x = end_x * self.H
end_y = end_y * self.W
control_x = control_x * self.H
control_y = control_y * self.W
self.brush.brushinfo.set_color_rgb(color_rgb)
self.brush.brushinfo.set_base_value("radius_logarithmic", size)
# Move brush to starting point without leaving it on the canvas.
self._stroke_to(start_x, start_y, 0)
self.curve(
control_x,
control_y,
start_x,
start_y,
end_x,
end_y,
entry_pressure,
pressure,
)
# Relieve brush pressure for next jump
self._stroke_to(end_x, end_y, 0)
self.surface.end_atomic()
self.surface.begin_atomic()
def get_mypaint_image(
self,
start_x,
start_y,
end_x,
end_y,
control_x,
control_y,
entry_pressure,
pressure,
size,
color_rgb,
):
self.draw_stroke(
start_x,
start_y,
end_x,
end_y,
control_x,
control_y,
entry_pressure,
pressure,
size,
color_rgb,
)
rect = [0, 0, self.H, self.W]
scanline_strips = surface.scanline_strips_iter(self.surface, rect, single_tile_pattern=True)
img = next(scanline_strips)
self.surface.clear()
self.surface.end_atomic()
self.surface.begin_atomic()
return img
def random_action(self):
return self.rng.uniform(size=[self.num_action])
def __len__(self):
return self.num_images
def __iter__(self):
for _ in range(self.num_images):
action = self.random_action()
img = self.get_mypaint_image(
start_x=action[0],
start_y=action[1],
end_x=action[2],
end_y=action[3],
control_x=action[4],
control_y=action[5],
pressure=action[6],
entry_pressure=action[7],
size=action[8],
color_rgb=[1, 1, 1],
)
img = Image.fromarray(img).convert('L')
# We need to create batch of size 1
img = np.expand_dims(img, axis=0)
# We need to create a channel for img
img = np.expand_dims(img, axis=0)
action = np.expand_dims(action, axis=0)
yield {
"stroke": torch.from_numpy(img.astype(float) / 255.0),
"action": torch.from_numpy(action),
}
|
[
"torch.from_numpy",
"lib.tiledsurface.Surface",
"lib.brush.Brush",
"lib.surface.scanline_strips_iter",
"numpy.expand_dims",
"numpy.random.default_rng",
"PIL.Image.fromarray",
"numpy.sqrt"
] |
[((607, 629), 'numpy.sqrt', 'np.sqrt', (['(x * x + y * y)'], {}), '(x * x + y * y)\n', (614, 629), True, 'import numpy as np\n'), ((1396, 1421), 'numpy.random.default_rng', 'np.random.default_rng', (['(42)'], {}), '(42)\n', (1417, 1421), True, 'import numpy as np\n'), ((1495, 1517), 'lib.tiledsurface.Surface', 'tiledsurface.Surface', ([], {}), '()\n', (1515, 1517), False, 'from lib import surface, tiledsurface, brush\n'), ((1691, 1719), 'lib.brush.Brush', 'brush.Brush', (['self.brush_info'], {}), '(self.brush_info)\n', (1702, 1719), False, 'from lib import surface, tiledsurface, brush\n'), ((5742, 5816), 'lib.surface.scanline_strips_iter', 'surface.scanline_strips_iter', (['self.surface', 'rect'], {'single_tile_pattern': '(True)'}), '(self.surface, rect, single_tile_pattern=True)\n', (5770, 5816), False, 'from lib import surface, tiledsurface, brush\n'), ((6752, 6779), 'numpy.expand_dims', 'np.expand_dims', (['img'], {'axis': '(0)'}), '(img, axis=0)\n', (6766, 6779), True, 'import numpy as np\n'), ((6848, 6875), 'numpy.expand_dims', 'np.expand_dims', (['img'], {'axis': '(0)'}), '(img, axis=0)\n', (6862, 6875), True, 'import numpy as np\n'), ((6897, 6927), 'numpy.expand_dims', 'np.expand_dims', (['action'], {'axis': '(0)'}), '(action, axis=0)\n', (6911, 6927), True, 'import numpy as np\n'), ((6652, 6672), 'PIL.Image.fromarray', 'Image.fromarray', (['img'], {}), '(img)\n', (6667, 6672), False, 'from PIL import Image\n'), ((7045, 7069), 'torch.from_numpy', 'torch.from_numpy', (['action'], {}), '(action)\n', (7061, 7069), False, 'import torch\n')]
|
#!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtksurfaceresolution.py,v $
## Language: Python
## Date: $$
## Version: $$
## Copyright (c) <NAME>, <NAME>. All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE. See the above copyright notices for more information.
## Note: this class was contributed by
## <NAME>
## Kalkulo AS
## Simula Research Laboratory
## This allows the user to specify a edge-length array to be used to specify resolution for surface remeshing
## The array is produced by RBF interpolation of values specified by the user by positioning spheres
from __future__ import absolute_import #NEEDS TO STAY AS TOP LEVEL MODULE FOR Py2-3 COMPATIBILITY
import vtk
import sys
from vmtk import vtkvmtk
from vmtk import vmtkrenderer
from vmtk import pypes
class vmtkSufaceResolution(pypes.pypeScript):
def __init__(self):
pypes.pypeScript.__init__(self)
self.Surface = None
self.ResolutionArrayName = 'ResolutionArray'
self.RBFType = 'biharmonic'
self.Spheres = vtk.vtkPolyData()
self.vmtkRenderer = None
self.OwnRenderer = 0
self.DisplayArray = False
self.SurfaceMapper = None
self.CurrentSphereId = -1
self.SphereWidget = None
self.Opacity = 1.
self.SpheresActor = None
self.ScalarBarActor = None
self.InteractionMode = 0
self.ExamineSurface = None
self.ExamineSpheres = vtk.vtkPolyData()
self.ExamineSpheresActor = None
self.ExamineText = None
self.SetScriptName('vmtksurfaceresolution')
self.SetScriptDoc('This allows the user to specify a edge-length array to be used to specify resolution for surface remeshing \
The array is produced by RBF interpolation of values specified by the user by positioning spheres')
self.SetInputMembers([
['Surface','i','vtkPolyData',1,'','the input surface','vmtksurfacereader'],
['ResolutionArrayName','resolutionarray','str',1,'','array storing the desired edge length'],
['RBFType','rbftype','str',1,'["thinplatespline","biharmonic","triharmonic"]','the type of RBF interpolation'],
['Opacity','opacity','float',1,'(0.0,1.0)','object opacities in the scene'],
['vmtkRenderer','renderer','vmtkRenderer',1,'','external renderer']
])
self.SetOutputMembers([
['Surface','o','vtkPolyData',1,'','','vmtksurfacewriter']
])
def ComputeArray(self):
rbf = vtkvmtk.vtkvmtkRBFInterpolation2()
rbf.SetSource(self.Spheres)
if self.RBFType == "thinplatespline":
rbf.SetRBFTypeToThinPlateSpline()
elif self.RBFType == "biharmonic":
rbf.SetRBFTypeToBiharmonic()
elif self.RBFType == "triharmonic":
rbf.SetRBFTypeToTriharmonic()
rbf.ComputeCoefficients()
sampler = vtkvmtk.vtkvmtkPolyDataSampleFunction()
sampler.SetInputData(self.Surface)
sampler.SetImplicitFunction(rbf)
sampler.SetSampleArrayName(self.ResolutionArrayName)
sampler.Update()
return sampler.GetOutput()
def InitializeSpheres(self):
if (self.InteractionMode==0):
self.Spheres.Initialize()
seedPoints = vtk.vtkPoints()
self.Spheres.SetPoints(seedPoints)
self.Spheres.GetPointData().Initialize()
seedRadii = vtk.vtkDoubleArray()
self.Spheres.GetPointData().SetScalars(seedRadii)
self.CurrentSphereId = -1
self.SphereWidget.Off()
else:
self.ExamineSpheres.Initialize()
spherePoints = vtk.vtkPoints()
self.ExamineSpheres.SetPoints(spherePoints)
self.ExamineSpheres.GetPointData().Initialize()
sphereRadii = vtk.vtkDoubleArray()
self.ExamineSpheres.GetPointData().SetScalars(sphereRadii)
def PlaceSphere(self):
if self.CurrentSphereId == -1:
return
self.SphereWidget.SetCenter(self.Spheres.GetPoint(self.CurrentSphereId))
self.SphereWidget.SetRadius(self.Spheres.GetPointData().GetScalars().GetValue(self.CurrentSphereId))
def SphereCallback(self,widget,event_string):
if self.CurrentSphereId == -1:
return
minRadius = self.Surface.GetLength()*0.001
if self.SphereWidget.GetRadius() < minRadius:
self.SphereWidget.SetRadius(minRadius)
self.Spheres.GetPoints().SetPoint(self.CurrentSphereId,self.SphereWidget.GetCenter())
self.Spheres.GetPointData().GetScalars().SetValue(self.CurrentSphereId,self.SphereWidget.GetRadius())
self.Spheres.Modified()
def UndoCallback(self,obj):
self.InitializeSpheres()
self.Spheres.Modified()
self.vmtkRenderer.RenderWindow.Render()
def PickCallback(self,obj):
picker = vtk.vtkCellPicker()
picker.SetTolerance(1E-4 * self.Surface.GetLength())
eventPosition = self.vmtkRenderer.RenderWindowInteractor.GetEventPosition()
#eventPosition = obj.GetEventPosition()
result = picker.Pick(float(eventPosition[0]),float(eventPosition[1]),0.0,self.vmtkRenderer.Renderer)
if result == 0:
return
pickPosition = picker.GetPickPosition()
if (self.InteractionMode==0):
self.CurrentSphereId = self.Spheres.GetPoints().InsertNextPoint(pickPosition)
self.Spheres.GetPointData().GetScalars().InsertNextValue(self.Surface.GetLength()*0.01)
self.Spheres.Modified()
self.PlaceSphere()
self.SphereWidget.On()
else:
pickedCellPointIds = self.Surface.GetCell(picker.GetCellId()).GetPointIds()
minDistance = 1E10
pickedPointId = -1
for i in range(pickedCellPointIds.GetNumberOfIds()):
distance = vtk.vtkMath.Distance2BetweenPoints(pickPosition,self.Surface.GetPoint(pickedCellPointIds.GetId(i)))
if distance < minDistance:
minDistance = distance
pickedPointId = pickedCellPointIds.GetId(i)
if pickedPointId == -1:
pickedPointId = pickedCellPointIds.GetId(0)
point = self.Surface.GetPoint(pickedPointId)
self.ExamineSpheres.GetPoints().InsertNextPoint(point)
length = 0.
array = self.ExamineSurface.GetPointData().GetArray(self.ResolutionArrayName)
if (array):
length = array.GetComponent(pickedPointId,0)
self.ExamineSpheres.GetPointData().GetScalars().InsertNextValue(length)
self.ExamineSpheres.Modified()
self.vmtkRenderer.RenderWindow.Render()
def IncreaseSphereRadiusCallback(self,obj):
if self.CurrentSphereId != -1:
newval = self.Spheres.GetPointData().GetScalars().GetValue(self.CurrentSphereId) + self.Surface.GetLength()*0.01
self.Spheres.GetPointData().GetScalars().SetValue(self.CurrentSphereId,newval)
self.Spheres.Modified()
self.PlaceSphere()
self.vmtkRenderer.RenderWindow.Render()
def DecreaseSphereRadiusCallback(self,obj):
if self.CurrentSphereId != -1:
newval = self.Spheres.GetPointData().GetScalars().GetValue(self.CurrentSphereId) - self.Surface.GetLength()*0.01
if newval> 0:
self.Spheres.GetPointData().GetScalars().SetValue(self.CurrentSphereId,newval)
self.Spheres.Modified()
self.PlaceSphere()
self.vmtkRenderer.RenderWindow.Render()
def NextCallback(self,obj):
if self.CurrentSphereId != -1:
self.CurrentSphereId = (self.CurrentSphereId + 1) % self.Spheres.GetNumberOfPoints();
self.PlaceSphere()
self.vmtkRenderer.RenderWindow.Render()
def PreviousCallback(self,obj):
if self.CurrentSphereId != -1:
self.CurrentSphereId = (self.CurrentSphereId - 1) % self.Spheres.GetNumberOfPoints();
self.PlaceSphere()
self.vmtkRenderer.RenderWindow.Render()
def DistancesCallback(self,obj):
self.DisplayArray = not self.DisplayArray
if self.DisplayArray:
self.ExamineSurface = self.ComputeArray()
self.SurfaceMapper.SetInputData(self.ExamineSurface)
self.ExamineSurface.GetPointData().SetActiveScalars(self.ResolutionArrayName)
array = self.ExamineSurface.GetPointData().GetScalars()
if (array):
array.Modified()
self.SurfaceMapper.SetScalarRange(array.GetRange(0))
self.ScalarBarActor.VisibilityOn()
else:
self.SurfaceMapper.SetInputData(self.Surface)
self.ScalarBarActor.VisibilityOff()
self.SurfaceMapper.SetScalarVisibility(self.DisplayArray)
self.vmtkRenderer.RenderWindow.Render()
def ExamineCallback(self,obj):
#Switch beetween examien and interact mode
if self.InteractionMode == 0:
self.InteractionMode = 1
self.ExamineSurface = self.ComputeArray()
#self.SpheresActor.VisibilityOff()
self.SphereWidget.Off()
self.ExamineSpheresActor.VisibilityOn()
self.ExamineText.VisibilityOn()
self.InitializeSpheres()
else:
self.InteractionMode = 0
#Compute the distances
self.SpheresActor.VisibilityOn()
self.ExamineSpheresActor.VisibilityOff()
self.ExamineText.VisibilityOff()
if (self.CurrentSphereId!=-1):
self.SphereWidget.On()
self.vmtkRenderer.RenderWindow.Render()
def Execute(self):
if self.Surface == None:
self.PrintError('Error: No input surface.')
if not self.vmtkRenderer:
self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
self.vmtkRenderer.Initialize()
self.OwnRenderer = 1
self.vmtkRenderer.RegisterScript(self)
glyphs = vtk.vtkGlyph3D()
glyphSource = vtk.vtkSphereSource()
glyphSource.SetRadius(1)
glyphs.SetInputData(self.Spheres)
glyphs.SetSourceConnection(glyphSource.GetOutputPort())
glyphs.SetScaleModeToScaleByScalar()
glyphs.SetScaleFactor(1.)
glyphMapper = vtk.vtkPolyDataMapper()
glyphMapper.SetInputConnection(glyphs.GetOutputPort())
glyphMapper.ScalarVisibilityOff()
self.SpheresActor = vtk.vtkActor()
self.SpheresActor.SetMapper(glyphMapper)
self.SpheresActor.GetProperty().SetColor(1.0,0.0,0.0)
self.SpheresActor.GetProperty().SetOpacity(self.Opacity)
self.SpheresActor.PickableOff()
self.vmtkRenderer.Renderer.AddActor(self.SpheresActor)
examineGlyphs = vtk.vtkGlyph3D()
examineGlyphSource = vtk.vtkSphereSource()
examineGlyphSource.SetRadius(1)
examineGlyphs.SetInputData(self.ExamineSpheres)
examineGlyphs.SetSourceConnection(examineGlyphSource.GetOutputPort())
examineGlyphs.SetScaleModeToScaleByScalar()
examineGlyphs.SetScaleFactor(1.)
examineGlyphMapper = vtk.vtkPolyDataMapper()
examineGlyphMapper.SetInputConnection(examineGlyphs.GetOutputPort())
examineGlyphMapper.ScalarVisibilityOff()
self.ExamineSpheresActor = vtk.vtkActor()
self.ExamineSpheresActor.SetMapper(examineGlyphMapper)
self.ExamineSpheresActor.GetProperty().SetColor(0.0,1.0,0.0)
self.ExamineSpheresActor.GetProperty().SetOpacity(self.Opacity)
self.ExamineSpheresActor.PickableOff()
self.ExamineSpheresActor.VisibilityOff()
self.vmtkRenderer.Renderer.AddActor(self.ExamineSpheresActor)
self.vmtkRenderer.AddKeyBinding('u','Undo.',self.UndoCallback)
self.vmtkRenderer.AddKeyBinding('space','Place picks.',self.PickCallback)
self.vmtkRenderer.AddKeyBinding('+','Increase sphere radius.',self.IncreaseSphereRadiusCallback)
self.vmtkRenderer.AddKeyBinding('-','Decrease sphere radius.',self.DecreaseSphereRadiusCallback)
self.vmtkRenderer.AddKeyBinding('n','Skip to next sphere.',self.NextCallback)
self.vmtkRenderer.AddKeyBinding('v','Skip to previous sphere.',self.PreviousCallback)
self.vmtkRenderer.AddKeyBinding('d','Show distances graph.',self.DistancesCallback)
self.vmtkRenderer.AddKeyBinding('x','Examine mode.',self.ExamineCallback)
#self.vmtkRenderer.RenderWindowInteractor.AddObserver("KeyPressEvent", self.KeyPressed)
self.SurfaceMapper = vtk.vtkPolyDataMapper()
self.SurfaceMapper.SetInputData(self.Surface)
self.SurfaceMapper.SetScalarVisibility(self.DisplayArray)
surfaceActor = vtk.vtkActor()
surfaceActor.SetMapper(self.SurfaceMapper)
surfaceActor.GetProperty().SetOpacity(self.Opacity)
self.vmtkRenderer.Renderer.AddActor(surfaceActor)
self.ScalarBarActor = vtk.vtkScalarBarActor()
self.ScalarBarActor.SetLookupTable(self.SurfaceMapper.GetLookupTable())
self.ScalarBarActor.GetLabelTextProperty().ItalicOff()
self.ScalarBarActor.GetLabelTextProperty().BoldOff()
self.ScalarBarActor.GetLabelTextProperty().ShadowOff()
self.ScalarBarActor.SetLabelFormat('%.2f')
self.ScalarBarActor.SetTitle('distances')
self.ScalarBarActor.VisibilityOff()
self.vmtkRenderer.Renderer.AddActor(self.ScalarBarActor)
self.SphereWidget = vtk.vtkSphereWidget()
self.SphereWidget.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.SphereWidget.AddObserver("InteractionEvent", self.SphereCallback)
self.ExamineText = vtk.vtkTextActor()
self.ExamineText.SetInput("Examine Mode")
self.ExamineText.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport()
self.ExamineText.SetPosition(0.05,0.95)
self.ExamineText.VisibilityOff()
self.vmtkRenderer.Renderer.AddActor2D(self.ExamineText)
self.InputInfo('Please position the mouse and press space to add spheres, \'u\' to undo\n')
any = 0
while any == 0:
self.InitializeSpheres()
self.vmtkRenderer.Render()
any = (self.Spheres.GetNumberOfPoints()>1)
self.InputInfo('Please position the mouse and press space to add spheres, \'u\' to undo\nInsert at least 2 spheres.')
self.Surface = self.ComputeArray()
if self.OwnRenderer:
self.vmtkRenderer.Deallocate()
if __name__=='__main__':
main = pypes.pypeMain()
main.Arguments = sys.argv
main.Execute()
|
[
"vtk.vtkPolyDataMapper",
"vmtk.vtkvmtk.vtkvmtkPolyDataSampleFunction",
"vtk.vtkPoints",
"vtk.vtkCellPicker",
"vtk.vtkDoubleArray",
"vtk.vtkGlyph3D",
"vtk.vtkScalarBarActor",
"vtk.vtkActor",
"vmtk.vtkvmtk.vtkvmtkRBFInterpolation2",
"vmtk.pypes.pypeScript.__init__",
"vtk.vtkTextActor",
"vtk.vtkPolyData",
"vtk.vtkSphereWidget",
"vtk.vtkSphereSource",
"vmtk.vmtkrenderer.vmtkRenderer",
"vmtk.pypes.pypeMain"
] |
[((14858, 14874), 'vmtk.pypes.pypeMain', 'pypes.pypeMain', ([], {}), '()\n', (14872, 14874), False, 'from vmtk import pypes\n'), ((1069, 1100), 'vmtk.pypes.pypeScript.__init__', 'pypes.pypeScript.__init__', (['self'], {}), '(self)\n', (1094, 1100), False, 'from vmtk import pypes\n'), ((1242, 1259), 'vtk.vtkPolyData', 'vtk.vtkPolyData', ([], {}), '()\n', (1257, 1259), False, 'import vtk\n'), ((1649, 1666), 'vtk.vtkPolyData', 'vtk.vtkPolyData', ([], {}), '()\n', (1664, 1666), False, 'import vtk\n'), ((2748, 2782), 'vmtk.vtkvmtk.vtkvmtkRBFInterpolation2', 'vtkvmtk.vtkvmtkRBFInterpolation2', ([], {}), '()\n', (2780, 2782), False, 'from vmtk import vtkvmtk\n'), ((3133, 3172), 'vmtk.vtkvmtk.vtkvmtkPolyDataSampleFunction', 'vtkvmtk.vtkvmtkPolyDataSampleFunction', ([], {}), '()\n', (3170, 3172), False, 'from vmtk import vtkvmtk\n'), ((5119, 5138), 'vtk.vtkCellPicker', 'vtk.vtkCellPicker', ([], {}), '()\n', (5136, 5138), False, 'import vtk\n'), ((10308, 10324), 'vtk.vtkGlyph3D', 'vtk.vtkGlyph3D', ([], {}), '()\n', (10322, 10324), False, 'import vtk\n'), ((10347, 10368), 'vtk.vtkSphereSource', 'vtk.vtkSphereSource', ([], {}), '()\n', (10366, 10368), False, 'import vtk\n'), ((10609, 10632), 'vtk.vtkPolyDataMapper', 'vtk.vtkPolyDataMapper', ([], {}), '()\n', (10630, 10632), False, 'import vtk\n'), ((10766, 10780), 'vtk.vtkActor', 'vtk.vtkActor', ([], {}), '()\n', (10778, 10780), False, 'import vtk\n'), ((11085, 11101), 'vtk.vtkGlyph3D', 'vtk.vtkGlyph3D', ([], {}), '()\n', (11099, 11101), False, 'import vtk\n'), ((11131, 11152), 'vtk.vtkSphereSource', 'vtk.vtkSphereSource', ([], {}), '()\n', (11150, 11152), False, 'import vtk\n'), ((11449, 11472), 'vtk.vtkPolyDataMapper', 'vtk.vtkPolyDataMapper', ([], {}), '()\n', (11470, 11472), False, 'import vtk\n'), ((11634, 11648), 'vtk.vtkActor', 'vtk.vtkActor', ([], {}), '()\n', (11646, 11648), False, 'import vtk\n'), ((12863, 12886), 'vtk.vtkPolyDataMapper', 'vtk.vtkPolyDataMapper', ([], {}), '()\n', (12884, 12886), False, 'import vtk\n'), ((13030, 13044), 'vtk.vtkActor', 'vtk.vtkActor', ([], {}), '()\n', (13042, 13044), False, 'import vtk\n'), ((13245, 13268), 'vtk.vtkScalarBarActor', 'vtk.vtkScalarBarActor', ([], {}), '()\n', (13266, 13268), False, 'import vtk\n'), ((13775, 13796), 'vtk.vtkSphereWidget', 'vtk.vtkSphereWidget', ([], {}), '()\n', (13794, 13796), False, 'import vtk\n'), ((13986, 14004), 'vtk.vtkTextActor', 'vtk.vtkTextActor', ([], {}), '()\n', (14002, 14004), False, 'import vtk\n'), ((3513, 3528), 'vtk.vtkPoints', 'vtk.vtkPoints', ([], {}), '()\n', (3526, 3528), False, 'import vtk\n'), ((3653, 3673), 'vtk.vtkDoubleArray', 'vtk.vtkDoubleArray', ([], {}), '()\n', (3671, 3673), False, 'import vtk\n'), ((3896, 3911), 'vtk.vtkPoints', 'vtk.vtkPoints', ([], {}), '()\n', (3909, 3911), False, 'import vtk\n'), ((4054, 4074), 'vtk.vtkDoubleArray', 'vtk.vtkDoubleArray', ([], {}), '()\n', (4072, 4074), False, 'import vtk\n'), ((10138, 10165), 'vmtk.vmtkrenderer.vmtkRenderer', 'vmtkrenderer.vmtkRenderer', ([], {}), '()\n', (10163, 10165), False, 'from vmtk import vmtkrenderer\n')]
|
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "dt 0.1, q"
tags = "actions"
import cocos
from cocos.director import director
from cocos.actions import *
from cocos.sprite import Sprite
import pyglet
class TestLayer(cocos.layer.Layer):
def _step( self, dt ):
super(TestLayer,self)._step(dt)
print('shall not happen')
print(self.rotation)
description = """
If a node is not in the active scene, will not perfom any action.
No output should be seen on console.
"""
def main():
print(description)
director.init()
test_layer = TestLayer ()
# note test_layer is NOT in the scene
main_scene = cocos.scene.Scene()
test_layer.do( RotateBy(360, duration=2) )
director.run (main_scene)
if __name__ == '__main__':
main()
|
[
"cocos.scene.Scene",
"os.path.dirname",
"cocos.director.director.init",
"cocos.director.director.run"
] |
[((729, 744), 'cocos.director.director.init', 'director.init', ([], {}), '()\n', (742, 744), False, 'from cocos.director import director\n'), ((834, 853), 'cocos.scene.Scene', 'cocos.scene.Scene', ([], {}), '()\n', (851, 853), False, 'import cocos\n'), ((905, 929), 'cocos.director.director.run', 'director.run', (['main_scene'], {}), '(main_scene)\n', (917, 929), False, 'from cocos.director import director\n'), ((193, 218), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (208, 218), False, 'import os\n')]
|
# Main
import argparse
from img_crop import crop_to_size, crop_to_percentage
# from img_resize import *
from img_resize import resize_by_percentage, resize_by_width, resize_by_height
from j2p import j2p
from p2j import p2j
print(f'Main running __name__ = {__name__}')
if __name__ == '__main__':
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(help='Please select image resize/cropping methods.', dest='definition')
parser_crp_pixel = subparsers.add_parser('crp_px', help='center crop images dimensions (width, height)')
parser_crp_pixel.add_argument('-file', '--image_path', type=str, required=True,
help='Select the folder where images present')
parser_crp_pixel.add_argument('-loc', '--new_path', type=str, required=True,
help='Save new folder for cropped images')
parser_crp_pixel.add_argument('-wt', '--width', type=int, required=True, help='Image width to crop')
parser_crp_pixel.add_argument('-ht', '--height', type=int, required=True, help='Image height to crop')
parser_crp_percentage = subparsers.add_parser('crp_p', help='center crop images for percentage')
parser_crp_percentage.add_argument('-file', '--image_path', type=str, required=True,
help='Select the folder where images present')
parser_crp_percentage.add_argument('-loc', '--new_path', type=str, required=True,
help='Save new folder for cropped images')
parser_crp_percentage.add_argument('-per', '--percentage', type=int, required=True,
help='mention the percentage to crop image')
parser_res_per = subparsers.add_parser('res_p', help='resize by user determined percentage')
parser_res_per.add_argument('-file', '--image_path', type=str, required=True,
help='Select the folder where images present')
parser_res_per.add_argument('-loc', '--new_path', type=str, required=True,
help='Save new folder for resized images')
parser_res_per.add_argument('-per', '--percentage', type=int, required=True,
help='Image width to resize by percentage between 0 too 100')
parser_res_w = subparsers.add_parser('res_w', help='Resize by user defined width value')
parser_res_w.add_argument('-file', '--image_path', type=str, required=True,
help='Select the folder where images present')
parser_res_w.add_argument('-loc', '--new_path', type=str, required=True,
help='Save new folder for resized images')
parser_res_w.add_argument('-wt', '--width', type=int, required=True, help='Image width to resize')
parser_res_w = subparsers.add_parser('res_h', help='Resize by user defined height value')
parser_res_w.add_argument('-file', '--image_path', type=str, required=True,
help='Select the folder where images present')
parser_res_w.add_argument('-loc', '--new_path', type=str, required=True,
help='Save new folder for resized images')
parser_res_w.add_argument('-ht', '--height', type=int, required=True, help='Image height to resize')
parser_p2j = subparsers.add_parser('p2j', help='Image conversion from png ==> jpeg')
parser_p2j.add_argument('-file', '--image_path', type=str, required=True,
help='Select the folder where images present')
parser_p2j.add_argument('-loc', '--new_path', type=str, required=True, help='Save new folder for converted images')
parser_j2p = subparsers.add_parser('j2p', help='Image conversion from jpeg ==> png')
parser_j2p.add_argument('-file', '--image_path', type=str, required=True,
help='Select the folder where images present')
parser_j2p.add_argument('-loc', '--new_path', type=str, required=True, help='Save new folder for converted images')
args = parser.parse_args()
if args.definition == 'crp_px':
crop_to_size(args.new_path, args.image_path, args.width, args.height)
elif args.definition == 'crp_p':
crop_to_percentage(args.new_path, args.image_path, args.percentage)
elif args.definition == 'res_p':
resize_by_percentage(args.new_path, args.image_path, args.percentage)
elif args.definition == 'res_w':
resize_by_width(args.new_path, args.image_path, args.width)
elif args.definition == 'res_h':
resize_by_height(args.new_path, args.image_path, args.height)
elif args.definition == 'p2j':
p2j(args.new_path, args.image_path)
elif args.definition == 'j2p':
j2p(args.new_path, args.image_path)
|
[
"img_crop.crop_to_size",
"argparse.ArgumentParser",
"img_crop.crop_to_percentage",
"p2j.p2j",
"img_resize.resize_by_percentage",
"img_resize.resize_by_height",
"j2p.j2p",
"img_resize.resize_by_width"
] |
[((329, 354), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (352, 354), False, 'import argparse\n'), ((4184, 4253), 'img_crop.crop_to_size', 'crop_to_size', (['args.new_path', 'args.image_path', 'args.width', 'args.height'], {}), '(args.new_path, args.image_path, args.width, args.height)\n', (4196, 4253), False, 'from img_crop import crop_to_size, crop_to_percentage\n'), ((4301, 4368), 'img_crop.crop_to_percentage', 'crop_to_percentage', (['args.new_path', 'args.image_path', 'args.percentage'], {}), '(args.new_path, args.image_path, args.percentage)\n', (4319, 4368), False, 'from img_crop import crop_to_size, crop_to_percentage\n'), ((4416, 4485), 'img_resize.resize_by_percentage', 'resize_by_percentage', (['args.new_path', 'args.image_path', 'args.percentage'], {}), '(args.new_path, args.image_path, args.percentage)\n', (4436, 4485), False, 'from img_resize import resize_by_percentage, resize_by_width, resize_by_height\n'), ((4533, 4592), 'img_resize.resize_by_width', 'resize_by_width', (['args.new_path', 'args.image_path', 'args.width'], {}), '(args.new_path, args.image_path, args.width)\n', (4548, 4592), False, 'from img_resize import resize_by_percentage, resize_by_width, resize_by_height\n'), ((4640, 4701), 'img_resize.resize_by_height', 'resize_by_height', (['args.new_path', 'args.image_path', 'args.height'], {}), '(args.new_path, args.image_path, args.height)\n', (4656, 4701), False, 'from img_resize import resize_by_percentage, resize_by_width, resize_by_height\n'), ((4747, 4782), 'p2j.p2j', 'p2j', (['args.new_path', 'args.image_path'], {}), '(args.new_path, args.image_path)\n', (4750, 4782), False, 'from p2j import p2j\n'), ((4828, 4863), 'j2p.j2p', 'j2p', (['args.new_path', 'args.image_path'], {}), '(args.new_path, args.image_path)\n', (4831, 4863), False, 'from j2p import j2p\n')]
|
import severus
import json
def respond(obj, data):
obj.send(json.dumps(data).encode())
def greet(obj, ip, data):
"""
Allows two peers to exchange information.
Receives host and port of peer and responds with own host and port
"""
host = ip[0]
port = data.get("port")
is_relay = data.get("is_relay")
if is_relay:
peer = severus.Peer(host, port)
if peer.is_alive() and host != severus.config.host and port != severus.config.port:
print(peer, "Saved")
peer.save()
else:
print(peer, "is dead")
respond(obj, {
"message":"Greetings"
})
def getallpeers(obj, ip, data):
"""
Returns list of all known peers
"""
all_peers = severus.db.peers.all()
respond(obj, {"peers":all_peers})
def getblock(obj, ip, data):
"""
Returns a block with specific index
"""
index = data.get("index")
block = severus.db.get_block(index)
respond(obj, {"block":block})
|
[
"severus.db.get_block",
"severus.Peer",
"json.dumps",
"severus.db.peers.all"
] |
[((745, 767), 'severus.db.peers.all', 'severus.db.peers.all', ([], {}), '()\n', (765, 767), False, 'import severus\n'), ((934, 961), 'severus.db.get_block', 'severus.db.get_block', (['index'], {}), '(index)\n', (954, 961), False, 'import severus\n'), ((365, 389), 'severus.Peer', 'severus.Peer', (['host', 'port'], {}), '(host, port)\n', (377, 389), False, 'import severus\n'), ((65, 81), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (75, 81), False, 'import json\n')]
|
import base64
import json
import os
import requests
def load_manifest(path):
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "manifests", path), "rb") as fp:
return base64.b64encode(fp.read()).decode("utf-8")
def get_release():
return {
"os": {
"type": "coreos",
"channel": "stable",
"version": "1688.4.0",
"manifests": {
"etcd": load_manifest("os/etcd.sh"),
"master": load_manifest("os/master.sh"),
"node": load_manifest("os/node.sh"),
},
},
"kubernetes": {
"version": "v1.10.0",
"images": {
"kube-dns": {
"kubedns": "gcr.io/google_containers/kubedns-amd64:1.6",
"dnsmasq": "gcr.io/google_containers/kube-dnsmasq-amd64:1.3",
}
},
"manifests": {
"kube-dns": load_manifest("kubernetes/dns.yml"),
},
},
"kel": {
"bundles": {
"api": "git-6ab87870",
"router": "git-f9563af8",
},
"images": {
"bundle-builder": "quay.io/kelproject/bundle-builder",
"bundle-runner": "quay.io/kelproject/bundle-runner",
"api-cache": "redis:3.0",
"api-database": "postgres:9.5",
"api-web": "quay.io/kelproject/bundle-runner",
"router": "quay.io/kelproject/bundle-runner",
},
"manifests": {
"kel-system": load_manifest("kel/kel-system.yml"),
"kel-builds": load_manifest("kel/kel-builds.yml"),
"router": load_manifest("kel/router.yml"),
"api-cache": load_manifest("kel/api-cache.yml"),
"api-database": load_manifest("kel/api-database.yml"),
"api-web": load_manifest("kel/api-web.yml"),
},
},
}
def main():
with open("manifest.json", "w") as fp:
fp.write(json.dumps(get_release()))
with open("channels.json", "w") as fp:
r = requests.get("https://storage.googleapis.com/release.kelproject.com/distro/channels.json")
if r.ok:
channels = json.loads(r.content.decode("utf-8"))
else:
channels = {"stable": None, "beta": None, "dev": {}}
git_tag = os.environ.get("TRAVIS_TAG", "")
if git_tag:
version, channel = git_tag.split("-")
channels[channel] = version
else:
channels["dev"][os.environ["TRAVIS_BRANCH"]] = os.environ["BUILD_TAG"]
fp.write(json.dumps(channels))
if __name__ == "__main__":
main()
|
[
"os.path.dirname",
"json.dumps",
"os.environ.get",
"requests.get",
"os.path.join"
] |
[((107, 132), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (122, 132), False, 'import os\n'), ((2182, 2282), 'requests.get', 'requests.get', (['"""https://storage.googleapis.com/release.kelproject.com/distro/channels.json"""'], {}), "(\n 'https://storage.googleapis.com/release.kelproject.com/distro/channels.json'\n )\n", (2194, 2282), False, 'import requests\n'), ((2448, 2480), 'os.environ.get', 'os.environ.get', (['"""TRAVIS_TAG"""', '""""""'], {}), "('TRAVIS_TAG', '')\n", (2462, 2480), False, 'import os\n'), ((148, 185), 'os.path.join', 'os.path.join', (['here', '"""manifests"""', 'path'], {}), "(here, 'manifests', path)\n", (160, 185), False, 'import os\n'), ((2705, 2725), 'json.dumps', 'json.dumps', (['channels'], {}), '(channels)\n', (2715, 2725), False, 'import json\n')]
|
import warnings
from . import NetworkTable # noqa
warnings.warn(
"networktables.networktable is deprecated, import networktables.NetworkTable directly",
DeprecationWarning,
stacklevel=2,
)
|
[
"warnings.warn"
] |
[((53, 198), 'warnings.warn', 'warnings.warn', (['"""networktables.networktable is deprecated, import networktables.NetworkTable directly"""', 'DeprecationWarning'], {'stacklevel': '(2)'}), "(\n 'networktables.networktable is deprecated, import networktables.NetworkTable directly'\n , DeprecationWarning, stacklevel=2)\n", (66, 198), False, 'import warnings\n')]
|
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
# If you like to run the code linked in this tutorial, please make sure to use
# the current `PyPI` release. If you cloned the source repository, this is
# obtained as follows:
#
# ```bash
# git checkout -b basic_tutorial v0.11
# ```
#
# This gives you a local branch `basic_tutorial`, in which you can play around
# with the code.
import logging
from pathlib import Path
from syne_tune.config_space import randint, uniform, loguniform
from syne_tune.backend import LocalBackend
from syne_tune.optimizer.schedulers import FIFOScheduler
from syne_tune import Tuner, StoppingCriterion
if __name__ == "__main__":
logging.getLogger().setLevel(logging.INFO)
random_seed = 31415927
n_workers = 4
max_wallclock_time = 3 * 3600 # Run for 3 hours
max_resource_level = 81 # Maximum number of training epochs
# Here, we specify the training script we want to tune
# - `mode` and `metric` must match what is reported in the training script
entry_point = str(Path(__file__).parent / "traincode_report_end.py")
mode = "max"
metric = "accuracy"
max_resource_attr = "epochs"
# Search space (or configuration space)
# For each tunable parameter, need to define type, range, and encoding
# (linear, logarithmic)
config_space = {
"n_units_1": randint(4, 1024),
"n_units_2": randint(4, 1024),
"batch_size": randint(8, 128),
"dropout_1": uniform(0, 0.99),
"dropout_2": uniform(0, 0.99),
"learning_rate": loguniform(1e-6, 1),
"weight_decay": loguniform(1e-8, 1),
}
# Additional fixed parameters
config_space.update(
{
max_resource_attr: max_resource_level,
"dataset_path": "./",
}
)
# Local back-end: Responsible for scheduling trials
# The local back-end runs trials as sub-processes on a single instance
trial_backend = LocalBackend(entry_point=entry_point)
# Scheduler:
# The `FIFOScheduler` starts a trial whenever a worker is free. It does
# not stop or pause trials, they always run to the end.
# We configure this scheduler with Bayesian optimization: configurations
# for new trials are selected by optimizing an acquisition function based
# on a Gaussian process surrogate model
# [1]
searcher = "bayesopt"
search_options = {"num_init_random": n_workers + 2}
scheduler = FIFOScheduler(
config_space,
searcher=searcher,
search_options=search_options,
mode=mode,
metric=metric,
random_seed=random_seed,
)
# The experiment is stopped after `max_wallclock_time` seconds
stop_criterion = StoppingCriterion(max_wallclock_time=max_wallclock_time)
# Everything comes together in the tuner
tuner = Tuner(
trial_backend=trial_backend,
scheduler=scheduler,
stop_criterion=stop_criterion,
n_workers=n_workers,
)
tuner.run()
|
[
"syne_tune.config_space.uniform",
"syne_tune.StoppingCriterion",
"syne_tune.config_space.randint",
"syne_tune.config_space.loguniform",
"pathlib.Path",
"syne_tune.backend.LocalBackend",
"syne_tune.optimizer.schedulers.FIFOScheduler",
"syne_tune.Tuner",
"logging.getLogger"
] |
[((2470, 2507), 'syne_tune.backend.LocalBackend', 'LocalBackend', ([], {'entry_point': 'entry_point'}), '(entry_point=entry_point)\n', (2482, 2507), False, 'from syne_tune.backend import LocalBackend\n'), ((2969, 3102), 'syne_tune.optimizer.schedulers.FIFOScheduler', 'FIFOScheduler', (['config_space'], {'searcher': 'searcher', 'search_options': 'search_options', 'mode': 'mode', 'metric': 'metric', 'random_seed': 'random_seed'}), '(config_space, searcher=searcher, search_options=\n search_options, mode=mode, metric=metric, random_seed=random_seed)\n', (2982, 3102), False, 'from syne_tune.optimizer.schedulers import FIFOScheduler\n'), ((3242, 3298), 'syne_tune.StoppingCriterion', 'StoppingCriterion', ([], {'max_wallclock_time': 'max_wallclock_time'}), '(max_wallclock_time=max_wallclock_time)\n', (3259, 3298), False, 'from syne_tune import Tuner, StoppingCriterion\n'), ((3357, 3469), 'syne_tune.Tuner', 'Tuner', ([], {'trial_backend': 'trial_backend', 'scheduler': 'scheduler', 'stop_criterion': 'stop_criterion', 'n_workers': 'n_workers'}), '(trial_backend=trial_backend, scheduler=scheduler, stop_criterion=\n stop_criterion, n_workers=n_workers)\n', (3362, 3469), False, 'from syne_tune import Tuner, StoppingCriterion\n'), ((1876, 1892), 'syne_tune.config_space.randint', 'randint', (['(4)', '(1024)'], {}), '(4, 1024)\n', (1883, 1892), False, 'from syne_tune.config_space import randint, uniform, loguniform\n'), ((1915, 1931), 'syne_tune.config_space.randint', 'randint', (['(4)', '(1024)'], {}), '(4, 1024)\n', (1922, 1931), False, 'from syne_tune.config_space import randint, uniform, loguniform\n'), ((1955, 1970), 'syne_tune.config_space.randint', 'randint', (['(8)', '(128)'], {}), '(8, 128)\n', (1962, 1970), False, 'from syne_tune.config_space import randint, uniform, loguniform\n'), ((1993, 2009), 'syne_tune.config_space.uniform', 'uniform', (['(0)', '(0.99)'], {}), '(0, 0.99)\n', (2000, 2009), False, 'from syne_tune.config_space import randint, uniform, loguniform\n'), ((2032, 2048), 'syne_tune.config_space.uniform', 'uniform', (['(0)', '(0.99)'], {}), '(0, 0.99)\n', (2039, 2048), False, 'from syne_tune.config_space import randint, uniform, loguniform\n'), ((2075, 2095), 'syne_tune.config_space.loguniform', 'loguniform', (['(1e-06)', '(1)'], {}), '(1e-06, 1)\n', (2085, 2095), False, 'from syne_tune.config_space import randint, uniform, loguniform\n'), ((2120, 2140), 'syne_tune.config_space.loguniform', 'loguniform', (['(1e-08)', '(1)'], {}), '(1e-08, 1)\n', (2130, 2140), False, 'from syne_tune.config_space import randint, uniform, loguniform\n'), ((1193, 1212), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1210, 1212), False, 'import logging\n'), ((1561, 1575), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (1565, 1575), False, 'from pathlib import Path\n')]
|
'''
Created on Jun 24, 2020
@author: ballance
'''
from enum import Enum, auto, IntEnum
import vsc
from vsc_test_case import VscTestCase
class TestAttrEnum(VscTestCase):
def test_rand_plain_enum(self):
class my_e(Enum):
A = auto()
B = auto()
@vsc.randobj
class my_s(object):
def __init__(self):
self.a = vsc.rand_enum_t(my_e)
self.b = vsc.enum_t(my_e)
inst = my_s()
for i in range(100):
inst.randomize()
def test_rand_plain_enum_hist(self):
class my_e(Enum):
A = auto()
B = auto()
@vsc.randobj
class my_s(object):
def __init__(self):
self.a = vsc.rand_enum_t(my_e)
self.b = vsc.enum_t(my_e)
inst = my_s()
for i in range(100):
inst.randomize()
def test_rand_int_enum(self):
class my_e(IntEnum):
A = auto()
B = auto()
@vsc.randobj
class my_s(object):
def __init__(self):
self.a = vsc.rand_enum_t(my_e)
self.b = vsc.enum_t(my_e)
self.c = vsc.rand_uint8_t()
a_hist = [0]*2
inst = my_s()
for i in range(100):
if inst.a == my_e.A:
a_hist[0] += 1
else:
a_hist[1] += 1
inst.randomize()
print("hist: " + str(a_hist))
delta = abs(a_hist[0] - a_hist[1])
self.assertLess(delta, 25)
def test_rand_int_enum_hist(self):
class my_e(IntEnum):
A = auto()
B = auto()
@vsc.randobj
class my_s(object):
def __init__(self):
self.a = vsc.rand_enum_t(my_e)
self.b = vsc.enum_t(my_e)
self.c = vsc.rand_uint8_t()
a_hist = [0]*2
inst = my_s()
for i in range(100):
inst.randomize()
if inst.a == my_e.A:
a_hist[0] += 1
else:
a_hist[1] += 1
print("a_hist: " + str(a_hist))
delta = abs(a_hist[0] - a_hist[1])
self.assertLess(delta, 25)
|
[
"enum.auto",
"vsc.enum_t",
"vsc.rand_enum_t",
"vsc.rand_uint8_t"
] |
[((265, 271), 'enum.auto', 'auto', ([], {}), '()\n', (269, 271), False, 'from enum import Enum, auto, IntEnum\n'), ((288, 294), 'enum.auto', 'auto', ([], {}), '()\n', (292, 294), False, 'from enum import Enum, auto, IntEnum\n'), ((666, 672), 'enum.auto', 'auto', ([], {}), '()\n', (670, 672), False, 'from enum import Enum, auto, IntEnum\n'), ((689, 695), 'enum.auto', 'auto', ([], {}), '()\n', (693, 695), False, 'from enum import Enum, auto, IntEnum\n'), ((1062, 1068), 'enum.auto', 'auto', ([], {}), '()\n', (1066, 1068), False, 'from enum import Enum, auto, IntEnum\n'), ((1085, 1091), 'enum.auto', 'auto', ([], {}), '()\n', (1089, 1091), False, 'from enum import Enum, auto, IntEnum\n'), ((1769, 1775), 'enum.auto', 'auto', ([], {}), '()\n', (1773, 1775), False, 'from enum import Enum, auto, IntEnum\n'), ((1792, 1798), 'enum.auto', 'auto', ([], {}), '()\n', (1796, 1798), False, 'from enum import Enum, auto, IntEnum\n'), ((403, 424), 'vsc.rand_enum_t', 'vsc.rand_enum_t', (['my_e'], {}), '(my_e)\n', (418, 424), False, 'import vsc\n'), ((450, 466), 'vsc.enum_t', 'vsc.enum_t', (['my_e'], {}), '(my_e)\n', (460, 466), False, 'import vsc\n'), ((804, 825), 'vsc.rand_enum_t', 'vsc.rand_enum_t', (['my_e'], {}), '(my_e)\n', (819, 825), False, 'import vsc\n'), ((851, 867), 'vsc.enum_t', 'vsc.enum_t', (['my_e'], {}), '(my_e)\n', (861, 867), False, 'import vsc\n'), ((1200, 1221), 'vsc.rand_enum_t', 'vsc.rand_enum_t', (['my_e'], {}), '(my_e)\n', (1215, 1221), False, 'import vsc\n'), ((1247, 1263), 'vsc.enum_t', 'vsc.enum_t', (['my_e'], {}), '(my_e)\n', (1257, 1263), False, 'import vsc\n'), ((1289, 1307), 'vsc.rand_uint8_t', 'vsc.rand_uint8_t', ([], {}), '()\n', (1305, 1307), False, 'import vsc\n'), ((1907, 1928), 'vsc.rand_enum_t', 'vsc.rand_enum_t', (['my_e'], {}), '(my_e)\n', (1922, 1928), False, 'import vsc\n'), ((1954, 1970), 'vsc.enum_t', 'vsc.enum_t', (['my_e'], {}), '(my_e)\n', (1964, 1970), False, 'import vsc\n'), ((1996, 2014), 'vsc.rand_uint8_t', 'vsc.rand_uint8_t', ([], {}), '()\n', (2012, 2014), False, 'import vsc\n')]
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import unicode literals so that StringIO works on both Python 2 and 3
from __future__ import unicode_literals
from __future__ import print_function
import sys
import os
import re
from argparse import ArgumentParser
try:
# Python 3
from io import StringIO
except ImportError:
# Python 2
from cStringIO import StringIO
def getType(v):
if hasattr(v, "decl_type"):
return getType(v.decl_type)
if hasattr(v, "declaration"):
return getType(v.declaration)
return v
class IdxGenerator(object):
"""Generates a the .idx file for an ITK wrapping submodule (which usually
corresponds to a class)."""
def __init__(self, moduleName):
self.moduleName = moduleName
# the output file
self.outputFile = StringIO()
def create_idxfile(self, idxFilePath, wrappersNamespace):
# iterate over all the typedefs in the _wrapping_::wrappers namespace
for typedef in wrappersNamespace.typedefs():
n = typedef.name
s = getType(typedef).decl_string
# drop the :: prefix - it make swig produce invalid code
if s.startswith("::"):
s = s[2:]
self.outputFile.write("{%s} {%s} {%s}\n" % (s, n, self.moduleName))
content = self.outputFile.getvalue()
with open(idxFilePath, "w") as f:
f.write(content)
class SwigInputGenerator(object):
"""Generates a swig input .i file for an ITK module."""
notWrapped = [
"std::_Deque_alloc<.+>",
"itk::AtomicInt<.+>",
"itk::MapContainer< unsigned long, itk::CellInterface<.+>",
"itk::VectorContainer< unsigned long, itk::CellInterface<.+>",
"itk::CellInterface< double, itk::QuadEdgeMeshCellTraitsInfo<.+>",
"itk::QuadEdgeMeshLineCell< itk::CellInterface<.+>",
"itk::LibHandle",
"itk::NeighborhoodAllocator<.+>",
# to avoid wrapping all the region for all the dims
"itk::ImageRegion<.+>",
"itk::ImportImageContainer<.+>",
"itk::DefaultPixelAccessor<.+>",
"itk::NeighborhoodAccessorFunctor<.+>",
"itk::DefaultVectorPixelAccessor<.+>",
"itk::VectorImageNeighborhoodAccessorFunctor<.+>",
"itk::.*Iterator.*", # TODO: remove this one ?
"itk::Neighborhood<.+>", # TODO: remove this one
"itk::ThreadFunctionType",
"itk::Functor::.+",
"itk::SmartPointer< itk::Functor::.+",
"itk::Function::.+",
"itk::.+Function.*", # Level set functions
"itk::watershed::.+", # ignore the internal classes of the watershed
# require to wrap too more type
"itk::SmartPointer< itk::VoronoiDiagram2D<.+> >",
# used internally in ImageToImageMetric
"itk::Image< itk::CovariantVector< double, \d+u >, \d+u >",
"itk::FixedArray< itk::SmartPointer.+ >",
# used internally in itkTransformBase
"itk::SmartPointer< itk::Transform.+ >",
# used internally in itkMattesMutualInformationImageToImageMetric
"itk::SmartPointer< itk::Image.+ >",
"itk::ObjectFactoryBasePrivate",
"itk::ThreadPoolGlobals",
"itk::MultiThreaderBaseGlobals",
".+[(][*][)][(].+" # functor functions
]
notWrappedRegExp = re.compile("|".join(["^" + s + "$" for s in notWrapped]))
# stdcomplex code
stdcomplex_headers = {
"D": """ class stdcomplexD {
public:
~stdcomplexD();
stdcomplexD & operator=(stdcomplexD const & arg0);
stdcomplexD(stdcomplexD const & arg0);
stdcomplexD(stdcomplexD __z);
stdcomplexD(double __r = 0.0, double __i = 0.0);
stdcomplexD(stdcomplexF const & __z);
double real();
double const real() const;
double imag();
double const imag() const;
stdcomplexD & operator=(double __d);
stdcomplexD & operator+=(double __d);
stdcomplexD & operator-=(double __d);
stdcomplexD & operator*=(double __d);
stdcomplexD & operator/=(double __d);
// stdcomplexD const & __rep() const;
private:
protected:
};
""",
"F": """class stdcomplexF {
public:
~stdcomplexF();
stdcomplexF & operator=(stdcomplexF const & arg0);
stdcomplexF(stdcomplexF const & arg0);
stdcomplexF(stdcomplexF __z);
stdcomplexF(float r = 0.0f, float i = 0.0f);
stdcomplexF(stdcomplexD const & __z);
float real();
float const real() const;
float imag();
float const imag() const;
stdcomplexF & operator=(float __f);
stdcomplexF & operator+=(float __f);
stdcomplexF & operator-=(float __f);
stdcomplexF & operator*=(float __f);
stdcomplexF & operator/=(float __f);
// stdcomplexF const & __rep() const;
private:
protected:
};
"""}
def __init__(self, moduleName, options):
self.moduleName = moduleName
self.options = options
self.outputFile = StringIO()
self.applyFileNames = []
# a dict to let us use the alias name instead of the full c++ name. Without
# that, in many cases, swig don't know that's the same type
self.aliases = {}
# a set of used types
self.usedTypes = set()
# a dict to store the file where the def comes from
self.typedefSource = {}
self.warnings = set()
self.mdx_loaded = set()
self.verbose = options.verbose
def warn(self, id, msg, doWarn=True):
if not doWarn:
# don't warn for anything
return
if str(id) not in self.options.warnings:
if not self.verbose and (id, msg) in self.warnings:
# just do nothing
return
self.warnings.add((id, msg))
if self.verbose:
if self.options.warningError:
print("error(%s): %s" % (str(id), msg), file=sys.stderr)
else:
print("warning(%s): %s" % (str(id), msg), file=sys.stderr)
else:
if self.options.warningError:
print(
"%s: error(%s): %s" %
(self.moduleName, str(id), msg), file=sys.stderr)
else:
print(
"%s: warning(%s): %s" %
(self.moduleName, str(id), msg), file=sys.stderr)
def info(self, msg):
if self.verbose:
print("info: %s" % msg, file=sys.stderr)
@staticmethod
def getDeclarationString(t):
t = getType(t)
if t.decl_string == "::PyObject *":
# don't go further - we want to keep that one as is
return "::PyObject *"
if isinstance(t, pygccxml.declarations.cpptypes.pointer_t):
return SwigInputGenerator.getDeclarationString(getType(t.base)) + " *"
elif isinstance(t, pygccxml.declarations.cpptypes.const_t):
return SwigInputGenerator.getDeclarationString(getType(t.base)) + " const"
elif isinstance(t, pygccxml.declarations.cpptypes.reference_t):
return SwigInputGenerator.getDeclarationString(getType(t.base)) + " &"
return t.decl_string
def renameTypesInSTL(self, s):
if s.startswith("std::") and \
pygccxml.declarations.templates.is_instantiation(s):
args = []
for arg in pygccxml.declarations.templates.args(s):
t, d = SwigInputGenerator.typeAndDecorators(arg)
args.append(self.renameTypesInSTL(self.get_alias(t)) + d)
return pygccxml.declarations.templates.join(
pygccxml.declarations.templates.name(s),
args) + SwigInputGenerator.typeAndDecorators(s)[1]
return s
@staticmethod
def removeStdAllocator(s):
if pygccxml.declarations.templates.is_instantiation(s):
args = []
for arg in pygccxml.declarations.templates.args(s):
if not arg.startswith("std::allocator"):
t, d = SwigInputGenerator.typeAndDecorators(arg)
args.append(SwigInputGenerator.removeStdAllocator(t) + d)
return pygccxml.declarations.templates.join(
pygccxml.declarations.templates.name(s),
args) + SwigInputGenerator.typeAndDecorators(s)[1]
return s
@staticmethod
def typeAndDecorators(s):
end = ""
s = s.strip()
ends = [" ", "*", "&", "const"]
needToContinue = True
while needToContinue:
needToContinue = False
for e in ends:
if s.endswith(e):
end = e + end
s = s[:-len(e)]
needToContinue = True
return (s, end)
def get_alias(self, decl_string, w=True):
s = str(decl_string)
# drop the :: prefix - it make swig produce invalid code
if s.startswith("::"):
s = s[2:]
# normalize string
s = SwigInputGenerator.normalize(s)
# workaround a bug - or is it a feature ? - somewhere
s = s.replace("complex float", "std::complex<float>")
s = s.replace("complex double", "std::complex<double>")
s = s.replace("complex long double", "std::complex<long double>")
(s, end) = SwigInputGenerator.typeAndDecorators(s)
if s in self.aliases:
self.usedTypes.add(self.aliases[s])
return self.aliases[s] + end
if s.startswith("itk::Templates::"):
# that's a explicitly instantiated type. The name is the same than
# the WrapITK one, so lets use it as a base for WrapITK
# Ex: itk::Templates::RGBPixelUC
# don't store the new string in s, because we need it unchanged if
# the type is explicitly instantiated, but not wrapped
new_s = s.replace("::Templates::", "")
if new_s.split("::")[0] in self.aliases.values():
self.usedTypes.add(new_s)
return new_s + end
if s[:s.rfind("::")] in self.aliases:
# take care of subtypes/enum/...
alias = self.aliases[s[:s.rfind("::")]] + s[s.rfind("::"):]
self.usedTypes.add(alias)
return alias + end
# replace the types defined in this type, to support
# std::vector<itkDataObject> for example
s = self.renameTypesInSTL(s)
# drop the allocator part of the type, because it is not supported by the
# %template directive with some generators (like tcl)
s = SwigInputGenerator.removeStdAllocator(s)
# rename basic_string to std::string to make name shorter
s = s.replace("std::basic_string< char >", "std::string")
s = s.replace(
"std::basic_string< char, std::char_traits< char > >",
"std::string")
s = s.replace(
"std::basic_ostream< char, std::char_traits< char > >",
"std::ostream")
s = s.replace(
"std::basic_istream< char, std::char_traits< char > >",
"std::istream")
s = s.replace(
"std::basic_ofstream< char, std::char_traits< char > >",
"std::ostream")
s = s.replace(
"std::basic_ifstream< char, std::char_traits< char > >",
"std::istream")
# rename some types not renamed by gccxml (why ?)
s = s.replace("itk::SerieUIDContainer", "std::vector< std::string >")
s = s.replace("itk::FilenamesContainer", "std::vector< std::string >")
if s.startswith("itk::") and not self.notWrappedRegExp.match(s):
self.warn(
4,
"ITK type not wrapped, or currently not known: %s" %
s,
w)
self.usedTypes.add(s)
return s + end
def load_idx(self, file_name):
with open(file_name, "r") as f:
for line in f:
(full_name, alias, module) = \
re.findall(r'{(.*)} {(.*)} {(.*)}', line)[0]
# workaround lack of :: prefix in idx files
# TODO: would it be better to remove the :: prefix in the output of
# pygccxml ?
# full_name = "::"+full_name
# normalize some basic type names
full_name = self.normalize(full_name)
if full_name in self.aliases:
# If the full_name key alreay exists, do not overwrite the
# value. load_idx() is called once before load_mdx(), making
# sure the first aliases loaded are the ones belonging to
# the current submodule (and the next load_idx() calls
# should not overwrite these aliases.
continue
self.aliases[full_name] = alias
# store the source of the def
if alias in self.typedefSource and file_name != self.typedefSource[alias]:
self.warn(
7, "%s in %s is already defined in %s." %
(alias, file_name, self.typedefSource[alias]))
else:
self.typedefSource[alias] = file_name
def load_mdx(self, file_name):
if file_name in self.mdx_loaded:
# already loaded - no need to do it again
return
self.mdx_loaded.add(file_name)
with open(file_name, "r") as f:
lines = f.readlines()
for line in lines:
line_stripped = line.strip()
if line.startswith('%') or line.isspace():
# exclude the lines which are starting with % - that's not the idx
# files
pass
elif line_stripped.endswith(".mdx"):
self.load_mdx(os.path.dirname(file_name) + os.sep + line_stripped)
elif line_stripped[:-4] == self.moduleName:
continue
else:
self.load_idx(os.path.dirname(file_name) + os.sep + line_stripped)
@staticmethod
def normalize(name):
name = name.replace("short unsigned int", "unsigned short")
name = name.replace("long unsigned int", "unsigned long")
name = name.replace("long long unsigned int", "unsigned long long")
name = name.replace("short int", "short")
name = name.replace("long int", "long")
name = name.replace("long long int", "long long")
# name = name.replace("unsigned int", "unsigned")
# normalize spaces
name = " ".join(name.replace(',', ', ').split())
return name
def generate_class(self, typedef, indent=0):
self.info("Generating interface for %s." % typedef.name)
decls = pygccxml.declarations
if not typedef.name.startswith("stdcomplex"):
super_classes = []
for super_class in getType(typedef).bases:
super_classes.append(
"%s %s" %
(super_class.access,
self.get_alias(
super_class.related_class.decl_string)))
s = ""
if super_classes:
s = " : " + ", ".join(super_classes)
self.outputFile.write(" " * indent)
self.outputFile.write("class %s%s {\n" % (typedef.name, s))
# iterate over access
for access in decls.ACCESS_TYPES.ALL:
# the access type
self.outputFile.write(" " * indent)
self.outputFile.write(" %s:\n" % access)
# warnings or no warning?
w = access not in self.options.access_warnings
# iterate over the members
for member in getType(typedef).get_members(access=access):
if isinstance(member, decls.typedef.typedef_t):
self.warn(
51,
"Member typedef are not supported: %s" %
member.name,
w)
elif isinstance(member, decls.member_function_t):
self.generate_method(typedef, member, indent, w)
elif isinstance(member, decls.constructor_t):
self.generate_constructor(typedef, member, indent, w)
elif isinstance(member, decls.member_operator_t):
self.generate_method(typedef, member, indent, w)
elif isinstance(member, decls.destructor_t):
self.generate_destructor(typedef, member, indent, w)
elif isinstance(member, decls.enumeration_t):
self.generate_nested_enum(typedef, member, indent, w)
elif isinstance(member, decls.variable_t):
self.warn(
52,
"Member variables are not supported: %s" %
member.name,
w)
elif isinstance(member, decls.class_declaration.class_t):
self.warn(
53,
"Member classes are not supported: %s" %
member.name,
w)
elif isinstance(
member, decls.class_declaration.class_declaration_t):
self.warn(
53,
"Member classes are not supported: %s" %
member.name,
w)
elif isinstance(member, decls.casting_operator_t):
self.warn(
54,
"Member casting operators are not supported: %s" %
member.name,
w)
else:
self.warn(
50,
"Unknown member type: %s" %
repr(member),
w)
# finally, close the class
self.outputFile.write(" " * indent)
self.outputFile.write("};\n\n\n")
elif typedef.name == "stdcomplexD":
self.outputFile.write(self.stdcomplex_headers["D"] + '\n')
elif typedef.name == "stdcomplexF":
self.outputFile.write(self.stdcomplex_headers["F"] + '\n')
else:
print('stdcomplex', typedef.name)
# stdcomplex is too difficult to wrap in some cases. Only wrap the
# constructor.
self.outputFile.write(" " * indent)
self.outputFile.write("class %s%s {\n" % (typedef.name, s))
# iterate over access
for access in pygccxml.declarations.ACCESS_TYPES.ALL:
# the access type
self.outputFile.write(" " * indent)
self.outputFile.write(" %s:\n" % access)
# warnings or no warning?
w = access not in self.options.access_warnings
for member in getType(typedef).get_members(access=access):
if isinstance(member, decls.constructor_t):
self.generate_constructor(typedef, member, indent, w)
elif isinstance(member, decls.destructor_t):
self.generate_destructor(typedef, member, indent, w)
# finally, close the class
self.outputFile.write(" " * indent)
self.outputFile.write("};\n\n\n")
def generate_constructor(self, typedef, constructor, indent, w):
# iterate over the arguments
args = []
for arg in constructor.arguments:
s = "%s %s" % (self.get_alias(self.getDeclarationString(arg), w), arg.name)
if 'unknown' in s:
continue
# append the default value if it exists
if arg.default_value:
s += " = %s" % arg.default_value
# and add the string to the arg list
args.append(s)
self.outputFile.write(" " * indent)
self.outputFile.write(" %s(%s);\n" % (typedef.name, ", ".join(args)))
def generate_destructor(self, typedef, destructor, indent, w):
self.outputFile.write(" " * indent)
self.outputFile.write(" ~%s();\n" % typedef.name)
def generate_enum(self, typedef):
name = typedef.name
enum = getType(typedef)
decl_string = typedef.decl_type.decl_string
# extract the namespace to put it in c++ code. Without that, the code
# generated by swig
# is wrong because it doesn't include the namespace
ns = "::".join(decl_string.split("::")[:-1])
self.outputFile.write("%{\n")
self.outputFile.write("using namespace %s;\n" % ns)
self.outputFile.write("%}\n")
content = [" %s = %i" % (key, value) for key, value in enum.values]
self.outputFile.write("enum %s { %s };\n" % (name, ", ".join(content)))
def generate_nested_enum(self, typedef, enum, indent, w):
content = [" %s = %i" % (key, value) for key, value in enum.values]
self.outputFile.write(" " * indent)
self.outputFile.write(" enum %s { %s };\n" % (enum.name, ", ".join(content)))
def generate_method(self, typedef, method, indent, w):
self.info("Generating interface for method '%s::%s'." %
(typedef.name, method.name))
# avoid the apply method for the class vnl_c_vector: the signature is
# quite strange and currently confuse swig :-/
if "(" in getType(method.return_type).decl_string:
self.warn(
1, "ignoring method not supported by swig '%s::%s'." %
(typedef.name, method.name), w)
return
names = [
"rBegin",
"rEnd",
"GetSpacingCallback",
"GetOriginCallback",
"Begin",
"End"]
if ((typedef.name.startswith('vnl_') and method.name in ["as_ref"])
or (typedef.name.startswith('itk') and method.name in names)):
self.warn(
3, "ignoring black listed method '%s::%s'." %
(typedef.name, method.name), w)
return
# iterate over the arguments
args = []
for arg in method.arguments:
s = "%s %s" % (self.get_alias(self.getDeclarationString(arg), w), arg.name)
if 'unknown' in s:
continue
if "(" in s:
self.warn(
1, "ignoring method not supported by swig '%s::%s'." %
(typedef.name, method.name), w)
return
# append the default value if it exists
if arg.default_value:
s += " = %s" % arg.default_value
# and add the string to the arg list
args.append(s)
# find the method decorators
static = ""
const = ""
if method.has_static:
static = "static "
if method.has_const:
const = " const"
if method.virtuality != "not virtual":
static += "virtual "
if method.virtuality == "pure virtual":
const += " = 0"
self.outputFile.write(" " * indent)
self.outputFile.write(
" %s%s %s(%s)%s;\n" %
(static,
self.get_alias(
self.getDeclarationString(
method.return_type),
w),
method.name,
", ".join(args),
const))
# Check the method arguments for std::string passed by reference.
# In this case, save the name of the argument in the applyFileNames list
# for further usage.
for arg in method.arguments:
dtype = arg.decl_type
if pygccxml.declarations.is_reference(dtype) and \
pygccxml.declarations.is_const(
pygccxml.declarations.remove_reference(dtype)) is False and \
pygccxml.declarations.is_std_string(dtype):
self.applyFileNames.append(arg.name)
def generate_headerfile(self, idxFile, wrappersNamespace):
# and begin to write the output
headerFile = StringIO()
headerFile.write("// This file is automatically generated.\n")
headerFile.write("// Do not modify this file manually.\n\n\n")
langs = [
"CHICKEN",
"CSHARP",
"GUILE",
"JAVA",
"LUA",
"MODULA3",
"MZSCHEME",
"OCAML",
"PERL",
"PERL5",
"PHP",
"PHP4",
"PHP5",
"PIKE",
"PYTHON",
"R",
"RUBY",
"SEXP",
"TCL",
"XML"]
# first, define the module
# [1:-1] is there to drop the quotes
for lang in langs:
headerFile.write("#ifdef SWIG%s\n" % lang)
headerFile.write("%%module %s%s\n" % (self.moduleName, lang.title()))
headerFile.write("#endif\n")
headerFile.write('\n')
# add the includes
# use a set to avoid putting many times the same include
s = set()
headerFile.write("%{\n")
# the include files passed in option
include = self.moduleName + 'SwigInterface.h'
i = '#include "%s"' % include
if i not in s:
headerFile.write(i + '\n')
s.add(i)
headerFile.write("%}\n\n\n")
# load the aliases files
headerFile.write("%{\n")
self.load_idx(idxFile)
# and the idx files in the mdx ones
for f in self.options.mdx:
self.load_mdx(f)
# iterate over all the typedefs in the _wrapping_::wrappers namespace
# to fill the alias dict
for typedef in wrappersNamespace.typedefs(): # allow_empty=True):
s = getType(typedef).decl_string
# drop the :: prefix - it make swig produce invalid code
if s.startswith("::"):
s = s[2:]
if s not in self.aliases:
self.warn(
2, "%s (%s) should be already defined in the idx files." %
(s, typedef.name))
self.aliases[s] = typedef.name
# declare the typedef
headerFile.write("typedef %s %s;\n" % (s, typedef.name))
headerFile.write("%}\n\n\n")
return headerFile
def generate_importfile(self, usedSources):
# add the imports
importFile = StringIO()
for f in self.options.imports:
importFile.write("%%import %s\n" % f)
importFile.write("\n\n")
for src in usedSources:
importFile.write("%%import %s.i\n" % src)
importFile.write('\n\n')
return importFile
def generate_includefile(self):
# add the swig includes
includeFile = StringIO()
includeFile.write("%include itk.i\n")
for f in options.swig_includes:
includeFile.write("%%include %s\n" % f)
includeFile.write("%%include %s\n" % (self.moduleName + "_ext.i"))
includeFile.write('\n\n')
return includeFile
def generate_applyfile(self):
# When a std::string is passed by reference, we need to add the %apply
# line with the argument name, and the INOUT command.
# Use a set() to remove duplicates, this will work event if we got
# multiple functions with the same argument name in the same .i file
# (swig should take care of it).
applyFileNames = set(self.applyFileNames)
# Apply file, for passing std::string as reference in methods
applyFile = StringIO()
for name in applyFileNames:
applyFile.write(
"%apply (std::string& INOUT) { std::string & " + name + "};\n")
applyFile.write("\n\n")
return applyFile
def create_typedefheader(self, usedSources):
# create the typedef header
typedefFile = StringIO()
typedefFile.write("#ifndef __%sSwigInterface_h\n" % self.moduleName)
typedefFile.write("#define __%sSwigInterface_h\n" % self.moduleName)
typedefInput = os.path.join(options.library_output_dir,
self.moduleName + 'SwigInterface.h.in')
with open(typedefInput, "r") as f:
typedefFile.write(f.read() + '\n')
for src in usedSources:
typedefFile.write('#include "%sSwigInterface.h"\n' % src)
typedefFile.write("#endif\n")
typedefOutput = os.path.join(options.interface_output_dir,
self.moduleName + 'SwigInterface.h')
with open(typedefOutput, "w") as f:
f.write(typedefFile.getvalue())
def create_interfacefile(self, interfaceFile, idxFile, wrappersNamespace):
headerFile = self.generate_headerfile(idxFile, wrappersNamespace)
# iterate over all the typedefs in the _wrapping_::wrappers namespace
# to build a list of classes with the dependecies
# classes :: [(name, [dep_name], typedef)]
classes = []
for typedef in wrappersNamespace.typedefs():
# begin a new class
if isinstance(
getType(typedef),
pygccxml.declarations.class_declaration.class_t):
classes.append((
typedef.name,
[self.get_alias(super_class.related_class.decl_string) for
super_class in getType(typedef).bases], typedef))
elif isinstance(
getType(typedef),
pygccxml.declarations.enumeration.enumeration_t):
# warn( 6, "Enum are currently supported only nested in a
# class." )
self.generate_enum(typedef)
else:
self.warn(
5, "Unknown type type: %s" % str(typedef.decl_type.declaration))
# copy the classes in a new ordered list, according to the dependencies
# classes is sorted to be sure to always get the same result everywhere
name_local_classes = [c[0] for c in classes]
classes = sorted(classes)
name_already_in_typedefs = []
typedefs = []
while len(classes) != 0:
nclasses = []
for name, deps, typedef in classes:
ok = True
for d in deps:
if d in name_local_classes and d not in name_already_in_typedefs:
ok = False
if ok:
name_already_in_typedefs.append(name)
typedefs.append(typedef)
else:
nclasses.append((name, deps, typedef))
classes = nclasses
# now really generate the swig interface
for typedef in typedefs:
# begin a new class
self.generate_class(typedef)
if len(self.warnings) > 0 and self.options.warningError:
sys.exit(1)
# search the files to import
usedSources = set()
for alias in self.usedTypes:
if alias in self.typedefSource:
idxName = os.path.basename(self.typedefSource[alias])
iName = idxName[:-len(".idx")]
usedSources.add(iName)
outputFileName = os.path.basename(interfaceFile)
if outputFileName in usedSources:
usedSources.remove(outputFileName)
importFile = self.generate_importfile(usedSources)
includeFile = self.generate_includefile()
applyFile = self.generate_applyfile()
self.create_typedefheader(usedSources)
# finally, really write the output
content = headerFile.getvalue() + importFile.getvalue() + \
includeFile.getvalue() + applyFile.getvalue() + self.outputFile.getvalue()
if self.options.keep and os.path.exists(interfaceFile):
with open(interfaceFile, "r") as f:
filecontent = f.read()
if self.options.keep and os.path.exists(interfaceFile) and \
filecontent == content:
self.info("%s unchanged." % interfaceFile)
else:
self.info("Writing %s." % interfaceFile)
with open(interfaceFile, "w") as f:
f.write(content)
if __name__ == '__main__':
argParser = ArgumentParser()
argParser.add_argument(
"--mdx",
action="append",
dest="mdx",
default=[],
metavar="FILE",
help="master idx file to be used.")
argParser.add_argument(
"--import",
action="append",
dest="imports",
default=[],
metavar="FILE",
help="File to be imported in the generated interface file.")
argParser.add_argument(
"--swig-include",
action="append",
dest="swig_includes",
default=[],
metavar="FILE",
help=(
"File to be included by swig (%include) in the generated "
"interface file."))
argParser.add_argument(
"-w",
"--disable-warning",
action="append",
dest="warnings",
default=[],
metavar="WARNING",
help="Warning to be disabled.")
argParser.add_argument(
"-A",
"--disable-access-warning",
action="append",
dest="access_warnings",
default=[],
metavar="LEVEL",
help=(
"Access level where warnings are disabled "
"(public, protected, private)."))
argParser.add_argument(
"-W",
"--warning-error",
action="store_true",
dest="warningError",
help="Treat warnings as errors.")
argParser.add_argument(
"-v",
"--verbose",
action="store_true",
dest="verbose",
help="Log what is currently done.")
argParser.add_argument(
"-k",
"--keep",
action="store_true",
dest="keep",
help="Don't rewrite the output file if the content is unchanged.")
argParser.add_argument(
"-p",
"--pygccxml-path",
action="store",
dest="pygccxml_path",
help="Path to pygccxml")
argParser.add_argument(
"-g",
"--castxml-path",
action="store",
dest="castxml_path",
help="Path to castxml")
argParser.add_argument(
"-o",
"--interface-output-dir",
action="store",
dest="interface_output_dir",
help="Directory to write the Swig input files")
argParser.add_argument(
"-l",
"--library-output-dir",
action="store",
dest="library_output_dir",
help="Directory to read the xml abstract syntax tree input files")
argParser.add_argument(
"-s",
"--submodule-order",
action="store",
dest="submodule_order",
help="List of submodules that must be wrapped in the given order")
options = argParser.parse_args()
sys.path.insert(1, options.pygccxml_path)
import pygccxml
import logging
# init the pygccxml stuff
pygccxml.utils.loggers.cxx_parser.setLevel(logging.CRITICAL)
pygccxml.declarations.scopedef_t.RECURSIVE_DEFAULT = False
pygccxml.declarations.scopedef_t.ALLOW_EMPTY_MDECL_WRAPPER = True
pygccxml_config = pygccxml.parser.config.xml_generator_configuration_t(
xml_generator_path=options.castxml_path,
xml_generator="castxml")
moduleNames = []
# The first mdx file is the master index file for this module.
with open(options.mdx[0], 'r') as ff:
for line in ff.readlines():
stripped = line.strip()
if line.startswith('%') or line.isspace():
# exclude the lines which are starting with % - that's not the idx
# files
pass
elif stripped.endswith(".mdx"):
pass
else:
moduleName = stripped.rsplit('.')[0]
if moduleName.startswith('(const char*)'):
moduleName = moduleName[len('(const char*)'):]
moduleName = moduleName.strip('"')
moduleNames.append(moduleName)
def generate_wrapping_namespace(moduleName):
xmlFilePath = os.path.join(options.library_output_dir,
moduleName + '.xml')
pygccxml_reader = pygccxml.parser.source_reader.source_reader_t(
pygccxml_config)
abstractSyntaxTree = pygccxml_reader.read_xml_file(xmlFilePath)
globalNamespace = pygccxml.declarations.get_global_namespace(abstractSyntaxTree)
wrappingNamespace = globalNamespace.namespace('_wrapping_')
return wrappingNamespace.namespace('wrappers')
wrappingNamespaces = dict()
# Limit the number of cached, parsed abstract syntax trees to avoid very
# high memory usage
wrappingCacheLength = min(len(moduleNames), 20)
for ii in range(wrappingCacheLength):
moduleName = moduleNames[ii]
wrappingNamespace = generate_wrapping_namespace(moduleName)
wrappingNamespaces[moduleName] = wrappingNamespace
for moduleName in moduleNames:
if moduleName in wrappingNamespaces:
wrappersNamespace = wrappingNamespaces[moduleName]
else:
wrappersNamespace = generate_wrapping_namespace(moduleName)
idxFilePath = os.path.join(options.interface_output_dir,
moduleName + '.idx')
idx_generator = IdxGenerator(moduleName)
idx_generator.create_idxfile(idxFilePath, wrappersNamespace)
def generate_swig_input(moduleName):
if moduleName in wrappingNamespaces:
wrappersNamespace = wrappingNamespaces[moduleName]
else:
wrappersNamespace = generate_wrapping_namespace(moduleName)
idxFilePath = os.path.join(options.interface_output_dir,
moduleName + '.idx')
swigInputFilePath = os.path.join(options.interface_output_dir,
moduleName + '.i')
swig_input_generator = SwigInputGenerator(moduleName, options)
swig_input_generator.create_interfacefile(swigInputFilePath, idxFilePath,
wrappersNamespace)
if options.submodule_order:
for moduleName in options.submodule_order.split(';'):
generate_swig_input(moduleName)
moduleNames.remove(moduleName)
for moduleName in moduleNames:
generate_swig_input(moduleName)
|
[
"argparse.ArgumentParser",
"pygccxml.parser.source_reader.source_reader_t",
"pygccxml.declarations.remove_reference",
"pygccxml.declarations.templates.name",
"os.path.join",
"pygccxml.declarations.templates.args",
"os.path.dirname",
"os.path.exists",
"pygccxml.declarations.is_reference",
"re.findall",
"os.path.basename",
"pygccxml.declarations.get_global_namespace",
"cStringIO.StringIO",
"pygccxml.utils.loggers.cxx_parser.setLevel",
"sys.exit",
"pygccxml.declarations.templates.is_instantiation",
"pygccxml.parser.config.xml_generator_configuration_t",
"sys.path.insert",
"pygccxml.declarations.is_std_string"
] |
[((33037, 33053), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (33051, 33053), False, 'from argparse import ArgumentParser\n'), ((35686, 35727), 'sys.path.insert', 'sys.path.insert', (['(1)', 'options.pygccxml_path'], {}), '(1, options.pygccxml_path)\n', (35701, 35727), False, 'import sys\n'), ((35801, 35861), 'pygccxml.utils.loggers.cxx_parser.setLevel', 'pygccxml.utils.loggers.cxx_parser.setLevel', (['logging.CRITICAL'], {}), '(logging.CRITICAL)\n', (35843, 35861), False, 'import pygccxml\n'), ((36018, 36141), 'pygccxml.parser.config.xml_generator_configuration_t', 'pygccxml.parser.config.xml_generator_configuration_t', ([], {'xml_generator_path': 'options.castxml_path', 'xml_generator': '"""castxml"""'}), "(xml_generator_path=\n options.castxml_path, xml_generator='castxml')\n", (36070, 36141), False, 'import pygccxml\n'), ((821, 831), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (829, 831), False, 'from cStringIO import StringIO\n'), ((5131, 5141), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (5139, 5141), False, 'from cStringIO import StringIO\n'), ((8022, 8073), 'pygccxml.declarations.templates.is_instantiation', 'pygccxml.declarations.templates.is_instantiation', (['s'], {}), '(s)\n', (8070, 8073), False, 'import pygccxml\n'), ((24763, 24773), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (24771, 24773), False, 'from cStringIO import StringIO\n'), ((27132, 27142), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (27140, 27142), False, 'from cStringIO import StringIO\n'), ((27502, 27512), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (27510, 27512), False, 'from cStringIO import StringIO\n'), ((28296, 28306), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (28304, 28306), False, 'from cStringIO import StringIO\n'), ((28617, 28627), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (28625, 28627), False, 'from cStringIO import StringIO\n'), ((28805, 28890), 'os.path.join', 'os.path.join', (['options.library_output_dir', "(self.moduleName + 'SwigInterface.h.in')"], {}), "(options.library_output_dir, self.moduleName + 'SwigInterface.h.in'\n )\n", (28817, 28890), False, 'import os\n'), ((29176, 29255), 'os.path.join', 'os.path.join', (['options.interface_output_dir', "(self.moduleName + 'SwigInterface.h')"], {}), "(options.interface_output_dir, self.moduleName + 'SwigInterface.h')\n", (29188, 29255), False, 'import os\n'), ((32003, 32034), 'os.path.basename', 'os.path.basename', (['interfaceFile'], {}), '(interfaceFile)\n', (32019, 32034), False, 'import os\n'), ((36972, 37033), 'os.path.join', 'os.path.join', (['options.library_output_dir', "(moduleName + '.xml')"], {}), "(options.library_output_dir, moduleName + '.xml')\n", (36984, 37033), False, 'import os\n'), ((37095, 37157), 'pygccxml.parser.source_reader.source_reader_t', 'pygccxml.parser.source_reader.source_reader_t', (['pygccxml_config'], {}), '(pygccxml_config)\n', (37140, 37157), False, 'import pygccxml\n'), ((37269, 37331), 'pygccxml.declarations.get_global_namespace', 'pygccxml.declarations.get_global_namespace', (['abstractSyntaxTree'], {}), '(abstractSyntaxTree)\n', (37311, 37331), False, 'import pygccxml\n'), ((38100, 38163), 'os.path.join', 'os.path.join', (['options.interface_output_dir', "(moduleName + '.idx')"], {}), "(options.interface_output_dir, moduleName + '.idx')\n", (38112, 38163), False, 'import os\n'), ((38576, 38639), 'os.path.join', 'os.path.join', (['options.interface_output_dir', "(moduleName + '.idx')"], {}), "(options.interface_output_dir, moduleName + '.idx')\n", (38588, 38639), False, 'import os\n'), ((38703, 38764), 'os.path.join', 'os.path.join', (['options.interface_output_dir', "(moduleName + '.i')"], {}), "(options.interface_output_dir, moduleName + '.i')\n", (38715, 38764), False, 'import os\n'), ((7485, 7536), 'pygccxml.declarations.templates.is_instantiation', 'pygccxml.declarations.templates.is_instantiation', (['s'], {}), '(s)\n', (7533, 7536), False, 'import pygccxml\n'), ((7583, 7622), 'pygccxml.declarations.templates.args', 'pygccxml.declarations.templates.args', (['s'], {}), '(s)\n', (7619, 7622), False, 'import pygccxml\n'), ((8120, 8159), 'pygccxml.declarations.templates.args', 'pygccxml.declarations.templates.args', (['s'], {}), '(s)\n', (8156, 8159), False, 'import pygccxml\n'), ((31663, 31674), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (31671, 31674), False, 'import sys\n'), ((32561, 32590), 'os.path.exists', 'os.path.exists', (['interfaceFile'], {}), '(interfaceFile)\n', (32575, 32590), False, 'import os\n'), ((32713, 32742), 'os.path.exists', 'os.path.exists', (['interfaceFile'], {}), '(interfaceFile)\n', (32727, 32742), False, 'import os\n'), ((24338, 24379), 'pygccxml.declarations.is_reference', 'pygccxml.declarations.is_reference', (['dtype'], {}), '(dtype)\n', (24372, 24379), False, 'import pygccxml\n'), ((24536, 24578), 'pygccxml.declarations.is_std_string', 'pygccxml.declarations.is_std_string', (['dtype'], {}), '(dtype)\n', (24571, 24578), False, 'import pygccxml\n'), ((31848, 31891), 'os.path.basename', 'os.path.basename', (['self.typedefSource[alias]'], {}), '(self.typedefSource[alias])\n', (31864, 31891), False, 'import os\n'), ((7836, 7875), 'pygccxml.declarations.templates.name', 'pygccxml.declarations.templates.name', (['s'], {}), '(s)\n', (7872, 7875), False, 'import pygccxml\n'), ((8438, 8477), 'pygccxml.declarations.templates.name', 'pygccxml.declarations.templates.name', (['s'], {}), '(s)\n', (8474, 8477), False, 'import pygccxml\n'), ((12237, 12277), 're.findall', 're.findall', (['"""{(.*)} {(.*)} {(.*)}"""', 'line'], {}), "('{(.*)} {(.*)} {(.*)}', line)\n", (12247, 12277), False, 'import re\n'), ((24454, 24499), 'pygccxml.declarations.remove_reference', 'pygccxml.declarations.remove_reference', (['dtype'], {}), '(dtype)\n', (24492, 24499), False, 'import pygccxml\n'), ((14078, 14104), 'os.path.dirname', 'os.path.dirname', (['file_name'], {}), '(file_name)\n', (14093, 14104), False, 'import os\n'), ((14260, 14286), 'os.path.dirname', 'os.path.dirname', (['file_name'], {}), '(file_name)\n', (14275, 14286), False, 'import os\n')]
|
from pathlib import Path
file_names = dict(
train='train.csv',
test='test.csv',
submission='sample_submission.csv',
)
home_path = Path(__file__).parent.resolve()
file_paths = {
file_key: home_path / file_name
for file_key, file_name in file_names.items()
}
|
[
"pathlib.Path"
] |
[((144, 158), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (148, 158), False, 'from pathlib import Path\n')]
|
# -*- coding: utf-8 -*-
############################################################################
#
# Copyright © 2015 OnlineGroups.net and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
############################################################################
from __future__ import absolute_import, unicode_literals
from mock import patch, MagicMock
from unittest import TestCase
from gs.profile.status.base.hook import MembersHook
class HookTest(TestCase):
@patch('gs.profile.status.base.hook.SkipQuery', autospec=True)
def test_profileIds_no_skip(self, FauxSkipQuery):
FauxSkipQuery().skip_people.return_value = []
context = MagicMock()
expected = ['keep0', 'keep1', 'keep2']
context.acl_users.getUserNames.return_value = expected
mh = MembersHook(context, MagicMock())
r = mh.profileIds
self.assertEqual(r, expected)
@patch('gs.profile.status.base.hook.SkipQuery', autospec=True)
def test_profileIds_no_dupe(self, FauxSkipQuery):
FauxSkipQuery().skip_people.return_value = []
context = MagicMock()
expected = ['keep0', 'keep1', 'keep2']
returned = expected + ['keep1', ]
context.acl_users.getUserNames.return_value = returned
mh = MembersHook(context, MagicMock())
r = mh.profileIds
self.assertEqual(r, expected)
@patch('gs.profile.status.base.hook.SkipQuery', autospec=True)
def test_profileIds_skip(self, FauxSkipQuery):
skip = ['skip0', 'skip1']
FauxSkipQuery().skip_people.return_value = skip
context = MagicMock()
expected = ['keep0', 'keep1', 'keep2']
returned = expected + skip
context.acl_users.getUserNames.return_value = returned
mh = MembersHook(context, MagicMock())
r = mh.profileIds
self.assertEqual(r, expected)
|
[
"mock.MagicMock",
"mock.patch"
] |
[((862, 923), 'mock.patch', 'patch', (['"""gs.profile.status.base.hook.SkipQuery"""'], {'autospec': '(True)'}), "('gs.profile.status.base.hook.SkipQuery', autospec=True)\n", (867, 923), False, 'from mock import patch, MagicMock\n'), ((1291, 1352), 'mock.patch', 'patch', (['"""gs.profile.status.base.hook.SkipQuery"""'], {'autospec': '(True)'}), "('gs.profile.status.base.hook.SkipQuery', autospec=True)\n", (1296, 1352), False, 'from mock import patch, MagicMock\n'), ((1762, 1823), 'mock.patch', 'patch', (['"""gs.profile.status.base.hook.SkipQuery"""'], {'autospec': '(True)'}), "('gs.profile.status.base.hook.SkipQuery', autospec=True)\n", (1767, 1823), False, 'from mock import patch, MagicMock\n'), ((1050, 1061), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (1059, 1061), False, 'from mock import patch, MagicMock\n'), ((1479, 1490), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (1488, 1490), False, 'from mock import patch, MagicMock\n'), ((1983, 1994), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (1992, 1994), False, 'from mock import patch, MagicMock\n'), ((1207, 1218), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (1216, 1218), False, 'from mock import patch, MagicMock\n'), ((1678, 1689), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (1687, 1689), False, 'from mock import patch, MagicMock\n'), ((2175, 2186), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (2184, 2186), False, 'from mock import patch, MagicMock\n')]
|
import threading
from kervi.controllers import Controller
from kervi.values import NumberValue, StringValue
import kervi.hal as hal
class _InputThread(threading.Thread):
def __init__(self, controller, device):
super().__init__(Name="InputThread")
self._controller = controller
self.deamon = True
self._terminate = False
self._device = device
def run(self):
while not self._terminate:
try:
events = self._device.read()
if events:
for event in events:
self._controller.on_input(event, self)
except EOFError:
self._terminate = True
except BrokenPipeError:
self._terminate = True
def terminate(self):
self._device._pipe.close()
self._terminate = True
class UserInput(Controller):
def __init__(self, input_id="user_input", name="User input", device=None, **kwargs):
Controller.__init__(self, input_id, name)
listen_to_keyboard = kwargs.pop("listen_to_keyboard", False)
listen_to_mouse = kwargs.pop("listen_to_mouse", False)
listen_to_gamepad = kwargs.pop("listen_to_gamepad", True)
self._devices = hal.get_user_inputs()
self._keyboard_thread = None
self._mouse_thread = None
self._gamepad_thread = None
if listen_to_keyboard:
if len(self._devices.keyboards):
self._keyboard_thread = _InputThread(self, self._devices.keyboards[0])
else:
self.spine.log.warning("no keyboards found")
if listen_to_mouse:
if len(self._devices.mice):
self._mouse_thread = _InputThread(self, self._devices.mice[0])
else:
self.spine.log.warning("no mouse found")
if listen_to_gamepad:
if len(self._devices.gamepads):
self._gamepad_thread = _InputThread(self, self._devices.gamepads[0])
else:
self.spine.log.warning("no gamepads found")
self.key = self.outputs.add("key", "Key", StringValue)
self.mouse_x = self.outputs.add("mouse_x", "Mouse x", NumberValue)
self.mouse_y = self.outputs.add("mouse_y", "Mouse y", NumberValue)
self.mouse_wheel = self.outputs.add("mouse_wheel", "Mouse wheel", NumberValue)
self._key_map = {}
self._ctrl_keys = ["KEY_LEFTCTRL", "KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_RIGHTCTRL", "KEY_RIGNTMETA", "KEY_RIGHTSHIFT"]
def _get_key(self, key):
if key in self._key_map.keys():
return True
return False
def _get_ctrl_keys(self, value):
res = []
for key in self._ctrl_keys:
if key != value and self._get_key(key):
res.append(key)
return res
def _is_ctrl_key(self, key):
return self._ctrl_keys.index(key) >=0
def controller_start(self):
if self._keyboard_thread:
self._keyboard_thread.start()
if self._mouse_thread:
self._mouse_thread.start()
if self._gamepad_thread:
self._gamepad_thread.start()
def controller_exit(self):
if self._keyboard_thread:
self._keyboard_thread.terminate()
if self._mouse_thread:
self._mouse_thread.terminate()
if self._gamepad_thread:
self._gamepad_thread.terminate()
def on_input(self, event, thread):
if event.ev_type == "Sync":
return
if event.ev_type == "Misc":
return
if event.ev_type == "Relative":
if event.code == "REL_WHEEL":
self.mouse_wheel.value += event.state
if event.ev_type == "Absolute":
if event.code == "ABS_X":
self.mouse_x.value = event.state
if event.code == "ABS_Y":
self.mouse_y.value = event.state
if event.ev_type == "Key":
if event.state:
self._key_map[event.code] = True
value = event.code +":" + str(event.state)
else:
if event.code in self._key_map.keys():
del self._key_map[event.code]
value = event.code +":" + str(event.state)
ctrl_keys = self._get_ctrl_keys(event.code)
if len(ctrl_keys):
value = str.join('+',ctrl_keys) +":" + value
if value != self.key.value:
self.key.value = value
|
[
"kervi.hal.get_user_inputs",
"kervi.controllers.Controller.__init__"
] |
[((1021, 1062), 'kervi.controllers.Controller.__init__', 'Controller.__init__', (['self', 'input_id', 'name'], {}), '(self, input_id, name)\n', (1040, 1062), False, 'from kervi.controllers import Controller\n'), ((1285, 1306), 'kervi.hal.get_user_inputs', 'hal.get_user_inputs', ([], {}), '()\n', (1304, 1306), True, 'import kervi.hal as hal\n')]
|
import os
import smtplib
from .conf import settings
from .conf import inputConfiguration
from .logger import Logger
# Import the email modules we'll need
from email.mime.multipart import MIMEMultipart
#from email.MIMEBase import MIMEBase
from email.mime.text import MIMEText
from email.utils import formatdate
#from email import Encoders
def main():
smtp = smtpInterface(settings)
smtp.setMessageSubject("Test Message")
smtp.setTargetSystem('beta2')
smtp.setRecipients(inputConfiguration.SMTPRECIPIENTS['testSource'])
smtp.setMessage("This is a test message...\r\n" )
smtp.formatMessage()
smtp.setAttachmentText(os.path.join(smtp.settings.BASE_PATH, 'emailprocessor.py'))
try:
print("trying to send message")
smtp.sendMessage()
except:
print('send failed')
class smtpInterface:
def __init__(self, settings):
print("SMTP Server Started")
self.settings = settings
self.log = Logger(settings.LOGGING_INI)
def prompt(self, prompt):
return raw_input(prompt).strip()
def setTargetSystem(self, targetsystem):
self.targetSystem = targetsystem
def setMessageSubject(self, messageSubject):
self.messageSubject = messageSubject
def setMessage(self, message):
self.message = message
def setRecipients(self, Recipients={}):
self.SMTPRECIPIENTS = Recipients
def setAttachmentText(self, textfile):
# Open a plain text file for reading. For this example, assume that
# the text file contains only ASCII characters.
#print textfile
#print os.getcwd()
fp = open(textfile, 'r')
# Create a text/plain message
#self.msg = MIMEText(fp.read())
#self.msg.add_header('Content-Disposition', 'attachment', filename=textfile)
#self.msg.attach( MIMEText(fp.read()) )
# now attach the attachment
att = MIMEText(fp.read())
fp.close()
#part.set_payload( open(file,"r").read() )
#Encoders.encode_base64(part)
#part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(f))
# SBB20070427 splitting out the filename from the full path (shows better in the heading of outlook)
fileNameOnly = os.path.basename(textfile)
#part.add_header('Content-Disposition', 'attachment', filename=textfile)
att.add_header('Content-Disposition', 'attachment', filename=fileNameOnly)
self.msg.attach(att)
def formatMessage(self):
self.msg = MIMEMultipart()
try:
self.fromaddr = self.settings.SMTPSENDER
# SMTPRECIPTIENTS is where these values come from
self.toaddrs = self.SMTPRECIPIENTS['SMTPTOADDRESS']
self.ccaddrs = self.SMTPRECIPIENTS['SMTPTOADDRESSCC']
self.bccaddrs = self.SMTPRECIPIENTS['SMTPTOADDRESSBCC']
except KeyError:
self.log.logger.exception('Unable to locate an Address')
self.log.logger.info("self.toaddrs")
self.log.logger.info(self.toaddrs)
# Add the From: and To: headers at the start!
#self.msg = ("From: %s\r\nTo: %s\r\n\r\n"
# % (self.fromaddr, ", ".join(self.toaddrs)))
self.msg['From'] = self.fromaddr
self.msg['To'] = ", ".join(self.toaddrs)
self.msg['CC'] = ", ".join(self.ccaddrs)
self.msg['BCC'] = ", ".join(self.bccaddrs)
self.msg['Date'] = formatdate(localtime=True)
self.msg['Subject'] = self.messageSubject
self.msg.attach(MIMEText(self.message))
# Guarantees the message ends in a newline
self.msg.epilogue = ''
#self.message = self.message + self.msg.as_string()
#print type(self.msg)
#self.message = self.msg.as_string()
def sendMessage(self):
logged_in = False
print("ServerAddress: %s" % self.settings.SMTPSERVER)
if self.settings.SMTPAUTH:
attempts = 0
while attempts <= 5:
attempts += 1
try:
server = smtplib.SMTP(self.settings.SMTPSERVER, self.settings.SMTPPORT)
if self.settings.SMTPTLS:
server.ehlo()
server.starttls()
server.ehlo
else:
print("no TLS tried for smtp")
server.login(self.settings.SMTPSENDER, self.settings.SMTPSENDERPWD)
logged_in = True
break
except smtplib.socket.error:
print("exception: socket error can't connect to smtp server")
else:
print("no authentication specified in settings for smtp")
server = smtplib.SMTP(self.settings.SMTPSERVER)
if self.settings.SMTPSENDERPWD != '' and not logged_in and self.settings.SMTPAUTH:
try:
server.login(self.settings.SMTPSENDER, self.settings.SMTPSENDERPWD)
except smtplib.SMTPRecipientsRefused:
self.log.logger.exception('smtplib.SMTPRecipientsRefused')
if settings.DEBUG:
print("SMTPRecipientsRefused")
return
except smtplib.SMTPException as detail:
self.log.logger.exception('smtplib.SMTPException')
if settings.DEBUG:
print(detail.value)
return
else:
if settings.DEBUG:
print("some other type of smtp exception")
return
else:
if not logged_in and not self.settings.SMTPAUTH:
print("Just sending the message without authentication")
print("trying to send the message")
server.set_debuglevel(0)
self.formatMessage()
server.sendmail(self.fromaddr, self.toaddrs, self.msg.as_string())
server.quit()
if __name__ == "__main__":
main()
|
[
"os.path.join",
"smtplib.SMTP",
"os.path.basename",
"email.mime.text.MIMEText",
"email.mime.multipart.MIMEMultipart",
"email.utils.formatdate"
] |
[((647, 705), 'os.path.join', 'os.path.join', (['smtp.settings.BASE_PATH', '"""emailprocessor.py"""'], {}), "(smtp.settings.BASE_PATH, 'emailprocessor.py')\n", (659, 705), False, 'import os\n'), ((2344, 2370), 'os.path.basename', 'os.path.basename', (['textfile'], {}), '(textfile)\n', (2360, 2370), False, 'import os\n'), ((2629, 2644), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', ([], {}), '()\n', (2642, 2644), False, 'from email.mime.multipart import MIMEMultipart\n'), ((3566, 3592), 'email.utils.formatdate', 'formatdate', ([], {'localtime': '(True)'}), '(localtime=True)\n', (3576, 3592), False, 'from email.utils import formatdate\n'), ((3668, 3690), 'email.mime.text.MIMEText', 'MIMEText', (['self.message'], {}), '(self.message)\n', (3676, 3690), False, 'from email.mime.text import MIMEText\n'), ((4921, 4959), 'smtplib.SMTP', 'smtplib.SMTP', (['self.settings.SMTPSERVER'], {}), '(self.settings.SMTPSERVER)\n', (4933, 4959), False, 'import smtplib\n'), ((4229, 4291), 'smtplib.SMTP', 'smtplib.SMTP', (['self.settings.SMTPSERVER', 'self.settings.SMTPPORT'], {}), '(self.settings.SMTPSERVER, self.settings.SMTPPORT)\n', (4241, 4291), False, 'import smtplib\n')]
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from numba import f8
from numba import i8
from numba import jit
from numba import prange
from numpy import argmin
from numpy import array
from numpy import empty
from numpy import min
from numpy.random import rand
from numpy.random import choice
__author__ = ['<NAME> <<EMAIL>>']
__copyright__ = 'Copyright 2017, BLOCK Research Group - ETH Zurich'
__license__ = 'MIT License'
__email__ = '<EMAIL>'
__all__ = [
'devo_numba',
]
args = 0
@jit(nogil=True, nopython=True, parallel=True)
def _fn(u, args):
# Booth's function, fopt=0, uopt=(1, 3)
x = u[0]
y = u[1]
z = (x + 2 * y - 7)**2 + (2 * x + y - 5)**2
return z
@jit((f8[:, :], i8, i8), nogil=True, nopython=True, parallel=False)
def devo_numba(bounds, population, generations):
""" Call the Numba accelerated Differential Evolution solver.
Parameters:
bounds (array): Lower and upper bounds for each DoF.
population (int): Number of agents in the population.
generations (int): Number of cross-over cycles/steps to perform.
F (float): Differential evolution parameter.
CR (float): Differential evolution cross-over ratio parameter.
Returns:
array: Values that give the optimum (minimised) function.
"""
# Heading
print('\n---------------------------------')
print('Differential Evolution started...')
print('---------------------------------')
F = 0.8
CR = 0.9
# Setup population
k = bounds.shape[0]
agents = rand(k, population)
for i in prange(k):
for j in prange(population):
agents[i, j] *= bounds[i, 1] - bounds[i, 0]
agents[i, j] += bounds[i, 0]
candidates = empty((population, population - 1))
for i in prange(population):
c = 0
for j in prange(population - 1):
if j == i:
c += 1
candidates[i, j] = c
c += 1
# Initial conditions
f = empty(population)
for i in prange(population):
f[i] = _fn(agents[:, i], args)
fopt = min(f)
agents_ = empty((k, population))
ts = 0
print('\nGeneration: ', ts, ' fopt: ', fopt)
# Start evolution
while ts < generations + 1:
ind = rand(k, population) < CR
for i in prange(population):
choices = choice(population - 1, 3, replace=False)
ind0 = int(candidates[i, choices[0]])
ind1 = int(candidates[i, choices[1]])
ind2 = int(candidates[i, choices[2]])
ac = agents[:, ind0]
bc = agents[:, ind1]
cc = agents[:, ind2]
for j in prange(k):
if ind[j, i]:
val = ac[j] + F * (bc[j] - cc[j])
if val < bounds[j, 0]:
val = bounds[j, 0]
elif val > bounds[j, 1]:
val = bounds[j, 1]
agents_[j, i] = val
else:
agents_[j, i] = agents[j, i]
f_ = _fn(agents_[:, i], args)
if f_ < f[i]:
agents[:, i] = agents_[:, i]
f[i] = f_
fopt = min(f)
xopt = agents[:, argmin(f)]
ts += 1
print('Generation: ', ts, ' fopt: ', fopt)
# Summary
print('\n-------------------------------')
print('Differential Evolution finished')
print('fopt: ', fopt)
print('-------------------------------')
return xopt
# ==============================================================================
# Main
# ==============================================================================
if __name__ == "__main__":
from time import time
tic = time()
bounds = array([[-10., 10.], [-10., 10.]])
devo_numba(bounds=bounds, population=1000, generations=1000)
print(time() - tic)
|
[
"numpy.random.choice",
"numpy.empty",
"numpy.argmin",
"time.time",
"numpy.min",
"numba.jit",
"numpy.array",
"numba.prange",
"numpy.random.rand"
] |
[((568, 613), 'numba.jit', 'jit', ([], {'nogil': '(True)', 'nopython': '(True)', 'parallel': '(True)'}), '(nogil=True, nopython=True, parallel=True)\n', (571, 613), False, 'from numba import jit\n'), ((766, 832), 'numba.jit', 'jit', (['(f8[:, :], i8, i8)'], {'nogil': '(True)', 'nopython': '(True)', 'parallel': '(False)'}), '((f8[:, :], i8, i8), nogil=True, nopython=True, parallel=False)\n', (769, 832), False, 'from numba import jit\n'), ((1620, 1639), 'numpy.random.rand', 'rand', (['k', 'population'], {}), '(k, population)\n', (1624, 1639), False, 'from numpy.random import rand\n'), ((1653, 1662), 'numba.prange', 'prange', (['k'], {}), '(k)\n', (1659, 1662), False, 'from numba import prange\n'), ((1816, 1851), 'numpy.empty', 'empty', (['(population, population - 1)'], {}), '((population, population - 1))\n', (1821, 1851), False, 'from numpy import empty\n'), ((1865, 1883), 'numba.prange', 'prange', (['population'], {}), '(population)\n', (1871, 1883), False, 'from numba import prange\n'), ((2073, 2090), 'numpy.empty', 'empty', (['population'], {}), '(population)\n', (2078, 2090), False, 'from numpy import empty\n'), ((2104, 2122), 'numba.prange', 'prange', (['population'], {}), '(population)\n', (2110, 2122), False, 'from numba import prange\n'), ((2174, 2180), 'numpy.min', 'min', (['f'], {}), '(f)\n', (2177, 2180), False, 'from numpy import min\n'), ((2195, 2217), 'numpy.empty', 'empty', (['(k, population)'], {}), '((k, population))\n', (2200, 2217), False, 'from numpy import empty\n'), ((3830, 3836), 'time.time', 'time', ([], {}), '()\n', (3834, 3836), False, 'from time import time\n'), ((3851, 3888), 'numpy.array', 'array', (['[[-10.0, 10.0], [-10.0, 10.0]]'], {}), '([[-10.0, 10.0], [-10.0, 10.0]])\n', (3856, 3888), False, 'from numpy import array\n'), ((1681, 1699), 'numba.prange', 'prange', (['population'], {}), '(population)\n', (1687, 1699), False, 'from numba import prange\n'), ((1916, 1938), 'numba.prange', 'prange', (['(population - 1)'], {}), '(population - 1)\n', (1922, 1938), False, 'from numba import prange\n'), ((2394, 2412), 'numba.prange', 'prange', (['population'], {}), '(population)\n', (2400, 2412), False, 'from numba import prange\n'), ((3284, 3290), 'numpy.min', 'min', (['f'], {}), '(f)\n', (3287, 3290), False, 'from numpy import min\n'), ((2351, 2370), 'numpy.random.rand', 'rand', (['k', 'population'], {}), '(k, population)\n', (2355, 2370), False, 'from numpy.random import rand\n'), ((2436, 2476), 'numpy.random.choice', 'choice', (['(population - 1)', '(3)'], {'replace': '(False)'}), '(population - 1, 3, replace=False)\n', (2442, 2476), False, 'from numpy.random import choice\n'), ((2748, 2757), 'numba.prange', 'prange', (['k'], {}), '(k)\n', (2754, 2757), False, 'from numba import prange\n'), ((3961, 3967), 'time.time', 'time', ([], {}), '()\n', (3965, 3967), False, 'from time import time\n'), ((3316, 3325), 'numpy.argmin', 'argmin', (['f'], {}), '(f)\n', (3322, 3325), False, 'from numpy import argmin\n')]
|
# -*- coding: utf-8 -*-
"""
smartcat.api
~~~~~~~~~~~~
This module contains classes that make http requests to SmartCAT
`API Documentation <https://smartcat.ai/api/methods/>`_
Original project at https://github.com/gilyaev/smartcat-python-sdk
Modified by <NAME> https://github.com/yakninja (added account part, some methods etc)
"""
import json
from abc import ABCMeta
import requests
class SmartcatException(Exception):
def __init__(self, message, code=0):
super(SmartcatException, self).__init__(message)
self.code = code
self.message = message
class SmartCAT(object):
"""SmartCAT API
Provides functionality for SmartCAT resource management:
- project
- document
Manage Project Resource::
>>> from smartcat.api import SmartCAT
>>> api = SmartCAT('username', 'password', SmartCAT.SERVER_EUROPE)
>>> project_resource = api.project
<smartcat.api.Project>
>>> project_model = {
"name": "Sample Project",
"sourceLanguage": "en",
"targetLanguages": ["ru"],
"assignToVendor": False
}
>>> res = project_resource.create(data=project_model)
<Response [200]>
Manage Document Resource::
>>> from smartcat.api import SmartCAT
>>> api = SmartCAT('username', 'password', SmartCAT.SERVER_EUROPE)
>>> document_resource = api.document
<smartcat.api.Document>
>>> res = document_resource.request_export(document_ids=['project1_doc1', 'project1_doc2', 'project2_doc1'])
<Response [200]>
>>> res = document_resource.request_export(document_ids='project1_doc1')
<Response [200]>
"""
SERVER_USA = 'https://us.smartcat.ai'
SERVER_EUROPE = 'https://smartcat.ai'
def __init__(self, username, password, server_url=SERVER_EUROPE):
"""
Constructor
:param username: SmartCAT API username.
:param password: SmartCAT API password.
:param server_url (optional): The API server: SmartCAT.SERVER_EUROPE or SmartCAT.SERVER_USA
"""
self.username = username
self.password = password
self.server_url = server_url
#: :class:`Project <Project>`.
self._project = None
self._document = None
self._account = None
pass
@property
def project(self):
"""Returns instance of class:`Project <smartcat.api.Project>`.
:return: :class:`Project <smartcat.api.Project>` object
:rtype: smartcat.api.Project
"""
if self._project is not None:
return self._project
self._project = self._create_api_resource('Project')
return self._project
@property
def document(self):
"""Returns instance of `Document <smartcat.api.Document>`
:return: :class:`Document <smartcat.api.Document>` object
:rtype: smartcat.api.Document
"""
if self._document is not None:
return self._document
self._document = self._create_api_resource('Document')
return self._document
@property
def account(self):
"""Returns instance of `Account <smartcat.api.Account>`
:return: :class:`Account <smartcat.api.Account>` object
:rtype: smartcat.api.Account
"""
if self._account is not None:
return self._account
self._account = self._create_api_resource('Account')
return self._account
def _create_api_resource(self, resource):
"""Creates and returns API resource
:return: :class:`BaseResource <BaseResource>` object
:rtype: smartcat.BaseResource
"""
return globals()[resource](self.username, self.password, self.server_url)
class BaseResource(object):
__metaclass__ = ABCMeta
def __init__(self, username, password, server):
self.session = requests.Session()
self.session.auth = (username, password)
self.session.headers.update({'Accept': 'application/json'})
self.server = server
def send_get_request(self, path, **kwargs):
url = self.server + path
return self.session.get(url, **kwargs)
def send_options_request(self, path, **kwargs):
url = self.server + path
return self.session.options(url, **kwargs)
def send_head_request(self, path, **kwargs):
url = self.server + path
return self.session.put(url, **kwargs)
def send_post_request(self, path, data=None, json=None, **kwargs):
url = self.server + path
return self.session.post(url, data=data, json=json, **kwargs)
def send_put_request(self, path, data=None, **kwargs):
url = self.server + path
return self.session.put(url, data=data, **kwargs)
def send_patch_request(self, path, data=None, **kwargs):
url = self.server + path
return self.session.patch(url, data=data, **kwargs)
def send_delete_request(self, path, **kwargs):
url = self.server + path
return self.session.delete(url, **kwargs)
class Project(BaseResource):
def create(self, data, files=None):
# type: (dict) -> requests.Response
"""Create a new project
:param data: The project information.
:type data: dict
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``)
for multipart encoding upload.
``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string
defining the content type of the given file and ``custom_headers`` a dict-like object containing additional
headers to add for the file
"""
if files is None:
files = {}
files["model"] = (None, json.dumps(data), 'application/json')
return self.send_post_request(
'/api/integration/v1/project/create',
files=files)
def update(self, id, data):
"""Update project by id
:param id: The project identifier.
:param data: The project information.
:type data: dict
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return self.send_put_request(
'/api/integration/v1/project/%s' % id,
json=data)
def delete(self, id):
"""Delete project
:param id: The project identifier.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return self.send_delete_request('/api/integration/v1/project/%s' % id)
def cancel(self, id):
"""Cancel the project
:param id: The project identifier.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return self.send_post_request(
'/api/integration/v1/project/cancel',
params={'projectId': id})
def restore(self, id):
"""Restore the project
:param id: The project identifier.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return self.send_post_request(
'/api/integration/v1/project/restore',
params={'projectId': id})
def get(self, id):
"""Get project
:param id: The project identifier.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return self.send_get_request('/api/integration/v1/project/%s' % id)
def completed_work_statistics(self, id):
"""Receiving statistics for the completed parts of the project.
:param id: The project identifier.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return self.send_get_request('/api/integration/v1/project/%s/completedWorkStatistics' % id)
def get_all(self):
"""Get document list.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return self.send_get_request('/api/integration/v1/project/list')
def attach_document(self, id, files):
"""Adds document to project.
:param id: The project identifier.
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``)
for multipart encoding upload.
``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string
defining the content type of the given file and ``custom_headers`` a dict-like object containing additional
headers to add for the file
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
params = {'projectId': id}
return self.send_post_request('/api/integration/v1/project/document', files=files, params=params)
def add_target_lang(self, id, lang):
"""Add a new target language to the project
:param id: The project identifier.
:param lang: Target language code.
:return: :class:`Response <Response>` object
:rtype:
"""
return self.send_post_request(
'/api/integration/v1/project/language',
params={'projectId': id, 'targetLanguage': lang})
def get_document_by_name(self, project_id, document_name):
"""Return document dict by name or id
:param project_id: The project identifier.
:param document_name: Document name or id.
:return dict: If no document with the name was found, return None
"""
response = self.get(project_id)
if response.status_code != 200:
raise SmartcatException(code=response.status_code, message='Invalid response code')
project_data = json.loads(response.content.decode('utf-8'))
if not project_data:
raise SmartcatException(message='Invalid response')
name = document_name.lower()
for d in project_data['documents']:
if d['id'] == name or d['name'].lower() == name:
return d
return None
class Document(BaseResource):
def update(self, document_id, files):
"""Updates document
:param document_id: The document identifier.
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``)
for multipart encoding upload.
``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string
defining the content type of the given file and ``custom_headers`` a dict-like object containing additional
headers to add for the file
:return: :class:`Response <Response>` object
:rtype: requests.Response
todo:: implement updateDocumentModel
"""
return self.send_put_request(
'/api/integration/v1/document/update',
files=files,
params={'documentId': document_id})
def rename(self, id, name):
"""Renames document
:param id: The document identifier.
:param name: New name.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return self.send_put_request(
'/api/integration/v1/document/rename',
params={'documentId': id, 'name': name})
def get_translation_status(self, id):
"""Receive the status of adding document translation.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return self.send_get_request(
'/api/integration/v1/document/translate/status',
params={'documentId': id})
def translate(self, id, files):
"""Translate the selected document using the uploaded translation file.
note::Available only for updatable file formats (in actual practice,
these currently include resource files with unique resource IDs)
This assigns a task to be processed; the translation
job may not be finished at the time the request is completed.
:param id: The document identifier.
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``)
for multipart encoding upload.
``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string
defining the content type of the given file and ``custom_headers`` a dict-like object containing additional
headers to add for the file
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return self.send_put_request(
'/api/integration/v1/document/translate',
files=files,
params={'documentId': id})
def request_export(self, document_ids, target_type='target'):
"""Sends task to export translations
:param document_ids: The document identifier string or list of the identifier.
:param target_type: (optional): The translation document type: xliff or target.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
if isinstance(document_ids, str):
document_ids = [document_ids]
params = {
'documentIds': '\n'.join(document_ids),
'type': target_type
}
return self.send_post_request('/api/integration/v1/document/export', params=params)
def download_export_result(self, task_id):
"""Download the results of export
:param task_id: The export task identifier
"""
return self.send_get_request('/api/integration/v1/document/export/%s' % task_id, stream=True)
def assign(self, document_id, stage_number, executive_user_id):
params = {
'documentId': document_id,
'stageNumber': stage_number,
}
data = {
"executives": [
{
"id": executive_user_id,
"wordsCount": 0
}
],
"minWordsCountForExecutive": 0,
"assignmentMode": "distributeAmongAll"
}
return self.send_post_request('/api/integration/v1/document/assign', params=params, json=data)
def unassign(self, document_id, stage_number, executive_user_id):
params = {
'documentId': document_id,
'stageNumber': stage_number,
}
return self.send_post_request('/api/integration/v1/document/unassign', params=params, json=executive_user_id)
class Account(BaseResource):
def search_my_team(self, params):
return self.send_post_request('/api/integration/v1/account/searchMyTeam', json=params)
|
[
"requests.Session",
"json.dumps"
] |
[((3932, 3950), 'requests.Session', 'requests.Session', ([], {}), '()\n', (3948, 3950), False, 'import requests\n'), ((5973, 5989), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (5983, 5989), False, 'import json\n')]
|
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import re
import spacy
import pickle
import time
from collections import defaultdict
import pmi_tfidf_classifier as ptic
path = "../data/"
np.random.seed(250)
#spacy.prefer_gpu()
#nlp = spacy.load("en_core_sci_sm", disable=['ner', 'parser'])
data_raw = pd.read_csv(path + 'DILI_data.csv')
indices = np.random.permutation(data_raw.index)
data = data_raw.loc[indices]
data = data_raw.sample(frac=1)
idx = int(data.shape[0] * 0.2)
test_data = data.iloc[:idx]
train_data = data.iloc[idx:]
targets_train = train_data['Label'].values
targets_test = test_data['Label'].values
tokenized_texts = ptic.tokenization(train_data)
tokenized_test_texts = ptic.tokenization(test_data)
N = len(tokenized_texts)
accuracies = []
precisions = []
recalls = []
F1s = []
dict_size = [i for i in range(0.02, 1, 0.01)]
for i in dict_size:
part = tokenized_texts[:int(N * i)]
word2text_count = ptic.get_word_stat(part)
words_pmis = ptic.create_pmi_dict(part, targets_train, min_count=20)
results = ptic.classify_pmi_based(words_pmis, word2text_count, tokenized_test_texts, N)
precision = np.sum( np.logical_and(results, targets_test) ) / np.sum(results)
recall = np.sum( np.logical_and(results, targets_test) ) / np.sum(targets_test)
F1 = 2 * (recall * precision)/(recall + precision)
accuracy = (results == targets_test).mean()
accuracies.append( accuracy )
precisions.append( precisions )
recalls.append( recall )
FP_rate = ((results - targets_test) == 1).sum()/np.sum(targets_test)
FN_rate = ((results - targets_test) == -1).sum()/np.sum(targets_test == 0)
print("Accuracy: %s\t \nPrecision: %s\t \nRecall: %s\t \nF1: %s\t" % (accuracy, precision, recall, F1))
print("FP: %s\t \nFN: %s\t" % (FP_rate, FN_rate))
|
[
"pmi_tfidf_classifier.get_word_stat",
"numpy.random.seed",
"numpy.sum",
"numpy.logical_and",
"pandas.read_csv",
"pmi_tfidf_classifier.create_pmi_dict",
"pmi_tfidf_classifier.classify_pmi_based",
"numpy.random.permutation",
"pmi_tfidf_classifier.tokenization"
] |
[((211, 230), 'numpy.random.seed', 'np.random.seed', (['(250)'], {}), '(250)\n', (225, 230), True, 'import numpy as np\n'), ((326, 361), 'pandas.read_csv', 'pd.read_csv', (["(path + 'DILI_data.csv')"], {}), "(path + 'DILI_data.csv')\n", (337, 361), True, 'import pandas as pd\n'), ((372, 409), 'numpy.random.permutation', 'np.random.permutation', (['data_raw.index'], {}), '(data_raw.index)\n', (393, 409), True, 'import numpy as np\n'), ((661, 690), 'pmi_tfidf_classifier.tokenization', 'ptic.tokenization', (['train_data'], {}), '(train_data)\n', (678, 690), True, 'import pmi_tfidf_classifier as ptic\n'), ((714, 742), 'pmi_tfidf_classifier.tokenization', 'ptic.tokenization', (['test_data'], {}), '(test_data)\n', (731, 742), True, 'import pmi_tfidf_classifier as ptic\n'), ((952, 976), 'pmi_tfidf_classifier.get_word_stat', 'ptic.get_word_stat', (['part'], {}), '(part)\n', (970, 976), True, 'import pmi_tfidf_classifier as ptic\n'), ((994, 1049), 'pmi_tfidf_classifier.create_pmi_dict', 'ptic.create_pmi_dict', (['part', 'targets_train'], {'min_count': '(20)'}), '(part, targets_train, min_count=20)\n', (1014, 1049), True, 'import pmi_tfidf_classifier as ptic\n'), ((1065, 1142), 'pmi_tfidf_classifier.classify_pmi_based', 'ptic.classify_pmi_based', (['words_pmis', 'word2text_count', 'tokenized_test_texts', 'N'], {}), '(words_pmis, word2text_count, tokenized_test_texts, N)\n', (1088, 1142), True, 'import pmi_tfidf_classifier as ptic\n'), ((1563, 1583), 'numpy.sum', 'np.sum', (['targets_test'], {}), '(targets_test)\n', (1569, 1583), True, 'import numpy as np\n'), ((1633, 1658), 'numpy.sum', 'np.sum', (['(targets_test == 0)'], {}), '(targets_test == 0)\n', (1639, 1658), True, 'import numpy as np\n'), ((1210, 1225), 'numpy.sum', 'np.sum', (['results'], {}), '(results)\n', (1216, 1225), True, 'import numpy as np\n'), ((1289, 1309), 'numpy.sum', 'np.sum', (['targets_test'], {}), '(targets_test)\n', (1295, 1309), True, 'import numpy as np\n'), ((1168, 1205), 'numpy.logical_and', 'np.logical_and', (['results', 'targets_test'], {}), '(results, targets_test)\n', (1182, 1205), True, 'import numpy as np\n'), ((1247, 1284), 'numpy.logical_and', 'np.logical_and', (['results', 'targets_test'], {}), '(results, targets_test)\n', (1261, 1284), True, 'import numpy as np\n')]
|
# -*- coding: utf-8 -*-
"""Heartbeat service.
This is the internal thread responsible for sending heartbeat events
at regular intervals (may not be an actual thread).
"""
from __future__ import absolute_import, unicode_literals
from celery.signals import heartbeat_sent
from celery.utils.sysinfo import load_average
from .state import SOFTWARE_INFO, active_requests, all_total_count
__all__ = ('Heart',)
class Heart(object):
"""Timer sending heartbeats at regular intervals.
Arguments:
timer (kombu.asynchronous.timer.Timer): Timer to use.
eventer (celery.events.EventDispatcher): Event dispatcher
to use.
interval (float): Time in seconds between sending
heartbeats. Default is 2 seconds.
"""
def __init__(self, timer, eventer, interval=None):
self.timer = timer
self.eventer = eventer
self.interval = float(interval or 2.0)
self.tref = None
# Make event dispatcher start/stop us when enabled/disabled.
self.eventer.on_enabled.add(self.start)
self.eventer.on_disabled.add(self.stop)
# Only send heartbeat_sent signal if it has receivers.
self._send_sent_signal = (
heartbeat_sent.send if heartbeat_sent.receivers else None)
def _send(self, event, retry=True):
if self._send_sent_signal is not None:
self._send_sent_signal(sender=self)
return self.eventer.send(event, freq=self.interval,
active=len(active_requests),
processed=all_total_count[0],
loadavg=load_average(),
retry=retry,
**SOFTWARE_INFO)
def start(self):
if self.eventer.enabled:
self._send('worker-online')
self.tref = self.timer.call_repeatedly(
self.interval, self._send, ('worker-heartbeat',),
)
def stop(self):
if self.tref is not None:
self.timer.cancel(self.tref)
self.tref = None
if self.eventer.enabled:
self._send('worker-offline', retry=False)
|
[
"celery.utils.sysinfo.load_average"
] |
[((1646, 1660), 'celery.utils.sysinfo.load_average', 'load_average', ([], {}), '()\n', (1658, 1660), False, 'from celery.utils.sysinfo import load_average\n')]
|
import cell
import line
def test_str():
_line = line.Line(cell.Cell(3, 3), cell.Cell(6, 3))
assert str(_line) == '((3, 3, 0), (6, 3, 0))'
def test_repr():
_line = line.Line(cell.Cell(3, 3), cell.Cell(6, 3))
assert repr(_line) == 'line.Line((3, 3, 0), (6, 3, 0))'
def test_length_distance_direct():
start = cell.Cell(3, 3)
end = cell.Cell(6, 3)
_line = line.Line(start, end)
assert _line.length() == 3.0
assert _line.length(squared=True) == 9.0
def test_length_angle():
start = cell.Cell(0, 0)
end = cell.Cell(3, 4)
_line = line.Line(start, end)
assert _line.length() == 5.0 # 3-4-5 triangle
def test_discretize_line_simple():
start = cell.Cell(0, 0)
end = cell.Cell(2, 0)
_line = line.Line(start, end)
coords = [(0, 0), (1, 0), (2, 0)]
expected = [cell.Cell(x) for x in coords]
assert _line.discretize() == expected
def test_discretize_line_x5():
start = cell.Cell(645, 463)
end = cell.Cell(651, 467)
_line = line.Line(start, end)
expected = [cell.Cell(x) for x in ((645, 463), (646, 464), (647, 464),
(648, 465), (649, 466), (650, 466),
(651, 467))]
result = list(_line.discretize())
assert result == expected
def test_discretize_line_45():
start = cell.Cell(0, 0)
end = cell.Cell(-3, -3)
_line = line.Line(start, end)
expected = [cell.Cell(x) for x in ((0, 0), (-1, -1), (-2, -2), (-3, -3))]
assert _line.discretize() == expected
def test_discretize_line_27():
start = cell.Cell(0, 0)
end = cell.Cell(2, 6)
_line = line.Line(start, end)
coords = [(0, 0), (0, 1), (1, 2), (1, 3), (1, 4), (2, 5), (2, 6)]
expected = [cell.Cell(x) for x in coords]
assert _line.discretize() == expected
|
[
"line.Line",
"cell.Cell"
] |
[((330, 345), 'cell.Cell', 'cell.Cell', (['(3)', '(3)'], {}), '(3, 3)\n', (339, 345), False, 'import cell\n'), ((356, 371), 'cell.Cell', 'cell.Cell', (['(6)', '(3)'], {}), '(6, 3)\n', (365, 371), False, 'import cell\n'), ((384, 405), 'line.Line', 'line.Line', (['start', 'end'], {}), '(start, end)\n', (393, 405), False, 'import line\n'), ((523, 538), 'cell.Cell', 'cell.Cell', (['(0)', '(0)'], {}), '(0, 0)\n', (532, 538), False, 'import cell\n'), ((549, 564), 'cell.Cell', 'cell.Cell', (['(3)', '(4)'], {}), '(3, 4)\n', (558, 564), False, 'import cell\n'), ((577, 598), 'line.Line', 'line.Line', (['start', 'end'], {}), '(start, end)\n', (586, 598), False, 'import line\n'), ((698, 713), 'cell.Cell', 'cell.Cell', (['(0)', '(0)'], {}), '(0, 0)\n', (707, 713), False, 'import cell\n'), ((724, 739), 'cell.Cell', 'cell.Cell', (['(2)', '(0)'], {}), '(2, 0)\n', (733, 739), False, 'import cell\n'), ((752, 773), 'line.Line', 'line.Line', (['start', 'end'], {}), '(start, end)\n', (761, 773), False, 'import line\n'), ((944, 963), 'cell.Cell', 'cell.Cell', (['(645)', '(463)'], {}), '(645, 463)\n', (953, 963), False, 'import cell\n'), ((974, 993), 'cell.Cell', 'cell.Cell', (['(651)', '(467)'], {}), '(651, 467)\n', (983, 993), False, 'import cell\n'), ((1006, 1027), 'line.Line', 'line.Line', (['start', 'end'], {}), '(start, end)\n', (1015, 1027), False, 'import line\n'), ((1342, 1357), 'cell.Cell', 'cell.Cell', (['(0)', '(0)'], {}), '(0, 0)\n', (1351, 1357), False, 'import cell\n'), ((1368, 1385), 'cell.Cell', 'cell.Cell', (['(-3)', '(-3)'], {}), '(-3, -3)\n', (1377, 1385), False, 'import cell\n'), ((1398, 1419), 'line.Line', 'line.Line', (['start', 'end'], {}), '(start, end)\n', (1407, 1419), False, 'import line\n'), ((1584, 1599), 'cell.Cell', 'cell.Cell', (['(0)', '(0)'], {}), '(0, 0)\n', (1593, 1599), False, 'import cell\n'), ((1610, 1625), 'cell.Cell', 'cell.Cell', (['(2)', '(6)'], {}), '(2, 6)\n', (1619, 1625), False, 'import cell\n'), ((1638, 1659), 'line.Line', 'line.Line', (['start', 'end'], {}), '(start, end)\n', (1647, 1659), False, 'import line\n'), ((64, 79), 'cell.Cell', 'cell.Cell', (['(3)', '(3)'], {}), '(3, 3)\n', (73, 79), False, 'import cell\n'), ((81, 96), 'cell.Cell', 'cell.Cell', (['(6)', '(3)'], {}), '(6, 3)\n', (90, 96), False, 'import cell\n'), ((188, 203), 'cell.Cell', 'cell.Cell', (['(3)', '(3)'], {}), '(3, 3)\n', (197, 203), False, 'import cell\n'), ((205, 220), 'cell.Cell', 'cell.Cell', (['(6)', '(3)'], {}), '(6, 3)\n', (214, 220), False, 'import cell\n'), ((828, 840), 'cell.Cell', 'cell.Cell', (['x'], {}), '(x)\n', (837, 840), False, 'import cell\n'), ((1044, 1056), 'cell.Cell', 'cell.Cell', (['x'], {}), '(x)\n', (1053, 1056), False, 'import cell\n'), ((1436, 1448), 'cell.Cell', 'cell.Cell', (['x'], {}), '(x)\n', (1445, 1448), False, 'import cell\n'), ((1746, 1758), 'cell.Cell', 'cell.Cell', (['x'], {}), '(x)\n', (1755, 1758), False, 'import cell\n')]
|
import pandas as pd
import numpy as np
import re
import urllib.request
import pandas as pd
import glob
import zipfile
class inflecteur():
def __init__(self, filepath=None):
self.dico_transformer = None
self.nlp_token_class = None
self.blob_to_gram = {'NN': 'Nom', 'NNP': 'Nom', 'VB': 'Verbe', 'JJ': 'Adjectif', 'DT': 'Déterminant', 'PRP': 'Pronom', 'IN': 'Préposition'}
self.tense_table = {'Conditionnel': 'C',
'Futur': 'F',
'Imparfait': 'I',
'Subjonctif Imparfait': 'T',
'Infinitif': 'W',
'Participe Présent': 'G',
'Passé Composé': 'K',
'Passé Simple': 'J',
'Présent': 'P',
'Subjonctif Présent': 'S',
'Impératif Présent': 'Y'}
self.tense_table_inv = {v: k for k, v in self.tense_table.items()}
self.person_table = {'1s': 'Je',
'2s': 'Tu',
'3s': 'Il/Elle',
'1p': 'Nous',
'2p': 'Vous',
'3p': 'Ils/Elles'}
self.bert_to_gram = {'ADJ': {'category': 'Adjectif', 'extra info': None},
'ADJWH': {'category': 'Adjectif', 'extra info': None},
'ADV': {'category': 'Adverbe', 'extra info': None},
'ADVWH': {'category': 'Adverbe', 'extra info': None},
'CC': {'category': 'Conjonction de coordination', 'extra info': None},
'CLO': {'category': 'Pronom', 'extra info': 'obj'},
'CLR': {'category': 'Pronom', 'extra info': 'refl'},
'CLS': {'category': 'Pronom', 'extra info': 'suj'},
'CS': {'category': 'Conjonction de subordination', 'extra info': None},
'DET': {'category': 'Déterminant', 'extra info': None},
'DETWH': {'category': 'Déterminant', 'extra info': None},
'ET': {'category': 'Mot étranger', 'extra info': None},
'I': {'category': 'Interjection', 'extra info': None},
'NC': {'category': 'Nom', 'extra info': None},
'NPP': {'category': 'Nom', 'extra info': None},
'P': {'category': 'Préposition', 'extra info': None},
'P+D': {'category': 'Préposition + déterminant', 'extra info': None},
'PONCT': {'category': 'Signe de ponctuation', 'extra info': None},
'PREF': {'category': 'Préfixe', 'extra info': None},
'PRO': {'category': 'Autres pronoms', 'extra info': None},
'PROREL': {'category': 'Autres pronoms', 'extra info': 'rel'},
'PROWH': {'category': 'Autres pronoms', 'extra info': 'int'},
'U': {'category': '?', 'extra info': None},
'V': {'category': 'Verbe', 'extra info': None},
'VIMP': {'category': 'Verbe imperatif', 'extra info': None},
'VINF': {'category': 'Verbe infinitif', 'extra info': None},
'VPP': {'category': 'Participe passé', 'extra info': None},
'VPR': {'category': 'Participe présent', 'extra info': None},
'VS': {'category': 'Subjonctif', 'extra info': None}}
if filepath is not None:
self.load_dict(filepath)
def download_url(self, url, save_path):
with urllib.request.urlopen(url) as dl_file:
with open(save_path, 'wb') as out_file:
out_file.write(dl_file.read())
def unzip_file(self, filepath, save_path):
with zipfile.ZipFile(filepath, 'r') as zip_ref:
zip_ref.extractall(save_path)
def load_dict(self, filepath=None):
if filepath is not None:
try:
with open(filepath, "r", encoding="utf16") as myfile:
data = myfile.readlines()
except:
print("File not found")
else:
if "dela-fr-public.zip" not in glob.glob('*'):
print("Downloading\t dela-fr-public...")
self.download_url(url="https://github.com/Achuttarsing/inflecteur/blob/ef4d99c7934f10319b07aa35e970185a51c439ff/dela-fr-public.zip?raw=true", save_path="dela-fr-public.zip")
if "dela-fr-public.dic" not in glob.glob('*') and "dela-fr-public.zip" in glob.glob('*'):
print("Unzipping\t dela-fr-public...")
self.unzip_file("dela-fr-public.zip", "./")
if "dela-fr-public.dic" in glob.glob('*'):
print("Loading\t dela-fr-public...")
with open("dela-fr-public.dic", "r", encoding="utf16") as myfile:
data = myfile.readlines()
cat_gram = {"A": "Adjectif","N": "Nom","V": "Verbe","DET": "Déterminant","ADV": "Adverbe","PRO": "Pronom","PREP": "Préposition","INTJ": "Interjection","CONJS": "Conjonction de subordination","CONJC": "Conjonction de coordination","PFX": "Préfixe","XINC": "Partie de composé","XI": "Partie de composé","X": "Partie de composé"}
type_transformer = ['Adjectif','Déterminant','Partie de composé','PREPDET','Pronom','PREPADJ','PREPPRO','PRON', 'Verbe','Nom']
dico = pd.DataFrame(data, columns=['forme'])
dico['forme'] = dico['forme'].apply(lambda x: re.sub(r'\n',r'',x))
dico['part'] = dico['forme'].apply(lambda x: x.split(':')[0])
dico['forme'] = dico['forme'].apply(lambda x: ':'.join(x.split(':')[1:]))
dico['type'] = dico['part'].apply(lambda x: x.split('.')[-1])
dico['part'] = dico['part'].apply(lambda x: '.'.join(x.split('.')[:-1]))
dico['lemma'] = dico['part'].apply(lambda x: x.split(',')[-1])
dico['part'] = dico['part'].apply(lambda x: ','.join(x.split(',')[:-1]))
dico['part'] = dico['part'].apply(lambda x: re.sub(r'\\','',x))
dico['gram'] = dico['type'].apply(lambda x: x.split('+')[0])
dico['gram'] = dico['gram'].apply(lambda x: cat_gram[x] if x in list(cat_gram.keys()) else x).astype('category')
dico['type'] = dico['type'].apply(lambda x: '+'.join(x.split('+')[1:]))
#dico['lenform'] = dico['forme'].apply(lambda x: len(x))
#dico = dico.sort_values(by=['part','lenform']).copy()
#print('ln=',len(dico[(dico.lemma == 'savoir') & (dico.forme == 'F1s')]))
#dico = dico.drop_duplicates(subset=['part','gram'], keep='last')
#dico.drop(columns=['lenform'], inplace=True)
dico = dico.set_index('part')
dico = dico[[len(x.split(' ')) <= 2 for x in dico.index]].copy()
dico_transformer = dico[(dico.gram.isin(type_transformer)) & (dico.forme != '')].copy()
# "3s:3p" -> "3fs:3ms:3fp:3mp"
dico_transformer.loc[dico_transformer.gram == 'Pronom', 'forme'] = dico_transformer.loc[dico_transformer.gram == 'Pronom', 'forme'].apply(self.develop_indef_formes)
dico_transformer['forme'] = dico_transformer['forme'].astype('category')
dico_transformer['gram'] = dico_transformer['gram'].astype('category')
dico_transformer = dico_transformer.drop(columns=['type'])
dico_transformer.loc[['il','elle','ils','elles'], 'lemma'] = '3P'
dico_transformer.loc[['je','nous'], 'lemma'] = '1P'
dico_transformer.loc[['tu','vous'], 'lemma'] = '2P'
dico_transformer['lemma'] = dico_transformer.apply(lambda x: x.name if x.lemma == '' else x.lemma, axis=1)
self.dico_transformer = dico_transformer.drop_duplicates()
print("Done.")
def load_bert_model(self):
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
tokenizer = AutoTokenizer.from_pretrained("gilf/french-camembert-postag-model")
model = AutoModelForTokenClassification.from_pretrained("gilf/french-camembert-postag-model")
self.nlp_token_class = pipeline('ner', model=model, tokenizer=tokenizer, grouped_entities=True)
def develop_indef_formes(self, formes):
formes = formes.split(':')
res = []
for f in formes:
if 'm' not in f and 'f' not in f:
res.append(f[:-1]+'f'+f[-1])
res.append(f[:-1]+'m'+f[-1])
else:
res.append(f)
return ':'.join(res)
def rebuild_text(self, text):
text = re.sub(r' \. ',r'. ',text)
text = re.sub(r' +',r' ',text)
text = re.sub(r' \, ',r', ',text)
text = re.sub(r" \' ",r" \' ",text)
text = re.sub(r" ’ ",r"’",text)
text = re.sub(r"(\w) - (\w)",r"\1-\2",text)
text = re.sub(r"(\w) ’(\w)",r"\1'\2",text)
# C' -> Ce
text = re.sub(r"([cC])’([^aeiouyAEIOUYéèàù])",r"\1e \2",text)
return text
def detect_person(self, tokens):
tokens = set([t.lower() for t in tokens])
if len(set(["je","j","j'",'nous']).intersection(tokens)) > 0:
return '1'
elif len(set(["tu","vous"]).intersection(tokens)) > 0:
return '2'
else:
return '3'
def build_cible(self, row, gender, number, tense, person):
base_cible = row.forme.split(':')[0]
if row.gram == 'Verbe':
if base_cible == 'W' or base_cible == 'G': return base_cible
tense = base_cible[0] if tense is None else self.tense_table[tense]
if person is None: person = base_cible[1]
if number is None: number = base_cible[2]
return tense + person + number
elif row.gram == 'Nom':
gender = base_cible[0]
if number is None: number = base_cible[1]
return gender + number
elif row.gram == 'Pronom':
if len(base_cible) == 3:
if person is None: person = base_cible[0]
if gender is None: gender = base_cible[1]
if number is None: number = base_cible[2]
return person + gender + number
elif len(base_cible) == 2:
if gender is None: gender = base_cible[0]
if number is None: number = base_cible[1]
return gender + number
elif (row.gram == 'Déterminant') or (row.gram == 'Adjectif') or (row.gram == 'PREPDET'):
if gender is None: gender = base_cible[0]
if number is None: number = base_cible[1]
return gender + number
def inflect_word(self, word, gender=None, number=None, tense=None, pos=None, person=None):
"""
Inflect a word according to gender, number and tense.
Parameters:
word (str): The word to inflect
gender (str): 'f' for female, 'm' for male
number (str): 's' for singular, 'p' for plural
tense (str): 'Conditionnel', 'Futur', 'Participe présent', 'Imparfait', 'Passé simple', 'Passé composé', 'Présent', 'Imparfait du subjonctif', 'Infinitif'
pos (str): 'Adjectif', 'Déterminant', 'Partie de composé', 'PREPDET', 'Pronom', 'PREPADJ', 'PREPPRO', 'PRON', 'Verbe', 'Nom'
person (str): '1' for 'je, nous', '2' for 'tu, vous', '3' for 'il, elle, ils, elles'
Returns:
word inflected: The word inflected if possible else the initial word
"""
maj = word[0].isupper()
oriword = word
word = word.lower()
if word in self.dico_transformer.index:
row = self.dico_transformer.loc[[word]] if pos is None else self.dico_transformer[(self.dico_transformer.index == word) & (self.dico_transformer.gram == pos)]
if len(row) != 0: row = row.iloc[0].copy()
else: return oriword
else:
return oriword
cible = self.build_cible(row, gender, number, tense, person)
try:
word_affected = self.dico_transformer.loc[(self.dico_transformer.lemma == row.lemma) & (self.dico_transformer.forme.str.contains(cible)) & (self.dico_transformer.gram == pos),[]].index.to_list()
word_affected = word if word in word_affected else word_affected[0]
#print(word, "→", word_affected, "\tcible =", cible, "\tpos =", pos)
except:
#print("not found", word, "→", oriword, "\tcible =", cible, "\tpos =", pos)
return oriword
return word_affected[0].upper() + word_affected[1:] if maj else word_affected
def inflect_sentence(self, text, gender=None, number=None, tense=None):
"""
Inflect a sentence according to gender, number and tense.
Parameters:
text (str): Sentence to inflect
gender (str): 'f' for female, 'm' for male
number (str): 's' for singular, 'p' for plural
tense (str): 'Conditionnel', 'Futur', 'Participe présent', 'Imparfait', 'Passé simple', 'Passé composé', 'Présent', 'Imparfait du subjonctif', 'Infinitif'
Returns:
sentence infected: The sentence inflected
"""
if self.nlp_token_class is None : self.load_bert_model()
tokens = self.nlp_token_class(text)
words = [x['word'] for x in tokens]
segments_id = [0] + list(np.array(([c for c, x in enumerate(tokens) if x['word'][-1] in [',','.','!','?']]))+1)
segments_mask = []
for i in range(len(segments_id)-1):
segments_mask += [segments_id[i]]*(segments_id[i+1]-segments_id[i])
if len(segments_mask) != 0 and len(segments_mask) < len(words):
segments_mask += [segments_id[-1]]*(len(words)-len(segments_mask))
elif len(segments_mask) == 0:
segments_mask = [0]*len(words)
res = []
for c, t in enumerate(tokens):
if t['entity_group'] == 'V':
#print(c, t['word'], segments_mask[c])
if c == segments_mask[c]:
potential_person = self.detect_person(words[c:c+3])
else:
potential_person = self.detect_person(words[(c-2):c])
else: potential_person = None
res.append(self.inflect_word(t['word'], tense=tense, pos=self.bert_to_gram[t['entity_group']]['category'], person=potential_person, gender=gender, number=number))
return self.rebuild_text(' '.join(res))
def get_word_form(self, word):
"""
Get the potential forms of a word
Parameters:
word (str): Sentence to inflect
Returns:
list of potential forms
"""
try:
potential_forms = self.dico_transformer.loc[[word]].copy()
except:
return None
potential_forms_dev = {}
potential_forms_dev['lemma'] = []
potential_forms_dev['gram'] = []
potential_forms_dev['forme'] = []
potential_forms_dev['gender'] = []
potential_forms_dev['number'] = []
potential_forms_dev['tense'] = []
potential_forms_dev['person'] = []
for i, id in enumerate(potential_forms.index):
for f in potential_forms.iloc[i].forme.split(':'):
potential_forms_dev['lemma'].append(potential_forms.iloc[i].lemma)
potential_forms_dev['gram'].append(potential_forms.iloc[i].gram)
potential_forms_dev['forme'].append(f)
if 'm' in f: potential_forms_dev['gender'].append('M')
elif 'f' in f: potential_forms_dev['gender'].append('F')
else: potential_forms_dev['gender'].append(None)
if 's' in f: potential_forms_dev['number'].append('singular')
elif 'p' in f: potential_forms_dev['number'].append('plural')
else: potential_forms_dev['number'].append(None)
if potential_forms.iloc[i].gram == 'Verbe':
potential_forms_dev['tense'].append(self.tense_table_inv[re.sub('[^A-Z]','',f)])
if potential_forms_dev['gender'][-1] is None:
res_person = re.sub('[A-Z]','',f)
potential_forms_dev['person'].append(self.person_table[res_person]) if res_person is not '' else potential_forms_dev['person'].append(None)
else: potential_forms_dev['person'].append(None)
else:
potential_forms_dev['tense'].append(None)
potential_forms_dev['person'].append(None)
return pd.DataFrame(potential_forms_dev)
|
[
"pandas.DataFrame",
"transformers.AutoModelForTokenClassification.from_pretrained",
"zipfile.ZipFile",
"transformers.pipeline",
"transformers.AutoTokenizer.from_pretrained",
"glob.glob",
"re.sub"
] |
[((5682, 5719), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': "['forme']"}), "(data, columns=['forme'])\n", (5694, 5719), True, 'import pandas as pd\n'), ((8159, 8226), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['"""gilf/french-camembert-postag-model"""'], {}), "('gilf/french-camembert-postag-model')\n", (8188, 8226), False, 'from transformers import AutoTokenizer, AutoModelForTokenClassification\n'), ((8243, 8333), 'transformers.AutoModelForTokenClassification.from_pretrained', 'AutoModelForTokenClassification.from_pretrained', (['"""gilf/french-camembert-postag-model"""'], {}), "(\n 'gilf/french-camembert-postag-model')\n", (8290, 8333), False, 'from transformers import AutoTokenizer, AutoModelForTokenClassification\n'), ((8360, 8432), 'transformers.pipeline', 'pipeline', (['"""ner"""'], {'model': 'model', 'tokenizer': 'tokenizer', 'grouped_entities': '(True)'}), "('ner', model=model, tokenizer=tokenizer, grouped_entities=True)\n", (8368, 8432), False, 'from transformers import pipeline\n'), ((8818, 8845), 're.sub', 're.sub', (['""" \\\\. """', '""". """', 'text'], {}), "(' \\\\. ', '. ', text)\n", (8824, 8845), False, 'import re\n'), ((8860, 8883), 're.sub', 're.sub', (['""" +"""', '""" """', 'text'], {}), "(' +', ' ', text)\n", (8866, 8883), False, 'import re\n'), ((8899, 8926), 're.sub', 're.sub', (['""" \\\\, """', '""", """', 'text'], {}), "(' \\\\, ', ', ', text)\n", (8905, 8926), False, 'import re\n'), ((8941, 8971), 're.sub', 're.sub', (['""" \\\\\' """', '""" \\\\\' """', 'text'], {}), '(" \\\\\' ", " \\\\\' ", text)\n', (8947, 8971), False, 'import re\n'), ((8985, 9009), 're.sub', 're.sub', (['""" ’ """', '"""’"""', 'text'], {}), "(' ’ ', '’', text)\n", (8991, 9009), False, 'import re\n'), ((9025, 9065), 're.sub', 're.sub', (['"""(\\\\w) - (\\\\w)"""', '"""\\\\1-\\\\2"""', 'text'], {}), "('(\\\\w) - (\\\\w)', '\\\\1-\\\\2', text)\n", (9031, 9065), False, 'import re\n'), ((9077, 9116), 're.sub', 're.sub', (['"""(\\\\w) ’(\\\\w)"""', '"""\\\\1\'\\\\2"""', 'text'], {}), '(\'(\\\\w) ’(\\\\w)\', "\\\\1\'\\\\2", text)\n', (9083, 9116), False, 'import re\n'), ((9147, 9203), 're.sub', 're.sub', (['"""([cC])’([^aeiouyAEIOUYéèàù])"""', '"""\\\\1e \\\\2"""', 'text'], {}), "('([cC])’([^aeiouyAEIOUYéèàù])', '\\\\1e \\\\2', text)\n", (9153, 9203), False, 'import re\n'), ((16862, 16895), 'pandas.DataFrame', 'pd.DataFrame', (['potential_forms_dev'], {}), '(potential_forms_dev)\n', (16874, 16895), True, 'import pandas as pd\n'), ((4071, 4101), 'zipfile.ZipFile', 'zipfile.ZipFile', (['filepath', '"""r"""'], {}), "(filepath, 'r')\n", (4086, 4101), False, 'import zipfile\n'), ((4480, 4494), 'glob.glob', 'glob.glob', (['"""*"""'], {}), "('*')\n", (4489, 4494), False, 'import glob\n'), ((4999, 5013), 'glob.glob', 'glob.glob', (['"""*"""'], {}), "('*')\n", (5008, 5013), False, 'import glob\n'), ((5774, 5794), 're.sub', 're.sub', (['"""\\\\n"""', '""""""', 'x'], {}), "('\\\\n', '', x)\n", (5780, 5794), False, 'import re\n'), ((6302, 6323), 're.sub', 're.sub', (['"""\\\\\\\\"""', '""""""', 'x'], {}), "('\\\\\\\\', '', x)\n", (6308, 6323), False, 'import re\n'), ((4786, 4800), 'glob.glob', 'glob.glob', (['"""*"""'], {}), "('*')\n", (4795, 4800), False, 'import glob\n'), ((4829, 4843), 'glob.glob', 'glob.glob', (['"""*"""'], {}), "('*')\n", (4838, 4843), False, 'import glob\n'), ((16446, 16468), 're.sub', 're.sub', (['"""[A-Z]"""', '""""""', 'f'], {}), "('[A-Z]', '', f)\n", (16452, 16468), False, 'import re\n'), ((16319, 16342), 're.sub', 're.sub', (['"""[^A-Z]"""', '""""""', 'f'], {}), "('[^A-Z]', '', f)\n", (16325, 16342), False, 'import re\n')]
|
from textwrap import dedent
from behave import then, when
import wrappers
@when('we run dbcli with {arg}')
def step_run_cli_with_arg(context, arg):
wrappers.run_cli(context, run_args=arg.split('='))
@when('we execute a small query')
def step_execute_small_query(context):
context.cli.sendline('select 1')
@when('we execute a large query')
def step_execute_large_query(context):
context.cli.sendline(
'select {}'.format(','.join([str(n) for n in range(1, 50)])))
@then('we see small results in horizontal format')
def step_see_small_results(context):
wrappers.expect_pager(context, dedent("""\
+---+\r
| 1 |\r
+---+\r
| 1 |\r
+---+\r
\r
"""), timeout=5)
wrappers.expect_exact(context, '1 row in set', timeout=2)
@then('we see large results in vertical format')
def step_see_large_results(context):
rows = ['{n:3}| {n}'.format(n=str(n)) for n in range(1, 50)]
expected = ('***************************[ 1. row ]'
'***************************\r\n' +
'{}\r\n'.format('\r\n'.join(rows) + '\r\n'))
wrappers.expect_pager(context, expected, timeout=5)
wrappers.expect_exact(context, '1 row in set', timeout=2)
|
[
"textwrap.dedent",
"behave.when",
"behave.then",
"wrappers.expect_exact",
"wrappers.expect_pager"
] |
[((79, 110), 'behave.when', 'when', (['"""we run dbcli with {arg}"""'], {}), "('we run dbcli with {arg}')\n", (83, 110), False, 'from behave import then, when\n'), ((210, 242), 'behave.when', 'when', (['"""we execute a small query"""'], {}), "('we execute a small query')\n", (214, 242), False, 'from behave import then, when\n'), ((322, 354), 'behave.when', 'when', (['"""we execute a large query"""'], {}), "('we execute a large query')\n", (326, 354), False, 'from behave import then, when\n'), ((493, 542), 'behave.then', 'then', (['"""we see small results in horizontal format"""'], {}), "('we see small results in horizontal format')\n", (497, 542), False, 'from behave import then, when\n'), ((808, 855), 'behave.then', 'then', (['"""we see large results in vertical format"""'], {}), "('we see large results in vertical format')\n", (812, 855), False, 'from behave import then, when\n'), ((747, 804), 'wrappers.expect_exact', 'wrappers.expect_exact', (['context', '"""1 row in set"""'], {'timeout': '(2)'}), "(context, '1 row in set', timeout=2)\n", (768, 804), False, 'import wrappers\n'), ((1132, 1183), 'wrappers.expect_pager', 'wrappers.expect_pager', (['context', 'expected'], {'timeout': '(5)'}), '(context, expected, timeout=5)\n', (1153, 1183), False, 'import wrappers\n'), ((1188, 1245), 'wrappers.expect_exact', 'wrappers.expect_exact', (['context', '"""1 row in set"""'], {'timeout': '(2)'}), "(context, '1 row in set', timeout=2)\n", (1209, 1245), False, 'import wrappers\n'), ((615, 740), 'textwrap.dedent', 'dedent', (["' +---+\\r\\n | 1 |\\r\\n +---+\\r\\n | 1 |\\r\\n +---+\\r\\n \\r\\n '"], {}), "(\n ' +---+\\r\\n | 1 |\\r\\n +---+\\r\\n | 1 |\\r\\n +---+\\r\\n \\r\\n '\n )\n", (621, 740), False, 'from textwrap import dedent\n')]
|
import requests
api_url = 'https://anipython.com/crawler/8/api/'
response = requests.get(api_url)
data_dict = response.json()
print(data_dict)
"""
输出:
{
'data': [
{
'desc': '如果只选一门编程语言来学习, 就学 Python 吧',
'id': 1,
'title': 'Python入门视频',
'url': 'https://study.163.com/course/introduction/1211262812.htm?share=2&shareId=480000002210461'
},
{
'desc': '用python 的pandas 库进行数据分析, 来操作excel表格, 实现办公自动化。',
'id': 2,
'title': 'Python Pandas Excel 办公自动化',
'url': 'https://study.163.com/course/introduction/1209966922.htm?share=2&shareId=480000002210461'
},
{
'desc': '学习使用 flask 进行 python web 开发',
'id': 3,
'title': 'Python Web 接单实战',
'url': 'https://study.163.com/course/introduction/1211591811.htm?share=2&shareId=480000002210461'
},
...
]
}
"""
|
[
"requests.get"
] |
[((78, 99), 'requests.get', 'requests.get', (['api_url'], {}), '(api_url)\n', (90, 99), False, 'import requests\n')]
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PacketStorm information
# Based on Vulners
#
# Software is free software released under the "Modified BSD license"
#
# Copyright (c) 2017 <NAME> - <EMAIL>
# Sources
SOURCE_NAME = 'packetstorm'
SOURCE_FILE = "https://vulners.com/api/v3/archive/collection/?type=packetstorm&api_key={}"
# Imports
import json
from collections import defaultdict
from lib.Config import Configuration as conf
from lib.Source import Source
def add_if(_, entry, item, name=None):
if not name: name=item
if entry.get(item): _[name] = entry[item]
def clean_date(_, item):
if _.get(item): _[item] = _[item].split('T')[0]
class PacketStorm(Source):
def __init__(self):
self.name = SOURCE_NAME
self.cves = defaultdict(list)
source_file = SOURCE_FILE.format(conf.readSetting("vulners", "api_key", ""))
_file, r = conf.getFeedData(SOURCE_NAME, source_file)
data = json.loads(str(_file.read(), 'utf-8'))
for entry in data:
ps = {}
source = entry['_source']
add_if(ps, source, 'published')
add_if(ps, source, 'lastseen', 'last seen')
add_if(ps, source, 'id')
add_if(ps, source, 'title')
add_if(ps, source, 'description')
add_if(ps, source, 'references')
add_if(ps, source, 'reporter')
add_if(ps, source, 'href', 'source')
add_if(ps, source, 'sourceHref', 'data source')
for date in ['published', 'last seen']: clean_date(ps, date)
if ps:
for CVE in source['cvelist']: self.cves[CVE].append(ps)
def getSearchables(self):
return ['id', 'reporter']
|
[
"collections.defaultdict",
"lib.Config.Configuration.getFeedData",
"lib.Config.Configuration.readSetting"
] |
[((770, 787), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (781, 787), False, 'from collections import defaultdict\n'), ((894, 936), 'lib.Config.Configuration.getFeedData', 'conf.getFeedData', (['SOURCE_NAME', 'source_file'], {}), '(SOURCE_NAME, source_file)\n', (910, 936), True, 'from lib.Config import Configuration as conf\n'), ((830, 872), 'lib.Config.Configuration.readSetting', 'conf.readSetting', (['"""vulners"""', '"""api_key"""', '""""""'], {}), "('vulners', 'api_key', '')\n", (846, 872), True, 'from lib.Config import Configuration as conf\n')]
|
from dtest import Tester
from tools import putget
from ccmlib.cluster import Cluster
class TestMultiDCPutGet(Tester):
def putget_2dc_rf1_test(self):
""" Simple put-get test for 2 DC with one node each (RF=1) [catches #3539] """
cluster = self.cluster
cluster.populate([1, 1]).start()
cursor = self.patient_cql_connection(cluster.nodelist()[0]).cursor()
self.create_ks(cursor, 'ks', { 'dc1' : 1, 'dc2' : 1})
self.create_cf(cursor, 'cf')
putget(cluster, cursor)
def putget_2dc_rf2_test(self):
""" Simple put-get test for 2 DC with 2 node each (RF=2) -- tests cross-DC efficient writes """
cluster = self.cluster
cluster.populate([2, 2]).start()
cursor = self.patient_cql_connection(cluster.nodelist()[0]).cursor()
self.create_ks(cursor, 'ks', { 'dc1' : 2, 'dc2' : 2})
self.create_cf(cursor, 'cf')
putget(cluster, cursor)
|
[
"tools.putget"
] |
[((500, 523), 'tools.putget', 'putget', (['cluster', 'cursor'], {}), '(cluster, cursor)\n', (506, 523), False, 'from tools import putget\n'), ((922, 945), 'tools.putget', 'putget', (['cluster', 'cursor'], {}), '(cluster, cursor)\n', (928, 945), False, 'from tools import putget\n')]
|
from statzcw import zvariance
from statistics import variance
import unittest
class TestZVariance(unittest.TestCase):
def test_variance1(self):
test_data = [1, 2, 3, 4, 5]
self.assertEqual(round(variance(test_data), 5), zvariance.variance(test_data))
def test_stddev2(self):
test_data = [6, 7, 8, 9, 10]
self.assertEqual(round(variance(test_data), 5), zvariance.variance(test_data))
def test_stddev3(self):
test_data = [-10, -20, -30, -40, -50]
self.assertEqual(round(variance(test_data), 5), zvariance.variance(test_data))
if __name__ == '__main__':
unittest.main()
|
[
"unittest.main",
"statistics.variance",
"statzcw.zvariance.variance"
] |
[((622, 637), 'unittest.main', 'unittest.main', ([], {}), '()\n', (635, 637), False, 'import unittest\n'), ((243, 272), 'statzcw.zvariance.variance', 'zvariance.variance', (['test_data'], {}), '(test_data)\n', (261, 272), False, 'from statzcw import zvariance\n'), ((396, 425), 'statzcw.zvariance.variance', 'zvariance.variance', (['test_data'], {}), '(test_data)\n', (414, 425), False, 'from statzcw import zvariance\n'), ((558, 587), 'statzcw.zvariance.variance', 'zvariance.variance', (['test_data'], {}), '(test_data)\n', (576, 587), False, 'from statzcw import zvariance\n'), ((218, 237), 'statistics.variance', 'variance', (['test_data'], {}), '(test_data)\n', (226, 237), False, 'from statistics import variance\n'), ((371, 390), 'statistics.variance', 'variance', (['test_data'], {}), '(test_data)\n', (379, 390), False, 'from statistics import variance\n'), ((533, 552), 'statistics.variance', 'variance', (['test_data'], {}), '(test_data)\n', (541, 552), False, 'from statistics import variance\n')]
|
import fire
import torch
from torch.utils.data import DataLoader as TorchDataLoader
from deepproblog.dataset import DataLoader, QueryDataset
from deepproblog.engines import ExactEngine
from deepproblog.evaluate import get_confusion_matrix
from deepproblog.examples.Forth.Sort.data.for_calibration import RawSortValidationDataset
from deepproblog.examples.Forth import EncodeModule
from deepproblog.model import Model
from deepproblog.network import Network
from deepproblog.calibrated_network import TemperatureScalingNetwork, NetworkECECollector
from deepproblog.train import train_model
def main(
calibrate = False,
calibrate_after_each_train_iteration = False
):
train = 2
test = 8
train_queries = QueryDataset("data/train{}_test{}_train.txt".format(train, test))
dev_queries = QueryDataset("data/train{}_test{}_dev.txt".format(train, test))
test_queries = QueryDataset("data/train{}_test{}_test.txt".format(train, test))
raw_validation_dataset = RawSortValidationDataset()
fc1 = EncodeModule(20, 20, 2)
networks_evolution_collectors = {}
if calibrate == True:
fc1_network = TemperatureScalingNetwork(fc1, "swap_net", TorchDataLoader(raw_validation_dataset, 16), optimizer = torch.optim.Adam(fc1.parameters(), 1.0), calibrate_after_each_train_iteration = calibrate_after_each_train_iteration)
fc1_test_network = TemperatureScalingNetwork(fc1, "swap_net", TorchDataLoader(raw_validation_dataset, 16), k = 1, calibrate_after_each_train_iteration = calibrate_after_each_train_iteration)
networks_evolution_collectors["calibration_collector"] = NetworkECECollector()
else:
fc1_network = Network(fc1, "swap_net", optimizer = torch.optim.Adam(fc1.parameters(), 1.0))
fc1_test_network = Network(fc1, "swap_net", k = 1)
model = Model("compare.pl", [fc1_network])
model.set_engine(ExactEngine(model), cache = True)
test_model = Model("compare.pl", [fc1_test_network])
test_model.set_engine(ExactEngine(test_model), cache = False)
train_obj = train_model(
model,
DataLoader(train_queries, 16),
40,
networks_evolution_collectors,
log_iter = 50,
test_iter = len(train_queries),
test = lambda x: [
("Accuracy", get_confusion_matrix(test_model, dev_queries).accuracy())
],
)
if calibrate:
fc1_network.calibrate()
fc1_test_network.calibrate()
return [train_obj, get_confusion_matrix(test_model, dev_queries, verbose = 0)]
if __name__ == "__main__":
fire.Fire(main())
|
[
"deepproblog.dataset.DataLoader",
"torch.utils.data.DataLoader",
"deepproblog.evaluate.get_confusion_matrix",
"deepproblog.calibrated_network.NetworkECECollector",
"deepproblog.model.Model",
"deepproblog.engines.ExactEngine",
"deepproblog.network.Network",
"deepproblog.examples.Forth.EncodeModule",
"deepproblog.examples.Forth.Sort.data.for_calibration.RawSortValidationDataset"
] |
[((969, 995), 'deepproblog.examples.Forth.Sort.data.for_calibration.RawSortValidationDataset', 'RawSortValidationDataset', ([], {}), '()\n', (993, 995), False, 'from deepproblog.examples.Forth.Sort.data.for_calibration import RawSortValidationDataset\n'), ((1004, 1027), 'deepproblog.examples.Forth.EncodeModule', 'EncodeModule', (['(20)', '(20)', '(2)'], {}), '(20, 20, 2)\n', (1016, 1027), False, 'from deepproblog.examples.Forth import EncodeModule\n'), ((1774, 1808), 'deepproblog.model.Model', 'Model', (['"""compare.pl"""', '[fc1_network]'], {}), "('compare.pl', [fc1_network])\n", (1779, 1808), False, 'from deepproblog.model import Model\n'), ((1877, 1916), 'deepproblog.model.Model', 'Model', (['"""compare.pl"""', '[fc1_test_network]'], {}), "('compare.pl', [fc1_test_network])\n", (1882, 1916), False, 'from deepproblog.model import Model\n'), ((1582, 1603), 'deepproblog.calibrated_network.NetworkECECollector', 'NetworkECECollector', ([], {}), '()\n', (1601, 1603), False, 'from deepproblog.calibrated_network import TemperatureScalingNetwork, NetworkECECollector\n'), ((1731, 1760), 'deepproblog.network.Network', 'Network', (['fc1', '"""swap_net"""'], {'k': '(1)'}), "(fc1, 'swap_net', k=1)\n", (1738, 1760), False, 'from deepproblog.network import Network\n'), ((1828, 1846), 'deepproblog.engines.ExactEngine', 'ExactEngine', (['model'], {}), '(model)\n', (1839, 1846), False, 'from deepproblog.engines import ExactEngine\n'), ((1941, 1964), 'deepproblog.engines.ExactEngine', 'ExactEngine', (['test_model'], {}), '(test_model)\n', (1952, 1964), False, 'from deepproblog.engines import ExactEngine\n'), ((2024, 2053), 'deepproblog.dataset.DataLoader', 'DataLoader', (['train_queries', '(16)'], {}), '(train_queries, 16)\n', (2034, 2053), False, 'from deepproblog.dataset import DataLoader, QueryDataset\n'), ((2366, 2422), 'deepproblog.evaluate.get_confusion_matrix', 'get_confusion_matrix', (['test_model', 'dev_queries'], {'verbose': '(0)'}), '(test_model, dev_queries, verbose=0)\n', (2386, 2422), False, 'from deepproblog.evaluate import get_confusion_matrix\n'), ((1151, 1194), 'torch.utils.data.DataLoader', 'TorchDataLoader', (['raw_validation_dataset', '(16)'], {}), '(raw_validation_dataset, 16)\n', (1166, 1194), True, 'from torch.utils.data import DataLoader as TorchDataLoader\n'), ((1392, 1435), 'torch.utils.data.DataLoader', 'TorchDataLoader', (['raw_validation_dataset', '(16)'], {}), '(raw_validation_dataset, 16)\n', (1407, 1435), True, 'from torch.utils.data import DataLoader as TorchDataLoader\n'), ((2197, 2242), 'deepproblog.evaluate.get_confusion_matrix', 'get_confusion_matrix', (['test_model', 'dev_queries'], {}), '(test_model, dev_queries)\n', (2217, 2242), False, 'from deepproblog.evaluate import get_confusion_matrix\n')]
|
# TODO 该模块存在大量exec用法,请勿随意改动相关文件名或函数名
__all__ = ['manage_task']
import random
from src.BusinessCentralLayer.middleware.redis_io import RedisClient
from src.BusinessCentralLayer.middleware.work_io import Middleware
from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, \
SINGLE_DEPLOYMENT, logger
from .cook import ActionShunt
from .slavers import __entropy__
from ..plugins.accelerator import ShuntRelease
def _is_overflow(task_name: str, rc=None):
"""
判断当前缓存是否已达单机采集极限
@param task_name: class_
@param rc: RedisClient Object Driver API
@return:
--stop: 停止任务同步并结束本轮采集任务
--offload:停止任务同步并开始执行采集任务
--continue:继续同步任务
"""
# TODO 将缓存操作原子化
cap: int = SINGLE_TASK_CAP
# 获取当前仓库剩余
storage_remain: int = rc.get_len(REDIS_SECRET_KEY.format(f'{task_name}'))
# 获取本机任务缓存
cache_size: int = Middleware.poseidon.qsize()
# 判断任务队列是否达到满载状态或已溢出
if storage_remain >= cap:
# logger.warning(f'<TaskManager> OverFlow || 任务溢出<{task_name}>({storage_remain}/{cap})')
return 'stop'
# 判断缓冲队列是否已达单机采集极限
# 未防止绝对溢出,此处限制单机任务数不可超过满载值的~x%
# x = 1 if signal collector else x = 1/sum (Number of processes)
if storage_remain + cache_size > round(cap * 0.8):
# 若已达或超过单机采集极限,则休眠任务
# logger.info(f'<TaskManager> BeatPause || 节拍停顿<{task_name}>({storage_remain + cache_size}/{cap})')
return 'offload'
return 'continue'
def _update_entropy(rc=None, entropy=None):
# 组合entropy标注数据
try:
atomic_queue = []
for entity_ in entropy.copy():
work_filed = [f"{j[0].upper()}" for j in entity_['hyper_params'].items() if j[-1]]
work_filed = "&".join(work_filed).strip()
atomic_item = f"|{work_filed}| {entity_['name']}"
atomic_queue.append(atomic_item)
# 更新列表
if rc is None:
rc = RedisClient()
rc.get_driver().set(name=REDIS_SECRET_KEY.format("__entropy__"), value="$".join(atomic_queue))
except Exception as e:
logger.exception(e)
def sync_actions(
class_: str,
mode_sync: str = None,
only_sync=False,
beat_sync=True,
):
"""
@param class_:
@param mode_sync: 是否同步消息队列。False:同步本机任务队列,True:同步Redis订阅任务
@param only_sync:
@param beat_sync:
@return:
"""
logger.info(f"<TaskManager> Sync{mode_sync.title()} || 正在同步<{class_}>任务队列...")
# ================================================
# 节拍停顿 原子同步
# ================================================
rc = RedisClient()
_state = _is_overflow(task_name=class_, rc=rc)
if _state == 'stop':
return _state
# ================================================
# 更新任务信息
# ================================================
# 公示即将发动的采集任务数据
_update_entropy(rc=rc, entropy=__entropy__)
# 通由工厂读取映射表批量生产采集器运行实体
sync_queue: list = ActionShunt(class_, silence=True, beat_sync=beat_sync).shunt()
# 打乱任务序列
random.shuffle(sync_queue)
# ================================================
# $执行核心业务
# ================================================
if mode_sync == 'upload':
# fixme:临时方案:解决链接溢出问题
if round(rc.get_len(REDIS_SECRET_KEY.format(class_)) * 1.25) > SINGLE_TASK_CAP:
logger.warning("<TaskManager> UploadHijack -- 连接池任务即将溢出,上传任务被劫持")
return None
# 持续实例化采集任务
for _ in range(sync_queue.__len__()):
rc.sync_message_queue(mode='upload', message=class_)
# 节拍同步线程锁
if only_sync:
logger.warning("<TaskManager> OnlySync -- 触发节拍同步线程锁,仅上传一枚原子任务")
break
logger.success("<TaskManager> UploadTasks -- 任务上传完毕")
elif mode_sync == 'download':
async_queue: list = []
while True:
# 获取原子任务
atomic = rc.sync_message_queue(mode='download')
# 若原子有效则同步数据
if atomic and atomic in CRAWLER_SEQUENCE:
# 判断同步状态
# 防止过载。当本地缓冲任务即将突破容载极限时停止同步
# _state 状态有三,continue/offload/stop
_state = _is_overflow(task_name=atomic, rc=rc)
if _state != 'continue':
return _state
if async_queue.__len__() == 0:
async_queue = ActionShunt(atomic, silence=True, beat_sync=beat_sync).shunt()
random.shuffle(async_queue)
# 将采集器实体推送至Poseidon本机消息队列
Middleware.poseidon.put_nowait(async_queue.pop())
logger.info(f'<TaskManager> offload atomic<{atomic}>({Middleware.poseidon.qsize()})')
# 节拍同步线程锁
if only_sync:
logger.warning(f"<TaskManager> OnlySync -- <{atomic}>触发节拍同步线程锁,仅下载一枚原子任务")
return 'offload'
else:
return 'offload'
elif mode_sync == 'force_run':
for slave_ in sync_queue:
# ================================================================================================
# TODO v5.4.r 版本新增特性 scaffold spawn
# 1. 之前版本中通由scaffold 无论运行 run 还是 force-run 指令都无法在队列满载的情况下启动采集任务
# 主要原因在于如下几行代码加了锁
# 2. 通过新增的spawn指令可绕过此模块通由SpawnBooster直接编译底层代码启动采集器
# ================================================================================================
# force_run :适用于单机部署或单步调试下
# 需要确保无溢出风险,故即使是force_run的启动模式,任务执行数也不应逾越任务容载数
_state = _is_overflow(task_name=class_, rc=rc)
if _state != 'continue':
return _state
# 将采集器实体推送至Poseidon本机消息队列
Middleware.poseidon.put_nowait(slave_)
# 节拍同步线程锁
if only_sync:
logger.warning(f"<TaskManager> OnlySync -- <{class_}>触发节拍同步线程锁,仅下载一枚原子任务")
return 'stop'
return 'offload'
@logger.catch()
def manage_task(
class_: str = 'v2ray',
only_sync=False,
run_collector=None,
beat_sync=True,
force_run=None
) -> bool:
"""
加载任务
@param force_run: debug模式下的强制运行,可逃逸队列满载检测
@param run_collector:创建协程工作空间,并开始并发执行队列任务。
@param only_sync:节拍同步线程锁。当本机任务数大于0时,将1枚原子任务推送至Poseidon协程空间。
@param class_: 任务类型,必须在 crawler seq内,如 ssr,v2ray or trojan。
@param beat_sync:
@return:
"""
# ----------------------------------------------------
# 参数审查与转译
# ----------------------------------------------------
# 若申请执行的任务类型不在本机授权范围内则结束本次任务
if class_ not in CRAWLER_SEQUENCE:
return False
# collector_permission 审核采集权限,允许越权传参。当手动指定参数时,可授予本机采集权限,否则使用配置权限
collector_permission: bool = ENABLE_DEPLOY.get('tasks').get('collector') if run_collector is None else run_collector
# force_run 强制运行,若不指定该参数,则以“是否单机部署”决定“是否运行force_run”
# 既默认单机模式下开启force_run
# 若未传参时也未定义部署形式(null),则默认不使用force_run
force_run = force_run if force_run else SINGLE_DEPLOYMENT
# ----------------------------------------------------
# 解析同步模式
# ----------------------------------------------------
# 以本机是否有采集权限来区分download 以及upload两种同步模式
mode_sync = "download" if collector_permission is True else "upload"
# 以更高优先级的`force_run` 替代传统同步模式,执行强制采集方案
mode_sync = "force_run" if force_run is True else mode_sync
# ----------------------------------------------------
# 同步消息(任务)队列
# ----------------------------------------------------
# IF 本机具备采集权限,将任务同步至本机执行,在单机部署情况下任务自产自销。
# ELSE 负责将生成的任务加入消息队列
response: str or bool = sync_actions(
class_=class_,
only_sync=only_sync,
beat_sync=beat_sync,
mode_sync=mode_sync,
)
# ----------------------------------------------------
# 初始化协程空间(执行任务)
# ----------------------------------------------------
# 若本机开启了采集器权限则创建协程空间
# 若从control-deploy进入此函数,则说明本机必定具备创建协程空间权限
if force_run:
if (response == 'offload') and (Middleware.poseidon.qsize() > 0):
logger.info(f'<TaskManager> ForceRun || <{class_}>采集任务启动')
ShuntRelease(work_queue=Middleware.poseidon).interface()
logger.success(f'<TaskManager> ForceWorkFinish || <{class_}>采集任务结束')
return True
# if 'force_run' is False and the node has the permissions of collector
if collector_permission:
# if task queue can be work
if (response == 'offload') and (Middleware.poseidon.qsize() > 0):
logger.info('<TaskManager> Run || 采集任务启动')
ShuntRelease(work_queue=Middleware.poseidon).interface()
logger.success('<TaskManager> Finish || 采集任务结束')
return True
# logger.warning(f"<TaskManager> Hijack<{class_}> || 当前节点不具备采集权限")
return False
|
[
"src.BusinessCentralLayer.setting.logger.catch",
"src.BusinessCentralLayer.setting.logger.warning",
"src.BusinessCentralLayer.middleware.work_io.Middleware.poseidon.qsize",
"random.shuffle",
"src.BusinessCentralLayer.setting.logger.success",
"src.BusinessCentralLayer.setting.logger.info",
"src.BusinessCentralLayer.setting.logger.exception",
"src.BusinessCentralLayer.middleware.redis_io.RedisClient",
"src.BusinessCentralLayer.middleware.work_io.Middleware.poseidon.put_nowait",
"src.BusinessCentralLayer.setting.REDIS_SECRET_KEY.format",
"src.BusinessCentralLayer.setting.ENABLE_DEPLOY.get"
] |
[((5953, 5967), 'src.BusinessCentralLayer.setting.logger.catch', 'logger.catch', ([], {}), '()\n', (5965, 5967), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((915, 942), 'src.BusinessCentralLayer.middleware.work_io.Middleware.poseidon.qsize', 'Middleware.poseidon.qsize', ([], {}), '()\n', (940, 942), False, 'from src.BusinessCentralLayer.middleware.work_io import Middleware\n'), ((2608, 2621), 'src.BusinessCentralLayer.middleware.redis_io.RedisClient', 'RedisClient', ([], {}), '()\n', (2619, 2621), False, 'from src.BusinessCentralLayer.middleware.redis_io import RedisClient\n'), ((3042, 3068), 'random.shuffle', 'random.shuffle', (['sync_queue'], {}), '(sync_queue)\n', (3056, 3068), False, 'import random\n'), ((836, 875), 'src.BusinessCentralLayer.setting.REDIS_SECRET_KEY.format', 'REDIS_SECRET_KEY.format', (['f"""{task_name}"""'], {}), "(f'{task_name}')\n", (859, 875), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((3733, 3786), 'src.BusinessCentralLayer.setting.logger.success', 'logger.success', (['"""<TaskManager> UploadTasks -- 任务上传完毕"""'], {}), "('<TaskManager> UploadTasks -- 任务上传完毕')\n", (3747, 3786), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((8184, 8252), 'src.BusinessCentralLayer.setting.logger.success', 'logger.success', (['f"""<TaskManager> ForceWorkFinish || <{class_}>采集任务结束"""'], {}), "(f'<TaskManager> ForceWorkFinish || <{class_}>采集任务结束')\n", (8198, 8252), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((8621, 8669), 'src.BusinessCentralLayer.setting.logger.success', 'logger.success', (['"""<TaskManager> Finish || 采集任务结束"""'], {}), "('<TaskManager> Finish || 采集任务结束')\n", (8635, 8669), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((1936, 1949), 'src.BusinessCentralLayer.middleware.redis_io.RedisClient', 'RedisClient', ([], {}), '()\n', (1947, 1949), False, 'from src.BusinessCentralLayer.middleware.redis_io import RedisClient\n'), ((2088, 2107), 'src.BusinessCentralLayer.setting.logger.exception', 'logger.exception', (['e'], {}), '(e)\n', (2104, 2107), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((3354, 3419), 'src.BusinessCentralLayer.setting.logger.warning', 'logger.warning', (['"""<TaskManager> UploadHijack -- 连接池任务即将溢出,上传任务被劫持"""'], {}), "('<TaskManager> UploadHijack -- 连接池任务即将溢出,上传任务被劫持')\n", (3368, 3419), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((8048, 8106), 'src.BusinessCentralLayer.setting.logger.info', 'logger.info', (['f"""<TaskManager> ForceRun || <{class_}>采集任务启动"""'], {}), "(f'<TaskManager> ForceRun || <{class_}>采集任务启动')\n", (8059, 8106), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((8501, 8543), 'src.BusinessCentralLayer.setting.logger.info', 'logger.info', (['"""<TaskManager> Run || 采集任务启动"""'], {}), "('<TaskManager> Run || 采集任务启动')\n", (8512, 8543), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((1983, 2021), 'src.BusinessCentralLayer.setting.REDIS_SECRET_KEY.format', 'REDIS_SECRET_KEY.format', (['"""__entropy__"""'], {}), "('__entropy__')\n", (2006, 2021), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((3639, 3702), 'src.BusinessCentralLayer.setting.logger.warning', 'logger.warning', (['"""<TaskManager> OnlySync -- 触发节拍同步线程锁,仅上传一枚原子任务"""'], {}), "('<TaskManager> OnlySync -- 触发节拍同步线程锁,仅上传一枚原子任务')\n", (3653, 3702), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((6737, 6763), 'src.BusinessCentralLayer.setting.ENABLE_DEPLOY.get', 'ENABLE_DEPLOY.get', (['"""tasks"""'], {}), "('tasks')\n", (6754, 6763), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((8002, 8029), 'src.BusinessCentralLayer.middleware.work_io.Middleware.poseidon.qsize', 'Middleware.poseidon.qsize', ([], {}), '()\n', (8027, 8029), False, 'from src.BusinessCentralLayer.middleware.work_io import Middleware\n'), ((8455, 8482), 'src.BusinessCentralLayer.middleware.work_io.Middleware.poseidon.qsize', 'Middleware.poseidon.qsize', ([], {}), '()\n', (8480, 8482), False, 'from src.BusinessCentralLayer.middleware.work_io import Middleware\n'), ((5715, 5753), 'src.BusinessCentralLayer.middleware.work_io.Middleware.poseidon.put_nowait', 'Middleware.poseidon.put_nowait', (['slave_'], {}), '(slave_)\n', (5745, 5753), False, 'from src.BusinessCentralLayer.middleware.work_io import Middleware\n'), ((3282, 3313), 'src.BusinessCentralLayer.setting.REDIS_SECRET_KEY.format', 'REDIS_SECRET_KEY.format', (['class_'], {}), '(class_)\n', (3305, 3313), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((4455, 4482), 'random.shuffle', 'random.shuffle', (['async_queue'], {}), '(async_queue)\n', (4469, 4482), False, 'import random\n'), ((4769, 4843), 'src.BusinessCentralLayer.setting.logger.warning', 'logger.warning', (['f"""<TaskManager> OnlySync -- <{atomic}>触发节拍同步线程锁,仅下载一枚原子任务"""'], {}), "(f'<TaskManager> OnlySync -- <{atomic}>触发节拍同步线程锁,仅下载一枚原子任务')\n", (4783, 4843), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((5819, 5893), 'src.BusinessCentralLayer.setting.logger.warning', 'logger.warning', (['f"""<TaskManager> OnlySync -- <{class_}>触发节拍同步线程锁,仅下载一枚原子任务"""'], {}), "(f'<TaskManager> OnlySync -- <{class_}>触发节拍同步线程锁,仅下载一枚原子任务')\n", (5833, 5893), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((4661, 4688), 'src.BusinessCentralLayer.middleware.work_io.Middleware.poseidon.qsize', 'Middleware.poseidon.qsize', ([], {}), '()\n', (4686, 4688), False, 'from src.BusinessCentralLayer.middleware.work_io import Middleware\n')]
|
import numpy as np
def msaeye(msa, unique, turbo):
tic1 = timeit.default_timer()
length = msa.shape[1]
number = msa.shape[0]
# number = 5
array = np.eye(int(number))
seqs = []
for i in range(number):
seqs.append(msa[i,:])
iseq = np.zeros((number, length), dtype=int)
for i in range(0,number-1):
if i == 0:
for k in range(length):
if ord(seqs[i][k])>90:
iseq[i,k]=ord(seqs[i][k])-96 if ord(seqs[i][k])-96 > 0 \
and ord(seqs[i][k])-96 < 26 else 0
else:
iseq[i,k]=ord(seqs[i][k])-64 if ord(seqs[i][k])-64 > 0 \
and ord(seqs[i][k])-64 < 26 else 0
for j in range(i+1,number):
score=0.
ncols=0.
for k in range(length):
if ord(seqs[j][k])>90:
iseq[j,k]=ord(seqs[j][k])-96 if ord(seqs[j][k])-96 > 0 \
and ord(seqs[j][k])-96 < 26 else 0
else:
iseq[j,k]=ord(seqs[j][k])-64 if ord(seqs[j][k])-64 > 0 and ord(seqs[j][k])-64 < 26 else 0
if iseq[i,k] or iseq[j,k]:
ncols += 1
if iseq[i,k]==iseq[j,k]:
score+=1
array[i,j]=float(score)/ncols
array[j,i]=array[i,j]
# print iseq[0]
# print seqs[0]
# raw_input()
else:
for j in range(i+1,number):
score=0.
ncols=0.
for k in range(length):
if iseq[i,k] or iseq[j,k]:
ncols += 1
if iseq[i,k]==iseq[j,k]:
score+=1
array[i,j]= float(score)/ncols#float(sum((iseq[i] == iseq[j])*(iseq[i]*iseq[j]!=0))) / sum(iseq[i]*iseq[j]!=0)
array[j,i]=array[i,j]
toc1 = timeit.default_timer()
elapsed1 = toc1 - tic1
LOGGER.debug('Elapsed: %4.2fs'%elapsed1)
def buildDaliEnsemble(PDBs, record):
daliInfo = record._alignPDB
n_confs = len(PDBs)
ref_pdb_ca = PDBs[0]
ref_chain = list(ref_pdb_ca.getHierView().iterChains())[0]
ref_indices_set = set(range(len(ref_chain)))
ensemble = PDBEnsemble('Dali ensemble - ' + record.getTitle())
ensemble.setAtoms(ref_chain)
ensemble.setCoords(ref_chain)
LOGGER.progress('Building PDB ensemble for {0} conformations from Dali...'
.format(n_confs), n_confs, '_prody_buildDaliEnsemble')
for i, pdb in enumerate(PDBs):
pdb_chain = pdb.getTitle()[:5]
temp_dict = daliInfo[pdb_chain]
sel_pdb_ca = PDBs[i]
map_ref = temp_dict['map_ref']
map_sel = temp_dict['map_sel']
dum_sel = list(ref_indices_set - set(map_ref))
atommap = AtomMap(sel_pdb_ca, indices=map_sel, mapping=map_ref, dummies=dum_sel)
ensemble.addCoordset(atommap, weights=atommap.getFlags('mapped'), degeneracy=True)
LOGGER.update(i, label='_prody_buildDaliEnsemble')
LOGGER.finish()
try:
ensemble.iterpose()
except:
LOGGER.warn('failed to iterpose the ensemble.')
return ensemble
def fetchCATH(filename, ftp_host=None, ftp_path=None, **kwargs):
"""Downloads CATH file via FTP."""
if ftp_host == None:
ftp_host = 'orengoftp.biochem.ucl.ac.uk'
if ftp_path == None:
ftp_path = '/cath/releases/daily-release/newest/'
from ftplib import FTP
output_folder = kwargs.pop('folder', None)
ftp_fn = filename
try:
ftp = FTP(ftp_host)
except Exception as error:
raise type(error)('FTP connection problem, potential reason: '
'no internet connectivity')
else:
success = 0
failure = 0
filenames = []
ftp.login('')
data = []
try:
ftp.cwd(ftp_path)
ftp.retrbinary('RETR ' + ftp_fn, data.append)
except Exception as error:
if ftp_fn in ftp.nlst():
LOGGER.warn('{0} download failed ({1}). It is '
'possible that you do not have rights to '
'download .gz files in the current network.'
.format(ftp_fn, str(error)))
else:
LOGGER.warn('{0} download failed. {1} does not exist '
'on {2}.'.format(ftp_fn, ftp_fn, ftp_host))
failure += 1
filenames.append(None)
else:
if len(data):
if output_folder is None:
output_folder = getcwd()
filename_full = join(output_folder, ftp_fn)
with open(filename_full, 'w+b') as pdbfile:
write = pdbfile.write
[write(block) for block in data]
filename_full = normpath(relpath(filename_full))
LOGGER.debug('{0} downloaded ({1})'
.format(ftp_fn, sympath(filename_full)))
success += 1
filenames.append(filename_full)
else:
LOGGER.warn('{0} download failed, reason unknown.'
.format(ftp_fn))
failure += 1
filenames.append(None)
ftp.quit()
def buildCATHNameDict(cath_file, iscommpressed=True):
"""Returns a dictionary for CATH names with key of CATH ID."""
if iscommpressed:
gunzip(cath_file, 'cath_b.names.temp')
cath_file = 'cath_b.names.temp'
cath_id2name = dict()
with open(cath_file, 'r') as file_temp:
for line in file_temp:
ind_temp = line.find(' ')
cath_id2name[line[:ind_temp]] = line[ind_temp:].strip()
if iscommpressed:
remove(cath_file)
return cath_id2name
def buildPDBChainCATHDict(cath_file, iscommpressed=True):
"""Returns a dictionary for CATH info (ID and version) with key of PDB chain."""
if iscommpressed:
gunzip(cath_file, 'cath_b.all.temp')
cath_file = 'cath_b.all.temp'
cath_dict_temp = dict()
cath_i_dict = dict()
with open(cath_file, 'r') as file_temp:
for line in file_temp:
line = line.strip()
if line != '':
line_list = line.split(' ')
cath_dict_temp[line_list[0]] = line_list[1:]
key, value = line[0:5], line[5:7]
if key in cath_i_dict:
cath_i_dict[key].append(value)
else:
cath_i_dict[key] = [value]
pdbChain2CATH = dict()
for key, values in cath_i_dict.items():
pdbChain2CATH[key] = []
for v in values:
pdbChain2CATH[key].append(cath_dict_temp[key+v])
if iscommpressed:
remove(cath_file)
return pdbChain2CATH
def fetchCATH(filename, ftp_host=None, ftp_path=None, **kwargs):
"""Downloads CATH file via FTP."""
if ftp_host == None:
ftp_host = 'orengoftp.biochem.ucl.ac.uk'
if ftp_path == None:
ftp_path = '/cath/releases/daily-release/newest/'
from ftplib import FTP
output_folder = kwargs.pop('folder', None)
ftp_fn = filename
try:
ftp = FTP(ftp_host)
except Exception as error:
raise type(error)('FTP connection problem, potential reason: '
'no internet connectivity')
else:
success = 0
failure = 0
filenames = []
ftp.login('')
data = []
try:
ftp.cwd(ftp_path)
ftp.retrbinary('RETR ' + ftp_fn, data.append)
except Exception as error:
if ftp_fn in ftp.nlst():
LOGGER.warn('{0} download failed ({1}). It is '
'possible that you do not have rights to '
'download .gz files in the current network.'
.format(ftp_fn, str(error)))
else:
LOGGER.warn('{0} download failed. {1} does not exist '
'on {2}.'.format(ftp_fn, ftp_fn, ftp_host))
failure += 1
filenames.append(None)
else:
if len(data):
if output_folder is None:
output_folder = getcwd()
filename_full = join(output_folder, ftp_fn)
with open(filename_full, 'w+b') as pdbfile:
write = pdbfile.write
[write(block) for block in data]
filename_full = normpath(relpath(filename_full))
LOGGER.debug('{0} downloaded ({1})'
.format(ftp_fn, sympath(filename_full)))
success += 1
filenames.append(filename_full)
else:
LOGGER.warn('{0} download failed, reason unknown.'
.format(ftp_fn))
failure += 1
filenames.append(None)
ftp.quit()
# ftp://orengoftp.biochem.ucl.ac.uk/cath/releases/daily-release/newest/
# fetchCATH('cath-b-newest-names.gz')
# cath_id2name = buildCATHNameDict('cath-b-newest-names.gz')
# fetchCATH('cath-b-newest-all.gz')
# pdbChain2CATH = buildPDBChainCATHDict('cath-b-newest-all.gz')
def extend(model, nodes, atoms):
"""Returns mapping indices and an :class:`.AtomMap`."""
try:
n_atoms = model.numAtoms()
is3d = model.is3d()
except AttributeError:
raise ValueError('model must be an NMA instance')
try:
n_nodes = nodes.numAtoms()
i_nodes = nodes.iterAtoms()
except AttributeError:
raise ValueError('nodes must be an Atomic instance')
if n_atoms != n_nodes:
raise ValueError('atom numbers must be the same')
if not nodes in atoms:
raise ValueError('nodes must be a subset of atoms')
atom_indices = []
indices = []
get = HierView(atoms).getResidue
for i, node in enumerate(i_nodes):
res = get(node.getChid() or None, node.getResnum(),
node.getIcode() or None, node.getSegname() or None)
if res is None:
raise ValueError('atoms must contain a residue for all atoms')
atom_indices.append(res._getIndices())
if is3d:
indices.append(list(range(i*3, (i+1)*3)) * len(res))
else:
indices.append([i] * len(res))
atom_indices = np.concatenate(atom_indices)
indices = np.concatenate(indices)
try:
ag = atoms.getAtomGroup()
except AttributeError:
ag = atoms
atommap = AtomMap(ag, atom_indices, atoms.getACSIndex(),
title=str(atoms), intarrays=True)
return indices, atommap
def extendAtomicData(data, nodes, atoms):
"""Extend a coarse grained data obtained for *nodes* to *atoms*.
:arg data: any data array
:type data: :class:`~numpy.ndarray`
:arg nodes: a set of atoms that has been used
as nodes in data generation
:type nodes: :class:`.Atomic`
:arg atoms: atoms to be selected from
:type atoms: :class:`.Atomic`
"""
from collections import Counter
try:
data = np.asarray(data)
except:
raise TypeError('The data must be array-like.')
if not isinstance(nodes, Atomic):
raise TypeError('nodes must be an Atomic instance')
if not isinstance(atoms, Atomic):
raise TypeError('atoms must be an Atomic instance')
nnodes = nodes.numAtoms()
is3d = False
if len(data) != nnodes:
if data.shape[0] == nnodes * 3:
is3d = True
else:
raise ValueError('data and atoms must have the same size')
indices = nodes.getResindices()
if is3d:
indices = np.array([[i*3, i*3+1, i*3+2]
for i in indices]
).reshape(3*len(indices))
data_ext = []
resid_counter = Counter(atoms.getResindices())
for i in indices:
data_ext.extend(resid_counter.values()[i]*[data[i]])
resid_selstr = ' '.join([str(resid) for resid in nodes.getResindices()])
rest = atoms.select('not resid {0}'.format(resid_selstr))
data_ext.extend(np.zeros(rest.numAtoms()))
return data_ext
def refineEnsemble(ens, lower=.5, upper=10.):
"""Refine a PDB ensemble based on RMSD criterions."""
from scipy.cluster.hierarchy import linkage, fcluster
from scipy.spatial.distance import squareform
from collections import Counter
### calculate pairwise RMSDs ###
RMSD = ens.getRMSDs(pairwise=True)
# convert the RMSD table to the compressed form
v = squareform(RMSD)
### apply upper threshold ###
Z_upper = linkage(v, method='complete')
labels = fcluster(Z_upper, upper, criterion='distance')
most_common_label = Counter(labels).most_common(1)[0][0]
I = np.where(labels==most_common_label)[0]
### apply lower threshold ###
Z_lower = linkage(v, method='single')
labels = fcluster(Z_lower, lower, criterion='distance')
uniq_labels = np.unique(labels)
clusters = []
for label in uniq_labels:
indices = np.where(labels==label)[0]
clusters.append(indices)
J = np.ones(len(clusters), dtype=int) * -1
rmsd = None
for i, cluster in enumerate(clusters):
if len(cluster) > 0:
# find the conformations with the largest coverage
# (the weight of the ref should be 1)
weights = [ens[j].getWeights().sum() for j in cluster]
js = np.where(weights==np.max(weights))[0]
# in the case where there are multiple structures with the same weight,
# the one with the smallest rmsd wrt the ens._coords is selected.
if len(js) > 1:
# rmsd is not calulated unless necessary for the sake of efficiency
rmsd = ens.getRMSDs() if rmsd is None else rmsd
j = js[np.argmin(rmsd[js])]
else:
j = js[0]
J[i] = cluster[j]
else:
J[i] = cluster[0]
### refine ensemble ###
K = np.intersect1d(I, J)
reens = ens[K]
return reens
def showVarianceBar(mode_ensemble, highlights=None, **kwargs):
from matplotlib.pyplot import figure, gca, annotate, subplots_adjust, plot
from matplotlib.figure import Figure
from matplotlib.colorbar import ColorbarBase
from matplotlib.colors import Normalize, NoNorm
from matplotlib import cm, colors
fig = kwargs.pop('figure', None)
if isinstance(fig, Figure):
fig_num = fig.number
elif fig is None or isinstance(fig, (int, str)):
fig_num = fig
else:
raise TypeError('figure can be either an instance of matplotlib.figure.Figure '
'or a figure number.')
if SETTINGS['auto_show']:
if fig_num is None:
figure(figsize=(6, 2))
else:
figure(fig_num)
elif fig_num is not None:
figure(fig_num)
ax = gca()
# adjust layouts
box = ax.get_position()
_, _, _, height = box.bounds
ratio = 2.5
box.y1 = box.y0 + height/ratio
#box.y0 += height/7.
ax.set_position(box)
fract = kwargs.pop('fraction', True)
#defarrow = {'width':1, 'headwidth':2,
# 'facecolor':'black',
# 'headlength': 4}
defarrow = {'arrowstyle': '->'}
arrowprops = kwargs.pop('arrowprops', defarrow)
if fract:
sig = calcSignatureFractVariance(mode_ensemble)
else:
sig = mode_ensemble.getVariances()
variances = sig.getArray().sum(axis=1)
#meanVar = variances.mean()
#stdVar = variances.std()
#variances = (variances - meanVar)/stdVar
maxVar = variances.max()
minVar = variances.min()
cmap = kwargs.pop('cmap', 'jet')
norm = Normalize(vmin=minVar, vmax=maxVar)
cb = ColorbarBase(ax, cmap=cmap, norm=norm,
orientation='horizontal')
if not highlights:
highlights = []
indices = []; labels = []
ens_labels = mode_ensemble.getLabels()
for hl in highlights:
if isinstance(hl, str):
if not ens_labels:
raise TypeError('highlights should be a list of integers because '
'mode_ensemble has no label')
indices.append(ens_labels.index(hl))
labels.append(hl)
else:
try:
index = int(hl)
except:
raise TypeError('highlights should be a list of integers or strings')
indices.append(index)
if ens_labels:
labels.append(ens_labels[index])
else:
labels.append(str(index))
annotations = []
for i, label in zip(indices, labels):
x = norm(variances[i])
an = annotate(label, xy=(x, 1), xytext=(x, ratio), arrowprops=arrowprops)
annotations.append(an)
for i in range(len(variances)):
x = norm(variances[i])
plot([x, x], [0, 1], 'w')
cb.set_label('Variances')
if SETTINGS['auto_show']:
showFigure()
return cb, annotations
def mapChainByChain(atoms, target, **kwargs):
"""This function is similar to :func:`.mapOntoChain` but correspondence
of chains is found by their chain identifiers.
:arg atoms: atoms to be mapped onto *target*
:type atoms: :class:`.Atomic`
:arg target: reference structure for mapping
:type target: :class:`.Atomic`
:arg return_all: whether to return all mappings.
If False, only mappings for the first chain will be returned.
Default is **True**
:arg return_all: bool
:arg correspondence: chain IDs in atoms corresponding to those in ref
Default is to use the same chain IDs as in ref.
:type correspondence: str, list, dict
"""
mappings = []
if isinstance(target, AtomGroup):
chs_ref_ag = target.iterChains()
else:
chs_ref_ag = target.getAtomGroup().iterChains()
id_atm = atoms.getTitle()
id_ref = target.getTitle()
chs_atm = [chain for chain in atoms.getHierView().iterChains()]
chs_ref = [chain for chain in target.getHierView().iterChains()]
corr_input = kwargs.get('correspondence', None)
if isinstance(corr_input, dict):
correspondence = corr_input
elif corr_input is None:
correspondence = {}
elif isinstance(corr_input, str):
correspondence = {}
correspondence[atoms.getTitle()] = corr_input
else:
correspondence = {}
try:
correspondence[id_atm] = corr_input[0]
correspondence[id_ref] = corr_input[1]
except (IndexError, TypeError):
raise TypeError('correspondence should be a dict with keys being titles of atoms and ref, '
'and values are str indicating chID correspondences')
if not id_atm in correspondence:
correspondence[id_atm] = ''.join([chain.getChid() for chain in chs_atm])
if not id_ref in correspondence:
correspondence[id_ref] = ''.join([chain.getChid() for chain in chs_ref_ag])
corr_tar = correspondence[id_atm]
corr_ref = correspondence[id_ref]
for chain in chs_ref:
try:
i = corr_ref.index(chain.getChid())
chid = corr_tar[i]
except ValueError:
continue
for target_chain in chs_atm:
if target_chain.getChid() == chid:
mappings_ = mapOntoChainByAlignment(target_chain, chain, **kwargs)
if len(mappings_):
mappings.append(mappings_[0])
return mappings
def _extend(self, arr, defval=0):
mask = self.mask#.copy()
if self.is3d():
mask = np.repeat(mask, 3)
n_true = np.sum(mask)
N = len(mask)
if arr.ndim == 1:
whole_array = np.empty(N, dtype=arr.dtype)
whole_array.fill(defval)
whole_array[mask] = arr[:n_true]
elif arr.ndim == 2:
n, m = arr.shape
whole_array = np.empty((N, m), dtype=arr.dtype)
whole_array.fill(defval)
#mask = np.expand_dims(mask, axis=1)
#mask = mask.repeat(m, axis=1)
whole_array[mask] = arr[:n_true, :]
else: # only developers can trigger this case
raise ValueError('arr can only be either 1D or 2D')
return whole_array
|
[
"scipy.cluster.hierarchy.fcluster",
"numpy.sum",
"numpy.empty",
"scipy.cluster.hierarchy.linkage",
"numpy.argmin",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.gca",
"numpy.unique",
"matplotlib.colors.Normalize",
"numpy.max",
"collections.Counter",
"numpy.intersect1d",
"numpy.repeat",
"scipy.spatial.distance.squareform",
"numpy.asarray",
"matplotlib.colorbar.ColorbarBase",
"numpy.concatenate",
"matplotlib.pyplot.annotate",
"matplotlib.pyplot.plot",
"numpy.zeros",
"numpy.where",
"numpy.array",
"ftplib.FTP"
] |
[((271, 308), 'numpy.zeros', 'np.zeros', (['(number, length)'], {'dtype': 'int'}), '((number, length), dtype=int)\n', (279, 308), True, 'import numpy as np\n'), ((10729, 10757), 'numpy.concatenate', 'np.concatenate', (['atom_indices'], {}), '(atom_indices)\n', (10743, 10757), True, 'import numpy as np\n'), ((10772, 10795), 'numpy.concatenate', 'np.concatenate', (['indices'], {}), '(indices)\n', (10786, 10795), True, 'import numpy as np\n'), ((12941, 12957), 'scipy.spatial.distance.squareform', 'squareform', (['RMSD'], {}), '(RMSD)\n', (12951, 12957), False, 'from scipy.spatial.distance import squareform\n'), ((13007, 13036), 'scipy.cluster.hierarchy.linkage', 'linkage', (['v'], {'method': '"""complete"""'}), "(v, method='complete')\n", (13014, 13036), False, 'from scipy.cluster.hierarchy import linkage, fcluster\n'), ((13050, 13096), 'scipy.cluster.hierarchy.fcluster', 'fcluster', (['Z_upper', 'upper'], {'criterion': '"""distance"""'}), "(Z_upper, upper, criterion='distance')\n", (13058, 13096), False, 'from scipy.cluster.hierarchy import linkage, fcluster\n'), ((13254, 13281), 'scipy.cluster.hierarchy.linkage', 'linkage', (['v'], {'method': '"""single"""'}), "(v, method='single')\n", (13261, 13281), False, 'from scipy.cluster.hierarchy import linkage, fcluster\n'), ((13295, 13341), 'scipy.cluster.hierarchy.fcluster', 'fcluster', (['Z_lower', 'lower'], {'criterion': '"""distance"""'}), "(Z_lower, lower, criterion='distance')\n", (13303, 13341), False, 'from scipy.cluster.hierarchy import linkage, fcluster\n'), ((13360, 13377), 'numpy.unique', 'np.unique', (['labels'], {}), '(labels)\n', (13369, 13377), True, 'import numpy as np\n'), ((14416, 14436), 'numpy.intersect1d', 'np.intersect1d', (['I', 'J'], {}), '(I, J)\n', (14430, 14436), True, 'import numpy as np\n'), ((15321, 15326), 'matplotlib.pyplot.gca', 'gca', ([], {}), '()\n', (15324, 15326), False, 'from matplotlib.pyplot import figure, gca, annotate, subplots_adjust, plot\n'), ((16148, 16183), 'matplotlib.colors.Normalize', 'Normalize', ([], {'vmin': 'minVar', 'vmax': 'maxVar'}), '(vmin=minVar, vmax=maxVar)\n', (16157, 16183), False, 'from matplotlib.colors import Normalize, NoNorm\n'), ((16193, 16257), 'matplotlib.colorbar.ColorbarBase', 'ColorbarBase', (['ax'], {'cmap': 'cmap', 'norm': 'norm', 'orientation': '"""horizontal"""'}), "(ax, cmap=cmap, norm=norm, orientation='horizontal')\n", (16205, 16257), False, 'from matplotlib.colorbar import ColorbarBase\n'), ((20150, 20162), 'numpy.sum', 'np.sum', (['mask'], {}), '(mask)\n', (20156, 20162), True, 'import numpy as np\n'), ((3715, 3728), 'ftplib.FTP', 'FTP', (['ftp_host'], {}), '(ftp_host)\n', (3718, 3728), False, 'from ftplib import FTP\n'), ((7474, 7487), 'ftplib.FTP', 'FTP', (['ftp_host'], {}), '(ftp_host)\n', (7477, 7487), False, 'from ftplib import FTP\n'), ((11482, 11498), 'numpy.asarray', 'np.asarray', (['data'], {}), '(data)\n', (11492, 11498), True, 'import numpy as np\n'), ((13166, 13203), 'numpy.where', 'np.where', (['(labels == most_common_label)'], {}), '(labels == most_common_label)\n', (13174, 13203), True, 'import numpy as np\n'), ((17167, 17235), 'matplotlib.pyplot.annotate', 'annotate', (['label'], {'xy': '(x, 1)', 'xytext': '(x, ratio)', 'arrowprops': 'arrowprops'}), '(label, xy=(x, 1), xytext=(x, ratio), arrowprops=arrowprops)\n', (17175, 17235), False, 'from matplotlib.pyplot import figure, gca, annotate, subplots_adjust, plot\n'), ((17343, 17368), 'matplotlib.pyplot.plot', 'plot', (['[x, x]', '[0, 1]', '"""w"""'], {}), "([x, x], [0, 1], 'w')\n", (17347, 17368), False, 'from matplotlib.pyplot import figure, gca, annotate, subplots_adjust, plot\n'), ((20117, 20135), 'numpy.repeat', 'np.repeat', (['mask', '(3)'], {}), '(mask, 3)\n', (20126, 20135), True, 'import numpy as np\n'), ((20226, 20254), 'numpy.empty', 'np.empty', (['N'], {'dtype': 'arr.dtype'}), '(N, dtype=arr.dtype)\n', (20234, 20254), True, 'import numpy as np\n'), ((13445, 13470), 'numpy.where', 'np.where', (['(labels == label)'], {}), '(labels == label)\n', (13453, 13470), True, 'import numpy as np\n'), ((15193, 15215), 'matplotlib.pyplot.figure', 'figure', ([], {'figsize': '(6, 2)'}), '(figsize=(6, 2))\n', (15199, 15215), False, 'from matplotlib.pyplot import figure, gca, annotate, subplots_adjust, plot\n'), ((15242, 15257), 'matplotlib.pyplot.figure', 'figure', (['fig_num'], {}), '(fig_num)\n', (15248, 15257), False, 'from matplotlib.pyplot import figure, gca, annotate, subplots_adjust, plot\n'), ((15296, 15311), 'matplotlib.pyplot.figure', 'figure', (['fig_num'], {}), '(fig_num)\n', (15302, 15311), False, 'from matplotlib.pyplot import figure, gca, annotate, subplots_adjust, plot\n'), ((20400, 20433), 'numpy.empty', 'np.empty', (['(N, m)'], {'dtype': 'arr.dtype'}), '((N, m), dtype=arr.dtype)\n', (20408, 20433), True, 'import numpy as np\n'), ((12059, 12117), 'numpy.array', 'np.array', (['[[i * 3, i * 3 + 1, i * 3 + 2] for i in indices]'], {}), '([[i * 3, i * 3 + 1, i * 3 + 2] for i in indices])\n', (12067, 12117), True, 'import numpy as np\n'), ((13121, 13136), 'collections.Counter', 'Counter', (['labels'], {}), '(labels)\n', (13128, 13136), False, 'from collections import Counter\n'), ((14240, 14259), 'numpy.argmin', 'np.argmin', (['rmsd[js]'], {}), '(rmsd[js])\n', (14249, 14259), True, 'import numpy as np\n'), ((13857, 13872), 'numpy.max', 'np.max', (['weights'], {}), '(weights)\n', (13863, 13872), True, 'import numpy as np\n')]
|
# Copyright 2014 ETH Zurich
# Copyright 2018 ETH Zurich, Anapaya Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
:mod:`prometheus` --- SCION topology prometheus generator
=============================================
"""
# Stdlib
import os
from collections import defaultdict
# External packages
import yaml
# SCION
from lib.defines import DOCKER_COMPOSE_CONFIG_VERSION, PROM_FILE
from lib.util import write_file
from topology.common import (
ArgsTopoDicts,
prom_addr_br,
prom_addr_infra,
prom_addr_sciond,
prom_addr_dispatcher,
)
PS_PROM_PORT = 30453
BS_PROM_PORT = 30452
CS_PROM_PORT = 30454
SCIOND_PROM_PORT = 30455
SIG_PROM_PORT = 30456
DISP_PROM_PORT = 30441
DEFAULT_BR_PROM_PORT = 30442
PROM_DC_FILE = "prom-dc.yml"
class PrometheusGenArgs(ArgsTopoDicts):
def __init__(self, args, topo_dicts, networks, port_gen=None):
super().__init__(args, topo_dicts, port_gen)
self.networks = networks
class PrometheusGenerator(object):
PROM_DIR = "prometheus"
TARGET_FILES = {
"BorderRouters": "br.yml",
"BeaconService": "bs.yml",
"CertificateService": "cs.yml",
"PathService": "ps.yml",
"Sciond": "sd.yml",
"Dispatcher": "disp.yml",
}
JOB_NAMES = {
"BorderRouters": "BR",
"BeaconService": "BS",
"CertificateService": "CS",
"PathService": "PS",
"Sciond": "SD",
"Dispatcher": "dispatcher",
}
def __init__(self, args):
"""
:param PrometheusGenArgs args: Contains the passed command line arguments and topo dicts.
"""
self.args = args
self.output_base = os.environ.get('SCION_OUTPUT_BASE', os.getcwd())
def generate(self):
config_dict = {}
for topo_id, as_topo in self.args.topo_dicts.items():
ele_dict = defaultdict(list)
for br_id, br_ele in as_topo["BorderRouters"].items():
ele_dict["BorderRouters"].append(prom_addr_br(br_id, br_ele, DEFAULT_BR_PROM_PORT))
for elem_id, elem in as_topo["BeaconService"].items():
prom_addr = prom_addr_infra(self.args.docker, elem_id, elem, BS_PROM_PORT)
ele_dict["BeaconService"].append(prom_addr)
for elem_id, elem in as_topo["PathService"].items():
prom_addr = prom_addr_infra(self.args.docker, elem_id, elem, PS_PROM_PORT)
ele_dict["PathService"].append(prom_addr)
for elem_id, elem in as_topo["CertificateService"].items():
prom_addr = prom_addr_infra(self.args.docker, elem_id, elem, CS_PROM_PORT)
ele_dict["CertificateService"].append(prom_addr)
if self.args.docker:
host_dispatcher = prom_addr_dispatcher(self.args.docker, topo_id,
self.args.networks, DISP_PROM_PORT, "")
br_dispatcher = prom_addr_dispatcher(self.args.docker, topo_id,
self.args.networks, DISP_PROM_PORT, "br")
ele_dict["Dispatcher"] = [host_dispatcher, br_dispatcher]
sd_prom_addr = prom_addr_sciond(self.args.docker, topo_id,
self.args.networks, SCIOND_PROM_PORT)
ele_dict["Sciond"].append(sd_prom_addr)
config_dict[topo_id] = ele_dict
self._write_config_files(config_dict)
self._write_dc_file()
self._write_disp_file()
def _write_config_files(self, config_dict):
targets_paths = defaultdict(list)
for topo_id, ele_dict in config_dict.items():
base = topo_id.base_dir(self.args.output_dir)
as_local_targets_path = {}
for ele_type, target_list in ele_dict.items():
local_path = os.path.join(self.PROM_DIR, self.TARGET_FILES[ele_type])
targets_path = os.path.join(topo_id.base_dir(''), local_path)
targets_paths[self.JOB_NAMES[ele_type]].append(targets_path)
as_local_targets_path[self.JOB_NAMES[ele_type]] = [local_path]
self._write_target_file(base, target_list, ele_type)
self._write_config_file(os.path.join(base, PROM_FILE), as_local_targets_path)
if not self.args.docker:
targets_paths["dispatcher"] = [os.path.join("dispatcher", "prometheus", "disp.yml")]
self._write_config_file(os.path.join(self.args.output_dir, PROM_FILE), targets_paths)
def _write_config_file(self, config_path, job_dict):
scrape_configs = []
for job_name, file_paths in job_dict.items():
scrape_configs.append({
'job_name': job_name,
'file_sd_configs': [{'files': file_paths}],
})
config = {
'global': {
'scrape_interval': '5s',
'evaluation_interval': '15s',
'external_labels': {
'monitor': 'scion-monitor'
}
},
'scrape_configs': scrape_configs,
}
write_file(config_path, yaml.dump(config, default_flow_style=False))
def _write_target_file(self, base_path, target_addrs, ele_type):
targets_path = os.path.join(base_path, self.PROM_DIR, self.TARGET_FILES[ele_type])
target_config = [{'targets': target_addrs}]
write_file(targets_path, yaml.dump(target_config, default_flow_style=False))
def _write_disp_file(self):
if self.args.docker:
return
targets_path = os.path.join(self.args.output_dir, "dispatcher",
PrometheusGenerator.PROM_DIR, "disp.yml")
target_config = [{'targets': [prom_addr_dispatcher(False, None, None,
DISP_PROM_PORT, None)]}]
write_file(targets_path, yaml.dump(target_config, default_flow_style=False))
def _write_dc_file(self):
name_prefix = 'prometheus'
name = '%s_docker' % name_prefix if self.args.in_docker else name_prefix
prom_dc = {
'version': DOCKER_COMPOSE_CONFIG_VERSION,
'services': {
name_prefix: {
'image': 'prom/prometheus:v2.6.0',
'container_name': name,
'network_mode': 'host',
'volumes': [
self.output_base + '/gen:/prom-config:ro'
],
'command': ['--config.file', '/prom-config/prometheus.yml'],
}
}
}
write_file(os.path.join(self.args.output_dir, PROM_DC_FILE),
yaml.dump(prom_dc, default_flow_style=False))
|
[
"os.getcwd",
"yaml.dump",
"topology.common.prom_addr_br",
"topology.common.prom_addr_sciond",
"collections.defaultdict",
"os.path.join",
"topology.common.prom_addr_infra",
"topology.common.prom_addr_dispatcher"
] |
[((4080, 4097), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (4091, 4097), False, 'from collections import defaultdict\n'), ((5773, 5840), 'os.path.join', 'os.path.join', (['base_path', 'self.PROM_DIR', 'self.TARGET_FILES[ele_type]'], {}), '(base_path, self.PROM_DIR, self.TARGET_FILES[ele_type])\n', (5785, 5840), False, 'import os\n'), ((6082, 6177), 'os.path.join', 'os.path.join', (['self.args.output_dir', '"""dispatcher"""', 'PrometheusGenerator.PROM_DIR', '"""disp.yml"""'], {}), "(self.args.output_dir, 'dispatcher', PrometheusGenerator.\n PROM_DIR, 'disp.yml')\n", (6094, 6177), False, 'import os\n'), ((2198, 2209), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2207, 2209), False, 'import os\n'), ((2346, 2363), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2357, 2363), False, 'from collections import defaultdict\n'), ((3677, 3762), 'topology.common.prom_addr_sciond', 'prom_addr_sciond', (['self.args.docker', 'topo_id', 'self.args.networks', 'SCIOND_PROM_PORT'], {}), '(self.args.docker, topo_id, self.args.networks,\n SCIOND_PROM_PORT)\n', (3693, 3762), False, 'from topology.common import ArgsTopoDicts, prom_addr_br, prom_addr_infra, prom_addr_sciond, prom_addr_dispatcher\n'), ((4949, 4994), 'os.path.join', 'os.path.join', (['self.args.output_dir', 'PROM_FILE'], {}), '(self.args.output_dir, PROM_FILE)\n', (4961, 4994), False, 'import os\n'), ((5635, 5678), 'yaml.dump', 'yaml.dump', (['config'], {'default_flow_style': '(False)'}), '(config, default_flow_style=False)\n', (5644, 5678), False, 'import yaml\n'), ((5926, 5976), 'yaml.dump', 'yaml.dump', (['target_config'], {'default_flow_style': '(False)'}), '(target_config, default_flow_style=False)\n', (5935, 5976), False, 'import yaml\n'), ((6404, 6454), 'yaml.dump', 'yaml.dump', (['target_config'], {'default_flow_style': '(False)'}), '(target_config, default_flow_style=False)\n', (6413, 6454), False, 'import yaml\n'), ((7141, 7189), 'os.path.join', 'os.path.join', (['self.args.output_dir', 'PROM_DC_FILE'], {}), '(self.args.output_dir, PROM_DC_FILE)\n', (7153, 7189), False, 'import os\n'), ((7210, 7254), 'yaml.dump', 'yaml.dump', (['prom_dc'], {'default_flow_style': '(False)'}), '(prom_dc, default_flow_style=False)\n', (7219, 7254), False, 'import yaml\n'), ((2626, 2688), 'topology.common.prom_addr_infra', 'prom_addr_infra', (['self.args.docker', 'elem_id', 'elem', 'BS_PROM_PORT'], {}), '(self.args.docker, elem_id, elem, BS_PROM_PORT)\n', (2641, 2688), False, 'from topology.common import ArgsTopoDicts, prom_addr_br, prom_addr_infra, prom_addr_sciond, prom_addr_dispatcher\n'), ((2842, 2904), 'topology.common.prom_addr_infra', 'prom_addr_infra', (['self.args.docker', 'elem_id', 'elem', 'PS_PROM_PORT'], {}), '(self.args.docker, elem_id, elem, PS_PROM_PORT)\n', (2857, 2904), False, 'from topology.common import ArgsTopoDicts, prom_addr_br, prom_addr_infra, prom_addr_sciond, prom_addr_dispatcher\n'), ((3063, 3125), 'topology.common.prom_addr_infra', 'prom_addr_infra', (['self.args.docker', 'elem_id', 'elem', 'CS_PROM_PORT'], {}), '(self.args.docker, elem_id, elem, CS_PROM_PORT)\n', (3078, 3125), False, 'from topology.common import ArgsTopoDicts, prom_addr_br, prom_addr_infra, prom_addr_sciond, prom_addr_dispatcher\n'), ((3258, 3349), 'topology.common.prom_addr_dispatcher', 'prom_addr_dispatcher', (['self.args.docker', 'topo_id', 'self.args.networks', 'DISP_PROM_PORT', '""""""'], {}), "(self.args.docker, topo_id, self.args.networks,\n DISP_PROM_PORT, '')\n", (3278, 3349), False, 'from topology.common import ArgsTopoDicts, prom_addr_br, prom_addr_infra, prom_addr_sciond, prom_addr_dispatcher\n'), ((3433, 3526), 'topology.common.prom_addr_dispatcher', 'prom_addr_dispatcher', (['self.args.docker', 'topo_id', 'self.args.networks', 'DISP_PROM_PORT', '"""br"""'], {}), "(self.args.docker, topo_id, self.args.networks,\n DISP_PROM_PORT, 'br')\n", (3453, 3526), False, 'from topology.common import ArgsTopoDicts, prom_addr_br, prom_addr_infra, prom_addr_sciond, prom_addr_dispatcher\n'), ((4337, 4393), 'os.path.join', 'os.path.join', (['self.PROM_DIR', 'self.TARGET_FILES[ele_type]'], {}), '(self.PROM_DIR, self.TARGET_FILES[ele_type])\n', (4349, 4393), False, 'import os\n'), ((4733, 4762), 'os.path.join', 'os.path.join', (['base', 'PROM_FILE'], {}), '(base, PROM_FILE)\n', (4745, 4762), False, 'import os\n'), ((4863, 4915), 'os.path.join', 'os.path.join', (['"""dispatcher"""', '"""prometheus"""', '"""disp.yml"""'], {}), "('dispatcher', 'prometheus', 'disp.yml')\n", (4875, 4915), False, 'import os\n'), ((2480, 2529), 'topology.common.prom_addr_br', 'prom_addr_br', (['br_id', 'br_ele', 'DEFAULT_BR_PROM_PORT'], {}), '(br_id, br_ele, DEFAULT_BR_PROM_PORT)\n', (2492, 2529), False, 'from topology.common import ArgsTopoDicts, prom_addr_br, prom_addr_infra, prom_addr_sciond, prom_addr_dispatcher\n'), ((6247, 6308), 'topology.common.prom_addr_dispatcher', 'prom_addr_dispatcher', (['(False)', 'None', 'None', 'DISP_PROM_PORT', 'None'], {}), '(False, None, None, DISP_PROM_PORT, None)\n', (6267, 6308), False, 'from topology.common import ArgsTopoDicts, prom_addr_br, prom_addr_infra, prom_addr_sciond, prom_addr_dispatcher\n')]
|
"""CLI interface for migrator."""
from argparse import ArgumentParser
from pathlib import Path
from . import VERSION, get_all_environments, get_environments, main
from .config import Config
def parse_args(argv, config_path=None):
"""
Parse the arguments passed to the script using argparse.
:param argv: arguments to parse
:type argv: list
:return: argparse.Namespace of the parsed args
"""
desc = 'Migration script for upgrading/downgrading the database'
parser = ArgumentParser(description=desc)
parser.add_argument(
'-v', '--version', action='version',
version='%(prog)s {}'.format(VERSION)
)
default_config = None
if config_path is not None and config_path.exists():
default_config = config_path.resolve()
parser.add_argument(
'-c', '--config', dest='config_path', type=lambda p: Path(p).resolve(),
required=default_config is None, default=default_config
)
parser.add_argument(
'-e', '--environment', dest='environments',
choices=get_all_environments(), action='append',
required=True
)
parser.add_argument(
'--course', dest='choose_course', nargs=2,
metavar=('semester', 'course'), default=None
)
subparsers = parser.add_subparsers(metavar='command', dest='command')
subparsers.required = True
sub = subparsers.add_parser('create', help='Create migration')
sub.add_argument('name', help='Name of new migration')
sub = subparsers.add_parser(
'status',
help='Get status of migrations for environment'
)
sub = subparsers.add_parser('migrate', help='Run migrations')
sub.add_argument(
'--single', action='store_true', default=False,
dest='single', help='Only run one migration'
)
sub.add_argument(
'--fake', action='store_true', default=False, dest='set_fake',
help='Mark migrations as run without actually running them'
)
sub.add_argument(
'--initial', action='store_true', default=False,
help='Only run the first migration and then mark '
'the rest as done without running them.'
)
sub = subparsers.add_parser(
'rollback', help='Rollback the previously done migration'
)
sub.add_argument(
'--fake', action='store_true', default=False, dest='set_fake',
help='Mark migrations as run without actually running them'
)
args = parser.parse_args(argv)
args.environments = get_environments(args.environments)
return args
def run(argv, config_path=None):
"""
Parse the CLI arguments, and then run the chosen command.
:param argv: arguments to parse
:type argv: list
"""
args = parse_args(argv, config_path)
args.config = Config(args.config_path)
getattr(main, args.command)(args)
|
[
"pathlib.Path",
"argparse.ArgumentParser"
] |
[((501, 533), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': 'desc'}), '(description=desc)\n', (515, 533), False, 'from argparse import ArgumentParser\n'), ((874, 881), 'pathlib.Path', 'Path', (['p'], {}), '(p)\n', (878, 881), False, 'from pathlib import Path\n')]
|
import tensorflow as tf
from models.bin_vgg16_cifar100 import VGG_cifar100
import utils.preprocess as preprocess
import numpy
import random
import os
def lr_scheduler(epoch):
return learning_rate * (0.1 ** (epoch // lr_drop))
def get_dataset():
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.cifar100.load_data()
preprocessor = preprocess.scale_random_crop(x_train.shape, 32)
x_train = preprocessor(x_train)
x_test = preprocessor(x_test)
# x_train = x_train / 255.0
# x_test = x_test / 255.0
y_train = tf.keras.utils.to_categorical(y_train, 100)
y_test = tf.keras.utils.to_categorical(y_test, 100)
return (x_train, y_train, x_test, y_test)
(x_train, y_train, x_test, y_test) = get_dataset()
model = VGG_cifar100()
batch_size = 128
max_epochs = 250
learning_rate = 0.1
lr_decay = 1e-6
lr_drop = 20
reduce_lr = tf.keras.callbacks.LearningRateScheduler(lr_scheduler)
sgd = tf.keras.optimizers.SGD(lr=learning_rate, momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy', 'top_k_categorical_accuracy'])
test = tf.reshape(x_train[0], (1, 32, 32, 3))
model(test)
model.initialize()
model.fit(x=x_train, y=y_train, batch_size=batch_size, epochs=max_epochs, validation_data=(x_test, y_test), callbacks=[reduce_lr])
|
[
"tensorflow.keras.utils.to_categorical",
"tensorflow.keras.datasets.cifar100.load_data",
"tensorflow.keras.optimizers.SGD",
"tensorflow.reshape",
"utils.preprocess.scale_random_crop",
"tensorflow.keras.callbacks.LearningRateScheduler",
"models.bin_vgg16_cifar100.VGG_cifar100"
] |
[((760, 774), 'models.bin_vgg16_cifar100.VGG_cifar100', 'VGG_cifar100', ([], {}), '()\n', (772, 774), False, 'from models.bin_vgg16_cifar100 import VGG_cifar100\n'), ((872, 926), 'tensorflow.keras.callbacks.LearningRateScheduler', 'tf.keras.callbacks.LearningRateScheduler', (['lr_scheduler'], {}), '(lr_scheduler)\n', (912, 926), True, 'import tensorflow as tf\n'), ((934, 1004), 'tensorflow.keras.optimizers.SGD', 'tf.keras.optimizers.SGD', ([], {'lr': 'learning_rate', 'momentum': '(0.9)', 'nesterov': '(True)'}), '(lr=learning_rate, momentum=0.9, nesterov=True)\n', (957, 1004), True, 'import tensorflow as tf\n'), ((1126, 1164), 'tensorflow.reshape', 'tf.reshape', (['x_train[0]', '(1, 32, 32, 3)'], {}), '(x_train[0], (1, 32, 32, 3))\n', (1136, 1164), True, 'import tensorflow as tf\n'), ((297, 335), 'tensorflow.keras.datasets.cifar100.load_data', 'tf.keras.datasets.cifar100.load_data', ([], {}), '()\n', (333, 335), True, 'import tensorflow as tf\n'), ((356, 403), 'utils.preprocess.scale_random_crop', 'preprocess.scale_random_crop', (['x_train.shape', '(32)'], {}), '(x_train.shape, 32)\n', (384, 403), True, 'import utils.preprocess as preprocess\n'), ((552, 595), 'tensorflow.keras.utils.to_categorical', 'tf.keras.utils.to_categorical', (['y_train', '(100)'], {}), '(y_train, 100)\n', (581, 595), True, 'import tensorflow as tf\n'), ((609, 651), 'tensorflow.keras.utils.to_categorical', 'tf.keras.utils.to_categorical', (['y_test', '(100)'], {}), '(y_test, 100)\n', (638, 651), True, 'import tensorflow as tf\n')]
|
import os
import sys
class tool_chain:
def __init__(self, config, tools_path=''):
self.config = config
self.tools_path = tools_path
self.binary_raw = os.path.join(self.config.out_dir, 'binary', self.config.app + '@' + self.config.board)
@staticmethod
def __get_os():
os = ''
if sys.platform.startswith('linux'):
os = 'Linux64' if sys.maxsize > 2**32 else 'Linux32'
elif sys.platform.startswith('darwin'):
os = 'OSX'
elif sys.platform.startswith('win'):
os = 'Win32'
else:
print('%s encrypt unsupported...' % sys.platform)
return os
def __tools_path(self):
tools_chain_root = os.path.join(self.config.project_path, 'build/compiler')
path = ''
if not self.tools_path:
if self.prefix == 'arm-none-eabi-':
path = os.path.join(tools_chain_root, 'gcc-arm-none-eabi', self.__get_os(), 'bin')
elif self.prefix == 'xtensa-esp32-elf-':
path = os.path.join(tools_chain_root, 'gcc-xtensa-esp32', self.__get_os(), 'bin')
elif self.prefix == 'xtensa-lx106-elf-':
path = os.path.join(self.config.project_path, 'gcc-xtensa-lx106', self.__get_os(), 'bin')
elif self.prefix == 'csky-abiv2-elf-':
path = os.path.join(tools_chain_root, 'gcc-csky-abiv2', self.__get_os(), 'bin')
elif self.prefix == '' and self.config.compiler=='gcc':
path = ''
elif self.prefix == '' and self.config.compiler=='cl':
path = ''
else:
print("tool chain is not support")
if os.path.isdir(path):
self.tools_path = path
elif os.getenv('TOOLCHAIN_PATH'):
self.tools_path = os.getenv('TOOLCHAIN_PATH')
def tools_name_config(self):
self.__tools_path()
self.config.aos_env['CC'] = os.path.join(self.tools_path, self.prefix + self.cc)
self.config.aos_env['CXX'] = os.path.join(self.tools_path, self.prefix + self.cxx)
self.config.aos_env['AS'] = os.path.join(self.tools_path, self.prefix + self.ass)
#msvs not support here temporary
if self.config.compiler != 'cl':
self.config.aos_env['AR'] = os.path.join(self.tools_path, self.prefix + self.ar)
self.config.aos_env['LD'] = os.path.join(self.tools_path, self.prefix + self.ld)
self.config.aos_env['OBJDUMP'] = os.path.join(self.tools_path, self.prefix + self.objdump)
self.config.aos_env['OBJCOPY'] = os.path.join(self.tools_path, self.prefix + self.objcopy)
self.config.aos_env['STRIP'] = os.path.join(self.tools_path, self.prefix + self.strip)
self.config.aos_env['NM'] = os.path.join(self.tools_path, self.prefix + self.nm)
self.config.aos_env['READELF'] = os.path.join(self.tools_path, self.prefix + self.readelf)
self.config.aos_env['RANLIBCOM'] = ''
for tool, name in list(self.extend_name_dict.items()):
self.config.aos_env[tool] = os.path.join(self.tools_path, self.prefix + name)
def tools_flag_config(self):
self.config.aos_env.Append(CPPFLAGS=self.cppflags)
self.config.aos_env.Append(CFLAGS=self.cflags)
self.config.aos_env.Append(CXXFLAGS=self.cxxflags)
self.config.aos_env.Append(ASFLAGS=self.asflags)
self.config.aos_env.Append(LINKFLAGS=self.ldflags)
self.config.aos_env.Replace(ARFLAGS=self.arflags)
for flag, value in list(self.extend_flag_dict.items()):
self.config.aos_env.Append(flag=value)
def tools_config(self):
self.tools_name_config()
self.tools_flag_config()
def extend_tool_name(self, tool, name):
self.extend_name_dict[tool] = name
def extend_tool_flag(self, key, value):
self.extend_flag_dict[key] = value
def set_tools_path(self, tools_path):
self.tools_path = tools_path if os.path.isabs(tools_path) else os.path.abspath(tools_path)
def set_prefix(self, prefix):
self.prefix = prefix
def set_cc(self, cc):
self.cc = cc
def set_cxx(self, cxx):
self.cxx = cxx
def set_as(self, ass):
self.ass = ass
def set_ar(self, ar):
self.ar = ar
def set_ld(self, ld):
self.ld = ld
def set_objdump(self, objcump):
self.objdump = objcump
def set_objcopy(self, objcopy):
self.objcopy = objcopy
def set_strip(self, strip):
self.strip = strip
def set_nm(self, nm):
self.nm = nm
def set_readelf(self, readelf):
self.readelf = readelf
def set_cflags(self, cflags):
self.cflags = cflags
def set_cxxflags(self, cxxflags):
self.cxxflags = cxxflags
def set_cppflags(self, cppflags):
self.cppflags = cppflags
def set_asflags(self, asflags):
self.asflags = asflags
def set_ldflags(self, ldflags):
self.ldflags = ldflags
def set_linkcom(self, linkcom):
self.linkcom = linkcom
class gcc_tool_chain(tool_chain):
def __init__(self, config, tools_path=''):
tool_chain.__init__(self, config, tools_path)
board_name = config.board
self.prefix = ''
self.cppflags = ''
self.cc = 'gcc'
self.cxx = 'g++'
self.ass = 'gcc'
self.ar = 'ar'
self.ld = 'ld'
self.objdump = 'objdump'
self.objcopy = 'objcopy'
self.strip = 'strip'
self.nm = 'nm'
self.readelf = 'readelf'
self.extend_name_dict = {}
self.cflags = '-Wfatal-errors -ggdb -Os -fsigned-char -ffunction-sections -fdata-sections -fno-common -std=gnu11'
self.cxxflags = '-Wfatal-errors -ggdb -Os -fsigned-char -ffunction-sections -fdata-sections -fno-common -std=gnu11'
self.asflags = '-c'
self.ldflags = ''
self.arflags = 'rc'
self.extend_flag_dict = {}
self.binary = self.binary_raw + '.elf'
env = self.config.aos_env
env['MAPFILE'] = self.binary_raw + '.map'
class win32msvs_tool_chain(tool_chain):
def __init__(self, config, tools_path=''):
tool_chain.__init__(self, config, tools_path)
self.linkcom = ''
board_name = config.board
self.prefix = ''
self.cppflags = ''
self.cc = 'cl'
self.cxx = 'cl'
self.ass = 'cl'
self.ar = 'cl'
self.ld = 'cl'
self.objdump = 'objdump'
self.objcopy = 'objcopy'
self.strip = 'strip'
self.nm = 'nm'
self.readelf = 'readelf'
self.extend_name_dict = {}
self.cflags = '-DWIN32 -D_WIN32 -D_DEBUG -MDd /utf-8 /c'
self.cxxflags = ''
self.asflags = ''
self.ldflags = ''
self.arflags = ''
self.extend_flag_dict = {}
self.binary = self.binary_raw + '.exe'
env = self.config.aos_env
env['MAPFILE'] = self.binary_raw + '.map'
class iar_tool_chain(tool_chain):
def __init__(self, config, tools_path=''):
tool_chain.__init__(self, config, tools_path)
self.prefix = ''
self.cc = 'iccarm'
self.cxx = 'iccarm'
self.ass = 'iasmarm'
self.ar = 'iarchive'
self.ld = 'ilinkarm'
self.objdump = 'ielfdumparm'
self.objcopy = 'ielftool'
self.strip = 'ielftool'
self.extend_name_dict = {}
self.cflags = '-e --dlib_config=full -D_TIMESPEC_DEFINED --silent --only_stdout --no_warnings --diag_warning=Pe167,Pe144,Pe513'
self.cxxflags = ''
self.cppflags = ''
self.asflags = ''
self.ldflags = ''
self.arflags = '--create'
self.extend_flag_dict = {}
self.nm = ''
self.readelf = ''
self.binary = self.binary_raw + '.iarElf'
class armcc_tool_chain(tool_chain):
def __init__(self,config,tools_path=''):
tool_chain.__init__(self,config,tools_path)
self.prefix = ''
self.cc = 'armcc'
self.cxx = 'armcc'
self.ass = 'armasm'
self.ar = 'armar'
self.ld = 'armlink'
self.objdump = 'fromelf'
self.objcopy = 'fromelf'
self.strip = 'fromelf'
self.extend_name_dict = {}
self.cflags = '--c90 --gnu --library_type=microlib -W'
self.cxxflags = ''
self.cppflags = ''
self.asflags = '--library_type=microlib'
self.ldflags = ''
self.arflags = '-rcs'
self.extend_flag_dict = {}
self.nm = ''
self.readelf = ''
self.binary = self.binary_raw + '.axf'
class rvct_tool_chain(tool_chain):
def __init__(self,config,tools_path=''):
tool_chain.__init__(self,config,tools_path)
self.prefix = ''
self.cc = 'armcc'
self.cxx = 'armcc'
self.ass = 'armasm'
self.ar = 'armar'
self.ld = 'armlink'
self.objdump = 'fromelf'
self.objcopy = 'fromelf'
self.strip = 'fromelf'
self.extend_name_dict = {}
self.cflags = '--c90 --gnu -W'
self.cxxflags = ''
self.cppflags = ''
self.asflags = ''
self.ldflags = ''
self.arflags = '-rcs'
self.extend_flag_dict = {}
self.nm = ''
self.readelf = ''
self.binary = self.binary_raw + '.axf'
def create_tool_chain(config):
compiler = config.compiler
if compiler == 'gcc':
return gcc_tool_chain(config)
elif compiler == 'cl':
return win32msvs_tool_chain(config)
elif compiler == 'iar':
return iar_tool_chain(config)
elif compiler == 'armcc':
return armcc_tool_chain(config)
elif compiler == 'rvct':
return rvct_tool_chain(config)
else:
print("%s is not support new, please contact aos build engineer." % compiler)
exit(-1)
|
[
"sys.platform.startswith",
"os.path.isabs",
"os.path.abspath",
"os.path.isdir",
"os.path.join",
"os.getenv"
] |
[((179, 270), 'os.path.join', 'os.path.join', (['self.config.out_dir', '"""binary"""', "(self.config.app + '@' + self.config.board)"], {}), "(self.config.out_dir, 'binary', self.config.app + '@' + self.\n config.board)\n", (191, 270), False, 'import os\n'), ((332, 364), 'sys.platform.startswith', 'sys.platform.startswith', (['"""linux"""'], {}), "('linux')\n", (355, 364), False, 'import sys\n'), ((722, 778), 'os.path.join', 'os.path.join', (['self.config.project_path', '"""build/compiler"""'], {}), "(self.config.project_path, 'build/compiler')\n", (734, 778), False, 'import os\n'), ((1717, 1736), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (1730, 1736), False, 'import os\n'), ((1971, 2023), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + self.cc)'], {}), '(self.tools_path, self.prefix + self.cc)\n', (1983, 2023), False, 'import os\n'), ((2061, 2114), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + self.cxx)'], {}), '(self.tools_path, self.prefix + self.cxx)\n', (2073, 2114), False, 'import os\n'), ((2151, 2204), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + self.ass)'], {}), '(self.tools_path, self.prefix + self.ass)\n', (2163, 2204), False, 'import os\n'), ((2416, 2468), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + self.ld)'], {}), '(self.tools_path, self.prefix + self.ld)\n', (2428, 2468), False, 'import os\n'), ((2510, 2567), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + self.objdump)'], {}), '(self.tools_path, self.prefix + self.objdump)\n', (2522, 2567), False, 'import os\n'), ((2609, 2666), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + self.objcopy)'], {}), '(self.tools_path, self.prefix + self.objcopy)\n', (2621, 2666), False, 'import os\n'), ((2706, 2761), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + self.strip)'], {}), '(self.tools_path, self.prefix + self.strip)\n', (2718, 2761), False, 'import os\n'), ((2798, 2850), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + self.nm)'], {}), '(self.tools_path, self.prefix + self.nm)\n', (2810, 2850), False, 'import os\n'), ((2892, 2949), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + self.readelf)'], {}), '(self.tools_path, self.prefix + self.readelf)\n', (2904, 2949), False, 'import os\n'), ((444, 477), 'sys.platform.startswith', 'sys.platform.startswith', (['"""darwin"""'], {}), "('darwin')\n", (467, 477), False, 'import sys\n'), ((1786, 1813), 'os.getenv', 'os.getenv', (['"""TOOLCHAIN_PATH"""'], {}), "('TOOLCHAIN_PATH')\n", (1795, 1813), False, 'import os\n'), ((2327, 2379), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + self.ar)'], {}), '(self.tools_path, self.prefix + self.ar)\n', (2339, 2379), False, 'import os\n'), ((3100, 3149), 'os.path.join', 'os.path.join', (['self.tools_path', '(self.prefix + name)'], {}), '(self.tools_path, self.prefix + name)\n', (3112, 3149), False, 'import os\n'), ((4001, 4026), 'os.path.isabs', 'os.path.isabs', (['tools_path'], {}), '(tools_path)\n', (4014, 4026), False, 'import os\n'), ((4032, 4059), 'os.path.abspath', 'os.path.abspath', (['tools_path'], {}), '(tools_path)\n', (4047, 4059), False, 'import os\n'), ((515, 545), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (538, 545), False, 'import sys\n'), ((1845, 1872), 'os.getenv', 'os.getenv', (['"""TOOLCHAIN_PATH"""'], {}), "('TOOLCHAIN_PATH')\n", (1854, 1872), False, 'import os\n')]
|
# Graphics / Primitives
# Use the #graphics module to render and update shapes.
# ---
from h2o_wave import site, ui, graphics as g
# Create some shapes
arc = g.arc(r1=25, r2=50, a1=90, a2=180)
circle = g.circle(cx=25, cy=25, r=25)
ellipse = g.ellipse(cx=25, cy=25, rx=25, ry=20)
image = g.image(width=50, height=50, href='https://www.python.org/static/community_logos/python-powered-h-140x182.png')
line = g.line(x1=0, y1=0, x2=50, y2=50)
path = g.path(d='M 0,0 L 50,50 L 50,0 L 0,50 z')
path2 = g.path(d=g.p().M(0, 0).L(50, 50).L(50, 0).L(0, 50).z().d()) # same effect as above, but programmable.
path3 = g.p().M(0, 0).L(50, 50).L(50, 0).L(0, 50).z().path() # same effect as above, but a tad more concise.
polygon = g.polygon(points='0,0 50,50 50,0 0,50')
polyline = g.polyline(points='0,0 50,50 50,0 0,50')
rect = g.rect(x=0, y=0, width=50, height=50)
rounded_rect = g.rect(x=0, y=0, width=50, height=50, rx=10)
text = g.text(x=0, y=48, text='Z', font_size='4em')
# Collect 'em all
shapes = [arc, circle, ellipse, image, line, path, path2, path3, polygon, polyline, rect, rounded_rect, text]
# Apply fill/stroke for each shape
for shape in shapes:
shape.fill = 'none' if g.type_of(shape) == 'polyline' else 'crimson'
shape.stroke = 'darkred'
shape.stroke_width = 5
# Lay out shapes vertically
y = 10
for shape in shapes:
shape.transform = f'translate(10,{y})'
y += 60
# Add shapes to the graphics card
page = site['/demo']
page['example'] = ui.graphics_card(
box='1 1 1 10', view_box='0 0 70 800', width='100%', height='100%',
stage=g.stage(
arc=arc,
circle=circle,
ellipse=ellipse,
image=image,
line=line,
path=path,
path2=path2,
path3=path3,
polygon=polygon,
polyline=polyline,
rect=rect,
rounded_rect=rounded_rect,
text=text,
),
)
page.save()
|
[
"h2o_wave.graphics.p",
"h2o_wave.graphics.type_of",
"h2o_wave.graphics.arc",
"h2o_wave.graphics.text",
"h2o_wave.graphics.stage",
"h2o_wave.graphics.image",
"h2o_wave.graphics.line",
"h2o_wave.graphics.circle",
"h2o_wave.graphics.polygon",
"h2o_wave.graphics.path",
"h2o_wave.graphics.rect",
"h2o_wave.graphics.ellipse",
"h2o_wave.graphics.polyline"
] |
[((160, 194), 'h2o_wave.graphics.arc', 'g.arc', ([], {'r1': '(25)', 'r2': '(50)', 'a1': '(90)', 'a2': '(180)'}), '(r1=25, r2=50, a1=90, a2=180)\n', (165, 194), True, 'from h2o_wave import site, ui, graphics as g\n'), ((204, 232), 'h2o_wave.graphics.circle', 'g.circle', ([], {'cx': '(25)', 'cy': '(25)', 'r': '(25)'}), '(cx=25, cy=25, r=25)\n', (212, 232), True, 'from h2o_wave import site, ui, graphics as g\n'), ((243, 280), 'h2o_wave.graphics.ellipse', 'g.ellipse', ([], {'cx': '(25)', 'cy': '(25)', 'rx': '(25)', 'ry': '(20)'}), '(cx=25, cy=25, rx=25, ry=20)\n', (252, 280), True, 'from h2o_wave import site, ui, graphics as g\n'), ((289, 410), 'h2o_wave.graphics.image', 'g.image', ([], {'width': '(50)', 'height': '(50)', 'href': '"""https://www.python.org/static/community_logos/python-powered-h-140x182.png"""'}), "(width=50, height=50, href=\n 'https://www.python.org/static/community_logos/python-powered-h-140x182.png'\n )\n", (296, 410), True, 'from h2o_wave import site, ui, graphics as g\n'), ((408, 440), 'h2o_wave.graphics.line', 'g.line', ([], {'x1': '(0)', 'y1': '(0)', 'x2': '(50)', 'y2': '(50)'}), '(x1=0, y1=0, x2=50, y2=50)\n', (414, 440), True, 'from h2o_wave import site, ui, graphics as g\n'), ((448, 489), 'h2o_wave.graphics.path', 'g.path', ([], {'d': '"""M 0,0 L 50,50 L 50,0 L 0,50 z"""'}), "(d='M 0,0 L 50,50 L 50,0 L 0,50 z')\n", (454, 489), True, 'from h2o_wave import site, ui, graphics as g\n'), ((721, 760), 'h2o_wave.graphics.polygon', 'g.polygon', ([], {'points': '"""0,0 50,50 50,0 0,50"""'}), "(points='0,0 50,50 50,0 0,50')\n", (730, 760), True, 'from h2o_wave import site, ui, graphics as g\n'), ((772, 812), 'h2o_wave.graphics.polyline', 'g.polyline', ([], {'points': '"""0,0 50,50 50,0 0,50"""'}), "(points='0,0 50,50 50,0 0,50')\n", (782, 812), True, 'from h2o_wave import site, ui, graphics as g\n'), ((820, 857), 'h2o_wave.graphics.rect', 'g.rect', ([], {'x': '(0)', 'y': '(0)', 'width': '(50)', 'height': '(50)'}), '(x=0, y=0, width=50, height=50)\n', (826, 857), True, 'from h2o_wave import site, ui, graphics as g\n'), ((873, 917), 'h2o_wave.graphics.rect', 'g.rect', ([], {'x': '(0)', 'y': '(0)', 'width': '(50)', 'height': '(50)', 'rx': '(10)'}), '(x=0, y=0, width=50, height=50, rx=10)\n', (879, 917), True, 'from h2o_wave import site, ui, graphics as g\n'), ((925, 969), 'h2o_wave.graphics.text', 'g.text', ([], {'x': '(0)', 'y': '(48)', 'text': '"""Z"""', 'font_size': '"""4em"""'}), "(x=0, y=48, text='Z', font_size='4em')\n", (931, 969), True, 'from h2o_wave import site, ui, graphics as g\n'), ((1571, 1773), 'h2o_wave.graphics.stage', 'g.stage', ([], {'arc': 'arc', 'circle': 'circle', 'ellipse': 'ellipse', 'image': 'image', 'line': 'line', 'path': 'path', 'path2': 'path2', 'path3': 'path3', 'polygon': 'polygon', 'polyline': 'polyline', 'rect': 'rect', 'rounded_rect': 'rounded_rect', 'text': 'text'}), '(arc=arc, circle=circle, ellipse=ellipse, image=image, line=line,\n path=path, path2=path2, path3=path3, polygon=polygon, polyline=polyline,\n rect=rect, rounded_rect=rounded_rect, text=text)\n', (1578, 1773), True, 'from h2o_wave import site, ui, graphics as g\n'), ((1183, 1199), 'h2o_wave.graphics.type_of', 'g.type_of', (['shape'], {}), '(shape)\n', (1192, 1199), True, 'from h2o_wave import site, ui, graphics as g\n'), ((609, 614), 'h2o_wave.graphics.p', 'g.p', ([], {}), '()\n', (612, 614), True, 'from h2o_wave import site, ui, graphics as g\n'), ((507, 512), 'h2o_wave.graphics.p', 'g.p', ([], {}), '()\n', (510, 512), True, 'from h2o_wave import site, ui, graphics as g\n')]
|
import numpy as np
import cv2 as cv
from split import SliceImage
import utils
class DocumentScanner:
def __init__(self, path):
self.path = path
self.contrast = 0
self.row = 4
self.column = 4
def setImage(self):
self.image = cv.imread(self.path, 1)
def copy(self):
self.clone = self.image.copy()
def resize(self, width):
# old_height/old_width
ratio = self.image.shape[0] / self.image.shape[1]
# Only resize when image's width > 600
if self.image.shape[1] > width:
# Resize (width, width*ratio)
self.image = cv.resize(self.image, (width, round(width * ratio)))
def convertGray(self):
self.grayscale = cv.cvtColor(self.clone, cv.COLOR_BGR2GRAY)
def calculate_contrast(self):
# Blur to decrease detail
blur = SliceImage(self.grayscale, self.column, self.row)
blur.divide()
blur.blur(50, 50)
self.contrast = blur.contrast()
def equalization(self):
equalization = cv.equalizeHist(self.grayscale)
self.median = cv.medianBlur(equalization,5)
def canny(self):
self.slice.edge_canny()
self.slice.merge()
self.edge = self.slice.image
def otsu(self):
self.slice.edge_otsu()
self.slice.merge()
self.edge = self.slice.image
def dilate(self):
kernel = cv.getStructuringElement(cv.MORPH_RECT, (3, 3))
self.dilation = cv.dilate(self.edge, kernel, 1)
def contour(self):
contours, hierarchy = cv.findContours(self.dilation, cv.RETR_LIST, cv.CHAIN_APPROX_SIMPLE)
contours = sorted(contours, key=cv.contourArea, reverse= True)
# Find matching contour
for i in contours:
elip = cv.arcLength(i, True)
approx = cv.approxPolyDP(i, 0.08*elip, True)
# Ordinary papers have 4 corner
if len(approx) == 4 :
doc = approx
break
cv.drawContours(self.clone, [doc], -1, (0, 255, 0), 2)
def write(self):
cv.imwrite('../process/grayscale.jpg', self.grayscale)
cv.imwrite('../process/edge.jpg', self.edge)
cv.imwrite('../process/dilation.jpg', self.dilation)
cv.imwrite('../process/contour.jpg', self.clone)
def test(self, name):
cv.imwrite('result/' + name, self.clone)
def detect(self):
self.setImage()
self.resize(600)
self.copy()
self.convertGray()
self.slice = SliceImage(self.grayscale, self.column, self.row)
self.slice.divide()
self.calculate_contrast()
if self.contrast < 25:
self.equalization()
self.slice.image = self.median
self.slice.divide()
self.slice.blur(70, 70)
else:
self.slice.blur(50, 50)
self.canny()
self.dilate()
self.contour()
def old(self):
#reshape to avoid errors ahead
doc=doc.reshape((4,2))
#create a new array and initialize
rect = np.zeros((4,2), dtype="float32")
Sum = doc.sum(axis = 1)
rect[0] = doc[np.argmin(Sum)]
rect[2] = doc[np.argmax(Sum)]
Diff = np.diff(doc, axis=1)
rect[1] = doc[np.argmin(Diff)]
rect[3] = doc[np.argmax(Diff)]
(topLeft,topRight,bottomRight,bottomLeft) = rect
#find distance between points and get max
dist1 = np.linalg.norm(bottomRight-bottomLeft)
dist2 = np.linalg.norm(topRight-topLeft)
maxWidth = max(int(dist1),int(dist2))
dist3 = np.linalg.norm(topRight-bottomRight)
dist4 = np.linalg.norm(topLeft-bottomLeft)
maxHeight = max(int(dist3), int(dist4))
dst = np.array([[0,0],[maxWidth-1, 0],[maxWidth-1, maxHeight-1], [0, maxHeight-1]], dtype="float32")
M = cv.getPerspectiveTransform(rect, dst)
warp = cv.warpPerspective(sourceImage, M, (maxWidth, maxHeight))
destinationImage = cv.cvtColor(warp, cv.COLOR_BGR2GRAY)
# sharpen image
sharpen = cv.GaussianBlur(destinationImage, (0, 0), 3)
sharpen = cv.addWeighted(destinationImage, 1.5, sharpen, -0.5, 0)
# apply adaptive threshold to get black and white effect
thresh = cv.adaptiveThreshold(
sharpen, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 21, 15)
cv.imwrite('scanned.jpg', warp)
cv.imwrite('white effect.jpg', thresh)
return thresh
|
[
"cv2.GaussianBlur",
"cv2.medianBlur",
"cv2.getPerspectiveTransform",
"cv2.arcLength",
"cv2.approxPolyDP",
"numpy.argmax",
"cv2.adaptiveThreshold",
"numpy.argmin",
"numpy.linalg.norm",
"cv2.warpPerspective",
"cv2.dilate",
"cv2.cvtColor",
"cv2.imwrite",
"split.SliceImage",
"cv2.drawContours",
"cv2.equalizeHist",
"cv2.addWeighted",
"cv2.getStructuringElement",
"numpy.zeros",
"cv2.imread",
"numpy.diff",
"numpy.array",
"cv2.findContours"
] |
[((278, 301), 'cv2.imread', 'cv.imread', (['self.path', '(1)'], {}), '(self.path, 1)\n', (287, 301), True, 'import cv2 as cv\n'), ((749, 791), 'cv2.cvtColor', 'cv.cvtColor', (['self.clone', 'cv.COLOR_BGR2GRAY'], {}), '(self.clone, cv.COLOR_BGR2GRAY)\n', (760, 791), True, 'import cv2 as cv\n'), ((881, 930), 'split.SliceImage', 'SliceImage', (['self.grayscale', 'self.column', 'self.row'], {}), '(self.grayscale, self.column, self.row)\n', (891, 930), False, 'from split import SliceImage\n'), ((1072, 1103), 'cv2.equalizeHist', 'cv.equalizeHist', (['self.grayscale'], {}), '(self.grayscale)\n', (1087, 1103), True, 'import cv2 as cv\n'), ((1126, 1156), 'cv2.medianBlur', 'cv.medianBlur', (['equalization', '(5)'], {}), '(equalization, 5)\n', (1139, 1156), True, 'import cv2 as cv\n'), ((1448, 1495), 'cv2.getStructuringElement', 'cv.getStructuringElement', (['cv.MORPH_RECT', '(3, 3)'], {}), '(cv.MORPH_RECT, (3, 3))\n', (1472, 1495), True, 'import cv2 as cv\n'), ((1520, 1551), 'cv2.dilate', 'cv.dilate', (['self.edge', 'kernel', '(1)'], {}), '(self.edge, kernel, 1)\n', (1529, 1551), True, 'import cv2 as cv\n'), ((1611, 1679), 'cv2.findContours', 'cv.findContours', (['self.dilation', 'cv.RETR_LIST', 'cv.CHAIN_APPROX_SIMPLE'], {}), '(self.dilation, cv.RETR_LIST, cv.CHAIN_APPROX_SIMPLE)\n', (1626, 1679), True, 'import cv2 as cv\n'), ((2031, 2085), 'cv2.drawContours', 'cv.drawContours', (['self.clone', '[doc]', '(-1)', '(0, 255, 0)', '(2)'], {}), '(self.clone, [doc], -1, (0, 255, 0), 2)\n', (2046, 2085), True, 'import cv2 as cv\n'), ((2117, 2171), 'cv2.imwrite', 'cv.imwrite', (['"""../process/grayscale.jpg"""', 'self.grayscale'], {}), "('../process/grayscale.jpg', self.grayscale)\n", (2127, 2171), True, 'import cv2 as cv\n'), ((2180, 2224), 'cv2.imwrite', 'cv.imwrite', (['"""../process/edge.jpg"""', 'self.edge'], {}), "('../process/edge.jpg', self.edge)\n", (2190, 2224), True, 'import cv2 as cv\n'), ((2233, 2285), 'cv2.imwrite', 'cv.imwrite', (['"""../process/dilation.jpg"""', 'self.dilation'], {}), "('../process/dilation.jpg', self.dilation)\n", (2243, 2285), True, 'import cv2 as cv\n'), ((2294, 2342), 'cv2.imwrite', 'cv.imwrite', (['"""../process/contour.jpg"""', 'self.clone'], {}), "('../process/contour.jpg', self.clone)\n", (2304, 2342), True, 'import cv2 as cv\n'), ((2379, 2419), 'cv2.imwrite', 'cv.imwrite', (["('result/' + name)", 'self.clone'], {}), "('result/' + name, self.clone)\n", (2389, 2419), True, 'import cv2 as cv\n'), ((2562, 2611), 'split.SliceImage', 'SliceImage', (['self.grayscale', 'self.column', 'self.row'], {}), '(self.grayscale, self.column, self.row)\n', (2572, 2611), False, 'from split import SliceImage\n'), ((3148, 3181), 'numpy.zeros', 'np.zeros', (['(4, 2)'], {'dtype': '"""float32"""'}), "((4, 2), dtype='float32')\n", (3156, 3181), True, 'import numpy as np\n'), ((3305, 3325), 'numpy.diff', 'np.diff', (['doc'], {'axis': '(1)'}), '(doc, axis=1)\n', (3312, 3325), True, 'import numpy as np\n'), ((3530, 3570), 'numpy.linalg.norm', 'np.linalg.norm', (['(bottomRight - bottomLeft)'], {}), '(bottomRight - bottomLeft)\n', (3544, 3570), True, 'import numpy as np\n'), ((3585, 3619), 'numpy.linalg.norm', 'np.linalg.norm', (['(topRight - topLeft)'], {}), '(topRight - topLeft)\n', (3599, 3619), True, 'import numpy as np\n'), ((3682, 3720), 'numpy.linalg.norm', 'np.linalg.norm', (['(topRight - bottomRight)'], {}), '(topRight - bottomRight)\n', (3696, 3720), True, 'import numpy as np\n'), ((3735, 3771), 'numpy.linalg.norm', 'np.linalg.norm', (['(topLeft - bottomLeft)'], {}), '(topLeft - bottomLeft)\n', (3749, 3771), True, 'import numpy as np\n'), ((3834, 3944), 'numpy.array', 'np.array', (['[[0, 0], [maxWidth - 1, 0], [maxWidth - 1, maxHeight - 1], [0, maxHeight - 1]]'], {'dtype': '"""float32"""'}), "([[0, 0], [maxWidth - 1, 0], [maxWidth - 1, maxHeight - 1], [0, \n maxHeight - 1]], dtype='float32')\n", (3842, 3944), True, 'import numpy as np\n'), ((3942, 3979), 'cv2.getPerspectiveTransform', 'cv.getPerspectiveTransform', (['rect', 'dst'], {}), '(rect, dst)\n', (3968, 3979), True, 'import cv2 as cv\n'), ((3995, 4052), 'cv2.warpPerspective', 'cv.warpPerspective', (['sourceImage', 'M', '(maxWidth, maxHeight)'], {}), '(sourceImage, M, (maxWidth, maxHeight))\n', (4013, 4052), True, 'import cv2 as cv\n'), ((4081, 4117), 'cv2.cvtColor', 'cv.cvtColor', (['warp', 'cv.COLOR_BGR2GRAY'], {}), '(warp, cv.COLOR_BGR2GRAY)\n', (4092, 4117), True, 'import cv2 as cv\n'), ((4161, 4205), 'cv2.GaussianBlur', 'cv.GaussianBlur', (['destinationImage', '(0, 0)', '(3)'], {}), '(destinationImage, (0, 0), 3)\n', (4176, 4205), True, 'import cv2 as cv\n'), ((4224, 4279), 'cv2.addWeighted', 'cv.addWeighted', (['destinationImage', '(1.5)', 'sharpen', '(-0.5)', '(0)'], {}), '(destinationImage, 1.5, sharpen, -0.5, 0)\n', (4238, 4279), True, 'import cv2 as cv\n'), ((4362, 4458), 'cv2.adaptiveThreshold', 'cv.adaptiveThreshold', (['sharpen', '(255)', 'cv.ADAPTIVE_THRESH_GAUSSIAN_C', 'cv.THRESH_BINARY', '(21)', '(15)'], {}), '(sharpen, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.\n THRESH_BINARY, 21, 15)\n', (4382, 4458), True, 'import cv2 as cv\n'), ((4481, 4512), 'cv2.imwrite', 'cv.imwrite', (['"""scanned.jpg"""', 'warp'], {}), "('scanned.jpg', warp)\n", (4491, 4512), True, 'import cv2 as cv\n'), ((4522, 4560), 'cv2.imwrite', 'cv.imwrite', (['"""white effect.jpg"""', 'thresh'], {}), "('white effect.jpg', thresh)\n", (4532, 4560), True, 'import cv2 as cv\n'), ((1829, 1850), 'cv2.arcLength', 'cv.arcLength', (['i', '(True)'], {}), '(i, True)\n', (1841, 1850), True, 'import cv2 as cv\n'), ((1869, 1906), 'cv2.approxPolyDP', 'cv.approxPolyDP', (['i', '(0.08 * elip)', '(True)'], {}), '(i, 0.08 * elip, True)\n', (1884, 1906), True, 'import cv2 as cv\n'), ((3235, 3249), 'numpy.argmin', 'np.argmin', (['Sum'], {}), '(Sum)\n', (3244, 3249), True, 'import numpy as np\n'), ((3273, 3287), 'numpy.argmax', 'np.argmax', (['Sum'], {}), '(Sum)\n', (3282, 3287), True, 'import numpy as np\n'), ((3348, 3363), 'numpy.argmin', 'np.argmin', (['Diff'], {}), '(Diff)\n', (3357, 3363), True, 'import numpy as np\n'), ((3387, 3402), 'numpy.argmax', 'np.argmax', (['Diff'], {}), '(Diff)\n', (3396, 3402), True, 'import numpy as np\n')]
|
import demistomock as demisto
from CommonServerPython import *
import urllib3
from typing import Any, Dict
# Disable insecure warnings
urllib3.disable_warnings()
class Client(BaseClient):
@logger
def __init__(self, headers, verify=False, proxy=False):
url = 'https://api.cloudconvert.com/v2'
super().__init__(url, headers=headers, verify=verify, proxy=proxy)
@logger
def upload_url(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
"""
Upload the file given as url to the API's server, for later conversion.
Note - this operation is called 'import' by the API.
Args:
arguments: dict containing the request arguments, should contain the field 'url'
Returns:
dict containing the results of the upload action as returned from the API (status, task ID, etc.)
``Dict[str, Any]``
"""
return self._http_request(
method='POST',
url_suffix='import/url',
data=arguments,
ok_codes=(200, 201, 422),
)
@logger
def upload_entry_id(self, file_path: str, file_name: str) -> Dict[str, Any]:
"""
Upload the file given as a war room entry id to the API's server, for later conversion
Note - this operation is called 'import' by the API.
Args:
file_path: path to given file, derived from the entry id
file_name: name of file, including format suffix
Returns:
dict containing the results of the upload action as returned from the API (status, task ID, etc.)
``Dict[str, Any]``
"""
response_get_form = self._http_request(
method='POST',
url_suffix='import/upload'
)
form = dict_safe_get(response_get_form, ('data', 'result', 'form'), default_return_value={})
port_url = form.get('url')
params = form.get('parameters')
if port_url is None or params is None:
raise ValueError('Failed to initiate an upload operation')
file_dict = {'file': (file_name, open(file_path, 'rb'))}
self._http_request(
method='POST',
url_suffix=None,
full_url=port_url,
files=file_dict,
empty_valid_codes=[201, 204],
return_empty_response=True,
data=params
)
# As shown, this operation has two requests
# The data about the operation is within the first request's response,
# So in order to keep the operation's data, we should return the first request's response,
# But first we should remove fields that are no longer true, such as ones that indicates that
# The second request has not been done yet
if response_get_form.get('data'):
response_get_form.get('data').pop('message', None)
response_get_form.get('data').pop('result', None)
return response_get_form
@logger
def convert(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
"""
Convert a file to desired format, given the file was priorly uploaded to the API's server
Args:
arguments: dict containing the request arguments, should contain the fields 'task_id' and 'output_format'
Returns:
dict containing the results of the convert action as returned from the API (status, task ID, etc.)
``Dict[str, Any]``
"""
arguments['input'] = arguments.pop('task_id')
return self._http_request(
method='POST',
url_suffix='convert',
data=arguments,
ok_codes=(200, 201, 422),
)
def check_status(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
"""
Check the status of a request sent to the API's server
Args:
arguments: dict containing the request arguments, should contain the field 'task_id'
Returns:
dict containing the results of the check status action as returned from the API (status, task ID, etc.)
``Dict[str, Any]``
"""
task_id = arguments.get('task_id')
return self._http_request(
method='GET',
url_suffix=f'/tasks/{task_id}',
ok_codes=(200, 201, 422),
)
@logger
def download_url(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
"""
Download a converted file to a url
Note - this operation is called 'export' by the API.
Args:
arguments:
dict containing the request arguments, should contain the field 'task_id' of the desired file
Returns:
dict containing the results of the download action as returned from the API (status, task ID, etc.)
if the action was complete, the result url will be a part of this dict. If the request is pending,
one should retrieve the url via the 'check_status' command
``Dict[str, Any]``
"""
arguments['input'] = arguments.pop('task_id')
return self._http_request(
method='POST',
url_suffix='/export/url',
data=arguments,
ok_codes=(200, 201, 422),
)
@logger
def get_file_from_url(self, url: str):
"""
Call a GET http request in order to get the file data given as url
Args:
url: url containing a file
Returns:
request response, containing the data of the file
"""
# Saving the headers of this client instance
# The HTTP request that gets the file data needs to have no headers
# Passing an empty dictionary to _http_request cause it to use this client's headers by default
session_headers = self._headers
self._headers = {}
try:
results = self._http_request(
method='GET',
url_suffix=None,
full_url=url,
headers={},
resp_type='response',
)
return results.content
finally:
self._headers = session_headers
@logger
def raise_error_if_no_data(results: Dict[str, Any]):
"""
This function checks if No 'data' field was returned from the request, meaning the input was invalid
Args:
results: a dict containing the request's results
Returns:
raises error if there is no 'data' field, with the matching error message returned from the server
if no error message was given from the server, suggests the other optional errors
"""
if results.get('data') is None:
if results.get('message'):
raise ValueError(results.get('message'))
else:
raise ValueError('No response from server, the server could be temporary unavailable or it is handling too '
'many requests. Please try again later.')
@logger
def upload_command(client: Client, arguments: Dict[str, Any]):
"""
Upload a file to the API for later conversion
Args:
client: CloudConvert client to use
arguments: All command arguments - either 'url' or 'entry_id'.
Returns:
CommandResults object containing the results of the upload action as returned from the API and its
readable output
"""
if arguments.get('url'):
if arguments.get('entry_id'):
raise ValueError('Both url and entry id were inserted - please insert only one.')
results = client.upload_url(arguments)
elif arguments.get('entry_id'):
demisto.debug('getting the path of the file from its entry id')
result = demisto.getFilePath(arguments.get('entry_id'))
if not result:
raise ValueError('No file was found for given entry id')
file_path, file_name = result['path'], result['name']
results = client.upload_entry_id(file_path, file_name)
else:
raise ValueError('No url or entry id specified.')
raise_error_if_no_data(results)
format_operation_title(results)
results_data = results.get('data')
readable_output = tableToMarkdown(
'Upload Results',
remove_empty_elements(results_data),
headers=('id', 'operation', 'created_at', 'status'),
headerTransform=string_to_table_header,
)
return CommandResults(
readable_output=readable_output,
outputs_prefix='CloudConvert.Task',
outputs_key_field='id',
raw_response=results,
outputs=remove_empty_elements(results_data),
)
@logger
def convert_command(client: Client, arguments: Dict[str, Any]):
"""
Convert a file that was priorly uploaded
Args:
client: CloudConvert client to use
arguments: All command arguments, the fields 'task_id' and 'output_format'
Returns:
CommandResults object containing the results of the convert action as returned from the API and its readable output
"""
results = client.convert(arguments)
raise_error_if_no_data(results)
results_data = results.get('data')
readable_output = tableToMarkdown(
'Convert Results',
remove_empty_elements(results_data),
headers=('id', 'operation', 'created_at', 'status', 'depends_on_task_ids'),
headerTransform=string_to_table_header,
)
return CommandResults(
readable_output=readable_output,
outputs_prefix='CloudConvert.Task',
outputs_key_field='id',
raw_response=results,
outputs=remove_empty_elements(results_data),
)
@logger
def check_status_command(client: Client, arguments: Dict[str, Any]):
"""
Check status of an existing operation using it's task id
Args:
client: CloudConvert client to use
arguments: All command arguments, the field 'task_id'
Note: When the checked operation is 'download', the field 'create_war_room_entry' should be set according
to the chosen download method, true if downloading as war room entry and false if not.
This way a war room entry containing the file will be created if needed.
Returns:
CommandResults object containing the results of the check status action as returned from the API
and its readable output OR if the argument create_war_room_entry is set to True, then a war room entry is also
being created.
"""
results = client.check_status(arguments)
raise_error_if_no_data(results)
format_operation_title(results)
results_data = results.get('data', {})
# If checking on an download to entry operation, manually change the operation name
# This is because the 'download as entry' operation is our variation on the export to url operation,
# hence not distinguished as a different operation by the API
if argToBoolean(arguments.get('create_war_room_entry', False)) \
and results_data.get('operation') == 'download/url':
results['data']['operation'] = 'download/entry'
# Check if an download to war room entry operation is finished
# If it did - create the entry
if results_data.get('status') == 'finished' \
and argToBoolean(arguments.get('create_war_room_entry', 'False'))\
and results_data.get('operation') == 'download/entry':
modify_results_dict(results_data)
url = results_data.get('url')
file_name = results_data.get('file_name')
file_data = client.get_file_from_url(url)
war_room_file = fileResult(filename=file_name, data=file_data, file_type=entryTypes['entryInfoFile'])
readable_output = tableToMarkdown('Check Status Results', remove_empty_elements(results_data),
headers=('id', 'operation', 'created_at', 'status', 'depends_on_task_ids',
'file_name', 'url'),
headerTransform=string_to_table_header,)
return_results(CommandResults(
outputs_prefix='CloudConvert.Task',
outputs_key_field='id',
raw_response=results,
readable_output=readable_output,
outputs=remove_empty_elements(results_data)
))
return war_room_file
else:
modify_results_dict(results_data)
readable_output = tableToMarkdown(
'Check Status Results',
remove_empty_elements(results_data),
headers=('id', 'operation', 'created_at', 'status', 'depends_on_task_ids', 'file_name', 'url'),
headerTransform=string_to_table_header,
)
return CommandResults(
readable_output=readable_output,
outputs_prefix='CloudConvert.Task',
outputs_key_field='id',
raw_response=results,
outputs=remove_empty_elements(results_data),
)
def modify_results_dict(results_data: Dict[str, Any]):
"""
The results of the specific file converted/uploaded/downloaded are sub-values of some keys,
so parse the results field to the outer scope of the dict
Args:
results_data: the dict under the 'data' field in the response's results
"""
if results_data.get('result'):
results_info = results_data.get('result', {}).get('files')
if results_info:
results_data['file_name'] = results_info[0].get('filename')
results_data['url'] = results_info[0].get('url')
results_data['size'] = results_info[0].get('size')
@logger
def download_command(client: Client, arguments: Dict[str, Any]):
"""
Download a converted file back to the user, either as a url or directly as a war room entry
Note: in order to get the resulted url/entry of the file you need to use a check-status command as well,
since the response of the download command is usually responded before the file is fully downloaded (hence the
'status' field is 'waiting', and not 'finished')
Args:
client: CloudConvert client to use
arguments: All command arguments, the fields 'task_id', and 'download_as' (url/war_room_entry)
Returns:
CommandResults object containing the results of the download action as returned from the API, and its readable
"""
# Call download as url request
# In both url and war room entry we still first get a url
results = client.download_url(arguments)
raise_error_if_no_data(results)
# If downloading as war room entry, manually change the operation name
# This is because the 'download as entry' operation is our variation on the export to url operation,
# hence not distinguished as a different operation by the API
if arguments['download_as'] == 'war_room_entry':
results['data']['operation'] = 'download/entry'
else:
format_operation_title(results)
results_data = results.get('data')
readable_output = tableToMarkdown(
'Download Results',
remove_empty_elements(results_data),
headers=('id', 'operation', 'created_at', 'status', 'depends_on_task_ids'),
headerTransform=string_to_table_header,
)
return CommandResults(
readable_output=readable_output,
outputs_prefix='CloudConvert.Task',
outputs_key_field='id',
raw_response=results,
outputs=remove_empty_elements(results_data),
)
def test_module(client: Client):
"""
Returning 'ok' indicates that the integration works like it suppose to. Connection to the service is successful.
Args:
client: CloudConvert client
Returns:
'ok' if test passed, anything else will fail the test
"""
dummy_url = 'https://raw.githubusercontent.com/demisto/content/master/TestData/pdfworking.pdf'
result = client.upload_url({'url': dummy_url})
if result.get('data'):
return 'ok'
elif result.get('message') == "Unauthenticated.":
return 'Authorization Error: make sure API Key is correctly set'
elif result.get('message'):
return result.get('message')
else:
return 'No response from server, the server could be temporary unavailable or it is handling too ' \
'many requests. Please try again later.'
def format_operation_title(results: Dict[str, Any]):
"""
This function is being used in order to change the titles of the operations that are done by the API and are
returned in the response to titles that makes more sense for the users actions, and matches the API's use in
our system.
Args:
results: The response from the http request
"""
title_exchange_dict = {
'import/url': 'upload/url',
'import/upload': 'upload/entry',
'export/url': 'download/url'}
operation = results['data']['operation']
results['data']['operation'] = title_exchange_dict[operation] if operation in title_exchange_dict.keys() \
else operation
def main() -> None:
try:
command = demisto.command()
params = demisto.params()
api_key = params.get('apikey')
verify = not params.get('insecure', False)
proxy = params.get('proxy', False)
headers = {
'Authorization': f'Bearer {api_key}'
}
client = Client(headers, verify, proxy)
if command == 'cloudconvert-upload':
return_results(upload_command(client, demisto.args()))
elif command == 'cloudconvert-convert':
return_results(convert_command(client, demisto.args()))
elif command == 'cloudconvert-check-status':
return_results(check_status_command(client, demisto.args()))
elif command == 'cloudconvert-download':
return_results(download_command(client, demisto.args()))
elif command == 'test-module':
return_results(test_module(client))
except Exception as e:
err_msg = 'Task id not found or expired' if 'No query results for model' in str(e) else \
('No more conversion minutes for today for this user' if 'Payment Required' in str(e) else str(e))
return_error(f'Failed to execute {command} command. Error: {err_msg}', error=traceback.format_exc())
if __name__ in ('__main__', '__builtin__', 'builtins'):
main()
|
[
"demistomock.args",
"demistomock.command",
"demistomock.params",
"demistomock.debug",
"urllib3.disable_warnings"
] |
[((137, 163), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (161, 163), False, 'import urllib3\n'), ((17114, 17131), 'demistomock.command', 'demisto.command', ([], {}), '()\n', (17129, 17131), True, 'import demistomock as demisto\n'), ((17149, 17165), 'demistomock.params', 'demisto.params', ([], {}), '()\n', (17163, 17165), True, 'import demistomock as demisto\n'), ((7670, 7733), 'demistomock.debug', 'demisto.debug', (['"""getting the path of the file from its entry id"""'], {}), "('getting the path of the file from its entry id')\n", (7683, 7733), True, 'import demistomock as demisto\n'), ((17522, 17536), 'demistomock.args', 'demisto.args', ([], {}), '()\n', (17534, 17536), True, 'import demistomock as demisto\n'), ((17639, 17653), 'demistomock.args', 'demisto.args', ([], {}), '()\n', (17651, 17653), True, 'import demistomock as demisto\n'), ((17766, 17780), 'demistomock.args', 'demisto.args', ([], {}), '()\n', (17778, 17780), True, 'import demistomock as demisto\n'), ((17885, 17899), 'demistomock.args', 'demisto.args', ([], {}), '()\n', (17897, 17899), True, 'import demistomock as demisto\n')]
|
import tensorflow as tf
import numpy as np
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train, x_test = np.array(x_train/255.0,dtype="<f4"), np.array(x_test/255.0,dtype="<f4")
idx=np.argsort(y_train.flatten())
vdx=np.array([6000*i+j for i in range(10) for j in range(5400,6000)])
tdx=np.array([6000*i+j for i in range(10) for j in range(5400)])
x_val, y_val = x_train[idx[vdx]] , y_train[idx[vdx]]
x_train, y_train = x_train[idx[tdx]] , y_train[idx[tdx]]
idx=np.random.permutation(54000)
x_train, y_train = tf.convert_to_tensor(x_train[idx]) , tf.convert_to_tensor(y_train[idx])
idx=np.random.permutation(6000)
x_val, y_val = tf.convert_to_tensor(x_val[idx]) , tf.convert_to_tensor(y_val[idx])
x_test, y_test = tf.convert_to_tensor(x_test) , tf.convert_to_tensor(y_test)
|
[
"numpy.random.permutation",
"tensorflow.convert_to_tensor",
"numpy.array",
"tensorflow.keras.datasets.mnist.load_data"
] |
[((86, 121), 'tensorflow.keras.datasets.mnist.load_data', 'tf.keras.datasets.mnist.load_data', ([], {}), '()\n', (119, 121), True, 'import tensorflow as tf\n'), ((508, 536), 'numpy.random.permutation', 'np.random.permutation', (['(54000)'], {}), '(54000)\n', (529, 536), True, 'import numpy as np\n'), ((636, 663), 'numpy.random.permutation', 'np.random.permutation', (['(6000)'], {}), '(6000)\n', (657, 663), True, 'import numpy as np\n'), ((141, 179), 'numpy.array', 'np.array', (['(x_train / 255.0)'], {'dtype': '"""<f4"""'}), "(x_train / 255.0, dtype='<f4')\n", (149, 179), True, 'import numpy as np\n'), ((178, 215), 'numpy.array', 'np.array', (['(x_test / 255.0)'], {'dtype': '"""<f4"""'}), "(x_test / 255.0, dtype='<f4')\n", (186, 215), True, 'import numpy as np\n'), ((557, 591), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['x_train[idx]'], {}), '(x_train[idx])\n', (577, 591), True, 'import tensorflow as tf\n'), ((594, 628), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['y_train[idx]'], {}), '(y_train[idx])\n', (614, 628), True, 'import tensorflow as tf\n'), ((680, 712), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['x_val[idx]'], {}), '(x_val[idx])\n', (700, 712), True, 'import tensorflow as tf\n'), ((715, 747), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['y_val[idx]'], {}), '(y_val[idx])\n', (735, 747), True, 'import tensorflow as tf\n'), ((768, 796), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['x_test'], {}), '(x_test)\n', (788, 796), True, 'import tensorflow as tf\n'), ((799, 827), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['y_test'], {}), '(y_test)\n', (819, 827), True, 'import tensorflow as tf\n')]
|
# Copyright 2020 by <NAME>. All rights reserved.
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""Unit tests for PARTS of the parse_pdb_header module of Bio.PDB."""
import unittest
import re
import warnings
try:
import numpy # noqa F401
except ImportError:
from Bio import MissingPythonDependencyError
raise MissingPythonDependencyError("Install NumPy if you want to use Bio.PDB.")
from Bio.PDB.ic_rebuild import structure_rebuild_test, write_PDB
from Bio.PDB.PDBParser import PDBParser
from Bio.PDB.MMCIFParser import MMCIFParser
from io import StringIO
from Bio.PDB.SCADIO import write_SCAD
from Bio.PDB.PICIO import write_PIC
from Bio.File import as_handle
from Bio.PDB.Model import Model
from Bio.PDB.Residue import Residue
from Bio.PDB.internal_coords import IC_Residue
from Bio.PDB.PDBExceptions import PDBConstructionWarning
class Rebuild(unittest.TestCase):
"""Read PDB and mmCIF structures, convert to/from internal coordinates."""
PDB_parser = PDBParser(PERMISSIVE=True, QUIET=True)
CIF_parser = MMCIFParser(QUIET=True)
pdb_1LCD = PDB_parser.get_structure("1LCD", "PDB/1LCD.pdb")
pdb_2XHE = PDB_parser.get_structure("2XHE", "PDB/2XHE.pdb")
cif_3JQH = CIF_parser.get_structure("3JQH", "PDB/3JQH.cif")
cif_4CUP = CIF_parser.get_structure("4CUP", "PDB/4CUP.cif")
def test_rebuild_multichain_missing(self):
"""Convert multichain missing atom protein to internal coordinates and back."""
# 2XHE has regions of missing chain, last residue has only N
r = structure_rebuild_test(self.pdb_2XHE, False)
self.assertEqual(r["residues"], 787)
self.assertEqual(r["rCount"], 835)
self.assertEqual(r["rMatchCount"], 835)
self.assertEqual(r["aCount"], 6267)
self.assertEqual(r["disAtmCount"], 0)
self.assertEqual(r["aCoordMatchCount"], 6267)
self.assertEqual(len(r["chains"]), 2)
self.assertTrue(r["pass"])
def test_rebuild_disordered_atoms_residues(self):
"""Convert disordered protein to internal coordinates and back."""
# 3jqh has both disordered residues
# and disordered atoms in ordered residues
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always", PDBConstructionWarning)
r = structure_rebuild_test(self.cif_3JQH, False)
# print(r)
self.assertEqual(r["residues"], 26)
self.assertEqual(r["rCount"], 47)
self.assertEqual(r["rMatchCount"], 47)
self.assertEqual(r["aCount"], 217)
self.assertEqual(r["disAtmCount"], 50)
self.assertEqual(r["aCoordMatchCount"], 217)
self.assertEqual(len(r["chains"]), 1)
self.assertTrue(r["pass"])
def test_model_change_internal_coords(self):
"""Get model internal coords, modify psi and chi1 values and check."""
for mdl in self.pdb_1LCD:
if mdl.serial_num == 2:
break
mdl.atom_to_internal_coordinates()
# other tests show can build with arbitrary internal coords
# build here so changes below trigger more comlicated
# xAtoms_needs_update mask arrays
mdl.internal_to_atom_coordinates()
nvt = {}
nvc1 = {}
nvpsi = {}
tcount = 0
c1count = 0
psicount = 0
for r in mdl.get_residues():
ric = r.internal_coord
if ric:
# hedra change
tau = ric.get_angle("tau")
if ric.rprev != [] and tau is not None:
tcount += 1
nv = tau + 0.5
ric.set_angle("tau", nv)
nvt[str(r)] = nv
# sidechain dihedron change
chi1 = ric.get_angle("chi1")
if chi1 is not None:
c1count += 1
nv = chi1 + 90
if nv > 180.0:
nv -= 360.0
ric.set_angle("chi1", nv)
nvc1[str(r)] = nv
# backbone dihedron change
psi = ric.get_angle("psi")
if psi is not None:
psicount += 1
nv = psi - 90
if nv < -180.0:
nv += 360.0
ric.set_angle("psi", nv)
nvpsi[str(r)] = nv
mdl.internal_to_atom_coordinates()
sf = StringIO()
write_PDB(self.pdb_1LCD, sf)
sf.seek(0)
new_1LCD = self.PDB_parser.get_structure("1LCD", sf)
for mdl in new_1LCD:
if mdl.serial_num == 2:
break
mdl.atom_to_internal_coordinates()
ttcount = 0
c1tcount = 0
psitcount = 0
for r in mdl.get_residues():
ric = r.internal_coord
if ric:
tau = ric.get_angle("tau")
if ric.rprev != [] and tau is not None:
ttcount += 1
self.assertAlmostEqual(tau, nvt[str(r)], places=1)
chi1 = ric.get_angle("chi1")
if chi1 is not None:
c1tcount += 1
self.assertAlmostEqual(chi1, nvc1[str(r)], places=1)
psi = ric.get_angle("psi")
if psi is not None:
psitcount += 1
self.assertAlmostEqual(psi, nvpsi[str(r)], places=1)
self.assertEqual(tcount, ttcount)
self.assertEqual(c1count, c1tcount)
self.assertEqual(psicount, psitcount)
self.assertTrue(ttcount > 0)
self.assertTrue(c1count > 0)
self.assertTrue(psicount > 0)
def test_write_SCAD(self):
"""Check SCAD output plus MaxPeptideBond and Gly CB.
SCAD tests: scaling, transform mtx, extra bond created (allBonds)
"""
sf = StringIO()
write_SCAD(
self.cif_4CUP, sf, 10.0, pdbid="4cup", backboneOnly=True, includeCode=False
)
sf.seek(0)
next_one = False
with as_handle(sf, mode="r") as handle:
for aline in handle.readlines():
if "// (1856_S_CB, 1856_S_CA, 1856_S_C)" in aline:
m = re.search(r"\[\s+(\d+\.\d+)\,", aline)
if m:
# test correctly scaled atom bond length
self.assertAlmostEqual(float(m.group(1)), 15.30582, places=3)
else:
self.fail("scaled atom bond length not found")
elif '[ 1, "1857M",' in aline:
next_one = True
elif next_one:
next_one = False
# test last residue transform looks roughly correct
# some differences due to sorting issues on different python
# versions
target = [-12.413, -3.303, 35.771, 1.0]
ms = re.findall( # last column of each row
r"\s+(-?\d+\.\d+)\s+\]", aline
)
if ms:
for i in range(0, 3):
self.assertAlmostEqual(float(ms[i]), target[i], places=0)
else:
self.fail("transform not found")
sf.seek(0)
IC_Residue.gly_Cbeta = True
write_SCAD(
self.pdb_2XHE[0]["A"],
sf,
10.0,
pdbid="2xhe",
maxPeptideBond=100.0,
includeCode=False,
)
sf.seek(0)
allBondsPass = False
maxPeptideBondPass = False
glyCbetaFound = False
with as_handle(sf, mode="r") as handle:
for aline in handle.readlines():
# test extra bond created in TRP (allBonds is True)
if '"Cres", 0, 0, 1, 0, StdBond, "W", 24, "CD2CE3CZ3"' in aline:
allBondsPass = True
# test 509_K-561_E long bond created
if "509_K" in aline and "561_E" in aline:
maxPeptideBondPass = True
if "(21_G_CB, 21_G_CA, 21_G_C)" in aline:
glyCbetaFound = True
target = [15.33630, 110.17513, 15.13861]
ms = re.findall(r"\s+(-?\d+\.\d+)", aline)
if ms:
for i in range(0, 3):
self.assertAlmostEqual(float(ms[i]), target[i], places=0)
else:
self.fail("Cbeta internal coords not found")
self.assertTrue(allBondsPass)
self.assertTrue(glyCbetaFound)
self.assertTrue(maxPeptideBondPass)
if __name__ == "__main__":
runner = unittest.TextTestRunner(verbosity=2)
unittest.main(testRunner=runner)
|
[
"unittest.main",
"Bio.PDB.SCADIO.write_SCAD",
"io.StringIO",
"unittest.TextTestRunner",
"warnings.simplefilter",
"Bio.PDB.MMCIFParser.MMCIFParser",
"Bio.MissingPythonDependencyError",
"Bio.File.as_handle",
"re.findall",
"warnings.catch_warnings",
"re.search",
"Bio.PDB.ic_rebuild.structure_rebuild_test",
"Bio.PDB.PDBParser.PDBParser",
"Bio.PDB.ic_rebuild.write_PDB"
] |
[((1176, 1214), 'Bio.PDB.PDBParser.PDBParser', 'PDBParser', ([], {'PERMISSIVE': '(True)', 'QUIET': '(True)'}), '(PERMISSIVE=True, QUIET=True)\n', (1185, 1214), False, 'from Bio.PDB.PDBParser import PDBParser\n'), ((1232, 1255), 'Bio.PDB.MMCIFParser.MMCIFParser', 'MMCIFParser', ([], {'QUIET': '(True)'}), '(QUIET=True)\n', (1243, 1255), False, 'from Bio.PDB.MMCIFParser import MMCIFParser\n'), ((8951, 8987), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (8974, 8987), False, 'import unittest\n'), ((8992, 9024), 'unittest.main', 'unittest.main', ([], {'testRunner': 'runner'}), '(testRunner=runner)\n', (9005, 9024), False, 'import unittest\n'), ((517, 590), 'Bio.MissingPythonDependencyError', 'MissingPythonDependencyError', (['"""Install NumPy if you want to use Bio.PDB."""'], {}), "('Install NumPy if you want to use Bio.PDB.')\n", (545, 590), False, 'from Bio import MissingPythonDependencyError\n'), ((1729, 1773), 'Bio.PDB.ic_rebuild.structure_rebuild_test', 'structure_rebuild_test', (['self.pdb_2XHE', '(False)'], {}), '(self.pdb_2XHE, False)\n', (1751, 1773), False, 'from Bio.PDB.ic_rebuild import structure_rebuild_test, write_PDB\n'), ((4636, 4646), 'io.StringIO', 'StringIO', ([], {}), '()\n', (4644, 4646), False, 'from io import StringIO\n'), ((4655, 4683), 'Bio.PDB.ic_rebuild.write_PDB', 'write_PDB', (['self.pdb_1LCD', 'sf'], {}), '(self.pdb_1LCD, sf)\n', (4664, 4683), False, 'from Bio.PDB.ic_rebuild import structure_rebuild_test, write_PDB\n'), ((6065, 6075), 'io.StringIO', 'StringIO', ([], {}), '()\n', (6073, 6075), False, 'from io import StringIO\n'), ((6084, 6175), 'Bio.PDB.SCADIO.write_SCAD', 'write_SCAD', (['self.cif_4CUP', 'sf', '(10.0)'], {'pdbid': '"""4cup"""', 'backboneOnly': '(True)', 'includeCode': '(False)'}), "(self.cif_4CUP, sf, 10.0, pdbid='4cup', backboneOnly=True,\n includeCode=False)\n", (6094, 6175), False, 'from Bio.PDB.SCADIO import write_SCAD\n'), ((7576, 7679), 'Bio.PDB.SCADIO.write_SCAD', 'write_SCAD', (["self.pdb_2XHE[0]['A']", 'sf', '(10.0)'], {'pdbid': '"""2xhe"""', 'maxPeptideBond': '(100.0)', 'includeCode': '(False)'}), "(self.pdb_2XHE[0]['A'], sf, 10.0, pdbid='2xhe', maxPeptideBond=\n 100.0, includeCode=False)\n", (7586, 7679), False, 'from Bio.PDB.SCADIO import write_SCAD\n'), ((2373, 2409), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (2396, 2409), False, 'import warnings\n'), ((2428, 2483), 'warnings.simplefilter', 'warnings.simplefilter', (['"""always"""', 'PDBConstructionWarning'], {}), "('always', PDBConstructionWarning)\n", (2449, 2483), False, 'import warnings\n'), ((2500, 2544), 'Bio.PDB.ic_rebuild.structure_rebuild_test', 'structure_rebuild_test', (['self.cif_3JQH', '(False)'], {}), '(self.cif_3JQH, False)\n', (2522, 2544), False, 'from Bio.PDB.ic_rebuild import structure_rebuild_test, write_PDB\n'), ((6251, 6274), 'Bio.File.as_handle', 'as_handle', (['sf'], {'mode': '"""r"""'}), "(sf, mode='r')\n", (6260, 6274), False, 'from Bio.File import as_handle\n'), ((7884, 7907), 'Bio.File.as_handle', 'as_handle', (['sf'], {'mode': '"""r"""'}), "(sf, mode='r')\n", (7893, 7907), False, 'from Bio.File import as_handle\n'), ((6422, 6465), 're.search', 're.search', (['"""\\\\[\\\\s+(\\\\d+\\\\.\\\\d+)\\\\,"""', 'aline'], {}), "('\\\\[\\\\s+(\\\\d+\\\\.\\\\d+)\\\\,', aline)\n", (6431, 6465), False, 'import re\n'), ((8495, 8535), 're.findall', 're.findall', (['"""\\\\s+(-?\\\\d+\\\\.\\\\d+)"""', 'aline'], {}), "('\\\\s+(-?\\\\d+\\\\.\\\\d+)', aline)\n", (8505, 8535), False, 'import re\n'), ((7155, 7202), 're.findall', 're.findall', (['"""\\\\s+(-?\\\\d+\\\\.\\\\d+)\\\\s+\\\\]"""', 'aline'], {}), "('\\\\s+(-?\\\\d+\\\\.\\\\d+)\\\\s+\\\\]', aline)\n", (7165, 7202), False, 'import re\n')]
|
import numpy as np
import mido
from mido import Message, MidiFile, MidiTrack
import argparse
from functools import partial
def main():
#Get options from input
parser = argparse.ArgumentParser(description='Superpermutation to midi converter')
parser.add_argument('inputfile',
help='The file containing the superpermutation to convert.')
parser.add_argument('outputfile', nargs='?', default='inputfile',
help='The file to store the midi output in.')
parser.add_argument('-s', '--scale', nargs='?', default="default",
help='Scale to translate the numbers into. Possible scales:\
major, natural-minor, harmonic-minor, whole-note')
parser.add_argument('-p', '--play', action='store_true',
help='Play back the midifile when running the script(requires python-rtmidi)')
parser.add_argument('-I', '--instrument', default=46,
help='General MIDI instrument number from 0 to 127. Default: 46 (harp)')
parser.add_argument('-l', '--note_length', default='edge-weight',
help='The method to decide note lengths.\
Possible values are: edge-weight, free-space, even')
args = parser.parse_args()
input_string = open(args.inputfile, 'r').read().strip()
superpermutation = np.array(list(input_string), dtype=int)
#Make sure it is zero indexed
superpermutation -= superpermutation.min()
N = superpermutation.max() + 1
note_lengths = np.zeros_like(superpermutation)
scale = args.scale
if args.scale == "default":
if N == 7:
scale = "major"
elif N == 6:
scale = "whole-note"
elif N == 5:
scale = "major-pentatonic"
scaleFunction = {
"major" : partial(numberToScale, scale=Scales.major),
"natural-minor" : partial(numberToScale, scale=Scales.natural_minor),
"harmonic-minor" : partial(numberToScale, scale=Scales.harmonic_minor),
"whole-note" : partial(numberToScale, scale=Scales.whole_note),
"major-pentatonic": partial(numberToScale, scale=Scales.major_pentatonic),
"miyako-bushi" : partial(numberToScale, scale=Scales.miyako_bushi)
}.get(scale, "major")
if args.note_length == 'free-space':
for i, number in enumerate(superpermutation):
num_perms = 0
# Length based on how far it is to the same value on both sides
for j in range(1, N):
if i-j < 0 or superpermutation[i-j] == number:
break
num_perms += 1
for j in range(1, N):
if i+j >= superpermutation.size or superpermutation[i+j] == number:
break
num_perms += 1
note_lengths[i] = num_perms - N + 1
elif args.note_length == 'edge-weight':
for i, number in enumerate(superpermutation):
weight = 0
for j in range(i+1, i+N+1):
if j >= N and j < superpermutation.size:
if isLegalPermutation(superpermutation[j-N:j]):
break;
weight += 1
note_lengths[i] = N - weight - 1
else:
note_lengths[:] = N - 1
# Fix the end values
note_lengths[0:N-1] = N - 1
mid = MidiFile()
track = MidiTrack()
mid.tracks.append(track)
track.append(Message('program_change', program=args.instrument, time=0))
for i in range(superpermutation.size):
note = scaleFunction(superpermutation[i])
track.append(Message('note_on', note=note, time=0))
track.append(Message('note_off', note=note, time=2**(note_lengths[i] + 10 - N)))
if args.outputfile == "inputfile":
mid.save(args.inputfile.split('.')[0] + ".mid")
else:
mid.save(args.outputfile)
if args.play:
port = mido.open_output()
for msg in mid.play():
port.send(msg)
def isLegalPermutation(array):
if np.unique(array).size == array.size:
return True
else:
return False
def numberToScale(number, scale, base_note=64):
octave = number // scale.__len__()
note = number % scale.__len__()
return base_note + octave*12 + scale.get(note, 0)
class Scales:
whole_note = {number: 2*number for number in range(7)}
major = {
0: 0,
1: 2,
2: 4,
3: 5,
4: 7,
5: 9,
6: 11
}
natural_minor = {
0: 0,
1: 2,
2: 3,
3: 5,
4: 7,
5: 8,
6: 10
}
harmonic_minor = {
0: 0,
1: 2,
2: 3,
3: 5,
4: 7,
5: 8,
6: 11
}
major_pentatonic = {
0: 0,
1: 2,
2: 4,
3: 7,
4: 9
}
miyako_bushi = {
0: 0,
1: 1,
2: 5,
3: 7,
4: 8
}
if __name__ == "__main__":
main()
|
[
"functools.partial",
"numpy.zeros_like",
"argparse.ArgumentParser",
"mido.MidiFile",
"mido.Message",
"mido.MidiTrack",
"mido.open_output",
"numpy.unique"
] |
[((178, 251), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Superpermutation to midi converter"""'}), "(description='Superpermutation to midi converter')\n", (201, 251), False, 'import argparse\n'), ((1550, 1581), 'numpy.zeros_like', 'np.zeros_like', (['superpermutation'], {}), '(superpermutation)\n', (1563, 1581), True, 'import numpy as np\n'), ((3400, 3410), 'mido.MidiFile', 'MidiFile', ([], {}), '()\n', (3408, 3410), False, 'from mido import Message, MidiFile, MidiTrack\n'), ((3423, 3434), 'mido.MidiTrack', 'MidiTrack', ([], {}), '()\n', (3432, 3434), False, 'from mido import Message, MidiFile, MidiTrack\n'), ((3482, 3540), 'mido.Message', 'Message', (['"""program_change"""'], {'program': 'args.instrument', 'time': '(0)'}), "('program_change', program=args.instrument, time=0)\n", (3489, 3540), False, 'from mido import Message, MidiFile, MidiTrack\n'), ((3960, 3978), 'mido.open_output', 'mido.open_output', ([], {}), '()\n', (3976, 3978), False, 'import mido\n'), ((3658, 3695), 'mido.Message', 'Message', (['"""note_on"""'], {'note': 'note', 'time': '(0)'}), "('note_on', note=note, time=0)\n", (3665, 3695), False, 'from mido import Message, MidiFile, MidiTrack\n'), ((3718, 3786), 'mido.Message', 'Message', (['"""note_off"""'], {'note': 'note', 'time': '(2 ** (note_lengths[i] + 10 - N))'}), "('note_off', note=note, time=2 ** (note_lengths[i] + 10 - N))\n", (3725, 3786), False, 'from mido import Message, MidiFile, MidiTrack\n'), ((4076, 4092), 'numpy.unique', 'np.unique', (['array'], {}), '(array)\n', (4085, 4092), True, 'import numpy as np\n'), ((1852, 1894), 'functools.partial', 'partial', (['numberToScale'], {'scale': 'Scales.major'}), '(numberToScale, scale=Scales.major)\n', (1859, 1894), False, 'from functools import partial\n'), ((1924, 1974), 'functools.partial', 'partial', (['numberToScale'], {'scale': 'Scales.natural_minor'}), '(numberToScale, scale=Scales.natural_minor)\n', (1931, 1974), False, 'from functools import partial\n'), ((2004, 2055), 'functools.partial', 'partial', (['numberToScale'], {'scale': 'Scales.harmonic_minor'}), '(numberToScale, scale=Scales.harmonic_minor)\n', (2011, 2055), False, 'from functools import partial\n'), ((2085, 2132), 'functools.partial', 'partial', (['numberToScale'], {'scale': 'Scales.whole_note'}), '(numberToScale, scale=Scales.whole_note)\n', (2092, 2132), False, 'from functools import partial\n'), ((2162, 2215), 'functools.partial', 'partial', (['numberToScale'], {'scale': 'Scales.major_pentatonic'}), '(numberToScale, scale=Scales.major_pentatonic)\n', (2169, 2215), False, 'from functools import partial\n'), ((2245, 2294), 'functools.partial', 'partial', (['numberToScale'], {'scale': 'Scales.miyako_bushi'}), '(numberToScale, scale=Scales.miyako_bushi)\n', (2252, 2294), False, 'from functools import partial\n')]
|
import logging
import time
import os
import re
from functools import lru_cache
import torch
from flask import Flask, request, jsonify
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
import src.data.config as cfg
import src.interactive.functions as interactive
sentry_sdk.init(dsn=os.getenv("SENTRY_DSN"), integrations=[FlaskIntegration()])
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO)
logger = logging.getLogger(__name__)
device = os.environ.get("DEVICE", "cpu")
graph = os.environ.get("GRAPH", "atomic")
logger.info(f"comet is set to run on {device} with {graph} graph")
model_file = f"pretrained_models/{graph}_pretrained_model.pickle"
# decoding algorithm should be one of:
# beam-N, e.g., beam-5
# topk-K, e.g., topk-5, topk-1 == greedy
# otherwise -- greedy decoding
decoding_algorithm = os.environ.get("DECODING_ALGO", "greedy")
logger.info(f"comet decoding algo: {decoding_algorithm}")
default_category = "all"
logger.info("comet model is preparing...")
opt, state_dict = interactive.load_model_file(model_file)
data_loader, text_encoder = interactive.load_data(graph, opt)
if graph == "atomic":
n_ctx = data_loader.max_event + data_loader.max_effect
elif graph == "conceptnet":
n_ctx = data_loader.max_e1 + data_loader.max_e2 + data_loader.max_r
else:
raise RuntimeError('Graph {graph} is not in ["atomic", "conceptnet"]')
n_vocab = len(text_encoder.encoder) + n_ctx
model = interactive.make_model(opt, n_vocab, n_ctx, state_dict)
if device != "cpu":
cfg.device = int(device.split("_")[-1])
cfg.do_gpu = True
torch.cuda.set_device(cfg.device)
model.cuda(cfg.device)
else:
cfg.device = "cpu"
sampler = interactive.set_sampler(opt, decoding_algorithm, data_loader)
@lru_cache(maxsize=2 ** 16)
def get_comet_atomic_output(input_event, category):
return interactive.get_atomic_sequence(input_event, model, sampler, data_loader, text_encoder, category)
@lru_cache(maxsize=2 ** 16)
def get_comet_conceptnet_output(input_event, category):
return interactive.get_conceptnet_sequence(input_event, model, sampler, data_loader, text_encoder, category)
logger.info(f"comet model for {graph} is ready")
other_symbols_compiled = re.compile(r"[^a-zA-Z0-9\- ]")
none_compiled = re.compile(r"\bnone\b", re.IGNORECASE)
def cleanup(text):
cleaned = re.sub(other_symbols_compiled, "", text)
cleaned = re.sub(none_compiled, "", cleaned)
return cleaned.strip()
app = Flask(__name__)
@app.route("/comet", methods=["POST"])
def respond():
"""
Runs graph predictions with COMeT, supports ATOMIC and ConceptNet
ATOMIC graph:
sample request:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"input": "PersonX went to a mall", "category": "xWant"}' \
http://0.0.0.0:8053/comet
sample response:
{
"xWant": {
"beams": [
"to buy something",
"to go home",
"to buy things",
"to shop",
"to go to the store"
],
"effect_type": "xWant",
"event": "PersonX went to a mall"
}
}
ConceptNet graph:
works best if words are lemmatized
sample request:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"input": "go on a hike", "category": "MotivatedByGoal"}' \
http://0.0.0.0:8065/comet
sample response:
{
"MotivatedByGoal": {
"beams": [
"exercise",
"it be fun",
"you like hike",
"you enjoy hike",
"explore"
],
"relation": "MotivatedByGoal",
"e1": "go on a hike"
}
}
if `category` is not set then `all` is used.
"""
st_time = time.time()
input_event = request.json["input"]
category = request.json.get("category", default_category)
if isinstance(category, list):
category = tuple(category)
if graph == "atomic":
output = get_comet_atomic_output(input_event, category)
elif graph == "conceptnet":
output = get_comet_conceptnet_output(input_event, category)
else:
raise RuntimeError('Graph {graph} is not in ["atomic", "conceptnet"]')
for rel in output:
output[rel]["beams"] = [cleanup(b) for b in output[rel].get("beams", []) if len(cleanup(b)) > 0]
logger.info(output)
total_time = time.time() - st_time
logger.info(f"comet exec time: {total_time:.3f}s")
return jsonify(output)
def atomic_annotator():
raise NotImplementedError
def conceptnet_annotator(request, category=("SymbolOf", "HasProperty", "Causes", "CausesDesire")):
batch = []
for nounphrases in request["nounphrases"]:
result = {}
for np in nounphrases:
cn_result = get_comet_conceptnet_output(np, category=category)
np_conceptnet_rels = {}
for rel in cn_result:
np_conceptnet_rels[rel] = [cleanup(b) for b in cn_result[rel].get("beams", []) if len(cleanup(b)) > 0]
result[np] = np_conceptnet_rels
batch += [result]
return batch
if graph == "atomic":
annotator_fn = atomic_annotator
elif graph == "conceptnet":
annotator_fn = conceptnet_annotator
else:
raise RuntimeError('Graph {graph} is not in ["atomic", "conceptnet"]')
@app.route("/comet_annotator", methods=["POST"])
def annotator_respond():
st_time = time.time()
output = annotator_fn(request.json)
logger.info(output)
total_time = time.time() - st_time
logger.info(f"comet_{graph}_annotator exec time: {total_time:.3f}s")
return jsonify(output)
if __name__ == "__main__":
app.run(debug=False, host="0.0.0.0", port=3000)
|
[
"src.interactive.functions.set_sampler",
"sentry_sdk.integrations.flask.FlaskIntegration",
"src.interactive.functions.get_conceptnet_sequence",
"flask.jsonify",
"torch.cuda.set_device",
"re.sub",
"flask.request.json.get",
"src.interactive.functions.load_data",
"os.getenv",
"re.compile",
"logging.basicConfig",
"flask.Flask",
"src.interactive.functions.load_model_file",
"time.time",
"os.environ.get",
"src.interactive.functions.get_atomic_sequence",
"src.interactive.functions.make_model",
"functools.lru_cache",
"logging.getLogger"
] |
[((374, 481), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)\n", (393, 481), False, 'import logging\n'), ((486, 513), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (503, 513), False, 'import logging\n'), ((524, 555), 'os.environ.get', 'os.environ.get', (['"""DEVICE"""', '"""cpu"""'], {}), "('DEVICE', 'cpu')\n", (538, 555), False, 'import os\n'), ((564, 597), 'os.environ.get', 'os.environ.get', (['"""GRAPH"""', '"""atomic"""'], {}), "('GRAPH', 'atomic')\n", (578, 597), False, 'import os\n'), ((889, 930), 'os.environ.get', 'os.environ.get', (['"""DECODING_ALGO"""', '"""greedy"""'], {}), "('DECODING_ALGO', 'greedy')\n", (903, 930), False, 'import os\n'), ((1076, 1115), 'src.interactive.functions.load_model_file', 'interactive.load_model_file', (['model_file'], {}), '(model_file)\n', (1103, 1115), True, 'import src.interactive.functions as interactive\n'), ((1144, 1177), 'src.interactive.functions.load_data', 'interactive.load_data', (['graph', 'opt'], {}), '(graph, opt)\n', (1165, 1177), True, 'import src.interactive.functions as interactive\n'), ((1494, 1549), 'src.interactive.functions.make_model', 'interactive.make_model', (['opt', 'n_vocab', 'n_ctx', 'state_dict'], {}), '(opt, n_vocab, n_ctx, state_dict)\n', (1516, 1549), True, 'import src.interactive.functions as interactive\n'), ((1742, 1803), 'src.interactive.functions.set_sampler', 'interactive.set_sampler', (['opt', 'decoding_algorithm', 'data_loader'], {}), '(opt, decoding_algorithm, data_loader)\n', (1765, 1803), True, 'import src.interactive.functions as interactive\n'), ((1807, 1833), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(2 ** 16)'}), '(maxsize=2 ** 16)\n', (1816, 1833), False, 'from functools import lru_cache\n'), ((1998, 2024), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(2 ** 16)'}), '(maxsize=2 ** 16)\n', (2007, 2024), False, 'from functools import lru_cache\n'), ((2272, 2302), 're.compile', 're.compile', (['"""[^a-zA-Z0-9\\\\- ]"""'], {}), "('[^a-zA-Z0-9\\\\- ]')\n", (2282, 2302), False, 'import re\n'), ((2319, 2358), 're.compile', 're.compile', (['"""\\\\bnone\\\\b"""', 're.IGNORECASE'], {}), "('\\\\bnone\\\\b', re.IGNORECASE)\n", (2329, 2358), False, 'import re\n'), ((2518, 2533), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (2523, 2533), False, 'from flask import Flask, request, jsonify\n'), ((1641, 1674), 'torch.cuda.set_device', 'torch.cuda.set_device', (['cfg.device'], {}), '(cfg.device)\n', (1662, 1674), False, 'import torch\n'), ((1897, 1998), 'src.interactive.functions.get_atomic_sequence', 'interactive.get_atomic_sequence', (['input_event', 'model', 'sampler', 'data_loader', 'text_encoder', 'category'], {}), '(input_event, model, sampler, data_loader,\n text_encoder, category)\n', (1928, 1998), True, 'import src.interactive.functions as interactive\n'), ((2092, 2197), 'src.interactive.functions.get_conceptnet_sequence', 'interactive.get_conceptnet_sequence', (['input_event', 'model', 'sampler', 'data_loader', 'text_encoder', 'category'], {}), '(input_event, model, sampler,\n data_loader, text_encoder, category)\n', (2127, 2197), True, 'import src.interactive.functions as interactive\n'), ((2393, 2433), 're.sub', 're.sub', (['other_symbols_compiled', '""""""', 'text'], {}), "(other_symbols_compiled, '', text)\n", (2399, 2433), False, 'import re\n'), ((2448, 2482), 're.sub', 're.sub', (['none_compiled', '""""""', 'cleaned'], {}), "(none_compiled, '', cleaned)\n", (2454, 2482), False, 'import re\n'), ((4039, 4050), 'time.time', 'time.time', ([], {}), '()\n', (4048, 4050), False, 'import time\n'), ((4106, 4152), 'flask.request.json.get', 'request.json.get', (['"""category"""', 'default_category'], {}), "('category', default_category)\n", (4122, 4152), False, 'from flask import Flask, request, jsonify\n'), ((4763, 4778), 'flask.jsonify', 'jsonify', (['output'], {}), '(output)\n', (4770, 4778), False, 'from flask import Flask, request, jsonify\n'), ((5699, 5710), 'time.time', 'time.time', ([], {}), '()\n', (5708, 5710), False, 'import time\n'), ((5898, 5913), 'flask.jsonify', 'jsonify', (['output'], {}), '(output)\n', (5905, 5913), False, 'from flask import Flask, request, jsonify\n'), ((312, 335), 'os.getenv', 'os.getenv', (['"""SENTRY_DSN"""'], {}), "('SENTRY_DSN')\n", (321, 335), False, 'import os\n'), ((4675, 4686), 'time.time', 'time.time', ([], {}), '()\n', (4684, 4686), False, 'import time\n'), ((5792, 5803), 'time.time', 'time.time', ([], {}), '()\n', (5801, 5803), False, 'import time\n'), ((351, 369), 'sentry_sdk.integrations.flask.FlaskIntegration', 'FlaskIntegration', ([], {}), '()\n', (367, 369), False, 'from sentry_sdk.integrations.flask import FlaskIntegration\n')]
|
#!/usr/bin/env python
from __future__ import (print_function, unicode_literals, division,
absolute_import)
"""
Simple script to create a bunch of AppInstances with similar names. This
has been replaced by DBMP, but the script can still be useful for one-off
creations.
Usage:
$ ./make_ais.py --prefix my-vol --number 10
$ ./make_ais.py --prefix test \
--size 5 \
--number 200 \
--threads 20 \
--replica_count 2
"""
import sys
import threading
try:
from Queue import Queue
except ImportError:
from queue import Queue
from dfs_sdk import scaffold
def _worker(api, queue):
while not queue.empty():
name, size, replica_count = queue.get()
print("Creating AppInstance:", name)
ai = api.app_instances.create(name=name)
si = ai.storage_instances.create(name="storage-1")
si.volumes.create(name="volume-1", size=size,
replica_count=replica_count)
queue.task_done()
def main(args):
api = scaffold.get_api()
# Populate Queue
ai_names = Queue()
for i in range(args.number):
name = "-".join((args.prefix, str(i)))
ai_names.put((name, args.size, args.replica_count))
for _ in range(args.threads):
thread = threading.Thread(target=_worker,
args=(api, ai_names))
thread.daemon = True
thread.start()
ai_names.join()
if __name__ == "__main__":
parser = scaffold.get_argparser()
parser.add_argument("-n", "--number", default=5, type=int,
help="Number of AppInstances")
parser.add_argument("-s", "--size", default=1, type=int,
help="Size of AppInstances")
parser.add_argument("-p", "--prefix", default="my-app",
help="Prefix each AppInstance should use")
parser.add_argument("-r", "--replica-count", default=3, type=int,
help="Number of replicas for volumes, default: 3")
parser.add_argument("-m", "--threads", default=5, type=int,
help="Threads to use for deletion")
args = parser.parse_args()
main(args)
sys.exit(0)
|
[
"threading.Thread",
"dfs_sdk.scaffold.get_api",
"dfs_sdk.scaffold.get_argparser",
"queue.Queue",
"sys.exit"
] |
[((1048, 1066), 'dfs_sdk.scaffold.get_api', 'scaffold.get_api', ([], {}), '()\n', (1064, 1066), False, 'from dfs_sdk import scaffold\n'), ((1104, 1111), 'queue.Queue', 'Queue', ([], {}), '()\n', (1109, 1111), False, 'from queue import Queue\n'), ((1508, 1532), 'dfs_sdk.scaffold.get_argparser', 'scaffold.get_argparser', ([], {}), '()\n', (1530, 1532), False, 'from dfs_sdk import scaffold\n'), ((2212, 2223), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (2220, 2223), False, 'import sys\n'), ((1304, 1358), 'threading.Thread', 'threading.Thread', ([], {'target': '_worker', 'args': '(api, ai_names)'}), '(target=_worker, args=(api, ai_names))\n', (1320, 1358), False, 'import threading\n')]
|
import discord
from random import shuffle
from dotenv import dotenv_values
TOKEN = dotenv_values(".env")["TOKEN"]
class Client(discord.Client):
async def on_ready(self):
members = [x for x in self.guilds[0].members if not x.bot]
shuffle(members)
savelist(members)
msg = ("@everyone The election has begun, please send a DM to vote (`!vote <ID>`). "
"Voting ends in 24 hours.\nThe candidate IDs are:\n")
for i, member in enumerate(members):
try:
msg += f"{i + 1}. {member.name}\n"
await member.remove_roles(self.guilds[0].get_role(810326558727602258))
dm = await member.create_dm()
await dm.send(
"Use `!vote <id>` to vote. (Only the latest message will be counted.)")
except Exception as e:
print(e)
await self.guilds[0].text_channels[0].send(msg)
await self.close()
def savelist(members):
with open("./members.txt", "w+") as f:
for member in members:
f.write(str(member.id)+"\n")
intents = discord.Intents.default()
intents.members = True
client = Client(intents=intents)
client.run(TOKEN)
|
[
"random.shuffle",
"dotenv.dotenv_values",
"discord.Intents.default"
] |
[((1121, 1146), 'discord.Intents.default', 'discord.Intents.default', ([], {}), '()\n', (1144, 1146), False, 'import discord\n'), ((84, 105), 'dotenv.dotenv_values', 'dotenv_values', (['""".env"""'], {}), "('.env')\n", (97, 105), False, 'from dotenv import dotenv_values\n'), ((252, 268), 'random.shuffle', 'shuffle', (['members'], {}), '(members)\n', (259, 268), False, 'from random import shuffle\n')]
|
from flask import Flask, request, render_template
from intelli.Sentiment_Analyzer import Sentiment_Analyzer
from dotenv import load_dotenv
import os
load_dotenv()
PORT = os.getenv("PORT")
app = Flask(__name__, template_folder='templates')
@app.route('/', methods=['GET'])
def home():
return render_template('home.html')
@app.route('/processSurvey', methods=['POST'])
def process_survey():
sentimentAnalizer = Sentiment_Analyzer(request.form['openEndedQuestion'])
data = sentimentAnalizer.get_sentiment()
data['normalQuestions'].append({
'firstQuestion': request.form['firstQuestion'],
'secondQuestion': request.form['secondQuestion'],
'thirdQuestion': request.form['thirdQuestion']
})
return render_template('score.html', data = data)
if __name__ == '__main__':
app.debug = True
app.run(port=PORT)
|
[
"flask.Flask",
"intelli.Sentiment_Analyzer.Sentiment_Analyzer",
"dotenv.load_dotenv",
"flask.render_template",
"os.getenv"
] |
[((150, 163), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (161, 163), False, 'from dotenv import load_dotenv\n'), ((171, 188), 'os.getenv', 'os.getenv', (['"""PORT"""'], {}), "('PORT')\n", (180, 188), False, 'import os\n'), ((195, 239), 'flask.Flask', 'Flask', (['__name__'], {'template_folder': '"""templates"""'}), "(__name__, template_folder='templates')\n", (200, 239), False, 'from flask import Flask, request, render_template\n'), ((297, 325), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (312, 325), False, 'from flask import Flask, request, render_template\n'), ((420, 473), 'intelli.Sentiment_Analyzer.Sentiment_Analyzer', 'Sentiment_Analyzer', (["request.form['openEndedQuestion']"], {}), "(request.form['openEndedQuestion'])\n", (438, 473), False, 'from intelli.Sentiment_Analyzer import Sentiment_Analyzer\n'), ((744, 784), 'flask.render_template', 'render_template', (['"""score.html"""'], {'data': 'data'}), "('score.html', data=data)\n", (759, 784), False, 'from flask import Flask, request, render_template\n')]
|
import itertools
from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk
from tkinter.ttk import Frame, Notebook, Combobox, Entry
from tkinter import filedialog
from tkinter import messagebox
import os.path as osp
import webbrowser
from . import picketfence, vmat, ct, log_analyzer, starshot, planar_imaging, __version__, winston_lutz, utilities
class PylinacGUI(Frame):
def __init__(self, master=None):
super().__init__(master)
self.pack()
self.notebook = Notebook(self)
self.init_pf()
self.init_vmat()
self.init_catphan()
self.init_logs()
# self.init_tg51()
self.init_star()
self.init_planar_imaging()
self.init_winstonlutz()
self.init_help()
for child in self.winfo_children():
child.grid_configure(padx=10, pady=10)
def init_help(self):
def upload():
webbrowser.open('https://www.dropbox.com/request/YKRu4AmuPsXu55uQq761')
def gotoforum():
webbrowser.open('https://groups.google.com/forum/#!forum/pylinac')
def gotogithub():
webbrowser.open('https://github.com/jrkerns/pylinac')
def gotortd():
webbrowser.open('https://pylinac.readthedocs.io/en/latest/')
self.help_tab = Frame(self.notebook)
Label(self.help_tab, text='Having trouble?\nWant to donate your images for program improvement?\nUpload them below')
Button(self.help_tab, text='Upload Files', command=upload)
Label(self.help_tab, text='Complete documentation is available on ReadTheDocs')
Button(self.help_tab, text='ReadTheDocs', command=gotortd)
Label(self.help_tab, text='Help is also available in the Pylinac forum')
Button(self.help_tab, text='Go to forum', command=gotoforum)
Label(self.help_tab, text='The source code of this program and all analyses is available on Github')
Button(self.help_tab, text='Github', command=gotogithub)
self.notebook.add(self.help_tab, text='Help/Upload Images')
for child in self.help_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def init_vmat(self):
def load_open():
f = filedialog.askopenfilename()
self.vmat_openimg.set(f)
def load_dmlc():
f = filedialog.askopenfilename()
self.vmat_dmlcimg.set(f)
def analyze_vmat():
images = (self.vmat_openimg.get(), self.vmat_dmlcimg.get())
if self.vmat_test.get() == 'DRGS':
v = vmat.DRGS(image_paths=images)
else:
v = vmat.DRMLC(image_paths=images)
v.analyze(tolerance=self.vmat_tol.get())
fname = osp.join(self.vmat_dmlcimg.get().replace('.dcm', '.pdf'))
fname = utilities.file_exists(fname)
v.publish_pdf(fname)
self.vmat_pdf.set(fname)
utilities.open_path(fname)
self.vmat_tab = Frame(self.notebook)
self.vmat_openimg = StringVar()
self.vmat_dmlcimg = StringVar()
self.vmat_test = StringVar(value='DRGS')
self.vmat_tol = DoubleVar(value=1.5)
self.vmat_pdf = StringVar()
Button(self.vmat_tab, text='Load Open Image...', command=load_open).grid(column=1, row=1)
Button(self.vmat_tab, text='Load DMLC Image...', command=load_dmlc).grid(column=1, row=3)
Label(self.vmat_tab, textvariable=self.vmat_openimg).grid(column=1, row=2)
Label(self.vmat_tab, textvariable=self.vmat_dmlcimg).grid(column=1, row=4)
Label(self.vmat_tab, text='Test type:').grid(column=1, row=5)
Combobox(self.vmat_tab, values=('DRGS', 'DRMLC'), textvariable=self.vmat_test).grid(column=2, row=5)
Label(self.vmat_tab, text='Tolerance (%):').grid(column=1, row=6)
Entry(self.vmat_tab, width=7, textvariable=self.vmat_tol).grid(column=2, row=6)
Button(self.vmat_tab, text='Analyze', command=analyze_vmat).grid(column=1, row=8)
Label(self.vmat_tab,
text='Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it.').grid(
column=1, row=9)
Label(self.vmat_tab, text='Save file:').grid(column=1, row=10)
Label(self.vmat_tab, textvariable=self.vmat_pdf).grid(column=1, row=11)
self.notebook.add(self.vmat_tab, text='VMAT')
for child in self.vmat_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def init_pf(self):
def load_file():
f = filedialog.askopenfilename()
self.pf_file.set(f)
def analyze_pf():
mlc_type = self.pf_mlc.get()
if self.pf_filter.get():
pf = picketfence.PicketFence(self.pf_file.get(), mlc=mlc_type, filter=3)
else:
pf = picketfence.PicketFence(self.pf_file.get(), mlc=mlc_type)
atol = self.pf_atol.get() if self.pf_atol.get() == 0 else None
pickets = self.pf_pickets.get() if self.pf_pickets.get() == 0 else None
pf.analyze(tolerance=self.pf_tol.get(),
action_tolerance=atol,
num_pickets=pickets,
)
fname = osp.join(self.pf_file.get().replace('.dcm', '.pdf'))
fname = utilities.file_exists(fname)
pf.publish_pdf(fname)
self.pf_pdf.set(fname)
utilities.open_path(fname)
self.pf_tab = Frame(self.notebook)
self.pf_filter = BooleanVar(value=False)
self.pf_file = StringVar()
self.pf_tol = DoubleVar(value=0.5)
self.pf_atol = DoubleVar(value=0.25)
self.pf_pickets = IntVar(value=10)
self.pf_pdf = StringVar()
self.pf_mlc = StringVar()
mlc_list = []
for mlc in picketfence.MLC:
mlc_list.append(mlc.value.get('name'))
Checkbutton(self.pf_tab, text='Apply median filter', variable=self.pf_filter).grid(column=1, row=3)
Button(self.pf_tab, text='Load File...', command=load_file).grid(column=1, row=1)
Label(self.pf_tab, text='File:').grid(column=1, row=2)
Label(self.pf_tab, textvariable=self.pf_file).grid(column=2, row=2)
Label(self.pf_tab, text='Tolerance (mm):').grid(column=1, row=4)
Entry(self.pf_tab, width=7, textvariable=self.pf_tol).grid(column=2, row=4)
Label(self.pf_tab, text='Action Tolerance (mm):').grid(column=1, row=5)
Entry(self.pf_tab, width=7, textvariable=self.pf_atol).grid(column=2, row=5)
Label(self.pf_tab, text='Number of pickets:').grid(column=1, row=6)
Entry(self.pf_tab, width=7, textvariable=self.pf_pickets).grid(column=2, row=6)
Label(self.pf_tab, text='MLC type:').grid(column=1, row=7)
Combobox(self.pf_tab, values=mlc_list, textvariable=self.pf_mlc, state='readonly').grid(column=2, row=7)
Button(self.pf_tab, text='Analyze', command=analyze_pf).grid(column=1, row=8)
Label(self.pf_tab, text='Analysis will analyze the file according to the settings, \nsave a PDF in the same directory as the original file location and then open it.').grid(column=1, row=9)
self.notebook.add(self.pf_tab, text='Picket Fence')
for child in self.pf_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def init_catphan(self):
def load_dir():
f = filedialog.askdirectory()
self.ct_file.set(f)
def load_zip():
f = filedialog.askopenfilename()
self.ct_file.set(f)
def analyze_cbct():
if osp.isdir(self.ct_file.get()):
cat = getattr(ct, self.ct_catphantype.get())(self.ct_file.get())
fname = osp.join(self.ct_file.get(), 'CBCT Analysis.pdf')
else:
cat = getattr(ct, self.ct_catphantype.get()).from_zip(self.ct_file.get())
fname = self.ct_file.get().replace('.zip', '.pdf')
cat.analyze(hu_tolerance=self.ct_hu.get(), thickness_tolerance=self.ct_thickness.get(),
scaling_tolerance=self.ct_scaling.get())
fname = utilities.file_exists(fname)
cat.publish_pdf(fname)
self.ct_pdf.set(fname)
utilities.open_path(fname)
self.ct_tab = Frame(self.notebook)
self.ct_file = StringVar()
self.ct_catphantype = StringVar()
self.ct_hu = IntVar(value=40)
self.ct_scaling = DoubleVar(value=1)
self.ct_thickness = DoubleVar(value=0.2)
self.ct_pdf = StringVar()
Label(self.ct_tab, text='Load EITHER a directory or ZIP file').grid(column=2, row=1)
Button(self.ct_tab, text='Load Directory...', command=load_dir).grid(column=2, row=2)
Button(self.ct_tab, text='Load ZIP file...', command=load_zip).grid(column=2, row=3)
Label(self.ct_tab, textvariable=self.ct_file).grid(column=2, row=4)
Label(self.ct_tab, text='CatPhan type:').grid(column=2, row=5)
Combobox(self.ct_tab, values=('CatPhan504', 'CatPhan503', 'CatPhan600', 'CatPhan604'), textvariable=self.ct_catphantype).grid(column=2, row=6)
Label(self.ct_tab, text='HU Tolerance (HU):').grid(column=1, row=7)
Entry(self.ct_tab, width=7, textvariable=self.ct_hu).grid(column=1, row=8)
Label(self.ct_tab, text='Scaling tolerance (mm):').grid(column=2, row=7)
Entry(self.ct_tab, width=7, textvariable=self.ct_scaling).grid(column=2, row=8)
Label(self.ct_tab, text='Thickness tolerance (mm):').grid(column=3, row=7)
Entry(self.ct_tab, width=7, textvariable=self.ct_thickness).grid(column=3, row=8)
Button(self.ct_tab, text='Analyze', command=analyze_cbct).grid(column=2, row=9)
Label(self.ct_tab,
text='Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it.').grid(
column=2, row=10)
Label(self.ct_tab, text='Save file:').grid(column=2, row=11)
Label(self.ct_tab, textvariable=self.ct_pdf).grid(column=2, row=12)
self.notebook.add(self.ct_tab, text='CatPhan')
for child in self.ct_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def init_logs(self):
def load_log():
f = filedialog.askopenfilename()
self.log_file.set(f)
def analyze_log():
log = log_analyzer.load_log(self.log_file.get())
name, _ = osp.splitext(self.log_file.get())
fname = name + '.pdf'
fname = utilities.file_exists(fname)
log.publish_pdf(fname)
self.log_pdf.set(fname)
utilities.open_path(fname)
self.log_tab = Frame(self.notebook)
self.log_file = StringVar()
self.log_pdf = StringVar()
Button(self.log_tab, text='Load log file...', command=load_log).grid(column=1, row=1)
Label(self.log_tab, textvariable=self.log_file).grid(column=1, row=2)
Button(self.log_tab, text='Analyze', command=analyze_log).grid(column=1, row=9)
Label(self.log_tab,
text='Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it.').grid(
column=1, row=10)
Label(self.log_tab, text='Save file:').grid(column=1, row=11)
Label(self.log_tab, textvariable=self.log_pdf).grid(column=1, row=12)
self.notebook.add(self.log_tab, text='Machine Logs')
for child in self.log_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def init_star(self):
def load_star():
f = filedialog.askopenfilename()
self.star_file.set(f)
def load_multiple_star():
f = filedialog.askopenfilenames()
self.star_mfiles = f
self.star_file.set(f)
def load_zip_star():
f = filedialog.askopenfilename()
self.star_file.set(f)
def analyze_star():
if osp.isfile(self.star_file.get()):
name, ext = osp.splitext(self.star_file.get())
if ext == '.zip':
star = starshot.Starshot.from_zip(self.star_file.get(), sid=self.star_sid.get(), dpi=self.star_dpi.get())
else:
star = starshot.Starshot(self.star_file.get(), sid=self.star_sid.get(), dpi=self.star_dpi.get())
else:
star = starshot.Starshot.from_multiple_images(self.star_mfiles, sid=self.star_sid.get(), dpi=self.star_dpi.get())
name, ext = osp.splitext(self.star_mfiles[0])
star.analyze(radius=self.star_radius.get(), tolerance=self.star_tolerance.get(),
recursive=self.star_recursive.get())
fname = name + '.pdf'
fname = utilities.file_exists(fname)
star.publish_pdf(fname)
self.star_pdf.set(fname)
utilities.open_path(fname)
self.star_tab = Frame(self.notebook)
self.star_file = StringVar()
self.star_mfiles = []
self.star_pdf = StringVar()
self.star_dpi = DoubleVar()
self.star_sid = DoubleVar()
self.star_radius = DoubleVar(value=0.85)
self.star_tolerance = DoubleVar(value=1)
self.star_recursive = BooleanVar(value=True)
Label(self.star_tab, text='Load EITHER a single star shot file, multiple files or a zip file...').grid(column=2, row=1)
Button(self.star_tab, text='Load single file...', command=load_star).grid(column=1, row=2)
Button(self.star_tab, text='Load multiple files...', command=load_multiple_star).grid(column=2, row=2)
Button(self.star_tab, text='Load zipped files...', command=load_zip_star).grid(column=3, row=2)
Label(self.star_tab, textvariable=self.star_file, anchor='w', width=100).grid(column=1, row=3, columnspan=3, sticky='W')
Label(self.star_tab, text='DPI (if file is not DICOM):').grid(column=1, row=4)
Entry(self.star_tab, width=7, textvariable=self.star_dpi).grid(column=1, row=5)
Label(self.star_tab, text='SID (mm; if file is not DICOM):').grid(column=2, row=4)
Entry(self.star_tab, width=7, textvariable=self.star_sid).grid(column=2, row=5)
Label(self.star_tab, text='Normalized analysis radius (0.2-1.0):').grid(column=3, row=4)
Entry(self.star_tab, width=7, textvariable=self.star_radius).grid(column=3, row=5)
Checkbutton(self.star_tab, text='Recursive analysis?', variable=self.star_recursive).grid(column=1, row=6)
Label(self.star_tab, text='Tolerance (mm):').grid(column=3, row=6)
Entry(self.star_tab, width=7, textvariable=self.star_tolerance).grid(column=3, row=7)
Button(self.star_tab, text='Analyze', command=analyze_star).grid(column=2, row=9)
Label(self.star_tab,
text='Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it.').grid(
column=2, row=10)
Label(self.star_tab, text='Save file:').grid(column=1, row=11)
Label(self.star_tab, textvariable=self.star_pdf).grid(column=2, row=11)
self.notebook.add(self.star_tab, text='Starshot')
for child in self.star_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def init_planar_imaging(self):
def load_phan():
f = filedialog.askopenfilename()
self.phan_file.set(f)
def analyze_phan():
phantom = getattr(planar_imaging, self.phan_type.get())(self.phan_file.get())
phantom.analyze()
name, _ = osp.splitext(self.phan_file.get())
fname = name + '.pdf'
fname = utilities.file_exists(fname)
phantom.publish_pdf(utilities.file_exists(fname))
self.phan_pdf.set(fname)
utilities.open_path(fname)
self.phan_tab = Frame(self.notebook)
self.phan_file = StringVar()
self.phan_pdf = StringVar()
self.phan_locon = DoubleVar(value=0.1)
self.phan_hicon = DoubleVar(value=0.5)
self.phan_inver = BooleanVar(value=False)
self.phan_type = StringVar(value='LeedsTOR')
Button(self.phan_tab, text='Load planar phantom DICOM file...', command=load_phan).grid(column=1, row=1)
Label(self.phan_tab, textvariable=self.phan_file).grid(column=1, row=2)
Label(self.phan_tab, text='Phantom:').grid(column=1, row=3)
Combobox(self.phan_tab, values=('LeedsTOR', 'LasVegas', 'StandardImagingQC3'), textvariable=self.phan_type).grid(column=2, row=3)
Label(self.phan_tab, text='Low contrast threshold:').grid(column=1, row=4)
Entry(self.phan_tab, width=7, textvariable=self.phan_locon).grid(column=2, row=4)
Label(self.phan_tab, text='High contrast threshold:').grid(column=1, row=5)
Entry(self.phan_tab, width=7, textvariable=self.phan_hicon).grid(column=2, row=5)
Checkbutton(self.phan_tab, text='Force image inversion?', variable=self.phan_inver).grid(column=1, row=6)
Button(self.phan_tab, text='Analyze', command=analyze_phan).grid(column=1, row=9)
Label(self.phan_tab,
text='Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it.').grid(
column=1, row=10)
Label(self.phan_tab, text='Save file:').grid(column=1, row=11)
Label(self.phan_tab, textvariable=self.phan_pdf).grid(column=1, row=12)
self.notebook.add(self.phan_tab, text='2D Phantoms')
for child in self.phan_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def init_winstonlutz(self):
def load_dir():
f = filedialog.askdirectory()
self.wl_file.set(f)
def load_zip():
f = filedialog.askopenfilename()
self.wl_file.set(f)
def analyze_wl():
if osp.isdir(self.wl_file.get()):
wl = winston_lutz.WinstonLutz(self.wl_file.get())
fname = osp.join(self.wl_file.get(), 'W-L Analysis.pdf')
else:
wl = winston_lutz.WinstonLutz.from_zip(self.wl_file.get())
fname = self.wl_file.get().replace('.zip', '.pdf')
fname = utilities.file_exists(fname)
wl.analyze()
wl.publish_pdf(fname)
self.wl_pdf.set(fname)
utilities.open_path(fname)
self.wl_tab = Frame(self.notebook)
self.wl_file = StringVar()
self.wl_pdf = StringVar()
Label(self.wl_tab, text='Load EITHER a directory or ZIP file').grid(column=2, row=1)
Button(self.wl_tab, text='Load Directory...', command=load_dir).grid(column=2, row=2)
Button(self.wl_tab, text='Load ZIP file...', command=load_zip).grid(column=2, row=3)
Label(self.wl_tab, textvariable=self.wl_file).grid(column=2, row=4)
Button(self.wl_tab, text='Analyze', command=analyze_wl).grid(column=2, row=9)
Label(self.wl_tab,
text='Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it.').grid(
column=2, row=10)
Label(self.wl_tab, text='Save file:').grid(column=2, row=11)
Label(self.wl_tab, textvariable=self.wl_pdf).grid(column=2, row=12)
self.notebook.add(self.wl_tab, text='Winston-Lutz')
for child in self.wl_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def init_tg51(self):
self.tg_tab = Frame(self.notebook)
self.tg_pdf = StringVar()
self.tg_temp = DoubleVar(value=22)
self.tg_press = DoubleVar(value=760)
r, r2 = itertools.count(), itertools.count()
Label(self.tg_tab, text='Temperature (C):').grid(column=1, row=next(r))
Entry(self.tg_tab, width=7, textvariable=self.tg_temp).grid(column=2, row=next(r2))
Label(self.tg_tab, text='Pressure (mmHg):').grid(column=1, row=next(r))
Entry(self.tg_tab, width=7, textvariable=self.tg_press).grid(column=2, row=next(r2))
self.notebook.add(self.tg_tab, text='TG-51')
for child in self.tg_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def gui():
def on_exit():
if messagebox.askokcancel("Quit", "Do you want to quit?"):
root.quit()
root = Tk()
root.title('Pylinac GUI ' + __version__)
root.protocol("WM_DELETE_WINDOW", on_exit)
app = PylinacGUI(master=root)
app.mainloop()
root.destroy()
del root
|
[
"tkinter.StringVar",
"tkinter.BooleanVar",
"tkinter.Label",
"tkinter.Checkbutton",
"tkinter.Button",
"tkinter.filedialog.askopenfilename",
"tkinter.ttk.Frame",
"tkinter.Tk",
"tkinter.ttk.Entry",
"tkinter.filedialog.askopenfilenames",
"itertools.count",
"tkinter.filedialog.askdirectory",
"tkinter.ttk.Combobox",
"tkinter.messagebox.askokcancel",
"tkinter.IntVar",
"tkinter.ttk.Notebook",
"webbrowser.open",
"os.path.splitext",
"tkinter.DoubleVar"
] |
[((20698, 20702), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (20700, 20702), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((526, 540), 'tkinter.ttk.Notebook', 'Notebook', (['self'], {}), '(self)\n', (534, 540), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((1334, 1354), 'tkinter.ttk.Frame', 'Frame', (['self.notebook'], {}), '(self.notebook)\n', (1339, 1354), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((1363, 1491), 'tkinter.Label', 'Label', (['self.help_tab'], {'text': '"""Having trouble?\nWant to donate your images for program improvement?\nUpload them below"""'}), '(self.help_tab, text=\n """Having trouble?\nWant to donate your images for program improvement?\nUpload them below"""\n )\n', (1368, 1491), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((1488, 1546), 'tkinter.Button', 'Button', (['self.help_tab'], {'text': '"""Upload Files"""', 'command': 'upload'}), "(self.help_tab, text='Upload Files', command=upload)\n", (1494, 1546), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((1555, 1634), 'tkinter.Label', 'Label', (['self.help_tab'], {'text': '"""Complete documentation is available on ReadTheDocs"""'}), "(self.help_tab, text='Complete documentation is available on ReadTheDocs')\n", (1560, 1634), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((1643, 1701), 'tkinter.Button', 'Button', (['self.help_tab'], {'text': '"""ReadTheDocs"""', 'command': 'gotortd'}), "(self.help_tab, text='ReadTheDocs', command=gotortd)\n", (1649, 1701), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((1710, 1782), 'tkinter.Label', 'Label', (['self.help_tab'], {'text': '"""Help is also available in the Pylinac forum"""'}), "(self.help_tab, text='Help is also available in the Pylinac forum')\n", (1715, 1782), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((1791, 1851), 'tkinter.Button', 'Button', (['self.help_tab'], {'text': '"""Go to forum"""', 'command': 'gotoforum'}), "(self.help_tab, text='Go to forum', command=gotoforum)\n", (1797, 1851), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((1860, 1965), 'tkinter.Label', 'Label', (['self.help_tab'], {'text': '"""The source code of this program and all analyses is available on Github"""'}), "(self.help_tab, text=\n 'The source code of this program and all analyses is available on Github')\n", (1865, 1965), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((1969, 2025), 'tkinter.Button', 'Button', (['self.help_tab'], {'text': '"""Github"""', 'command': 'gotogithub'}), "(self.help_tab, text='Github', command=gotogithub)\n", (1975, 2025), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3020, 3040), 'tkinter.ttk.Frame', 'Frame', (['self.notebook'], {}), '(self.notebook)\n', (3025, 3040), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((3069, 3080), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (3078, 3080), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3109, 3120), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (3118, 3120), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3146, 3169), 'tkinter.StringVar', 'StringVar', ([], {'value': '"""DRGS"""'}), "(value='DRGS')\n", (3155, 3169), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3194, 3214), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(1.5)'}), '(value=1.5)\n', (3203, 3214), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3239, 3250), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (3248, 3250), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((5579, 5599), 'tkinter.ttk.Frame', 'Frame', (['self.notebook'], {}), '(self.notebook)\n', (5584, 5599), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((5625, 5648), 'tkinter.BooleanVar', 'BooleanVar', ([], {'value': '(False)'}), '(value=False)\n', (5635, 5648), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((5672, 5683), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (5681, 5683), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((5706, 5726), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(0.5)'}), '(value=0.5)\n', (5715, 5726), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((5750, 5771), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(0.25)'}), '(value=0.25)\n', (5759, 5771), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((5798, 5814), 'tkinter.IntVar', 'IntVar', ([], {'value': '(10)'}), '(value=10)\n', (5804, 5814), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((5837, 5848), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (5846, 5848), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((5871, 5882), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (5880, 5882), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((8421, 8441), 'tkinter.ttk.Frame', 'Frame', (['self.notebook'], {}), '(self.notebook)\n', (8426, 8441), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((8465, 8476), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (8474, 8476), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((8507, 8518), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (8516, 8518), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((8540, 8556), 'tkinter.IntVar', 'IntVar', ([], {'value': '(40)'}), '(value=40)\n', (8546, 8556), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((8583, 8601), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(1)'}), '(value=1)\n', (8592, 8601), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((8630, 8650), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(0.2)'}), '(value=0.2)\n', (8639, 8650), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((8673, 8684), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (8682, 8684), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((10873, 10893), 'tkinter.ttk.Frame', 'Frame', (['self.notebook'], {}), '(self.notebook)\n', (10878, 10893), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((10918, 10929), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (10927, 10929), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((10953, 10964), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (10962, 10964), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13179, 13199), 'tkinter.ttk.Frame', 'Frame', (['self.notebook'], {}), '(self.notebook)\n', (13184, 13199), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((13225, 13236), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (13234, 13236), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13291, 13302), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (13300, 13302), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13327, 13338), 'tkinter.DoubleVar', 'DoubleVar', ([], {}), '()\n', (13336, 13338), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13363, 13374), 'tkinter.DoubleVar', 'DoubleVar', ([], {}), '()\n', (13372, 13374), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13402, 13423), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(0.85)'}), '(value=0.85)\n', (13411, 13423), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13454, 13472), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(1)'}), '(value=1)\n', (13463, 13472), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13503, 13525), 'tkinter.BooleanVar', 'BooleanVar', ([], {'value': '(True)'}), '(value=True)\n', (13513, 13525), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16151, 16171), 'tkinter.ttk.Frame', 'Frame', (['self.notebook'], {}), '(self.notebook)\n', (16156, 16171), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((16197, 16208), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (16206, 16208), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16233, 16244), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (16242, 16244), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16271, 16291), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(0.1)'}), '(value=0.1)\n', (16280, 16291), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16318, 16338), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(0.5)'}), '(value=0.5)\n', (16327, 16338), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16365, 16388), 'tkinter.BooleanVar', 'BooleanVar', ([], {'value': '(False)'}), '(value=False)\n', (16375, 16388), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16414, 16441), 'tkinter.StringVar', 'StringVar', ([], {'value': '"""LeedsTOR"""'}), "(value='LeedsTOR')\n", (16423, 16441), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((18751, 18771), 'tkinter.ttk.Frame', 'Frame', (['self.notebook'], {}), '(self.notebook)\n', (18756, 18771), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((18795, 18806), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (18804, 18806), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((18829, 18840), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (18838, 18840), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((19867, 19887), 'tkinter.ttk.Frame', 'Frame', (['self.notebook'], {}), '(self.notebook)\n', (19872, 19887), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((19910, 19921), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (19919, 19921), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((19945, 19964), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(22)'}), '(value=22)\n', (19954, 19964), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((19989, 20009), 'tkinter.DoubleVar', 'DoubleVar', ([], {'value': '(760)'}), '(value=760)\n', (19998, 20009), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((20606, 20660), 'tkinter.messagebox.askokcancel', 'messagebox.askokcancel', (['"""Quit"""', '"""Do you want to quit?"""'], {}), "('Quit', 'Do you want to quit?')\n", (20628, 20660), False, 'from tkinter import messagebox\n'), ((942, 1013), 'webbrowser.open', 'webbrowser.open', (['"""https://www.dropbox.com/request/YKRu4AmuPsXu55uQq761"""'], {}), "('https://www.dropbox.com/request/YKRu4AmuPsXu55uQq761')\n", (957, 1013), False, 'import webbrowser\n'), ((1052, 1118), 'webbrowser.open', 'webbrowser.open', (['"""https://groups.google.com/forum/#!forum/pylinac"""'], {}), "('https://groups.google.com/forum/#!forum/pylinac')\n", (1067, 1118), False, 'import webbrowser\n'), ((1158, 1211), 'webbrowser.open', 'webbrowser.open', (['"""https://github.com/jrkerns/pylinac"""'], {}), "('https://github.com/jrkerns/pylinac')\n", (1173, 1211), False, 'import webbrowser\n'), ((1248, 1308), 'webbrowser.open', 'webbrowser.open', (['"""https://pylinac.readthedocs.io/en/latest/"""'], {}), "('https://pylinac.readthedocs.io/en/latest/')\n", (1263, 1308), False, 'import webbrowser\n'), ((2265, 2293), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (2291, 2293), False, 'from tkinter import filedialog\n'), ((2373, 2401), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (2399, 2401), False, 'from tkinter import filedialog\n'), ((4648, 4676), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (4674, 4676), False, 'from tkinter import filedialog\n'), ((7510, 7535), 'tkinter.filedialog.askdirectory', 'filedialog.askdirectory', ([], {}), '()\n', (7533, 7535), False, 'from tkinter import filedialog\n'), ((7609, 7637), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (7635, 7637), False, 'from tkinter import filedialog\n'), ((10449, 10477), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (10475, 10477), False, 'from tkinter import filedialog\n'), ((11834, 11862), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (11860, 11862), False, 'from tkinter import filedialog\n'), ((11948, 11977), 'tkinter.filedialog.askopenfilenames', 'filedialog.askopenfilenames', ([], {}), '()\n', (11975, 11977), False, 'from tkinter import filedialog\n'), ((12091, 12119), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (12117, 12119), False, 'from tkinter import filedialog\n'), ((15636, 15664), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (15662, 15664), False, 'from tkinter import filedialog\n'), ((18014, 18039), 'tkinter.filedialog.askdirectory', 'filedialog.askdirectory', ([], {}), '()\n', (18037, 18039), False, 'from tkinter import filedialog\n'), ((18113, 18141), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (18139, 18141), False, 'from tkinter import filedialog\n'), ((20026, 20043), 'itertools.count', 'itertools.count', ([], {}), '()\n', (20041, 20043), False, 'import itertools\n'), ((20045, 20062), 'itertools.count', 'itertools.count', ([], {}), '()\n', (20060, 20062), False, 'import itertools\n'), ((3259, 3326), 'tkinter.Button', 'Button', (['self.vmat_tab'], {'text': '"""Load Open Image..."""', 'command': 'load_open'}), "(self.vmat_tab, text='Load Open Image...', command=load_open)\n", (3265, 3326), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3357, 3424), 'tkinter.Button', 'Button', (['self.vmat_tab'], {'text': '"""Load DMLC Image..."""', 'command': 'load_dmlc'}), "(self.vmat_tab, text='Load DMLC Image...', command=load_dmlc)\n", (3363, 3424), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3455, 3507), 'tkinter.Label', 'Label', (['self.vmat_tab'], {'textvariable': 'self.vmat_openimg'}), '(self.vmat_tab, textvariable=self.vmat_openimg)\n', (3460, 3507), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3538, 3590), 'tkinter.Label', 'Label', (['self.vmat_tab'], {'textvariable': 'self.vmat_dmlcimg'}), '(self.vmat_tab, textvariable=self.vmat_dmlcimg)\n', (3543, 3590), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3621, 3660), 'tkinter.Label', 'Label', (['self.vmat_tab'], {'text': '"""Test type:"""'}), "(self.vmat_tab, text='Test type:')\n", (3626, 3660), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3691, 3769), 'tkinter.ttk.Combobox', 'Combobox', (['self.vmat_tab'], {'values': "('DRGS', 'DRMLC')", 'textvariable': 'self.vmat_test'}), "(self.vmat_tab, values=('DRGS', 'DRMLC'), textvariable=self.vmat_test)\n", (3699, 3769), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((3800, 3843), 'tkinter.Label', 'Label', (['self.vmat_tab'], {'text': '"""Tolerance (%):"""'}), "(self.vmat_tab, text='Tolerance (%):')\n", (3805, 3843), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((3874, 3931), 'tkinter.ttk.Entry', 'Entry', (['self.vmat_tab'], {'width': '(7)', 'textvariable': 'self.vmat_tol'}), '(self.vmat_tab, width=7, textvariable=self.vmat_tol)\n', (3879, 3931), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((3962, 4021), 'tkinter.Button', 'Button', (['self.vmat_tab'], {'text': '"""Analyze"""', 'command': 'analyze_vmat'}), "(self.vmat_tab, text='Analyze', command=analyze_vmat)\n", (3968, 4021), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((4052, 4237), 'tkinter.Label', 'Label', (['self.vmat_tab'], {'text': '"""Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""'}), '(self.vmat_tab, text=\n """Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""\n )\n', (4057, 4237), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((4282, 4321), 'tkinter.Label', 'Label', (['self.vmat_tab'], {'text': '"""Save file:"""'}), "(self.vmat_tab, text='Save file:')\n", (4287, 4321), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((4353, 4401), 'tkinter.Label', 'Label', (['self.vmat_tab'], {'textvariable': 'self.vmat_pdf'}), '(self.vmat_tab, textvariable=self.vmat_pdf)\n', (4358, 4401), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((6000, 6077), 'tkinter.Checkbutton', 'Checkbutton', (['self.pf_tab'], {'text': '"""Apply median filter"""', 'variable': 'self.pf_filter'}), "(self.pf_tab, text='Apply median filter', variable=self.pf_filter)\n", (6011, 6077), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((6108, 6167), 'tkinter.Button', 'Button', (['self.pf_tab'], {'text': '"""Load File..."""', 'command': 'load_file'}), "(self.pf_tab, text='Load File...', command=load_file)\n", (6114, 6167), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((6198, 6230), 'tkinter.Label', 'Label', (['self.pf_tab'], {'text': '"""File:"""'}), "(self.pf_tab, text='File:')\n", (6203, 6230), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((6261, 6306), 'tkinter.Label', 'Label', (['self.pf_tab'], {'textvariable': 'self.pf_file'}), '(self.pf_tab, textvariable=self.pf_file)\n', (6266, 6306), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((6337, 6379), 'tkinter.Label', 'Label', (['self.pf_tab'], {'text': '"""Tolerance (mm):"""'}), "(self.pf_tab, text='Tolerance (mm):')\n", (6342, 6379), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((6410, 6463), 'tkinter.ttk.Entry', 'Entry', (['self.pf_tab'], {'width': '(7)', 'textvariable': 'self.pf_tol'}), '(self.pf_tab, width=7, textvariable=self.pf_tol)\n', (6415, 6463), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((6494, 6543), 'tkinter.Label', 'Label', (['self.pf_tab'], {'text': '"""Action Tolerance (mm):"""'}), "(self.pf_tab, text='Action Tolerance (mm):')\n", (6499, 6543), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((6574, 6628), 'tkinter.ttk.Entry', 'Entry', (['self.pf_tab'], {'width': '(7)', 'textvariable': 'self.pf_atol'}), '(self.pf_tab, width=7, textvariable=self.pf_atol)\n', (6579, 6628), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((6659, 6704), 'tkinter.Label', 'Label', (['self.pf_tab'], {'text': '"""Number of pickets:"""'}), "(self.pf_tab, text='Number of pickets:')\n", (6664, 6704), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((6735, 6792), 'tkinter.ttk.Entry', 'Entry', (['self.pf_tab'], {'width': '(7)', 'textvariable': 'self.pf_pickets'}), '(self.pf_tab, width=7, textvariable=self.pf_pickets)\n', (6740, 6792), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((6823, 6859), 'tkinter.Label', 'Label', (['self.pf_tab'], {'text': '"""MLC type:"""'}), "(self.pf_tab, text='MLC type:')\n", (6828, 6859), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((6890, 6977), 'tkinter.ttk.Combobox', 'Combobox', (['self.pf_tab'], {'values': 'mlc_list', 'textvariable': 'self.pf_mlc', 'state': '"""readonly"""'}), "(self.pf_tab, values=mlc_list, textvariable=self.pf_mlc, state=\n 'readonly')\n", (6898, 6977), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((7003, 7058), 'tkinter.Button', 'Button', (['self.pf_tab'], {'text': '"""Analyze"""', 'command': 'analyze_pf'}), "(self.pf_tab, text='Analyze', command=analyze_pf)\n", (7009, 7058), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((7089, 7269), 'tkinter.Label', 'Label', (['self.pf_tab'], {'text': '"""Analysis will analyze the file according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""'}), '(self.pf_tab, text=\n """Analysis will analyze the file according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""\n )\n', (7094, 7269), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((8693, 8755), 'tkinter.Label', 'Label', (['self.ct_tab'], {'text': '"""Load EITHER a directory or ZIP file"""'}), "(self.ct_tab, text='Load EITHER a directory or ZIP file')\n", (8698, 8755), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((8786, 8849), 'tkinter.Button', 'Button', (['self.ct_tab'], {'text': '"""Load Directory..."""', 'command': 'load_dir'}), "(self.ct_tab, text='Load Directory...', command=load_dir)\n", (8792, 8849), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((8880, 8942), 'tkinter.Button', 'Button', (['self.ct_tab'], {'text': '"""Load ZIP file..."""', 'command': 'load_zip'}), "(self.ct_tab, text='Load ZIP file...', command=load_zip)\n", (8886, 8942), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((8973, 9018), 'tkinter.Label', 'Label', (['self.ct_tab'], {'textvariable': 'self.ct_file'}), '(self.ct_tab, textvariable=self.ct_file)\n', (8978, 9018), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((9049, 9089), 'tkinter.Label', 'Label', (['self.ct_tab'], {'text': '"""CatPhan type:"""'}), "(self.ct_tab, text='CatPhan type:')\n", (9054, 9089), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((9120, 9244), 'tkinter.ttk.Combobox', 'Combobox', (['self.ct_tab'], {'values': "('CatPhan504', 'CatPhan503', 'CatPhan600', 'CatPhan604')", 'textvariable': 'self.ct_catphantype'}), "(self.ct_tab, values=('CatPhan504', 'CatPhan503', 'CatPhan600',\n 'CatPhan604'), textvariable=self.ct_catphantype)\n", (9128, 9244), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((9271, 9316), 'tkinter.Label', 'Label', (['self.ct_tab'], {'text': '"""HU Tolerance (HU):"""'}), "(self.ct_tab, text='HU Tolerance (HU):')\n", (9276, 9316), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((9347, 9399), 'tkinter.ttk.Entry', 'Entry', (['self.ct_tab'], {'width': '(7)', 'textvariable': 'self.ct_hu'}), '(self.ct_tab, width=7, textvariable=self.ct_hu)\n', (9352, 9399), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((9430, 9480), 'tkinter.Label', 'Label', (['self.ct_tab'], {'text': '"""Scaling tolerance (mm):"""'}), "(self.ct_tab, text='Scaling tolerance (mm):')\n", (9435, 9480), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((9511, 9568), 'tkinter.ttk.Entry', 'Entry', (['self.ct_tab'], {'width': '(7)', 'textvariable': 'self.ct_scaling'}), '(self.ct_tab, width=7, textvariable=self.ct_scaling)\n', (9516, 9568), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((9599, 9651), 'tkinter.Label', 'Label', (['self.ct_tab'], {'text': '"""Thickness tolerance (mm):"""'}), "(self.ct_tab, text='Thickness tolerance (mm):')\n", (9604, 9651), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((9682, 9741), 'tkinter.ttk.Entry', 'Entry', (['self.ct_tab'], {'width': '(7)', 'textvariable': 'self.ct_thickness'}), '(self.ct_tab, width=7, textvariable=self.ct_thickness)\n', (9687, 9741), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((9772, 9829), 'tkinter.Button', 'Button', (['self.ct_tab'], {'text': '"""Analyze"""', 'command': 'analyze_cbct'}), "(self.ct_tab, text='Analyze', command=analyze_cbct)\n", (9778, 9829), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((9860, 10043), 'tkinter.Label', 'Label', (['self.ct_tab'], {'text': '"""Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""'}), '(self.ct_tab, text=\n """Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""\n )\n', (9865, 10043), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((10089, 10126), 'tkinter.Label', 'Label', (['self.ct_tab'], {'text': '"""Save file:"""'}), "(self.ct_tab, text='Save file:')\n", (10094, 10126), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((10158, 10202), 'tkinter.Label', 'Label', (['self.ct_tab'], {'textvariable': 'self.ct_pdf'}), '(self.ct_tab, textvariable=self.ct_pdf)\n', (10163, 10202), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((10973, 11036), 'tkinter.Button', 'Button', (['self.log_tab'], {'text': '"""Load log file..."""', 'command': 'load_log'}), "(self.log_tab, text='Load log file...', command=load_log)\n", (10979, 11036), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((11067, 11114), 'tkinter.Label', 'Label', (['self.log_tab'], {'textvariable': 'self.log_file'}), '(self.log_tab, textvariable=self.log_file)\n', (11072, 11114), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((11145, 11202), 'tkinter.Button', 'Button', (['self.log_tab'], {'text': '"""Analyze"""', 'command': 'analyze_log'}), "(self.log_tab, text='Analyze', command=analyze_log)\n", (11151, 11202), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((11233, 11417), 'tkinter.Label', 'Label', (['self.log_tab'], {'text': '"""Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""'}), '(self.log_tab, text=\n """Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""\n )\n', (11238, 11417), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((11463, 11501), 'tkinter.Label', 'Label', (['self.log_tab'], {'text': '"""Save file:"""'}), "(self.log_tab, text='Save file:')\n", (11468, 11501), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((11533, 11579), 'tkinter.Label', 'Label', (['self.log_tab'], {'textvariable': 'self.log_pdf'}), '(self.log_tab, textvariable=self.log_pdf)\n', (11538, 11579), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((12770, 12803), 'os.path.splitext', 'osp.splitext', (['self.star_mfiles[0]'], {}), '(self.star_mfiles[0])\n', (12782, 12803), True, 'import os.path as osp\n'), ((13534, 13636), 'tkinter.Label', 'Label', (['self.star_tab'], {'text': '"""Load EITHER a single star shot file, multiple files or a zip file..."""'}), "(self.star_tab, text=\n 'Load EITHER a single star shot file, multiple files or a zip file...')\n", (13539, 13636), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13662, 13730), 'tkinter.Button', 'Button', (['self.star_tab'], {'text': '"""Load single file..."""', 'command': 'load_star'}), "(self.star_tab, text='Load single file...', command=load_star)\n", (13668, 13730), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13761, 13846), 'tkinter.Button', 'Button', (['self.star_tab'], {'text': '"""Load multiple files..."""', 'command': 'load_multiple_star'}), "(self.star_tab, text='Load multiple files...', command=load_multiple_star\n )\n", (13767, 13846), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13872, 13945), 'tkinter.Button', 'Button', (['self.star_tab'], {'text': '"""Load zipped files..."""', 'command': 'load_zip_star'}), "(self.star_tab, text='Load zipped files...', command=load_zip_star)\n", (13878, 13945), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((13976, 14048), 'tkinter.Label', 'Label', (['self.star_tab'], {'textvariable': 'self.star_file', 'anchor': '"""w"""', 'width': '(100)'}), "(self.star_tab, textvariable=self.star_file, anchor='w', width=100)\n", (13981, 14048), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((14105, 14161), 'tkinter.Label', 'Label', (['self.star_tab'], {'text': '"""DPI (if file is not DICOM):"""'}), "(self.star_tab, text='DPI (if file is not DICOM):')\n", (14110, 14161), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((14192, 14249), 'tkinter.ttk.Entry', 'Entry', (['self.star_tab'], {'width': '(7)', 'textvariable': 'self.star_dpi'}), '(self.star_tab, width=7, textvariable=self.star_dpi)\n', (14197, 14249), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((14280, 14340), 'tkinter.Label', 'Label', (['self.star_tab'], {'text': '"""SID (mm; if file is not DICOM):"""'}), "(self.star_tab, text='SID (mm; if file is not DICOM):')\n", (14285, 14340), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((14371, 14428), 'tkinter.ttk.Entry', 'Entry', (['self.star_tab'], {'width': '(7)', 'textvariable': 'self.star_sid'}), '(self.star_tab, width=7, textvariable=self.star_sid)\n', (14376, 14428), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((14459, 14525), 'tkinter.Label', 'Label', (['self.star_tab'], {'text': '"""Normalized analysis radius (0.2-1.0):"""'}), "(self.star_tab, text='Normalized analysis radius (0.2-1.0):')\n", (14464, 14525), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((14556, 14616), 'tkinter.ttk.Entry', 'Entry', (['self.star_tab'], {'width': '(7)', 'textvariable': 'self.star_radius'}), '(self.star_tab, width=7, textvariable=self.star_radius)\n', (14561, 14616), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((14647, 14736), 'tkinter.Checkbutton', 'Checkbutton', (['self.star_tab'], {'text': '"""Recursive analysis?"""', 'variable': 'self.star_recursive'}), "(self.star_tab, text='Recursive analysis?', variable=self.\n star_recursive)\n", (14658, 14736), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((14762, 14806), 'tkinter.Label', 'Label', (['self.star_tab'], {'text': '"""Tolerance (mm):"""'}), "(self.star_tab, text='Tolerance (mm):')\n", (14767, 14806), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((14837, 14900), 'tkinter.ttk.Entry', 'Entry', (['self.star_tab'], {'width': '(7)', 'textvariable': 'self.star_tolerance'}), '(self.star_tab, width=7, textvariable=self.star_tolerance)\n', (14842, 14900), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((14931, 14990), 'tkinter.Button', 'Button', (['self.star_tab'], {'text': '"""Analyze"""', 'command': 'analyze_star'}), "(self.star_tab, text='Analyze', command=analyze_star)\n", (14937, 14990), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((15021, 15206), 'tkinter.Label', 'Label', (['self.star_tab'], {'text': '"""Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""'}), '(self.star_tab, text=\n """Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""\n )\n', (15026, 15206), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((15254, 15293), 'tkinter.Label', 'Label', (['self.star_tab'], {'text': '"""Save file:"""'}), "(self.star_tab, text='Save file:')\n", (15259, 15293), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((15325, 15373), 'tkinter.Label', 'Label', (['self.star_tab'], {'textvariable': 'self.star_pdf'}), '(self.star_tab, textvariable=self.star_pdf)\n', (15330, 15373), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16450, 16537), 'tkinter.Button', 'Button', (['self.phan_tab'], {'text': '"""Load planar phantom DICOM file..."""', 'command': 'load_phan'}), "(self.phan_tab, text='Load planar phantom DICOM file...', command=\n load_phan)\n", (16456, 16537), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16563, 16612), 'tkinter.Label', 'Label', (['self.phan_tab'], {'textvariable': 'self.phan_file'}), '(self.phan_tab, textvariable=self.phan_file)\n', (16568, 16612), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16643, 16680), 'tkinter.Label', 'Label', (['self.phan_tab'], {'text': '"""Phantom:"""'}), "(self.phan_tab, text='Phantom:')\n", (16648, 16680), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16711, 16822), 'tkinter.ttk.Combobox', 'Combobox', (['self.phan_tab'], {'values': "('LeedsTOR', 'LasVegas', 'StandardImagingQC3')", 'textvariable': 'self.phan_type'}), "(self.phan_tab, values=('LeedsTOR', 'LasVegas',\n 'StandardImagingQC3'), textvariable=self.phan_type)\n", (16719, 16822), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((16849, 16901), 'tkinter.Label', 'Label', (['self.phan_tab'], {'text': '"""Low contrast threshold:"""'}), "(self.phan_tab, text='Low contrast threshold:')\n", (16854, 16901), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((16932, 16991), 'tkinter.ttk.Entry', 'Entry', (['self.phan_tab'], {'width': '(7)', 'textvariable': 'self.phan_locon'}), '(self.phan_tab, width=7, textvariable=self.phan_locon)\n', (16937, 16991), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((17022, 17075), 'tkinter.Label', 'Label', (['self.phan_tab'], {'text': '"""High contrast threshold:"""'}), "(self.phan_tab, text='High contrast threshold:')\n", (17027, 17075), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((17106, 17165), 'tkinter.ttk.Entry', 'Entry', (['self.phan_tab'], {'width': '(7)', 'textvariable': 'self.phan_hicon'}), '(self.phan_tab, width=7, textvariable=self.phan_hicon)\n', (17111, 17165), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((17196, 17284), 'tkinter.Checkbutton', 'Checkbutton', (['self.phan_tab'], {'text': '"""Force image inversion?"""', 'variable': 'self.phan_inver'}), "(self.phan_tab, text='Force image inversion?', variable=self.\n phan_inver)\n", (17207, 17284), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((17310, 17369), 'tkinter.Button', 'Button', (['self.phan_tab'], {'text': '"""Analyze"""', 'command': 'analyze_phan'}), "(self.phan_tab, text='Analyze', command=analyze_phan)\n", (17316, 17369), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((17400, 17585), 'tkinter.Label', 'Label', (['self.phan_tab'], {'text': '"""Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""'}), '(self.phan_tab, text=\n """Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""\n )\n', (17405, 17585), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((17633, 17672), 'tkinter.Label', 'Label', (['self.phan_tab'], {'text': '"""Save file:"""'}), "(self.phan_tab, text='Save file:')\n", (17638, 17672), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((17704, 17752), 'tkinter.Label', 'Label', (['self.phan_tab'], {'textvariable': 'self.phan_pdf'}), '(self.phan_tab, textvariable=self.phan_pdf)\n', (17709, 17752), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((18849, 18911), 'tkinter.Label', 'Label', (['self.wl_tab'], {'text': '"""Load EITHER a directory or ZIP file"""'}), "(self.wl_tab, text='Load EITHER a directory or ZIP file')\n", (18854, 18911), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((18942, 19005), 'tkinter.Button', 'Button', (['self.wl_tab'], {'text': '"""Load Directory..."""', 'command': 'load_dir'}), "(self.wl_tab, text='Load Directory...', command=load_dir)\n", (18948, 19005), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((19036, 19098), 'tkinter.Button', 'Button', (['self.wl_tab'], {'text': '"""Load ZIP file..."""', 'command': 'load_zip'}), "(self.wl_tab, text='Load ZIP file...', command=load_zip)\n", (19042, 19098), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((19129, 19174), 'tkinter.Label', 'Label', (['self.wl_tab'], {'textvariable': 'self.wl_file'}), '(self.wl_tab, textvariable=self.wl_file)\n', (19134, 19174), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((19205, 19260), 'tkinter.Button', 'Button', (['self.wl_tab'], {'text': '"""Analyze"""', 'command': 'analyze_wl'}), "(self.wl_tab, text='Analyze', command=analyze_wl)\n", (19211, 19260), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((19291, 19474), 'tkinter.Label', 'Label', (['self.wl_tab'], {'text': '"""Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""'}), '(self.wl_tab, text=\n """Analysis will analyze the file(s) according to the settings, \nsave a PDF in the same directory as the original file location and then open it."""\n )\n', (19296, 19474), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((19520, 19557), 'tkinter.Label', 'Label', (['self.wl_tab'], {'text': '"""Save file:"""'}), "(self.wl_tab, text='Save file:')\n", (19525, 19557), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((19589, 19633), 'tkinter.Label', 'Label', (['self.wl_tab'], {'textvariable': 'self.wl_pdf'}), '(self.wl_tab, textvariable=self.wl_pdf)\n', (19594, 19633), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((20071, 20114), 'tkinter.Label', 'Label', (['self.tg_tab'], {'text': '"""Temperature (C):"""'}), "(self.tg_tab, text='Temperature (C):')\n", (20076, 20114), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((20151, 20205), 'tkinter.ttk.Entry', 'Entry', (['self.tg_tab'], {'width': '(7)', 'textvariable': 'self.tg_temp'}), '(self.tg_tab, width=7, textvariable=self.tg_temp)\n', (20156, 20205), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n'), ((20243, 20286), 'tkinter.Label', 'Label', (['self.tg_tab'], {'text': '"""Pressure (mmHg):"""'}), "(self.tg_tab, text='Pressure (mmHg):')\n", (20248, 20286), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((20323, 20378), 'tkinter.ttk.Entry', 'Entry', (['self.tg_tab'], {'width': '(7)', 'textvariable': 'self.tg_press'}), '(self.tg_tab, width=7, textvariable=self.tg_press)\n', (20328, 20378), False, 'from tkinter.ttk import Frame, Notebook, Combobox, Entry\n')]
|
#!/usr/bin/env python3
"""
Netflow V9 collector and parser implementation in Python 3.
This file belongs to https://github.com/bitkeks/python-netflow-v9-softflowd.
Created for learning purposes and unsatisfying alternatives.
Reference: https://www.cisco.com/en/US/technologies/tk648/tk362/technologies_white_paper09186a00800a3db9.html
This script is specifically implemented in combination with softflowd. See https://github.com/djmdjm/softflowd
Copyright 2016-2020 <NAME> <<EMAIL>>
Licensed under MIT License. See LICENSE.
"""
import ipaddress
import struct
__all__ = ["V9DataFlowSet", "V9DataRecord", "V9ExportPacket", "V9Header", "V9TemplateField",
"V9TemplateFlowSet", "V9TemplateNotRecognized", "V9TemplateRecord"]
V9_FIELD_TYPES = {
0: 'UNKNOWN_FIELD_TYPE', # fallback for unknown field types
# Cisco specs for NetFlow v9
# https://tools.ietf.org/html/rfc3954
# https://www.cisco.com/en/US/technologies/tk648/tk362/technologies_white_paper09186a00800a3db9.html
1: 'IN_BYTES',
2: 'IN_PKTS',
3: 'FLOWS',
4: 'PROTOCOL',
5: 'SRC_TOS',
6: 'TCP_FLAGS',
7: 'L4_SRC_PORT',
8: 'IPV4_SRC_ADDR',
9: 'SRC_MASK',
10: 'INPUT_SNMP',
11: 'L4_DST_PORT',
12: 'IPV4_DST_ADDR',
13: 'DST_MASK',
14: 'OUTPUT_SNMP',
15: 'IPV4_NEXT_HOP',
16: 'SRC_AS',
17: 'DST_AS',
18: 'BGP_IPV4_NEXT_HOP',
19: 'MUL_DST_PKTS',
20: 'MUL_DST_BYTES',
21: 'LAST_SWITCHED',
22: 'FIRST_SWITCHED',
23: 'OUT_BYTES',
24: 'OUT_PKTS',
25: 'MIN_PKT_LNGTH',
26: 'MAX_PKT_LNGTH',
27: 'IPV6_SRC_ADDR',
28: 'IPV6_DST_ADDR',
29: 'IPV6_SRC_MASK',
30: 'IPV6_DST_MASK',
31: 'IPV6_FLOW_LABEL',
32: 'ICMP_TYPE',
33: 'MUL_IGMP_TYPE',
34: 'SAMPLING_INTERVAL',
35: 'SAMPLING_ALGORITHM',
36: 'FLOW_ACTIVE_TIMEOUT',
37: 'FLOW_INACTIVE_TIMEOUT',
38: 'ENGINE_TYPE',
39: 'ENGINE_ID',
40: 'TOTAL_BYTES_EXP',
41: 'TOTAL_PKTS_EXP',
42: 'TOTAL_FLOWS_EXP',
# 43 vendor proprietary
44: 'IPV4_SRC_PREFIX',
45: 'IPV4_DST_PREFIX',
46: 'MPLS_TOP_LABEL_TYPE',
47: 'MPLS_TOP_LABEL_IP_ADDR',
48: 'FLOW_SAMPLER_ID',
49: 'FLOW_SAMPLER_MODE',
50: 'NTERVAL',
# 51 vendor proprietary
52: 'MIN_TTL',
53: 'MAX_TTL',
54: 'IPV4_IDENT',
55: 'DST_TOS',
56: 'IN_SRC_MAC',
57: 'OUT_DST_MAC',
58: 'SRC_VLAN',
59: 'DST_VLAN',
60: 'IP_PROTOCOL_VERSION',
61: 'DIRECTION',
62: 'IPV6_NEXT_HOP',
63: 'BPG_IPV6_NEXT_HOP',
64: 'IPV6_OPTION_HEADERS',
# 65-69 vendor proprietary
70: 'MPLS_LABEL_1',
71: 'MPLS_LABEL_2',
72: 'MPLS_LABEL_3',
73: 'MPLS_LABEL_4',
74: 'MPLS_LABEL_5',
75: 'MPLS_LABEL_6',
76: 'MPLS_LABEL_7',
77: 'MPLS_LABEL_8',
78: 'MPLS_LABEL_9',
79: 'MPLS_LABEL_10',
80: 'IN_DST_MAC',
81: 'OUT_SRC_MAC',
82: 'IF_NAME',
83: 'IF_DESC',
84: 'SAMPLER_NAME',
85: 'IN_PERMANENT_BYTES',
86: 'IN_PERMANENT_PKTS',
# 87 vendor property
88: 'FRAGMENT_OFFSET',
89: 'FORWARDING_STATUS',
90: 'MPLS_PAL_RD',
91: 'MPLS_PREFIX_LEN', # Number of consecutive bits in the MPLS prefix length.
92: 'SRC_TRAFFIC_INDEX', # BGP Policy Accounting Source Traffic Index
93: 'DST_TRAFFIC_INDEX', # BGP Policy Accounting Destination Traffic Index
94: 'APPLICATION_DESCRIPTION', # Application description
95: 'APPLICATION_TAG', # 8 bits of engine ID, followed by n bits of classification
96: 'APPLICATION_NAME', # Name associated with a classification
98: 'postipDiffServCodePoint', # The value of a Differentiated Services Code Point (DSCP)
# encoded in the Differentiated Services Field, after modification
99: 'replication_factor', # Multicast replication factor
100: 'DEPRECATED', # DEPRECATED
102: 'layer2packetSectionOffset', # Layer 2 packet section offset. Potentially a generic offset
103: 'layer2packetSectionSize', # Layer 2 packet section size. Potentially a generic size
104: 'layer2packetSectionData', # Layer 2 packet section data
# 105-127 reserved for future use by Cisco
# ASA extensions
# https://www.cisco.com/c/en/us/td/docs/security/asa/special/netflow/guide/asa_netflow.html
148: 'NF_F_CONN_ID', # An identifier of a unique flow for the device
176: 'NF_F_ICMP_TYPE', # ICMP type value
177: 'NF_F_ICMP_CODE', # ICMP code value
178: 'NF_F_ICMP_TYPE_IPV6', # ICMP IPv6 type value
179: 'NF_F_ICMP_CODE_IPV6', # ICMP IPv6 code value
225: 'NF_F_XLATE_SRC_ADDR_IPV4', # Post NAT Source IPv4 Address
226: 'NF_F_XLATE_DST_ADDR_IPV4', # Post NAT Destination IPv4 Address
227: 'NF_F_XLATE_SRC_PORT', # Post NATT Source Transport Port
228: 'NF_F_XLATE_DST_PORT', # Post NATT Destination Transport Port
281: 'NF_F_XLATE_SRC_ADDR_IPV6', # Post NAT Source IPv6 Address
282: 'NF_F_XLATE_DST_ADDR_IPV6', # Post NAT Destination IPv6 Address
233: 'NF_F_FW_EVENT', # High-level event code
33002: 'NF_F_FW_EXT_EVENT', # Extended event code
323: 'NF_F_EVENT_TIME_MSEC', # The time that the event occurred, which comes from IPFIX
152: 'NF_F_FLOW_CREATE_TIME_MSEC',
231: 'NF_F_FWD_FLOW_DELTA_BYTES', # The delta number of bytes from source to destination
232: 'NF_F_REV_FLOW_DELTA_BYTES', # The delta number of bytes from destination to source
33000: 'NF_F_INGRESS_ACL_ID', # The input ACL that permitted or denied the flow
33001: 'NF_F_EGRESS_ACL_ID', # The output ACL that permitted or denied a flow
40000: 'NF_F_USERNAME', # AAA username
# PaloAlto PAN-OS 8.0
# https://www.paloaltonetworks.com/documentation/80/pan-os/pan-os/monitoring/netflow-monitoring/netflow-templates
346: 'PANOS_privateEnterpriseNumber',
56701: 'PANOS_APPID',
56702: 'PANOS_USERID'
}
class V9TemplateNotRecognized(KeyError):
pass
class V9DataRecord:
"""This is a 'flow' as we want it from our source. What it contains is
variable in NetFlow V9, so to work with the data you have to analyze the
data dict keys (which are integers and can be mapped with the FIELD_TYPES
dict).
Should hold a 'data' dict with keys=field_type (integer) and value (in bytes).
"""
def __init__(self):
self.data = {}
def __repr__(self):
return "<DataRecord with data: {}>".format(self.data)
class V9DataFlowSet:
"""Holds one or multiple DataRecord which are all defined after the same
template. This template is referenced in the field 'flowset_id' of this
DataFlowSet and must not be zero.
"""
def __init__(self, data, templates):
pack = struct.unpack('!HH', data[:4])
self.template_id = pack[0] # flowset_id is reference to a template_id
self.length = pack[1]
self.flows = []
offset = 4
if self.template_id not in templates:
raise V9TemplateNotRecognized
template = templates[self.template_id]
if len(template.fields) == 0:
return #ignore options templates at the moment
# As the field lengths are variable V9 has padding to next 32 Bit
padding_size = 4 - (self.length % 4) # 4 Byte
while offset <= (self.length - padding_size):
new_record = V9DataRecord()
for field in template.fields:
flen = field.field_length
fkey = V9_FIELD_TYPES[field.field_type]
# The length of the value byte slice is defined in the template
dataslice = data[offset:offset + flen]
# Better solution than struct.unpack with variable field length
fdata = 0
for idx, byte in enumerate(reversed(bytearray(dataslice))):
fdata += byte << (idx * 8)
# Special handling of IP addresses to convert integers to strings to not lose precision in dump
# TODO: might only be needed for IPv6
if fkey in ["IPV4_SRC_ADDR", "IPV4_DST_ADDR", "IPV6_SRC_ADDR", "IPV6_DST_ADDR"]:
try:
ip = ipaddress.ip_address(fdata)
except ValueError:
print("IP address could not be parsed: {}".format(fdata))
continue
new_record.data[fkey] = ip.compressed
else:
new_record.data[fkey] = fdata
offset += flen
new_record.__dict__.update(new_record.data)
self.flows.append(new_record)
def __repr__(self):
return "<DataFlowSet with template {} of length {} holding {} flows>" \
.format(self.template_id, self.length, len(self.flows))
class V9TemplateField:
"""A field with type identifier and length.
"""
def __init__(self, field_type, field_length):
self.field_type = field_type # integer
self.field_length = field_length # bytes
def __repr__(self):
return "<TemplateField type {}:{}, length {}>".format(
self.field_type, V9_FIELD_TYPES[self.field_type], self.field_length)
class V9TemplateRecord:
"""A template record contained in a TemplateFlowSet.
"""
def __init__(self, template_id, field_count, fields):
self.template_id = template_id
self.field_count = field_count
self.fields = fields
def __repr__(self):
return "<TemplateRecord {} with {} fields: {}>".format(
self.template_id, self.field_count,
' '.join([V9_FIELD_TYPES[field.field_type] for field in self.fields]))
class V9OptionsTemplateFlowSet:
def __init__(self, data):
pack = struct.unpack('!HHH', data[:6])
self.flowset_id = pack[0]
self.length = pack[1]
self.template_id = pack[2]
class V9TemplateFlowSet:
"""A template flowset, which holds an id that is used by data flowsets to
reference back to the template. The template then has fields which hold
identifiers of data types (eg "IP_SRC_ADDR", "PKTS"..). This way the flow
sender can dynamically put together data flowsets.
"""
def __init__(self, data):
pack = struct.unpack('!HH', data[:4])
self.flowset_id = pack[0]
self.length = pack[1] # total length including this header in bytes
self.templates = {}
offset = 4 # Skip header
# Iterate through all template records in this template flowset
while offset < self.length:
pack = struct.unpack('!HH', data[offset:offset + 4])
template_id = pack[0]
field_count = pack[1]
fields = []
for field in range(field_count):
# Get all fields of this template
offset += 4
field_type, field_length = struct.unpack('!HH', data[offset:offset + 4])
if field_type not in V9_FIELD_TYPES:
field_type = 0 # Set field_type to UNKNOWN_FIELD_TYPE as fallback
field = V9TemplateField(field_type, field_length)
fields.append(field)
# Create a template object with all collected data
template = V9TemplateRecord(template_id, field_count, fields)
# Append the new template to the global templates list
self.templates[template.template_id] = template
# Set offset to next template_id field
offset += 4
def __repr__(self):
return "<TemplateFlowSet with id {} of length {} containing templates: {}>" \
.format(self.flowset_id, self.length, self.templates.keys())
class V9Header:
"""The header of the V9ExportPacket
"""
length = 20
def __init__(self, data):
pack = struct.unpack('!HHIIII', data[:self.length])
self.version = pack[0]
self.count = pack[1] # not sure if correct. softflowd: no of flows
self.uptime = pack[2]
self.timestamp = pack[3]
self.sequence = pack[4]
self.source_id = pack[5]
def to_dict(self):
return self.__dict__
class V9ExportPacket:
"""The flow record holds the header and all template and data flowsets.
"""
def __init__(self, data, templates):
self.header = V9Header(data)
self._templates = templates
self._new_templates = False
self._flows = []
offset = self.header.length
skipped_flowsets_offsets = []
while offset != len(data):
flowset_id = struct.unpack('!H', data[offset:offset + 2])[0]
if flowset_id == 0: # TemplateFlowSet always have id 0
tfs = V9TemplateFlowSet(data[offset:])
# Check for any new/changed templates
if not self._new_templates:
for id_, template in tfs.templates.items():
if id_ not in self._templates or self._templates[id_] != template:
self._new_templates = True
break
# Update the templates with the provided templates, even if they are the same
self._templates.update(tfs.templates)
offset += tfs.length
elif flowset_id == 1:
otfs = V9OptionsTemplateFlowSet(data[offset:])
if not self._new_templates:
if otfs.template_id not in self._templates:
self._new_templates = True
self._templates.update({otfs.template_id: V9TemplateRecord(otfs.template_id, 0, {})})
offset += otfs.length
else:
try:
dfs = V9DataFlowSet(data[offset:], self._templates)
self._flows += dfs.flows
offset += dfs.length
except V9TemplateNotRecognized:
# Could not be parsed, continue to check for templates
length = struct.unpack("!H", data[offset + 2:offset + 4])[0]
skipped_flowsets_offsets.append(offset)
offset += length
if skipped_flowsets_offsets and self._new_templates:
# Process flowsets in the data slice which occured before the template sets
for offset in skipped_flowsets_offsets:
dfs = V9DataFlowSet(data[offset:], self._templates)
self._flows += dfs.flows
elif skipped_flowsets_offsets:
raise V9TemplateNotRecognized
@property
def contains_new_templates(self):
return self._new_templates
@property
def flows(self):
return self._flows
@property
def templates(self):
return self._templates
def __repr__(self):
s = " and new template(s)" if self.contains_new_templates else ""
return "<ExportPacket v{} with {} records{}>".format(
self.header.version, self.header.count, s)
|
[
"struct.unpack",
"ipaddress.ip_address"
] |
[((6669, 6699), 'struct.unpack', 'struct.unpack', (['"""!HH"""', 'data[:4]'], {}), "('!HH', data[:4])\n", (6682, 6699), False, 'import struct\n'), ((9708, 9739), 'struct.unpack', 'struct.unpack', (['"""!HHH"""', 'data[:6]'], {}), "('!HHH', data[:6])\n", (9721, 9739), False, 'import struct\n'), ((10206, 10236), 'struct.unpack', 'struct.unpack', (['"""!HH"""', 'data[:4]'], {}), "('!HH', data[:4])\n", (10219, 10236), False, 'import struct\n'), ((11787, 11831), 'struct.unpack', 'struct.unpack', (['"""!HHIIII"""', 'data[:self.length]'], {}), "('!HHIIII', data[:self.length])\n", (11800, 11831), False, 'import struct\n'), ((10539, 10584), 'struct.unpack', 'struct.unpack', (['"""!HH"""', 'data[offset:offset + 4]'], {}), "('!HH', data[offset:offset + 4])\n", (10552, 10584), False, 'import struct\n'), ((10844, 10889), 'struct.unpack', 'struct.unpack', (['"""!HH"""', 'data[offset:offset + 4]'], {}), "('!HH', data[offset:offset + 4])\n", (10857, 10889), False, 'import struct\n'), ((12539, 12583), 'struct.unpack', 'struct.unpack', (['"""!H"""', 'data[offset:offset + 2]'], {}), "('!H', data[offset:offset + 2])\n", (12552, 12583), False, 'import struct\n'), ((8138, 8165), 'ipaddress.ip_address', 'ipaddress.ip_address', (['fdata'], {}), '(fdata)\n', (8158, 8165), False, 'import ipaddress\n'), ((13985, 14033), 'struct.unpack', 'struct.unpack', (['"""!H"""', 'data[offset + 2:offset + 4]'], {}), "('!H', data[offset + 2:offset + 4])\n", (13998, 14033), False, 'import struct\n')]
|
import argparse
import logging
from typing import Any, Dict, List, Optional
import pandas
import annofabcli
import annofabcli.common.cli
from annofabcli import AnnofabApiFacade
from annofabcli.common.cli import AbstractCommandLineInterface, ArgumentParser, build_annofabapi_resource_and_login
from annofabcli.common.utils import isoduration_to_hour
logger = logging.getLogger(__name__)
class TaskProgress(AbstractCommandLineInterface):
"""
タスクフェーズ別の累積作業時間を出力する。
"""
def get_task_phase_statistics(self, project_id: str) -> List[Dict[str, Any]]:
"""
フェーズごとの累積作業時間をCSVに出力するための dict 配列を作成する。
Args:
project_id:
Returns:
フェーズごとの累積作業時間に対応するdict配列
"""
task_phase_statistics = self.service.wrapper.get_task_phase_statistics(project_id)
row_list: List[Dict[str, Any]] = []
for stat_by_date in task_phase_statistics:
date = stat_by_date["date"]
phase_stat_list = stat_by_date["phases"]
for phase_stat in phase_stat_list:
phase_stat["date"] = date
phase_stat["worktime_hour"] = isoduration_to_hour(phase_stat["worktime"])
row_list.extend(phase_stat_list)
return row_list
def list_cumulative_labor_time(self, project_id: str) -> None:
super().validate_project(project_id, project_member_roles=None)
phase_stat_list = self.get_task_phase_statistics(project_id)
if len(phase_stat_list) == 0:
logger.info("タスクフェーズ別の累積作業時間情報がないため出力しません。")
return
df = pandas.DataFrame(phase_stat_list)
# 出力対象の列を指定する
target_df = df[["date", "phase", "worktime_hour"]]
annofabcli.utils.print_csv(target_df, output=self.output, to_csv_kwargs=self.csv_format)
def main(self):
args = self.args
project_id = args.project_id
self.list_cumulative_labor_time(project_id)
def parse_args(parser: argparse.ArgumentParser):
argument_parser = ArgumentParser(parser)
argument_parser.add_project_id()
argument_parser.add_csv_format()
argument_parser.add_output()
parser.set_defaults(subcommand_func=main)
def main(args):
service = build_annofabapi_resource_and_login(args)
facade = AnnofabApiFacade(service)
TaskProgress(service, facade, args).main()
def add_parser(subparsers: Optional[argparse._SubParsersAction] = None):
subcommand_name = "list_cumulative_labor_time"
subcommand_help = "日ごとタスクフェーズごとの累積作業時間を出力する。"
description = "日ごとタスクフェーズごとの累積作業時間をCSV形式で出力する。"
parser = annofabcli.common.cli.add_parser(subparsers, subcommand_name, subcommand_help, description=description)
parse_args(parser)
return parser
|
[
"pandas.DataFrame",
"annofabcli.common.cli.ArgumentParser",
"annofabcli.common.cli.build_annofabapi_resource_and_login",
"annofabcli.utils.print_csv",
"annofabcli.common.utils.isoduration_to_hour",
"annofabcli.common.cli.add_parser",
"annofabcli.AnnofabApiFacade",
"logging.getLogger"
] |
[((361, 388), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (378, 388), False, 'import logging\n'), ((2019, 2041), 'annofabcli.common.cli.ArgumentParser', 'ArgumentParser', (['parser'], {}), '(parser)\n', (2033, 2041), False, 'from annofabcli.common.cli import AbstractCommandLineInterface, ArgumentParser, build_annofabapi_resource_and_login\n'), ((2229, 2270), 'annofabcli.common.cli.build_annofabapi_resource_and_login', 'build_annofabapi_resource_and_login', (['args'], {}), '(args)\n', (2264, 2270), False, 'from annofabcli.common.cli import AbstractCommandLineInterface, ArgumentParser, build_annofabapi_resource_and_login\n'), ((2284, 2309), 'annofabcli.AnnofabApiFacade', 'AnnofabApiFacade', (['service'], {}), '(service)\n', (2300, 2309), False, 'from annofabcli import AnnofabApiFacade\n'), ((2598, 2705), 'annofabcli.common.cli.add_parser', 'annofabcli.common.cli.add_parser', (['subparsers', 'subcommand_name', 'subcommand_help'], {'description': 'description'}), '(subparsers, subcommand_name,\n subcommand_help, description=description)\n', (2630, 2705), False, 'import annofabcli\n'), ((1598, 1631), 'pandas.DataFrame', 'pandas.DataFrame', (['phase_stat_list'], {}), '(phase_stat_list)\n', (1614, 1631), False, 'import pandas\n'), ((1721, 1814), 'annofabcli.utils.print_csv', 'annofabcli.utils.print_csv', (['target_df'], {'output': 'self.output', 'to_csv_kwargs': 'self.csv_format'}), '(target_df, output=self.output, to_csv_kwargs=\n self.csv_format)\n', (1747, 1814), False, 'import annofabcli\n'), ((1147, 1190), 'annofabcli.common.utils.isoduration_to_hour', 'isoduration_to_hour', (["phase_stat['worktime']"], {}), "(phase_stat['worktime'])\n", (1166, 1190), False, 'from annofabcli.common.utils import isoduration_to_hour\n')]
|
""" the main query widget
"""
# Copyright (c) 2021 ipyradiant contributors.
# Distributed under the terms of the Modified BSD License.
import re
import IPython
import ipywidgets as W
import traitlets as T
from pandas import DataFrame
from rdflib import Graph, URIRef
from .namespace_manager import collapse_namespace
from .query_constructor import QueryConstructor
from .utils import service_patch_rdflib
class QueryWidget(W.VBox):
"""
TODO
- use SPARQLQueryFramer?
- link select and limit/offset (only needs to be visible for SELECT queries)
- store namespace info intelligently
- process longer (via path edges) namespaces first (most reductive to least reductive)
- error displays or output panel
"""
# namespace pattern
NS_PATTERN = re.compile(r"PREFIX ([\w]*): <(.+)>")
graph = T.Instance(Graph)
run_button = T.Instance(W.Button)
log = W.Output(layout={"border": "1px solid black"})
grid = T.Instance(W.Output)
current_dataframe = T.Instance(DataFrame)
def __init__(self, graph: Graph = None, *args, **kwargs):
super().__init__(*args, **kwargs)
if graph is not None:
self.graph = graph
self.query_constructor = QueryConstructor()
self.children = [self.query_constructor, self.run_button, self.grid]
@log.capture(clear_output=True)
def run_query(self, button):
# Get all namespaces from the widget string
namespaces = self.NS_PATTERN.findall(self.query_constructor.namespaces)
# RDFlib SERVICE patch -> to be removed in release>5.0.0
query_str = service_patch_rdflib(self.query_constructor.query)
self.query_constructor.query = query_str
res = self.graph.query(self.query_constructor.query, initNs=dict(namespaces))
self.current_dataframe = DataFrame(list(res))
collapsed_data = DataFrame(list(res))
for ii, row in collapsed_data.iterrows():
for jj, cell in enumerate(row):
if isinstance(cell, URIRef):
collapsed_data.iat[ii, jj] = collapse_namespace(namespaces, cell)
self.grid.clear_output()
with self.grid:
IPython.display.display(
IPython.display.HTML(collapsed_data.to_html(escape=False))
)
@T.default("graph")
def make_default_graph(self):
return Graph()
@T.default("grid")
def make_default_grid(self):
return W.Output(layout=dict(max_height="60vh"))
@T.default("run_button")
def make_default_run_button(self):
button = W.Button(
description="Run Query",
icon="search",
tooltip="Click to execute query with current configuration.",
)
button.on_click(self.run_query)
return button
|
[
"traitlets.default",
"rdflib.Graph",
"ipywidgets.Button",
"ipywidgets.Output",
"traitlets.Instance",
"re.compile"
] |
[((793, 830), 're.compile', 're.compile', (['"""PREFIX ([\\\\w]*): <(.+)>"""'], {}), "('PREFIX ([\\\\w]*): <(.+)>')\n", (803, 830), False, 'import re\n'), ((844, 861), 'traitlets.Instance', 'T.Instance', (['Graph'], {}), '(Graph)\n', (854, 861), True, 'import traitlets as T\n'), ((879, 899), 'traitlets.Instance', 'T.Instance', (['W.Button'], {}), '(W.Button)\n', (889, 899), True, 'import traitlets as T\n'), ((910, 956), 'ipywidgets.Output', 'W.Output', ([], {'layout': "{'border': '1px solid black'}"}), "(layout={'border': '1px solid black'})\n", (918, 956), True, 'import ipywidgets as W\n'), ((968, 988), 'traitlets.Instance', 'T.Instance', (['W.Output'], {}), '(W.Output)\n', (978, 988), True, 'import traitlets as T\n'), ((1013, 1034), 'traitlets.Instance', 'T.Instance', (['DataFrame'], {}), '(DataFrame)\n', (1023, 1034), True, 'import traitlets as T\n'), ((2319, 2337), 'traitlets.default', 'T.default', (['"""graph"""'], {}), "('graph')\n", (2328, 2337), True, 'import traitlets as T\n'), ((2401, 2418), 'traitlets.default', 'T.default', (['"""grid"""'], {}), "('grid')\n", (2410, 2418), True, 'import traitlets as T\n'), ((2514, 2537), 'traitlets.default', 'T.default', (['"""run_button"""'], {}), "('run_button')\n", (2523, 2537), True, 'import traitlets as T\n'), ((2387, 2394), 'rdflib.Graph', 'Graph', ([], {}), '()\n', (2392, 2394), False, 'from rdflib import Graph, URIRef\n'), ((2594, 2709), 'ipywidgets.Button', 'W.Button', ([], {'description': '"""Run Query"""', 'icon': '"""search"""', 'tooltip': '"""Click to execute query with current configuration."""'}), "(description='Run Query', icon='search', tooltip=\n 'Click to execute query with current configuration.')\n", (2602, 2709), True, 'import ipywidgets as W\n')]
|
from django.db import models
class Course(models.Model):
identifier = models.CharField('ID', max_length=100, unique=True)
title = models.CharField('Published title', max_length=100)
url = models.CharField('Url', max_length=100)
image_240x135 = models.URLField('Image 240x135')
image_480x270 = models.URLField('Image 480x270')
def __str__(self):
return self.title
class Meta:
verbose_name = 'Course'
verbose_name_plural = 'Courses'
ordering = ['-pk']
|
[
"django.db.models.CharField",
"django.db.models.URLField"
] |
[((76, 127), 'django.db.models.CharField', 'models.CharField', (['"""ID"""'], {'max_length': '(100)', 'unique': '(True)'}), "('ID', max_length=100, unique=True)\n", (92, 127), False, 'from django.db import models\n'), ((140, 191), 'django.db.models.CharField', 'models.CharField', (['"""Published title"""'], {'max_length': '(100)'}), "('Published title', max_length=100)\n", (156, 191), False, 'from django.db import models\n'), ((202, 241), 'django.db.models.CharField', 'models.CharField', (['"""Url"""'], {'max_length': '(100)'}), "('Url', max_length=100)\n", (218, 241), False, 'from django.db import models\n'), ((262, 294), 'django.db.models.URLField', 'models.URLField', (['"""Image 240x135"""'], {}), "('Image 240x135')\n", (277, 294), False, 'from django.db import models\n'), ((315, 347), 'django.db.models.URLField', 'models.URLField', (['"""Image 480x270"""'], {}), "('Image 480x270')\n", (330, 347), False, 'from django.db import models\n')]
|
"""
This module implements the intermediates computation for plot(df) function.
""" # pylint: disable=too-many-lines
from collections import defaultdict
from typing import Any, DefaultDict, Dict, List, Optional, Tuple, Union, cast
import dask
import dask.array as da
import dask.dataframe as dd
import numpy as np
import pandas as pd
from dask.array.stats import kurtosis, skew
from nltk.stem import PorterStemmer, WordNetLemmatizer
from scipy.stats import gaussian_kde
from ...assets.english_stopwords import english_stopwords
from ...errors import UnreachableError
from ..dtypes import (
Continuous,
DateTime,
DType,
DTypeDef,
Nominal,
detect_dtype,
drop_null,
is_dtype,
)
from ..intermediate import Intermediate
from ..utils import to_dask
__all__ = ["compute"]
# Dictionary for mapping the time unit to its formatting. Each entry is of the
# form unit:(unit code for pd.Grouper freq parameter, pandas to_period strftime
# formatting for line charts, pandas to_period strftime formatting for box plot,
# label format).
DTMAP = {
"year": ("Y", "%Y", "%Y", "Year"),
"quarter": ("Q", "Q%q %Y", "Q%q %Y", "Quarter"),
"month": ("M", "%B %Y", "%b %Y", "Month"),
"week": ("W-SAT", "%d %B, %Y", "%d %b, %Y", "Week of"),
"day": ("D", "%d %B, %Y", "%d %b, %Y", "Date"),
"hour": ("H", "%d %B, %Y, %I %p", "%d %b, %Y, %I %p", "Hour"),
"minute": ("T", "%d %B, %Y, %I:%M %p", "%d %b, %Y, %I:%M %p", "Minute"),
"second": ("S", "%d %B, %Y, %I:%M:%S %p", "%d %b, %Y, %I:%M:%S %p", "Second"),
}
def compute(
df: Union[pd.DataFrame, dd.DataFrame],
x: Optional[str] = None,
y: Optional[str] = None,
z: Optional[str] = None,
*,
bins: int = 10,
ngroups: int = 10,
largest: bool = True,
nsubgroups: int = 5,
timeunit: str = "auto",
agg: str = "mean",
sample_size: int = 1000,
top_words: int = 30,
stopword: bool = True,
lemmatize: bool = False,
stem: bool = False,
value_range: Optional[Tuple[float, float]] = None,
dtype: Optional[DTypeDef] = None,
) -> Intermediate:
"""
Parameters
----------
df
Dataframe from which plots are to be generated
x: Optional[str], default None
A valid column name from the dataframe
y: Optional[str], default None
A valid column name from the dataframe
z: Optional[str], default None
A valid column name from the dataframe
bins: int, default 10
For a histogram or box plot with numerical x axis, it defines
the number of equal-width bins to use when grouping.
ngroups: int, default 10
When grouping over a categorical column, it defines the
number of groups to show in the plot. Ie, the number of
bars to show in a bar chart.
largest: bool, default True
If true, when grouping over a categorical column, the groups
with the largest count will be output. If false, the groups
with the smallest count will be output.
nsubgroups: int, default 5
If x and y are categorical columns, ngroups refers to
how many groups to show from column x, and nsubgroups refers to
how many subgroups to show from column y in each group in column x.
timeunit: str, default "auto"
Defines the time unit to group values over for a datetime column.
It can be "year", "quarter", "month", "week", "day", "hour",
"minute", "second". With default value "auto", it will use the
time unit such that the resulting number of groups is closest to 15.
agg: str, default "mean"
Specify the aggregate to use when aggregating over a numeric column
sample_size: int, default 1000
Sample size for the scatter plot
top_words: int, default 30
Specify the amount of words to show in the wordcloud and
word frequency bar chart
stopword: bool, default True
Eliminate the stopwords in the text data for plotting wordcloud and
word frequency bar chart
lemmatize: bool, default False
Lemmatize the words in the text data for plotting wordcloud and
word frequency bar chart
stem: bool, default False
Apply Potter Stem on the text data for plotting wordcloud and
word frequency bar chart
value_range: Optional[Tuple[float, float]], default None
The lower and upper bounds on the range of a numerical column.
Applies when column x is specified and column y is unspecified.
dtype: str or DType or dict of str or dict of DType, default None
Specify Data Types for designated column or all columns.
E.g. dtype = {"a": Continuous, "b": "Nominal"} or
dtype = {"a": Continuous(), "b": "nominal"}
or dtype = Continuous() or dtype = "Continuous" or dtype = Continuous()
""" # pylint: disable=too-many-locals
df = to_dask(df)
if not any((x, y, z)):
return compute_overview(df, bins, ngroups, largest, timeunit, dtype)
if sum(v is None for v in (x, y, z)) == 2:
col: str = cast(str, x or y or z)
return compute_univariate(
df,
col,
bins,
ngroups,
largest,
timeunit,
top_words,
stopword,
lemmatize,
stem,
value_range,
dtype,
)
if sum(v is None for v in (x, y, z)) == 1:
x, y = (v for v in (x, y, z) if v is not None)
return compute_bivariate(
df,
x,
y,
bins,
ngroups,
largest,
nsubgroups,
timeunit,
agg,
sample_size,
dtype,
)
if x is not None and y is not None and z is not None:
return compute_trivariate(df, x, y, z, ngroups, largest, timeunit, agg, dtype)
return Intermediate()
def compute_overview(
df: dd.DataFrame,
bins: int,
ngroups: int,
largest: bool,
timeunit: str,
dtype: Optional[DTypeDef] = None,
) -> Intermediate:
# pylint: disable=too-many-arguments,too-many-locals
"""
Compute functions for plot(df)
Parameters
----------
df
Dataframe from which plots are to be generated
bins
For a histogram or box plot with numerical x axis, it defines
the number of equal-width bins to use when grouping.
ngroups
When grouping over a categorical column, it defines the
number of groups to show in the plot. Ie, the number of
bars to show in a bar chart.
largest
If true, when grouping over a categorical column, the groups
with the largest count will be output. If false, the groups
with the smallest count will be output.
timeunit
Defines the time unit to group values over for a datetime column.
It can be "year", "quarter", "month", "week", "day", "hour",
"minute", "second". With default value "auto", it will use the
time unit such that the resulting number of groups is closest to 15.
dtype: str or DType or dict of str or dict of DType, default None
Specify Data Types for designated column or all columns.
E.g. dtype = {"a": Continuous, "b": "Nominal"} or
dtype = {"a": Continuous(), "b": "nominal"}
or dtype = Continuous() or dtype = "Continuous" or dtype = Continuous()
"""
# extract the first rows for checking if a column contains a mutable type
first_rows: pd.DataFrame = df.head() # dd.DataFrame.head triggers a (small) data read
datas: List[Any] = []
dtype_cnts: DefaultDict[str, int] = defaultdict(int)
col_names_dtypes: List[Tuple[str, DType]] = []
for column in df.columns:
srs = df[column]
column_dtype = detect_dtype(srs, dtype)
if is_dtype(column_dtype, Nominal()):
# cast the column as string type if it contains a mutable type
try:
first_rows[column].apply(hash)
except TypeError:
srs = df[column] = srs.dropna().astype(str)
# bar chart
datas.append(calc_bar(srs, ngroups, largest))
col_names_dtypes.append((column, Nominal()))
dtype_cnts["Categorical"] += 1
elif is_dtype(column_dtype, Continuous()):
# histogram
hist = da.histogram(drop_null(srs), bins=bins, range=[srs.min(), srs.max()])
datas.append(hist)
col_names_dtypes.append((column, Continuous()))
dtype_cnts["Numerical"] += 1
elif is_dtype(column_dtype, DateTime()):
datas.append(dask.delayed(calc_line_dt)(df[[column]], timeunit))
col_names_dtypes.append((column, DateTime()))
dtype_cnts["DateTime"] += 1
else:
raise UnreachableError
stats = calc_stats(df, dtype_cnts)
datas, stats = dask.compute(datas, stats)
data = [(col, dtp, dat) for (col, dtp), dat in zip(col_names_dtypes, datas)]
return Intermediate(data=data, stats=stats, visual_type="distribution_grid",)
def compute_univariate(
df: dd.DataFrame,
x: str,
bins: int,
ngroups: int,
largest: bool,
timeunit: str,
top_words: int,
stopword: bool = True,
lemmatize: bool = False,
stem: bool = False,
value_range: Optional[Tuple[float, float]] = None,
dtype: Optional[DTypeDef] = None,
) -> Intermediate:
"""
Compute functions for plot(df, x)
Parameters
----------
df
Dataframe from which plots are to be generated
x
A valid column name from the dataframe
bins
For a histogram or box plot with numerical x axis, it defines
the number of equal-width bins to use when grouping.
ngroups
When grouping over a categorical column, it defines the
number of groups to show in the plot. Ie, the number of
bars to show in a bar chart.
largest
If true, when grouping over a categorical column, the groups
with the largest count will be output. If false, the groups
with the smallest count will be output.
timeunit
Defines the time unit to group values over for a datetime column.
It can be "year", "quarter", "month", "week", "day", "hour",
"minute", "second". With default value "auto", it will use the
time unit such that the resulting number of groups is closest to 15.
top_words: int, default 30
Specify the amount of words to show in the wordcloud and
word frequency bar chart
stopword: bool, default True
Eliminate the stopwords in the text data for plotting wordcloud and
word frequency bar chart
lemmatize: bool, default False
Lemmatize the words in the text data for plotting wordcloud and
word frequency bar chart
stem: bool, default False
Apply Potter Stem on the text data for plotting wordcloud and
word frequency bar chart
value_range
The lower and upper bounds on the range of a numerical column.
Applies when column x is specified and column y is unspecified.
dtype: str or DType or dict of str or dict of DType, default None
Specify Data Types for designated column or all columns.
E.g. dtype = {"a": Continuous, "b": "Nominal"} or
dtype = {"a": Continuous(), "b": "nominal"}
or dtype = Continuous() or dtype = "Continuous" or dtype = Continuous()
"""
# pylint: disable=too-many-locals, too-many-arguments
col_dtype = detect_dtype(df[x], dtype)
if is_dtype(col_dtype, Nominal()):
# extract the column
df_x = df[x]
# calculate the total rows
nrows = df_x.shape[0]
# cast the column as string type if it contains a mutable type
if df_x.head().apply(lambda x: hasattr(x, "__hash__")).any():
# drop_null() will not work if the column conatains a mutable type
df_x = df_x.dropna().astype(str)
# drop null values
df_x = drop_null(df_x)
# calc_word_freq() returns the frequency of words (for the word cloud and word
# frequency bar chart) and the total number of words
word_data = calc_word_freq(df_x, top_words, stopword, lemmatize, stem)
# calc_cat_stats() computes all the categorical stats including the length
# histogram. calc_bar_pie() does the calculations for the bar and pie charts
# NOTE this dictionary could be returned to create_report without
# calling the subsequent compute
cat_data = {
"stats": calc_cat_stats(df_x, nrows, bins),
"bar_pie": calc_bar_pie(df_x, ngroups, largest),
"word_data": word_data,
}
cat_data = dask.compute(cat_data)[0]
return Intermediate(
col=x,
stats=cat_data["stats"],
bar_pie=cat_data["bar_pie"],
word_data=cat_data["word_data"],
visual_type="categorical_column",
)
elif is_dtype(col_dtype, Continuous()):
# calculate the total number of rows then drop the missing values
nrows = df.shape[0]
df_x = drop_null(df[x])
if value_range is not None:
df_x = df_x[df_x.between(*value_range)]
# TODO perhaps we should not use to_dask() on the entire
# initial dataframe and instead only use the column of data
# df_x = df_x.repartition(partition_size="100MB")
# calculate numerical statistics and extract the min and max
num_stats = calc_num_stats(df_x, nrows)
minv, maxv = num_stats["min"], num_stats["max"]
# NOTE this dictionary could be returned to create_report without
# calling the subsequent compute
num_data = {
"hist": da.histogram(df_x, bins=bins, range=[minv, maxv]),
"kde": calc_kde(df_x, bins, minv, maxv),
"box_data": calc_box_new(df_x, num_stats["qntls"]),
"stats": num_stats,
}
num_data = dask.compute(num_data)[0]
return Intermediate(
col=x,
hist=num_data["hist"],
kde=num_data["kde"],
box_data=num_data["box_data"],
stats=num_data["stats"],
visual_type="numerical_column",
)
elif is_dtype(col_dtype, DateTime()):
data_dt: List[Any] = []
# line chart
data_dt.append(dask.delayed(calc_line_dt)(df[[x]], timeunit))
# stats
data_dt.append(dask.delayed(calc_stats_dt)(df[x]))
data, statsdata_dt = dask.compute(*data_dt)
return Intermediate(
col=x, data=data, stats=statsdata_dt, visual_type="datetime_column",
)
else:
raise UnreachableError
def compute_bivariate(
df: dd.DataFrame,
x: str,
y: str,
bins: int,
ngroups: int,
largest: bool,
nsubgroups: int,
timeunit: str,
agg: str,
sample_size: int,
dtype: Optional[DTypeDef] = None,
) -> Intermediate:
"""
Compute functions for plot(df, x, y)
Parameters
----------
df
Dataframe from which plots are to be generated
x
A valid column name from the dataframe
y
A valid column name from the dataframe
bins
For a histogram or box plot with numerical x axis, it defines
the number of equal-width bins to use when grouping.
ngroups
When grouping over a categorical column, it defines the
number of groups to show in the plot. Ie, the number of
bars to show in a bar chart.
largest
If true, when grouping over a categorical column, the groups
with the largest count will be output. If false, the groups
with the smallest count will be output.
nsubgroups
If x and y are categorical columns, ngroups refers to
how many groups to show from column x, and nsubgroups refers to
how many subgroups to show from column y in each group in column x.
timeunit
Defines the time unit to group values over for a datetime column.
It can be "year", "quarter", "month", "week", "day", "hour",
"minute", "second". With default value "auto", it will use the
time unit such that the resulting number of groups is closest to 15.
agg
Specify the aggregate to use when aggregating over a numeric column
sample_size
Sample size for the scatter plot
dtype: str or DType or dict of str or dict of DType, default None
Specify Data Types for designated column or all columns.
E.g. dtype = {"a": Continuous, "b": "Nominal"} or
dtype = {"a": Continuous(), "b": "nominal"}
or dtype = Continuous() or dtype = "Continuous" or dtype = Continuous()
"""
# pylint: disable=too-many-arguments,too-many-locals
xtype = detect_dtype(df[x], dtype)
ytype = detect_dtype(df[y], dtype)
if (
is_dtype(xtype, Nominal())
and is_dtype(ytype, Continuous())
or is_dtype(xtype, Continuous())
and is_dtype(ytype, Nominal())
):
x, y = (x, y) if is_dtype(xtype, Nominal()) else (y, x)
df = drop_null(df[[x, y]])
df[x] = df[x].apply(str, meta=(x, str))
# box plot per group
boxdata = calc_box(df, bins, ngroups, largest, dtype)
# histogram per group
hisdata = calc_hist_by_group(df, bins, ngroups, largest)
return Intermediate(
x=x, y=y, boxdata=boxdata, histdata=hisdata, visual_type="cat_and_num_cols",
)
elif (
is_dtype(xtype, DateTime())
and is_dtype(ytype, Continuous())
or is_dtype(xtype, Continuous())
and is_dtype(ytype, DateTime())
):
x, y = (x, y) if is_dtype(xtype, DateTime()) else (y, x)
df = drop_null(df[[x, y]])
dtnum: List[Any] = []
# line chart
dtnum.append(dask.delayed(calc_line_dt)(df, timeunit, agg))
# box plot
dtnum.append(dask.delayed(calc_box_dt)(df, timeunit))
dtnum = dask.compute(*dtnum)
return Intermediate(
x=x,
y=y,
linedata=dtnum[0],
boxdata=dtnum[1],
visual_type="dt_and_num_cols",
)
elif (
is_dtype(xtype, DateTime())
and is_dtype(ytype, Nominal())
or is_dtype(xtype, Nominal())
and is_dtype(ytype, DateTime())
):
x, y = (x, y) if is_dtype(xtype, DateTime()) else (y, x)
df = drop_null(df[[x, y]])
df[y] = df[y].apply(str, meta=(y, str))
dtcat: List[Any] = []
# line chart
dtcat.append(
dask.delayed(calc_line_dt)(df, timeunit, ngroups=ngroups, largest=largest)
)
# stacked bar chart
dtcat.append(dask.delayed(calc_stacked_dt)(df, timeunit, ngroups, largest))
dtcat = dask.compute(*dtcat)
return Intermediate(
x=x,
y=y,
linedata=dtcat[0],
stackdata=dtcat[1],
visual_type="dt_and_cat_cols",
)
elif is_dtype(xtype, Nominal()) and is_dtype(ytype, Nominal()):
df = drop_null(df[[x, y]])
df[x] = df[x].apply(str, meta=(x, str))
df[y] = df[y].apply(str, meta=(y, str))
# nested bar chart
nesteddata = calc_nested(df, ngroups, nsubgroups)
# stacked bar chart
stackdata = calc_stacked(df, ngroups, nsubgroups)
# heat map
heatmapdata = calc_heatmap(df, ngroups, nsubgroups)
return Intermediate(
x=x,
y=y,
nesteddata=nesteddata,
stackdata=stackdata,
heatmapdata=heatmapdata,
visual_type="two_cat_cols",
)
elif is_dtype(xtype, Continuous()) and is_dtype(ytype, Continuous()):
df = drop_null(df[[x, y]])
# scatter plot
scatdata = calc_scatter(df, sample_size)
# hexbin plot
hexbindata = df.compute()
# box plot
boxdata = calc_box(df, bins)
return Intermediate(
x=x,
y=y,
scatdata=scatdata,
boxdata=boxdata,
hexbindata=hexbindata,
spl_sz=sample_size,
visual_type="two_num_cols",
)
else:
raise UnreachableError
def compute_trivariate(
df: dd.DataFrame,
x: str,
y: str,
z: str,
ngroups: int,
largest: bool,
timeunit: str,
agg: str,
dtype: Optional[DTypeDef] = None,
) -> Intermediate:
"""
Compute functions for plot(df, x, y, z)
Parameters
----------
df
Dataframe from which plots are to be generated
x
A valid column name from the dataframe
y
A valid column name from the dataframe
z
A valid column name from the dataframe
bins
For a histogram or box plot with numerical x axis, it defines
the number of equal-width bins to use when grouping.
ngroups
When grouping over a categorical column, it defines the
number of groups to show in the plot. Ie, the number of
bars to show in a bar chart.
largest
If true, when grouping over a categorical column, the groups
with the largest count will be output. If false, the groups
with the smallest count will be output.
timeunit
Defines the time unit to group values over for a datetime column.
It can be "year", "quarter", "month", "week", "day", "hour",
"minute", "second". With default value "auto", it will use the
time unit such that the resulting number of groups is closest to 15.
agg
Specify the aggregate to use when aggregating over a numeric column
dtype: str or DType or dict of str or dict of DType, default None
Specify Data Types for designated column or all columns.
E.g. dtype = {"a": Continuous, "b": "Nominal"} or
dtype = {"a": Continuous(), "b": "nominal"}
or dtype = Continuous() or dtype = "Continuous" or dtype = Continuous()
"""
# pylint: disable=too-many-arguments
xtype = detect_dtype(df[x], dtype)
ytype = detect_dtype(df[y], dtype)
ztype = detect_dtype(df[z], dtype)
if (
is_dtype(xtype, DateTime())
and is_dtype(ytype, Nominal())
and is_dtype(ztype, Continuous())
):
y, z = z, y
elif (
is_dtype(xtype, Continuous())
and is_dtype(ytype, DateTime())
and is_dtype(ztype, Nominal())
):
x, y = y, x
elif (
is_dtype(xtype, Continuous())
and is_dtype(ytype, Nominal())
and is_dtype(ztype, DateTime())
):
x, y, z = z, x, y
elif (
is_dtype(xtype, Nominal())
and is_dtype(ytype, DateTime())
and is_dtype(ztype, Continuous())
):
x, y, z = y, z, x
elif (
is_dtype(xtype, Nominal())
and is_dtype(ytype, Continuous())
and is_dtype(ztype, DateTime())
):
x, z = z, x
assert (
is_dtype(xtype, DateTime())
and is_dtype(ytype, Continuous())
and is_dtype(ztype, Nominal())
), "x, y, and z must be one each of type datetime, numerical, and categorical"
df = drop_null(df[[x, y, z]])
df[z] = df[z].apply(str, meta=(z, str))
# line chart
data = dask.compute(dask.delayed(calc_line_dt)(df, timeunit, agg, ngroups, largest))
return Intermediate(
x=x, y=y, z=z, agg=agg, data=data[0], visual_type="dt_cat_num_cols",
)
def calc_line_dt(
df: dd.DataFrame,
unit: str,
agg: Optional[str] = None,
ngroups: Optional[int] = None,
largest: Optional[bool] = None,
) -> Union[
Tuple[pd.DataFrame, Dict[str, int], str],
Tuple[pd.DataFrame, str, float],
Tuple[pd.DataFrame, str],
]:
"""
Calculate a line or multiline chart with date on the x axis. If df contains
one datetime column, it will make a line chart of the frequency of values. If
df contains a datetime and categorical column, it will compute the frequency
of each categorical value in each time group. If df contains a datetime and
numerical column, it will compute the aggregate of the numerical column grouped
by the time groups. If df contains a datetime, categorical, and numerical column,
it will compute the aggregate of the numerical column for values in the categorical
column grouped by time.
Parameters
----------
df
A dataframe
unit
The unit of time over which to group the values
agg
Aggregate to use for the numerical column
ngroups
Number of groups for the categorical column
largest
Use the largest or smallest groups in the categorical column
"""
# pylint: disable=too-many-locals
x = df.columns[0] # time column
unit = _get_timeunit(df[x].min(), df[x].max(), 100) if unit == "auto" else unit
if unit not in DTMAP.keys():
raise ValueError
grouper = pd.Grouper(key=x, freq=DTMAP[unit][0]) # for grouping the time values
# multiline charts
if ngroups and largest:
hist_dict: Dict[str, Tuple[np.ndarray, np.ndarray, List[str]]] = dict()
hist_lst: List[Tuple[np.ndarray, np.ndarray, List[str]]] = list()
agg = (
"freq" if agg is None else agg
) # default agg if unspecified for notational concision
# categorical column for grouping over, each resulting group is a line in the chart
grpby_col = df.columns[1] if len(df.columns) == 2 else df.columns[2]
df, grp_cnt_stats, largest_grps = _calc_groups(df, grpby_col, ngroups, largest)
groups = df.groupby([grpby_col])
for grp in largest_grps:
srs = groups.get_group(grp)
# calculate the frequencies or aggregate value in each time group
if len(df.columns) == 3:
dfr = srs.groupby(grouper)[df.columns[1]].agg(agg).reset_index()
else:
dfr = srs[x].to_frame().groupby(grouper).size().reset_index()
dfr.columns = [x, agg]
# if grouping by week, make the label for the week the beginning Sunday
dfr[x] = dfr[x] - pd.to_timedelta(6, unit="d") if unit == "week" else dfr[x]
# format the label
dfr["lbl"] = dfr[x].dt.to_period("S").dt.strftime(DTMAP[unit][1])
hist_lst.append((list(dfr[agg]), list(dfr[x]), list(dfr["lbl"])))
hist_lst = dask.compute(*hist_lst)
for elem in zip(largest_grps, hist_lst):
hist_dict[elem[0]] = elem[1]
return hist_dict, grp_cnt_stats, DTMAP[unit][3]
# single line charts
if agg is None: # frequency of datetime column
miss_pct = round(df[x].isna().sum() / len(df) * 100, 1)
dfr = drop_null(df).groupby(grouper).size().reset_index()
dfr.columns = [x, "freq"]
dfr["pct"] = dfr["freq"] / len(df) * 100
else: # aggregate over a second column
dfr = df.groupby(grouper)[df.columns[1]].agg(agg).reset_index()
dfr.columns = [x, agg]
dfr[x] = dfr[x] - pd.to_timedelta(6, unit="d") if unit == "week" else dfr[x]
dfr["lbl"] = dfr[x].dt.to_period("S").dt.strftime(DTMAP[unit][1])
return (dfr, DTMAP[unit][3], miss_pct) if agg is None else (dfr, DTMAP[unit][3])
def calc_box_dt(
df: dd.DataFrame, unit: str
) -> Tuple[pd.DataFrame, List[str], List[float], str]:
"""
Calculate a box plot with date on the x axis.
Parameters
----------
df
A dataframe with one datetime and one numerical column
unit
The unit of time over which to group the values
"""
x, y = df.columns[0], df.columns[1] # time column
unit = _get_timeunit(df[x].min(), df[x].max(), 10) if unit == "auto" else unit
if unit not in DTMAP.keys():
raise ValueError
grps = df.groupby(pd.Grouper(key=x, freq=DTMAP[unit][0])) # time groups
# box plot for the values in each time group
df = pd.concat([_calc_box_stats(g[1][y], g[0], True) for g in grps], axis=1,)
df = df.append(pd.Series({c: i + 1 for i, c in enumerate(df.columns)}, name="x",)).T
# If grouping by week, make the label for the week the beginning Sunday
df.index = df.index - pd.to_timedelta(6, unit="d") if unit == "week" else df.index
df.index.name = "grp"
df = df.reset_index()
df["grp"] = df["grp"].dt.to_period("S").dt.strftime(DTMAP[unit][2])
df["x0"], df["x1"] = df["x"] - 0.8, df["x"] - 0.2 # width of whiskers for plotting
outx, outy = _calc_box_otlrs(df)
return df, outx, outy, DTMAP[unit][3]
def calc_stacked_dt(
df: dd.DataFrame, unit: str, ngroups: int, largest: bool,
) -> Tuple[pd.DataFrame, Dict[str, int], str]:
"""
Calculate a stacked bar chart with date on the x axis
Parameters
----------
df
A dataframe with one datetime and one categorical column
unit
The unit of time over which to group the values
ngroups
Number of groups for the categorical column
largest
Use the largest or smallest groups in the categorical column
"""
# pylint: disable=too-many-locals
x, y = df.columns[0], df.columns[1] # time column
unit = _get_timeunit(df[x].min(), df[x].max(), 10) if unit == "auto" else unit
if unit not in DTMAP.keys():
raise ValueError
# get the largest groups
df_grps, grp_cnt_stats, _ = _calc_groups(df, y, ngroups, largest)
grouper = (pd.Grouper(key=x, freq=DTMAP[unit][0]),) # time grouper
# pivot table of counts with date groups as index and categorical values as column names
dfr = pd.pivot_table(
df_grps, index=grouper, columns=y, aggfunc=len, fill_value=0,
).rename_axis(None)
# if more than ngroups categorical values, aggregate the smallest groups into "Others"
if grp_cnt_stats[f"{y}_ttl"] > grp_cnt_stats[f"{y}_shw"]:
grp_cnts = df.groupby(pd.Grouper(key=x, freq=DTMAP[unit][0])).size()
dfr["Others"] = grp_cnts - dfr.sum(axis=1)
dfr.index = ( # If grouping by week, make the label for the week the beginning Sunday
dfr.index - pd.to_timedelta(6, unit="d") if unit == "week" else dfr.index
)
dfr.index = dfr.index.to_period("S").strftime(DTMAP[unit][2]) # format labels
return dfr, grp_cnt_stats, DTMAP[unit][3]
def calc_bar(
srs: dd.Series, ngroups: int, largest: bool
) -> Tuple[dd.DataFrame, dd.core.Scalar, dd.core.Scalar]:
"""
Calculates the counts of categorical values, the total number of
categorical values, and the number of non-null cells required
for a bar chart in plot(df).
Parameters
----------
srs
One categorical column
ngroups
Number of groups to return
largest
If true, show the groups with the largest count,
else show the groups with the smallest count
"""
# drop null values
srs_present = drop_null(srs)
# number of present (not null) values
npresent = srs_present.shape[0]
# counts of unique values in the series
grps = srs_present.value_counts(sort=False)
# total number of groups
ttl_grps = grps.shape[0]
# select the largest or smallest groups
fnl_grp_cnts = grps.nlargest(ngroups) if largest else grps.nsmallest(ngroups)
return fnl_grp_cnts.to_frame(), ttl_grps, npresent
def calc_bar_pie(
srs: dd.Series, ngroups: int, largest: bool
) -> Tuple[dd.DataFrame, dd.core.Scalar]:
"""
Calculates the counts of categorical values and the total number of
categorical values required for the bar and pie charts in plot(df, x).
Parameters
----------
srs
One categorical column
ngroups
Number of groups to return
largest
If true, show the groups with the largest count,
else show the groups with the smallest count
"""
# counts of unique values in the series
grps = srs.value_counts(sort=False)
# total number of groups
ttl_grps = grps.shape[0]
# select the largest or smallest groups
fnl_grp_cnts = grps.nlargest(ngroups) if largest else grps.nsmallest(ngroups)
return fnl_grp_cnts.to_frame(), ttl_grps
def calc_word_freq(
srs: dd.Series,
top_words: int = 30,
stopword: bool = True,
lemmatize: bool = False,
stem: bool = False,
) -> Tuple[dd.Series, dd.core.Scalar]:
"""
Parse a categorical column of text data into words, and then
compute the frequency distribution of words and the total
number of words.
Parameters
----------
srs
One categorical column
top_words
Number of highest frequency words to show in the
wordcloud and word frequency bar chart
stopword
If True, remove stop words, else keep them
lemmatize
If True, lemmatize the words before computing
the word frequencies, else don't
stem
If True, extract the stem of the words before
computing the word frequencies, else don't
"""
# pylint: disable=unnecessary-lambda
if stopword:
# use a regex to replace stop words with empty string
srs = srs.str.replace(r"\b(?:{})\b".format("|".join(english_stopwords)), "")
# replace all non-alphanumeric characters with an empty string, and convert to lowercase
srs = srs.str.replace(r"[^\w+ ]", "").str.lower()
# split each string on whitespace into words then apply "explode()" to "stack" all
# the words into a series
# NOTE this is slow. One possibly better solution: after .split(), count the words
# immediately rather than create a new series with .explode() and apply
# .value_counts()
srs = srs.str.split().explode()
# lemmatize and stem
if lemmatize or stem:
srs = srs.dropna()
if lemmatize:
lem = WordNetLemmatizer()
srs = srs.apply(lambda x: lem.lemmatize(x), meta=(srs.name, "object"))
if stem:
porter = PorterStemmer()
srs = srs.apply(lambda x: porter.stem(x), meta=(srs.name, "object"))
# counts of words, excludes null values
word_cnts = srs.value_counts(sort=False)
# total number of words
nwords = word_cnts.sum()
# words with the highest frequency
fnl_word_cnts = word_cnts.nlargest(n=top_words)
return fnl_word_cnts, nwords
def calc_kde(
srs: dd.Series, bins: int, minv: float, maxv: float,
) -> Tuple[Tuple[da.core.Array, da.core.Array], np.ndarray]:
"""
Calculate a density histogram and its corresponding kernel density
estimate over a given series. The kernel is Gaussian.
Parameters
----------
data
One numerical column over which to compute the histogram and kde
bins
Number of bins to use in the histogram
"""
# compute the density histogram
hist = da.histogram(srs, bins=bins, range=[minv, maxv], density=True)
# probability density function for the series
# NOTE gaussian_kde triggers a .compute()
try:
kde = gaussian_kde(
srs.map_partitions(lambda x: x.sample(min(1000, x.shape[0])), meta=srs)
)
except np.linalg.LinAlgError:
kde = None
return hist, kde
def calc_box_new(srs: dd.Series, qntls: dd.Series) -> Dict[str, Any]:
"""
Calculate the data required for a box plot
Parameters
----------
srs
One numerical column from which to compute the box plot data
qntls
Quantiles from the normal Q-Q plot
"""
# box plot stats
# inter-quartile range
# TODO figure out how to extract a scalar from a Dask series without using a function like sum()
qrtl1 = qntls.loc[0.25].sum()
qrtl3 = qntls.loc[0.75].sum()
iqr = qrtl3 - qrtl1
srs_iqr = srs[srs.between(qrtl1 - 1.5 * iqr, qrtl3 + 1.5 * iqr)]
# outliers
otlrs = srs[~srs.between(qrtl1 - 1.5 * iqr, qrtl3 + 1.5 * iqr)]
# randomly sample at most 100 outliers from each partition without replacement
otlrs = otlrs.map_partitions(lambda x: x.sample(min(100, x.shape[0])), meta=otlrs)
box_data = {
"grp": srs.name,
"q1": qrtl1,
"q2": qntls.loc[0.5].sum(),
"q3": qrtl3,
"lw": srs_iqr.min(),
"uw": srs_iqr.max(),
"otlrs": otlrs.values,
"x": 1, # x, x0, and x1 are for plotting the box plot with bokeh
"x0": 0.2,
"x1": 0.8,
}
return box_data
def calc_stats(
df: dd.DataFrame, dtype_cnts: Dict[str, int]
) -> Dict[str, Union[int, dd.core.Scalar, Dict[str, int]]]:
"""
Calculate the statistics for plot(df) from a DataFrame
Parameters
----------
df
a DataFrame
dtype_cnts
a dictionary that contains the count for each type
"""
stats = {
"nrows": df.shape[0],
"ncols": df.shape[1],
"npresent_cells": df.count().sum(),
"nrows_wo_dups": df.drop_duplicates().shape[0],
"mem_use": df.memory_usage(deep=True).sum(),
"dtype_cnts": dtype_cnts,
}
return stats
def calc_num_stats(srs: dd.Series, nrows: dd.core.Scalar,) -> Dict[str, Any]:
"""
Calculate statistics for a numerical column
Parameters
----------
srs
a numerical column
nrows
number of rows in the column before dropping null values
"""
stats = {
"nrows": nrows,
"npresent": srs.shape[0],
"nunique": srs.nunique(),
"ninfinite": ((srs == np.inf) | (srs == -np.inf)).sum(),
"nzero": (srs == 0).sum(),
"min": srs.min(),
"max": srs.max(),
"qntls": srs.quantile(np.linspace(0.01, 0.99, 99)),
"mean": srs.mean(),
"std": srs.std(),
"skew": skew(srs),
"kurt": kurtosis(srs),
"mem_use": srs.memory_usage(),
}
return stats
def calc_cat_stats(
srs: dd.Series, nrows: int, bins: int,
) -> Tuple[Dict[str, Any], Dict[str, Any], Dict[str, Any]]:
"""
Calculate stats for a categorical column
Parameters
----------
srs
a categorical column
nrows
number of rows before dropping null values
bins
number of bins for the category length frequency histogram
"""
# overview stats
stats = {
"nrows": nrows,
"npresent": srs.shape[0],
"nunique": srs.nunique(),
"mem_use": srs.memory_usage(),
"first_rows": srs.loc[:4],
}
# length stats
lengths = srs.str.len()
minv, maxv = lengths.min(), lengths.max()
hist = da.histogram(lengths.values, bins=bins, range=[minv, maxv])
length_stats = {
"Mean": lengths.mean(),
"Median": lengths.quantile(0.5),
"Minimum": minv,
"Maximum": maxv,
"hist": hist,
}
# letter stats
letter_stats = {
"Count": srs.str.count(r"[a-zA-Z]").sum(),
"Lowercase Letter": srs.str.count(r"[a-z]").sum(),
"Space Separator": srs.str.count(r"[ ]").sum(),
"Uppercase Letter": srs.str.count(r"[A-Z]").sum(),
"Dash Punctuation": srs.str.count(r"[-]").sum(),
"Decimal Number": srs.str.count(r"[0-9]").sum(),
}
return stats, length_stats, letter_stats
def calc_box(
df: dd.DataFrame,
bins: int,
ngroups: int = 10,
largest: bool = True,
dtype: Optional[DTypeDef] = None,
) -> Tuple[pd.DataFrame, List[str], List[float], Optional[Dict[str, int]]]:
"""
Compute a box plot over either
1) the values in one column
2) the values corresponding to groups in another column
3) the values corresponding to binning another column
Parameters
----------
df
Dataframe with one or two columns
bins
Number of bins to use if df has two numerical columns
ngroups
Number of groups to show if df has a categorical and numerical column
largest
When calculating a box plot per group, select the largest or smallest groups
dtype: str or DType or dict of str or dict of DType, default None
Specify Data Types for designated column or all columns.
E.g. dtype = {"a": Continuous, "b": "Nominal"} or
dtype = {"a": Continuous(), "b": "nominal"}
or dtype = Continuous() or dtype = "Continuous" or dtype = Continuous()
Returns
-------
Tuple[pd.DataFrame, List[str], List[float], Dict[str, int]]
The box plot statistics in a dataframe, a list of the outlier
groups and another list of the outlier values, a dictionary
logging the sampled group output
"""
# pylint: disable=too-many-locals
grp_cnt_stats = None # to inform the user of sampled output
x = df.columns[0]
if len(df.columns) == 1:
df = _calc_box_stats(df[x], x)
else:
y = df.columns[1]
if is_dtype(detect_dtype(df[x], dtype), Continuous()) and is_dtype(
detect_dtype(df[y], dtype), Continuous()
):
minv, maxv, cnt = dask.compute(df[x].min(), df[x].max(), df[x].nunique())
bins = cnt if cnt < bins else bins
endpts = np.linspace(minv, maxv, num=bins + 1)
# calculate a box plot over each bin
df = dd.concat(
[
_calc_box_stats(
df[(df[x] >= endpts[i]) & (df[x] < endpts[i + 1])][y],
f"[{endpts[i]},{endpts[i + 1]})",
)
if i != len(endpts) - 2
else _calc_box_stats(
df[(df[x] >= endpts[i]) & (df[x] <= endpts[i + 1])][y],
f"[{endpts[i]},{endpts[i + 1]}]",
)
for i in range(len(endpts) - 1)
],
axis=1,
).compute()
endpts_df = pd.DataFrame(
[endpts[:-1], endpts[1:]], ["lb", "ub"], df.columns
)
df = pd.concat([df, endpts_df], axis=0)
else:
df, grp_cnt_stats, largest_grps = _calc_groups(df, x, ngroups, largest)
# calculate a box plot over each group
df = dd.concat(
[_calc_box_stats(df[df[x] == grp][y], grp) for grp in largest_grps],
axis=1,
).compute()
df = df.append(pd.Series({c: i + 1 for i, c in enumerate(df.columns)}, name="x",)).T
df.index.name = "grp"
df = df.reset_index()
df["x0"], df["x1"] = df["x"] - 0.8, df["x"] - 0.2 # width of whiskers for plotting
outx, outy = _calc_box_otlrs(df)
return df, outx, outy, grp_cnt_stats
def calc_hist_by_group(
df: dd.DataFrame, bins: int, ngroups: int, largest: bool
) -> Tuple[pd.DataFrame, Dict[str, int]]:
"""
Compute a histogram over the values corresponding to the groups in another column
Parameters
----------
df
Dataframe with one categorical and one numerical column
bins
Number of bins to use in the histogram
ngroups
Number of groups to show from the categorical column
largest
Select the largest or smallest groups
Returns
-------
Tuple[pd.DataFrame, Dict[str, int]]
The histograms in a dataframe and a dictionary
logging the sampled group output
"""
# pylint: disable=too-many-locals
hist_dict: Dict[str, Tuple[np.ndarray, np.ndarray, List[str]]] = dict()
hist_lst: List[Tuple[np.ndarray, np.ndarray, List[str]]] = list()
df, grp_cnt_stats, largest_grps = _calc_groups(df, df.columns[0], ngroups, largest)
# create a histogram for each group
groups = df.groupby([df.columns[0]])
minv, maxv = dask.compute(df[df.columns[1]].min(), df[df.columns[1]].max())
for grp in largest_grps:
grp_srs = groups.get_group(grp)[df.columns[1]]
hist_arr, bins_arr = da.histogram(grp_srs, range=[minv, maxv], bins=bins)
intervals = _format_bin_intervals(bins_arr)
hist_lst.append((hist_arr, bins_arr, intervals))
hist_lst = dask.compute(*hist_lst)
for elem in zip(largest_grps, hist_lst):
hist_dict[elem[0]] = elem[1]
return hist_dict, grp_cnt_stats
def calc_scatter(df: dd.DataFrame, sample_size: int) -> pd.DataFrame:
"""
Extracts the points to use in a scatter plot
Parameters
----------
df
Dataframe with two numerical columns
sample_size
the number of points to randomly sample in the scatter plot
Returns
-------
pd.DataFrame
A dataframe containing the scatter points
"""
if len(df) > sample_size:
df = df.sample(frac=sample_size / len(df))
return df.compute()
def calc_nested(
df: dd.DataFrame, ngroups: int, nsubgroups: int,
) -> Tuple[pd.DataFrame, Dict[str, int]]:
"""
Calculate a nested bar chart of the counts of two columns
Parameters
----------
df
Dataframe with two categorical columns
ngroups
Number of groups to show from the first column
nsubgroups
Number of subgroups (from the second column) to show in each group
Returns
-------
Tuple[pd.DataFrame, Dict[str, int]]
The bar chart counts in a dataframe and a dictionary
logging the sampled group output
"""
x, y = df.columns[0], df.columns[1]
df, grp_cnt_stats, _ = _calc_groups(df, x, ngroups)
df2 = df.groupby([x, y]).size().reset_index()
max_subcol_cnt = df2.groupby(x).size().max().compute()
df2.columns = [x, y, "cnt"]
df_res = (
df2.groupby(x)[[y, "cnt"]]
.apply(
lambda x: x.nlargest(n=nsubgroups, columns="cnt"),
meta=({y: "f8", "cnt": "i8"}),
)
.reset_index()
.compute()
)
df_res["grp_names"] = list(zip(df_res[x], df_res[y]))
df_res = df_res.drop([x, "level_1", y], axis=1)
grp_cnt_stats[f"{y}_ttl"] = max_subcol_cnt
grp_cnt_stats[f"{y}_shw"] = min(max_subcol_cnt, nsubgroups)
return df_res, grp_cnt_stats
def calc_stacked(
df: dd.DataFrame, ngroups: int, nsubgroups: int,
) -> Tuple[pd.DataFrame, Dict[str, int]]:
"""
Calculate a stacked bar chart of the counts of two columns
Parameters
----------
df
two categorical columns
ngroups
number of groups to show from the first column
nsubgroups
number of subgroups (from the second column) to show in each group
Returns
-------
Tuple[pd.DataFrame, Dict[str, int]]
The bar chart counts in a dataframe and a dictionary
logging the sampled group output
"""
x, y = df.columns[0], df.columns[1]
df, grp_cnt_stats, largest_grps = _calc_groups(df, x, ngroups)
fin_df = pd.DataFrame()
for grp in largest_grps:
df_grp = df[df[x] == grp]
df_res = df_grp.groupby(y).size().nlargest(n=nsubgroups) / len(df_grp) * 100
df_res = df_res.to_frame().compute().T
df_res.columns = list(df_res.columns)
df_res["Others"] = 100 - df_res.sum(axis=1)
fin_df = fin_df.append(df_res, sort=False)
fin_df = fin_df.fillna(value=0)
others = fin_df.pop("Others")
if others.sum() > 1e-4:
fin_df["Others"] = others
fin_df.index = list(largest_grps)
return fin_df, grp_cnt_stats
def calc_heatmap(
df: dd.DataFrame, ngroups: int, nsubgroups: int,
) -> Tuple[pd.DataFrame, Dict[str, int]]:
"""
Calculate a heatmap of the counts of two columns
Parameters
----------
df
Dataframe with two categorical columns
ngroups
Number of groups to show from the first column
nsubgroups
Number of subgroups (from the second column) to show in each group
Returns
-------
Tuple[pd.DataFrame, Dict[str, int]]
The heatmap counts in a dataframe and a dictionary
logging the sampled group output
"""
x, y = df.columns[0], df.columns[1]
df, grp_cnt_stats, _ = _calc_groups(df, x, ngroups)
srs = df.groupby(y).size()
srs_lrgst = srs.nlargest(n=nsubgroups)
largest_subgrps = list(srs_lrgst.index.compute())
df = df[df[y].isin(largest_subgrps)]
df_res = df.groupby([x, y]).size().reset_index().compute()
df_res.columns = ["x", "y", "cnt"]
df_res = pd.pivot_table(
df_res, index=["x", "y"], values="cnt", fill_value=0, aggfunc=np.sum,
).reset_index()
grp_cnt_stats[f"{y}_ttl"] = len(srs.index.compute())
grp_cnt_stats[f"{y}_shw"] = len(largest_subgrps)
return df_res, grp_cnt_stats
def calc_stats_dt(srs: dd.Series) -> Dict[str, str]:
"""
Calculate stats from a datetime column
Parameters
----------
srs
a datetime column
Returns
-------
Dict[str, str]
Dictionary that contains Overview
"""
size = len(srs) # include nan
count = srs.count() # exclude nan
uniq_count = srs.nunique()
overview_dict = {
"Distinct Count": uniq_count,
"Unique (%)": uniq_count / count,
"Missing": size - count,
"Missing (%)": 1 - (count / size),
"Memory Size": srs.memory_usage(),
"Minimum": srs.min(),
"Maximum": srs.max(),
}
return overview_dict
def _calc_box_stats(grp_srs: dd.Series, grp: str, dlyd: bool = False) -> pd.DataFrame:
"""
Auxiliary function to calculate the Tukey box plot statistics
dlyd is for if this function is called when dask is computing in parallel (dask.delayed)
"""
stats: Dict[str, Any] = dict()
try: # this is a bad fix for the problem of when there is no data passed to this function
if dlyd:
qntls = np.round(grp_srs.quantile([0.25, 0.50, 0.75]), 3)
else:
qntls = np.round(grp_srs.quantile([0.25, 0.50, 0.75]).compute(), 3)
stats["q1"], stats["q2"], stats["q3"] = qntls[0.25], qntls[0.50], qntls[0.75]
except ValueError:
stats["q1"], stats["q2"], stats["q3"] = np.nan, np.nan, np.nan
iqr = stats["q3"] - stats["q1"]
stats["lw"] = grp_srs[grp_srs >= stats["q1"] - 1.5 * iqr].min()
stats["uw"] = grp_srs[grp_srs <= stats["q3"] + 1.5 * iqr].max()
if not dlyd:
stats["lw"], stats["uw"] = dask.compute(stats["lw"], stats["uw"])
otlrs = grp_srs[(grp_srs < stats["lw"]) | (grp_srs > stats["uw"])]
if len(otlrs) > 100: # sample 100 outliers
otlrs = otlrs.sample(frac=100 / len(otlrs))
stats["otlrs"] = list(otlrs) if dlyd else list(otlrs.compute())
return pd.DataFrame({grp: stats})
def _calc_box_otlrs(df: dd.DataFrame) -> Tuple[List[str], List[float]]:
"""
Calculate the outliers for a box plot
"""
outx: List[str] = [] # list for the outlier groups
outy: List[float] = [] # list for the outlier values
for ind in df.index:
otlrs = df.loc[ind]["otlrs"]
outx = outx + [df.loc[ind]["grp"]] * len(otlrs)
outy = outy + otlrs
return outx, outy
def _calc_groups(
df: dd.DataFrame, x: str, ngroups: int, largest: bool = True
) -> Tuple[dd.DataFrame, Dict[str, int], List[str]]:
"""
Auxillary function to parse the dataframe to consist of only the
groups with the largest counts
"""
# group count statistics to inform the user of the sampled output
grp_cnt_stats: Dict[str, int] = dict()
srs = df.groupby(x).size()
srs_lrgst = srs.nlargest(n=ngroups) if largest else srs.nsmallest(n=ngroups)
try:
largest_grps = list(srs_lrgst.index.compute())
grp_cnt_stats[f"{x}_ttl"] = len(srs.index.compute())
except AttributeError:
largest_grps = list(srs_lrgst.index)
grp_cnt_stats[f"{x}_ttl"] = len(srs.index)
df = df[df[x].isin(largest_grps)]
grp_cnt_stats[f"{x}_shw"] = len(largest_grps)
return df, grp_cnt_stats, largest_grps
def _format_bin_intervals(bins_arr: np.ndarray) -> List[str]:
"""
Auxillary function to format bin intervals in a histogram
"""
bins_arr = np.round(bins_arr, 3)
bins_arr = [int(val) if float(val).is_integer() else val for val in bins_arr]
intervals = [
f"[{bins_arr[i]}, {bins_arr[i + 1]})" for i in range(len(bins_arr) - 2)
]
intervals.append(f"[{bins_arr[-2]},{bins_arr[-1]}]")
return intervals
def _get_timeunit(min_time: pd.Timestamp, max_time: pd.Timestamp, dflt: int) -> str:
"""
Auxillary function to find an appropriate time unit. Will find the
time unit such that the number of time units are closest to dflt.
"""
dt_secs = {
"year": 60 * 60 * 24 * 365,
"quarter": 60 * 60 * 24 * 91,
"month": 60 * 60 * 24 * 30,
"week": 60 * 60 * 24 * 7,
"day": 60 * 60 * 24,
"hour": 60 * 60,
"minute": 60,
"second": 1,
}
time_rng_secs = (max_time - min_time).total_seconds()
prev_bin_cnt, prev_unit = 0, "year"
for unit, secs_in_unit in dt_secs.items():
cur_bin_cnt = time_rng_secs / secs_in_unit
if abs(prev_bin_cnt - dflt) < abs(cur_bin_cnt - dflt):
return prev_unit
prev_bin_cnt = cur_bin_cnt
prev_unit = unit
return prev_unit
|
[
"pandas.DataFrame",
"dask.array.stats.skew",
"dask.delayed",
"nltk.stem.PorterStemmer",
"nltk.stem.WordNetLemmatizer",
"dask.array.histogram",
"typing.cast",
"dask.array.stats.kurtosis",
"pandas.pivot_table",
"collections.defaultdict",
"pandas.to_timedelta",
"pandas.Grouper",
"numpy.linspace",
"dask.compute",
"numpy.round",
"pandas.concat"
] |
[((7664, 7680), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (7675, 7680), False, 'from collections import defaultdict\n'), ((8921, 8947), 'dask.compute', 'dask.compute', (['datas', 'stats'], {}), '(datas, stats)\n', (8933, 8947), False, 'import dask\n'), ((25009, 25047), 'pandas.Grouper', 'pd.Grouper', ([], {'key': 'x', 'freq': 'DTMAP[unit][0]'}), '(key=x, freq=DTMAP[unit][0])\n', (25019, 25047), True, 'import pandas as pd\n'), ((34802, 34864), 'dask.array.histogram', 'da.histogram', (['srs'], {'bins': 'bins', 'range': '[minv, maxv]', 'density': '(True)'}), '(srs, bins=bins, range=[minv, maxv], density=True)\n', (34814, 34864), True, 'import dask.array as da\n'), ((38471, 38530), 'dask.array.histogram', 'da.histogram', (['lengths.values'], {'bins': 'bins', 'range': '[minv, maxv]'}), '(lengths.values, bins=bins, range=[minv, maxv])\n', (38483, 38530), True, 'import dask.array as da\n'), ((43907, 43930), 'dask.compute', 'dask.compute', (['*hist_lst'], {}), '(*hist_lst)\n', (43919, 43930), False, 'import dask\n'), ((46579, 46593), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (46591, 46593), True, 'import pandas as pd\n'), ((50325, 50351), 'pandas.DataFrame', 'pd.DataFrame', (['{grp: stats}'], {}), '({grp: stats})\n', (50337, 50351), True, 'import pandas as pd\n'), ((51790, 51811), 'numpy.round', 'np.round', (['bins_arr', '(3)'], {}), '(bins_arr, 3)\n', (51798, 51811), True, 'import numpy as np\n'), ((5064, 5086), 'typing.cast', 'cast', (['str', '(x or y or z)'], {}), '(str, x or y or z)\n', (5068, 5086), False, 'from typing import Any, DefaultDict, Dict, List, Optional, Tuple, Union, cast\n'), ((26489, 26512), 'dask.compute', 'dask.compute', (['*hist_lst'], {}), '(*hist_lst)\n', (26501, 26512), False, 'import dask\n'), ((27890, 27928), 'pandas.Grouper', 'pd.Grouper', ([], {'key': 'x', 'freq': 'DTMAP[unit][0]'}), '(key=x, freq=DTMAP[unit][0])\n', (27900, 27928), True, 'import pandas as pd\n'), ((29488, 29526), 'pandas.Grouper', 'pd.Grouper', ([], {'key': 'x', 'freq': 'DTMAP[unit][0]'}), '(key=x, freq=DTMAP[unit][0])\n', (29498, 29526), True, 'import pandas as pd\n'), ((33814, 33833), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (33831, 33833), False, 'from nltk.stem import PorterStemmer, WordNetLemmatizer\n'), ((33943, 33958), 'nltk.stem.PorterStemmer', 'PorterStemmer', ([], {}), '()\n', (33956, 33958), False, 'from nltk.stem import PorterStemmer, WordNetLemmatizer\n'), ((37665, 37674), 'dask.array.stats.skew', 'skew', (['srs'], {}), '(srs)\n', (37669, 37674), False, 'from dask.array.stats import kurtosis, skew\n'), ((37692, 37705), 'dask.array.stats.kurtosis', 'kurtosis', (['srs'], {}), '(srs)\n', (37700, 37705), False, 'from dask.array.stats import kurtosis, skew\n'), ((43729, 43781), 'dask.array.histogram', 'da.histogram', (['grp_srs'], {'range': '[minv, maxv]', 'bins': 'bins'}), '(grp_srs, range=[minv, maxv], bins=bins)\n', (43741, 43781), True, 'import dask.array as da\n'), ((50034, 50072), 'dask.compute', 'dask.compute', (["stats['lw']", "stats['uw']"], {}), "(stats['lw'], stats['uw'])\n", (50046, 50072), False, 'import dask\n'), ((12795, 12817), 'dask.compute', 'dask.compute', (['cat_data'], {}), '(cat_data)\n', (12807, 12817), False, 'import dask\n'), ((18083, 18103), 'dask.compute', 'dask.compute', (['*dtnum'], {}), '(*dtnum)\n', (18095, 18103), False, 'import dask\n'), ((23367, 23393), 'dask.delayed', 'dask.delayed', (['calc_line_dt'], {}), '(calc_line_dt)\n', (23379, 23393), False, 'import dask\n'), ((27119, 27147), 'pandas.to_timedelta', 'pd.to_timedelta', (['(6)'], {'unit': '"""d"""'}), "(6, unit='d')\n", (27134, 27147), True, 'import pandas as pd\n'), ((28267, 28295), 'pandas.to_timedelta', 'pd.to_timedelta', (['(6)'], {'unit': '"""d"""'}), "(6, unit='d')\n", (28282, 28295), True, 'import pandas as pd\n'), ((29648, 29724), 'pandas.pivot_table', 'pd.pivot_table', (['df_grps'], {'index': 'grouper', 'columns': 'y', 'aggfunc': 'len', 'fill_value': '(0)'}), '(df_grps, index=grouper, columns=y, aggfunc=len, fill_value=0)\n', (29662, 29724), True, 'import pandas as pd\n'), ((30152, 30180), 'pandas.to_timedelta', 'pd.to_timedelta', (['(6)'], {'unit': '"""d"""'}), "(6, unit='d')\n", (30167, 30180), True, 'import pandas as pd\n'), ((37565, 37592), 'numpy.linspace', 'np.linspace', (['(0.01)', '(0.99)', '(99)'], {}), '(0.01, 0.99, 99)\n', (37576, 37592), True, 'import numpy as np\n'), ((41017, 41054), 'numpy.linspace', 'np.linspace', (['minv', 'maxv'], {'num': '(bins + 1)'}), '(minv, maxv, num=bins + 1)\n', (41028, 41054), True, 'import numpy as np\n'), ((41735, 41800), 'pandas.DataFrame', 'pd.DataFrame', (['[endpts[:-1], endpts[1:]]', "['lb', 'ub']", 'df.columns'], {}), "([endpts[:-1], endpts[1:]], ['lb', 'ub'], df.columns)\n", (41747, 41800), True, 'import pandas as pd\n'), ((41848, 41882), 'pandas.concat', 'pd.concat', (['[df, endpts_df]'], {'axis': '(0)'}), '([df, endpts_df], axis=0)\n', (41857, 41882), True, 'import pandas as pd\n'), ((48113, 48201), 'pandas.pivot_table', 'pd.pivot_table', (['df_res'], {'index': "['x', 'y']", 'values': '"""cnt"""', 'fill_value': '(0)', 'aggfunc': 'np.sum'}), "(df_res, index=['x', 'y'], values='cnt', fill_value=0,\n aggfunc=np.sum)\n", (48127, 48201), True, 'import pandas as pd\n'), ((13840, 13889), 'dask.array.histogram', 'da.histogram', (['df_x'], {'bins': 'bins', 'range': '[minv, maxv]'}), '(df_x, bins=bins, range=[minv, maxv])\n', (13852, 13889), True, 'import dask.array as da\n'), ((14069, 14091), 'dask.compute', 'dask.compute', (['num_data'], {}), '(num_data)\n', (14081, 14091), False, 'import dask\n'), ((14615, 14637), 'dask.compute', 'dask.compute', (['*data_dt'], {}), '(*data_dt)\n', (14627, 14637), False, 'import dask\n'), ((18898, 18918), 'dask.compute', 'dask.compute', (['*dtcat'], {}), '(*dtcat)\n', (18910, 18918), False, 'import dask\n'), ((17939, 17965), 'dask.delayed', 'dask.delayed', (['calc_line_dt'], {}), '(calc_line_dt)\n', (17951, 17965), False, 'import dask\n'), ((18026, 18051), 'dask.delayed', 'dask.delayed', (['calc_box_dt'], {}), '(calc_box_dt)\n', (18038, 18051), False, 'import dask\n'), ((26224, 26252), 'pandas.to_timedelta', 'pd.to_timedelta', (['(6)'], {'unit': '"""d"""'}), "(6, unit='d')\n", (26239, 26252), True, 'import pandas as pd\n'), ((29942, 29980), 'pandas.Grouper', 'pd.Grouper', ([], {'key': 'x', 'freq': 'DTMAP[unit][0]'}), '(key=x, freq=DTMAP[unit][0])\n', (29952, 29980), True, 'import pandas as pd\n'), ((14464, 14490), 'dask.delayed', 'dask.delayed', (['calc_line_dt'], {}), '(calc_line_dt)\n', (14476, 14490), False, 'import dask\n'), ((14550, 14577), 'dask.delayed', 'dask.delayed', (['calc_stats_dt'], {}), '(calc_stats_dt)\n', (14562, 14577), False, 'import dask\n'), ((18685, 18711), 'dask.delayed', 'dask.delayed', (['calc_line_dt'], {}), '(calc_line_dt)\n', (18697, 18711), False, 'import dask\n'), ((18819, 18848), 'dask.delayed', 'dask.delayed', (['calc_stacked_dt'], {}), '(calc_stacked_dt)\n', (18831, 18848), False, 'import dask\n'), ((8663, 8689), 'dask.delayed', 'dask.delayed', (['calc_line_dt'], {}), '(calc_line_dt)\n', (8675, 8689), False, 'import dask\n')]
|
# encoding: utf-8
"""Utility functions wrapping the excellent *mock* library"""
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
if sys.version_info > (3, 0):
from unittest.mock import ANY, call, MagicMock # noqa
from unittest.mock import create_autospec, Mock, mock_open, patch, PropertyMock
else:
from mock import ANY, call, MagicMock # noqa
from mock import create_autospec, Mock, patch, PropertyMock
def class_mock(request, q_class_name, autospec=True, **kwargs):
"""Return mock patching class with qualified name *q_class_name*.
The mock is autospec'ed based on the patched class unless the optional
argument *autospec* is set to False. Any other keyword arguments are
passed through to Mock(). Patch is reversed after calling test returns.
"""
_patch = patch(q_class_name, autospec=autospec, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
def cls_attr_mock(request, cls, attr_name, name=None, **kwargs):
"""
Return a mock for attribute *attr_name* on *cls* where the patch is
reversed after pytest uses it.
"""
name = request.fixturename if name is None else name
_patch = patch.object(cls, attr_name, name=name, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
def function_mock(request, q_function_name, autospec=True, **kwargs):
"""Return mock patching function with qualified name *q_function_name*.
Patch is reversed after calling test returns.
"""
_patch = patch(q_function_name, autospec=autospec, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
def initializer_mock(request, cls, autospec=True, **kwargs):
"""Return mock for __init__() method on *cls*.
The patch is reversed after pytest uses it.
"""
_patch = patch.object(
cls, "__init__", autospec=autospec, return_value=None, **kwargs
)
request.addfinalizer(_patch.stop)
return _patch.start()
def instance_mock(request, cls, name=None, spec_set=True, **kwargs):
"""
Return a mock for an instance of *cls* that draws its spec from the class
and does not allow new attributes to be set on the instance. If *name* is
missing or |None|, the name of the returned |Mock| instance is set to
*request.fixturename*. Additional keyword arguments are passed through to
the Mock() call that creates the mock.
"""
name = name if name is not None else request.fixturename
return create_autospec(cls, _name=name, spec_set=spec_set, instance=True, **kwargs)
def loose_mock(request, name=None, **kwargs):
"""
Return a "loose" mock, meaning it has no spec to constrain calls on it.
Additional keyword arguments are passed through to Mock(). If called
without a name, it is assigned the name of the fixture.
"""
if name is None:
name = request.fixturename
return Mock(name=name, **kwargs)
def method_mock(request, cls, method_name, autospec=True, **kwargs):
"""Return mock for method *method_name* on *cls*.
The patch is reversed after pytest uses it.
"""
_patch = patch.object(cls, method_name, autospec=autospec, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
def open_mock(request, module_name, **kwargs):
"""Return a mock for the builtin `open()` method in *module_name*."""
target = "%s.open" % module_name
_patch = patch(target, mock_open(), create=True, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
def property_mock(request, cls, prop_name, **kwargs):
"""
Return a mock for property *prop_name* on class *cls* where the patch is
reversed after pytest uses it.
"""
_patch = patch.object(cls, prop_name, new_callable=PropertyMock, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
def var_mock(request, q_var_name, **kwargs):
"""
Return a mock patching the variable with qualified name *q_var_name*.
Patch is reversed after calling test returns.
"""
_patch = patch(q_var_name, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
|
[
"mock.patch.object",
"mock.patch",
"mock.create_autospec",
"unittest.mock.mock_open",
"mock.Mock"
] |
[((853, 901), 'mock.patch', 'patch', (['q_class_name'], {'autospec': 'autospec'}), '(q_class_name, autospec=autospec, **kwargs)\n', (858, 901), False, 'from mock import create_autospec, Mock, patch, PropertyMock\n'), ((1226, 1275), 'mock.patch.object', 'patch.object', (['cls', 'attr_name'], {'name': 'name'}), '(cls, attr_name, name=name, **kwargs)\n', (1238, 1275), False, 'from mock import create_autospec, Mock, patch, PropertyMock\n'), ((1560, 1611), 'mock.patch', 'patch', (['q_function_name'], {'autospec': 'autospec'}), '(q_function_name, autospec=autospec, **kwargs)\n', (1565, 1611), False, 'from mock import create_autospec, Mock, patch, PropertyMock\n'), ((1860, 1937), 'mock.patch.object', 'patch.object', (['cls', '"""__init__"""'], {'autospec': 'autospec', 'return_value': 'None'}), "(cls, '__init__', autospec=autospec, return_value=None, **kwargs)\n", (1872, 1937), False, 'from mock import create_autospec, Mock, patch, PropertyMock\n'), ((2526, 2602), 'mock.create_autospec', 'create_autospec', (['cls'], {'_name': 'name', 'spec_set': 'spec_set', 'instance': '(True)'}), '(cls, _name=name, spec_set=spec_set, instance=True, **kwargs)\n', (2541, 2602), False, 'from mock import create_autospec, Mock, patch, PropertyMock\n'), ((2943, 2968), 'mock.Mock', 'Mock', ([], {'name': 'name'}), '(name=name, **kwargs)\n', (2947, 2968), False, 'from mock import create_autospec, Mock, patch, PropertyMock\n'), ((3164, 3223), 'mock.patch.object', 'patch.object', (['cls', 'method_name'], {'autospec': 'autospec'}), '(cls, method_name, autospec=autospec, **kwargs)\n', (3176, 3223), False, 'from mock import create_autospec, Mock, patch, PropertyMock\n'), ((3772, 3837), 'mock.patch.object', 'patch.object', (['cls', 'prop_name'], {'new_callable': 'PropertyMock'}), '(cls, prop_name, new_callable=PropertyMock, **kwargs)\n', (3784, 3837), False, 'from mock import create_autospec, Mock, patch, PropertyMock\n'), ((4102, 4129), 'mock.patch', 'patch', (['q_var_name'], {}), '(q_var_name, **kwargs)\n', (4107, 4129), False, 'from mock import create_autospec, Mock, patch, PropertyMock\n'), ((3475, 3486), 'unittest.mock.mock_open', 'mock_open', ([], {}), '()\n', (3484, 3486), False, 'from unittest.mock import create_autospec, Mock, mock_open, patch, PropertyMock\n')]
|
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore
from google.cloud.aiplatform_v1.types import (
migratable_resource as gca_migratable_resource,
)
from google.cloud.aiplatform_v1.types import operation
from google.rpc import status_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.cloud.aiplatform.v1",
manifest={
"SearchMigratableResourcesRequest",
"SearchMigratableResourcesResponse",
"BatchMigrateResourcesRequest",
"MigrateResourceRequest",
"BatchMigrateResourcesResponse",
"MigrateResourceResponse",
"BatchMigrateResourcesOperationMetadata",
},
)
class SearchMigratableResourcesRequest(proto.Message):
r"""Request message for
[MigrationService.SearchMigratableResources][google.cloud.aiplatform.v1.MigrationService.SearchMigratableResources].
Attributes:
parent (str):
Required. The location that the migratable resources should
be searched from. It's the AI Platform location that the
resources can be migrated to, not the resources' original
location. Format:
``projects/{project}/locations/{location}``
page_size (int):
The standard page size.
The default and maximum value is 100.
page_token (str):
The standard page token.
filter (str):
Supported filters are:
- Resource type: For a specific type of MigratableResource.
- ``ml_engine_model_version:*``
- ``automl_model:*``,
- ``automl_dataset:*``
- ``data_labeling_dataset:*``.
- Migrated or not: Filter migrated resource or not by
last_migrate_time.
- ``last_migrate_time:*`` will filter migrated
resources.
- ``NOT last_migrate_time:*`` will filter not yet
migrated resources.
"""
parent = proto.Field(proto.STRING, number=1,)
page_size = proto.Field(proto.INT32, number=2,)
page_token = proto.Field(proto.STRING, number=3,)
filter = proto.Field(proto.STRING, number=4,)
class SearchMigratableResourcesResponse(proto.Message):
r"""Response message for
[MigrationService.SearchMigratableResources][google.cloud.aiplatform.v1.MigrationService.SearchMigratableResources].
Attributes:
migratable_resources (Sequence[google.cloud.aiplatform_v1.types.MigratableResource]):
All migratable resources that can be migrated
to the location specified in the request.
next_page_token (str):
The standard next-page token. The migratable_resources may
not fill page_size in SearchMigratableResourcesRequest even
when there are subsequent pages.
"""
@property
def raw_page(self):
return self
migratable_resources = proto.RepeatedField(
proto.MESSAGE, number=1, message=gca_migratable_resource.MigratableResource,
)
next_page_token = proto.Field(proto.STRING, number=2,)
class BatchMigrateResourcesRequest(proto.Message):
r"""Request message for
[MigrationService.BatchMigrateResources][google.cloud.aiplatform.v1.MigrationService.BatchMigrateResources].
Attributes:
parent (str):
Required. The location of the migrated resource will live
in. Format: ``projects/{project}/locations/{location}``
migrate_resource_requests (Sequence[google.cloud.aiplatform_v1.types.MigrateResourceRequest]):
Required. The request messages specifying the
resources to migrate. They must be in the same
location as the destination. Up to 50 resources
can be migrated in one batch.
"""
parent = proto.Field(proto.STRING, number=1,)
migrate_resource_requests = proto.RepeatedField(
proto.MESSAGE, number=2, message="MigrateResourceRequest",
)
class MigrateResourceRequest(proto.Message):
r"""Config of migrating one resource from automl.googleapis.com,
datalabeling.googleapis.com and ml.googleapis.com to AI
Platform.
Attributes:
migrate_ml_engine_model_version_config (google.cloud.aiplatform_v1.types.MigrateResourceRequest.MigrateMlEngineModelVersionConfig):
Config for migrating Version in
ml.googleapis.com to AI Platform's Model.
migrate_automl_model_config (google.cloud.aiplatform_v1.types.MigrateResourceRequest.MigrateAutomlModelConfig):
Config for migrating Model in
automl.googleapis.com to AI Platform's Model.
migrate_automl_dataset_config (google.cloud.aiplatform_v1.types.MigrateResourceRequest.MigrateAutomlDatasetConfig):
Config for migrating Dataset in
automl.googleapis.com to AI Platform's Dataset.
migrate_data_labeling_dataset_config (google.cloud.aiplatform_v1.types.MigrateResourceRequest.MigrateDataLabelingDatasetConfig):
Config for migrating Dataset in
datalabeling.googleapis.com to AI Platform's
Dataset.
"""
class MigrateMlEngineModelVersionConfig(proto.Message):
r"""Config for migrating version in ml.googleapis.com to AI
Platform's Model.
Attributes:
endpoint (str):
Required. The ml.googleapis.com endpoint that this model
version should be migrated from. Example values:
- ml.googleapis.com
- us-centrall-ml.googleapis.com
- europe-west4-ml.googleapis.com
- asia-east1-ml.googleapis.com
model_version (str):
Required. Full resource name of ml engine model version.
Format:
``projects/{project}/models/{model}/versions/{version}``.
model_display_name (str):
Required. Display name of the model in AI
Platform. System will pick a display name if
unspecified.
"""
endpoint = proto.Field(proto.STRING, number=1,)
model_version = proto.Field(proto.STRING, number=2,)
model_display_name = proto.Field(proto.STRING, number=3,)
class MigrateAutomlModelConfig(proto.Message):
r"""Config for migrating Model in automl.googleapis.com to AI
Platform's Model.
Attributes:
model (str):
Required. Full resource name of automl Model. Format:
``projects/{project}/locations/{location}/models/{model}``.
model_display_name (str):
Optional. Display name of the model in AI
Platform. System will pick a display name if
unspecified.
"""
model = proto.Field(proto.STRING, number=1,)
model_display_name = proto.Field(proto.STRING, number=2,)
class MigrateAutomlDatasetConfig(proto.Message):
r"""Config for migrating Dataset in automl.googleapis.com to AI
Platform's Dataset.
Attributes:
dataset (str):
Required. Full resource name of automl Dataset. Format:
``projects/{project}/locations/{location}/datasets/{dataset}``.
dataset_display_name (str):
Required. Display name of the Dataset in AI
Platform. System will pick a display name if
unspecified.
"""
dataset = proto.Field(proto.STRING, number=1,)
dataset_display_name = proto.Field(proto.STRING, number=2,)
class MigrateDataLabelingDatasetConfig(proto.Message):
r"""Config for migrating Dataset in datalabeling.googleapis.com
to AI Platform's Dataset.
Attributes:
dataset (str):
Required. Full resource name of data labeling Dataset.
Format: ``projects/{project}/datasets/{dataset}``.
dataset_display_name (str):
Optional. Display name of the Dataset in AI
Platform. System will pick a display name if
unspecified.
migrate_data_labeling_annotated_dataset_configs (Sequence[google.cloud.aiplatform_v1.types.MigrateResourceRequest.MigrateDataLabelingDatasetConfig.MigrateDataLabelingAnnotatedDatasetConfig]):
Optional. Configs for migrating
AnnotatedDataset in datalabeling.googleapis.com
to AI Platform's SavedQuery. The specified
AnnotatedDatasets have to belong to the
datalabeling Dataset.
"""
class MigrateDataLabelingAnnotatedDatasetConfig(proto.Message):
r"""Config for migrating AnnotatedDataset in
datalabeling.googleapis.com to AI Platform's SavedQuery.
Attributes:
annotated_dataset (str):
Required. Full resource name of data labeling
AnnotatedDataset. Format:
``projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}``.
"""
annotated_dataset = proto.Field(proto.STRING, number=1,)
dataset = proto.Field(proto.STRING, number=1,)
dataset_display_name = proto.Field(proto.STRING, number=2,)
migrate_data_labeling_annotated_dataset_configs = proto.RepeatedField(
proto.MESSAGE,
number=3,
message="MigrateResourceRequest.MigrateDataLabelingDatasetConfig.MigrateDataLabelingAnnotatedDatasetConfig",
)
migrate_ml_engine_model_version_config = proto.Field(
proto.MESSAGE,
number=1,
oneof="request",
message=MigrateMlEngineModelVersionConfig,
)
migrate_automl_model_config = proto.Field(
proto.MESSAGE, number=2, oneof="request", message=MigrateAutomlModelConfig,
)
migrate_automl_dataset_config = proto.Field(
proto.MESSAGE, number=3, oneof="request", message=MigrateAutomlDatasetConfig,
)
migrate_data_labeling_dataset_config = proto.Field(
proto.MESSAGE,
number=4,
oneof="request",
message=MigrateDataLabelingDatasetConfig,
)
class BatchMigrateResourcesResponse(proto.Message):
r"""Response message for
[MigrationService.BatchMigrateResources][google.cloud.aiplatform.v1.MigrationService.BatchMigrateResources].
Attributes:
migrate_resource_responses (Sequence[google.cloud.aiplatform_v1.types.MigrateResourceResponse]):
Successfully migrated resources.
"""
migrate_resource_responses = proto.RepeatedField(
proto.MESSAGE, number=1, message="MigrateResourceResponse",
)
class MigrateResourceResponse(proto.Message):
r"""Describes a successfully migrated resource.
Attributes:
dataset (str):
Migrated Dataset's resource name.
model (str):
Migrated Model's resource name.
migratable_resource (google.cloud.aiplatform_v1.types.MigratableResource):
Before migration, the identifier in
ml.googleapis.com, automl.googleapis.com or
datalabeling.googleapis.com.
"""
dataset = proto.Field(proto.STRING, number=1, oneof="migrated_resource",)
model = proto.Field(proto.STRING, number=2, oneof="migrated_resource",)
migratable_resource = proto.Field(
proto.MESSAGE, number=3, message=gca_migratable_resource.MigratableResource,
)
class BatchMigrateResourcesOperationMetadata(proto.Message):
r"""Runtime operation information for
[MigrationService.BatchMigrateResources][google.cloud.aiplatform.v1.MigrationService.BatchMigrateResources].
Attributes:
generic_metadata (google.cloud.aiplatform_v1.types.GenericOperationMetadata):
The common part of the operation metadata.
partial_results (Sequence[google.cloud.aiplatform_v1.types.BatchMigrateResourcesOperationMetadata.PartialResult]):
Partial results that reflect the latest
migration operation progress.
"""
class PartialResult(proto.Message):
r"""Represents a partial result in batch migration operation for one
[MigrateResourceRequest][google.cloud.aiplatform.v1.MigrateResourceRequest].
Attributes:
error (google.rpc.status_pb2.Status):
The error result of the migration request in
case of failure.
model (str):
Migrated model resource name.
dataset (str):
Migrated dataset resource name.
request (google.cloud.aiplatform_v1.types.MigrateResourceRequest):
It's the same as the value in
[MigrateResourceRequest.migrate_resource_requests][].
"""
error = proto.Field(
proto.MESSAGE, number=2, oneof="result", message=status_pb2.Status,
)
model = proto.Field(proto.STRING, number=3, oneof="result",)
dataset = proto.Field(proto.STRING, number=4, oneof="result",)
request = proto.Field(
proto.MESSAGE, number=1, message="MigrateResourceRequest",
)
generic_metadata = proto.Field(
proto.MESSAGE, number=1, message=operation.GenericOperationMetadata,
)
partial_results = proto.RepeatedField(
proto.MESSAGE, number=2, message=PartialResult,
)
__all__ = tuple(sorted(__protobuf__.manifest))
|
[
"proto.RepeatedField",
"proto.module",
"proto.Field"
] |
[((853, 1164), 'proto.module', 'proto.module', ([], {'package': '"""google.cloud.aiplatform.v1"""', 'manifest': "{'SearchMigratableResourcesRequest', 'SearchMigratableResourcesResponse',\n 'BatchMigrateResourcesRequest', 'MigrateResourceRequest',\n 'BatchMigrateResourcesResponse', 'MigrateResourceResponse',\n 'BatchMigrateResourcesOperationMetadata'}"}), "(package='google.cloud.aiplatform.v1', manifest={\n 'SearchMigratableResourcesRequest', 'SearchMigratableResourcesResponse',\n 'BatchMigrateResourcesRequest', 'MigrateResourceRequest',\n 'BatchMigrateResourcesResponse', 'MigrateResourceResponse',\n 'BatchMigrateResourcesOperationMetadata'})\n", (865, 1164), False, 'import proto\n'), ((2563, 2598), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(1)'}), '(proto.STRING, number=1)\n', (2574, 2598), False, 'import proto\n'), ((2616, 2650), 'proto.Field', 'proto.Field', (['proto.INT32'], {'number': '(2)'}), '(proto.INT32, number=2)\n', (2627, 2650), False, 'import proto\n'), ((2669, 2704), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(3)'}), '(proto.STRING, number=3)\n', (2680, 2704), False, 'import proto\n'), ((2719, 2754), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(4)'}), '(proto.STRING, number=4)\n', (2730, 2754), False, 'import proto\n'), ((3501, 3602), 'proto.RepeatedField', 'proto.RepeatedField', (['proto.MESSAGE'], {'number': '(1)', 'message': 'gca_migratable_resource.MigratableResource'}), '(proto.MESSAGE, number=1, message=\n gca_migratable_resource.MigratableResource)\n', (3520, 3602), False, 'import proto\n'), ((3635, 3670), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(2)'}), '(proto.STRING, number=2)\n', (3646, 3670), False, 'import proto\n'), ((4387, 4422), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(1)'}), '(proto.STRING, number=1)\n', (4398, 4422), False, 'import proto\n'), ((4456, 4534), 'proto.RepeatedField', 'proto.RepeatedField', (['proto.MESSAGE'], {'number': '(2)', 'message': '"""MigrateResourceRequest"""'}), "(proto.MESSAGE, number=2, message='MigrateResourceRequest')\n", (4475, 4534), False, 'import proto\n'), ((10181, 10282), 'proto.Field', 'proto.Field', (['proto.MESSAGE'], {'number': '(1)', 'oneof': '"""request"""', 'message': 'MigrateMlEngineModelVersionConfig'}), "(proto.MESSAGE, number=1, oneof='request', message=\n MigrateMlEngineModelVersionConfig)\n", (10192, 10282), False, 'import proto\n'), ((10351, 10443), 'proto.Field', 'proto.Field', (['proto.MESSAGE'], {'number': '(2)', 'oneof': '"""request"""', 'message': 'MigrateAutomlModelConfig'}), "(proto.MESSAGE, number=2, oneof='request', message=\n MigrateAutomlModelConfig)\n", (10362, 10443), False, 'import proto\n'), ((10490, 10584), 'proto.Field', 'proto.Field', (['proto.MESSAGE'], {'number': '(3)', 'oneof': '"""request"""', 'message': 'MigrateAutomlDatasetConfig'}), "(proto.MESSAGE, number=3, oneof='request', message=\n MigrateAutomlDatasetConfig)\n", (10501, 10584), False, 'import proto\n'), ((10638, 10738), 'proto.Field', 'proto.Field', (['proto.MESSAGE'], {'number': '(4)', 'oneof': '"""request"""', 'message': 'MigrateDataLabelingDatasetConfig'}), "(proto.MESSAGE, number=4, oneof='request', message=\n MigrateDataLabelingDatasetConfig)\n", (10649, 10738), False, 'import proto\n'), ((11178, 11257), 'proto.RepeatedField', 'proto.RepeatedField', (['proto.MESSAGE'], {'number': '(1)', 'message': '"""MigrateResourceResponse"""'}), "(proto.MESSAGE, number=1, message='MigrateResourceResponse')\n", (11197, 11257), False, 'import proto\n'), ((11774, 11836), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(1)', 'oneof': '"""migrated_resource"""'}), "(proto.STRING, number=1, oneof='migrated_resource')\n", (11785, 11836), False, 'import proto\n'), ((11850, 11912), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(2)', 'oneof': '"""migrated_resource"""'}), "(proto.STRING, number=2, oneof='migrated_resource')\n", (11861, 11912), False, 'import proto\n'), ((11940, 12033), 'proto.Field', 'proto.Field', (['proto.MESSAGE'], {'number': '(3)', 'message': 'gca_migratable_resource.MigratableResource'}), '(proto.MESSAGE, number=3, message=gca_migratable_resource.\n MigratableResource)\n', (11951, 12033), False, 'import proto\n'), ((13762, 13847), 'proto.Field', 'proto.Field', (['proto.MESSAGE'], {'number': '(1)', 'message': 'operation.GenericOperationMetadata'}), '(proto.MESSAGE, number=1, message=operation.GenericOperationMetadata\n )\n', (13773, 13847), False, 'import proto\n'), ((13880, 13947), 'proto.RepeatedField', 'proto.RepeatedField', (['proto.MESSAGE'], {'number': '(2)', 'message': 'PartialResult'}), '(proto.MESSAGE, number=2, message=PartialResult)\n', (13899, 13947), False, 'import proto\n'), ((6662, 6697), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(1)'}), '(proto.STRING, number=1)\n', (6673, 6697), False, 'import proto\n'), ((6723, 6758), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(2)'}), '(proto.STRING, number=2)\n', (6734, 6758), False, 'import proto\n'), ((6789, 6824), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(3)'}), '(proto.STRING, number=3)\n', (6800, 6824), False, 'import proto\n'), ((7381, 7416), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(1)'}), '(proto.STRING, number=1)\n', (7392, 7416), False, 'import proto\n'), ((7447, 7482), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(2)'}), '(proto.STRING, number=2)\n', (7458, 7482), False, 'import proto\n'), ((8059, 8094), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(1)'}), '(proto.STRING, number=1)\n', (8070, 8094), False, 'import proto\n'), ((8127, 8162), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(2)'}), '(proto.STRING, number=2)\n', (8138, 8162), False, 'import proto\n'), ((9771, 9806), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(1)'}), '(proto.STRING, number=1)\n', (9782, 9806), False, 'import proto\n'), ((9839, 9874), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(2)'}), '(proto.STRING, number=2)\n', (9850, 9874), False, 'import proto\n'), ((9934, 10097), 'proto.RepeatedField', 'proto.RepeatedField', (['proto.MESSAGE'], {'number': '(3)', 'message': '"""MigrateResourceRequest.MigrateDataLabelingDatasetConfig.MigrateDataLabelingAnnotatedDatasetConfig"""'}), "(proto.MESSAGE, number=3, message=\n 'MigrateResourceRequest.MigrateDataLabelingDatasetConfig.MigrateDataLabelingAnnotatedDatasetConfig'\n )\n", (9953, 10097), False, 'import proto\n'), ((13383, 13462), 'proto.Field', 'proto.Field', (['proto.MESSAGE'], {'number': '(2)', 'oneof': '"""result"""', 'message': 'status_pb2.Status'}), "(proto.MESSAGE, number=2, oneof='result', message=status_pb2.Status)\n", (13394, 13462), False, 'import proto\n'), ((13502, 13553), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(3)', 'oneof': '"""result"""'}), "(proto.STRING, number=3, oneof='result')\n", (13513, 13553), False, 'import proto\n'), ((13573, 13624), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(4)', 'oneof': '"""result"""'}), "(proto.STRING, number=4, oneof='result')\n", (13584, 13624), False, 'import proto\n'), ((13644, 13714), 'proto.Field', 'proto.Field', (['proto.MESSAGE'], {'number': '(1)', 'message': '"""MigrateResourceRequest"""'}), "(proto.MESSAGE, number=1, message='MigrateResourceRequest')\n", (13655, 13714), False, 'import proto\n'), ((9715, 9750), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(1)'}), '(proto.STRING, number=1)\n', (9726, 9750), False, 'import proto\n')]
|
from unittest import TestCase
import pandas.api.types as ptypes
from pytrends.request import TrendReq
class TestTrendReq(TestCase):
def test__get_data(self):
"""Should use same values as in the documentation"""
pytrend = TrendReq()
self.assertEqual(pytrend.hl, 'en-US')
self.assertEqual(pytrend.tz, 360)
self.assertEqual(pytrend.geo, '')
self.assertTrue(pytrend.cookies['NID'])
def test_build_payload(self):
"""Should return the widgets to get data"""
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.token_payload)
def test__tokens(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.related_queries_widget_list)
def test_interest_over_time(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.interest_over_time())
def test_interest_over_time_images(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'], gprop='images')
self.assertIsNotNone(pytrend.interest_over_time())
def test_interest_over_time_news(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'], gprop='news')
self.assertIsNotNone(pytrend.interest_over_time())
def test_interest_over_time_youtube(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'], gprop='youtube')
self.assertIsNotNone(pytrend.interest_over_time())
def test_interest_over_time_froogle(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'], gprop='froogle')
self.assertIsNotNone(pytrend.interest_over_time())
def test_interest_over_time_bad_gprop(self):
pytrend = TrendReq()
with self.assertRaises(ValueError):
pytrend.build_payload(kw_list=['pizza', 'bagel'], gprop=' ')
def test_interest_by_region(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.interest_by_region())
def test_interest_by_region_city_resolution(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.interest_by_region(resolution='CITY'))
def test_related_topics(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.related_topics())
def test_related_queries(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.related_queries())
def test_trending_searches(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.trending_searches())
def test_realtime_trending_searches(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.realtime_trending_searches(pn='IN'))
def test_top_charts(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.top_charts(date=2019))
def test_suggestions(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
self.assertIsNotNone(pytrend.suggestions(keyword='pizza'))
def test_ispartial_dtype(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'])
df = pytrend.interest_over_time()
assert ptypes.is_bool_dtype(df.isPartial)
def test_ispartial_dtype_timeframe_all(self):
pytrend = TrendReq()
pytrend.build_payload(kw_list=['pizza', 'bagel'],
timeframe='all')
df = pytrend.interest_over_time()
assert ptypes.is_bool_dtype(df.isPartial)
|
[
"pytrends.request.TrendReq",
"pandas.api.types.is_bool_dtype"
] |
[((245, 255), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (253, 255), False, 'from pytrends.request import TrendReq\n'), ((539, 549), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (547, 549), False, 'from pytrends.request import TrendReq\n'), ((707, 717), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (715, 717), False, 'from pytrends.request import TrendReq\n'), ((900, 910), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (908, 910), False, 'from pytrends.request import TrendReq\n'), ((1093, 1103), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (1101, 1103), False, 'from pytrends.request import TrendReq\n'), ((1300, 1310), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (1308, 1310), False, 'from pytrends.request import TrendReq\n'), ((1508, 1518), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (1516, 1518), False, 'from pytrends.request import TrendReq\n'), ((1719, 1729), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (1727, 1729), False, 'from pytrends.request import TrendReq\n'), ((1932, 1942), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (1940, 1942), False, 'from pytrends.request import TrendReq\n'), ((2118, 2128), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (2126, 2128), False, 'from pytrends.request import TrendReq\n'), ((2320, 2330), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (2328, 2330), False, 'from pytrends.request import TrendReq\n'), ((2519, 2529), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (2527, 2529), False, 'from pytrends.request import TrendReq\n'), ((2698, 2708), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (2706, 2708), False, 'from pytrends.request import TrendReq\n'), ((2880, 2890), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (2888, 2890), False, 'from pytrends.request import TrendReq\n'), ((3073, 3083), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (3081, 3083), False, 'from pytrends.request import TrendReq\n'), ((3266, 3276), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (3274, 3276), False, 'from pytrends.request import TrendReq\n'), ((3446, 3456), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (3454, 3456), False, 'from pytrends.request import TrendReq\n'), ((3637, 3647), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (3645, 3647), False, 'from pytrends.request import TrendReq\n'), ((3763, 3797), 'pandas.api.types.is_bool_dtype', 'ptypes.is_bool_dtype', (['df.isPartial'], {}), '(df.isPartial)\n', (3783, 3797), True, 'import pandas.api.types as ptypes\n'), ((3867, 3877), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (3875, 3877), False, 'from pytrends.request import TrendReq\n'), ((4040, 4074), 'pandas.api.types.is_bool_dtype', 'ptypes.is_bool_dtype', (['df.isPartial'], {}), '(df.isPartial)\n', (4060, 4074), True, 'import pandas.api.types as ptypes\n')]
|
from collections import defaultdict
from email.headerregistry import Address
from smtplib import (
SMTPAuthenticationError,
SMTPDataError,
SMTPRecipientsRefused,
SMTPSenderRefused,
SMTPServerDisconnected,
)
from ssl import SSLCertVerificationError
from time import time
from typing import Any, Dict, Optional, Tuple, Union
from fastjsonschema import JsonSchemaException
from ....models.models import User
from ....permissions.permissions import Permissions
from ....shared.exceptions import DatastoreException, MissingPermission
from ....shared.interfaces.write_request import WriteRequest
from ....shared.patterns import Collection, FullQualifiedId
from ....shared.schema import required_id_schema
from ...generics.update import UpdateAction
from ...mixins.send_email_mixin import EmailMixin, EmailSettings
from ...util.default_schema import DefaultSchema
from ...util.register import register_action
from ...util.typing import ActionData, ActionResults
from .helper import get_user_name
@register_action("user.send_invitation_email")
class UserSendInvitationMail(EmailMixin, UpdateAction):
"""
Action send an invitation mail to a user.
"""
model = User()
schema = DefaultSchema(User()).get_update_schema(
additional_required_fields={"meeting_id": required_id_schema},
)
permission = Permissions.User.CAN_MANAGE
def perform(
self, action_data: ActionData, user_id: int, internal: bool = False
) -> Tuple[Optional[WriteRequest], Optional[ActionResults]]:
self.user_id = user_id
self.index = 0
if not EmailMixin.check_email(EmailSettings.default_from_email):
result = {
"sent": False,
"message": f"email {EmailSettings.default_from_email} is not a valid sender email address.",
}
self.results.append(result)
return (None, self.results)
try:
with EmailMixin.get_mail_connection() as mail_client:
self.index = -1
self.mail_client = mail_client
for instance in action_data:
self.index += 1
result = self.get_initial_result_false(instance)
try:
self.validate_instance(instance)
self.check_for_archived_meeting(instance)
self.check_permissions(instance)
instance = self.update_instance(instance)
result = instance.pop("result")
except SMTPRecipientsRefused as e:
result["message"] = f"SMTPRecipientsRefused: {str(e)}"
except SMTPServerDisconnected as e:
result[
"message"
] = f"SMTPServerDisconnected: {str(e)} during transmission"
except JsonSchemaException as e:
result["message"] = f"JsonSchema: {str(e)}"
except DatastoreException as e:
result["message"] = f"DatastoreException: {str(e)}"
except MissingPermission as e:
result["message"] = e.message
except SMTPDataError as e:
result["message"] = f"SMTPDataError: {str(e)}"
if result["sent"]:
write_request = self.create_write_requests(instance)
self.write_requests.extend(write_request)
self.results.append(result)
except SMTPAuthenticationError as e:
result = {"sent": False, "message": f"SMTPAuthenticationError: {str(e)}"}
self.results.append(result)
except SMTPSenderRefused as e:
result = {
"sent": False,
"message": f"SMTPSenderRefused: {str(e)}",
}
self.results.append(result)
except ConnectionRefusedError as e:
result = {"sent": False, "message": f"ConnectionRefusedError: {str(e)}"}
self.results.append(result)
except SSLCertVerificationError as e:
result = {"sent": False, "message": f"SSLCertVerificationError: {str(e)}"}
self.results.append(result)
except Exception as e:
result = {
"sent": False,
"message": f"Unspecified mail connection exception on sending invitation email to server {EmailSettings.host}, port {EmailSettings.port}: {str(e)}",
}
self.results.append(result)
final_write_request = self.process_write_requests()
return (final_write_request, self.results)
def update_instance(self, instance: Dict[str, Any]) -> Dict[str, Any]:
user_id = instance["id"]
meeting_id = instance["meeting_id"]
result = self.get_initial_result_false(instance)
instance["result"] = result
user = self.datastore.get(
FullQualifiedId(Collection("user"), user_id),
[
"meeting_ids",
"email",
"username",
"last_name",
"first_name",
"title",
"default_password",
],
)
if not (to_email := user.get("email")):
result["message"] = f"User/{user_id} has no email-address."
return instance
if not self.check_email(to_email):
result[
"message"
] = f"The email-address {to_email} of User/{user_id} is not valid."
return instance
result["recipient"] = to_email
if meeting_id not in user["meeting_ids"]:
result[
"message"
] = f"User/{user_id} does not belong to meeting/{meeting_id}"
return instance
meeting = self.datastore.fetch_model(
FullQualifiedId(Collection("meeting"), meeting_id),
[
"name",
"users_email_sender",
"users_email_replyto",
"users_email_subject",
"users_email_body",
"users_pdf_url",
],
lock_result=False,
)
from_email: Union[str, Address]
if users_email_sender := meeting.get("users_email_sender", "").strip():
blacklist = ("[", "]", "\\")
if any(x in users_email_sender for x in blacklist):
result["message"] = (
f'Invalid characters in the sender name configuration of meeting_id "{meeting_id}". Not allowed chars: "'
+ '", "'.join(blacklist)
+ '"'
)
return instance
from_email = Address(
users_email_sender, addr_spec=EmailSettings.default_from_email
)
else:
from_email = EmailSettings.default_from_email
if (
reply_to := meeting.get("users_email_replyto", "")
) and not self.check_email(reply_to):
result["message"] = f"The given reply_to address '{reply_to}' is not valid."
return instance
class format_dict(defaultdict):
def __missing__(self, key: str) -> str:
return f"'{key}'"
subject_format = format_dict(
None,
{
"event_name": meeting.get("name", ""),
"name": get_user_name(user),
"username": user.get("username", ""),
},
)
body_format = format_dict(
None,
{
"url": meeting.get("users_pdf_url", ""),
"password": user.get("default_password", ""),
**subject_format,
},
)
self.send_email(
self.mail_client,
from_email,
to_email,
meeting.get("users_email_subject", "").format_map(subject_format),
meeting.get("users_email_body", "").format_map(body_format),
reply_to=reply_to,
html=False,
)
result["sent"] = True
instance["last_email_send"] = round(time())
return super().update_instance(instance)
def validate_instance(self, instance: Dict[str, Any]) -> None:
type(self).schema_validator(instance)
def get_initial_result_false(self, instance: Dict[str, Any]) -> Dict[str, Any]:
return {
"sent": False,
"recipient_user_id": instance.get("id"),
"recipient_meeting_id": instance.get("meeting_id"),
}
|
[
"email.headerregistry.Address",
"time.time"
] |
[((6829, 6900), 'email.headerregistry.Address', 'Address', (['users_email_sender'], {'addr_spec': 'EmailSettings.default_from_email'}), '(users_email_sender, addr_spec=EmailSettings.default_from_email)\n', (6836, 6900), False, 'from email.headerregistry import Address\n'), ((8258, 8264), 'time.time', 'time', ([], {}), '()\n', (8262, 8264), False, 'from time import time\n')]
|
################################################################################
# Numba-DPPY
#
# Copyright 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
import dpctl
import numpy as np
import pytest
from numba import njit
import numba_dppy as dppy
from numba_dppy.tests._helper import (
assert_auto_offloading,
filter_strings,
is_gen12,
)
list_of_filter_strs = [
"opencl:gpu:0",
"level_zero:gpu:0",
"opencl:cpu:0",
]
@pytest.fixture(params=list_of_filter_strs)
def filter_str(request):
return request.param
list_of_trig_ops = [
"sin",
"cos",
"tan",
"arcsin",
"arccos",
"arctan",
"arctan2",
"sinh",
"cosh",
"tanh",
"arcsinh",
"arccosh",
"arctanh",
"deg2rad",
"rad2deg",
"degrees",
"radians",
]
@pytest.fixture(params=list_of_trig_ops)
def trig_op(request):
return request.param
list_of_dtypes = [
np.float32,
np.float64,
]
@pytest.fixture(params=list_of_trig_ops)
def dtype(request):
return request.param
@pytest.fixture(params=list_of_dtypes)
def input_arrays(request):
# The size of input and out arrays to be used
N = 2048
# Note: These inputs do not work for all of the functions and
# can result in warnings. E.g. arccosh needs the range of values
# to be greater than 0, while arccos needs them to be [-1,1].
# These warnings are relatively benign as NumPy will return "nan"
# for such cases.
a = np.array(np.random.random(N), request.param)
b = np.array(np.random.random(N), request.param)
return a, b
@pytest.mark.parametrize("filter_str", filter_strings)
def test_trigonometric_fn(filter_str, trig_op, input_arrays):
# FIXME: Why does archcosh fail on Gen12 discrete graphics card?
if trig_op == "arccosh" and is_gen12(filter_str):
pytest.skip()
a, b = input_arrays
trig_fn = getattr(np, trig_op)
actual = np.empty(shape=a.shape, dtype=a.dtype)
expected = np.empty(shape=a.shape, dtype=a.dtype)
if trig_op == "arctan2":
@njit
def f(a, b):
return trig_fn(a, b)
device = dpctl.SyclDevice(filter_str)
with dpctl.device_context(device), assert_auto_offloading():
actual = f(a, b)
expected = trig_fn(a, b)
else:
@njit
def f(a):
return trig_fn(a)
device = dpctl.SyclDevice(filter_str)
with dpctl.device_context(device), assert_auto_offloading():
actual = f(a)
expected = trig_fn(a)
np.testing.assert_allclose(actual, expected, rtol=1e-5, atol=0)
|
[
"dpctl.SyclDevice",
"numba_dppy.tests._helper.assert_auto_offloading",
"numpy.empty",
"dpctl.device_context",
"numpy.testing.assert_allclose",
"pytest.fixture",
"pytest.skip",
"numpy.random.random",
"numba_dppy.tests._helper.is_gen12",
"pytest.mark.parametrize"
] |
[((1088, 1130), 'pytest.fixture', 'pytest.fixture', ([], {'params': 'list_of_filter_strs'}), '(params=list_of_filter_strs)\n', (1102, 1130), False, 'import pytest\n'), ((1440, 1479), 'pytest.fixture', 'pytest.fixture', ([], {'params': 'list_of_trig_ops'}), '(params=list_of_trig_ops)\n', (1454, 1479), False, 'import pytest\n'), ((1585, 1624), 'pytest.fixture', 'pytest.fixture', ([], {'params': 'list_of_trig_ops'}), '(params=list_of_trig_ops)\n', (1599, 1624), False, 'import pytest\n'), ((1673, 1710), 'pytest.fixture', 'pytest.fixture', ([], {'params': 'list_of_dtypes'}), '(params=list_of_dtypes)\n', (1687, 1710), False, 'import pytest\n'), ((2219, 2272), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""filter_str"""', 'filter_strings'], {}), "('filter_str', filter_strings)\n", (2242, 2272), False, 'import pytest\n'), ((2553, 2591), 'numpy.empty', 'np.empty', ([], {'shape': 'a.shape', 'dtype': 'a.dtype'}), '(shape=a.shape, dtype=a.dtype)\n', (2561, 2591), True, 'import numpy as np\n'), ((2607, 2645), 'numpy.empty', 'np.empty', ([], {'shape': 'a.shape', 'dtype': 'a.dtype'}), '(shape=a.shape, dtype=a.dtype)\n', (2615, 2645), True, 'import numpy as np\n'), ((3173, 3237), 'numpy.testing.assert_allclose', 'np.testing.assert_allclose', (['actual', 'expected'], {'rtol': '(1e-05)', 'atol': '(0)'}), '(actual, expected, rtol=1e-05, atol=0)\n', (3199, 3237), True, 'import numpy as np\n'), ((2111, 2130), 'numpy.random.random', 'np.random.random', (['N'], {}), '(N)\n', (2127, 2130), True, 'import numpy as np\n'), ((2164, 2183), 'numpy.random.random', 'np.random.random', (['N'], {}), '(N)\n', (2180, 2183), True, 'import numpy as np\n'), ((2436, 2456), 'numba_dppy.tests._helper.is_gen12', 'is_gen12', (['filter_str'], {}), '(filter_str)\n', (2444, 2456), False, 'from numba_dppy.tests._helper import assert_auto_offloading, filter_strings, is_gen12\n'), ((2466, 2479), 'pytest.skip', 'pytest.skip', ([], {}), '()\n', (2477, 2479), False, 'import pytest\n'), ((2763, 2791), 'dpctl.SyclDevice', 'dpctl.SyclDevice', (['filter_str'], {}), '(filter_str)\n', (2779, 2791), False, 'import dpctl\n'), ((3014, 3042), 'dpctl.SyclDevice', 'dpctl.SyclDevice', (['filter_str'], {}), '(filter_str)\n', (3030, 3042), False, 'import dpctl\n'), ((2805, 2833), 'dpctl.device_context', 'dpctl.device_context', (['device'], {}), '(device)\n', (2825, 2833), False, 'import dpctl\n'), ((2835, 2859), 'numba_dppy.tests._helper.assert_auto_offloading', 'assert_auto_offloading', ([], {}), '()\n', (2857, 2859), False, 'from numba_dppy.tests._helper import assert_auto_offloading, filter_strings, is_gen12\n'), ((3056, 3084), 'dpctl.device_context', 'dpctl.device_context', (['device'], {}), '(device)\n', (3076, 3084), False, 'import dpctl\n'), ((3086, 3110), 'numba_dppy.tests._helper.assert_auto_offloading', 'assert_auto_offloading', ([], {}), '()\n', (3108, 3110), False, 'from numba_dppy.tests._helper import assert_auto_offloading, filter_strings, is_gen12\n')]
|
import hashlib
import os
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import patch
from samcli.lib.utils.hash import dir_checksum, str_checksum
class TestHash(TestCase):
def setUp(self):
self.temp_dir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(self.temp_dir, ignore_errors=True)
def test_dir_hash_independent_of_location(self):
temp_dir1 = os.path.join(self.temp_dir, "temp-dir-1")
os.mkdir(temp_dir1)
with open(os.path.join(temp_dir1, "test-file"), "w+") as f:
f.write("Testfile")
checksum1 = dir_checksum(temp_dir1)
temp_dir2 = shutil.move(temp_dir1, os.path.join(self.temp_dir, "temp-dir-2"))
checksum2 = dir_checksum(temp_dir2)
self.assertEqual(checksum1, checksum2)
def test_dir_hash_independent_of_file_order(self):
file1 = tempfile.NamedTemporaryFile(delete=False, dir=self.temp_dir)
file1.write(b"Testfile")
file1.close()
file2 = tempfile.NamedTemporaryFile(delete=False, dir=self.temp_dir)
file2.write(b"Testfile")
file2.close()
dir_checksums = {}
with patch("os.walk") as mockwalk:
mockwalk.return_value = [
(
self.temp_dir,
[],
[
file1.name,
file2.name,
],
),
]
dir_checksums["first"] = dir_checksum(self.temp_dir)
with patch("os.walk") as mockwalk:
mockwalk.return_value = [
(
self.temp_dir,
[],
[
file2.name,
file1.name,
],
),
]
dir_checksums["second"] = dir_checksum(self.temp_dir)
self.assertEqual(dir_checksums["first"], dir_checksums["second"])
def test_dir_hash_same_contents_diff_file_per_directory(self):
_file = tempfile.NamedTemporaryFile(delete=False, dir=self.temp_dir)
_file.write(b"Testfile")
_file.close()
checksum_before = dir_checksum(os.path.dirname(_file.name))
shutil.move(os.path.abspath(_file.name), os.path.join(os.path.dirname(_file.name), "different_name"))
checksum_after = dir_checksum(os.path.dirname(_file.name))
self.assertNotEqual(checksum_before, checksum_after)
def test_dir_hash_with_ignore_list(self):
_file = tempfile.NamedTemporaryFile(delete=False, dir=self.temp_dir)
_file.write(b"Testfile")
_file.close()
dir_path = os.path.dirname(_file.name)
checksum_before = dir_checksum(dir_path)
# add a file to .aws-sam/
aws_sam_dir_path = os.path.join(dir_path, ".aws-sam")
os.mkdir(aws_sam_dir_path)
_new_file = tempfile.NamedTemporaryFile(delete=False, dir=aws_sam_dir_path)
_new_file.write(b"dummy")
_new_file.close()
checksum_after = dir_checksum(os.path.dirname(_file.name))
self.assertNotEqual(checksum_before, checksum_after)
checksum_after_with_ignore_list = dir_checksum(os.path.dirname(_file.name), ignore_list=[".aws-sam"])
self.assertEqual(checksum_before, checksum_after_with_ignore_list)
def test_hashing_method(self):
_file = tempfile.NamedTemporaryFile(delete=False, dir=self.temp_dir)
_file.write(b"Testfile")
_file.close()
checksum_sha256 = dir_checksum(os.path.dirname(_file.name), hash_generator=hashlib.sha256())
checksum_md5 = dir_checksum(os.path.dirname(_file.name), hashlib.md5())
checksum_default = dir_checksum(os.path.dirname(_file.name))
self.assertEqual(checksum_default, checksum_md5)
self.assertNotEqual(checksum_md5, checksum_sha256)
def test_dir_cyclic_links(self):
_file = tempfile.NamedTemporaryFile(delete=False, dir=self.temp_dir)
_file.write(b"Testfile")
_file.close()
os.symlink(os.path.abspath(_file.name), os.path.join(os.path.dirname(_file.name), "symlink"))
os.symlink(
os.path.join(os.path.dirname(_file.name), "symlink"), os.path.join(os.path.dirname(_file.name), "symlink2")
)
os.unlink(os.path.abspath(_file.name))
os.symlink(os.path.join(os.path.dirname(_file.name), "symlink2"), os.path.abspath(_file.name))
with self.assertRaises(OSError) as ex:
dir_checksum(os.path.dirname(_file.name))
self.assertIn("Too many levels of symbolic links", ex.message)
def test_str_checksum(self):
checksum = str_checksum("Hello, World!")
self.assertEqual(checksum, "65a8e27d8879283831b664bd8b7f0ad4")
|
[
"os.mkdir",
"tempfile.NamedTemporaryFile",
"os.path.abspath",
"hashlib.md5",
"os.path.dirname",
"samcli.lib.utils.hash.dir_checksum",
"unittest.mock.patch",
"hashlib.sha256",
"tempfile.mkdtemp",
"samcli.lib.utils.hash.str_checksum",
"shutil.rmtree",
"os.path.join"
] |
[((252, 270), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (268, 270), False, 'import tempfile\n'), ((304, 352), 'shutil.rmtree', 'shutil.rmtree', (['self.temp_dir'], {'ignore_errors': '(True)'}), '(self.temp_dir, ignore_errors=True)\n', (317, 352), False, 'import shutil\n'), ((427, 468), 'os.path.join', 'os.path.join', (['self.temp_dir', '"""temp-dir-1"""'], {}), "(self.temp_dir, 'temp-dir-1')\n", (439, 468), False, 'import os\n'), ((477, 496), 'os.mkdir', 'os.mkdir', (['temp_dir1'], {}), '(temp_dir1)\n', (485, 496), False, 'import os\n'), ((617, 640), 'samcli.lib.utils.hash.dir_checksum', 'dir_checksum', (['temp_dir1'], {}), '(temp_dir1)\n', (629, 640), False, 'from samcli.lib.utils.hash import dir_checksum, str_checksum\n'), ((748, 771), 'samcli.lib.utils.hash.dir_checksum', 'dir_checksum', (['temp_dir2'], {}), '(temp_dir2)\n', (760, 771), False, 'from samcli.lib.utils.hash import dir_checksum, str_checksum\n'), ((892, 952), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'dir': 'self.temp_dir'}), '(delete=False, dir=self.temp_dir)\n', (919, 952), False, 'import tempfile\n'), ((1025, 1085), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'dir': 'self.temp_dir'}), '(delete=False, dir=self.temp_dir)\n', (1052, 1085), False, 'import tempfile\n'), ((2076, 2136), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'dir': 'self.temp_dir'}), '(delete=False, dir=self.temp_dir)\n', (2103, 2136), False, 'import tempfile\n'), ((2561, 2621), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'dir': 'self.temp_dir'}), '(delete=False, dir=self.temp_dir)\n', (2588, 2621), False, 'import tempfile\n'), ((2697, 2724), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (2712, 2724), False, 'import os\n'), ((2751, 2773), 'samcli.lib.utils.hash.dir_checksum', 'dir_checksum', (['dir_path'], {}), '(dir_path)\n', (2763, 2773), False, 'from samcli.lib.utils.hash import dir_checksum, str_checksum\n'), ((2836, 2870), 'os.path.join', 'os.path.join', (['dir_path', '""".aws-sam"""'], {}), "(dir_path, '.aws-sam')\n", (2848, 2870), False, 'import os\n'), ((2879, 2905), 'os.mkdir', 'os.mkdir', (['aws_sam_dir_path'], {}), '(aws_sam_dir_path)\n', (2887, 2905), False, 'import os\n'), ((2926, 2989), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'dir': 'aws_sam_dir_path'}), '(delete=False, dir=aws_sam_dir_path)\n', (2953, 2989), False, 'import tempfile\n'), ((3417, 3477), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'dir': 'self.temp_dir'}), '(delete=False, dir=self.temp_dir)\n', (3444, 3477), False, 'import tempfile\n'), ((3953, 4013), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'dir': 'self.temp_dir'}), '(delete=False, dir=self.temp_dir)\n', (3980, 4013), False, 'import tempfile\n'), ((4700, 4729), 'samcli.lib.utils.hash.str_checksum', 'str_checksum', (['"""Hello, World!"""'], {}), "('Hello, World!')\n", (4712, 4729), False, 'from samcli.lib.utils.hash import dir_checksum, str_checksum\n'), ((685, 726), 'os.path.join', 'os.path.join', (['self.temp_dir', '"""temp-dir-2"""'], {}), "(self.temp_dir, 'temp-dir-2')\n", (697, 726), False, 'import os\n'), ((1182, 1198), 'unittest.mock.patch', 'patch', (['"""os.walk"""'], {}), "('os.walk')\n", (1187, 1198), False, 'from unittest.mock import patch\n'), ((1514, 1541), 'samcli.lib.utils.hash.dir_checksum', 'dir_checksum', (['self.temp_dir'], {}), '(self.temp_dir)\n', (1526, 1541), False, 'from samcli.lib.utils.hash import dir_checksum, str_checksum\n'), ((1556, 1572), 'unittest.mock.patch', 'patch', (['"""os.walk"""'], {}), "('os.walk')\n", (1561, 1572), False, 'from unittest.mock import patch\n'), ((1889, 1916), 'samcli.lib.utils.hash.dir_checksum', 'dir_checksum', (['self.temp_dir'], {}), '(self.temp_dir)\n', (1901, 1916), False, 'from samcli.lib.utils.hash import dir_checksum, str_checksum\n'), ((2231, 2258), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (2246, 2258), False, 'import os\n'), ((2280, 2307), 'os.path.abspath', 'os.path.abspath', (['_file.name'], {}), '(_file.name)\n', (2295, 2307), False, 'import os\n'), ((2408, 2435), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (2423, 2435), False, 'import os\n'), ((3089, 3116), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (3104, 3116), False, 'import os\n'), ((3235, 3262), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (3250, 3262), False, 'import os\n'), ((3572, 3599), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (3587, 3599), False, 'import os\n'), ((3670, 3697), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (3685, 3697), False, 'import os\n'), ((3699, 3712), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (3710, 3712), False, 'import hashlib\n'), ((3754, 3781), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (3769, 3781), False, 'import os\n'), ((4088, 4115), 'os.path.abspath', 'os.path.abspath', (['_file.name'], {}), '(_file.name)\n', (4103, 4115), False, 'import os\n'), ((4339, 4366), 'os.path.abspath', 'os.path.abspath', (['_file.name'], {}), '(_file.name)\n', (4354, 4366), False, 'import os\n'), ((4442, 4469), 'os.path.abspath', 'os.path.abspath', (['_file.name'], {}), '(_file.name)\n', (4457, 4469), False, 'import os\n'), ((515, 551), 'os.path.join', 'os.path.join', (['temp_dir1', '"""test-file"""'], {}), "(temp_dir1, 'test-file')\n", (527, 551), False, 'import os\n'), ((2322, 2349), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (2337, 2349), False, 'import os\n'), ((3616, 3632), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (3630, 3632), False, 'import hashlib\n'), ((4130, 4157), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (4145, 4157), False, 'import os\n'), ((4216, 4243), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (4231, 4243), False, 'import os\n'), ((4270, 4297), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (4285, 4297), False, 'import os\n'), ((4400, 4427), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (4415, 4427), False, 'import os\n'), ((4543, 4570), 'os.path.dirname', 'os.path.dirname', (['_file.name'], {}), '(_file.name)\n', (4558, 4570), False, 'import os\n')]
|
# -*- coding: utf-8 -*-
"""
A urls module that raises a DeadlineExceededError
:Copyright: (c) 2010 <NAME> <<EMAIL>> All rights reserved.
:license: BSD, see LICENSE for more details.
"""
from google.appengine.runtime import DeadlineExceededError
raise DeadlineExceededError()
|
[
"google.appengine.runtime.DeadlineExceededError"
] |
[((255, 278), 'google.appengine.runtime.DeadlineExceededError', 'DeadlineExceededError', ([], {}), '()\n', (276, 278), False, 'from google.appengine.runtime import DeadlineExceededError\n')]
|
# -*- coding: utf-8 -*-
#
# Copyright (c) 2009, <NAME>
# Copyright (c) 2010, <NAME>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the <ORGANIZATION> nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ----------------------------------------------------------------------------
import re
from trac.core import Component, implements
from trac.ticket import model
from trac.web.chrome import add_warning
from trac.config import ListOption
from announcer.api import IAnnouncementSubscriber, istrue
from announcer.api import IAnnouncementPreferenceProvider
from announcer.api import _
from announcer.util.settings import BoolSubscriptionSetting
class TicketComponentSubscriber(Component):
implements(IAnnouncementSubscriber, IAnnouncementPreferenceProvider)
def subscriptions(self, event):
if event.realm != 'ticket':
return
if event.category not in ('changed', 'created', 'attachment added'):
return
settings = self._settings()
setting = settings.get(event.target['component'])
if setting:
for result in setting.get_subscriptions():
self.log.debug("TicketComponentSubscriber added '%s " \
"(%s)' for component '%s'"%(
result[1], result[2], event.target['component']))
yield result
def get_announcement_preference_boxes(self, req):
if req.authname == "anonymous" and 'email' not in req.session:
return
yield "joinable_components", _("Ticket Component Subscriptions")
def render_announcement_preference_box(self, req, panel):
settings = self._settings()
if req.method == "POST":
for attr, setting in settings.items():
setting.set_user_setting(req.session,
value=req.args.get('component_%s'%attr), save=False)
req.session.save()
d = {}
for attr, setting in settings.items():
d[attr]= setting.get_user_setting(req.session.sid)[1]
return "prefs_announcer_joinable_components.html", dict(components=d)
def _settings(self):
settings = {}
for component in model.Component.select(self.env):
settings[component.name] = BoolSubscriptionSetting(
self.env,
'component_%s'%component.name
)
return settings
|
[
"trac.ticket.model.Component.select",
"announcer.api._",
"trac.core.implements",
"announcer.util.settings.BoolSubscriptionSetting"
] |
[((2116, 2184), 'trac.core.implements', 'implements', (['IAnnouncementSubscriber', 'IAnnouncementPreferenceProvider'], {}), '(IAnnouncementSubscriber, IAnnouncementPreferenceProvider)\n', (2126, 2184), False, 'from trac.core import Component, implements\n'), ((3621, 3653), 'trac.ticket.model.Component.select', 'model.Component.select', (['self.env'], {}), '(self.env)\n', (3643, 3653), False, 'from trac.ticket import model\n'), ((3694, 3760), 'announcer.util.settings.BoolSubscriptionSetting', 'BoolSubscriptionSetting', (['self.env', "('component_%s' % component.name)"], {}), "(self.env, 'component_%s' % component.name)\n", (3717, 3760), False, 'from announcer.util.settings import BoolSubscriptionSetting\n'), ((2956, 2991), 'announcer.api._', '_', (['"""Ticket Component Subscriptions"""'], {}), "('Ticket Component Subscriptions')\n", (2957, 2991), False, 'from announcer.api import _\n')]
|
import tkinter
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
from matplotlib.figure import Figure
import requests
from scipy.signal import medfilt
from copy import deepcopy
from json import loads
import numpy as np
with open('endomondo.config', 'r') as conf:
username = conf.readline()[:-1]
password = conf.readline()
class Requester:
def __init__(self, email, password):
self.email = email
self.password = password
self.session = requests.session()
self.cookies = {}
self.headers = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'en-US,en;q=0.5',
'Referer': 'https://www.endomondo.com/home',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
'Cache-Control': 'max-age=0',
'TE': 'Trailers',
}
self.data = '{"email":"' + self.email + '","password":"' + self.password + '","remember":true}'
def login(self):
# getting csrf token, jsessionid and awselb
response = self.session.get('https://www.endomondo.com/', headers=self.headers, cookies=self.cookies)
self.headers["X-CSRF-TOKEN"] = response.cookies["CSRF_TOKEN"]
self.headers["Referer"] = "https://www.endomondo.com/login"
self.headers["Origin"] = "https://www.endomondo.com"
self.headers["Content-Type"] = "application/json;charset=utf-8"
response2 = self.session.post('https://www.endomondo.com/rest/session', headers=self.headers,
cookies=self.cookies, data=self.data)
def get_workout(self, url):
self.headers["Referer"] = url
response = self.session.get("https://www.endomondo.com/rest/v1/" + url[26:], headers=self.headers,
cookies=self.cookies)
return response.content.decode('utf-8')
class Training:
class Plot:
def __init__(self, data, y_label, line_color):
self.raw_data = data
self.data = data
self.y_label = y_label
self.line_color = line_color
self.visible = True
self.inherited = None
def set_visible(self, boolean):
self.visible = boolean
def average(self, _i):
self.data = medfilt(self.raw_data, _i)
def __init__(self, json, line_type):
self.decoded = loads(json)
self.line_type = line_type
self.name = self.decoded['id']
# creating all plots
heart_rate = []
for i in range(len(self.decoded['points']['points'])):
if "heart_rate" in self.decoded['points']['points'][i]['sensor_data']:
heart_rate.append(self.decoded['points']['points'][i]['sensor_data']['heart_rate'])
else:
if heart_rate:
heart_rate.append(heart_rate[-1])
else:
heart_rate.append(0)
self.plot_heart_rate = self.Plot(heart_rate, "[heart rate] = bpm", 'tab:red')
self.distance = [self.decoded["points"]["points"][i]["distance"]
for i in range(len(self. decoded['points']['points']))]
speed = []
for i in range(len(self.decoded['points']['points'])):
if "speed" in self.decoded['points']['points'][i]['sensor_data']:
speed.append(self.decoded['points']['points'][i]['sensor_data']['speed'])
else:
if speed:
speed.append(speed[-1])
else:
speed.append(0)
avg = np.average(speed)
for j, i in enumerate(speed):
try:
speed[j] = 60 / i
except ZeroDivisionError:
speed[j] = 60 / avg
self.plot_speed = self.Plot(speed, "[speed] = minpkm", 'tab:blue')
alt = []
for i in range(len(self.decoded['points']['points'])):
if "altitude" in self.decoded['points']['points'][i]:
alt.append(self.decoded['points']['points'][i]['altitude'])
else:
if alt:
alt.append(alt[-1])
else:
alt.append(None)
for j, i in enumerate(alt):
if i is None:
for el in alt[j:]:
if el:
alt[j] = el
self.plot_altitude = self.Plot(alt, "[altitude] = m", 'tab:green')
self.plot_speed.inherited = [self.distance, self.line_type, self.name]
self.plot_altitude.inherited = [self.distance, self.line_type, self.name]
self.plot_heart_rate.inherited = [self.distance, self.line_type, self.name]
self.date = self.decoded["local_start_time"]
self.empty_plot = self.Plot([0 for _ in range(len(self.decoded['points']['points']))], "", "tab:blue")
self.empty_plot.set_visible(False)
self.empty_plot.inherited = [self.distance, self.line_type, self.name]
def txt_changed_0(txt):
if len(txt) >= 50:
Trainings[0] = Training(user.get_workout(txt), '-')
plot(states)
def txt_changed_1(txt):
if not txt:
Trainings.pop(1)
if len(txt) >= 50:
if len(Trainings) >= 2:
Trainings[1] = Training(user.get_workout(txt), '--')
else:
Trainings.append(Training(user.get_workout(txt), '--'))
plot(states)
def txt_changed_2(txt):
if not txt:
Trainings.pop(2)
if len(txt) >= 50:
if len(Trainings) >= 3:
Trainings[2] = Training(user.get_workout(txt), ':')
else:
Trainings.append(Training(user.get_workout(txt), ':'))
plot(states)
def txt_changed_3(txt):
if not txt:
Trainings.pop(3)
if len(txt) >= 50:
if len(Trainings) >= 4:
Trainings[3] = Training(user.get_workout(txt), '-.')
else:
Trainings.append(Training(user.get_workout(txt), '-.'))
plot(states)
def slide(numb):
numb = int(numb)
for training in Trainings:
training.plot_speed.average(numb)
training.plot_heart_rate.average(numb)
plot(states)
def slide_change(n):
n = int(n)
if not n % 2:
slider.set(n + 1)
def btn_slide():
slide(int(slider.get()))
def check_box():
global states
states['plot_speed'] = varSpeed.get()
states['plot_altitude'] = varAltitude.get()
states['plot_heart_rate'] = varHeart.get()
plot(states)
def submit():
global txtBoxes
temp = [txtBox0.get(), txtBox1.get(), txtBox2.get(), txtBox3.get()]
for i, element in enumerate(temp):
if not element == txtBoxes[i]:
if i == 0:
txt_changed_0(element)
if i == 1:
txt_changed_1(element)
if i == 2:
txt_changed_2(element)
if i == 3:
txt_changed_3(element)
txtBoxes[i] = element
user = Requester(username, password)
user.login()
Trainings = [Training(user.get_workout("https://www.endomondo.com/users/19154541/workouts/1458780940"), '-')]
states = {'plot_speed': True, 'plot_altitude': True, 'plot_heart_rate': False}
txtBoxes = ['', '', '', '']
root = tkinter.Tk()
root.wm_title("Endomondo Analyzer")
fig = Figure(figsize=(5, 4), dpi=100)
fig.add_subplot(111)
ax1 = fig.subplots()
ax2 = ax1.twinx()
canvas = FigureCanvasTkAgg(fig, master=root) # A tk.DrawingArea.
canvas.draw()
canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=1)
toolbar = NavigationToolbar2Tk(canvas, root)
toolbar.update()
canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=1)
txtBox0 = tkinter.Entry(root)
txtBox0.place(x=20, y=40)
lbl0 = tkinter.Label(root, text="durchgezogen")
lbl0.place(x=150, y=40)
lbl1 = tkinter.Label(root, text="gestrichelt")
lbl1.place(x=150, y=80)
lbl0 = tkinter.Label(root, text="gepunktet")
lbl0.place(x=150, y=120)
lbl1 = tkinter.Label(root, text="gestrichpunktet")
lbl1.place(x=150, y=160)
txtBox1 = tkinter.Entry(root)
txtBox1.place(x=20, y=80)
txtBox2 = tkinter.Entry(root)
txtBox2.place(x=20, y=120)
txtBox3 = tkinter.Entry(root)
txtBox3.place(x=20, y=160)
slider = tkinter.Scale(root, from_=1, to=35, orient=tkinter.HORIZONTAL, length=300, command=slide_change)
slider.place(x=20, y=580)
varSpeed = tkinter.BooleanVar()
chckSpeed = tkinter.Checkbutton(root, text="Speed", command=check_box, variable=varSpeed)
chckSpeed.place(x=20, y=410)
chckSpeed.select()
varAltitude = tkinter.BooleanVar()
chckAltitude = tkinter.Checkbutton(root, text="Altitude", command=check_box, variable=varAltitude)
chckAltitude.place(x=20, y=450)
chckAltitude.select()
varHeart = tkinter.BooleanVar()
chckHeart = tkinter.Checkbutton(root, text="Heart Rate", command=check_box, variable=varHeart)
chckHeart.place(x=20, y=490)
btnSubmit = tkinter.Button(root, command=submit, text="Submit")
btnSubmit.place(x=20, y=200)
btnChangeScale = tkinter.Button(root, command=btn_slide, text="Change Average")
btnChangeScale.place(x=20, y=540)
Dates = tkinter.StringVar(root)
lblDates = tkinter.Label(root, textvariable=Dates)
lblDates.place(x=20, y=250)
def _quit():
root.quit() # stops mainloop
root.destroy() # this is necessary on Windows to prevent
# Fatal Python Error: PyEval_RestoreThread: NULL tstate
def plot(_dict):
# choosing which plots to show on which axis
plot1 = None
plot2 = None
dictionary = deepcopy(_dict)
for element in dictionary:
if dictionary[element]:
plot1 = element
dictionary[element] = 0
break
for element in dictionary:
if dictionary[element]:
plot2 = element
dictionary[element] = 0
break
global ax1
global ax2
color = ""
ax1.clear()
ax2.clear()
# defining lists of plots
if plot1 == "plot_speed":
plots1 = [i.plot_speed for i in Trainings]
elif plot1 == "plot_altitude":
plots1 = [i.plot_altitude for i in Trainings]
elif plot1 == "plot_heart_rate":
plots1 = [i.plot_heart_rate for i in Trainings]
if plot2 == "plot_altitude":
plots2 = [i.plot_altitude for i in Trainings]
elif plot2 == "plot_heart_rate":
plots2 = [i.plot_heart_rate for i in Trainings]
if plot1 is None:
plots1 = [Trainings[0].empty_plot]
if plot2 is None:
plots2 = [Trainings[0].empty_plot]
color = plots1[0].line_color
ax1.set_xlabel('[distance] = km')
ax1.set_ylabel(plots1[0].y_label, color=color)
dates = "Dates:\n"
for training in Trainings:
dates = dates + training.date[:10] + "\n"
Dates.set(dates)
for pl in plots1:
ax1.plot(pl.inherited[0], pl.data, color=color, visible=pl.visible, linestyle=pl.inherited[1])
ax1.tick_params(axis='y', labelcolor=color)
color = plots2[0].line_color
ax2.set_xlabel('[distance] = km')
ax2.set_ylabel(plots2[0].y_label, color=color)
for pl in plots2:
ax2.plot(pl.inherited[0], pl.data, color=color, visible=pl.visible, linestyle=pl.inherited[1])
ax2.tick_params(axis='y', labelcolor=color)
fig.subplots_adjust(left=0.2)
fig.canvas.draw_idle()
plot(states)
fig.canvas.draw_idle()
button = tkinter.Button(master=root, text="Quit", command=_quit)
button.pack(side=tkinter.BOTTOM)
tkinter.mainloop()
|
[
"matplotlib.backends.backend_tkagg.NavigationToolbar2Tk",
"tkinter.Checkbutton",
"tkinter.StringVar",
"copy.deepcopy",
"requests.session",
"json.loads",
"numpy.average",
"tkinter.mainloop",
"tkinter.Button",
"tkinter.Entry",
"scipy.signal.medfilt",
"matplotlib.figure.Figure",
"tkinter.Scale",
"tkinter.BooleanVar",
"tkinter.Label",
"tkinter.Tk",
"matplotlib.backends.backend_tkagg.FigureCanvasTkAgg"
] |
[((7376, 7388), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (7386, 7388), False, 'import tkinter\n'), ((7432, 7463), 'matplotlib.figure.Figure', 'Figure', ([], {'figsize': '(5, 4)', 'dpi': '(100)'}), '(figsize=(5, 4), dpi=100)\n', (7438, 7463), False, 'from matplotlib.figure import Figure\n'), ((7534, 7569), 'matplotlib.backends.backend_tkagg.FigureCanvasTkAgg', 'FigureCanvasTkAgg', (['fig'], {'master': 'root'}), '(fig, master=root)\n', (7551, 7569), False, 'from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk\n'), ((7691, 7725), 'matplotlib.backends.backend_tkagg.NavigationToolbar2Tk', 'NavigationToolbar2Tk', (['canvas', 'root'], {}), '(canvas, root)\n', (7711, 7725), False, 'from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk\n'), ((7829, 7848), 'tkinter.Entry', 'tkinter.Entry', (['root'], {}), '(root)\n', (7842, 7848), False, 'import tkinter\n'), ((7882, 7922), 'tkinter.Label', 'tkinter.Label', (['root'], {'text': '"""durchgezogen"""'}), "(root, text='durchgezogen')\n", (7895, 7922), False, 'import tkinter\n'), ((7954, 7993), 'tkinter.Label', 'tkinter.Label', (['root'], {'text': '"""gestrichelt"""'}), "(root, text='gestrichelt')\n", (7967, 7993), False, 'import tkinter\n'), ((8025, 8062), 'tkinter.Label', 'tkinter.Label', (['root'], {'text': '"""gepunktet"""'}), "(root, text='gepunktet')\n", (8038, 8062), False, 'import tkinter\n'), ((8095, 8138), 'tkinter.Label', 'tkinter.Label', (['root'], {'text': '"""gestrichpunktet"""'}), "(root, text='gestrichpunktet')\n", (8108, 8138), False, 'import tkinter\n'), ((8174, 8193), 'tkinter.Entry', 'tkinter.Entry', (['root'], {}), '(root)\n', (8187, 8193), False, 'import tkinter\n'), ((8230, 8249), 'tkinter.Entry', 'tkinter.Entry', (['root'], {}), '(root)\n', (8243, 8249), False, 'import tkinter\n'), ((8287, 8306), 'tkinter.Entry', 'tkinter.Entry', (['root'], {}), '(root)\n', (8300, 8306), False, 'import tkinter\n'), ((8345, 8445), 'tkinter.Scale', 'tkinter.Scale', (['root'], {'from_': '(1)', 'to': '(35)', 'orient': 'tkinter.HORIZONTAL', 'length': '(300)', 'command': 'slide_change'}), '(root, from_=1, to=35, orient=tkinter.HORIZONTAL, length=300,\n command=slide_change)\n', (8358, 8445), False, 'import tkinter\n'), ((8480, 8500), 'tkinter.BooleanVar', 'tkinter.BooleanVar', ([], {}), '()\n', (8498, 8500), False, 'import tkinter\n'), ((8513, 8590), 'tkinter.Checkbutton', 'tkinter.Checkbutton', (['root'], {'text': '"""Speed"""', 'command': 'check_box', 'variable': 'varSpeed'}), "(root, text='Speed', command=check_box, variable=varSpeed)\n", (8532, 8590), False, 'import tkinter\n'), ((8653, 8673), 'tkinter.BooleanVar', 'tkinter.BooleanVar', ([], {}), '()\n', (8671, 8673), False, 'import tkinter\n'), ((8689, 8777), 'tkinter.Checkbutton', 'tkinter.Checkbutton', (['root'], {'text': '"""Altitude"""', 'command': 'check_box', 'variable': 'varAltitude'}), "(root, text='Altitude', command=check_box, variable=\n varAltitude)\n", (8708, 8777), False, 'import tkinter\n'), ((8838, 8858), 'tkinter.BooleanVar', 'tkinter.BooleanVar', ([], {}), '()\n', (8856, 8858), False, 'import tkinter\n'), ((8871, 8958), 'tkinter.Checkbutton', 'tkinter.Checkbutton', (['root'], {'text': '"""Heart Rate"""', 'command': 'check_box', 'variable': 'varHeart'}), "(root, text='Heart Rate', command=check_box, variable=\n varHeart)\n", (8890, 8958), False, 'import tkinter\n'), ((8996, 9047), 'tkinter.Button', 'tkinter.Button', (['root'], {'command': 'submit', 'text': '"""Submit"""'}), "(root, command=submit, text='Submit')\n", (9010, 9047), False, 'import tkinter\n'), ((9096, 9158), 'tkinter.Button', 'tkinter.Button', (['root'], {'command': 'btn_slide', 'text': '"""Change Average"""'}), "(root, command=btn_slide, text='Change Average')\n", (9110, 9158), False, 'import tkinter\n'), ((9202, 9225), 'tkinter.StringVar', 'tkinter.StringVar', (['root'], {}), '(root)\n', (9219, 9225), False, 'import tkinter\n'), ((9237, 9276), 'tkinter.Label', 'tkinter.Label', (['root'], {'textvariable': 'Dates'}), '(root, textvariable=Dates)\n', (9250, 9276), False, 'import tkinter\n'), ((11425, 11480), 'tkinter.Button', 'tkinter.Button', ([], {'master': 'root', 'text': '"""Quit"""', 'command': '_quit'}), "(master=root, text='Quit', command=_quit)\n", (11439, 11480), False, 'import tkinter\n'), ((11515, 11533), 'tkinter.mainloop', 'tkinter.mainloop', ([], {}), '()\n', (11531, 11533), False, 'import tkinter\n'), ((9614, 9629), 'copy.deepcopy', 'deepcopy', (['_dict'], {}), '(_dict)\n', (9622, 9629), False, 'from copy import deepcopy\n'), ((511, 529), 'requests.session', 'requests.session', ([], {}), '()\n', (527, 529), False, 'import requests\n'), ((2558, 2569), 'json.loads', 'loads', (['json'], {}), '(json)\n', (2563, 2569), False, 'from json import loads\n'), ((3762, 3779), 'numpy.average', 'np.average', (['speed'], {}), '(speed)\n', (3772, 3779), True, 'import numpy as np\n'), ((2466, 2492), 'scipy.signal.medfilt', 'medfilt', (['self.raw_data', '_i'], {}), '(self.raw_data, _i)\n', (2473, 2492), False, 'from scipy.signal import medfilt\n')]
|
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------
"""Azure Service Fabric CLI package that can be installed using setuptools"""
import os
from setuptools import setup
def read(fname):
"""Local read helper function for long documentation"""
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='sfctl',
version='11.1.0',
description='Azure Service Fabric command line',
long_description=read('README.rst'),
url='https://github.com/Azure/service-fabric-cli',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'Environment :: Console',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
],
keywords='servicefabric azure',
python_requires='>3.5, <4',
packages=[
'sfctl',
'sfctl.helps',
'sfctl.tests'
],
install_requires=[
'knack==0.6.3',
'msrest>=0.5.0',
'msrestazure',
'requests',
'azure-servicefabric==8.0.0.0',
'adal',
'future',
'applicationinsights',
'psutil',
'portalocker',
'six',
"joblib",
"tqdm"
],
extras_require={
'test': [
'coverage',
'nose2',
'pylint==2.7.2',
'vcrpy',
'mock',
'contextlib2',
]
},
entry_points={
'console_scripts': ['sfctl=sfctl:launch']
}
)
|
[
"os.path.dirname"
] |
[((544, 569), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (559, 569), False, 'import os\n')]
|
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test basic integration with Numeric Python.
# Author: <NAME>, <EMAIL>
#
###############################################################################
# Copyright (c) 2003, <NAME> <<EMAIL>>
# Copyright (c) 2009-2010, <NAME> <even dot rouault at mines-paris dot org>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
###############################################################################
import sys
sys.path.append( '../pymod' )
import gdaltest
from osgeo import gdal
###############################################################################
# verify that we can load Numeric python, and find the Numpy driver.
def numpy_rw_1():
gdaltest.numpy_drv = None
try:
from osgeo import gdalnumeric
gdalnumeric.zeros
except:
return 'skip'
try:
import _gdal
_gdal.GDALRegister_NUMPY() # only needed for old style bindings.
gdal.AllRegister()
except:
pass
gdaltest.numpy_drv = gdal.GetDriverByName( 'NUMPY' )
if gdaltest.numpy_drv is None:
gdaltest.post_reason( 'NUMPY driver not found!' )
return 'fail'
return 'success'
###############################################################################
# Load a test file into a memory Numpy array, and verify the checksum.
def numpy_rw_2():
if gdaltest.numpy_drv is None:
return 'skip'
from osgeo import gdalnumeric
array = gdalnumeric.LoadFile( 'data/utmsmall.tif' )
if array is None:
gdaltest.post_reason( 'Failed to load utmsmall.tif into array')
return 'fail'
ds = gdalnumeric.OpenArray( array )
if ds is None:
gdaltest.post_reason( 'Failed to open memory array as dataset.' )
return 'fail'
bnd = ds.GetRasterBand(1)
if bnd.Checksum() != 50054:
gdaltest.post_reason( 'Didnt get expected checksum on reopened file')
return 'fail'
ds = None
return 'success'
###############################################################################
# Test loading complex data.
def numpy_rw_3():
if gdaltest.numpy_drv is None:
return 'skip'
ds = gdal.Open( 'data/cint_sar.tif' )
array = ds.ReadAsArray()
if array[2][3] != 116-16j:
print(array[0][2][3])
gdaltest.post_reason( 'complex value read improperly.' )
return 'fail'
return 'success'
###############################################################################
# Test a band read with downsampling.
def numpy_rw_4():
if gdaltest.numpy_drv is None:
return 'skip'
ds = gdal.Open( 'data/byte.tif' )
array = ds.GetRasterBand(1).ReadAsArray(0,0,20,20,5,5)
if array[2][3] != 123:
print(array[2][3])
gdaltest.post_reason( 'Read wrong value - perhaps downsampling algorithm has changed subtly?' )
return 'fail'
return 'success'
###############################################################################
# Test reading a multi-band file.
def numpy_rw_5():
if gdaltest.numpy_drv is None:
return 'skip'
from osgeo import gdalnumeric
array = gdalnumeric.LoadFile('data/rgbsmall.tif',35,21,1,1)
if array[0][0][0] != 78:
print(array)
gdaltest.post_reason( 'value read improperly.' )
return 'fail'
if array[1][0][0] != 117:
print(array)
gdaltest.post_reason( 'value read improperly.' )
return 'fail'
if array[2][0][0] != 24:
print(array)
gdaltest.post_reason( 'value read improperly.' )
return 'fail'
array = gdalnumeric.LoadFile('data/rgbsmall.tif', buf_xsize=1, buf_ysize=1, resample_alg = gdal.GRIORA_Bilinear)
if array.shape[0] != 3 or array.shape[1] != 1 or array.shape[2] != 1:
print(array.shape)
gdaltest.post_reason( 'wrong array shape.' )
return 'fail'
if array[0][0][0] != 70 or array[1][0][0] != 97 or array[2][0][0] != 29:
print(array)
gdaltest.post_reason( 'value read improperly.' )
return 'fail'
import numpy
array = numpy.zeros([3, 1, 1], dtype = numpy.uint8)
ds = gdal.Open('data/rgbsmall.tif')
ds.ReadAsArray( buf_obj = array, resample_alg = gdal.GRIORA_Bilinear )
if array[0][0][0] != 70 or array[1][0][0] != 97 or array[2][0][0] != 29:
print(array)
gdaltest.post_reason( 'value read improperly.' )
return 'fail'
return 'success'
###############################################################################
# Check that Band.ReadAsArray() can accept an already allocated array (#2658, #3028)
def numpy_rw_6():
if gdaltest.numpy_drv is None:
return 'skip'
import numpy
from osgeo import gdalnumeric
ds = gdal.Open( 'data/byte.tif' )
array = numpy.zeros( [ds.RasterYSize, ds.RasterXSize], numpy.uint8 )
array_res = ds.GetRasterBand(1).ReadAsArray(buf_obj = array)
if array is not array_res:
return 'fail'
ds2 = gdalnumeric.OpenArray( array )
if ds2.GetRasterBand(1).Checksum() != ds.GetRasterBand(1).Checksum():
return 'fail'
return 'success'
###############################################################################
# Check that Dataset.ReadAsArray() can accept an already allocated array (#2658, #3028)
def numpy_rw_7():
if gdaltest.numpy_drv is None:
return 'skip'
import numpy
from osgeo import gdalnumeric
ds = gdal.Open( 'data/byte.tif' )
array = numpy.zeros( [1, ds.RasterYSize, ds.RasterXSize], numpy.uint8 )
array_res = ds.ReadAsArray(buf_obj = array)
if array is not array_res:
return 'fail'
ds2 = gdalnumeric.OpenArray( array )
if ds2.GetRasterBand(1).Checksum() != ds.GetRasterBand(1).Checksum():
return 'fail'
# Try again with a 2D array
array = numpy.zeros( [ds.RasterYSize, ds.RasterXSize], numpy.uint8 )
array_res = ds.ReadAsArray(buf_obj = array)
if array is not array_res:
return 'fail'
ds2 = gdalnumeric.OpenArray( array )
if ds2.GetRasterBand(1).Checksum() != ds.GetRasterBand(1).Checksum():
return 'fail'
# With a multi band file
ds = gdal.Open( 'data/rgbsmall.tif' )
array = numpy.zeros( [ds.RasterCount, ds.RasterYSize, ds.RasterXSize], numpy.uint8 )
array_res = ds.ReadAsArray(buf_obj = array)
if array is not array_res:
return 'fail'
ds2 = gdalnumeric.OpenArray( array )
if ds2.GetRasterBand(1).Checksum() != ds.GetRasterBand(1).Checksum():
return 'fail'
return 'success'
###############################################################################
# Check that Dataset.ReadAsArray() with multi-band data
def numpy_rw_8():
if gdaltest.numpy_drv is None:
return 'skip'
import numpy
from osgeo import gdalnumeric
ds = gdal.Open( 'data/rgbsmall.tif' )
array = numpy.zeros( [ds.RasterCount,ds.RasterYSize, ds.RasterXSize], numpy.uint8 )
ds.ReadAsArray(buf_obj = array)
ds2 = gdalnumeric.OpenArray( array )
for i in range(1, ds.RasterCount):
if ds2.GetRasterBand(i).Checksum() != ds.GetRasterBand(i).Checksum():
return 'fail'
return 'success'
###############################################################################
# Test Band.WriteArray()
def numpy_rw_9():
if gdaltest.numpy_drv is None:
return 'skip'
ds = gdal.Open( 'data/byte.tif' )
array = ds.ReadAsArray()
out_ds = gdal.GetDriverByName('MEM').Create('', ds.RasterYSize, ds.RasterXSize)
out_ds.GetRasterBand(1).WriteArray(array)
cs = out_ds.GetRasterBand(1).Checksum()
out_ds = None
ds = None
if cs != 4672:
gdaltest.post_reason('did not get expected checksum')
print(cs)
return 'fail'
return 'success'
###############################################################################
# Test signed byte handling
def numpy_rw_10():
if gdaltest.numpy_drv is None:
return 'skip'
import numpy
ds = gdal.GetDriverByName('GTiff').Create('/vsimem/signed8.tif', 2, 1, options = ['PIXELTYPE=SIGNEDBYTE'])
ar = numpy.empty([1, 2], dtype = numpy.int8)
ar[0][0] = -128
ar[0][1] = 127
ds.GetRasterBand(1).WriteArray(ar)
ds = None
ds = gdal.Open('/vsimem/signed8.tif')
ar2 = ds.ReadAsArray()
ar3 = numpy.empty_like(ar2)
ds.GetRasterBand(1).ReadAsArray(buf_obj = ar3)
ds = None
gdal.Unlink('/vsimem/signed8.tif')
if ar2[0][0] != -128 or ar2[0][1] != 127:
gdaltest.post_reason('did not get expected result (1)')
print(ar2)
return 'fail'
if ar3[0][0] != -128 or ar3[0][1] != 127:
gdaltest.post_reason('did not get expected result (2)')
print(ar3)
return 'fail'
return 'success'
###############################################################################
# Test all datatypes
def numpy_rw_11():
if gdaltest.numpy_drv is None:
return 'skip'
import numpy
type_tuples = [ ( 'uint8', gdal.GDT_Byte, numpy.uint8, 255 ),
( 'uint16', gdal.GDT_UInt16, numpy.uint16, 65535 ),
( 'int16', gdal.GDT_Int16, numpy.int16, -32767 ),
( 'uint32', gdal.GDT_UInt32, numpy.uint32, 4294967295 ),
( 'int32', gdal.GDT_Int32, numpy.int32, -2147483648 ),
( 'float32', gdal.GDT_Float32, numpy.float32, 1.23 ),
( 'float64', gdal.GDT_Float64, numpy.float64, 1.23456789 ),
( 'cint16', gdal.GDT_CInt16, numpy.complex64, -32768 + 32767j ),
( 'cint32', gdal.GDT_CInt32, numpy.complex64, -32769 + 32768j ),
( 'cfloat32', gdal.GDT_CFloat32, numpy.complex64, -32768.5 + 32767.5j ),
( 'cfloat64', gdal.GDT_CFloat64, numpy.complex128, -32768.123456 + 32767.123456j ) ]
for type_tuple in type_tuples:
ds = gdal.GetDriverByName('GTiff').Create('/vsimem/' + type_tuple[0], 1, 1, 1, type_tuple[1])
tmp = ds.ReadAsArray()
if tmp.dtype != type_tuple[2]:
gdaltest.post_reason('did not get expected numpy type')
print(type_tuple)
return 'fail'
ar = numpy.empty([1, 1], dtype = type_tuple[2])
ar[0][0] = type_tuple[3]
ds.GetRasterBand(1).WriteArray(ar)
ds = None
ds = gdal.Open('/vsimem/' + type_tuple[0])
ar2 = ds.ReadAsArray()
ar3 = numpy.empty_like(ar2)
ds.GetRasterBand(1).ReadAsArray(buf_obj = ar3)
ds = None
gdal.Unlink('/vsimem/' + type_tuple[0])
if (type_tuple[0] == 'float32' and abs(ar2[0][0] - type_tuple[3]) > 1e-6) or \
(type_tuple[0] != 'float32' and ar2[0][0] != type_tuple[3]):
gdaltest.post_reason('did not get expected result (1)')
print(ar2)
print(type_tuple)
return 'fail'
if (type_tuple[0] == 'float32' and abs(ar3[0][0] - type_tuple[3]) > 1e-6) or \
(type_tuple[0] != 'float32' and ar3[0][0] != type_tuple[3]):
gdaltest.post_reason('did not get expected result (2)')
print(ar3)
print(type_tuple)
return 'fail'
return 'success'
###############################################################################
# Test array with slices (#3542)
def numpy_rw_12():
if gdaltest.numpy_drv is None:
return 'skip'
import numpy
ar = numpy.empty([2, 2], dtype = numpy.uint8)
ar[0][0] = 0
ar[0][1] = 1
ar[1][0] = 2
ar[1][1] = 3
drv = gdal.GetDriverByName( 'MEM' )
ds = drv.Create( '', 1, 2, 1, gdal.GDT_Byte )
slice = ar[:,1:]
ds.GetRasterBand(1).WriteArray( slice )
ar_read = numpy.zeros_like(ar)
slice_read = ar_read[:,1:]
ds.GetRasterBand(1).ReadAsArray( buf_obj = slice_read )
ds = None
if slice_read[0][0] != 1 or slice_read[1][0] != 3:
print(slice_read)
return 'fail'
return 'success'
###############################################################################
# Test expected errors
def numpy_rw_13():
if gdaltest.numpy_drv is None:
return 'skip'
import numpy
drv = gdal.GetDriverByName( 'MEM' )
ds = drv.Create( '', 2, 1, 1, gdal.GDT_Byte )
ar = numpy.empty([1, 2], dtype = numpy.uint8)
ar[0][0] = 100
ar[0][1] = 200
ds.GetRasterBand(1).WriteArray( ar )
# Try reading into unsupported array type
ar = numpy.empty([1, 2], dtype = numpy.int64)
try:
ds.GetRasterBand(1).ReadAsArray( buf_obj = ar )
gdaltest.post_reason('expected "ValueError: array does not have corresponding GDAL data type"')
return 'fail'
except:
pass
# Try call with inconsistant parameters
ar = numpy.empty([1, 2], dtype = numpy.uint8)
try:
ds.GetRasterBand(1).ReadAsArray( buf_obj = ar, buf_xsize = 2, buf_ysize = 2 )
gdaltest.post_reason('expected "Specified buf_ysize not consistant with buffer shape"')
return 'fail'
except:
pass
# Same with 3 dimensions
ar = numpy.empty([1, 1, 2], dtype = numpy.uint8)
try:
ds.GetRasterBand(1).ReadAsArray( buf_obj = ar, buf_xsize = 2, buf_ysize = 2 )
gdaltest.post_reason('expected "Specified buf_ysize not consistant with buffer shape"')
return 'fail'
except:
pass
# Try call with inconsistant parameters
ar = numpy.empty([1, 2], dtype = numpy.uint8)
try:
ds.GetRasterBand(1).ReadAsArray( buf_obj = ar, buf_xsize = 1, buf_ysize = 1 )
gdaltest.post_reason('expected "Specified buf_xsize not consistant with buffer shape"')
return 'fail'
except:
pass
# Inconsistent data type
ar = numpy.empty([1, 2], dtype = numpy.uint8)
try:
ds.GetRasterBand(1).ReadAsArray( buf_obj = ar, buf_type = gdal.GDT_Int16 )
gdaltest.post_reason('expected "Specified buf_type not consistant with array type"')
return 'fail'
except:
pass
# This one should be OK !
ar = numpy.zeros([1, 2], dtype = numpy.uint8)
ds.GetRasterBand(1).ReadAsArray( buf_obj = ar, buf_xsize = 2, buf_ysize = 1 )
if ar[0][0] != 100 or ar[0][1] != 200:
gdaltest.post_reason('did not get expected values')
print(ar)
return 'fail'
# This one too
ar = numpy.zeros([1, 1, 2], dtype = numpy.uint8)
ds.GetRasterBand(1).ReadAsArray( buf_obj = ar )
if ar[0][0][0] != 100 or ar[0][0][1] != 200:
gdaltest.post_reason('did not get expected values')
print(ar)
return 'fail'
# This one too
ar = numpy.zeros([1, 1, 2], dtype = numpy.uint8)
ds.ReadAsArray( buf_obj = ar )
if ar[0][0][0] != 100 or ar[0][0][1] != 200:
gdaltest.post_reason('did not get expected values')
print(ar)
return 'fail'
# This one too
ar = ds.ReadAsArray()
if ar[0][0] != 100 or ar[0][1] != 200:
gdaltest.post_reason('did not get expected values')
print(ar)
return 'fail'
ds = None
# With a multiband file
drv = gdal.GetDriverByName( 'MEM' )
ds = drv.Create( '', 2, 1, 3, gdal.GDT_Byte )
ar = numpy.empty([3, 1, 2], dtype = numpy.uint8)
ar[0][0][0] = 100
ar[0][0][1] = 200
ar[1][0][0] = 101
ar[1][0][1] = 201
ar[2][0][0] = 102
ar[2][0][1] = 202
for i in range(3):
ds.GetRasterBand(i+1).WriteArray( ar[i] )
ar = numpy.empty([3, 1, 2], dtype = numpy.int64)
try:
ds.ReadAsArray( buf_obj = ar )
gdaltest.post_reason('expected "ValueError: array does not have corresponding GDAL data type"')
return 'fail'
except:
pass
# Try call with inconsistant parameters
ar = numpy.empty([3, 1, 2], dtype = numpy.uint8)
try:
ds.ReadAsArray( buf_obj = ar, buf_xsize = 2, buf_ysize = 2 )
gdaltest.post_reason('expected "Specified buf_ysize not consistant with buffer shape"')
return 'fail'
except:
pass
# With 2 dimensions
ar = numpy.empty([1, 2], dtype = numpy.uint8)
try:
ds.ReadAsArray( buf_obj = ar )
gdaltest.post_reason('expected "ValueError: Array should have 3 dimensions"')
return 'fail'
except:
pass
# Try call with inconsistant parameters
ar = numpy.empty([3, 1, 2], dtype = numpy.uint8)
try:
ds.ReadAsArray( buf_obj = ar, buf_xsize = 1, buf_ysize = 1 )
gdaltest.post_reason('expected "Specified buf_xsize not consistant with buffer shape"')
return 'fail'
except:
pass
# Inconsistent data type
ar = numpy.empty([3, 1, 2], dtype = numpy.uint8)
try:
ds.ReadAsArray( buf_obj = ar, buf_type = gdal.GDT_Int16 )
gdaltest.post_reason('expected "Specified buf_type not consistant with array type"')
return 'fail'
except:
pass
# Not enough space in first dimension
ar = numpy.empty([2, 1, 2], dtype = numpy.uint8)
try:
ds.ReadAsArray( buf_obj = ar )
gdaltest.post_reason('expected "Array should have space for 3 bands"')
return 'fail'
except:
pass
# This one should be OK !
ar = numpy.zeros([3, 1, 2], dtype = numpy.uint8)
ds.ReadAsArray( buf_obj = ar, buf_xsize = 2, buf_ysize = 1, buf_type = gdal.GDT_Byte )
if ar[0][0][0] != 100 or ar[0][0][1] != 200 or ar[1][0][0] != 101 or ar[1][0][1] != 201 or ar[2][0][0] != 102 or ar[2][0][1] != 202:
gdaltest.post_reason('did not get expected values')
print(ar)
return 'fail'
# This one too
ar = numpy.zeros([3, 1, 2], dtype = numpy.uint8)
ds.ReadAsArray( buf_obj = ar )
if ar[0][0][0] != 100 or ar[0][0][1] != 200 or ar[1][0][0] != 101 or ar[1][0][1] != 201 or ar[2][0][0] != 102 or ar[2][0][1] != 202:
gdaltest.post_reason('did not get expected values')
print(ar)
return 'fail'
# This one too
ar = ds.ReadAsArray()
if ar[0][0][0] != 100 or ar[0][0][1] != 200 or ar[1][0][0] != 101 or ar[1][0][1] != 201 or ar[2][0][0] != 102 or ar[2][0][1] != 202:
gdaltest.post_reason('did not get expected values')
print(ar)
return 'fail'
ds = None
return 'success'
###############################################################################
# Test callback of ReadAsArray()
def numpy_rw_14_progress_callback(pct, message, user_data):
if abs(pct - user_data[0]) > 1e-5:
print('Expected %f, got %f' % (user_data[0], pct))
user_data[1] = False
user_data[0] = user_data[0] + 0.05
return 1 # 1 to continue, 0 to stop
def numpy_rw_14_progress_interrupt_callback(pct, message, user_data):
user_data[0] = pct
if pct >= 0.5:
return 0
return 1 # 1 to continue, 0 to stop
def numpy_rw_14_progress_callback_2(pct, message, user_data):
if pct < user_data[0]:
print('Got %f, last pct was %f' % (pct, user_data[0]))
return 0
user_data[0] = pct
return 1 # 1 to continue, 0 to stop
def numpy_rw_14():
if gdaltest.numpy_drv is None:
return 'skip'
# Progress not implemented yet
if gdal.GetConfigOption('GTIFF_DIRECT_IO') == 'YES' or \
gdal.GetConfigOption('GTIFF_VIRTUAL_MEM_IO') == 'YES':
return 'skip'
import numpy
ds = gdal.Open('data/byte.tif')
# Test RasterBand.ReadAsArray
tab = [ 0.05, True ]
data = ds.GetRasterBand(1).ReadAsArray(resample_alg = gdal.GRIORA_NearestNeighbour,
callback = numpy_rw_14_progress_callback,
callback_data = tab)
if data is None:
gdaltest.post_reason('failure')
return 'fail'
if abs(tab[0] - 1.05) > 1e-5 or not tab[1]:
gdaltest.post_reason('failure')
return 'fail'
# Test interruption
tab = [ 0 ]
data = ds.GetRasterBand(1).ReadAsArray(callback = numpy_rw_14_progress_interrupt_callback,
callback_data = tab)
if data is not None:
gdaltest.post_reason('failure')
return 'fail'
if tab[0] < 0.50:
gdaltest.post_reason('failure')
return 'fail'
# Test Dataset.ReadAsArray
tab = [ 0.05, True ]
data = ds.ReadAsArray(resample_alg = gdal.GRIORA_NearestNeighbour,
callback = numpy_rw_14_progress_callback,
callback_data = tab)
if data is None:
gdaltest.post_reason('failure')
return 'fail'
if abs(tab[0] - 1.05) > 1e-5 or not tab[1]:
gdaltest.post_reason('failure')
return 'fail'
# Same with interruption
tab = [ 0 ]
data = ds.ReadAsArray(callback = numpy_rw_14_progress_interrupt_callback,
callback_data = tab)
if data is not None or tab[0] < 0.50:
gdaltest.post_reason('failure')
return 'fail'
# Test Dataset.ReadAsArray on a multi band file
ds = None
ds = gdal.Open('data/rgbsmall.tif')
last_pct = [ 0 ]
data = ds.ReadAsArray(callback = numpy_rw_14_progress_callback_2,
callback_data = last_pct)
if data is None or abs(last_pct[0] - 1.0) > 1e-5:
gdaltest.post_reason('failure')
return 'fail'
last_pct = [ 0 ]
# Same but with a provided array
array = numpy.empty( [ds.RasterCount, ds.RasterYSize, ds.RasterXSize], numpy.uint8 )
data = ds.ReadAsArray(buf_obj = array,
callback = numpy_rw_14_progress_callback_2,
callback_data = last_pct)
if data is None or abs(last_pct[0] - 1.0) > 1e-5:
gdaltest.post_reason('failure')
return 'fail'
return 'success'
###############################################################################
# Test NumPy GetGeoTransform/SetGeoTransform
def numpy_rw_15():
if gdaltest.numpy_drv is None:
return 'skip'
import numpy
from osgeo import gdal_array
array = numpy.empty( [1,1,1], numpy.uint8 )
ds = gdal_array.OpenArray( array )
gt = ds.GetGeoTransform(can_return_null = True)
if gt is not None:
gdaltest.post_reason('failure')
return 'fail'
ds.SetGeoTransform([1,2,3,4,5,-6])
gt = ds.GetGeoTransform()
if gt != (1,2,3,4,5,-6):
gdaltest.post_reason('failure')
return 'fail'
return 'success'
def numpy_rw_cleanup():
gdaltest.numpy_drv = None
return 'success'
gdaltest_list = [
numpy_rw_1,
numpy_rw_2,
numpy_rw_3,
numpy_rw_4,
numpy_rw_5,
numpy_rw_6,
numpy_rw_7,
numpy_rw_8,
numpy_rw_9,
numpy_rw_10,
numpy_rw_11,
numpy_rw_12,
numpy_rw_13,
numpy_rw_14,
numpy_rw_15,
numpy_rw_cleanup ]
if __name__ == '__main__':
gdaltest.setup_run( 'numpy_rw' )
gdaltest.run_tests( gdaltest_list )
gdaltest.summarize()
|
[
"sys.path.append",
"numpy.zeros_like",
"osgeo.gdal_array.OpenArray",
"_gdal.GDALRegister_NUMPY",
"gdaltest.post_reason",
"osgeo.gdal.Unlink",
"numpy.empty",
"numpy.zeros",
"numpy.empty_like",
"osgeo.gdalnumeric.OpenArray",
"gdaltest.run_tests",
"gdaltest.setup_run",
"gdaltest.summarize",
"osgeo.gdalnumeric.LoadFile",
"osgeo.gdal.GetConfigOption",
"osgeo.gdal.Open",
"osgeo.gdal.GetDriverByName",
"osgeo.gdal.AllRegister"
] |
[((1577, 1604), 'sys.path.append', 'sys.path.append', (['"""../pymod"""'], {}), "('../pymod')\n", (1592, 1604), False, 'import sys\n'), ((2138, 2167), 'osgeo.gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""NUMPY"""'], {}), "('NUMPY')\n", (2158, 2167), False, 'from osgeo import gdal\n'), ((2588, 2629), 'osgeo.gdalnumeric.LoadFile', 'gdalnumeric.LoadFile', (['"""data/utmsmall.tif"""'], {}), "('data/utmsmall.tif')\n", (2608, 2629), False, 'from osgeo import gdalnumeric\n'), ((2758, 2786), 'osgeo.gdalnumeric.OpenArray', 'gdalnumeric.OpenArray', (['array'], {}), '(array)\n', (2779, 2786), False, 'from osgeo import gdalnumeric\n'), ((3300, 3330), 'osgeo.gdal.Open', 'gdal.Open', (['"""data/cint_sar.tif"""'], {}), "('data/cint_sar.tif')\n", (3309, 3330), False, 'from osgeo import gdal\n'), ((3739, 3765), 'osgeo.gdal.Open', 'gdal.Open', (['"""data/byte.tif"""'], {}), "('data/byte.tif')\n", (3748, 3765), False, 'from osgeo import gdal\n'), ((4270, 4325), 'osgeo.gdalnumeric.LoadFile', 'gdalnumeric.LoadFile', (['"""data/rgbsmall.tif"""', '(35)', '(21)', '(1)', '(1)'], {}), "('data/rgbsmall.tif', 35, 21, 1, 1)\n", (4290, 4325), False, 'from osgeo import gdalnumeric\n'), ((4726, 4832), 'osgeo.gdalnumeric.LoadFile', 'gdalnumeric.LoadFile', (['"""data/rgbsmall.tif"""'], {'buf_xsize': '(1)', 'buf_ysize': '(1)', 'resample_alg': 'gdal.GRIORA_Bilinear'}), "('data/rgbsmall.tif', buf_xsize=1, buf_ysize=1,\n resample_alg=gdal.GRIORA_Bilinear)\n", (4746, 4832), False, 'from osgeo import gdalnumeric\n'), ((5214, 5255), 'numpy.zeros', 'numpy.zeros', (['[3, 1, 1]'], {'dtype': 'numpy.uint8'}), '([3, 1, 1], dtype=numpy.uint8)\n', (5225, 5255), False, 'import numpy\n'), ((5267, 5297), 'osgeo.gdal.Open', 'gdal.Open', (['"""data/rgbsmall.tif"""'], {}), "('data/rgbsmall.tif')\n", (5276, 5297), False, 'from osgeo import gdal\n'), ((5885, 5911), 'osgeo.gdal.Open', 'gdal.Open', (['"""data/byte.tif"""'], {}), "('data/byte.tif')\n", (5894, 5911), False, 'from osgeo import gdal\n'), ((5926, 5984), 'numpy.zeros', 'numpy.zeros', (['[ds.RasterYSize, ds.RasterXSize]', 'numpy.uint8'], {}), '([ds.RasterYSize, ds.RasterXSize], numpy.uint8)\n', (5937, 5984), False, 'import numpy\n'), ((6121, 6149), 'osgeo.gdalnumeric.OpenArray', 'gdalnumeric.OpenArray', (['array'], {}), '(array)\n', (6142, 6149), False, 'from osgeo import gdalnumeric\n'), ((6586, 6612), 'osgeo.gdal.Open', 'gdal.Open', (['"""data/byte.tif"""'], {}), "('data/byte.tif')\n", (6595, 6612), False, 'from osgeo import gdal\n'), ((6627, 6688), 'numpy.zeros', 'numpy.zeros', (['[1, ds.RasterYSize, ds.RasterXSize]', 'numpy.uint8'], {}), '([1, ds.RasterYSize, ds.RasterXSize], numpy.uint8)\n', (6638, 6688), False, 'import numpy\n'), ((6808, 6836), 'osgeo.gdalnumeric.OpenArray', 'gdalnumeric.OpenArray', (['array'], {}), '(array)\n', (6829, 6836), False, 'from osgeo import gdalnumeric\n'), ((6988, 7046), 'numpy.zeros', 'numpy.zeros', (['[ds.RasterYSize, ds.RasterXSize]', 'numpy.uint8'], {}), '([ds.RasterYSize, ds.RasterXSize], numpy.uint8)\n', (6999, 7046), False, 'import numpy\n'), ((7166, 7194), 'osgeo.gdalnumeric.OpenArray', 'gdalnumeric.OpenArray', (['array'], {}), '(array)\n', (7187, 7194), False, 'from osgeo import gdalnumeric\n'), ((7332, 7362), 'osgeo.gdal.Open', 'gdal.Open', (['"""data/rgbsmall.tif"""'], {}), "('data/rgbsmall.tif')\n", (7341, 7362), False, 'from osgeo import gdal\n'), ((7377, 7451), 'numpy.zeros', 'numpy.zeros', (['[ds.RasterCount, ds.RasterYSize, ds.RasterXSize]', 'numpy.uint8'], {}), '([ds.RasterCount, ds.RasterYSize, ds.RasterXSize], numpy.uint8)\n', (7388, 7451), False, 'import numpy\n'), ((7571, 7599), 'osgeo.gdalnumeric.OpenArray', 'gdalnumeric.OpenArray', (['array'], {}), '(array)\n', (7592, 7599), False, 'from osgeo import gdalnumeric\n'), ((8008, 8038), 'osgeo.gdal.Open', 'gdal.Open', (['"""data/rgbsmall.tif"""'], {}), "('data/rgbsmall.tif')\n", (8017, 8038), False, 'from osgeo import gdal\n'), ((8053, 8127), 'numpy.zeros', 'numpy.zeros', (['[ds.RasterCount, ds.RasterYSize, ds.RasterXSize]', 'numpy.uint8'], {}), '([ds.RasterCount, ds.RasterYSize, ds.RasterXSize], numpy.uint8)\n', (8064, 8127), False, 'import numpy\n'), ((8176, 8204), 'osgeo.gdalnumeric.OpenArray', 'gdalnumeric.OpenArray', (['array'], {}), '(array)\n', (8197, 8204), False, 'from osgeo import gdalnumeric\n'), ((8577, 8603), 'osgeo.gdal.Open', 'gdal.Open', (['"""data/byte.tif"""'], {}), "('data/byte.tif')\n", (8586, 8603), False, 'from osgeo import gdal\n'), ((9316, 9353), 'numpy.empty', 'numpy.empty', (['[1, 2]'], {'dtype': 'numpy.int8'}), '([1, 2], dtype=numpy.int8)\n', (9327, 9353), False, 'import numpy\n'), ((9458, 9490), 'osgeo.gdal.Open', 'gdal.Open', (['"""/vsimem/signed8.tif"""'], {}), "('/vsimem/signed8.tif')\n", (9467, 9490), False, 'from osgeo import gdal\n'), ((9528, 9549), 'numpy.empty_like', 'numpy.empty_like', (['ar2'], {}), '(ar2)\n', (9544, 9549), False, 'import numpy\n'), ((9620, 9654), 'osgeo.gdal.Unlink', 'gdal.Unlink', (['"""/vsimem/signed8.tif"""'], {}), "('/vsimem/signed8.tif')\n", (9631, 9654), False, 'from osgeo import gdal\n'), ((12642, 12680), 'numpy.empty', 'numpy.empty', (['[2, 2]'], {'dtype': 'numpy.uint8'}), '([2, 2], dtype=numpy.uint8)\n', (12653, 12680), False, 'import numpy\n'), ((12762, 12789), 'osgeo.gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""MEM"""'], {}), "('MEM')\n", (12782, 12789), False, 'from osgeo import gdal\n'), ((12923, 12943), 'numpy.zeros_like', 'numpy.zeros_like', (['ar'], {}), '(ar)\n', (12939, 12943), False, 'import numpy\n'), ((13386, 13413), 'osgeo.gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""MEM"""'], {}), "('MEM')\n", (13406, 13413), False, 'from osgeo import gdal\n'), ((13475, 13513), 'numpy.empty', 'numpy.empty', (['[1, 2]'], {'dtype': 'numpy.uint8'}), '([1, 2], dtype=numpy.uint8)\n', (13486, 13513), False, 'import numpy\n'), ((13651, 13689), 'numpy.empty', 'numpy.empty', (['[1, 2]'], {'dtype': 'numpy.int64'}), '([1, 2], dtype=numpy.int64)\n', (13662, 13689), False, 'import numpy\n'), ((13962, 14000), 'numpy.empty', 'numpy.empty', (['[1, 2]'], {'dtype': 'numpy.uint8'}), '([1, 2], dtype=numpy.uint8)\n', (13973, 14000), False, 'import numpy\n'), ((14280, 14321), 'numpy.empty', 'numpy.empty', (['[1, 1, 2]'], {'dtype': 'numpy.uint8'}), '([1, 1, 2], dtype=numpy.uint8)\n', (14291, 14321), False, 'import numpy\n'), ((14616, 14654), 'numpy.empty', 'numpy.empty', (['[1, 2]'], {'dtype': 'numpy.uint8'}), '([1, 2], dtype=numpy.uint8)\n', (14627, 14654), False, 'import numpy\n'), ((14938, 14976), 'numpy.empty', 'numpy.empty', (['[1, 2]'], {'dtype': 'numpy.uint8'}), '([1, 2], dtype=numpy.uint8)\n', (14949, 14976), False, 'import numpy\n'), ((15251, 15289), 'numpy.zeros', 'numpy.zeros', (['[1, 2]'], {'dtype': 'numpy.uint8'}), '([1, 2], dtype=numpy.uint8)\n', (15262, 15289), False, 'import numpy\n'), ((15546, 15587), 'numpy.zeros', 'numpy.zeros', (['[1, 1, 2]'], {'dtype': 'numpy.uint8'}), '([1, 1, 2], dtype=numpy.uint8)\n', (15557, 15587), False, 'import numpy\n'), ((15820, 15861), 'numpy.zeros', 'numpy.zeros', (['[1, 1, 2]'], {'dtype': 'numpy.uint8'}), '([1, 1, 2], dtype=numpy.uint8)\n', (15831, 15861), False, 'import numpy\n'), ((16291, 16318), 'osgeo.gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""MEM"""'], {}), "('MEM')\n", (16311, 16318), False, 'from osgeo import gdal\n'), ((16380, 16421), 'numpy.empty', 'numpy.empty', (['[3, 1, 2]'], {'dtype': 'numpy.uint8'}), '([3, 1, 2], dtype=numpy.uint8)\n', (16391, 16421), False, 'import numpy\n'), ((16639, 16680), 'numpy.empty', 'numpy.empty', (['[3, 1, 2]'], {'dtype': 'numpy.int64'}), '([3, 1, 2], dtype=numpy.int64)\n', (16650, 16680), False, 'import numpy\n'), ((16936, 16977), 'numpy.empty', 'numpy.empty', (['[3, 1, 2]'], {'dtype': 'numpy.uint8'}), '([3, 1, 2], dtype=numpy.uint8)\n', (16947, 16977), False, 'import numpy\n'), ((17235, 17273), 'numpy.empty', 'numpy.empty', (['[1, 2]'], {'dtype': 'numpy.uint8'}), '([1, 2], dtype=numpy.uint8)\n', (17246, 17273), False, 'import numpy\n'), ((17511, 17552), 'numpy.empty', 'numpy.empty', (['[3, 1, 2]'], {'dtype': 'numpy.uint8'}), '([3, 1, 2], dtype=numpy.uint8)\n', (17522, 17552), False, 'import numpy\n'), ((17819, 17860), 'numpy.empty', 'numpy.empty', (['[3, 1, 2]'], {'dtype': 'numpy.uint8'}), '([3, 1, 2], dtype=numpy.uint8)\n', (17830, 17860), False, 'import numpy\n'), ((18130, 18171), 'numpy.empty', 'numpy.empty', (['[2, 1, 2]'], {'dtype': 'numpy.uint8'}), '([2, 1, 2], dtype=numpy.uint8)\n', (18141, 18171), False, 'import numpy\n'), ((18392, 18433), 'numpy.zeros', 'numpy.zeros', (['[3, 1, 2]'], {'dtype': 'numpy.uint8'}), '([3, 1, 2], dtype=numpy.uint8)\n', (18403, 18433), False, 'import numpy\n'), ((18793, 18834), 'numpy.zeros', 'numpy.zeros', (['[3, 1, 2]'], {'dtype': 'numpy.uint8'}), '([3, 1, 2], dtype=numpy.uint8)\n', (18804, 18834), False, 'import numpy\n'), ((20500, 20526), 'osgeo.gdal.Open', 'gdal.Open', (['"""data/byte.tif"""'], {}), "('data/byte.tif')\n", (20509, 20526), False, 'from osgeo import gdal\n'), ((22174, 22204), 'osgeo.gdal.Open', 'gdal.Open', (['"""data/rgbsmall.tif"""'], {}), "('data/rgbsmall.tif')\n", (22183, 22204), False, 'from osgeo import gdal\n'), ((22536, 22610), 'numpy.empty', 'numpy.empty', (['[ds.RasterCount, ds.RasterYSize, ds.RasterXSize]', 'numpy.uint8'], {}), '([ds.RasterCount, ds.RasterYSize, ds.RasterXSize], numpy.uint8)\n', (22547, 22610), False, 'import numpy\n'), ((23184, 23219), 'numpy.empty', 'numpy.empty', (['[1, 1, 1]', 'numpy.uint8'], {}), '([1, 1, 1], numpy.uint8)\n', (23195, 23219), False, 'import numpy\n'), ((23229, 23256), 'osgeo.gdal_array.OpenArray', 'gdal_array.OpenArray', (['array'], {}), '(array)\n', (23249, 23256), False, 'from osgeo import gdal_array\n'), ((23976, 24006), 'gdaltest.setup_run', 'gdaltest.setup_run', (['"""numpy_rw"""'], {}), "('numpy_rw')\n", (23994, 24006), False, 'import gdaltest\n'), ((24014, 24047), 'gdaltest.run_tests', 'gdaltest.run_tests', (['gdaltest_list'], {}), '(gdaltest_list)\n', (24032, 24047), False, 'import gdaltest\n'), ((24055, 24075), 'gdaltest.summarize', 'gdaltest.summarize', ([], {}), '()\n', (24073, 24075), False, 'import gdaltest\n'), ((1994, 2020), '_gdal.GDALRegister_NUMPY', '_gdal.GDALRegister_NUMPY', ([], {}), '()\n', (2018, 2020), False, 'import _gdal\n'), ((2068, 2086), 'osgeo.gdal.AllRegister', 'gdal.AllRegister', ([], {}), '()\n', (2084, 2086), False, 'from osgeo import gdal\n'), ((2213, 2260), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""NUMPY driver not found!"""'], {}), "('NUMPY driver not found!')\n", (2233, 2260), False, 'import gdaltest\n'), ((2662, 2724), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""Failed to load utmsmall.tif into array"""'], {}), "('Failed to load utmsmall.tif into array')\n", (2682, 2724), False, 'import gdaltest\n'), ((2816, 2879), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""Failed to open memory array as dataset."""'], {}), "('Failed to open memory array as dataset.')\n", (2836, 2879), False, 'import gdaltest\n'), ((2975, 3043), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""Didnt get expected checksum on reopened file"""'], {}), "('Didnt get expected checksum on reopened file')\n", (2995, 3043), False, 'import gdaltest\n'), ((3432, 3486), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""complex value read improperly."""'], {}), "('complex value read improperly.')\n", (3452, 3486), False, 'import gdaltest\n'), ((3890, 3988), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""Read wrong value - perhaps downsampling algorithm has changed subtly?"""'], {}), "(\n 'Read wrong value - perhaps downsampling algorithm has changed subtly?')\n", (3910, 3988), False, 'import gdaltest\n'), ((4381, 4427), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""value read improperly."""'], {}), "('value read improperly.')\n", (4401, 4427), False, 'import gdaltest\n'), ((4512, 4558), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""value read improperly."""'], {}), "('value read improperly.')\n", (4532, 4558), False, 'import gdaltest\n'), ((4642, 4688), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""value read improperly."""'], {}), "('value read improperly.')\n", (4662, 4688), False, 'import gdaltest\n'), ((4940, 4982), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""wrong array shape."""'], {}), "('wrong array shape.')\n", (4960, 4982), False, 'import gdaltest\n'), ((5113, 5159), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""value read improperly."""'], {}), "('value read improperly.')\n", (5133, 5159), False, 'import gdaltest\n'), ((5479, 5525), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""value read improperly."""'], {}), "('value read improperly.')\n", (5499, 5525), False, 'import gdaltest\n'), ((8870, 8923), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected checksum"""'], {}), "('did not get expected checksum')\n", (8890, 8923), False, 'import gdaltest\n'), ((9710, 9765), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected result (1)"""'], {}), "('did not get expected result (1)')\n", (9730, 9765), False, 'import gdaltest\n'), ((9862, 9917), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected result (2)"""'], {}), "('did not get expected result (2)')\n", (9882, 9917), False, 'import gdaltest\n'), ((11408, 11448), 'numpy.empty', 'numpy.empty', (['[1, 1]'], {'dtype': 'type_tuple[2]'}), '([1, 1], dtype=type_tuple[2])\n', (11419, 11448), False, 'import numpy\n'), ((11559, 11596), 'osgeo.gdal.Open', 'gdal.Open', (["('/vsimem/' + type_tuple[0])"], {}), "('/vsimem/' + type_tuple[0])\n", (11568, 11596), False, 'from osgeo import gdal\n'), ((11642, 11663), 'numpy.empty_like', 'numpy.empty_like', (['ar2'], {}), '(ar2)\n', (11658, 11663), False, 'import numpy\n'), ((11746, 11785), 'osgeo.gdal.Unlink', 'gdal.Unlink', (["('/vsimem/' + type_tuple[0])"], {}), "('/vsimem/' + type_tuple[0])\n", (11757, 11785), False, 'from osgeo import gdal\n'), ((13765, 13865), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "ValueError: array does not have corresponding GDAL data type\\""""'], {}), '(\n \'expected "ValueError: array does not have corresponding GDAL data type"\')\n', (13785, 13865), False, 'import gdaltest\n'), ((14106, 14198), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "Specified buf_ysize not consistant with buffer shape\\""""'], {}), '(\n \'expected "Specified buf_ysize not consistant with buffer shape"\')\n', (14126, 14198), False, 'import gdaltest\n'), ((14427, 14519), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "Specified buf_ysize not consistant with buffer shape\\""""'], {}), '(\n \'expected "Specified buf_ysize not consistant with buffer shape"\')\n', (14447, 14519), False, 'import gdaltest\n'), ((14760, 14852), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "Specified buf_xsize not consistant with buffer shape\\""""'], {}), '(\n \'expected "Specified buf_xsize not consistant with buffer shape"\')\n', (14780, 14852), False, 'import gdaltest\n'), ((15079, 15168), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "Specified buf_type not consistant with array type\\""""'], {}), '(\n \'expected "Specified buf_type not consistant with array type"\')\n', (15099, 15168), False, 'import gdaltest\n'), ((15425, 15476), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected values"""'], {}), "('did not get expected values')\n", (15445, 15476), False, 'import gdaltest\n'), ((15699, 15750), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected values"""'], {}), "('did not get expected values')\n", (15719, 15750), False, 'import gdaltest\n'), ((15956, 16007), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected values"""'], {}), "('did not get expected values')\n", (15976, 16007), False, 'import gdaltest\n'), ((16145, 16196), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected values"""'], {}), "('did not get expected values')\n", (16165, 16196), False, 'import gdaltest\n'), ((16739, 16839), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "ValueError: array does not have corresponding GDAL data type\\""""'], {}), '(\n \'expected "ValueError: array does not have corresponding GDAL data type"\')\n', (16759, 16839), False, 'import gdaltest\n'), ((17066, 17158), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "Specified buf_ysize not consistant with buffer shape\\""""'], {}), '(\n \'expected "Specified buf_ysize not consistant with buffer shape"\')\n', (17086, 17158), False, 'import gdaltest\n'), ((17332, 17409), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "ValueError: Array should have 3 dimensions\\""""'], {}), '(\'expected "ValueError: Array should have 3 dimensions"\')\n', (17352, 17409), False, 'import gdaltest\n'), ((17641, 17733), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "Specified buf_xsize not consistant with buffer shape\\""""'], {}), '(\n \'expected "Specified buf_xsize not consistant with buffer shape"\')\n', (17661, 17733), False, 'import gdaltest\n'), ((17946, 18035), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "Specified buf_type not consistant with array type\\""""'], {}), '(\n \'expected "Specified buf_type not consistant with array type"\')\n', (17966, 18035), False, 'import gdaltest\n'), ((18230, 18300), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""expected "Array should have space for 3 bands\\""""'], {}), '(\'expected "Array should have space for 3 bands"\')\n', (18250, 18300), False, 'import gdaltest\n'), ((18672, 18723), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected values"""'], {}), "('did not get expected values')\n", (18692, 18723), False, 'import gdaltest\n'), ((19017, 19068), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected values"""'], {}), "('did not get expected values')\n", (19037, 19068), False, 'import gdaltest\n'), ((19300, 19351), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected values"""'], {}), "('did not get expected values')\n", (19320, 19351), False, 'import gdaltest\n'), ((20855, 20886), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (20875, 20886), False, 'import gdaltest\n'), ((20965, 20996), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (20985, 20996), False, 'import gdaltest\n'), ((21252, 21283), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (21272, 21283), False, 'import gdaltest\n'), ((21336, 21367), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (21356, 21367), False, 'import gdaltest\n'), ((21660, 21691), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (21680, 21691), False, 'import gdaltest\n'), ((21770, 21801), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (21790, 21801), False, 'import gdaltest\n'), ((22044, 22075), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (22064, 22075), False, 'import gdaltest\n'), ((22410, 22441), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (22430, 22441), False, 'import gdaltest\n'), ((22840, 22871), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (22860, 22871), False, 'import gdaltest\n'), ((23342, 23373), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (23362, 23373), False, 'import gdaltest\n'), ((23502, 23533), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""failure"""'], {}), "('failure')\n", (23522, 23533), False, 'import gdaltest\n'), ((8649, 8676), 'osgeo.gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""MEM"""'], {}), "('MEM')\n", (8669, 8676), False, 'from osgeo import gdal\n'), ((9205, 9234), 'osgeo.gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""GTiff"""'], {}), "('GTiff')\n", (9225, 9234), False, 'from osgeo import gdal\n'), ((11282, 11337), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected numpy type"""'], {}), "('did not get expected numpy type')\n", (11302, 11337), False, 'import gdaltest\n'), ((11958, 12013), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected result (1)"""'], {}), "('did not get expected result (1)')\n", (11978, 12013), False, 'import gdaltest\n'), ((12265, 12320), 'gdaltest.post_reason', 'gdaltest.post_reason', (['"""did not get expected result (2)"""'], {}), "('did not get expected result (2)')\n", (12285, 12320), False, 'import gdaltest\n'), ((20334, 20373), 'osgeo.gdal.GetConfigOption', 'gdal.GetConfigOption', (['"""GTIFF_DIRECT_IO"""'], {}), "('GTIFF_DIRECT_IO')\n", (20354, 20373), False, 'from osgeo import gdal\n'), ((20395, 20439), 'osgeo.gdal.GetConfigOption', 'gdal.GetConfigOption', (['"""GTIFF_VIRTUAL_MEM_IO"""'], {}), "('GTIFF_VIRTUAL_MEM_IO')\n", (20415, 20439), False, 'from osgeo import gdal\n'), ((11111, 11140), 'osgeo.gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""GTiff"""'], {}), "('GTiff')\n", (11131, 11140), False, 'from osgeo import gdal\n')]
|
#!/usr/bin/python
import time
import hmac
import hashlib
import requests
import json
bitso_key = "your api key"
bitso_secret = "your api secret"
http_method = "GET" # Change to POST if endpoint requires data
request_path = "/v3/balance/"
parameters = {} # Needed for POST endpoints requiring data
# Create signature
nonce = str(int(round(time.time() * 1000)))
message = nonce+http_method+request_path
if (http_method == "POST"):
message += json.dumps(parameters)
signature = hmac.new(bitso_secret.encode('utf-8'),
message.encode('utf-8'),
hashlib.sha256).hexdigest()
# Build the auth header
auth_header = 'Bitso %s:%s:%s' % (bitso_key, nonce, signature)
# Send request
if (http_method == "GET"):
response = requests.get("https://api.bitso.com" + request_path, headers={"Authorization": auth_header})
elif (http_method == "POST"):
response = requests.post("https://api.bitso.com" + request_path, json = parameters, headers={"Authorization": auth_header})
print (response.content)
|
[
"requests.get",
"requests.post",
"json.dumps",
"time.time"
] |
[((451, 473), 'json.dumps', 'json.dumps', (['parameters'], {}), '(parameters)\n', (461, 473), False, 'import json\n'), ((810, 907), 'requests.get', 'requests.get', (["('https://api.bitso.com' + request_path)"], {'headers': "{'Authorization': auth_header}"}), "('https://api.bitso.com' + request_path, headers={\n 'Authorization': auth_header})\n", (822, 907), False, 'import requests\n'), ((946, 1060), 'requests.post', 'requests.post', (["('https://api.bitso.com' + request_path)"], {'json': 'parameters', 'headers': "{'Authorization': auth_header}"}), "('https://api.bitso.com' + request_path, json=parameters,\n headers={'Authorization': auth_header})\n", (959, 1060), False, 'import requests\n'), ((347, 358), 'time.time', 'time.time', ([], {}), '()\n', (356, 358), False, 'import time\n')]
|
# coding: utf-8
"""
ASR documentation
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 1.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from cloud_client.cloud_api_client import CloudApiClient
class RecognizeApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = CloudApiClient()
self.api_client = api_client
def close(self, x_session_id, x_transaction_id, **kwargs): # noqa: E501
"""Close transaction # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.close(x_session_id, x_transaction_id, async=True)
>>> result = thread.get()
:param async bool
:param str x_session_id: Session identifier (required)
:param str x_transaction_id: Session identifier (required)
:return: ASRResultDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.close_with_http_info(x_session_id, x_transaction_id, **kwargs) # noqa: E501
else:
(data) = self.close_with_http_info(x_session_id, x_transaction_id, **kwargs) # noqa: E501
return data
def close_with_http_info(self, x_session_id, x_transaction_id, **kwargs): # noqa: E501
"""Close transaction # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.close_with_http_info(x_session_id, x_transaction_id, async=True)
>>> result = thread.get()
:param async bool
:param str x_session_id: Session identifier (required)
:param str x_transaction_id: Session identifier (required)
:return: ASRResultDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['x_session_id', 'x_transaction_id'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method close" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'x_session_id' is set
if ('x_session_id' not in params or
params['x_session_id'] is None):
raise ValueError("Missing the required parameter `x_session_id` when calling `close`") # noqa: E501
# verify the required parameter 'x_transaction_id' is set
if ('x_transaction_id' not in params or
params['x_transaction_id'] is None):
raise ValueError("Missing the required parameter `x_transaction_id` when calling `close`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
if 'x_session_id' in params:
header_params['X-Session-ID'] = params['x_session_id'] # noqa: E501
if 'x_transaction_id' in params:
header_params['X-Transaction-Id'] = params['x_transaction_id'] # noqa: E501
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json;charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json;charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/vkasr/rest/v1/recognize/stream', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='ASRResultDto', # noqa: E501
auth_settings=auth_settings,
async_=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def recognize(self, x_session_id, body, **kwargs): # noqa: E501
"""Get speech recognition result # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.recognize(x_session_id, body, async=True)
>>> result = thread.get()
:param async bool
:param str x_session_id: Session identifier (required)
:param RecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
:param str x_request_id: Request identifier
:return: ASRResultDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.recognize_with_http_info(x_session_id, body, **kwargs) # noqa: E501
else:
(data) = self.recognize_with_http_info(x_session_id, body, **kwargs) # noqa: E501
return data
def recognize_with_http_info(self, x_session_id, body, **kwargs): # noqa: E501
"""Get speech recognition result # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.recognize_with_http_info(x_session_id, body, async=True)
>>> result = thread.get()
:param async bool
:param str x_session_id: Session identifier (required)
:param RecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
:param str x_request_id: Request identifier
:return: ASRResultDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['x_session_id', 'body', 'x_request_id'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method recognize" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'x_session_id' is set
if ('x_session_id' not in params or
params['x_session_id'] is None):
raise ValueError("Missing the required parameter `x_session_id` when calling `recognize`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `recognize`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
if 'x_session_id' in params:
header_params['X-Session-ID'] = params['x_session_id'] # noqa: E501
if 'x_request_id' in params:
header_params['X-Request-Id'] = params['x_request_id'] # noqa: E501
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json;charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json;charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/vkasr/rest/v1/recognize', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='ASRResultDto', # noqa: E501
auth_settings=auth_settings,
async_=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def recognize_advanced(self, x_session_id, body, **kwargs): # noqa: E501
"""Recognize speech with advanced options # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.recognize_advanced(x_session_id, body, async=True)
>>> result = thread.get()
:param async bool
:param str x_session_id: Session identifier (required)
:param AdvancedRecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
:param str x_request_id: Request identifier
:return: list[ASRAdvancedResultDto]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.recognize_advanced_with_http_info(x_session_id, body, **kwargs) # noqa: E501
else:
(data) = self.recognize_advanced_with_http_info(x_session_id, body, **kwargs) # noqa: E501
return data
def recognize_advanced_with_http_info(self, x_session_id, body, **kwargs): # noqa: E501
"""Recognize speech with advanced options # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.recognize_advanced_with_http_info(x_session_id, body, async=True)
>>> result = thread.get()
:param async bool
:param str x_session_id: Session identifier (required)
:param AdvancedRecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
:param str x_request_id: Request identifier
:return: list[ASRAdvancedResultDto]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['x_session_id', 'body', 'x_request_id'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method recognize_advanced" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'x_session_id' is set
if ('x_session_id' not in params or
params['x_session_id'] is None):
raise ValueError("Missing the required parameter `x_session_id` when calling `recognize_advanced`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `recognize_advanced`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
if 'x_session_id' in params:
header_params['X-Session-ID'] = params['x_session_id'] # noqa: E501
if 'x_request_id' in params:
header_params['X-Request-Id'] = params['x_request_id'] # noqa: E501
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json;charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json;charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/vkasr/rest/v1/recognize/advanced', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[ASRAdvancedResultDto]', # noqa: E501
auth_settings=auth_settings,
async_=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def recognize_sessionless(self, body, **kwargs): # noqa: E501
"""Get speech recognition result # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.recognize_sessionless(body, async=True)
>>> result = thread.get()
:param async bool
:param SessionlessRecognitionRequestDto body: Request with user login data and recognition request (required)
:param str x_request_id: Request identifier
:return: ASRResultDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.recognize_sessionless_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.recognize_sessionless_with_http_info(body, **kwargs) # noqa: E501
return data
def recognize_sessionless_with_http_info(self, body, **kwargs): # noqa: E501
"""Get speech recognition result # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.recognize_sessionless_with_http_info(body, async=True)
>>> result = thread.get()
:param async bool
:param SessionlessRecognitionRequestDto body: Request with user login data and recognition request (required)
:param str x_request_id: Request identifier
:return: ASRResultDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body', 'x_request_id'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method recognize_sessionless" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `recognize_sessionless`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
if 'x_request_id' in params:
header_params['X-Request-Id'] = params['x_request_id'] # noqa: E501
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json;charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json;charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/vkasr/rest/v1/recognize/sessionless', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='ASRResultDto', # noqa: E501
auth_settings=auth_settings,
async_=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def recognize_words(self, x_session_id, body, **kwargs): # noqa: E501
"""Recognize speech and return word list # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.recognize_words(x_session_id, body, async=True)
>>> result = thread.get()
:param async bool
:param str x_session_id: Session identifier (required)
:param RecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
:param str x_request_id: Request identifier
:return: list[WordDto]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.recognize_words_with_http_info(x_session_id, body, **kwargs) # noqa: E501
else:
(data) = self.recognize_words_with_http_info(x_session_id, body, **kwargs) # noqa: E501
return data
def recognize_words_with_http_info(self, x_session_id, body, **kwargs): # noqa: E501
"""Recognize speech and return word list # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.recognize_words_with_http_info(x_session_id, body, async=True)
>>> result = thread.get()
:param async bool
:param str x_session_id: Session identifier (required)
:param RecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
:param str x_request_id: Request identifier
:return: list[WordDto]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['x_session_id', 'body', 'x_request_id'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method recognize_words" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'x_session_id' is set
if ('x_session_id' not in params or
params['x_session_id'] is None):
raise ValueError("Missing the required parameter `x_session_id` when calling `recognize_words`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `recognize_words`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
if 'x_session_id' in params:
header_params['X-Session-ID'] = params['x_session_id'] # noqa: E501
if 'x_request_id' in params:
header_params['X-Request-Id'] = params['x_request_id'] # noqa: E501
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json;charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json;charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/vkasr/rest/v1/recognize/words', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[WordDto]', # noqa: E501
auth_settings=auth_settings,
async_=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def recognize_words_sessionless(self, body, **kwargs): # noqa: E501
"""Recognize speech without session and return word list # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.recognize_words_sessionless(body, async=True)
>>> result = thread.get()
:param async bool
:param SessionlessRecognitionRequestDto body: Request with user login data and recognition request (required)
:param str x_request_id: Request identifier
:return: list[WordDto]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.recognize_words_sessionless_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.recognize_words_sessionless_with_http_info(body, **kwargs) # noqa: E501
return data
def recognize_words_sessionless_with_http_info(self, body, **kwargs): # noqa: E501
"""Recognize speech without session and return word list # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.recognize_words_sessionless_with_http_info(body, async=True)
>>> result = thread.get()
:param async bool
:param SessionlessRecognitionRequestDto body: Request with user login data and recognition request (required)
:param str x_request_id: Request identifier
:return: list[WordDto]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body', 'x_request_id'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method recognize_words_sessionless" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `recognize_words_sessionless`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
if 'x_request_id' in params:
header_params['X-Request-Id'] = params['x_request_id'] # noqa: E501
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json;charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json;charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/vkasr/rest/v1/recognize/sessionless/words', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[WordDto]', # noqa: E501
auth_settings=auth_settings,
async_=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def start(self, x_session_id, body, **kwargs): # noqa: E501
"""Start recognition stream # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.start(x_session_id, body, async=True)
>>> result = thread.get()
:param async bool
:param str x_session_id: Session identifier (required)
:param StreamRequestDto body: Transaction parameters (required)
:param str x_request_id: Request identifier
:return: StreamResponseDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.start_with_http_info(x_session_id, body, **kwargs) # noqa: E501
else:
(data) = self.start_with_http_info(x_session_id, body, **kwargs) # noqa: E501
return data
def start_with_http_info(self, x_session_id, body, **kwargs): # noqa: E501
"""Start recognition stream # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.start_with_http_info(x_session_id, body, async=True)
>>> result = thread.get()
:param async bool
:param str x_session_id: Session identifier (required)
:param StreamRequestDto body: Transaction parameters (required)
:param str x_request_id: Request identifier
:return: StreamResponseDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['x_session_id', 'body', 'x_request_id'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method start" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'x_session_id' is set
if ('x_session_id' not in params or
params['x_session_id'] is None):
raise ValueError("Missing the required parameter `x_session_id` when calling `start`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `start`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
if 'x_session_id' in params:
header_params['X-Session-ID'] = params['x_session_id'] # noqa: E501
if 'x_request_id' in params:
header_params['X-Request-Id'] = params['x_request_id'] # noqa: E501
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json;charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json;charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/vkasr/rest/v1/recognize/stream', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='StreamResponseDto', # noqa: E501
auth_settings=auth_settings,
async_=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
[
"cloud_client.cloud_api_client.CloudApiClient",
"six.iteritems"
] |
[((2852, 2883), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (2865, 2883), False, 'import six\n'), ((7458, 7489), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (7471, 7489), False, 'import six\n'), ((12193, 12224), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (12206, 12224), False, 'import six\n'), ((16712, 16743), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (16725, 16743), False, 'import six\n'), ((21031, 21062), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (21044, 21062), False, 'import six\n'), ((25611, 25642), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (25624, 25642), False, 'import six\n'), ((29783, 29814), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (29796, 29814), False, 'import six\n'), ((765, 781), 'cloud_client.cloud_api_client.CloudApiClient', 'CloudApiClient', ([], {}), '()\n', (779, 781), False, 'from cloud_client.cloud_api_client import CloudApiClient\n')]
|
import random
w, h = 128, 128
Matrix1 = [[random.randint(-100, 100) for x in range(w)] for y in range(h)]
Matrix2 = [[random.randint(-100, 100) for x in range(w)] for y in range(h)]
Matrix_out = [[0 for x in range(w)] for y in range(h)]
print(Matrix2)
print(Matrix1)
print(Matrix_out)
for x in range(len(Matrix1)): # rows
for y in range(len(Matrix1[0])): # column
Matrix_out[x][y] = Matrix1[x][y] + Matrix2[x][y]
print("Result matrix:")
print(Matrix_out)
|
[
"random.randint"
] |
[((48, 73), 'random.randint', 'random.randint', (['(-100)', '(100)'], {}), '(-100, 100)\n', (62, 73), False, 'import random\n'), ((125, 150), 'random.randint', 'random.randint', (['(-100)', '(100)'], {}), '(-100, 100)\n', (139, 150), False, 'import random\n')]
|
import inspect
import os
import re
from typing import Optional
import requests
from colorama import Fore
from colorama import Style
from ruamel.yaml import YAML
from voluptuous.error import Invalid
from voluptuous.error import MultipleInvalid
from .compliance import Compliance
from .get_apikeys_from_env_vars import get_apikeys_from_env_vars
from .mixins.checklist_mixin import ChecklistMixin
from .mixins.citation_mixin import CitationMixin
from .mixins.license_mixin import LicenseMixin
from .mixins.registry_mixin import RegistryMixin
from .mixins.repository_mixin import RepositoryMixin
from .readme import Readme
from .readme_format import ReadmeFormat
from .repo import Repo
from .requesting.get_from_platform import get_from_platform
from .schema import validate_against_schema
DEFAULT_CONFIG_FILENAME = ".howfairis.yml"
class Checker(RepositoryMixin, LicenseMixin, RegistryMixin, CitationMixin, ChecklistMixin):
"""Check the repo against the five FAIR software recommendations using supplied config.
Args:
repo: Repository to check
user_config_filename: Filename of configuration file on users local filesystem.
repo_config_filename: Filename of configuration file on the repository.
Default is ".howfairis.yml".
ignore_repo_config: If True then the configuration file on the repository is not loaded.
Default is False.
is_quiet: If True then less verbose output is printed. Default is False.
Example:
The registry compliance of the ``https://github.com/fair-software/howfairis`` repository can be checked with:
.. code-block ::
>>> from howfairis import Repo, Checker
>>> url = "https://github.com/fair-software/howfairis"
>>> repo = Repo(url)
>>> checker = Checker(repo, is_quiet=True)
...
>>> compliance = checker.check_five_recommendations()
>>> compliance.registry
True
Attributes:
repo (.repo.Repo): Object describing the properties of the target repository.
is_quiet (bool): If True then less verbose output is printed. Default is False.
readme (.readme.Readme): Retrieved README from the repository.
The ``skip_*_checks_reason`` and :attr:`Checker.ignore_commented_badges` properties are set based on merger of
1. the default configuration (see :download:`howfairis/data/.howfairis.yml </../howfairis/data/.howfairis.yml>`),
2. config file from repo and
3. config file from users local filesystem.
"""
# pylint: disable=too-many-arguments,too-many-instance-attributes
def __init__(self, repo: Repo,
user_config_filename: Optional[str] = None,
repo_config_filename: str = DEFAULT_CONFIG_FILENAME,
ignore_repo_config: bool = False, is_quiet: bool = False):
super().__init__()
self.repo = repo
self.is_quiet = is_quiet
self._apikeys = get_apikeys_from_env_vars()
self._default_config = Checker._load_default_config()
self._repo_config = self._load_repo_config(repo_config_filename, ignore_repo_config)
self._user_config = Checker._load_user_config(user_config_filename)
self._merged_config = self._merge_configurations()
self.readme = self._get_readme()
def _eval_regexes(self, regexes, check_name=None):
if check_name is None:
# get name of the function who's calling me
check_name = inspect.stack()[1].function
if self.readme.text is None:
self._print_state(check_name=check_name, state=False)
return False
for regex in regexes:
if re.compile(regex).search(self.readme.text) is not None:
self._print_state(check_name=check_name, state=True)
return True
self._print_state(check_name=check_name, state=False)
return False
def _get_readme(self):
for readme_filename in ["README.rst", "README.md"]:
raw_url = self.repo.raw_url_format_string.format(readme_filename)
try:
response = get_from_platform(self.repo.platform, raw_url, "raw", apikeys=self._apikeys)
# If the response was successful, no Exception will be raised
response.raise_for_status()
except requests.HTTPError:
continue
if readme_filename == "README.rst":
readme_file_format = ReadmeFormat.RESTRUCTUREDTEXT
elif readme_filename == "README.md":
readme_file_format = ReadmeFormat.MARKDOWN
else:
readme_file_format = None
return Readme(filename=readme_filename, text=response.text, file_format=readme_file_format,
ignore_commented_badges=self.ignore_commented_badges)
print("\nDid not find a README[.md|.rst] file at {0}\nProceeding without it -- expect the"
" compliance to suffer.\n".format(raw_url.replace(readme_filename, "")))
return Readme(filename=None, text=None, file_format=None)
@staticmethod
def _load_default_config():
pkg_root = os.path.dirname(__file__)
default_config_filename = os.path.join(pkg_root, "data", ".howfairis.yml")
with open(default_config_filename, "rt") as fid:
text = fid.read()
default_config = YAML(typ="safe").load(text)
if default_config is None:
default_config = dict()
try:
validate_against_schema(default_config)
except (Invalid, MultipleInvalid):
print("Default configuration file should follow the schema for it to be considered.")
return dict()
return default_config
def _load_repo_config(self, repo_config_filename, ignore_remote_config):
if self.repo is None:
return dict()
if ignore_remote_config is True:
return dict()
raw_url = self.repo.raw_url_format_string.format(repo_config_filename)
non_default_repo_config_filename = repo_config_filename != DEFAULT_CONFIG_FILENAME
try:
response = get_from_platform(self.repo.platform, raw_url, "raw", apikeys=self._apikeys)
# If the response was successful, no Exception will be raised
response.raise_for_status()
if non_default_repo_config_filename:
print("Using the configuration file {0}".format(raw_url))
except requests.HTTPError as ex:
if non_default_repo_config_filename:
raise Exception("Could not find the configuration file {0}".format(raw_url)) from ex
return dict()
try:
repo_config = YAML(typ="safe").load(response.text)
except Exception as ex:
raise Exception("Problem loading YAML configuration from file {0}".format(raw_url)) from ex
try:
validate_against_schema(repo_config)
except (Invalid, MultipleInvalid):
print("Repository's configuration file should follow the schema for it to be considered.")
return dict()
return repo_config
@staticmethod
def _load_user_config(user_config_filename):
if user_config_filename is None:
return dict()
if os.path.isabs(user_config_filename):
path = user_config_filename
else:
path = os.path.join(os.getcwd(), user_config_filename)
if not os.path.exists(path):
raise FileNotFoundError("{0} doesn't exist.".format(user_config_filename))
with open(user_config_filename, "rt") as fid:
text = fid.read()
user_config = YAML(typ="safe").load(text)
if user_config is None:
user_config = dict()
try:
validate_against_schema(user_config)
except Exception as ex:
raise Exception("User configuration file should follow the schema.") from ex
return user_config
def _merge_configurations(self):
"""Configuration dictionary based on merger of
* default config from this package
* config from repository
* config from local user
"""
merged = dict()
merged.update(self._default_config)
merged.update(self._repo_config)
merged.update(self._user_config)
return merged
def _print_state(self, check_name="", state=None, indent=6):
if not self.is_quiet:
if state is True:
print(" " * indent + Style.BRIGHT + Fore.GREEN + "\u2713 " + Style.RESET_ALL + check_name)
elif state is False:
print(" " * indent + Style.BRIGHT + Fore.RED + "\u00D7 " + Style.RESET_ALL + check_name)
def check_five_recommendations(self) -> Compliance:
"""Check the repo against the five FAIR software recommendations
Returns: compliance result
"""
return Compliance(repository=self.check_repository(),
license_=self.check_license(),
registry=self.check_registry(),
citation=self.check_citation(),
checklist=self.check_checklist())
@property
def skip_repository_checks_reason(self) -> bool:
"""bool: If True then checks for the repository recommendation are skipped
and the recommendation is marked as compliant"""
return self._merged_config.get("skip_repository_checks_reason", None)
@property
def skip_license_checks_reason(self) -> bool:
"""bool: If True then checks for the license recommendation are skipped
and the recommendation is marked as compliant"""
return self._merged_config.get("skip_license_checks_reason", None)
@property
def skip_registry_checks_reason(self) -> bool:
"""bool: If True then checks for the registry recommendation are skipped
and the recommendation is marked as compliant"""
return self._merged_config.get("skip_registry_checks_reason", None)
@property
def skip_citation_checks_reason(self) -> bool:
"""bool: If True then checks for the citation recommendation are skipped
and the recommendation is marked as compliant"""
return self._merged_config.get("skip_citation_checks_reason", None)
@property
def skip_checklist_checks_reason(self) -> bool:
"""bool: If True then checks for the checklist recommendation are skipped
and the recommendation is marked as compliant"""
return self._merged_config.get("skip_checklist_checks_reason", None)
@property
def ignore_commented_badges(self) -> bool:
"""bool: If True then any commented out badges in the README of the repository are ignored."""
return self._merged_config.get("ignore_commented_badges")
|
[
"os.path.isabs",
"inspect.stack",
"os.getcwd",
"os.path.dirname",
"os.path.exists",
"ruamel.yaml.YAML",
"os.path.join",
"re.compile"
] |
[((5212, 5237), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (5227, 5237), False, 'import os\n'), ((5272, 5320), 'os.path.join', 'os.path.join', (['pkg_root', '"""data"""', '""".howfairis.yml"""'], {}), "(pkg_root, 'data', '.howfairis.yml')\n", (5284, 5320), False, 'import os\n'), ((7358, 7393), 'os.path.isabs', 'os.path.isabs', (['user_config_filename'], {}), '(user_config_filename)\n', (7371, 7393), False, 'import os\n'), ((7532, 7552), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (7546, 7552), False, 'import os\n'), ((5433, 5449), 'ruamel.yaml.YAML', 'YAML', ([], {'typ': '"""safe"""'}), "(typ='safe')\n", (5437, 5449), False, 'from ruamel.yaml import YAML\n'), ((7481, 7492), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (7490, 7492), False, 'import os\n'), ((7749, 7765), 'ruamel.yaml.YAML', 'YAML', ([], {'typ': '"""safe"""'}), "(typ='safe')\n", (7753, 7765), False, 'from ruamel.yaml import YAML\n'), ((3509, 3524), 'inspect.stack', 'inspect.stack', ([], {}), '()\n', (3522, 3524), False, 'import inspect\n'), ((6775, 6791), 'ruamel.yaml.YAML', 'YAML', ([], {'typ': '"""safe"""'}), "(typ='safe')\n", (6779, 6791), False, 'from ruamel.yaml import YAML\n'), ((3710, 3727), 're.compile', 're.compile', (['regex'], {}), '(regex)\n', (3720, 3727), False, 'import re\n')]
|
from .. import haven_utils
from .. import haven_results as hr
from .. import haven_utils as hu
from .. import haven_share as hd
import os
import pprint
import json
import copy
import pprint
import pandas as pd
from . import widgets as wdg
try:
import ast
from ipywidgets import Button, HBox, VBox
from ipywidgets import widgets
from IPython.display import display
from IPython.core.display import Javascript, display, HTML
from IPython.display import FileLink, FileLinks
from ipywidgets.widgets.interaction import show_inline_matplotlib_plots
except Exception:
print("widgets not available...")
def images_tab(self, output):
db = self
if db.vars.get("legend_list") is None:
db.vars["legend_list"] = hu.get_diff_hparam(db.rm.exp_list)
w_legend = wdg.SelectMultiple(header="Legend:", options=db.rm.exp_params, db_vars=db.vars, var="legend_list")
w_n_exps = wdg.Text("n_exps:", default="3", type="int", db_vars=db.vars, var="n_exps")
w_n_images = wdg.Text("n_images:", default="5", type="int", db_vars=db.vars, var="n_images")
w_figsize = wdg.Text("figsize:", default="(10,5)", type="tuple", db_vars=db.vars, var="figsize")
w_dirname = wdg.Text("dirname:", default="images", type="str", db_vars=db.vars, var="dirname")
bdownload = widgets.Button(description="Download Images", layout=self.layout_button)
bdownload_out = widgets.Output(layout=self.layout_button)
bdownload_zip = widgets.Button(description="Download Images zipped", layout=self.layout_button)
bdownload_zip_out = widgets.Output(layout=self.layout_button)
brefresh = widgets.Button(description="Display Images")
button = widgets.VBox(
[
widgets.HBox(
[
w_legend.get_widget(),
w_n_exps.get_widget(),
w_n_images.get_widget(),
w_figsize.get_widget(),
w_dirname.get_widget(),
]
),
widgets.HBox([brefresh, bdownload, bdownload_out, bdownload_zip, bdownload_zip_out]),
]
)
output_plot = widgets.Output()
with output:
display(button)
display(output_plot)
def on_clicked(b):
output_plot.clear_output()
with output_plot:
self.update_rm()
self.rm_original.fig_image_list = self.rm.get_images(
legend_list=w_legend.update(),
n_images=w_n_images.update(),
n_exps=w_n_exps.update(),
figsize=w_figsize.update(),
dirname=w_dirname.update(),
)
show_inline_matplotlib_plots()
brefresh.on_click(on_clicked)
def on_download_clicked(b):
fname = "images"
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
pp = PdfPages(fname)
for fig in self.rm_original.fig_image_list:
fig.savefig(pp, format="pdf")
pp.close()
bdownload_out.clear_output()
with bdownload_out:
display(FileLink(fname, result_html_prefix="Download: "))
def on_download_clicked_zip(b):
fname = "results.zip"
bdownload_zip_out.clear_output()
with bdownload_zip_out:
import zipfile, glob
exp_id_list = [hu.hash_dict(exp_dict) for exp_dict in self.rm.exp_list]
zipf = zipfile.ZipFile(fname, "w", zipfile.ZIP_DEFLATED)
for exp_id in exp_id_list:
abs_path_list = glob.glob(os.path.join(self.rm.savedir_base, exp_id, "images", "*"))
for abs_path in abs_path_list:
# weq
iname = os.path.split(abs_path)[-1]
rel_path = f"{exp_id}_{iname}"
zipf.write(abs_path, rel_path)
zipf.close()
# self.rm.to_zip(savedir_base="", fname=fname, fname_list=self.vars["fname_list"])
bdownload_zip_out.clear_output()
with bdownload_zip_out:
display("%d exps zipped." % len(self.rm.exp_list))
display(FileLink(fname, result_html_prefix="Download: "))
bdownload.on_click(on_download_clicked)
bdownload_zip.on_click(on_download_clicked_zip)
|
[
"matplotlib.backends.backend_pdf.PdfPages",
"zipfile.ZipFile",
"ipywidgets.widgets.HBox",
"os.path.join",
"IPython.core.display.display",
"ipywidgets.widgets.Button",
"ipywidgets.widgets.interaction.show_inline_matplotlib_plots",
"ipywidgets.widgets.Output",
"os.path.split",
"IPython.display.FileLink"
] |
[((1308, 1380), 'ipywidgets.widgets.Button', 'widgets.Button', ([], {'description': '"""Download Images"""', 'layout': 'self.layout_button'}), "(description='Download Images', layout=self.layout_button)\n", (1322, 1380), False, 'from ipywidgets import widgets\n'), ((1401, 1442), 'ipywidgets.widgets.Output', 'widgets.Output', ([], {'layout': 'self.layout_button'}), '(layout=self.layout_button)\n', (1415, 1442), False, 'from ipywidgets import widgets\n'), ((1463, 1542), 'ipywidgets.widgets.Button', 'widgets.Button', ([], {'description': '"""Download Images zipped"""', 'layout': 'self.layout_button'}), "(description='Download Images zipped', layout=self.layout_button)\n", (1477, 1542), False, 'from ipywidgets import widgets\n'), ((1567, 1608), 'ipywidgets.widgets.Output', 'widgets.Output', ([], {'layout': 'self.layout_button'}), '(layout=self.layout_button)\n', (1581, 1608), False, 'from ipywidgets import widgets\n'), ((1624, 1668), 'ipywidgets.widgets.Button', 'widgets.Button', ([], {'description': '"""Display Images"""'}), "(description='Display Images')\n", (1638, 1668), False, 'from ipywidgets import widgets\n'), ((2135, 2151), 'ipywidgets.widgets.Output', 'widgets.Output', ([], {}), '()\n', (2149, 2151), False, 'from ipywidgets import widgets\n'), ((2178, 2193), 'IPython.core.display.display', 'display', (['button'], {}), '(button)\n', (2185, 2193), False, 'from IPython.core.display import Javascript, display, HTML\n'), ((2202, 2222), 'IPython.core.display.display', 'display', (['output_plot'], {}), '(output_plot)\n', (2209, 2222), False, 'from IPython.core.display import Javascript, display, HTML\n'), ((2892, 2907), 'matplotlib.backends.backend_pdf.PdfPages', 'PdfPages', (['fname'], {}), '(fname)\n', (2900, 2907), False, 'from matplotlib.backends.backend_pdf import PdfPages\n'), ((2014, 2102), 'ipywidgets.widgets.HBox', 'widgets.HBox', (['[brefresh, bdownload, bdownload_out, bdownload_zip, bdownload_zip_out]'], {}), '([brefresh, bdownload, bdownload_out, bdownload_zip,\n bdownload_zip_out])\n', (2026, 2102), False, 'from ipywidgets import widgets\n'), ((2653, 2683), 'ipywidgets.widgets.interaction.show_inline_matplotlib_plots', 'show_inline_matplotlib_plots', ([], {}), '()\n', (2681, 2683), False, 'from ipywidgets.widgets.interaction import show_inline_matplotlib_plots\n'), ((3436, 3485), 'zipfile.ZipFile', 'zipfile.ZipFile', (['fname', '"""w"""', 'zipfile.ZIP_DEFLATED'], {}), "(fname, 'w', zipfile.ZIP_DEFLATED)\n", (3451, 3485), False, 'import zipfile, glob\n'), ((4130, 4178), 'IPython.display.FileLink', 'FileLink', (['fname'], {'result_html_prefix': '"""Download: """'}), "(fname, result_html_prefix='Download: ')\n", (4138, 4178), False, 'from IPython.display import FileLink, FileLinks\n'), ((3108, 3156), 'IPython.display.FileLink', 'FileLink', (['fname'], {'result_html_prefix': '"""Download: """'}), "(fname, result_html_prefix='Download: ')\n", (3116, 3156), False, 'from IPython.display import FileLink, FileLinks\n'), ((3567, 3624), 'os.path.join', 'os.path.join', (['self.rm.savedir_base', 'exp_id', '"""images"""', '"""*"""'], {}), "(self.rm.savedir_base, exp_id, 'images', '*')\n", (3579, 3624), False, 'import os\n'), ((3727, 3750), 'os.path.split', 'os.path.split', (['abs_path'], {}), '(abs_path)\n', (3740, 3750), False, 'import os\n')]
|