From 87b55a6ea6a421b4702dbc178a45165f20d1e775 Mon Sep 17 00:00:00 2001 From: hippo91 Date: Sun, 2 Dec 2018 16:20:06 +0100 Subject: Avoid statement deletion in the _filter_stmts method of the LookupMixin class for PartialFunction In the case where the node is a PartialFunction and its name is the same as the current statement's name, avoid the statement deletion. The problem was that a call to a function that has been previously called vit a functools.partial was wrongly inferred. The bug comes from the _filter_stmts method of the LookupMixin class. The deletion of the current statement should not be made in the case where the node is an instance of the PartialFunction class and if the node's name is the same as the statement's name. This change also extracts PartialFunction from brain_functools into astroid.objects so that we remove a circular import problem. Close PyCQA/pylint#2588 --- ChangeLog | 4 ++++ astroid/brain/brain_functools.py | 28 +++------------------------- astroid/node_classes.py | 12 ++++++++++-- astroid/objects.py | 29 +++++++++++++++++++++++++++++ astroid/tests/unittest_brain.py | 5 ++++- 5 files changed, 50 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 118170fd..2ffee9c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ What's New in astroid 2.2.0? ============================ Release Date: TBA +* Fix a bug where a call to a function that has been previously called via + functools.partial was wrongly inferred + + Close PyCQA/pylint#2588 * Fix a recursion error caused by inferring the ``slice`` builtin. diff --git a/astroid/brain/brain_functools.py b/astroid/brain/brain_functools.py index 473b5bfe..726c82fc 100644 --- a/astroid/brain/brain_functools.py +++ b/astroid/brain/brain_functools.py @@ -12,6 +12,7 @@ from astroid import extract_node from astroid import helpers from astroid.interpreter import objectmodel from astroid import MANAGER +from astroid import objects LRU_CACHE = "functools.lru_cache" @@ -98,31 +99,8 @@ def _functools_partial_inference(node, context=None): "wrapped function received unknown parameters" ) - # Return a wrapped() object that can be used further for inference - class PartialFunction(astroid.FunctionDef): - - filled_positionals = len(call.positional_arguments[1:]) - filled_keywords = list(call.keyword_arguments) - - def infer_call_result(self, caller=None, context=None): - nonlocal call - filled_args = call.positional_arguments[1:] - filled_keywords = call.keyword_arguments - - if context: - current_passed_keywords = { - keyword for (keyword, _) in context.callcontext.keywords - } - for keyword, value in filled_keywords.items(): - if keyword not in current_passed_keywords: - context.callcontext.keywords.append((keyword, value)) - - call_context_args = context.callcontext.args or [] - context.callcontext.args = filled_args + call_context_args - - return super().infer_call_result(caller=caller, context=context) - - partial_function = PartialFunction( + partial_function = objects.PartialFunction( + call, name=inferred_wrapped_function.name, doc=inferred_wrapped_function.doc, lineno=inferred_wrapped_function.lineno, diff --git a/astroid/node_classes.py b/astroid/node_classes.py index 4e5f5612..0ab9be08 100644 --- a/astroid/node_classes.py +++ b/astroid/node_classes.py @@ -1217,8 +1217,16 @@ class LookupMixIn: # want to clear previous assignments if any (hence the test on # optional_assign) if not (optional_assign or are_exclusive(_stmts[pindex], node)): - del _stmt_parents[pindex] - del _stmts[pindex] + if ( + # In case of partial function node, if the statement is different + # from the origin function then it can be deleted otherwise it should + # remain to be able to correctly infer the call to origin function. + not node.is_function + or node.qname() != "PartialFunction" + or node.name != _stmts[pindex].name + ): + del _stmt_parents[pindex] + del _stmts[pindex] if isinstance(node, AssignName): if not optional_assign and stmt.parent is mystmt.parent: _stmts = [] diff --git a/astroid/objects.py b/astroid/objects.py index b68d3596..b511cda0 100644 --- a/astroid/objects.py +++ b/astroid/objects.py @@ -248,6 +248,35 @@ class DictValues(bases.Proxy): __repr__ = node_classes.NodeNG.__repr__ +class PartialFunction(scoped_nodes.FunctionDef): + """A class representing partial function obtained via functools.partial""" + + def __init__( + self, call, name=None, doc=None, lineno=None, col_offset=None, parent=None + ): + super().__init__(name, doc, lineno, col_offset, parent) + self.filled_positionals = len(call.positional_arguments[1:]) + self.filled_args = call.positional_arguments[1:] + self.filled_keywords = call.keyword_arguments + + def infer_call_result(self, caller=None, context=None): + if context: + current_passed_keywords = { + keyword for (keyword, _) in context.callcontext.keywords + } + for keyword, value in self.filled_keywords.items(): + if keyword not in current_passed_keywords: + context.callcontext.keywords.append((keyword, value)) + + call_context_args = context.callcontext.args or [] + context.callcontext.args = self.filled_args + call_context_args + + return super().infer_call_result(caller=caller, context=context) + + def qname(self): + return self.__class__.__name__ + + # TODO: Hack to solve the circular import problem between node_classes and objects # This is not needed in 2.0, which has a cleaner design overall node_classes.Dict.__bases__ = (node_classes.NodeNG, DictInstance) diff --git a/astroid/tests/unittest_brain.py b/astroid/tests/unittest_brain.py index 031bce7a..5eec16ad 100644 --- a/astroid/tests/unittest_brain.py +++ b/astroid/tests/unittest_brain.py @@ -1776,9 +1776,12 @@ class TestFunctoolsPartial: partial(other_test, c=4)(1, 3) #@ partial(other_test, 4, c=4)(4) #@ partial(other_test, 4, c=4)(b=5) #@ + test(1, 2) #@ + partial(other_test, 1, 2)(c=3) #@ + partial(test, b=4)(a=3) #@ """ ) - expected_values = [4, 7, 7, 3, 12, 16, 32, 36] + expected_values = [4, 7, 7, 3, 12, 16, 32, 36, 3, 9, 7] for node, expected_value in zip(ast_nodes, expected_values): inferred = next(node.infer()) assert isinstance(inferred, astroid.Const) -- cgit v1.2.1 From 3de3c1f2b31f97338c581a31cc1323a611efa768 Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Wed, 23 Jan 2019 09:27:27 +0100 Subject: Bump typed_ast to 1.2.0 --- astroid/__pkginfo__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astroid/__pkginfo__.py b/astroid/__pkginfo__.py index 646e6575..81177c87 100644 --- a/astroid/__pkginfo__.py +++ b/astroid/__pkginfo__.py @@ -30,7 +30,7 @@ install_requires = [ "six", "wrapt", 'typing;python_version<"3.5"', - 'typed-ast<=1.1.0;python_version<"3.7" and implementation_name== "cpython"', + 'typed-ast<=1.2.0;python_version<"3.7" and implementation_name== "cpython"', ] # pylint: disable=redefined-builtin; why license is a builtin anyway? -- cgit v1.2.1 From 9d5925fe603c9b6dd98477d638dd397d4226029a Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Fri, 25 Jan 2019 09:51:21 +0100 Subject: ``brain_numpy`` returns an undefined type for ``numpy`` methods to avoid ``assignment-from-no-retur n`` Close PyCQA/pylint#2694 --- ChangeLog | 4 + astroid/brain/brain_numpy.py | 544 +++++++++++++++++++++---------------------- 2 files changed, 276 insertions(+), 272 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ffee9c5..88818cb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ What's New in astroid 2.2.0? ============================ Release Date: TBA +* ``brain_numpy`` returns an undefined type for ``numpy`` methods to avoid ``assignment-from-no-return`` + + Close PyCQA/pylint#2694 + * Fix a bug where a call to a function that has been previously called via functools.partial was wrongly inferred diff --git a/astroid/brain/brain_numpy.py b/astroid/brain/brain_numpy.py index 9d31a476..26c76157 100644 --- a/astroid/brain/brain_numpy.py +++ b/astroid/brain/brain_numpy.py @@ -14,53 +14,53 @@ import astroid def numpy_random_mtrand_transform(): return astroid.parse( """ - def beta(a, b, size=None): pass - def binomial(n, p, size=None): pass - def bytes(length): pass - def chisquare(df, size=None): pass - def choice(a, size=None, replace=True, p=None): pass - def dirichlet(alpha, size=None): pass - def exponential(scale=1.0, size=None): pass - def f(dfnum, dfden, size=None): pass - def gamma(shape, scale=1.0, size=None): pass - def geometric(p, size=None): pass - def get_state(): pass - def gumbel(loc=0.0, scale=1.0, size=None): pass - def hypergeometric(ngood, nbad, nsample, size=None): pass - def laplace(loc=0.0, scale=1.0, size=None): pass - def logistic(loc=0.0, scale=1.0, size=None): pass - def lognormal(mean=0.0, sigma=1.0, size=None): pass - def logseries(p, size=None): pass - def multinomial(n, pvals, size=None): pass - def multivariate_normal(mean, cov, size=None): pass - def negative_binomial(n, p, size=None): pass - def noncentral_chisquare(df, nonc, size=None): pass - def noncentral_f(dfnum, dfden, nonc, size=None): pass - def normal(loc=0.0, scale=1.0, size=None): pass - def pareto(a, size=None): pass - def permutation(x): pass - def poisson(lam=1.0, size=None): pass - def power(a, size=None): pass - def rand(*args): pass - def randint(low, high=None, size=None, dtype='l'): pass - def randn(*args): pass - def random_integers(low, high=None, size=None): pass - def random_sample(size=None): pass - def rayleigh(scale=1.0, size=None): pass - def seed(seed=None): pass - def set_state(state): pass - def shuffle(x): pass - def standard_cauchy(size=None): pass - def standard_exponential(size=None): pass - def standard_gamma(shape, size=None): pass - def standard_normal(size=None): pass - def standard_t(df, size=None): pass - def triangular(left, mode, right, size=None): pass - def uniform(low=0.0, high=1.0, size=None): pass - def vonmises(mu, kappa, size=None): pass - def wald(mean, scale, size=None): pass - def weibull(a, size=None): pass - def zipf(a, size=None): pass + def beta(a, b, size=None): return any + def binomial(n, p, size=None): return any + def bytes(length): return any + def chisquare(df, size=None): return any + def choice(a, size=None, replace=True, p=None): return any + def dirichlet(alpha, size=None): return any + def exponential(scale=1.0, size=None): return any + def f(dfnum, dfden, size=None): return any + def gamma(shape, scale=1.0, size=None): return any + def geometric(p, size=None): return any + def get_state(): return any + def gumbel(loc=0.0, scale=1.0, size=None): return any + def hypergeometric(ngood, nbad, nsample, size=None): return any + def laplace(loc=0.0, scale=1.0, size=None): return any + def logistic(loc=0.0, scale=1.0, size=None): return any + def lognormal(mean=0.0, sigma=1.0, size=None): return any + def logseries(p, size=None): return any + def multinomial(n, pvals, size=None): return any + def multivariate_normal(mean, cov, size=None): return any + def negative_binomial(n, p, size=None): return any + def noncentral_chisquare(df, nonc, size=None): return any + def noncentral_f(dfnum, dfden, nonc, size=None): return any + def normal(loc=0.0, scale=1.0, size=None): return any + def pareto(a, size=None): return any + def permutation(x): return any + def poisson(lam=1.0, size=None): return any + def power(a, size=None): return any + def rand(*args): return any + def randint(low, high=None, size=None, dtype='l'): return any + def randn(*args): return any + def random_integers(low, high=None, size=None): return any + def random_sample(size=None): return any + def rayleigh(scale=1.0, size=None): return any + def seed(seed=None): return any + def set_state(state): return any + def shuffle(x): return any + def standard_cauchy(size=None): return any + def standard_exponential(size=None): return any + def standard_gamma(shape, size=None): return any + def standard_normal(size=None): return any + def standard_t(df, size=None): return any + def triangular(left, mode, right, size=None): return any + def uniform(low=0.0, high=1.0, size=None): return any + def vonmises(mu, kappa, size=None): return any + def wald(mean, scale, size=None): return any + def weibull(a, size=None): return any + def zipf(a, size=None): return any """ ) @@ -77,80 +77,80 @@ def numpy_core_umath_transform(): euler_gamma = 0.5772156649015329 # No arg functions - def geterrobj(): pass + def geterrobj(): return any # One arg functions - def seterrobj(errobj): pass + def seterrobj(errobj): return any # One arg functions with optional kwargs - def arccos(x, {opt_args:s}): pass - def arccosh(x, {opt_args:s}): pass - def arcsin(x, {opt_args:s}): pass - def arcsinh(x, {opt_args:s}): pass - def arctan(x, {opt_args:s}): pass - def arctanh(x, {opt_args:s}): pass - def cbrt(x, {opt_args:s}): pass - def conj(x, {opt_args:s}): pass - def conjugate(x, {opt_args:s}): pass - def cosh(x, {opt_args:s}): pass - def deg2rad(x, {opt_args:s}): pass - def degrees(x, {opt_args:s}): pass - def exp2(x, {opt_args:s}): pass - def expm1(x, {opt_args:s}): pass - def fabs(x, {opt_args:s}): pass - def frexp(x, {opt_args:s}): pass - def isfinite(x, {opt_args:s}): pass - def isinf(x, {opt_args:s}): pass - def log(x, {opt_args:s}): pass - def log1p(x, {opt_args:s}): pass - def log2(x, {opt_args:s}): pass - def logical_not(x, {opt_args:s}): pass - def modf(x, {opt_args:s}): pass - def negative(x, {opt_args:s}): pass - def rad2deg(x, {opt_args:s}): pass - def radians(x, {opt_args:s}): pass - def reciprocal(x, {opt_args:s}): pass - def rint(x, {opt_args:s}): pass - def sign(x, {opt_args:s}): pass - def signbit(x, {opt_args:s}): pass - def sinh(x, {opt_args:s}): pass - def spacing(x, {opt_args:s}): pass - def square(x, {opt_args:s}): pass - def tan(x, {opt_args:s}): pass - def tanh(x, {opt_args:s}): pass - def trunc(x, {opt_args:s}): pass + def arccos(x, {opt_args:s}): return any + def arccosh(x, {opt_args:s}): return any + def arcsin(x, {opt_args:s}): return any + def arcsinh(x, {opt_args:s}): return any + def arctan(x, {opt_args:s}): return any + def arctanh(x, {opt_args:s}): return any + def cbrt(x, {opt_args:s}): return any + def conj(x, {opt_args:s}): return any + def conjugate(x, {opt_args:s}): return any + def cosh(x, {opt_args:s}): return any + def deg2rad(x, {opt_args:s}): return any + def degrees(x, {opt_args:s}): return any + def exp2(x, {opt_args:s}): return any + def expm1(x, {opt_args:s}): return any + def fabs(x, {opt_args:s}): return any + def frexp(x, {opt_args:s}): return any + def isfinite(x, {opt_args:s}): return any + def isinf(x, {opt_args:s}): return any + def log(x, {opt_args:s}): return any + def log1p(x, {opt_args:s}): return any + def log2(x, {opt_args:s}): return any + def logical_not(x, {opt_args:s}): return any + def modf(x, {opt_args:s}): return any + def negative(x, {opt_args:s}): return any + def rad2deg(x, {opt_args:s}): return any + def radians(x, {opt_args:s}): return any + def reciprocal(x, {opt_args:s}): return any + def rint(x, {opt_args:s}): return any + def sign(x, {opt_args:s}): return any + def signbit(x, {opt_args:s}): return any + def sinh(x, {opt_args:s}): return any + def spacing(x, {opt_args:s}): return any + def square(x, {opt_args:s}): return any + def tan(x, {opt_args:s}): return any + def tanh(x, {opt_args:s}): return any + def trunc(x, {opt_args:s}): return any # Two args functions with optional kwargs - def bitwise_and(x1, x2, {opt_args:s}): pass - def bitwise_or(x1, x2, {opt_args:s}): pass - def bitwise_xor(x1, x2, {opt_args:s}): pass - def copysign(x1, x2, {opt_args:s}): pass - def divide(x1, x2, {opt_args:s}): pass - def equal(x1, x2, {opt_args:s}): pass - def float_power(x1, x2, {opt_args:s}): pass - def floor_divide(x1, x2, {opt_args:s}): pass - def fmax(x1, x2, {opt_args:s}): pass - def fmin(x1, x2, {opt_args:s}): pass - def fmod(x1, x2, {opt_args:s}): pass - def greater(x1, x2, {opt_args:s}): pass - def hypot(x1, x2, {opt_args:s}): pass - def ldexp(x1, x2, {opt_args:s}): pass - def left_shift(x1, x2, {opt_args:s}): pass - def less(x1, x2, {opt_args:s}): pass - def logaddexp(x1, x2, {opt_args:s}): pass - def logaddexp2(x1, x2, {opt_args:s}): pass - def logical_and(x1, x2, {opt_args:s}): pass - def logical_or(x1, x2, {opt_args:s}): pass - def logical_xor(x1, x2, {opt_args:s}): pass - def maximum(x1, x2, {opt_args:s}): pass - def minimum(x1, x2, {opt_args:s}): pass - def nextafter(x1, x2, {opt_args:s}): pass - def not_equal(x1, x2, {opt_args:s}): pass - def power(x1, x2, {opt_args:s}): pass - def remainder(x1, x2, {opt_args:s}): pass - def right_shift(x1, x2, {opt_args:s}): pass - def subtract(x1, x2, {opt_args:s}): pass - def true_divide(x1, x2, {opt_args:s}): pass + def bitwise_and(x1, x2, {opt_args:s}): return any + def bitwise_or(x1, x2, {opt_args:s}): return any + def bitwise_xor(x1, x2, {opt_args:s}): return any + def copysign(x1, x2, {opt_args:s}): return any + def divide(x1, x2, {opt_args:s}): return any + def equal(x1, x2, {opt_args:s}): return any + def float_power(x1, x2, {opt_args:s}): return any + def floor_divide(x1, x2, {opt_args:s}): return any + def fmax(x1, x2, {opt_args:s}): return any + def fmin(x1, x2, {opt_args:s}): return any + def fmod(x1, x2, {opt_args:s}): return any + def greater(x1, x2, {opt_args:s}): return any + def hypot(x1, x2, {opt_args:s}): return any + def ldexp(x1, x2, {opt_args:s}): return any + def left_shift(x1, x2, {opt_args:s}): return any + def less(x1, x2, {opt_args:s}): return any + def logaddexp(x1, x2, {opt_args:s}): return any + def logaddexp2(x1, x2, {opt_args:s}): return any + def logical_and(x1, x2, {opt_args:s}): return any + def logical_or(x1, x2, {opt_args:s}): return any + def logical_xor(x1, x2, {opt_args:s}): return any + def maximum(x1, x2, {opt_args:s}): return any + def minimum(x1, x2, {opt_args:s}): return any + def nextafter(x1, x2, {opt_args:s}): return any + def not_equal(x1, x2, {opt_args:s}): return any + def power(x1, x2, {opt_args:s}): return any + def remainder(x1, x2, {opt_args:s}): return any + def right_shift(x1, x2, {opt_args:s}): return any + def subtract(x1, x2, {opt_args:s}): return any + def true_divide(x1, x2, {opt_args:s}): return any """.format( opt_args=ufunc_optional_keyword_arguments ) @@ -177,72 +177,72 @@ def numpy_core_numerictypes_transform(): self.size = None self.strides = None - def all(self): pass - def any(self): pass - def argmax(self): pass - def argmin(self): pass - def argsort(self): pass - def astype(self): pass - def base(self): pass - def byteswap(self): pass - def choose(self): pass - def clip(self): pass - def compress(self): pass - def conj(self): pass - def conjugate(self): pass - def copy(self): pass - def cumprod(self): pass - def cumsum(self): pass - def data(self): pass - def diagonal(self): pass - def dtype(self): pass - def dump(self): pass - def dumps(self): pass - def fill(self): pass - def flags(self): pass - def flat(self): pass - def flatten(self): pass - def getfield(self): pass - def imag(self): pass - def item(self): pass - def itemset(self): pass - def itemsize(self): pass - def max(self): pass - def mean(self): pass - def min(self): pass - def nbytes(self): pass - def ndim(self): pass - def newbyteorder(self): pass - def nonzero(self): pass - def prod(self): pass - def ptp(self): pass - def put(self): pass - def ravel(self): pass - def real(self): pass - def repeat(self): pass - def reshape(self): pass - def resize(self): pass - def round(self): pass - def searchsorted(self): pass - def setfield(self): pass - def setflags(self): pass - def shape(self): pass - def size(self): pass - def sort(self): pass - def squeeze(self): pass - def std(self): pass - def strides(self): pass - def sum(self): pass - def swapaxes(self): pass - def take(self): pass - def tobytes(self): pass - def tofile(self): pass - def tolist(self): pass - def tostring(self): pass - def trace(self): pass - def transpose(self): pass - def var(self): pass - def view(self): pass + def all(self): return any + def any(self): return any + def argmax(self): return any + def argmin(self): return any + def argsort(self): return any + def astype(self): return any + def base(self): return any + def byteswap(self): return any + def choose(self): return any + def clip(self): return any + def compress(self): return any + def conj(self): return any + def conjugate(self): return any + def copy(self): return any + def cumprod(self): return any + def cumsum(self): return any + def data(self): return any + def diagonal(self): return any + def dtype(self): return any + def dump(self): return any + def dumps(self): return any + def fill(self): return any + def flags(self): return any + def flat(self): return any + def flatten(self): return any + def getfield(self): return any + def imag(self): return any + def item(self): return any + def itemset(self): return any + def itemsize(self): return any + def max(self): return any + def mean(self): return any + def min(self): return any + def nbytes(self): return any + def ndim(self): return any + def newbyteorder(self): return any + def nonzero(self): return any + def prod(self): return any + def ptp(self): return any + def put(self): return any + def ravel(self): return any + def real(self): return any + def repeat(self): return any + def reshape(self): return any + def resize(self): return any + def round(self): return any + def searchsorted(self): return any + def setfield(self): return any + def setflags(self): return any + def shape(self): return any + def size(self): return any + def sort(self): return any + def squeeze(self): return any + def std(self): return any + def strides(self): return any + def sum(self): return any + def swapaxes(self): return any + def take(self): return any + def tobytes(self): return any + def tofile(self): return any + def tolist(self): return any + def tostring(self): return any + def trace(self): return any + def transpose(self): return any + def var(self): return any + def view(self): return any class dtype(object): @@ -269,7 +269,7 @@ def numpy_core_numerictypes_transform(): self.subdtype = None self.type = None - def newbyteorder(self, new_order='S'): pass + def newbyteorder(self, new_order='S'): return any class ndarray(object): @@ -291,62 +291,62 @@ def numpy_core_numerictypes_transform(): self.size = None self.strides = None - def all(self): pass - def any(self): pass - def argmax(self): pass - def argmin(self): pass - def argpartition(self): pass - def argsort(self): pass - def astype(self): pass - def byteswap(self): pass - def choose(self): pass - def clip(self): pass - def compress(self): pass - def conj(self): pass - def conjugate(self): pass - def copy(self): pass - def cumprod(self): pass - def cumsum(self): pass - def diagonal(self): pass - def dot(self): pass - def dump(self): pass - def dumps(self): pass - def fill(self): pass - def flatten(self): pass - def getfield(self): pass - def item(self): pass - def itemset(self): pass - def max(self): pass - def mean(self): pass - def min(self): pass - def newbyteorder(self): pass - def nonzero(self): pass - def partition(self): pass - def prod(self): pass - def ptp(self): pass - def put(self): pass - def ravel(self): pass - def repeat(self): pass - def reshape(self): pass - def resize(self): pass - def round(self): pass - def searchsorted(self): pass - def setfield(self): pass - def setflags(self): pass - def sort(self): pass - def squeeze(self): pass - def std(self): pass - def sum(self): pass - def swapaxes(self): pass - def take(self): pass - def tobytes(self): pass - def tofile(self): pass - def tolist(self): pass - def tostring(self): pass - def trace(self): pass - def transpose(self): pass - def var(self): pass - def view(self): pass + def all(self): return any + def any(self): return any + def argmax(self): return any + def argmin(self): return any + def argpartition(self): return any + def argsort(self): return any + def astype(self): return any + def byteswap(self): return any + def choose(self): return any + def clip(self): return any + def compress(self): return any + def conj(self): return any + def conjugate(self): return any + def copy(self): return any + def cumprod(self): return any + def cumsum(self): return any + def diagonal(self): return any + def dot(self): return any + def dump(self): return any + def dumps(self): return any + def fill(self): return any + def flatten(self): return any + def getfield(self): return any + def item(self): return any + def itemset(self): return any + def max(self): return any + def mean(self): return any + def min(self): return any + def newbyteorder(self): return any + def nonzero(self): return any + def partition(self): return any + def prod(self): return any + def ptp(self): return any + def put(self): return any + def ravel(self): return any + def repeat(self): return any + def reshape(self): return any + def resize(self): return any + def round(self): return any + def searchsorted(self): return any + def setfield(self): return any + def setflags(self): return any + def sort(self): return any + def squeeze(self): return any + def std(self): return any + def sum(self): return any + def swapaxes(self): return any + def take(self): return any + def tobytes(self): return any + def tofile(self): return any + def tolist(self): return any + def tostring(self): return any + def trace(self): return any + def transpose(self): return any + def var(self): return any + def view(self): return any class busdaycalendar(object): @@ -354,10 +354,10 @@ def numpy_core_numerictypes_transform(): self.holidays = None self.weekmask = None - class flexible(generic): pass - class bool_(generic): pass - class number(generic): pass - class datetime64(generic): pass + class flexible(generic): return any + class bool_(generic): return any + class number(generic): return any + class datetime64(generic): return any class void(flexible): @@ -365,11 +365,11 @@ def numpy_core_numerictypes_transform(): self.base = None self.dtype = None self.flags = None - def getfield(self): pass - def setfield(self): pass + def getfield(self): return any + def setfield(self): return any - class character(flexible): pass + class character(flexible): return any class integer(number): @@ -378,50 +378,50 @@ def numpy_core_numerictypes_transform(): self.numerator = None - class inexact(number): pass + class inexact(number): return any class str_(str, character): - def maketrans(self, x, y=None, z=None): pass + def maketrans(self, x, y=None, z=None): return any class bytes_(bytes, character): - def fromhex(self, string): pass - def maketrans(self, frm, to): pass + def fromhex(self, string): return any + def maketrans(self, frm, to): return any - class signedinteger(integer): pass + class signedinteger(integer): return any - class unsignedinteger(integer): pass + class unsignedinteger(integer): return any - class complexfloating(inexact): pass + class complexfloating(inexact): return any - class floating(inexact): pass + class floating(inexact): return any class float64(floating, float): - def fromhex(self, string): pass - - - class uint64(unsignedinteger): pass - class complex64(complexfloating): pass - class int16(signedinteger): pass - class float96(floating): pass - class int8(signedinteger): pass - class uint32(unsignedinteger): pass - class uint8(unsignedinteger): pass - class _typedict(dict): pass - class complex192(complexfloating): pass - class timedelta64(signedinteger): pass - class int32(signedinteger): pass - class uint16(unsignedinteger): pass - class float32(floating): pass - class complex128(complexfloating, complex): pass - class float16(floating): pass - class int64(signedinteger): pass + def fromhex(self, string): return any + + + class uint64(unsignedinteger): return any + class complex64(complexfloating): return any + class int16(signedinteger): return any + class float96(floating): return any + class int8(signedinteger): return any + class uint32(unsignedinteger): return any + class uint8(unsignedinteger): return any + class _typedict(dict): return any + class complex192(complexfloating): return any + class timedelta64(signedinteger): return any + class int32(signedinteger): return any + class uint16(unsignedinteger): return any + class float32(floating): return any + class complex128(complexfloating, complex): return any + class float16(floating): return any + class int64(signedinteger): return any buffer_type = memoryview bool8 = bool_ -- cgit v1.2.1