def _nanpercentile(a, q, axis=None, out=None, overwrite_input=False,<EOL>interpolation='<STR_LIT>', keepdims=False):

if axis is None:<EOL><INDENT>part = a.ravel()<EOL>result = _nanpercentile1d(part, q, overwrite_input, interpolation)<EOL><DEDENT>else:<EOL><INDENT>result = np.apply_along_axis(_nanpercentile1d, axis, a, q,<EOL>overwrite_input, interpolation)<EOL><DEDENT>if out is not None:<EOL><INDENT>out[...] = result<EOL><DEDENT>return result<EOL>

Private function that doesn't support extended axis or keepdims.
These methods are extended to this function using _ureduce
See nanpercentile for parameter usage


def _nanpercentile1d(arr1d, q, overwrite_input=False, interpolation='<STR_LIT>'):

c = np.isnan(arr1d)<EOL>s = np.where(c)[<NUM_LIT:0>]<EOL>if s.size == arr1d.size:<EOL><INDENT>warnings.warn("<STR_LIT>", RuntimeWarning)<EOL>return np.nan<EOL><DEDENT>elif s.size == <NUM_LIT:0>:<EOL><INDENT>return np.percentile(arr1d, q, overwrite_input=overwrite_input,<EOL>interpolation=interpolation)<EOL><DEDENT>else:<EOL><INDENT>if overwrite_input:<EOL><INDENT>x = arr1d<EOL><DEDENT>else:<EOL><INDENT>x = arr1d.copy()<EOL><DEDENT>enonan = arr1d[-s.size:][~c[-s.size:]]<EOL>x[s[:enonan.size]] = enonan<EOL>return np.percentile(x[:-s.size], q, overwrite_input=True,<EOL>interpolation=interpolation)<EOL><DEDENT>

Private function for rank 1 arrays. Compute percentile ignoring NaNs.
See nanpercentile for parameter usage


def nanvar(a, axis=None, dtype=None, out=None, ddof=<NUM_LIT:0>, keepdims=False):

arr, mask = _replace_nan(a, <NUM_LIT:0>)<EOL>if mask is None:<EOL><INDENT>return np.var(arr, axis=axis, dtype=dtype, out=out, ddof=ddof,<EOL>keepdims=keepdims)<EOL><DEDENT>if dtype is not None:<EOL><INDENT>dtype = np.dtype(dtype)<EOL><DEDENT>if dtype is not None and not issubclass(dtype.type, np.inexact):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if out is not None and not issubclass(out.dtype.type, np.inexact):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>with warnings.catch_warnings():<EOL><INDENT>warnings.simplefilter('<STR_LIT:ignore>')<EOL>cnt = np.sum(~mask, axis=axis, dtype=np.intp, keepdims=True)<EOL>avg = np.sum(arr, axis=axis, dtype=dtype, keepdims=True)<EOL>avg = _divide_by_count(avg, cnt)<EOL>arr -= avg<EOL>arr = _copyto(arr, <NUM_LIT:0>, mask)<EOL>if issubclass(arr.dtype.type, np.complexfloating):<EOL><INDENT>sqr = np.multiply(arr, arr.conj(), out=arr).real<EOL><DEDENT>else:<EOL><INDENT>sqr = np.multiply(arr, arr, out=arr)<EOL><DEDENT>var = np.sum(sqr, axis=axis, dtype=dtype, out=out, keepdims=keepdims)<EOL>if var.ndim < cnt.ndim:<EOL><INDENT>cnt = cnt.squeeze(axis)<EOL><DEDENT>dof = cnt - ddof<EOL>var = _divide_by_count(var, dof)<EOL><DEDENT>isbad = (dof <= <NUM_LIT:0>)<EOL>if np.any(isbad):<EOL><INDENT>warnings.warn("<STR_LIT>", RuntimeWarning)<EOL>var = _copyto(var, np.nan, isbad)<EOL><DEDENT>return var<EOL>

Compute the variance along the specified axis, while ignoring NaNs.

Returns the variance of the array elements, a measure of the spread of
a distribution.  The variance is computed for the flattened array by
default, otherwise over the specified axis.

For all-NaN slices or slices with zero degrees of freedom, NaN is
returned and a `RuntimeWarning` is raised.

.. versionadded:: 1.8.0

Parameters
----------
a : array_like
    Array containing numbers whose variance is desired.  If `a` is not an
    array, a conversion is attempted.
axis : int, optional
    Axis along which the variance is computed.  The default is to compute
    the variance of the flattened array.
dtype : data-type, optional
    Type to use in computing the variance.  For arrays of integer type
    the default is `float32`; for arrays of float types it is the same as
    the array type.
out : ndarray, optional
    Alternate output array in which to place the result.  It must have
    the same shape as the expected output, but the type is cast if
    necessary.
ddof : int, optional
    "Delta Degrees of Freedom": the divisor used in the calculation is
    ``N - ddof``, where ``N`` represents the number of non-NaN
    elements. By default `ddof` is zero.
keepdims : bool, optional
    If this is set to True, the axes which are reduced are left
    in the result as dimensions with size one. With this option,
    the result will broadcast correctly against the original `arr`.

Returns
-------
variance : ndarray, see dtype parameter above
    If `out` is None, return a new array containing the variance,
    otherwise return a reference to the output array. If ddof is >= the
    number of non-NaN elements in a slice or the slice contains only
    NaNs, then the result for that slice is NaN.

See Also
--------
std : Standard deviation
mean : Average
var : Variance while not ignoring NaNs
nanstd, nanmean
numpy.doc.ufuncs : Section "Output arguments"

Notes
-----
The variance is the average of the squared deviations from the mean,
i.e.,  ``var = mean(abs(x - x.mean())**2)``.

The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``.
If, however, `ddof` is specified, the divisor ``N - ddof`` is used
instead.  In standard statistical practice, ``ddof=1`` provides an
unbiased estimator of the variance of a hypothetical infinite
population.  ``ddof=0`` provides a maximum likelihood estimate of the
variance for normally distributed variables.

Note that for complex numbers, the absolute value is taken before
squaring, so that the result is always real and nonnegative.

For floating-point input, the variance is computed using the same
precision the input has.  Depending on the input data, this can cause
the results to be inaccurate, especially for `float32` (see example
below).  Specifying a higher-accuracy accumulator using the ``dtype``
keyword can alleviate this issue.

Examples
--------
>>> a = np.array([[1, np.nan], [3, 4]])
>>> np.var(a)
1.5555555555555554
>>> np.nanvar(a, axis=0)
array([ 1.,  0.])
>>> np.nanvar(a, axis=1)
array([ 0.,  0.25])


def nanstd(a, axis=None, dtype=None, out=None, ddof=<NUM_LIT:0>, keepdims=False):

var = nanvar(a, axis=axis, dtype=dtype, out=out, ddof=ddof,<EOL>keepdims=keepdims)<EOL>if isinstance(var, np.ndarray):<EOL><INDENT>std = np.sqrt(var, out=var)<EOL><DEDENT>else:<EOL><INDENT>std = var.dtype.type(np.sqrt(var))<EOL><DEDENT>return std<EOL>

Compute the standard deviation along the specified axis, while
ignoring NaNs.

Returns the standard deviation, a measure of the spread of a
distribution, of the non-NaN array elements. The standard deviation is
computed for the flattened array by default, otherwise over the
specified axis.

For all-NaN slices or slices with zero degrees of freedom, NaN is
returned and a `RuntimeWarning` is raised.

.. versionadded:: 1.8.0

Parameters
----------
a : array_like
    Calculate the standard deviation of the non-NaN values.
axis : int, optional
    Axis along which the standard deviation is computed. The default is
    to compute the standard deviation of the flattened array.
dtype : dtype, optional
    Type to use in computing the standard deviation. For arrays of
    integer type the default is float64, for arrays of float types it
    is the same as the array type.
out : ndarray, optional
    Alternative output array in which to place the result. It must have
    the same shape as the expected output but the type (of the
    calculated values) will be cast if necessary.
ddof : int, optional
    Means Delta Degrees of Freedom.  The divisor used in calculations
    is ``N - ddof``, where ``N`` represents the number of non-NaN
    elements.  By default `ddof` is zero.
keepdims : bool, optional
    If this is set to True, the axes which are reduced are left
    in the result as dimensions with size one. With this option,
    the result will broadcast correctly against the original `arr`.

Returns
-------
standard_deviation : ndarray, see dtype parameter above.
    If `out` is None, return a new array containing the standard
    deviation, otherwise return a reference to the output array. If
    ddof is >= the number of non-NaN elements in a slice or the slice
    contains only NaNs, then the result for that slice is NaN.

See Also
--------
var, mean, std
nanvar, nanmean
numpy.doc.ufuncs : Section "Output arguments"

Notes
-----
The standard deviation is the square root of the average of the squared
deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``.

The average squared deviation is normally calculated as
``x.sum() / N``, where ``N = len(x)``.  If, however, `ddof` is
specified, the divisor ``N - ddof`` is used instead. In standard
statistical practice, ``ddof=1`` provides an unbiased estimator of the
variance of the infinite population. ``ddof=0`` provides a maximum
likelihood estimate of the variance for normally distributed variables.
The standard deviation computed in this function is the square root of
the estimated variance, so even with ``ddof=1``, it will not be an
unbiased estimate of the standard deviation per se.

Note that, for complex numbers, `std` takes the absolute value before
squaring, so that the result is always real and nonnegative.

For floating-point input, the *std* is computed using the same
precision the input has. Depending on the input data, this can cause
the results to be inaccurate, especially for float32 (see example
below).  Specifying a higher-accuracy accumulator using the `dtype`
keyword can alleviate this issue.

Examples
--------
>>> a = np.array([[1, np.nan], [3, 4]])
>>> np.nanstd(a)
1.247219128924647
>>> np.nanstd(a, axis=0)
array([ 1.,  0.])
>>> np.nanstd(a, axis=1)
array([ 0.,  0.5])


typecodes = [(isinstance(t, str) and t) or asarray(t).dtype.char<EOL>for t in typechars]<EOL>intersection = [t for t in typecodes if t in typeset]<EOL>if not intersection:<EOL><INDENT>return default<EOL><DEDENT>if '<STR_LIT:F>' in intersection and '<STR_LIT:d>' in intersection:<EOL><INDENT>return '<STR_LIT:D>'<EOL><DEDENT>l = []<EOL>for t in intersection:<EOL><INDENT>i = _typecodes_by_elsize.index(t)<EOL>l.append((i, t))<EOL><DEDENT>l.sort()<EOL>return l[<NUM_LIT:0>][<NUM_LIT:1>]<EOL>

Return the character for the minimum-size type to which given types can
be safely cast.

The returned type character must represent the smallest size dtype such
that an array of the returned type can handle the data from an array of
all types in `typechars` (or if `typechars` is an array, then its
dtype.char).

Parameters
----------
typechars : list of str or array_like
    If a list of strings, each string should represent a dtype.
    If array_like, the character representation of the array dtype is used.
typeset : str or list of str, optional
    The set of characters that the returned character is chosen from.
    The default set is 'GDFgdf'.
default : str, optional
    The default character, this is returned if none of the characters in
    `typechars` matches a character in `typeset`.

Returns
-------
typechar : str
    The character representing the minimum-size type that was found.

See Also
--------
dtype, sctype2char, maximum_sctype

Examples
--------
>>> np.mintypecode(['d', 'f', 'S'])
'd'
>>> x = np.array([1.1, 2-3.j])
>>> np.mintypecode(x)
'D'

>>> np.mintypecode('abceh', default='G')
'G'


dtype = _nx.obj2sctype(dtype)<EOL>if not issubclass(dtype, _nx.inexact):<EOL><INDENT>dtype = _nx.float_<EOL><DEDENT>return asarray(a, dtype=dtype)<EOL>

Return an array converted to a float type.

Parameters
----------
a : array_like
    The input array.
dtype : str or dtype object, optional
    Float type code to coerce input array `a`.  If `dtype` is one of the
    'int' dtypes, it is replaced with float64.

Returns
-------
out : ndarray
    The input `a` as a float ndarray.

Examples
--------
>>> np.asfarray([2, 3])
array([ 2.,  3.])
>>> np.asfarray([2, 3], dtype='float')
array([ 2.,  3.])
>>> np.asfarray([2, 3], dtype='int8')
array([ 2.,  3.])


return asanyarray(val).real<EOL>

Return the real part of the elements of the array.

Parameters
----------
val : array_like
    Input array.

Returns
-------
out : ndarray
    Output array. If `val` is real, the type of `val` is used for the
    output.  If `val` has complex elements, the returned type is float.

See Also
--------
real_if_close, imag, angle

Examples
--------
>>> a = np.array([1+2j, 3+4j, 5+6j])
>>> a.real
array([ 1.,  3.,  5.])
>>> a.real = 9
>>> a
array([ 9.+2.j,  9.+4.j,  9.+6.j])
>>> a.real = np.array([9, 8, 7])
>>> a
array([ 9.+2.j,  8.+4.j,  7.+6.j])


return asanyarray(val).imag<EOL>

Return the imaginary part of the elements of the array.

Parameters
----------
val : array_like
    Input array.

Returns
-------
out : ndarray
    Output array. If `val` is real, the type of `val` is used for the
    output.  If `val` has complex elements, the returned type is float.

See Also
--------
real, angle, real_if_close

Examples
--------
>>> a = np.array([1+2j, 3+4j, 5+6j])
>>> a.imag
array([ 2.,  4.,  6.])
>>> a.imag = np.array([8, 10, 12])
>>> a
array([ 1. +8.j,  3.+10.j,  5.+12.j])


ax = asanyarray(x)<EOL>if issubclass(ax.dtype.type, _nx.complexfloating):<EOL><INDENT>return ax.imag != <NUM_LIT:0><EOL><DEDENT>res = zeros(ax.shape, bool)<EOL>return +res<EOL>

Returns a bool array, where True if input element is complex.

What is tested is whether the input has a non-zero imaginary part, not if
the input type is complex.

Parameters
----------
x : array_like
    Input array.

Returns
-------
out : ndarray of bools
    Output array.

See Also
--------
isreal
iscomplexobj : Return True if x is a complex type or an array of complex
               numbers.

Examples
--------
>>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j])
array([ True, False, False, False, False,  True], dtype=bool)


return imag(x) == <NUM_LIT:0><EOL>

Returns a bool array, where True if input element is real.

If element has complex type with zero complex part, the return value
for that element is True.

Parameters
----------
x : array_like
    Input array.

Returns
-------
out : ndarray, bool
    Boolean array of same shape as `x`.

See Also
--------
iscomplex
isrealobj : Return True if x is not a complex type.

Examples
--------
>>> np.isreal([1+1j, 1+0j, 4.5, 3, 2, 2j])
array([False,  True,  True,  True,  True, False], dtype=bool)


return issubclass(asarray(x).dtype.type, _nx.complexfloating)<EOL>

Check for a complex type or an array of complex numbers.

The type of the input is checked, not the value. Even if the input
has an imaginary part equal to zero, `iscomplexobj` evaluates to True.

Parameters
----------
x : any
    The input can be of any type and shape.

Returns
-------
iscomplexobj : bool
    The return value, True if `x` is of a complex type or has at least
    one complex element.

See Also
--------
isrealobj, iscomplex

Examples
--------
>>> np.iscomplexobj(1)
False
>>> np.iscomplexobj(1+0j)
True
>>> np.iscomplexobj([3, 1+0j, True])
True


return not issubclass(asarray(x).dtype.type, _nx.complexfloating)<EOL>

Return True if x is a not complex type or an array of complex numbers.

The type of the input is checked, not the value. So even if the input
has an imaginary part equal to zero, `isrealobj` evaluates to False
if the data type is complex.

Parameters
----------
x : any
    The input can be of any type and shape.

Returns
-------
y : bool
    The return value, False if `x` is of a complex type.

See Also
--------
iscomplexobj, isreal

Examples
--------
>>> np.isrealobj(1)
True
>>> np.isrealobj(1+0j)
False
>>> np.isrealobj([3, 1+0j, True])
False


try:<EOL><INDENT>t = x.dtype.type<EOL><DEDENT>except AttributeError:<EOL><INDENT>t = obj2sctype(type(x))<EOL><DEDENT>if issubclass(t, _nx.complexfloating):<EOL><INDENT>return nan_to_num(x.real) + <NUM_LIT> * nan_to_num(x.imag)<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>y = x.copy()<EOL><DEDENT>except AttributeError:<EOL><INDENT>y = array(x)<EOL><DEDENT><DEDENT>if not issubclass(t, _nx.integer):<EOL><INDENT>if not y.shape:<EOL><INDENT>y = array([x])<EOL>scalar = True<EOL><DEDENT>else:<EOL><INDENT>scalar = False<EOL><DEDENT>are_inf = isposinf(y)<EOL>are_neg_inf = isneginf(y)<EOL>are_nan = isnan(y)<EOL>maxf, minf = _getmaxmin(y.dtype.type)<EOL>y[are_nan] = <NUM_LIT:0><EOL>y[are_inf] = maxf<EOL>y[are_neg_inf] = minf<EOL>if scalar:<EOL><INDENT>y = y[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>return y<EOL>

Replace nan with zero and inf with finite numbers.

Returns an array or scalar replacing Not a Number (NaN) with zero,
(positive) infinity with a very large number and negative infinity
with a very small (or negative) number.

Parameters
----------
x : array_like
    Input data.

Returns
-------
out : ndarray, float
    Array with the same shape as `x` and dtype of the element in `x`  with
    the greatest precision. NaN is replaced by zero, and infinity
    (-infinity) is replaced by the largest (smallest or most negative)
    floating point value that fits in the output dtype. All finite numbers
    are upcast to the output dtype (default float64).

See Also
--------
isinf : Shows which elements are negative or negative infinity.
isneginf : Shows which elements are negative infinity.
isposinf : Shows which elements are positive infinity.
isnan : Shows which elements are Not a Number (NaN).
isfinite : Shows which elements are finite (not NaN, not infinity)

Notes
-----
Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic
(IEEE 754). This means that Not a Number is not equivalent to infinity.

Examples
--------
>>> np.set_printoptions(precision=8)
>>> x = np.array([np.inf, -np.inf, np.nan, -128, 128])
>>> np.nan_to_num(x)
array([  1.79769313e+308,  -1.79769313e+308,   0.00000000e+000,
        -1.28000000e+002,   1.28000000e+002])


a = asanyarray(a)<EOL>if not issubclass(a.dtype.type, _nx.complexfloating):<EOL><INDENT>return a<EOL><DEDENT>if tol > <NUM_LIT:1>:<EOL><INDENT>from numpy.core import getlimits<EOL>f = getlimits.finfo(a.dtype.type)<EOL>tol = f.eps * tol<EOL><DEDENT>if _nx.allclose(a.imag, <NUM_LIT:0>, atol=tol):<EOL><INDENT>a = a.real<EOL><DEDENT>return a<EOL>

If complex input returns a real array if complex parts are close to zero.

"Close to zero" is defined as `tol` * (machine epsilon of the type for
`a`).

Parameters
----------
a : array_like
    Input array.
tol : float
    Tolerance in machine epsilons for the complex part of the elements
    in the array.

Returns
-------
out : ndarray
    If `a` is real, the type of `a` is used for the output.  If `a`
    has complex elements, the returned type is float.

See Also
--------
real, imag, angle

Notes
-----
Machine epsilon varies from machine to machine and between data types
but Python floats on most platforms have a machine epsilon equal to
2.2204460492503131e-16.  You can use 'np.finfo(np.float).eps' to print
out the machine epsilon for floats.

Examples
--------
>>> np.finfo(np.float).eps
2.2204460492503131e-16

>>> np.real_if_close([2.1 + 4e-14j], tol=1000)
array([ 2.1])
>>> np.real_if_close([2.1 + 4e-13j], tol=1000)
array([ 2.1 +4.00000000e-13j])


return a.item()<EOL>

Convert an array of size 1 to its scalar equivalent.

Parameters
----------
a : ndarray
    Input array of size 1.

Returns
-------
out : scalar
    Scalar representation of `a`. The output data type is the same type
    returned by the input's `item` method.

Examples
--------
>>> np.asscalar(np.array([24]))
24


return _namefromtype[char]<EOL>

Return a description for the given data type code.

Parameters
----------
char : str
    Data type code.

Returns
-------
out : str
    Description of the input data type code.

See Also
--------
dtype, typecodes

Examples
--------
>>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q',
...              'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q']
>>> for typechar in typechars:
...     print typechar, ' : ', np.typename(typechar)
...
S1  :  character
?  :  bool
B  :  unsigned char
D  :  complex double precision
G  :  complex long double precision
F  :  complex single precision
I  :  unsigned integer
H  :  unsigned short
L  :  unsigned long integer
O  :  object
Q  :  unsigned long long integer
S  :  string
U  :  unicode
V  :  void
b  :  signed char
d  :  double precision
g  :  long precision
f  :  single precision
i  :  integer
h  :  short
l  :  long integer
q  :  long long integer


is_complex = False<EOL>precision = <NUM_LIT:0><EOL>for a in arrays:<EOL><INDENT>t = a.dtype.type<EOL>if iscomplexobj(a):<EOL><INDENT>is_complex = True<EOL><DEDENT>if issubclass(t, _nx.integer):<EOL><INDENT>p = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>p = array_precision.get(t, None)<EOL>if p is None:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT><DEDENT>precision = max(precision, p)<EOL><DEDENT>if is_complex:<EOL><INDENT>return array_type[<NUM_LIT:1>][precision]<EOL><DEDENT>else:<EOL><INDENT>return array_type[<NUM_LIT:0>][precision]<EOL><DEDENT>

Return a scalar type which is common to the input arrays.

The return type will always be an inexact (i.e. floating point) scalar
type, even if all the arrays are integer arrays. If one of the inputs is
an integer array, the minimum precision type that is returned is a
64-bit floating point dtype.

All input arrays can be safely cast to the returned dtype without loss
of information.

Parameters
----------
array1, array2, ... : ndarrays
    Input arrays.

Returns
-------
out : data type code
    Data type code.

See Also
--------
dtype, mintypecode

Examples
--------
>>> np.common_type(np.arange(2, dtype=np.float32))
<type 'numpy.float32'>
>>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2))
<type 'numpy.float64'>
>>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0]))
<type 'numpy.complex128'>


return matrix(data, dtype=dtype, copy=False)<EOL>

Interpret the input as a matrix.

Unlike `matrix`, `asmatrix` does not make a copy if the input is already
a matrix or an ndarray.  Equivalent to ``matrix(data, copy=False)``.

Parameters
----------
data : array_like
    Input data.

Returns
-------
mat : matrix
    `data` interpreted as a matrix.

Examples
--------
>>> x = np.array([[1, 2], [3, 4]])

>>> m = np.asmatrix(x)

>>> x[0,0] = 5

>>> m
matrix([[5, 2],
        [3, 4]])


M = asanyarray(M)<EOL>if len(M.shape) != <NUM_LIT:2> or M.shape[<NUM_LIT:0>] != M.shape[<NUM_LIT:1>]:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not issubdtype(type(n), int):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>from numpy.linalg import inv<EOL>if n==<NUM_LIT:0>:<EOL><INDENT>M = M.copy()<EOL>M[:] = identity(M.shape[<NUM_LIT:0>])<EOL>return M<EOL><DEDENT>elif n<<NUM_LIT:0>:<EOL><INDENT>M = inv(M)<EOL>n *= -<NUM_LIT:1><EOL><DEDENT>result = M<EOL>if n <= <NUM_LIT:3>:<EOL><INDENT>for _ in range(n-<NUM_LIT:1>):<EOL><INDENT>result=N.dot(result, M)<EOL><DEDENT>return result<EOL><DEDENT>beta = binary_repr(n)<EOL>Z, q, t = M, <NUM_LIT:0>, len(beta)<EOL>while beta[t-q-<NUM_LIT:1>] == '<STR_LIT:0>':<EOL><INDENT>Z = N.dot(Z, Z)<EOL>q += <NUM_LIT:1><EOL><DEDENT>result = Z<EOL>for k in range(q+<NUM_LIT:1>, t):<EOL><INDENT>Z = N.dot(Z, Z)<EOL>if beta[t-k-<NUM_LIT:1>] == '<STR_LIT:1>':<EOL><INDENT>result = N.dot(result, Z)<EOL><DEDENT><DEDENT>return result<EOL>

Raise a square matrix to the (integer) power `n`.

For positive integers `n`, the power is computed by repeated matrix
squarings and matrix multiplications. If ``n == 0``, the identity matrix
of the same shape as M is returned. If ``n < 0``, the inverse
is computed and then raised to the ``abs(n)``.

Parameters
----------
M : ndarray or matrix object
    Matrix to be "powered."  Must be square, i.e. ``M.shape == (m, m)``,
    with `m` a positive integer.
n : int
    The exponent can be any integer or long integer, positive,
    negative, or zero.

Returns
-------
M**n : ndarray or matrix object
    The return value is the same shape and type as `M`;
    if the exponent is positive or zero then the type of the
    elements is the same as those of `M`. If the exponent is
    negative the elements are floating-point.

Raises
------
LinAlgError
    If the matrix is not numerically invertible.

See Also
--------
matrix
    Provides an equivalent function as the exponentiation operator
    (``**``, not ``^``).

Examples
--------
>>> from numpy import linalg as LA
>>> i = np.array([[0, 1], [-1, 0]]) # matrix equiv. of the imaginary unit
>>> LA.matrix_power(i, 3) # should = -i
array([[ 0, -1],
       [ 1,  0]])
>>> LA.matrix_power(np.matrix(i), 3) # matrix arg returns matrix
matrix([[ 0, -1],
        [ 1,  0]])
>>> LA.matrix_power(i, 0)
array([[1, 0],
       [0, 1]])
>>> LA.matrix_power(i, -3) # should = 1/(-i) = i, but w/ f.p. elements
array([[ 0.,  1.],
       [-1.,  0.]])

Somewhat more sophisticated example

>>> q = np.zeros((4, 4))
>>> q[0:2, 0:2] = -i
>>> q[2:4, 2:4] = i
>>> q # one of the three quarternion units not equal to 1
array([[ 0., -1.,  0.,  0.],
       [ 1.,  0.,  0.,  0.],
       [ 0.,  0.,  0.,  1.],
       [ 0.,  0., -1.,  0.]])
>>> LA.matrix_power(q, 2) # = -np.eye(4)
array([[-1.,  0.,  0.,  0.],
       [ 0., -1.,  0.,  0.],
       [ 0.,  0., -1.,  0.],
       [ 0.,  0.,  0., -1.]])


if isinstance(obj, str):<EOL><INDENT>if gdict is None:<EOL><INDENT>frame = sys._getframe().f_back<EOL>glob_dict = frame.f_globals<EOL>loc_dict = frame.f_locals<EOL><DEDENT>else:<EOL><INDENT>glob_dict = gdict<EOL>loc_dict = ldict<EOL><DEDENT>return matrix(_from_string(obj, glob_dict, loc_dict))<EOL><DEDENT>if isinstance(obj, (tuple, list)):<EOL><INDENT>arr_rows = []<EOL>for row in obj:<EOL><INDENT>if isinstance(row, N.ndarray):  <EOL><INDENT>return matrix(concatenate(obj, axis=-<NUM_LIT:1>))<EOL><DEDENT>else:<EOL><INDENT>arr_rows.append(concatenate(row, axis=-<NUM_LIT:1>))<EOL><DEDENT><DEDENT>return matrix(concatenate(arr_rows, axis=<NUM_LIT:0>))<EOL><DEDENT>if isinstance(obj, N.ndarray):<EOL><INDENT>return matrix(obj)<EOL><DEDENT>

Build a matrix object from a string, nested sequence, or array.

Parameters
----------
obj : str or array_like
    Input data.  Names of variables in the current scope may be
    referenced, even if `obj` is a string.

Returns
-------
out : matrix
    Returns a matrix object, which is a specialized 2-D array.

See Also
--------
matrix

Examples
--------
>>> A = np.mat('1 1; 1 1')
>>> B = np.mat('2 2; 2 2')
>>> C = np.mat('3 4; 5 6')
>>> D = np.mat('7 8; 9 0')

All the following expressions construct the same block matrix:

>>> np.bmat([[A, B], [C, D]])
matrix([[1, 1, 2, 2],
        [1, 1, 2, 2],
        [3, 4, 7, 8],
        [5, 6, 9, 0]])
>>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]])
matrix([[1, 1, 2, 2],
        [1, 1, 2, 2],
        [3, 4, 7, 8],
        [5, 6, 9, 0]])
>>> np.bmat('A,B; C,D')
matrix([[1, 1, 2, 2],
        [1, 1, 2, 2],
        [3, 4, 7, 8],
        [5, 6, 9, 0]])


if axis is None:<EOL><INDENT>return self[<NUM_LIT:0>, <NUM_LIT:0>]<EOL><DEDENT>elif axis==<NUM_LIT:0>:<EOL><INDENT>return self<EOL><DEDENT>elif axis==<NUM_LIT:1>:<EOL><INDENT>return self.transpose()<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>

A convenience function for operations that need to preserve axis
        orientation.


if axis is None:<EOL><INDENT>return self[<NUM_LIT:0>, <NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>return self<EOL><DEDENT>

A convenience function for operations that want to collapse
        to a scalar like _align, but are using keepdims=True


return self.__array__().tolist()<EOL>

Return the matrix as a (possibly nested) list.

See `ndarray.tolist` for full documentation.

See Also
--------
ndarray.tolist

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3,4))); x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> x.tolist()
[[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]


def sum(self, axis=None, dtype=None, out=None):

return N.ndarray.sum(self, axis, dtype, out, keepdims=True)._collapse(axis)<EOL>

Returns the sum of the matrix elements, along the given axis.

Refer to `numpy.sum` for full documentation.

See Also
--------
numpy.sum

Notes
-----
This is the same as `ndarray.sum`, except that where an `ndarray` would
be returned, a `matrix` object is returned instead.

Examples
--------
>>> x = np.matrix([[1, 2], [4, 3]])
>>> x.sum()
10
>>> x.sum(axis=1)
matrix([[3],
        [7]])
>>> x.sum(axis=1, dtype='float')
matrix([[ 3.],
        [ 7.]])
>>> out = np.zeros((1, 2), dtype='float')
>>> x.sum(axis=1, dtype='float', out=out)
matrix([[ 3.],
        [ 7.]])


def mean(self, axis=None, dtype=None, out=None):

return N.ndarray.mean(self, axis, dtype, out, keepdims=True)._collapse(axis)<EOL>

Returns the average of the matrix elements along the given axis.

Refer to `numpy.mean` for full documentation.

See Also
--------
numpy.mean

Notes
-----
Same as `ndarray.mean` except that, where that returns an `ndarray`,
this returns a `matrix` object.

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3, 4)))
>>> x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> x.mean()
5.5
>>> x.mean(0)
matrix([[ 4.,  5.,  6.,  7.]])
>>> x.mean(1)
matrix([[ 1.5],
        [ 5.5],
        [ 9.5]])


def std(self, axis=None, dtype=None, out=None, ddof=<NUM_LIT:0>):

return N.ndarray.std(self, axis, dtype, out, ddof, keepdims=True)._collapse(axis)<EOL>

Return the standard deviation of the array elements along the given axis.

Refer to `numpy.std` for full documentation.

See Also
--------
numpy.std

Notes
-----
This is the same as `ndarray.std`, except that where an `ndarray` would
be returned, a `matrix` object is returned instead.

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3, 4)))
>>> x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> x.std()
3.4520525295346629
>>> x.std(0)
matrix([[ 3.26598632,  3.26598632,  3.26598632,  3.26598632]])
>>> x.std(1)
matrix([[ 1.11803399],
        [ 1.11803399],
        [ 1.11803399]])


def var(self, axis=None, dtype=None, out=None, ddof=<NUM_LIT:0>):

return N.ndarray.var(self, axis, dtype, out, ddof, keepdims=True)._collapse(axis)<EOL>

Returns the variance of the matrix elements, along the given axis.

Refer to `numpy.var` for full documentation.

See Also
--------
numpy.var

Notes
-----
This is the same as `ndarray.var`, except that where an `ndarray` would
be returned, a `matrix` object is returned instead.

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3, 4)))
>>> x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> x.var()
11.916666666666666
>>> x.var(0)
matrix([[ 10.66666667,  10.66666667,  10.66666667,  10.66666667]])
>>> x.var(1)
matrix([[ 1.25],
        [ 1.25],
        [ 1.25]])


def prod(self, axis=None, dtype=None, out=None):

return N.ndarray.prod(self, axis, dtype, out, keepdims=True)._collapse(axis)<EOL>

Return the product of the array elements over the given axis.

Refer to `prod` for full documentation.

See Also
--------
prod, ndarray.prod

Notes
-----
Same as `ndarray.prod`, except, where that returns an `ndarray`, this
returns a `matrix` object instead.

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3,4))); x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> x.prod()
0
>>> x.prod(0)
matrix([[  0,  45, 120, 231]])
>>> x.prod(1)
matrix([[   0],
        [ 840],
        [7920]])


return N.ndarray.any(self, axis, out, keepdims=True)._collapse(axis)<EOL>

Test whether any array element along a given axis evaluates to True.

Refer to `numpy.any` for full documentation.

Parameters
----------
axis : int, optional
    Axis along which logical OR is performed
out : ndarray, optional
    Output to existing array instead of creating new one, must have
    same shape as expected output

Returns
-------
    any : bool, ndarray
        Returns a single bool if `axis` is ``None``; otherwise,
        returns `ndarray`


return N.ndarray.all(self, axis, out, keepdims=True)._collapse(axis)<EOL>

Test whether all matrix elements along a given axis evaluate to True.

Parameters
----------
See `numpy.all` for complete descriptions

See Also
--------
numpy.all

Notes
-----
This is the same as `ndarray.all`, but it returns a `matrix` object.

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3,4))); x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> y = x[0]; y
matrix([[0, 1, 2, 3]])
>>> (x == y)
matrix([[ True,  True,  True,  True],
        [False, False, False, False],
        [False, False, False, False]], dtype=bool)
>>> (x == y).all()
False
>>> (x == y).all(0)
matrix([[False, False, False, False]], dtype=bool)
>>> (x == y).all(1)
matrix([[ True],
        [False],
        [False]], dtype=bool)


return N.ndarray.max(self, axis, out, keepdims=True)._collapse(axis)<EOL>

Return the maximum value along an axis.

Parameters
----------
See `amax` for complete descriptions

See Also
--------
amax, ndarray.max

Notes
-----
This is the same as `ndarray.max`, but returns a `matrix` object
where `ndarray.max` would return an ndarray.

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3,4))); x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> x.max()
11
>>> x.max(0)
matrix([[ 8,  9, 10, 11]])
>>> x.max(1)
matrix([[ 3],
        [ 7],
        [11]])


return N.ndarray.argmax(self, axis, out)._align(axis)<EOL>

Indices of the maximum values along an axis.

Parameters
----------
See `numpy.argmax` for complete descriptions

See Also
--------
numpy.argmax

Notes
-----
This is the same as `ndarray.argmax`, but returns a `matrix` object
where `ndarray.argmax` would return an `ndarray`.

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3,4))); x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> x.argmax()
11
>>> x.argmax(0)
matrix([[2, 2, 2, 2]])
>>> x.argmax(1)
matrix([[3],
        [3],
        [3]])


return N.ndarray.min(self, axis, out, keepdims=True)._collapse(axis)<EOL>

Return the minimum value along an axis.

Parameters
----------
See `amin` for complete descriptions.

See Also
--------
amin, ndarray.min

Notes
-----
This is the same as `ndarray.min`, but returns a `matrix` object
where `ndarray.min` would return an ndarray.

Examples
--------
>>> x = -np.matrix(np.arange(12).reshape((3,4))); x
matrix([[  0,  -1,  -2,  -3],
        [ -4,  -5,  -6,  -7],
        [ -8,  -9, -10, -11]])
>>> x.min()
-11
>>> x.min(0)
matrix([[ -8,  -9, -10, -11]])
>>> x.min(1)
matrix([[ -3],
        [ -7],
        [-11]])


return N.ndarray.argmin(self, axis, out)._align(axis)<EOL>

Return the indices of the minimum values along an axis.

Parameters
----------
See `numpy.argmin` for complete descriptions.

See Also
--------
numpy.argmin

Notes
-----
This is the same as `ndarray.argmin`, but returns a `matrix` object
where `ndarray.argmin` would return an `ndarray`.

Examples
--------
>>> x = -np.matrix(np.arange(12).reshape((3,4))); x
matrix([[  0,  -1,  -2,  -3],
        [ -4,  -5,  -6,  -7],
        [ -8,  -9, -10, -11]])
>>> x.argmin()
11
>>> x.argmin(0)
matrix([[2, 2, 2, 2]])
>>> x.argmin(1)
matrix([[3],
        [3],
        [3]])


return N.ndarray.ptp(self, axis, out)._align(axis)<EOL>

Peak-to-peak (maximum - minimum) value along the given axis.

Refer to `numpy.ptp` for full documentation.

See Also
--------
numpy.ptp

Notes
-----
Same as `ndarray.ptp`, except, where that would return an `ndarray` object,
this returns a `matrix` object.

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3,4))); x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> x.ptp()
11
>>> x.ptp(0)
matrix([[8, 8, 8, 8]])
>>> x.ptp(1)
matrix([[3],
        [3],
        [3]])


M, N = self.shape<EOL>if M == N:<EOL><INDENT>from numpy.dual import inv as func<EOL><DEDENT>else:<EOL><INDENT>from numpy.dual import pinv as func<EOL><DEDENT>return asmatrix(func(self))<EOL>

Returns the (multiplicative) inverse of invertible `self`.

Parameters
----------
None

Returns
-------
ret : matrix object
    If `self` is non-singular, `ret` is such that ``ret * self`` ==
    ``self * ret`` == ``np.matrix(np.eye(self[0,:].size)`` all return
    ``True``.

Raises
------
numpy.linalg.LinAlgError: Singular matrix
    If `self` is singular.

See Also
--------
linalg.inv

Examples
--------
>>> m = np.matrix('[1, 2; 3, 4]'); m
matrix([[1, 2],
        [3, 4]])
>>> m.getI()
matrix([[-2. ,  1. ],
        [ 1.5, -0.5]])
>>> m.getI() * m
matrix([[ 1.,  0.],
        [ 0.,  1.]])


return self.__array__()<EOL>

Return `self` as an `ndarray` object.

Equivalent to ``np.asarray(self)``.

Parameters
----------
None

Returns
-------
ret : ndarray
    `self` as an `ndarray`

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3,4))); x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> x.getA()
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11]])


return self.__array__().ravel()<EOL>

Return `self` as a flattened `ndarray`.

Equivalent to ``np.asarray(x).ravel()``

Parameters
----------
None

Returns
-------
ret : ndarray
    `self`, 1-D, as an `ndarray`

Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3,4))); x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
>>> x.getA1()
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11])


return self.transpose()<EOL>

Returns the transpose of the matrix.

Does *not* conjugate!  For the complex conjugate transpose, use ``.H``.

Parameters
----------
None

Returns
-------
ret : matrix object
    The (non-conjugated) transpose of the matrix.

See Also
--------
transpose, getH

Examples
--------
>>> m = np.matrix('[1, 2; 3, 4]')
>>> m
matrix([[1, 2],
        [3, 4]])
>>> m.getT()
matrix([[1, 3],
        [2, 4]])


if issubclass(self.dtype.type, N.complexfloating):<EOL><INDENT>return self.transpose().conjugate()<EOL><DEDENT>else:<EOL><INDENT>return self.transpose()<EOL><DEDENT>


lexer = shlex.shlex(line)<EOL>lexer.whitespace_split = True<EOL>d = {'<STR_LIT>': [], '<STR_LIT>': [], '<STR_LIT>': [],<EOL>'<STR_LIT>': [], '<STR_LIT>': []}<EOL>def next_token(t):<EOL><INDENT>if t.startswith('<STR_LIT>'):<EOL><INDENT>if len(t) > <NUM_LIT:2>:<EOL><INDENT>d['<STR_LIT>'].append(t[<NUM_LIT:2>:])<EOL><DEDENT>else:<EOL><INDENT>t = lexer.get_token()<EOL>d['<STR_LIT>'].append(t)<EOL><DEDENT><DEDENT>elif t.startswith('<STR_LIT>'):<EOL><INDENT>if len(t) > <NUM_LIT:2>:<EOL><INDENT>d['<STR_LIT>'].append(t[<NUM_LIT:2>:])<EOL><DEDENT>else:<EOL><INDENT>t = lexer.get_token()<EOL>d['<STR_LIT>'].append(t)<EOL><DEDENT><DEDENT>elif t.startswith('<STR_LIT>'):<EOL><INDENT>d['<STR_LIT>'].append(t[<NUM_LIT:2>:])<EOL><DEDENT>elif t.startswith('<STR_LIT>'):<EOL><INDENT>d['<STR_LIT>'].append(t[<NUM_LIT:2>:])<EOL><DEDENT>else:<EOL><INDENT>d['<STR_LIT>'].append(t)<EOL><DEDENT>return lexer.get_token()<EOL><DEDENT>t = lexer.get_token()<EOL>while t:<EOL><INDENT>t = next_token(t)<EOL><DEDENT>return d<EOL>

Parse a line from a config file containing compile flags.

Parameters
----------
line : str
    A single line containing one or more compile flags.

Returns
-------
d : dict
    Dictionary of parsed flags, split into relevant categories.
    These categories are the keys of `d`:

    * 'include_dirs'
    * 'library_dirs'
    * 'libraries'
    * 'macros'
    * 'ignored'


try:<EOL><INDENT>return _CACHE[pkgname]<EOL><DEDENT>except KeyError:<EOL><INDENT>v = _read_config_imp(pkg_to_filename(pkgname), dirs)<EOL>_CACHE[pkgname] = v<EOL>return v<EOL><DEDENT>

Return library info for a package from its configuration file.

Parameters
----------
pkgname : str
    Name of the package (should match the name of the .ini file, without
    the extension, e.g. foo for the file foo.ini).
dirs : sequence, optional
    If given, should be a sequence of directories - usually including
    the NumPy base directory - where to look for npy-pkg-config files.

Returns
-------
pkginfo : class instance
    The `LibraryInfo` instance containing the build information.

Raises
------
PkgNotFound
    If the package is not found.

See Also
--------
misc_util.get_info, misc_util.get_pkg_info

Examples
--------
>>> npymath_info = np.distutils.npy_pkg_config.read_config('npymath')
>>> type(npymath_info)
<class 'numpy.distutils.npy_pkg_config.LibraryInfo'>
>>> print npymath_info
Name: npymath
Description: Portable, core math library implementing C99 standard
Requires:
Version: 0.1  #random


return list(self._sections.keys())<EOL>

Return the section headers of the config file.

Parameters
----------
None

Returns
-------
keys : list of str
    The list of section headers.


return list(self._raw_data.keys())<EOL>

Return the list of variable names.

Parameters
----------
None

Returns
-------
names : list of str
    The names of all variables in the `VariableSet` instance.


if level == <NUM_LIT:0> :<EOL><INDENT>loopbeg = "<STR_LIT>"<EOL>loopend = "<STR_LIT>"<EOL><DEDENT>else :<EOL><INDENT>loopbeg = "<STR_LIT>" % level<EOL>loopend = "<STR_LIT>" % level<EOL><DEDENT>ind = <NUM_LIT:0><EOL>line = <NUM_LIT:0><EOL>spanlist = []<EOL>while True:<EOL><INDENT>start = astr.find(loopbeg, ind)<EOL>if start == -<NUM_LIT:1>:<EOL><INDENT>break<EOL><DEDENT>start2 = astr.find("<STR_LIT>", start)<EOL>start2 = astr.find("<STR_LIT:\n>", start2)<EOL>fini1 = astr.find(loopend, start2)<EOL>fini2 = astr.find("<STR_LIT:\n>", fini1)<EOL>line += astr.count("<STR_LIT:\n>", ind, start2+<NUM_LIT:1>)<EOL>spanlist.append((start, start2+<NUM_LIT:1>, fini1, fini2+<NUM_LIT:1>, line))<EOL>line += astr.count("<STR_LIT:\n>", start2+<NUM_LIT:1>, fini2)<EOL>ind = fini2<EOL><DEDENT>spanlist.sort()<EOL>return spanlist<EOL>

The returned line number is from the beginning of the string, starting
at zero. Returns an empty list if no loops found.


<EOL>loophead = stripast.sub("<STR_LIT>", loophead)<EOL>names = []<EOL>reps = named_re.findall(loophead)<EOL>nsub = None<EOL>for rep in reps:<EOL><INDENT>name = rep[<NUM_LIT:0>]<EOL>vals = parse_values(rep[<NUM_LIT:1>])<EOL>size = len(vals)<EOL>if nsub is None :<EOL><INDENT>nsub = size<EOL><DEDENT>elif nsub != size :<EOL><INDENT>msg = "<STR_LIT>" % (name, vals)<EOL>raise ValueError(msg)<EOL><DEDENT>names.append((name, vals))<EOL><DEDENT>excludes = []<EOL>for obj in exclude_re.finditer(loophead):<EOL><INDENT>span = obj.span()<EOL>endline = loophead.find('<STR_LIT:\n>', span[<NUM_LIT:1>])<EOL>substr = loophead[span[<NUM_LIT:1>]:endline]<EOL>ex_names = exclude_vars_re.findall(substr)<EOL>excludes.append(dict(ex_names))<EOL><DEDENT>dlist = []<EOL>if nsub is None :<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>for i in range(nsub) :<EOL><INDENT>tmp = {}<EOL>for name, vals in names :<EOL><INDENT>tmp[name] = vals[i]<EOL><DEDENT>dlist.append(tmp)<EOL><DEDENT>return dlist<EOL>

Find all named replacements in the header

    Returns a list of dictionaries, one for each loop iteration,
    where each key is a name to be substituted and the corresponding
    value is the replacement string.

    Also return a list of exclusions.  The exclusions are dictionaries
     of key value pairs. There can be more than one exclusion.
     [{'var1':'value1', 'var2', 'value2'[,...]}, ...]


if os.path.isdir(file):<EOL><INDENT>print(file, "<STR_LIT>")<EOL>return<EOL><DEDENT>data = open(file, "<STR_LIT:rb>").read()<EOL>if '<STR_LIT>' in data:<EOL><INDENT>print(file, "<STR_LIT>")<EOL>return<EOL><DEDENT>newdata = re.sub("<STR_LIT:\r\n>", "<STR_LIT:\n>", data)<EOL>if newdata != data:<EOL><INDENT>print('<STR_LIT>', file)<EOL>f = open(file, "<STR_LIT:wb>")<EOL>f.write(newdata)<EOL>f.close()<EOL>return file<EOL><DEDENT>else:<EOL><INDENT>print(file, '<STR_LIT>')<EOL><DEDENT>

Replace CRLF with LF in argument files.  Print names of changed files.


if os.path.isdir(file):<EOL><INDENT>print(file, "<STR_LIT>")<EOL>return<EOL><DEDENT>data = open(file, "<STR_LIT:rb>").read()<EOL>if '<STR_LIT>' in data:<EOL><INDENT>print(file, "<STR_LIT>")<EOL>return<EOL><DEDENT>newdata = re.sub("<STR_LIT:\r\n>", "<STR_LIT:\n>", data)<EOL>newdata = re.sub("<STR_LIT:\n>", "<STR_LIT:\r\n>", newdata)<EOL>if newdata != data:<EOL><INDENT>print('<STR_LIT>', file)<EOL>f = open(file, "<STR_LIT:wb>")<EOL>f.write(newdata)<EOL>f.close()<EOL>return file<EOL><DEDENT>else:<EOL><INDENT>print(file, '<STR_LIT>')<EOL><DEDENT>

Replace LF with CRLF in argument files.  Print names of changed files.


def CCompiler_spawn(self, cmd, display=None):

if display is None:<EOL><INDENT>display = cmd<EOL>if is_sequence(display):<EOL><INDENT>display = '<STR_LIT:U+0020>'.join(list(display))<EOL><DEDENT><DEDENT>log.info(display)<EOL>s, o = exec_command(cmd)<EOL>if s:<EOL><INDENT>if is_sequence(cmd):<EOL><INDENT>cmd = '<STR_LIT:U+0020>'.join(list(cmd))<EOL><DEDENT>try:<EOL><INDENT>print(o)<EOL><DEDENT>except UnicodeError:<EOL><INDENT>pass<EOL><DEDENT>if re.search('<STR_LIT>', o):<EOL><INDENT>msg = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>msg = '<STR_LIT>'<EOL><DEDENT>raise DistutilsExecError('<STR_LIT>' % (cmd, s, msg))<EOL><DEDENT>

Execute a command in a sub-process.

Parameters
----------
cmd : str
    The command to execute.
display : str or sequence of str, optional
    The text to add to the log file kept by `numpy.distutils`.
    If not given, `display` is equal to `cmd`.

Returns
-------
None

Raises
------
DistutilsExecError
    If the command failed, i.e. the exit status was not 0.


def CCompiler_object_filenames(self, source_filenames, strip_dir=<NUM_LIT:0>, output_dir='<STR_LIT>'):

if output_dir is None:<EOL><INDENT>output_dir = '<STR_LIT>'<EOL><DEDENT>obj_names = []<EOL>for src_name in source_filenames:<EOL><INDENT>base, ext = os.path.splitext(os.path.normpath(src_name))<EOL>base = os.path.splitdrive(base)[<NUM_LIT:1>] <EOL>base = base[os.path.isabs(base):]  <EOL>if base.startswith('<STR_LIT:..>'):<EOL><INDENT>i = base.rfind('<STR_LIT:..>')+<NUM_LIT:2><EOL>d = base[:i]<EOL>d = os.path.basename(os.path.abspath(d))<EOL>base = d + base[i:]<EOL><DEDENT>if ext not in self.src_extensions:<EOL><INDENT>raise UnknownFileError("<STR_LIT>" % (ext, src_name))<EOL><DEDENT>if strip_dir:<EOL><INDENT>base = os.path.basename(base)<EOL><DEDENT>obj_name = os.path.join(output_dir, base + self.obj_extension)<EOL>obj_names.append(obj_name)<EOL><DEDENT>return obj_names<EOL>

Return the name of the object files for the given source files.

Parameters
----------
source_filenames : list of str
    The list of paths to source files. Paths can be either relative or
    absolute, this is handled transparently.
strip_dir : bool, optional
    Whether to strip the directory from the returned paths. If True,
    the file name prepended by `output_dir` is returned. Default is False.
output_dir : str, optional
    If given, this path is prepended to the returned paths to the
    object files.

Returns
-------
obj_names : list of str
    The list of paths to the object files corresponding to the source
    files in `source_filenames`.


def CCompiler_compile(self, sources, output_dir=None, macros=None,<EOL>include_dirs=None, debug=<NUM_LIT:0>, extra_preargs=None,<EOL>extra_postargs=None, depends=None):

<EOL>if not sources:<EOL><INDENT>return []<EOL><DEDENT>if sys.version_info[<NUM_LIT:0>] < <NUM_LIT:3>:<EOL><INDENT>from .fcompiler import FCompiler<EOL><DEDENT>else:<EOL><INDENT>from numpy.distutils.fcompiler import FCompiler<EOL><DEDENT>if isinstance(self, FCompiler):<EOL><INDENT>display = []<EOL>for fc in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>fcomp = getattr(self, '<STR_LIT>'+fc)<EOL>if fcomp is None:<EOL><INDENT>continue<EOL><DEDENT>display.append("<STR_LIT>" % (fc, '<STR_LIT:U+0020>'.join(fcomp)))<EOL><DEDENT>display = '<STR_LIT:\n>'.join(display)<EOL><DEDENT>else:<EOL><INDENT>ccomp = self.compiler_so<EOL>display = "<STR_LIT>" % ('<STR_LIT:U+0020>'.join(ccomp),)<EOL><DEDENT>log.info(display)<EOL>macros, objects, extra_postargs, pp_opts, build =self._setup_compile(output_dir, macros, include_dirs, sources,<EOL>depends, extra_postargs)<EOL>cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)<EOL>display = "<STR_LIT>" % ('<STR_LIT:U+0020>'.join(cc_args))<EOL>if extra_postargs:<EOL><INDENT>display += "<STR_LIT>" % ('<STR_LIT:U+0020>'.join(extra_postargs))<EOL><DEDENT>log.info(display)<EOL>if isinstance(self, FCompiler):<EOL><INDENT>objects_to_build = list(build.keys())<EOL>for obj in objects:<EOL><INDENT>if obj in objects_to_build:<EOL><INDENT>src, ext = build[obj]<EOL>if self.compiler_type=='<STR_LIT>':<EOL><INDENT>obj = cyg2win32(obj)<EOL>src = cyg2win32(src)<EOL><DEDENT>self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for obj, (src, ext) in build.items():<EOL><INDENT>self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)<EOL><DEDENT><DEDENT>return objects<EOL>

Compile one or more source files.

Please refer to the Python distutils API reference for more details.

Parameters
----------
sources : list of str
    A list of filenames
output_dir : str, optional
    Path to the output directory.
macros : list of tuples
    A list of macro definitions.
include_dirs : list of str, optional
    The directories to add to the default include file search path for
    this compilation only.
debug : bool, optional
    Whether or not to output debug symbols in or alongside the object
    file(s).
extra_preargs, extra_postargs : ?
    Extra pre- and post-arguments.
depends : list of str, optional
    A list of file names that all targets depend on.

Returns
-------
objects : list of str
    A list of object file names, one per source file `sources`.

Raises
------
CompileError
    If compilation fails.


def CCompiler_customize_cmd(self, cmd, ignore=()):

log.info('<STR_LIT>' % (self.__class__.__name__,<EOL>cmd.__class__.__name__))<EOL>def allow(attr):<EOL><INDENT>return getattr(cmd, attr, None) is not None and attr not in ignore<EOL><DEDENT>if allow('<STR_LIT>'):<EOL><INDENT>self.set_include_dirs(cmd.include_dirs)<EOL><DEDENT>if allow('<STR_LIT>'):<EOL><INDENT>for (name, value) in cmd.define:<EOL><INDENT>self.define_macro(name, value)<EOL><DEDENT><DEDENT>if allow('<STR_LIT>'):<EOL><INDENT>for macro in cmd.undef:<EOL><INDENT>self.undefine_macro(macro)<EOL><DEDENT><DEDENT>if allow('<STR_LIT>'):<EOL><INDENT>self.set_libraries(self.libraries + cmd.libraries)<EOL><DEDENT>if allow('<STR_LIT>'):<EOL><INDENT>self.set_library_dirs(self.library_dirs + cmd.library_dirs)<EOL><DEDENT>if allow('<STR_LIT>'):<EOL><INDENT>self.set_runtime_library_dirs(cmd.rpath)<EOL><DEDENT>if allow('<STR_LIT>'):<EOL><INDENT>self.set_link_objects(cmd.link_objects)<EOL><DEDENT>

Customize compiler using distutils command.

Parameters
----------
cmd : class instance
    An instance inheriting from `distutils.cmd.Command`.
ignore : sequence of str, optional
    List of `CCompiler` commands (without ``'set_'``) that should not be
    altered. Strings that are checked for are:
    ``('include_dirs', 'define', 'undef', 'libraries', 'library_dirs',
    'rpath', 'link_objects')``.

Returns
-------
None


if <NUM_LIT:0>:<EOL><INDENT>for attrname in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>attr = getattr(self, attrname, None)<EOL>if not attr:<EOL><INDENT>continue<EOL><DEDENT>log.info("<STR_LIT>" % (attrname, attr))<EOL><DEDENT><DEDENT>try:<EOL><INDENT>self.get_version()<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>if log._global_log.threshold<<NUM_LIT:2>:<EOL><INDENT>print('<STR_LIT:*>'*<NUM_LIT>)<EOL>print(self.__class__)<EOL>print(_compiler_to_string(self))<EOL>print('<STR_LIT:*>'*<NUM_LIT>)<EOL><DEDENT>

Print the compiler customizations to stdout.

Parameters
----------
None

Returns
-------
None

Notes
-----
Printing is only done if the distutils log threshold is < 2.


def CCompiler_customize(self, dist, need_cxx=<NUM_LIT:0>):

<EOL>log.info('<STR_LIT>' % (self.__class__.__name__))<EOL>customize_compiler(self)<EOL>if need_cxx:<EOL><INDENT>try:<EOL><INDENT>self.compiler_so.remove('<STR_LIT>')<EOL><DEDENT>except (AttributeError, ValueError):<EOL><INDENT>pass<EOL><DEDENT>if hasattr(self, '<STR_LIT>') and '<STR_LIT>' in self.compiler[<NUM_LIT:0>]:<EOL><INDENT>if not self.compiler_cxx:<EOL><INDENT>if self.compiler[<NUM_LIT:0>].startswith('<STR_LIT>'):<EOL><INDENT>a, b = '<STR_LIT>', '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>a, b = '<STR_LIT>', '<STR_LIT>'<EOL><DEDENT>self.compiler_cxx = [self.compiler[<NUM_LIT:0>].replace(a, b)]+ self.compiler[<NUM_LIT:1>:]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if hasattr(self, '<STR_LIT>'):<EOL><INDENT>log.warn("<STR_LIT>" % (self.compiler,))<EOL><DEDENT>log.warn('<STR_LIT>'+self.__class__.__name__)<EOL><DEDENT><DEDENT>return<EOL>

Do any platform-specific customization of a compiler instance.

This method calls `distutils.sysconfig.customize_compiler` for
platform-specific customization, as well as optionally remove a flag
to suppress spurious warnings in case C++ code is being compiled.

Parameters
----------
dist : object
    This parameter is not used for anything.
need_cxx : bool, optional
    Whether or not C++ has to be compiled. If so (True), the
    ``"-Wstrict-prototypes"`` option is removed to prevent spurious
    warnings. Default is False.

Returns
-------
None

Notes
-----
All the default options used by distutils can be extracted with::

  from distutils import sysconfig
  sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS',
                            'CCSHARED', 'LDSHARED', 'SO')


def simple_version_match(pat=r'<STR_LIT>', ignore='<STR_LIT>', start='<STR_LIT>'):

def matcher(self, version_string):<EOL><INDENT>version_string = version_string.replace('<STR_LIT:\n>', '<STR_LIT:U+0020>')<EOL>pos = <NUM_LIT:0><EOL>if start:<EOL><INDENT>m = re.match(start, version_string)<EOL>if not m:<EOL><INDENT>return None<EOL><DEDENT>pos = m.end()<EOL><DEDENT>while True:<EOL><INDENT>m = re.search(pat, version_string[pos:])<EOL>if not m:<EOL><INDENT>return None<EOL><DEDENT>if ignore and re.match(ignore, m.group(<NUM_LIT:0>)):<EOL><INDENT>pos = m.end()<EOL>continue<EOL><DEDENT>break<EOL><DEDENT>return m.group(<NUM_LIT:0>)<EOL><DEDENT>return matcher<EOL>

Simple matching of version numbers, for use in CCompiler and FCompiler.

Parameters
----------
pat : str, optional
    A regular expression matching version numbers.
    Default is ``r'[-.\\d]+'``.
ignore : str, optional
    A regular expression matching patterns to skip.
    Default is ``''``, in which case nothing is skipped.
start : str, optional
    A regular expression matching the start of where to start looking
    for version numbers.
    Default is ``''``, in which case searching is started at the
    beginning of the version string given to `matcher`.

Returns
-------
matcher : callable
    A function that is appropriate to use as the ``.version_match``
    attribute of a `CCompiler` class. `matcher` takes a single parameter,
    a version string.


def CCompiler_get_version(self, force=False, ok_status=[<NUM_LIT:0>]):

if not force and hasattr(self, '<STR_LIT:version>'):<EOL><INDENT>return self.version<EOL><DEDENT>self.find_executables()<EOL>try:<EOL><INDENT>version_cmd = self.version_cmd<EOL><DEDENT>except AttributeError:<EOL><INDENT>return None<EOL><DEDENT>if not version_cmd or not version_cmd[<NUM_LIT:0>]:<EOL><INDENT>return None<EOL><DEDENT>try:<EOL><INDENT>matcher = self.version_match<EOL><DEDENT>except AttributeError:<EOL><INDENT>try:<EOL><INDENT>pat = self.version_pattern<EOL><DEDENT>except AttributeError:<EOL><INDENT>return None<EOL><DEDENT>def matcher(version_string):<EOL><INDENT>m = re.match(pat, version_string)<EOL>if not m:<EOL><INDENT>return None<EOL><DEDENT>version = m.group('<STR_LIT:version>')<EOL>return version<EOL><DEDENT><DEDENT>status, output = exec_command(version_cmd, use_tee=<NUM_LIT:0>)<EOL>version = None<EOL>if status in ok_status:<EOL><INDENT>version = matcher(output)<EOL>if version:<EOL><INDENT>version = LooseVersion(version)<EOL><DEDENT><DEDENT>self.version = version<EOL>return version<EOL>

Return compiler version, or None if compiler is not available.

Parameters
----------
force : bool, optional
    If True, force a new determination of the version, even if the
    compiler already has a version attribute. Default is False.
ok_status : list of int, optional
    The list of status values returned by the version look-up process
    for which a version string is returned. If the status value is not
    in `ok_status`, None is returned. Default is ``[0]``.

Returns
-------
version : str or None
    Version string, in the format of `distutils.version.LooseVersion`.


if self.compiler_type=='<STR_LIT>': return self<EOL>cxx = copy(self)<EOL>cxx.compiler_so = [cxx.compiler_cxx[<NUM_LIT:0>]] + cxx.compiler_so[<NUM_LIT:1>:]<EOL>if sys.platform.startswith('<STR_LIT>') and '<STR_LIT>' in cxx.linker_so[<NUM_LIT:0>]:<EOL><INDENT>cxx.linker_so = [cxx.linker_so[<NUM_LIT:0>], cxx.compiler_cxx[<NUM_LIT:0>]]+ cxx.linker_so[<NUM_LIT:2>:]<EOL><DEDENT>else:<EOL><INDENT>cxx.linker_so = [cxx.compiler_cxx[<NUM_LIT:0>]] + cxx.linker_so[<NUM_LIT:1>:]<EOL><DEDENT>return cxx<EOL>

Return the C++ compiler.

Parameters
----------
None

Returns
-------
cxx : class instance
    The C++ compiler, as a `CCompiler` instance.


if WARN >= self.threshold:<EOL><INDENT>if args:<EOL><INDENT>print(green_text(msg % _fix_args(args)))<EOL><DEDENT>else:<EOL><INDENT>print(green_text(msg))<EOL><DEDENT>sys.stdout.flush()<EOL><DEDENT>

If we log WARN messages, log this message as a 'nice' anti-warn
message.


from glob import glob<EOL>global fcompiler_class, fcompiler_aliases<EOL>if fcompiler_class is not None:<EOL><INDENT>return<EOL><DEDENT>pys = os.path.join(os.path.dirname(__file__), '<STR_LIT>')<EOL>fcompiler_class = {}<EOL>fcompiler_aliases = {}<EOL>for fname in glob(pys):<EOL><INDENT>module_name, ext = os.path.splitext(os.path.basename(fname))<EOL>module_name = '<STR_LIT>' + module_name<EOL>__import__ (module_name)<EOL>module = sys.modules[module_name]<EOL>if hasattr(module, '<STR_LIT>'):<EOL><INDENT>for cname in module.compilers:<EOL><INDENT>klass = getattr(module, cname)<EOL>desc = (klass.compiler_type, klass, klass.description)<EOL>fcompiler_class[klass.compiler_type] = desc<EOL>for alias in klass.compiler_aliases:<EOL><INDENT>if alias in fcompiler_aliases:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>% (alias, klass.__name__,<EOL>fcompiler_aliases[alias][<NUM_LIT:1>].__name__))<EOL><DEDENT>fcompiler_aliases[alias] = desc<EOL><DEDENT><DEDENT><DEDENT><DEDENT>

Cache all the FCompiler classes found in modules in the
    numpy.distutils.fcompiler package.


def get_default_fcompiler(osname=None, platform=None, requiref90=False,<EOL>c_compiler=None):

matching_compiler_types = available_fcompilers_for_platform(osname,<EOL>platform)<EOL>compiler_type =  _find_existing_fcompiler(matching_compiler_types,<EOL>osname=osname,<EOL>platform=platform,<EOL>requiref90=requiref90,<EOL>c_compiler=c_compiler)<EOL>return compiler_type<EOL>

Determine the default Fortran compiler to use for the given
    platform.


global failed_fcompilers<EOL>fcompiler_key = (plat, compiler)<EOL>if fcompiler_key in failed_fcompilers:<EOL><INDENT>return None<EOL><DEDENT>load_all_fcompiler_classes()<EOL>if plat is None:<EOL><INDENT>plat = os.name<EOL><DEDENT>if compiler is None:<EOL><INDENT>compiler = get_default_fcompiler(plat, requiref90=requiref90,<EOL>c_compiler=c_compiler)<EOL><DEDENT>if compiler in fcompiler_class:<EOL><INDENT>module_name, klass, long_description = fcompiler_class[compiler]<EOL><DEDENT>elif compiler in fcompiler_aliases:<EOL><INDENT>module_name, klass, long_description = fcompiler_aliases[compiler]<EOL><DEDENT>else:<EOL><INDENT>msg = "<STR_LIT>" % plat<EOL>if compiler is not None:<EOL><INDENT>msg = msg + "<STR_LIT>" % compiler<EOL>msg = msg + "<STR_LIT>"% ('<STR_LIT:U+002C>'.join(fcompiler_class.keys()))<EOL><DEDENT>log.warn(msg)<EOL>failed_fcompilers.add(fcompiler_key)<EOL>return None<EOL><DEDENT>compiler = klass(verbose=verbose, dry_run=dry_run, force=force)<EOL>compiler.c_compiler = c_compiler<EOL>return compiler<EOL>

Generate an instance of some FCompiler subclass for the supplied
    platform/compiler combination.


if dist is None:<EOL><INDENT>from distutils.dist import Distribution<EOL>from numpy.distutils.command.config_compiler import config_fc<EOL>dist = Distribution()<EOL>dist.script_name = os.path.basename(sys.argv[<NUM_LIT:0>])<EOL>dist.script_args = ['<STR_LIT>'] + sys.argv[<NUM_LIT:1>:]<EOL>try:<EOL><INDENT>dist.script_args.remove('<STR_LIT>')<EOL><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT>dist.cmdclass['<STR_LIT>'] = config_fc<EOL>dist.parse_config_files()<EOL>dist.parse_command_line()<EOL><DEDENT>compilers = []<EOL>compilers_na = []<EOL>compilers_ni = []<EOL>if not fcompiler_class:<EOL><INDENT>load_all_fcompiler_classes()<EOL><DEDENT>platform_compilers = available_fcompilers_for_platform()<EOL>for compiler in platform_compilers:<EOL><INDENT>v = None<EOL>log.set_verbosity(-<NUM_LIT:2>)<EOL>try:<EOL><INDENT>c = new_fcompiler(compiler=compiler, verbose=dist.verbose)<EOL>c.customize(dist)<EOL>v = c.get_version()<EOL><DEDENT>except (DistutilsModuleError, CompilerNotFound):<EOL><INDENT>e = get_exception()<EOL>log.debug("<STR_LIT>" % (compiler,))<EOL>log.debug(repr(e))<EOL><DEDENT>if v is None:<EOL><INDENT>compilers_na.append(("<STR_LIT>"+compiler, None,<EOL>fcompiler_class[compiler][<NUM_LIT:2>]))<EOL><DEDENT>else:<EOL><INDENT>c.dump_properties()<EOL>compilers.append(("<STR_LIT>"+compiler, None,<EOL>fcompiler_class[compiler][<NUM_LIT:2>] + '<STR_LIT>' % v))<EOL><DEDENT><DEDENT>compilers_ni = list(set(fcompiler_class.keys()) - set(platform_compilers))<EOL>compilers_ni = [("<STR_LIT>"+fc, None, fcompiler_class[fc][<NUM_LIT:2>])<EOL>for fc in compilers_ni]<EOL>compilers.sort()<EOL>compilers_na.sort()<EOL>compilers_ni.sort()<EOL>pretty_printer = FancyGetopt(compilers)<EOL>pretty_printer.print_help("<STR_LIT>")<EOL>pretty_printer = FancyGetopt(compilers_na)<EOL>pretty_printer.print_help("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>if compilers_ni:<EOL><INDENT>pretty_printer = FancyGetopt(compilers_ni)<EOL>pretty_printer.print_help("<STR_LIT>")<EOL><DEDENT>print("<STR_LIT>")<EOL>

Print list of available compilers (used by the "--help-fcompiler"
    option to "config_fc").


<EOL>result = <NUM_LIT:0><EOL>f = open_latin1(file, '<STR_LIT:r>')<EOL>line = f.readline()<EOL>n = <NUM_LIT> <EOL>if _has_f_header(line):<EOL><INDENT>n = <NUM_LIT:0><EOL><DEDENT>elif _has_f90_header(line):<EOL><INDENT>n = <NUM_LIT:0><EOL>result = <NUM_LIT:1><EOL><DEDENT>while n><NUM_LIT:0> and line:<EOL><INDENT>line = line.rstrip()<EOL>if line and line[<NUM_LIT:0>]!='<STR_LIT:!>':<EOL><INDENT>n -= <NUM_LIT:1><EOL>if (line[<NUM_LIT:0>]!='<STR_LIT:\t>' and _free_f90_start(line[:<NUM_LIT:5>])) or line[-<NUM_LIT:1>:]=='<STR_LIT:&>':<EOL><INDENT>result = <NUM_LIT:1><EOL>break<EOL><DEDENT><DEDENT>line = f.readline()<EOL><DEDENT>f.close()<EOL>return result<EOL>

Check if file is in free format Fortran.


flags = {}<EOL>f = open_latin1(src, '<STR_LIT:r>')<EOL>i = <NUM_LIT:0><EOL>for line in f:<EOL><INDENT>i += <NUM_LIT:1><EOL>if i><NUM_LIT:20>: break<EOL>m = _f77flags_re.match(line)<EOL>if not m: continue<EOL>fcname = m.group('<STR_LIT>').strip()<EOL>fflags = m.group('<STR_LIT>').strip()<EOL>flags[fcname] = split_quoted(fflags)<EOL><DEDENT>f.close()<EOL>return flags<EOL>

Search the first 20 lines of fortran 77 code for line pattern
  `CF77FLAGS(<fcompiler type>)=<f77 flags>`
Return a dictionary {<fcompiler type>:<f77 flags>}.


assert self._is_customised<EOL>exe_cache = self._exe_cache<EOL>def cached_find_executable(exe):<EOL><INDENT>if exe in exe_cache:<EOL><INDENT>return exe_cache[exe]<EOL><DEDENT>fc_exe = find_executable(exe)<EOL>exe_cache[exe] = exe_cache[fc_exe] = fc_exe<EOL>return fc_exe<EOL><DEDENT>def verify_command_form(name, value):<EOL><INDENT>if value is not None and not is_sequence_of_strings(value):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>" %<EOL>(name, value, self.__class__.__name__))<EOL><DEDENT><DEDENT>def set_exe(exe_key, f77=None, f90=None):<EOL><INDENT>cmd = self.executables.get(exe_key, None)<EOL>if not cmd:<EOL><INDENT>return None<EOL><DEDENT>exe_from_environ = getattr(self.command_vars, exe_key)<EOL>if not exe_from_environ:<EOL><INDENT>possibles = [f90, f77] + self.possible_executables<EOL><DEDENT>else:<EOL><INDENT>possibles = [exe_from_environ] + self.possible_executables<EOL><DEDENT>seen = set()<EOL>unique_possibles = []<EOL>for e in possibles:<EOL><INDENT>if e == '<STR_LIT>':<EOL><INDENT>e = f77<EOL><DEDENT>elif e == '<STR_LIT>':<EOL><INDENT>e = f90<EOL><DEDENT>if not e or e in seen:<EOL><INDENT>continue<EOL><DEDENT>seen.add(e)<EOL>unique_possibles.append(e)<EOL><DEDENT>for exe in unique_possibles:<EOL><INDENT>fc_exe = cached_find_executable(exe)<EOL>if fc_exe:<EOL><INDENT>cmd[<NUM_LIT:0>] = fc_exe<EOL>return fc_exe<EOL><DEDENT><DEDENT>self.set_command(exe_key, None)<EOL>return None<EOL><DEDENT>ctype = self.compiler_type<EOL>f90 = set_exe('<STR_LIT>')<EOL>if not f90:<EOL><INDENT>f77 = set_exe('<STR_LIT>')<EOL>if f77:<EOL><INDENT>log.warn('<STR_LIT>' % ctype)<EOL><DEDENT>else:<EOL><INDENT>raise CompilerNotFound('<STR_LIT>' % ctype)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>f77 = set_exe('<STR_LIT>', f90=f90)<EOL>if not f77:<EOL><INDENT>log.warn('<STR_LIT>' % ctype)<EOL><DEDENT>set_exe('<STR_LIT>', f90=f90)<EOL><DEDENT>set_exe('<STR_LIT>', f77=f77, f90=f90)<EOL>set_exe('<STR_LIT>', f77=f77, f90=f90)<EOL>set_exe('<STR_LIT>', f77=f77, f90=f90)<EOL>set_exe('<STR_LIT>')<EOL>set_exe('<STR_LIT>')<EOL>

Go through the self.executables dictionary, and attempt to
        find and assign appropiate executables.

        Executable names are looked for in the environment (environment
        variables, the distutils.cfg, and command line), the 0th-element of
        the command list, and the self.possible_executables list.

        Also, if the 0th element is "<F77>" or "<F90>", the Fortran 77
        or the Fortran 90 compiler executable is used, unless overridden
        by an environment setting.

        Subclasses should call this if overriden.


pass<EOL>

Called at the beginning of customisation. Subclasses should
        override this if they need to set up the executables dictionary.

        Note that self.find_executables() is run afterwards, so the
        self.executables dictionary values can contain <F77> or <F90> as
        the command, which will be replaced by the found F77 or F90
        compiler.


return [] + self.pic_flags<EOL>

List of flags common to all compiler types.


return self._get_command_flags('<STR_LIT>')<EOL>


return []<EOL>

List of Fortran 90 free format specific flags.


List of Fortran 90 fixed format specific flags.


List of linker flags to build a shared library.


List of linker flags to build an executable.


return []<EOL>

List of architecture independent compiler flags.


return []<EOL>

List of architecture dependent compiler flags.


return []<EOL>

List of compiler flags to compile with debugging information.


return self.libraries[:]<EOL>


return self.library_dirs[:]<EOL>


log.info('<STR_LIT>' % (self.__class__.__name__))<EOL>self._is_customised = True<EOL>self.distutils_vars.use_distribution(dist)<EOL>self.command_vars.use_distribution(dist)<EOL>self.flag_vars.use_distribution(dist)<EOL>self.update_executables()<EOL>self.find_executables()<EOL>noopt = self.distutils_vars.get('<STR_LIT>', False)<EOL>noarch = self.distutils_vars.get('<STR_LIT>', noopt)<EOL>debug = self.distutils_vars.get('<STR_LIT>', False)<EOL>f77 = self.command_vars.compiler_f77<EOL>f90 = self.command_vars.compiler_f90<EOL>f77flags = []<EOL>f90flags = []<EOL>freeflags = []<EOL>fixflags = []<EOL>if f77:<EOL><INDENT>f77flags = self.flag_vars.f77<EOL><DEDENT>if f90:<EOL><INDENT>f90flags = self.flag_vars.f90<EOL>freeflags = self.flag_vars.free<EOL><DEDENT>fix = self.command_vars.compiler_fix<EOL>if fix:<EOL><INDENT>fixflags = self.flag_vars.fix + f90flags<EOL><DEDENT>oflags, aflags, dflags = [], [], []<EOL>def get_flags(tag, flags):<EOL><INDENT>flags.extend(getattr(self.flag_vars, tag))<EOL>this_get = getattr(self, '<STR_LIT>' + tag)<EOL>for name, c, flagvar in [('<STR_LIT>', f77, f77flags),<EOL>('<STR_LIT>', f90, f90flags),<EOL>('<STR_LIT>', fix, fixflags)]:<EOL><INDENT>t = '<STR_LIT>' % (tag, name)<EOL>if c and this_get is not getattr(self, '<STR_LIT>' + t):<EOL><INDENT>flagvar.extend(getattr(self.flag_vars, t))<EOL><DEDENT><DEDENT><DEDENT>if not noopt:<EOL><INDENT>get_flags('<STR_LIT>', oflags)<EOL>if not noarch:<EOL><INDENT>get_flags('<STR_LIT>', aflags)<EOL><DEDENT><DEDENT>if debug:<EOL><INDENT>get_flags('<STR_LIT>', dflags)<EOL><DEDENT>fflags = self.flag_vars.flags + dflags + oflags + aflags<EOL>if f77:<EOL><INDENT>self.set_commands(compiler_f77=[f77]+f77flags+fflags)<EOL><DEDENT>if f90:<EOL><INDENT>self.set_commands(compiler_f90=[f90]+freeflags+f90flags+fflags)<EOL><DEDENT>if fix:<EOL><INDENT>self.set_commands(compiler_fix=[fix]+fixflags+fflags)<EOL><DEDENT>linker_so = self.linker_so<EOL>if linker_so:<EOL><INDENT>linker_so_flags = self.flag_vars.linker_so<EOL>if sys.platform.startswith('<STR_LIT>'):<EOL><INDENT>python_lib = get_python_lib(standard_lib=<NUM_LIT:1>)<EOL>ld_so_aix = os.path.join(python_lib, '<STR_LIT>', '<STR_LIT>')<EOL>python_exp = os.path.join(python_lib, '<STR_LIT>', '<STR_LIT>')<EOL>linker_so = [ld_so_aix] + linker_so + ['<STR_LIT>'+python_exp]<EOL><DEDENT>self.set_commands(linker_so=linker_so+linker_so_flags)<EOL><DEDENT>linker_exe = self.linker_exe<EOL>if linker_exe:<EOL><INDENT>linker_exe_flags = self.flag_vars.linker_exe<EOL>self.set_commands(linker_exe=linker_exe+linker_exe_flags)<EOL><DEDENT>ar = self.command_vars.archiver<EOL>if ar:<EOL><INDENT>arflags = self.flag_vars.ar<EOL>self.set_commands(archiver=[ar]+arflags)<EOL><DEDENT>self.set_library_dirs(self.get_library_dirs())<EOL>self.set_libraries(self.get_libraries())<EOL>

Customize Fortran compiler.

        This method gets Fortran compiler specific information from
        (i) class definition, (ii) environment, (iii) distutils config
        files, and (iv) command line (later overrides earlier).

        This method should be always called after constructing a
        compiler instance. But not in __init__ because Distribution
        instance is needed for (iii) and (iv).


props = []<EOL>for key in list(self.executables.keys()) +['<STR_LIT:version>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>if hasattr(self, key):<EOL><INDENT>v = getattr(self, key)<EOL>props.append((key, None, '<STR_LIT>'+repr(v)))<EOL><DEDENT><DEDENT>props.sort()<EOL>pretty_printer = FancyGetopt(props)<EOL>for l in pretty_printer.generate_help("<STR_LIT>"% (self.__class__.__name__)):<EOL><INDENT>if l[:<NUM_LIT:4>]=='<STR_LIT>':<EOL><INDENT>l = '<STR_LIT:U+0020>' + l[<NUM_LIT:4>:]<EOL><DEDENT>print(l)<EOL><DEDENT>

Print out the attributes of a compiler instance.


def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):

src_flags = {}<EOL>if is_f_file(src) and not has_f90_header(src):<EOL><INDENT>flavor = '<STR_LIT>'<EOL>compiler = self.compiler_f77<EOL>src_flags = get_f77flags(src)<EOL>extra_compile_args = self.extra_f77_compile_args or []<EOL><DEDENT>elif is_free_format(src):<EOL><INDENT>flavor = '<STR_LIT>'<EOL>compiler = self.compiler_f90<EOL>if compiler is None:<EOL><INDENT>raise DistutilsExecError('<STR_LIT>'% (self.__class__.__name__, src))<EOL><DEDENT>extra_compile_args = self.extra_f90_compile_args or []<EOL><DEDENT>else:<EOL><INDENT>flavor = '<STR_LIT>'<EOL>compiler = self.compiler_fix<EOL>if compiler is None:<EOL><INDENT>raise DistutilsExecError('<STR_LIT>'% (self.__class__.__name__, src))<EOL><DEDENT>extra_compile_args = self.extra_f90_compile_args or []<EOL><DEDENT>if self.object_switch[-<NUM_LIT:1>]=='<STR_LIT:U+0020>':<EOL><INDENT>o_args = [self.object_switch.strip(), obj]<EOL><DEDENT>else:<EOL><INDENT>o_args = [self.object_switch.strip()+obj]<EOL><DEDENT>assert self.compile_switch.strip()<EOL>s_args = [self.compile_switch, src]<EOL>if extra_compile_args:<EOL><INDENT>log.info('<STR_LIT>'% (flavor[<NUM_LIT:1>:], '<STR_LIT:U+0020>'.join(extra_compile_args)))<EOL><DEDENT>extra_flags = src_flags.get(self.compiler_type, [])<EOL>if extra_flags:<EOL><INDENT>log.info('<STR_LIT>'% '<STR_LIT:U+0020>'.join(extra_flags))<EOL><DEDENT>command = compiler + cc_args + extra_flags + s_args + o_args+ extra_postargs + extra_compile_args<EOL>display = '<STR_LIT>' % (os.path.basename(compiler[<NUM_LIT:0>]) + flavor,<EOL>src)<EOL>try:<EOL><INDENT>self.spawn(command, display=display)<EOL><DEDENT>except DistutilsExecError:<EOL><INDENT>msg = str(get_exception())<EOL>raise CompileError(msg)<EOL><DEDENT>


newcmd = cmd[:]<EOL>fid, filename = tempfile.mkstemp(suffix="<STR_LIT>")<EOL>try:<EOL><INDENT>d = os.path.dirname(filename)<EOL>output = os.path.splitext(filename)[<NUM_LIT:0>] + "<STR_LIT>"<EOL>try:<EOL><INDENT>newcmd.extend(["<STR_LIT>", arch, "<STR_LIT:-c>", filename])<EOL>p = Popen(newcmd, stderr=STDOUT, stdout=PIPE, cwd=d)<EOL>p.communicate()<EOL>return p.returncode == <NUM_LIT:0><EOL><DEDENT>finally:<EOL><INDENT>if os.path.exists(output):<EOL><INDENT>os.remove(output)<EOL><DEDENT><DEDENT><DEDENT>finally:<EOL><INDENT>os.remove(filename)<EOL><DEDENT>return False<EOL>

Return true is the command supports the -arch flag for the given
    architecture.


m = re.search(r'<STR_LIT>', version_string)<EOL>if not m:<EOL><INDENT>return None<EOL><DEDENT>m = re.search(r'<STR_LIT>', version_string)<EOL>if m:<EOL><INDENT>return ('<STR_LIT>', m.group(<NUM_LIT:1>))<EOL><DEDENT>m = re.search(r'<STR_LIT>', version_string)<EOL>if m:<EOL><INDENT>v = m.group(<NUM_LIT:1>)<EOL>if v.startswith('<STR_LIT:0>') or v.startswith('<STR_LIT:2>') or v.startswith('<STR_LIT:3>'):<EOL><INDENT>return ('<STR_LIT>', v)<EOL><DEDENT>else:<EOL><INDENT>return ('<STR_LIT>', v)<EOL><DEDENT><DEDENT>

Handle the different versions of GNU fortran compilers


from distutils import sysconfig<EOL>try:<EOL><INDENT>cflags = sysconfig.get_config_vars()['<STR_LIT>']<EOL><DEDENT>except KeyError:<EOL><INDENT>return []<EOL><DEDENT>arch_re = re.compile(r"<STR_LIT>")<EOL>arch_flags = []<EOL>for arch in arch_re.findall(cflags):<EOL><INDENT>arch_flags += ['<STR_LIT>', arch]<EOL><DEDENT>return arch_flags<EOL>


if not sys.platform == '<STR_LIT>':<EOL><INDENT>return []<EOL><DEDENT>arch_flags = []<EOL>c_archs = self._c_arch_flags()<EOL>if "<STR_LIT>" in c_archs:<EOL><INDENT>c_archs[c_archs.index("<STR_LIT>")] = "<STR_LIT>"<EOL><DEDENT>for arch in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>if _can_target(cmd, arch) and arch in c_archs:<EOL><INDENT>arch_flags.extend(["<STR_LIT>", arch])<EOL><DEDENT><DEDENT>return arch_flags<EOL>

Return a list of -arch flags for every supported architecture.


spanlist = []<EOL>ind = <NUM_LIT:0><EOL>while True:<EOL><INDENT>m = routine_start_re.search(astr, ind)<EOL>if m is None:<EOL><INDENT>break<EOL><DEDENT>start = m.start()<EOL>if function_start_re.match(astr, start, m.end()):<EOL><INDENT>while True:<EOL><INDENT>i = astr.rfind('<STR_LIT:\n>', ind, start)<EOL>if i==-<NUM_LIT:1>:<EOL><INDENT>break<EOL><DEDENT>start = i<EOL>if astr[i:i+<NUM_LIT:7>]!='<STR_LIT>':<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>start += <NUM_LIT:1><EOL>m = routine_end_re.search(astr, m.end())<EOL>ind = end = m and m.end()-<NUM_LIT:1> or len(astr)<EOL>spanlist.append((start, end))<EOL><DEDENT>return spanlist<EOL>

Return a list of tuples for each function or subroutine each
    tuple is the start and end of a subroutine or function to be
    expanded.


allkeys = list(adict.keys())<EOL>done = False<EOL>n = <NUM_LIT:1><EOL>while not done:<EOL><INDENT>newkey = '<STR_LIT>' % (n)<EOL>if newkey in allkeys:<EOL><INDENT>n += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>done = True<EOL><DEDENT><DEDENT>return newkey<EOL>


if bits not in (<NUM_LIT:32>, <NUM_LIT:64>):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if bits == <NUM_LIT:32>:<EOL><INDENT>return paths<EOL><DEDENT>out = []<EOL>for p in paths:<EOL><INDENT>out.extend([p + '<STR_LIT>', p])<EOL><DEDENT>return out<EOL>

Return a list of library paths valid on 32 or 64 bit systems.

    Inputs:
      paths : sequence
        A sequence of strings (typically paths)
      bits : int
        An integer, the only valid values are 32 or 64.  A ValueError exception
      is raised otherwise.

    Examples:

    Consider a list of directories
    >>> paths = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib']

    For a 32-bit platform, this is already valid:
    >>> np.distutils.system_info.libpaths(paths,32)
    ['/usr/X11R6/lib', '/usr/X11/lib', '/usr/lib']

    On 64 bits, we prepend the '64' postfix
    >>> np.distutils.system_info.libpaths(paths,64)
    ['/usr/X11R6/lib64', '/usr/X11R6/lib', '/usr/X11/lib64', '/usr/X11/lib',
    '/usr/lib64', '/usr/lib']


<EOL>filenames = []<EOL>try:<EOL><INDENT>f = __file__<EOL><DEDENT>except NameError:<EOL><INDENT>f = sys.argv[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>sysfile = os.path.join(os.path.split(os.path.abspath(f))[<NUM_LIT:0>],<EOL>fname)<EOL>if os.path.isfile(sysfile):<EOL><INDENT>filenames.append(sysfile)<EOL><DEDENT><DEDENT>try:<EOL><INDENT>f = os.path.expanduser('<STR_LIT>')<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>user_file = os.path.join(f, fname)<EOL>if os.path.isfile(user_file):<EOL><INDENT>filenames.append(user_file)<EOL><DEDENT><DEDENT>if os.path.isfile(fname):<EOL><INDENT>filenames.append(os.path.abspath(fname))<EOL><DEDENT>return filenames<EOL>

Returns a list of files named 'fname' from
    1) System-wide directory (directory-location of this module)
    2) Users HOME directory (os.environ['HOME'])
    3) Local directory


cl = {'<STR_LIT>': atlas_info,  <EOL>'<STR_LIT>': atlas_threads_info,                <EOL>'<STR_LIT>': atlas_blas_info,<EOL>'<STR_LIT>': atlas_blas_threads_info,<EOL>'<STR_LIT>': lapack_atlas_info,  <EOL>'<STR_LIT>': lapack_atlas_threads_info,  <EOL>'<STR_LIT>': atlas_3_10_info,  <EOL>'<STR_LIT>': atlas_3_10_threads_info,                <EOL>'<STR_LIT>': atlas_3_10_blas_info,<EOL>'<STR_LIT>': atlas_3_10_blas_threads_info,<EOL>'<STR_LIT>': lapack_atlas_3_10_info,  <EOL>'<STR_LIT>': lapack_atlas_3_10_threads_info,  <EOL>'<STR_LIT>': mkl_info,<EOL>'<STR_LIT>': openblas_info,          <EOL>'<STR_LIT>': openblas_lapack_info, <EOL>'<STR_LIT>': lapack_mkl_info,      <EOL>'<STR_LIT>': blas_mkl_info,          <EOL>'<STR_LIT>': x11_info,<EOL>'<STR_LIT>': fft_opt_info,<EOL>'<STR_LIT>': fftw_info,<EOL>'<STR_LIT>': fftw2_info,<EOL>'<STR_LIT>': fftw3_info,<EOL>'<STR_LIT>': dfftw_info,<EOL>'<STR_LIT>': sfftw_info,<EOL>'<STR_LIT>': fftw_threads_info,<EOL>'<STR_LIT>': dfftw_threads_info,<EOL>'<STR_LIT>': sfftw_threads_info,<EOL>'<STR_LIT>': djbfft_info,<EOL>'<STR_LIT>': blas_info,                  <EOL>'<STR_LIT>': lapack_info,              <EOL>'<STR_LIT>': lapack_src_info,<EOL>'<STR_LIT>': blas_src_info,<EOL>'<STR_LIT>': numpy_info,<EOL>'<STR_LIT>': f2py_info,<EOL>'<STR_LIT>': Numeric_info,<EOL>'<STR_LIT>': Numeric_info,<EOL>'<STR_LIT>': numarray_info,<EOL>'<STR_LIT>': numerix_info,<EOL>'<STR_LIT>': lapack_opt_info,<EOL>'<STR_LIT>': blas_opt_info,<EOL>'<STR_LIT>': boost_python_info,<EOL>'<STR_LIT>': agg2_info,<EOL>'<STR_LIT>': wx_info,<EOL>'<STR_LIT>': gdk_pixbuf_xlib_2_info,<EOL>'<STR_LIT>': gdk_pixbuf_xlib_2_info,<EOL>'<STR_LIT>': gdk_pixbuf_2_info,<EOL>'<STR_LIT>': gdk_pixbuf_2_info,<EOL>'<STR_LIT>': gdk_info,<EOL>'<STR_LIT>': gdk_2_info,<EOL>'<STR_LIT>': gdk_2_info,<EOL>'<STR_LIT>': gdk_x11_2_info,<EOL>'<STR_LIT>': gdk_x11_2_info,<EOL>'<STR_LIT>': gtkp_x11_2_info,<EOL>'<STR_LIT>': gtkp_x11_2_info,<EOL>'<STR_LIT>': gtkp_2_info,<EOL>'<STR_LIT>': gtkp_2_info,<EOL>'<STR_LIT>': xft_info,<EOL>'<STR_LIT>': freetype2_info,<EOL>'<STR_LIT>': umfpack_info,<EOL>'<STR_LIT>': amd_info,<EOL>}.get(name.lower(), system_info)<EOL>return cl().get_info(notfound_action)<EOL>

notfound_action:
  0 - do nothing
  1 - display warning message
  2 - raise error


r = []<EOL>for a in args:<EOL><INDENT>if not a:<EOL><INDENT>continue<EOL><DEDENT>if is_string(a):<EOL><INDENT>a = [a]<EOL><DEDENT>r.append(a)<EOL><DEDENT>args = r<EOL>if not args:<EOL><INDENT>return []<EOL><DEDENT>if len(args) == <NUM_LIT:1>:<EOL><INDENT>result = reduce(lambda a, b: a + b, map(glob, args[<NUM_LIT:0>]), [])<EOL><DEDENT>elif len(args) == <NUM_LIT:2>:<EOL><INDENT>result = []<EOL>for a0 in args[<NUM_LIT:0>]:<EOL><INDENT>for a1 in args[<NUM_LIT:1>]:<EOL><INDENT>result.extend(glob(os.path.join(a0, a1)))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>result = combine_paths(*(combine_paths(args[<NUM_LIT:0>], args[<NUM_LIT:1>]) + args[<NUM_LIT:2>:]))<EOL><DEDENT>verbosity = kws.get('<STR_LIT>', <NUM_LIT:1>)<EOL>log.debug('<STR_LIT>', '<STR_LIT:U+002C>'.join(result))<EOL>return result<EOL>

Return a list of existing paths composed by all combinations of
        items from arguments.


flag = <NUM_LIT:0><EOL>if not self.has_info():<EOL><INDENT>flag = <NUM_LIT:1><EOL>log.info(self.__class__.__name__ + '<STR_LIT::>')<EOL>if hasattr(self, '<STR_LIT>'):<EOL><INDENT>self.calc_info()<EOL><DEDENT>if notfound_action:<EOL><INDENT>if not self.has_info():<EOL><INDENT>if notfound_action == <NUM_LIT:1>:<EOL><INDENT>warnings.warn(self.notfounderror.__doc__)<EOL><DEDENT>elif notfound_action == <NUM_LIT:2>:<EOL><INDENT>raise self.notfounderror(self.notfounderror.__doc__)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(repr(notfound_action))<EOL><DEDENT><DEDENT><DEDENT>if not self.has_info():<EOL><INDENT>log.info('<STR_LIT>')<EOL>self.set_info()<EOL><DEDENT>else:<EOL><INDENT>log.info('<STR_LIT>')<EOL><DEDENT><DEDENT>res = self.saved_results.get(self.__class__.__name__)<EOL>if self.verbosity > <NUM_LIT:0> and flag:<EOL><INDENT>for k, v in res.items():<EOL><INDENT>v = str(v)<EOL>if k in ['<STR_LIT>', '<STR_LIT>'] and len(v) > <NUM_LIT>:<EOL><INDENT>v = v[:<NUM_LIT>] + '<STR_LIT>' + v[-<NUM_LIT>:]<EOL><DEDENT>log.info('<STR_LIT>', k, v)<EOL><DEDENT>log.info('<STR_LIT>')<EOL><DEDENT>return copy.deepcopy(res)<EOL>

Return a dictonary with items that are compatible
            with numpy.distutils.setup keyword arguments.


def check_libs(self, lib_dirs, libs, opt_libs=[]):

exts = self.library_extensions()<EOL>info = None<EOL>for ext in exts:<EOL><INDENT>info = self._check_libs(lib_dirs, libs, opt_libs, [ext])<EOL>if info is not None:<EOL><INDENT>break<EOL><DEDENT><DEDENT>if not info:<EOL><INDENT>log.info('<STR_LIT>', '<STR_LIT:U+002C>'.join(libs),<EOL>lib_dirs)<EOL><DEDENT>return info<EOL>

If static or shared libraries are available then return
        their info dictionary.

        Checks for all libraries as shared libraries first, then
        static (or vice versa if self.search_static_first is True).


def check_libs2(self, lib_dirs, libs, opt_libs=[]):

exts = self.library_extensions()<EOL>info = self._check_libs(lib_dirs, libs, opt_libs, exts)<EOL>if not info:<EOL><INDENT>log.info('<STR_LIT>', '<STR_LIT:U+002C>'.join(libs),<EOL>lib_dirs)<EOL><DEDENT>return info<EOL>

If static or shared libraries are available then return
        their info dictionary.

        Checks each library for shared or static.


def _check_libs(self, lib_dirs, libs, opt_libs, exts):

<EOL>if is_sequence(lib_dirs):<EOL><INDENT>found_libs, found_dirs = [], []<EOL>for dir_ in lib_dirs:<EOL><INDENT>found_libs1 = self._lib_list(dir_, libs, exts)<EOL>for found_lib in found_libs1:<EOL><INDENT>if found_lib not in found_libs:<EOL><INDENT>found_libs.append(found_lib)<EOL>if dir_ not in found_dirs:<EOL><INDENT>found_dirs.append(dir_)<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>found_libs = self._lib_list(lib_dirs, libs, exts)<EOL>found_dirs = [lib_dirs]<EOL><DEDENT>if len(found_libs) > <NUM_LIT:0> and len(found_libs) == len(libs):<EOL><INDENT>info = {'<STR_LIT>': found_libs, '<STR_LIT>': found_dirs}<EOL>if is_sequence(lib_dirs):<EOL><INDENT>for dir_ in lib_dirs:<EOL><INDENT>opt_found_libs = self._lib_list(dir_, opt_libs, exts)<EOL>if opt_found_libs:<EOL><INDENT>if dir_ not in found_dirs:<EOL><INDENT>found_dirs.extend(dir_)<EOL><DEDENT>found_libs.extend(opt_found_libs)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>opt_found_libs = self._lib_list(lib_dirs, opt_libs, exts)<EOL>if opt_found_libs:<EOL><INDENT>found_libs.extend(opt_found_libs)<EOL><DEDENT><DEDENT>return info<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>

Find mandatory and optional libs in expected paths.

        Missing optional libraries are silently forgotten.


return combine_paths(*args, **{'<STR_LIT>': self.verbosity})<EOL>

Return a list of existing paths composed by all combinations
        of items from the arguments.


lib_dirs = self.get_lib_dirs()<EOL>incl_dirs = self.get_include_dirs()<EOL>incl_dir = None<EOL>libs = self.get_libs(self.section + '<STR_LIT>', ver_param['<STR_LIT>'])<EOL>info = self.check_libs(lib_dirs, libs)<EOL>if info is not None:<EOL><INDENT>flag = <NUM_LIT:0><EOL>for d in incl_dirs:<EOL><INDENT>if len(self.combine_paths(d, ver_param['<STR_LIT>']))== len(ver_param['<STR_LIT>']):<EOL><INDENT>dict_append(info, include_dirs=[d])<EOL>flag = <NUM_LIT:1><EOL>incl_dirs = [d]<EOL>break<EOL><DEDENT><DEDENT>if flag:<EOL><INDENT>dict_append(info, define_macros=ver_param['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>info = None<EOL><DEDENT><DEDENT>if info is not None:<EOL><INDENT>self.set_info(**info)<EOL>return True<EOL><DEDENT>else:<EOL><INDENT>log.info('<STR_LIT>' % (ver_param['<STR_LIT:name>']))<EOL>return False<EOL><DEDENT>

Returns True on successful version detection, else False


def check_type(self, type_name, headers=None, include_dirs=None,<EOL>library_dirs=None):

self._check_compiler()<EOL>body =

Check type availability. Return True if the type can be compiled,
        False otherwise


def check_type_size(self, type_name, headers=None, include_dirs=None, library_dirs=None, expected=None):

self._check_compiler()<EOL>body = r"""<STR_LIT>"""<EOL>%(type)s npy_check_sizeof_type;<EOL><INDENT>()<EOL><DEDENT>ic int test_array [<NUM_LIT:1> - <NUM_LIT:2> *!(((long) (sizeof (npy_check_sizeof_type))) == %(size)s)];<EOL>_array [<NUM_LIT:0>] = <NUM_LIT:0><EOL>rn <NUM_LIT:0>;<EOL><INDENT>for size in expected:<EOL><INDENT>try:<EOL><INDENT>self._compile(body % {'<STR_LIT:type>': type_name, '<STR_LIT:size>': size},<EOL>headers, include_dirs, '<STR_LIT:c>')<EOL>self._clean()<EOL>return size<EOL><DEDENT>except CompileError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>body =


def check_funcs_once(self, funcs,<EOL>headers=None, include_dirs=None,<EOL>libraries=None, library_dirs=None,<EOL>decl=False, call=False, call_args=None):

self._check_compiler()<EOL>body = []<EOL>if decl:<EOL><INDENT>for f, v in decl.items():<EOL><INDENT>if v:<EOL><INDENT>body.append("<STR_LIT>" % f)<EOL><DEDENT><DEDENT><DEDENT>body.append("<STR_LIT>")<EOL>for func in funcs:<EOL><INDENT>body.append("<STR_LIT>" % func)<EOL><DEDENT>body.append("<STR_LIT>")<EOL>body.append("<STR_LIT>")<EOL>if call:<EOL><INDENT>for f in funcs:<EOL><INDENT>if f in call and call[f]:<EOL><INDENT>if not (call_args and f in call_args and call_args[f]):<EOL><INDENT>args = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>args = call_args[f]<EOL><DEDENT>body.append("<STR_LIT>" % (f, args))<EOL><DEDENT>else:<EOL><INDENT>body.append("<STR_LIT>" % f)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for f in funcs:<EOL><INDENT>body.append("<STR_LIT>" % f)<EOL><DEDENT><DEDENT>body.append("<STR_LIT>")<EOL>body.append("<STR_LIT:}>")<EOL>body = '<STR_LIT:\n>'.join(body) + "<STR_LIT:\n>"<EOL>return self.try_link(body, headers, include_dirs,<EOL>libraries, library_dirs)<EOL>

Check a list of functions at once.

        This is useful to speed up things, since all the functions in the funcs
        list will be put in one compilation unit.

        Arguments
        ---------
        funcs : seq
            list of functions to test
        include_dirs : seq
            list of header paths
        libraries : seq
            list of libraries to link the code snippet to
        libraru_dirs : seq
            list of library paths
        decl : dict
            for every (key, value), the declaration in the value will be
            used for function in key. If a function is not in the
            dictionay, no declaration will be used.
        call : dict
            for every item (f, value), if the value is True, a call will be
            done to the function f.


return check_inline(self)<EOL>

Return the inline keyword recognized by the compiler, empty string
        otherwise.


return check_compiler_gcc4(self)<EOL>

Return True if the C compiler is gcc >= 4.


def get_output(self, body, headers=None, include_dirs=None,<EOL>libraries=None, library_dirs=None,<EOL>lang="<STR_LIT:c>", use_tee=None):

warnings.warn("<STR_LIT>""<STR_LIT>""<STR_LIT>""<STR_LIT>""<STR_LIT>",<EOL>DeprecationWarning)<EOL>from distutils.ccompiler import CompileError, LinkError<EOL>self._check_compiler()<EOL>exitcode, output = <NUM_LIT:255>, '<STR_LIT>'<EOL>try:<EOL><INDENT>grabber = GrabStdout()<EOL>try:<EOL><INDENT>src, obj, exe = self._link(body, headers, include_dirs,<EOL>libraries, library_dirs, lang)<EOL>grabber.restore()<EOL><DEDENT>except:<EOL><INDENT>output = grabber.data<EOL>grabber.restore()<EOL>raise<EOL><DEDENT>exe = os.path.join('<STR_LIT:.>', exe)<EOL>exitstatus, output = exec_command(exe, execute_in='<STR_LIT:.>',<EOL>use_tee=use_tee)<EOL>if hasattr(os, '<STR_LIT>'):<EOL><INDENT>exitcode = os.WEXITSTATUS(exitstatus)<EOL>if os.WIFSIGNALED(exitstatus):<EOL><INDENT>sig = os.WTERMSIG(exitstatus)<EOL>log.error('<STR_LIT>' % (sig,))<EOL>if sig == signal.SIGINT:<EOL><INDENT>raise KeyboardInterrupt<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>exitcode = exitstatus<EOL><DEDENT>log.info("<STR_LIT>")<EOL><DEDENT>except (CompileError, LinkError):<EOL><INDENT>log.info("<STR_LIT>")<EOL><DEDENT>self._clean()<EOL>return exitcode, output<EOL>

Try to compile, link to an executable, and run a program
        built from 'body' and 'headers'. Returns the exit status code
        of the program and its output.


cmd._check_compiler()<EOL>body = """<STR_LIT>"""<EOL>for kw in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>st = cmd.try_compile(body % {'<STR_LIT>': kw}, None, None)<EOL>if st:<EOL><INDENT>return kw<EOL><DEDENT><DEDENT>return '<STR_LIT>'<EOL>

Return the inline identifier (may be empty).


cmd._check_compiler()<EOL>body =

Return True if the C compiler is GCC 4.x.


var = re.compile('<STR_LIT>')<EOL>fs = open(source, '<STR_LIT:r>')<EOL>try:<EOL><INDENT>ft = open(target, '<STR_LIT:w>')<EOL>try:<EOL><INDENT>for l in fs:<EOL><INDENT>m = var.search(l)<EOL>if m:<EOL><INDENT>ft.write(l.replace('<STR_LIT>' % m.group(<NUM_LIT:1>), d[m.group(<NUM_LIT:1>)]))<EOL><DEDENT>else:<EOL><INDENT>ft.write(l)<EOL><DEDENT><DEDENT><DEDENT>finally:<EOL><INDENT>ft.close()<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>fs.close()<EOL><DEDENT>

Substitute any occurence of @foo@ by d['foo'] from source file into
    target.


from distutils.command.install import install as distutils_install<EOL>if self.old_and_unmanageable or self.single_version_externally_managed:<EOL><INDENT>return distutils_install.run(self)<EOL><DEDENT>caller = sys._getframe(<NUM_LIT:3>)<EOL>caller_module = caller.f_globals.get('<STR_LIT>', '<STR_LIT>')<EOL>caller_name = caller.f_code.co_name<EOL>if caller_module != '<STR_LIT>' or caller_name!='<STR_LIT>':<EOL><INDENT>distutils_install.run(self)<EOL><DEDENT>else:<EOL><INDENT>self.do_egg_install()<EOL><DEDENT>

The setuptools version of the .run() method.

        We must pull in the entire code so we can override the level used in the
        _getframe() call since we wrap this call by one more level.


dump = dump_table(dll)<EOL>for i in range(len(dump)):<EOL><INDENT>if _START.match(dump[i].decode()):<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>syms = []<EOL>for j in range(i+<NUM_LIT:1>, len(dump)):<EOL><INDENT>m = _TABLE.match(dump[j].decode())<EOL>if m:<EOL><INDENT>syms.append((int(m.group(<NUM_LIT:1>).strip()), m.group(<NUM_LIT:2>)))<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>if len(syms) == <NUM_LIT:0>:<EOL><INDENT>log.warn('<STR_LIT>' % dll)<EOL><DEDENT>d = open(dfile, '<STR_LIT:w>')<EOL>d.write('<STR_LIT>' % os.path.basename(dll))<EOL>d.write('<STR_LIT>')<EOL>d.write('<STR_LIT>')<EOL>d.write('<STR_LIT>')<EOL>for s in syms:<EOL><INDENT>d.write('<STR_LIT>' % s[<NUM_LIT:1>])<EOL><DEDENT>d.close()<EOL>

Given a dll file location,  get all its exported symbols and dump them
    into the given def file.

    The .def file will be overwritten


lib_name = "<STR_LIT>" % tuple(sys.version_info[:<NUM_LIT:2>])<EOL>lib_file = os.path.join(sys.prefix, '<STR_LIT>', lib_name)<EOL>out_name = "<STR_LIT>" % tuple(sys.version_info[:<NUM_LIT:2>])<EOL>out_file = os.path.join(sys.prefix, '<STR_LIT>', out_name)<EOL>if not os.path.isfile(lib_file):<EOL><INDENT>log.warn('<STR_LIT>' % (lib_file))<EOL>return<EOL><DEDENT>if os.path.isfile(out_file):<EOL><INDENT>log.debug('<STR_LIT>' % (out_file))<EOL>return<EOL><DEDENT>log.info('<STR_LIT>' % (out_file))<EOL>from numpy.distutils import lib2def<EOL>def_name = "<STR_LIT>" % tuple(sys.version_info[:<NUM_LIT:2>])<EOL>def_file = os.path.join(sys.prefix, '<STR_LIT>', def_name)<EOL>nm_cmd = '<STR_LIT>' % (lib2def.DEFAULT_NM, lib_file)<EOL>nm_output = lib2def.getnm(nm_cmd)<EOL>dlist, flist = lib2def.parse_nm(nm_output)<EOL>lib2def.output_def(dlist, flist, lib2def.DEF_HEADER, open(def_file, '<STR_LIT:w>'))<EOL>dll_name = "<STR_LIT>" % tuple(sys.version_info[:<NUM_LIT:2>])<EOL>args = (dll_name, def_file, out_file)<EOL>cmd = '<STR_LIT>' % args<EOL>status = os.system(cmd)<EOL>if status:<EOL><INDENT>log.warn('<STR_LIT>')<EOL><DEDENT>return<EOL>

Build the import libraries for Mingw32-gcc on Windows


try:<EOL><INDENT>fullver = _MSVCRVER_TO_FULLVER[str(maj * <NUM_LIT:10> + min)]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise ValueError("<STR_LIT>"% (maj, min))<EOL><DEDENT>template = """<STR_LIT>"""<EOL>return template % {'<STR_LIT>': fullver, '<STR_LIT>': maj, '<STR_LIT>': min}<EOL>

Given a major and minor version of the MSVCR, returns the
    corresponding XML file.


if type == '<STR_LIT>':<EOL><INDENT>rctype = <NUM_LIT:2><EOL><DEDENT>elif type == '<STR_LIT>':<EOL><INDENT>rctype = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % type)<EOL><DEDENT>return """<STR_LIT>""" % (rctype, name)<EOL>

Return the rc file used to generate the res file which will be embedded
    as manifest for given manifest file name, of given type ('dll' or
    'exe').

    Parameters
    ----------
    name : str
            name of the manifest file to embed
    type : str {'dll', 'exe'}
            type of the binary which will embed the manifest


<EOL>msvcv = msvc_runtime_library()<EOL>if msvcv:<EOL><INDENT>assert msvcv.startswith("<STR_LIT>"), msvcv<EOL>maj = int(msvcv[<NUM_LIT:5>:-<NUM_LIT:1>])<EOL>if not maj == int(msver):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>""<STR_LIT>""<STR_LIT>" % (int(msver), maj))<EOL><DEDENT><DEDENT>

msver is the ms runtime version used for the MANIFEST.


if _cache:<EOL><INDENT>return _cache[<NUM_LIT:0>]<EOL><DEDENT>ok = True<EOL>display_opts = ['<STR_LIT>'+n for n in Distribution.display_option_names]<EOL>for o in Distribution.display_options:<EOL><INDENT>if o[<NUM_LIT:1>]:<EOL><INDENT>display_opts.append('<STR_LIT:->'+o[<NUM_LIT:1>])<EOL><DEDENT><DEDENT>for arg in sys.argv:<EOL><INDENT>if arg.startswith('<STR_LIT>') or arg=='<STR_LIT>' or arg in display_opts:<EOL><INDENT>ok = False<EOL>break<EOL><DEDENT><DEDENT>_cache.append(ok)<EOL>return ok<EOL>

Return True if command line does not contain any
    help or display requests.


splitted = name.split('<STR_LIT:/>')<EOL>return os.path.join(*splitted)<EOL>

Convert a /-separated pathname to one using the OS's path separator.


pd = os.path.abspath(parent_path)<EOL>apath = os.path.abspath(path)<EOL>if len(apath)<len(pd):<EOL><INDENT>return path<EOL><DEDENT>if apath==pd:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>if pd == apath[:len(pd)]:<EOL><INDENT>assert apath[len(pd)] in [os.sep], repr((path, apath[len(pd)]))<EOL>path = apath[len(pd)+<NUM_LIT:1>:]<EOL><DEDENT>return path<EOL>


<EOL>try:<EOL><INDENT>caller_file = eval('<STR_LIT>', frame.f_globals, frame.f_locals)<EOL>d = os.path.dirname(os.path.abspath(caller_file))<EOL><DEDENT>except NameError:<EOL><INDENT>caller_name = eval('<STR_LIT>', frame.f_globals, frame.f_locals)<EOL>__import__(caller_name)<EOL>mod = sys.modules[caller_name]<EOL>if hasattr(mod, '<STR_LIT>'):<EOL><INDENT>d = os.path.dirname(os.path.abspath(mod.__file__))<EOL><DEDENT>else:<EOL><INDENT>d = os.path.abspath('<STR_LIT:.>')<EOL><DEDENT><DEDENT>if parent_path is not None:<EOL><INDENT>d = rel_path(d, parent_path)<EOL><DEDENT>return d or '<STR_LIT:.>'<EOL>

Return path of the module given a frame object from the call stack.

    Returned path is relative to parent_path when given,
    otherwise it is absolute path.


paths = []<EOL>for p in path:<EOL><INDENT>if is_sequence(p):<EOL><INDENT>paths.append(njoin(*p))<EOL><DEDENT>else:<EOL><INDENT>assert is_string(p)<EOL>paths.append(p)<EOL><DEDENT><DEDENT>path = paths<EOL>if not path:<EOL><INDENT>joined = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>joined = os.path.join(*path)<EOL><DEDENT>if os.path.sep != '<STR_LIT:/>':<EOL><INDENT>joined = joined.replace('<STR_LIT:/>', os.path.sep)<EOL><DEDENT>return minrelpath(joined)<EOL>

Join two or more pathname components +
    - convert a /-separated pathname to one using the OS's path separator.
    - resolve `..` and `.` from path.

    Either passing n arguments as in njoin('a','b'), or a sequence
    of n names as in njoin(['a','b']) is handled, or a mixture of such arguments.


if path is not None:<EOL><INDENT>config_file = os.path.join(path, '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>dirs = get_numpy_include_dirs()<EOL>for path in dirs:<EOL><INDENT>fn = os.path.join(path, '<STR_LIT>')<EOL>if os.path.exists(fn):<EOL><INDENT>config_file = fn<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise DistutilsError('<STR_LIT>'<EOL>'<STR_LIT>' % (dirs,))<EOL><DEDENT><DEDENT>fid = open(config_file)<EOL>mathlibs = []<EOL>s = '<STR_LIT>'<EOL>for line in fid:<EOL><INDENT>if line.startswith(s):<EOL><INDENT>value = line[len(s):].strip()<EOL>if value:<EOL><INDENT>mathlibs.extend(value.split('<STR_LIT:U+002C>'))<EOL><DEDENT><DEDENT><DEDENT>fid.close()<EOL>return mathlibs<EOL>

Return the MATHLIB line from numpyconfig.h


if not is_string(path):<EOL><INDENT>return path<EOL><DEDENT>if '<STR_LIT:.>' not in path:<EOL><INDENT>return path<EOL><DEDENT>l = path.split(os.sep)<EOL>while l:<EOL><INDENT>try:<EOL><INDENT>i = l.index('<STR_LIT:.>', <NUM_LIT:1>)<EOL><DEDENT>except ValueError:<EOL><INDENT>break<EOL><DEDENT>del l[i]<EOL><DEDENT>j = <NUM_LIT:1><EOL>while l:<EOL><INDENT>try:<EOL><INDENT>i = l.index('<STR_LIT:..>', j)<EOL><DEDENT>except ValueError:<EOL><INDENT>break<EOL><DEDENT>if l[i-<NUM_LIT:1>]=='<STR_LIT:..>':<EOL><INDENT>j += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>del l[i], l[i-<NUM_LIT:1>]<EOL>j = <NUM_LIT:1><EOL><DEDENT><DEDENT>if not l:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>return os.sep.join(l)<EOL>


def gpaths(paths, local_path='<STR_LIT>', include_non_existing=True):

if is_string(paths):<EOL><INDENT>paths = (paths,)<EOL><DEDENT>return _fix_paths(paths, local_path, include_non_existing)<EOL>

Apply glob to paths and prepend local_path if needed.


if sys.platform=='<STR_LIT:win32>':<EOL><INDENT>if os.environ.get('<STR_LIT>', '<STR_LIT>')=='<STR_LIT>':<EOL><INDENT>return True<EOL><DEDENT>if os.environ.get('<STR_LIT>', '<STR_LIT>')=='<STR_LIT>':<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>

Return true when using mingw32 environment.