diff --git a/ChangeLog b/ChangeLog index 2ffee9c56a..88818cb7b6 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 9d31a47651..26c7615798 100644 --- a/astroid/brain/brain_numpy.py +++ b/astroid/brain/brain_numpy.py @@ -14,53 +14,53 @@ 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 __init__(self, value): 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 __init__(self, obj, align=False, copy=False): 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 __init__(self, shape, dtype=float, buffer=None, offset=0, 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 __init__(self, weekmask='1111100', holidays=None): 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 __init__(self, *args, **kwargs): 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 __init__(self, value): 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_