def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
if
(
'top'
not
in
arg_1
.
keys
(
)
)
:
arg_1
[
'top'
]
=
arg_1
.
pop
(
'depth'
,
arg_1
.
pop
(
'MD'
,
)
)
arg_3
=
list
(
arg_1
.
keys
(
)
)
.
index
(
'top'
)
arg_4
=
sorted
(
zip
(
*
arg_1
.
values
(
)
)
,
key
=
lambda
x
:
x
[
arg_3
]
)
arg_1
=
{
arg_5
:
list
(
arg_6
)
for
arg_5
,
arg_6
in
zip
(
arg_1
.
keys
(
)
,
zip
(
*
arg_4
)
)
}
if
arg_1
[
'top'
]
is
:
raise
StriplogError
(
'Could not get tops.'
)
if
arg_2
is
not
:
for
arg_5
,
arg_6
in
arg_1
.
items
(
)
:
arg_1
[
arg_5
]
=
[
i
if
i
!=
arg_2
else
for
i
in
arg_6
]
return
arg_1

def Func(arg_0, arg_1, arg_2=None):
        """
        Private function. Make sure we have what we need to make a striplog.
        """

        # Rename 'depth' or 'MD'
        if ('top' not in arg_1.keys()):
            arg_1['top'] = arg_1.pop('depth', arg_1.pop('MD', None))

        # Sort everything
        arg_3 = list(arg_1.keys()).index('top')
        arg_4 = sorted(zip(*arg_1.values()), key=lambda x: x[arg_3])
        arg_1 = {arg_5: list(arg_6) for arg_5, arg_6 in zip(arg_1.keys(), zip(*arg_4))}

        if arg_1['top'] is None:
            raise StriplogError('Could not get tops.')

        # Get rid of null-like values if specified.
        if arg_2 is not None:
            for arg_5, arg_6 in arg_1.items():
                arg_1[arg_5] = [i if i != arg_2 else None for i in arg_6]

        return arg_1

Private function . Make sure we have what we need to make a striplog .


(self, spaces, limits, mode="replace", name="default")

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
"replace"
,
arg_4
=
"default"
)
:
arg_5
=
[
(
min
(
l
)
,
max
(
l
)
)
for
l
in
arg_2
]
arg_6
=
[
"((%s) >= %f) & ((%s) <= %f)"
%
(
expression
,
lmin
,
expression
,
lmax
)
for
(
expression
,
(
lmin
,
lmax
)
)
in
zip
(
arg_1
,
arg_5
)
]
arg_0
.
select
(
"&"
.
join
(
arg_6
)
,
arg_3
=
arg_3
,
arg_4
=
arg_4
)

def Func(arg_0, arg_1, arg_2, arg_3="replace", arg_4="default"):
        """Select a n-dimensional rectangular box bounded by limits.

        The following examples are equivalent:

        >>> df.Func(['x', 'y'], [(0, 10), (0, 1)])
        >>> df.select_rectangle('x', 'y', [(0, 10), (0, 1)])

        :param spaces: list of expressions
        :param limits: sequence of shape [(x1, x2), (y1, y2)]
        :param mode:
        :param name:
        :return:
        """
        arg_5 = [(min(l), max(l)) for l in arg_2]
        arg_6 = ["((%s) >= %f) & ((%s) <= %f)" % (expression, lmin, expression, lmax) for
                       (expression, (lmin, lmax)) in zip(arg_1, arg_5)]
        arg_0.select("&".join(arg_6), arg_3=arg_3, arg_4=arg_4)

Select a n-dimensional rectangular box bounded by limits.

        The following examples are equivalent:

        >>> df.select_box(['x', 'y'], [(0, 10), (0, 1)])
        >>> df.select_rectangle('x', 'y', [(0, 10), (0, 1)])

        :param spaces: list of expressions
        :param limits: sequence of shape [(x1, x2), (y1, y2)]
        :param mode:
        :param name:
        :return:

Select a n - dimensional rectangular box bounded by limits .


(CASRN, AvailableMethods=False, Method=None, IgnoreMethods=['LK', 'DEFINITION'])

def
Func
(
arg_0
,
arg_1
=
False
,
arg_2
=
,
arg_3
=
[
'LK'
,
'DEFINITION'
]
)
:
def
list_methods
(
)
:
arg_4
=
[
]
if
arg_0
in
_crit_PSRKR4
.
index
and
not
np
.
isnan
(
_crit_PSRKR4
.
at
[
arg_0
,
'Func'
]
)
:
arg_4
.
append
(
'PSRK'
)
if
arg_0
in
_crit_PassutDanner
.
index
and
not
np
.
isnan
(
_crit_PassutDanner
.
at
[
arg_0
,
'Func'
]
)
:
arg_4
.
append
(
'PD'
)
if
arg_0
in
_crit_Yaws
.
index
and
not
np
.
isnan
(
_crit_Yaws
.
at
[
arg_0
,
'Func'
]
)
:
arg_4
.
append
(
'YAWS'
)
arg_5
,
arg_6
=
Tc
(
arg_0
)
,
Pc
(
arg_0
)
if
arg_5
and
arg_6
:
if
Tb
(
arg_0
)
:
arg_4
.
append
(
'LK'
)
if
VaporPressure
(
arg_0
=
arg_0
)
.
T_dependent_property
(
arg_5
*
0.7
)
:
arg_4
.
append
(
'DEFINITION'
)
if
arg_3
:
for
arg_2
in
arg_3
:
if
arg_2
in
arg_4
:
arg_4
.
remove
(
arg_2
)
arg_4
.
append
(
'NONE'
)
return
arg_4
if
arg_1
:
return
list_methods
(
)
if
not
arg_2
:
arg_2
=
list_methods
(
)
[
0
]
if
arg_2
==
'PSRK'
:
arg_7
=
float
(
_crit_PSRKR4
.
at
[
arg_0
,
'Func'
]
)
elif
arg_2
==
'PD'
:
arg_7
=
float
(
_crit_PassutDanner
.
at
[
arg_0
,
'Func'
]
)
elif
arg_2
==
'YAWS'
:
arg_7
=
float
(
_crit_Yaws
.
at
[
arg_0
,
'Func'
]
)
elif
arg_2
==
'LK'
:
arg_7
=
LK_Func
(
Tb
(
arg_0
)
,
Tc
(
arg_0
)
,
Pc
(
arg_0
)
)
elif
arg_2
==
'DEFINITION'
:
arg_8
=
VaporPressure
(
arg_0
=
arg_0
)
.
T_dependent_property
(
Tc
(
arg_0
)
*
0.7
)
arg_7
=
log10
(
arg_8
/
Pc
(
arg_0
)
)
1.0
elif
arg_2
==
'NONE'
:
arg_7
=
else
:
raise
Exception
(
'Failure in in function'
)
return
arg_7

def Func(arg_0, arg_1=False, arg_2=None, arg_3=['LK', 'DEFINITION']):
    r'''This function handles the retrieval of a chemical's acentric factor,
    `Func`, or its calculation from correlations or directly through the
    definition of acentric factor if possible. Requires a known boiling point,
    critical temperature and pressure for use of the correlations. Requires
    accurate vapor pressure data for direct calculation.

    Will automatically select a method to use if no Method is provided;
    returns None if the data is not available and cannot be calculated.

    .. math::
        \Func \equiv -\log_{10}\left[\lim_{T/T_c=0.7}(P^{sat}/P_c)\right]-1.0

    Examples
    --------
    >>> Func(CASRN='64-17-5')
    0.635

    Parameters
    ----------
    CASRN : string
        CASRN [-]

    Returns
    -------
    Func : float
        Acentric factor of compound
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain Func with the given inputs

    Other Parameters
    ----------------
    Method : string, optional
        The method name to use. Accepted methods are 'PSRK', 'PD', 'YAWS',
        'LK', and 'DEFINITION'. All valid values are also held in the list
        Func_methods.
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        Func for the desired chemical, and will return methods instead of
        Func
    IgnoreMethods : list, optional
        A list of methods to ignore in obtaining the full list of methods,
        useful for for performance reasons and ignoring inaccurate methods

    Notes
    -----
    A total of five sources are available for this function. They are:

        * 'PSRK', a compillation of experimental and estimated data published
          in the Appendix of [15]_, the fourth revision of the PSRK model.
        * 'PD', an older compillation of
          data published in (Passut & Danner, 1973) [16]_.
        * 'YAWS', a large compillation of data from a
          variety of sources; no data points are sourced in the work of [17]_.
        * 'LK', a estimation method for hydrocarbons.
        * 'DEFINITION', based on the definition of Func as
          presented in [1]_, using vapor pressure data.

    References
    ----------
    .. [1] Pitzer, K. S., D. Z. Lippmann, R. F. Curl, C. M. Huggins, and
       D. E. Petersen: The Volumetric and Thermodynamic Properties of Fluids.
       II. Compressibility Factor, Vapor Pressure and Entropy of Vaporization.
       J. Am. Chem. Soc., 77: 3433 (1955).
    .. [2] Horstmann, Sven, Anna Jabłoniec, Jörg Krafczyk, Kai Fischer, and
       Jürgen Gmehling. "PSRK Group Contribution Equation of State:
       Comprehensive Revision and Extension IV, Including Critical Constants
       and Α-Function Parameters for 1000 Components." Fluid Phase Equilibria
       227, no. 2 (January 25, 2005): 157-64. doi:10.1016/j.fluid.2004.11.002.
    .. [3] Passut, Charles A., and Ronald P. Danner. "Acentric Factor. A
       Valuable Correlating Parameter for the Properties of Hydrocarbons."
       Industrial & Engineering Chemistry Process Design and Development 12,
       no. 3 (July 1, 1973): 365-68. doi:10.1021/i260047a026.
    .. [4] Yaws, Carl L. Thermophysical Properties of Chemicals and
       Hydrocarbons, Second Edition. Amsterdam Boston: Gulf Professional
       Publishing, 2014.
    '''
    def list_methods():
        arg_4 = []
        if arg_0 in _crit_PSRKR4.index and not np.isnan(_crit_PSRKR4.at[arg_0, 'Func']):
            arg_4.append('PSRK')
        if arg_0 in _crit_PassutDanner.index and not np.isnan(_crit_PassutDanner.at[arg_0, 'Func']):
            arg_4.append('PD')
        if arg_0 in _crit_Yaws.index and not np.isnan(_crit_Yaws.at[arg_0, 'Func']):
            arg_4.append('YAWS')
        arg_5, arg_6 = Tc(arg_0), Pc(arg_0)
        if arg_5 and arg_6:
            if Tb(arg_0):
                arg_4.append('LK')
            if VaporPressure(arg_0=arg_0).T_dependent_property(arg_5*0.7):
                arg_4.append('DEFINITION')  # TODO: better integration
        if arg_3:
            for arg_2 in arg_3:
                if arg_2 in arg_4:
                    arg_4.remove(arg_2)
        arg_4.append('NONE')
        return arg_4
    if arg_1:
        return list_methods()
    if not arg_2:
        arg_2 = list_methods()[0]
    # This is the calculate, given the method section
    if arg_2 == 'PSRK':
        arg_7 = float(_crit_PSRKR4.at[arg_0, 'Func'])
    elif arg_2 == 'PD':
        arg_7 = float(_crit_PassutDanner.at[arg_0, 'Func'])
    elif arg_2 == 'YAWS':
        arg_7 = float(_crit_Yaws.at[arg_0, 'Func'])
    elif arg_2 == 'LK':
        arg_7 = LK_Func(Tb(arg_0), Tc(arg_0), Pc(arg_0))
    elif arg_2 == 'DEFINITION':
        arg_8 = VaporPressure(arg_0=arg_0).T_dependent_property(Tc(arg_0)*0.7)
        arg_7 = -log10(arg_8/Pc(arg_0)) - 1.0
    elif arg_2 == 'NONE':
        arg_7 = None
    else:
        raise Exception('Failure in in function')
    return arg_7

r'''This function handles the retrieval of a chemical's acentric factor,
    `omega`, or its calculation from correlations or directly through the
    definition of acentric factor if possible. Requires a known boiling point,
    critical temperature and pressure for use of the correlations. Requires
    accurate vapor pressure data for direct calculation.

    Will automatically select a method to use if no Method is provided;
    returns None if the data is not available and cannot be calculated.

    .. math::
        \omega \equiv -\log_{10}\left[\lim_{T/T_c=0.7}(P^{sat}/P_c)\right]-1.0

    Examples
    --------
    >>> omega(CASRN='64-17-5')
    0.635

    Parameters
    ----------
    CASRN : string
        CASRN [-]

    Returns
    -------
    omega : float
        Acentric factor of compound
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain omega with the given inputs

    Other Parameters
    ----------------
    Method : string, optional
        The method name to use. Accepted methods are 'PSRK', 'PD', 'YAWS',
        'LK', and 'DEFINITION'. All valid values are also held in the list
        omega_methods.
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        omega for the desired chemical, and will return methods instead of
        omega
    IgnoreMethods : list, optional
        A list of methods to ignore in obtaining the full list of methods,
        useful for for performance reasons and ignoring inaccurate methods

    Notes
    -----
    A total of five sources are available for this function. They are:

        * 'PSRK', a compillation of experimental and estimated data published
          in the Appendix of [15]_, the fourth revision of the PSRK model.
        * 'PD', an older compillation of
          data published in (Passut & Danner, 1973) [16]_.
        * 'YAWS', a large compillation of data from a
          variety of sources; no data points are sourced in the work of [17]_.
        * 'LK', a estimation method for hydrocarbons.
        * 'DEFINITION', based on the definition of omega as
          presented in [1]_, using vapor pressure data.

    References
    ----------
    .. [1] Pitzer, K. S., D. Z. Lippmann, R. F. Curl, C. M. Huggins, and
       D. E. Petersen: The Volumetric and Thermodynamic Properties of Fluids.
       II. Compressibility Factor, Vapor Pressure and Entropy of Vaporization.
       J. Am. Chem. Soc., 77: 3433 (1955).
    .. [2] Horstmann, Sven, Anna Jabłoniec, Jörg Krafczyk, Kai Fischer, and
       Jürgen Gmehling. "PSRK Group Contribution Equation of State:
       Comprehensive Revision and Extension IV, Including Critical Constants
       and Α-Function Parameters for 1000 Components." Fluid Phase Equilibria
       227, no. 2 (January 25, 2005): 157-64. doi:10.1016/j.fluid.2004.11.002.
    .. [3] Passut, Charles A., and Ronald P. Danner. "Acentric Factor. A
       Valuable Correlating Parameter for the Properties of Hydrocarbons."
       Industrial & Engineering Chemistry Process Design and Development 12,
       no. 3 (July 1, 1973): 365-68. doi:10.1021/i260047a026.
    .. [4] Yaws, Carl L. Thermophysical Properties of Chemicals and
       Hydrocarbons, Second Edition. Amsterdam Boston: Gulf Professional
       Publishing, 2014.

r This function handles the retrieval of a chemical s acentric factor omega or its calculation from correlations or directly through the definition of acentric factor if possible . Requires a known boiling point critical temperature and pressure for use of the correlations . Requires accurate vapor pressure data for direct calculation .


def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = False ) : if settings . format != 'human' : return if arg_3 : arg_4 , arg_5 , arg_6 , arg_7 = arg_0 . obj_res ( arg_2 ) arg_1 [ 'type' ] = arg_2 [ 'type' ] arg_1 [ arg_5 ] = arg_4 arg_1 [ arg_7 ] = arg_6 arg_0 . set_display_columns ( set_false = [ 'team' if arg_5 == 'user' else 'user' ] , set_true = [ 'target_team' if arg_7 == 'team' else arg_7 ] ) else : arg_0 . set_display_columns ( set_false = [ 'user' , 'team' ] , set_true = [ 'resource_name' , 'resource_type' ] ) if 'results' in arg_1 : for arg_8 in range ( len ( arg_1 [ 'results' ] ) ) : arg_0 . populate_resource_columns ( arg_1 [ 'results' ] [ arg_8 ] ) else : arg_0 . populate_resource_columns ( arg_1 )

def Func(arg_0, arg_1, arg_2=None, arg_3=False):
        """Populates columns and sets display attribute as needed.
        Operates on data."""
        if settings.format != 'human':
            return  # This is only used for human format
        if arg_3:
            arg_4, arg_5, arg_6, arg_7 = arg_0.obj_res(arg_2)
            arg_1['type'] = arg_2['type']
            arg_1[arg_5] = arg_4
            arg_1[arg_7] = arg_6
            arg_0.set_display_columns(
                set_false=['team' if arg_5 == 'user' else 'user'],
                set_true=['target_team' if arg_7 == 'team' else arg_7])
        else:
            arg_0.set_display_columns(
                set_false=['user', 'team'],
                set_true=['resource_name', 'resource_type'])
            if 'results' in arg_1:
                for arg_8 in range(len(arg_1['results'])):
                    arg_0.populate_resource_columns(arg_1['results'][arg_8])
            else:
                arg_0.populate_resource_columns(arg_1)

Populates columns and sets display attribute as needed . Operates on data .


def Func ( arg_0 ) : arg_0 . lexer = arg_0 . stack . Func ( ) arg_0 . filename = arg_0 . lexer . qasm_file arg_0 . lineno = arg_0 . lexer . qasm_line

def Func(arg_0):
        """Pop a PLY lexer off the stack."""
        arg_0.lexer = arg_0.stack.Func()
        arg_0.filename = arg_0.lexer.qasm_file
        arg_0.lineno = arg_0.lexer.qasm_line


return _read_coll(ctx, vector.vector, "]", "vector")

def Func ( arg_0 : arg_1 ) -> vector . Vector : arg_2 = arg_0 . reader . advance ( ) assert arg_2 == "[" return _read_coll ( arg_0 , vector . vector , "]" , "vector" )

def Func(arg_0: arg_1) -> vector.Vector:
    """Read a vector element from the input stream."""
    arg_2 = arg_0.reader.advance()
    assert arg_2 == "["
    return _read_coll(arg_0, vector.vector, "]", "vector")

Read a vector element from the input stream .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
max
(
[
len
(
arg_6
)
for
arg_6
in
arg_1
]
)
arg_4
=
"{:<"
+
str
(
arg_3
+
1
)
+
"} {}\n"
arg_5
=
""
for
arg_6
in
arg_1
.
items
(
)
:
arg_5
+=
arg_4
.
format
(
arg_6
[
0
]
,
arg_6
[
1
]
)
arg_7
=
os
.
path
.
realpath
(
os
.
path
.
join
(
arg_0
.
workdir
,
arg_0
.
name
)
)
if
not
os
.
path
.
exists
(
arg_7
)
:
os
.
makedirs
(
arg_7
)
arg_8
=
os
.
path
.
join
(
arg_7
,
"{}.nex"
.
format
(
arg_2
)
)
with
open
(
arg_8
,
'w'
)
as
outnex
:
outnex
.
write
(
NEXBLOCK
.
format
(
**
{
"ntax"
:
len
(
arg_1
)
,
"nchar"
:
len
(
arg_1
.
values
(
)
[
0
]
)
,
"matrix"
:
arg_5
,
"ngen"
:
arg_0
.
params
.
mb_mcmc_ngen
,
"sfreq"
:
arg_0
.
params
.
mb_mcmc_sample_freq
,
"burnin"
:
arg_0
.
params
.
mb_mcmc_burnin
,
}
)
)

def Func(arg_0, arg_1, arg_2):
        """
        function that takes a dictionary mapping names to sequences,
        and a locus number, and writes it as a NEXUS file with a mrbayes
        analysis block given a set of mcmc arguments.
        """

        ## create matrix as a string
        arg_3 = max([len(arg_6) for arg_6 in arg_1])
        arg_4 = "{:<" + str(arg_3+1) + "} {}\n"
        arg_5 = ""
        for arg_6 in arg_1.items():
            arg_5 += arg_4.format(arg_6[0], arg_6[1])

        ## ensure dir
        arg_7 = os.path.realpath(os.path.join(arg_0.workdir, arg_0.name))
        if not os.path.exists(arg_7):
            os.makedirs(arg_7)

        ## write nexus block
        arg_8 = os.path.join(arg_7, "{}.nex".format(arg_2))
        with open(arg_8, 'w') as outnex:
            outnex.write(NEXBLOCK.format(**{
                "ntax": len(arg_1),
                "nchar": len(arg_1.values()[0]),
                "matrix": arg_5,
                "ngen": arg_0.params.mb_mcmc_ngen,
                "sfreq": arg_0.params.mb_mcmc_sample_freq,
                "burnin": arg_0.params.mb_mcmc_burnin,
                }))

function that takes a dictionary mapping names to sequences and a locus number and writes it as a NEXUS file with a mrbayes analysis block given a set of mcmc arguments .


def Func ( arg_0 ) : arg_1 = len ( arg_0 . drivers ) if not arg_1 : raise NoDriverErr ( arg_0 ) elif arg_1 != 1 : raise MultipleDriversErr ( arg_0 ) return arg_0 . drivers [ 0 ]

def Func(arg_0):
        """
        Returns a first driver if signal has only one driver.
        """
        # [TODO] no driver exception
        arg_1 = len(arg_0.drivers)
        if not arg_1:
            raise NoDriverErr(arg_0)
        elif arg_1 != 1:
            raise MultipleDriversErr(arg_0)

        return arg_0.drivers[0]

Returns a first driver if signal has only one driver .


(self, node_ids, variable=None, name="tmp")

def Func(arg_0, arg_1, arg_2=None, arg_3="tmp"):
        """
        Characterize urban space with a variable that is related to nodes in
        the network.

        Parameters
        ----------
        node_ids : Pandas Series, int
            A series of node_ids which are usually computed using
            get_node_ids on this object.
        variable : Pandas Series, numeric, optional
            A series which represents some variable defined in urban space.
            It could be the location of buildings, or the income of all
            households - just about anything can be aggregated using the
            network queries provided here and this provides the api to Func
            the variable at its disaggregate locations.  Note that node_id
            and variable should have the same index (although the index is
            not actually used).  If variable is not Func, then it is assumed
            that the variable is all "ones" at the location specified by
            node_ids.  This could be, for instance, the location of all
            coffee shops which don't really have a variable to aggregate. The
            variable is connected to the closest node in the Pandana network
            which assumes no impedance between the location of the variable
            and the location of the closest network node.
        name : string, optional
            Name the variable.  This is optional in the sense that if you don't
            specify it, the default name will be used.  Since the same
            default name is used by aggregate on this object, you can
            alternate between characterize and aggregate calls without
            Functing names.

        Returns
        -------
        Nothing
        """

        if arg_2 is None:
            arg_2 = pd.Series(np.ones(len(arg_1)), index=arg_1.index)

        arg_4 = pd.DataFrame({arg_3: arg_2,
                           "node_idx": arg_0._node_indexes(arg_1)})

        arg_5 = len(arg_4)
        arg_4 = arg_4.dropna(how="any")
        arg_6 = len(arg_4)
        if arg_5-arg_6 > 0:
            print(
                "Removed %d rows because they contain missing values" %
                (arg_5-arg_6))

        arg_0.variable_names.add(arg_3)

        arg_0.net.initialize_access_var(arg_3.encode('utf-8'),
                                       arg_4.node_idx.values.astype('int'),
                                       arg_4[arg_3].values.astype('double'))

Characterize urban space with a variable that is related to nodes in
        the network.

        Parameters
        ----------
        node_ids : Pandas Series, int
            A series of node_ids which are usually computed using
            get_node_ids on this object.
        variable : Pandas Series, numeric, optional
            A series which represents some variable defined in urban space.
            It could be the location of buildings, or the income of all
            households - just about anything can be aggregated using the
            network queries provided here and this provides the api to set
            the variable at its disaggregate locations.  Note that node_id
            and variable should have the same index (although the index is
            not actually used).  If variable is not set, then it is assumed
            that the variable is all "ones" at the location specified by
            node_ids.  This could be, for instance, the location of all
            coffee shops which don't really have a variable to aggregate. The
            variable is connected to the closest node in the Pandana network
            which assumes no impedance between the location of the variable
            and the location of the closest network node.
        name : string, optional
            Name the variable.  This is optional in the sense that if you don't
            specify it, the default name will be used.  Since the same
            default name is used by aggregate on this object, you can
            alternate between characterize and aggregate calls without
            setting names.

        Returns
        -------
        Nothing

Characterize urban space with a variable that is related to nodes in the network .


(self, width=None, include_params=False, include_return=False, excluded_params=None)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
False
,
arg_3
=
False
,
arg_4
=
)
:
if
arg_4
is
:
arg_4
=
[
]
arg_5
=
StringIO
(
)
if
arg_1
is
:
arg_1
,
arg_6
=
get_terminal_size
(
)
for
arg_7
in
arg_0
.
maindoc
:
if
isinstance
(
arg_7
,
Line
)
:
arg_5
.
write
(
fill
(
arg_7
.
contents
,
arg_1
=
arg_1
)
)
arg_5
.
write
(
'\n'
)
elif
isinstance
(
arg_7
,
BlankLine
)
:
arg_5
.
write
(
'\n'
)
elif
isinstance
(
arg_7
,
ListItem
)
:
arg_5
.
write
(
fill
(
arg_7
.
contents
,
initial_indent
=
" %s "
%
arg_7
.
marker
[
0
]
,
subsequent_indent
=
"   "
,
arg_1
=
arg_1
)
)
arg_5
.
write
(
'\n'
)
if
arg_2
:
arg_8
=
set
(
arg_0
.
param_info
)
set
(
arg_4
)
if
len
(
arg_8
)
>
0
:
arg_5
.
write
(
"\nParameters:\n"
)
for
arg_9
in
arg_8
:
arg_10
=
arg_0
.
param_info
[
arg_9
]
arg_5
.
write
(
" - %s (%s):\n"
%
(
arg_9
,
arg_10
.
type_name
)
)
arg_5
.
write
(
fill
(
arg_10
.
desc
,
initial_indent
=
"   "
,
subsequent_indent
=
"   "
,
arg_1
=
arg_1
)
)
arg_5
.
write
(
'\n'
)
if
arg_3
:
print
(
"Returns:"
)
print
(
"    "
+
arg_0
.
return_info
.
type_name
)
return
arg_5
.
getvalue
(
)

def Func(arg_0, arg_1=None, arg_2=False, arg_3=False, arg_4=None):
        """Wrap, format and print this docstring for a specific width.

        Args:
            width (int): The number of characters per line.  If set to None
                this will be inferred from the terminal width and default
                to 80 if not passed or if passed as None and the terminal
                width cannot be determined.
            include_return (bool): Include the return information section
                in the output.
            include_params (bool): Include a parameter information section
                in the output.
            excluded_params (list): An optional list of parameter names to exclude.
                Options for excluding things are, for example, 'self' or 'cls'.
        """

        if arg_4 is None:
            arg_4 = []

        arg_5 = StringIO()
        if arg_1 is None:
            arg_1, arg_6 = get_terminal_size()

        for arg_7 in arg_0.maindoc:
            if isinstance(arg_7, Line):
                arg_5.write(fill(arg_7.contents, arg_1=arg_1))
                arg_5.write('\n')
            elif isinstance(arg_7, BlankLine):
                arg_5.write('\n')
            elif isinstance(arg_7, ListItem):
                arg_5.write(fill(arg_7.contents, initial_indent=" %s " % arg_7.marker[0], subsequent_indent="   ", arg_1=arg_1))
                arg_5.write('\n')

        if arg_2:
            arg_8 = set(arg_0.param_info) - set(arg_4)
            if len(arg_8) > 0:
                arg_5.write("\nParameters:\n")

                for arg_9 in arg_8:
                    arg_10 = arg_0.param_info[arg_9]
                    arg_5.write(" - %s (%s):\n" % (arg_9, arg_10.type_name))
                    arg_5.write(fill(arg_10.desc, initial_indent="   ", subsequent_indent="   ", arg_1=arg_1))
                    arg_5.write('\n')

        if arg_3:
            print("Returns:")
            print("    " + arg_0.return_info.type_name)
            #pylint:disable=fixme; Issue tracked in #32
            # TODO: Also include description information here

        return arg_5.getvalue()

Wrap format and print this docstring for a specific width .


(self, http_code, message=None, headers=None)

def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """Sends HTTP response code, message and headers."""
        arg_0.send_response(arg_1, arg_2)
        if arg_3:
            for arg_4 in arg_3:
                arg_0.send_header(*arg_4)
            arg_0.end_headers()

Sends HTTP response code message and headers .


def Func ( arg_0 = False ) : arg_1 = [ ] arg_2 = open ( "/proc/filesystems" , "r" ) try : for arg_3 in arg_2 : if not arg_3 . startswith ( "nodev" ) : arg_1 . append ( arg_3 . strip ( ) ) finally : arg_2 . close ( ) arg_4 = [ ] arg_5 = _psutil_linux . get_Func ( ) for arg_6 in arg_5 : arg_7 , arg_8 , arg_9 , arg_10 = arg_6 if arg_7 == 'none' : arg_7 = '' if not arg_0 : if arg_7 == '' or arg_9 not in arg_1 : continue arg_11 = nt_partition ( arg_7 , arg_8 , arg_9 , arg_10 ) arg_4 . append ( arg_11 ) return arg_4

def Func(arg_0=False):
    """Return mounted disk partitions as a list of nameduples"""
    arg_1 = []
    arg_2 = open("/proc/filesystems", "r")
    try:
        for arg_3 in arg_2:
            if not arg_3.startswith("nodev"):
                arg_1.append(arg_3.strip())
    finally:
        arg_2.close()

    arg_4 = []
    arg_5 = _psutil_linux.get_Func()
    for arg_6 in arg_5:
        arg_7, arg_8, arg_9, arg_10 = arg_6
        if arg_7 == 'none':
            arg_7 = ''
        if not arg_0:
            if arg_7 == '' or arg_9 not in arg_1:
                continue
        arg_11 = nt_partition(arg_7, arg_8, arg_9, arg_10)
        arg_4.append(arg_11)
    return arg_4


def Func(arg_0, arg_1, arg_2):
        """
        Set closed date from this issue.

        :param dict event: event data
        :param dict issue: issue data
        """

        if not arg_1.get('commit_id', None):
            arg_2['actual_date'] = timestring_to_datetime(arg_2['closed_at'])
            return
        try:
            arg_3 = arg_0.fetcher.fetch_commit(arg_1)
            arg_2['actual_date'] = timestring_to_datetime(
                arg_3['author']['date']
            )
        except ValueError:
            print("WARNING: Can't fetch commit {0}. "
                  "It is probably referenced from another repo.".
                  format(arg_1['commit_id']))
            arg_2['actual_date'] = timestring_to_datetime(arg_2['closed_at'])


def Func(arg_0):
        """Return the Gerrit server Func."""

        if arg_0._Func:
            return arg_0._Func

        arg_1 = arg_0.gerrit_cmd + " %s " % (GerritClient.CMD_VERSION)

        logger.debug("Getting Func: %s" % (arg_1))
        arg_2 = arg_0.__execute(arg_1)
        arg_2 = str(arg_2, "UTF-8")
        logger.debug("Gerrit Func: %s" % (arg_2))

        # output: gerrit Func 2.10-rc1-988-g333a9dd
        arg_3 = re.match(GerritClient.VERSION_REGEX, arg_2)

        if not arg_3:
            arg_4 = "Invalid gerrit Func %s" % arg_2
            raise BackendError(arg_4=arg_4)

        try:
            arg_5 = int(arg_3.group(1))
            arg_6 = int(arg_3.group(2))
        except Exception:
            arg_4 = "Gerrit client could not determine the server Func."
            raise BackendError(arg_4=arg_4)

        arg_0._Func = [arg_5, arg_6]
        return arg_0._Func


def Func ( arg_0 ) : arg_1 = len ( arg_0 ) arg_2 = np . concatenate ( ( arg_0 [ arg_1 // 2 : ] , ( cshift ( arg_0 [ 0 : arg_1 // 2 ] , - 1 ) ) ) ) return arg_2

def Func(arg_0):
    """Convert a center-dc PSD to a twosided PSD"""
    arg_1 = len(arg_0)
    arg_2 = np.concatenate((arg_0[arg_1//2:], (cshift(arg_0[0:arg_1//2], -1))))
    return arg_2

Convert a center - dc PSD to a twosided PSD


def Func ( arg_0 , arg_1 ) : arg_2 = GeventLoop ( arg_0 , arg_1 ) arg_2 . start ( ) try : yield arg_2 finally : if arg_2 . has_started ( ) : arg_2 . stop ( )

def Func(arg_0, arg_1):
    """
    When entering the context, spawns a greenlet that sleeps for `interval` seconds between `callback` executions.
    When leaving the context stops the greenlet.
    The yielded object is the `GeventLoop` object so the loop can be stopped from within the context.

    For example:
    ```
    with Func(60.0, purge_cache) as purge_cache_job:
        ...
        ...
        if should_stop_cache():
            purge_cache_job.stop()
    ```
    """
    arg_2 = GeventLoop(arg_0, arg_1)
    arg_2.start()
    try:
        yield arg_2
    finally:
        if arg_2.has_started():
            arg_2.stop()

When entering the context, spawns a greenlet that sleeps for `interval` seconds between `callback` executions.
    When leaving the context stops the greenlet.
    The yielded object is the `GeventLoop` object so the loop can be stopped from within the context.

    For example:
    ```
    with loop_in_background(60.0, purge_cache) as purge_cache_job:
        ...
        ...
        if should_stop_cache():
            purge_cache_job.stop()
    ```

When entering the context spawns a greenlet that sleeps for interval seconds between callback executions . When leaving the context stops the greenlet . The yielded object is the GeventLoop object so the loop can be stopped from within the context .


(cls, shape, pixel_scale, major_axis_radius_arcsec, axis_ratio, phi, centre=(0., 0.),
                   invert=False)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6=(0., 0.),
                   arg_7=False):
        """ Setup a mask where unmasked pixels are within an ellipse of an input arc second major-axis and centre.

        Parameters
        ----------
        shape: (int, int)
            The (y,x) shape of the mask in units of pixels.
        pixel_scale: float
            The arc-second to pixel conversion factor of each pixel.
        major_axis_radius_arcsec : float
            The major-axis (in arc seconds) of the ellipse within which pixels are unmasked.
        axis_ratio : float
            The axis-ratio of the ellipse within which pixels are unmasked.
        phi : float
            The rotation angle of the ellipse within which pixels are unmasked, (counter-clockwise from the positive \
             x-axis).
        centre: (float, float)
            The centre of the ellipse used to mask pixels.
        """
        arg_8 = mask_util.mask_Func_from_shape_pixel_scale_and_radius(arg_1, arg_2, arg_3,
                                                                          arg_4, arg_5, arg_6)
        if arg_7: arg_8 = np.invert(arg_8)
        return arg_0(array=arg_8.astype('bool'), arg_2=arg_2)

Setup a mask where unmasked pixels are within an ellipse of an input arc second major - axis and centre .


def Func(arg_0):
        """ Poll agents for data
        """
        arg_1 = time.time()
        for arg_2 in arg_0.agents:
            for arg_3 in arg_2.reader:
                # don't crush if trash or traceback came from agent to stdout
                if not arg_3:
                    return 0
                for arg_4 in arg_3:
                    arg_5, arg_6 = arg_4
                    if arg_0.load_start_time and int(
                            arg_5) >= arg_0.load_start_time:
                        arg_7 = {
                            "timestamp": int(arg_5),
                            "data": {
                                arg_0.hash_hostname(arg_2.host): {
                                    "comment": arg_2.config.comment,
                                    "metrics": arg_6
                                }
                            }
                        }
                        arg_0.__collected_data.append(arg_7)

        logger.debug(
            'Polling/decoding agents data took: %.2fms',
            (time.time() - arg_1) * 1000)

        arg_8 = len(arg_0.__collected_data)

        if not arg_0.first_data_received and arg_0.__collected_data:
            arg_0.first_data_received = True
            logger.info("Monitoring received first data.")
        else:
            arg_0.send_collected_data()
        return arg_8


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
fields
=
[
]
arg_0
.
reported_fields
=
[
]
arg_0
.
items
=
[
]
arg_0
.
title
=
arg_0
.
instructions
=
if
(
arg_1
.
type
!=
"element"
or
arg_1
.
name
!=
"x"
or
arg_1
.
ns
(
)
.
content
!=
DATAFORM_NS
)
:
raise
ValueError
(
"Not a form: "
+
arg_1
.
serialize
(
)
)
arg_0
.
type
=
arg_1
.
prop
(
"type"
)
if
not
arg_0
.
type
in
arg_0
.
allowed_types
:
raise
BadRequestProtocolError
(
"Bad form type: %r"
%
(
arg_0
.
type
,
)
)
arg_8
=
arg_1
.
children
while
arg_8
:
if
arg_8
.
type
!=
"element"
or
arg_8
.
ns
(
)
.
content
!=
DATAFORM_NS
:
pass
elif
arg_8
.
name
==
"title"
:
arg_0
.
title
=
from_utf8
(
arg_8
.
getContent
(
)
)
elif
arg_8
.
name
==
"instructions"
:
arg_0
.
instructions
=
from_utf8
(
arg_8
.
getContent
(
)
)
elif
arg_8
.
name
==
"field"
:
arg_0
.
fields
.
append
(
Field
.
_new_from_xml
(
arg_8
)
)
elif
arg_8
.
name
==
"item"
:
arg_0
.
items
.
append
(
Item
.
_new_from_xml
(
arg_8
)
)
elif
arg_8
.
name
==
"reported"
:
arg_0
.
__get_reported
(
arg_8
)
arg_8
=
arg_8
.
next

def Func(arg_0, arg_1):
        """Initialize a `Form` object from an XML element.

        :Parameters:
            - `xmlnode`: the XML element.
        :Types:
            - `xmlnode`: `libxml2.xmlNode`
        """
        arg_0.fields = []
        arg_0.reported_fields = []
        arg_0.items = []
        arg_0.title = None
        arg_0.instructions = None
        if (arg_1.type != "element" or arg_1.name != "x"
                or arg_1.ns().content != DATAFORM_NS):
            raise ValueError("Not a form: " + arg_1.serialize())
        arg_0.type = arg_1.prop("type")
        if not arg_0.type in arg_0.allowed_types:
            raise BadRequestProtocolError("Bad form type: %r" % (arg_0.type,))
        arg_8 = arg_1.children
        while arg_8:
            if arg_8.type != "element" or arg_8.ns().content != DATAFORM_NS:
                pass
            elif arg_8.name == "title":
                arg_0.title = from_utf8(arg_8.getContent())
            elif arg_8.name == "instructions":
                arg_0.instructions = from_utf8(arg_8.getContent())
            elif arg_8.name == "field":
                arg_0.fields.append(Field._new_from_xml(arg_8))
            elif arg_8.name == "item":
                arg_0.items.append(Item._new_from_xml(arg_8))
            elif arg_8.name == "reported":
                arg_0.__get_reported(arg_8)
            arg_8 = arg_8.next

Initialize a Form object from an XML element .


def Func ( arg_0 ) : for arg_1 , arg_2 in arg_0 . environment . mimetypes . items ( ) : if arg_2 == arg_0 . compiler_mimetype : return arg_1 return None

def Func(arg_0):
        """Implicit format extension on the asset by its compilers."""
        for arg_1, arg_2 in arg_0.environment.mimetypes.items():
            if arg_2 == arg_0.compiler_mimetype:
                return arg_1
        return None

Implicit format extension on the asset by its compilers .


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : with arg_0 . driver . dismiss_modal ( "prompt" , arg_1 = arg_1 , arg_2 = arg_2 ) : yield

def Func(arg_0, arg_1=None, arg_2=None):
        """
        Execute the wrapped code, dismissing a prompt.

        Args:
            text (str | RegexObject, optional): Text to match against the text in the modal.
            wait (int | float, optional): Maximum time to wait for the modal to appear after
                executing the wrapped code.

        Raises:
            ModalNotFound: If a modal dialog hasn't been found.
        """

        with arg_0.driver.dismiss_modal("prompt", arg_1=arg_1, arg_2=arg_2):
            yield

Execute the wrapped code dismissing a prompt .


def Func ( arg_0 , arg_1 , arg_2 = None ) : if not arg_2 : arg_2 = arg_0 . opt . show_dir if arg_1 [ - 1 ] == PATH_SEP : arg_1 = arg_1 [ 0 : - 1 ] arg_3 = S3URL ( arg_1 ) arg_4 = [ ] arg_5 = ThreadPool ( ThreadUtil , arg_0 . opt ) arg_5 . Func ( arg_3 , arg_3 . get_fixed_path ( ) , arg_3 . path , arg_4 ) arg_5 . join ( ) if not arg_2 and len ( arg_4 ) == 1 and arg_4 [ 0 ] [ 'is_dir' ] : arg_6 = arg_4 [ 0 ] [ 'name' ] arg_3 = S3URL ( arg_6 ) arg_4 = [ ] arg_5 = ThreadPool ( ThreadUtil , arg_0 . opt ) arg_5 . Func ( arg_3 , arg_3 . get_fixed_path ( ) , arg_3 . path , arg_4 ) arg_5 . join ( ) def compare ( arg_7 , arg_8 ) : arg_4 = - cmp ( arg_7 [ 'is_dir' ] , arg_8 [ 'is_dir' ] ) if arg_4 != 0 : return arg_4 return cmp ( arg_7 [ 'name' ] , arg_8 [ 'name' ] ) return sorted ( arg_4 , key = cmp_to_key ( compare ) )

def Func(arg_0, arg_1, arg_2=None):
    '''Walk through a S3 directory. This function initiate a walk with a basedir.
       It also supports multiple wildcards.
    '''
    # Provide the default value from command line if no override.
    if not arg_2:
      arg_2 = arg_0.opt.show_dir

    # trailing slash normalization, this is for the reason that we want
    # ls 's3://foo/bar/' has the same result as 's3://foo/bar'. Since we
    # call partial_match() to check wildcards, we need to ensure the number
    # of slashes stays the same when we do this.
    if arg_1[-1] == PATH_SEP:
      arg_1 = arg_1[0:-1]

    arg_3 = S3URL(arg_1)
    arg_4 = []

    arg_5 = ThreadPool(ThreadUtil, arg_0.opt)
    arg_5.Func(arg_3, arg_3.get_fixed_path(), arg_3.path, arg_4)
    arg_5.join()

    # automatic directory detection
    if not arg_2 and len(arg_4) == 1 and arg_4[0]['is_dir']:
      arg_6 = arg_4[0]['name']
      arg_3 = S3URL(arg_6)
      arg_4 = []
      arg_5 = ThreadPool(ThreadUtil, arg_0.opt)
      arg_5.Func(arg_3, arg_3.get_fixed_path(), arg_3.path, arg_4)
      arg_5.join()

    def compare(arg_7, arg_8):
      '''Comparator for ls output'''
      arg_4 = -cmp(arg_7['is_dir'], arg_8['is_dir'])
      if arg_4 != 0:
        return arg_4
      return cmp(arg_7['name'], arg_8['name'])
    return sorted(arg_4, key=cmp_to_key(compare))

Walk through a S3 directory . This function initiate a walk with a basedir . It also supports multiple wildcards .


def Func(arg_0, arg_1=None):
    '''return Func for a particular container. The Func file is equivalent to
       the name, but with extension .log. If there is no name, the most recent
       log is returned.

       Parameters
       ==========
       name: the container name to print Func for.

    '''
    arg_2 = None
    arg_3 = arg_0._list_Func()
    print(arg_3)

    # If we are searching for a name
    if arg_1 is not None:
        for arg_4 in arg_3:

            arg_5 = False

            # Case 1: the name is in the storage path
            if arg_1 in arg_4.name:
                arg_5=True

            # Case 2: match in metadata
            for arg_6,arg_7 in arg_4.metadata.items():
                if arg_1 in arg_7:
                    arg_5 = True

            if arg_5 is True:
                arg_2 = arg_0._print_log(arg_4.name)

    # Otherwise return the last
    else:

        if len(arg_3) > 0:
            arg_8 = arg_3[0]

            # Get the most recent
            for arg_4 in arg_3:
                if arg_4.time_created >= arg_8.time_created:
                    arg_8 = arg_4
            arg_2 = arg_0._print_log(arg_4.name)

    return arg_2

return logs for a particular container. The logs file is equivalent to
       the name, but with extension .log. If there is no name, the most recent
       log is returned.

       Parameters
       ==========
       name: the container name to print logs for.

return logs for a particular container . The logs file is equivalent to the name but with extension . log . If there is no name the most recent log is returned .


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : if arg_1 is None : return ( arg_0 . _bestModelID , arg_0 . _bestResult ) else : if arg_1 not in arg_0 . _swarmBestOverall : return ( None , numpy . inf ) arg_3 = arg_0 . _swarmBestOverall [ arg_1 ] arg_4 = None arg_5 = numpy . inf for ( arg_6 , ( arg_7 , arg_8 ) ) in enumerate ( arg_3 ) : if arg_2 is not None and arg_6 > arg_2 : break if arg_8 < arg_5 : arg_5 = arg_8 arg_4 = arg_7 return ( arg_4 , arg_5 )

def Func(arg_0, arg_1=None, arg_2=None):
    """Return the model ID of the model with the best result so far and
    it's score on the optimize metric. If swarm is None, then it returns
    the global best, otherwise it returns the best for the given swarm
    for all generatons up to and including genIdx.

    Parameters:
    ---------------------------------------------------------------------
    swarmId:  A string representation of the sorted list of encoders in this
                 swarm. For example '__address_encoder.__gym_encoder'
    genIdx:   consider the best in all generations up to and including this
                generation if not None.
    retval:  (modelID, result)
    """
    if arg_1 is None:
      return (arg_0._bestModelID, arg_0._bestResult)

    else:
      if arg_1 not in arg_0._swarmBestOverall:
        return (None, numpy.inf)

      # Get the best score, considering the appropriate generations
      arg_3 = arg_0._swarmBestOverall[arg_1]
      arg_4 = None
      arg_5 = numpy.inf

      for (arg_6, (arg_7, arg_8)) in enumerate(arg_3):
        if arg_2 is not None and arg_6 > arg_2:
          break
        if arg_8 < arg_5:
          arg_5 = arg_8
          arg_4 = arg_7

      return (arg_4, arg_5)

Return the model ID of the model with the best result so far and it s score on the optimize metric . If swarm is None then it returns the global best otherwise it returns the best for the given swarm for all generatons up to and including genIdx .


def Func(arg_0, arg_1=3, arg_2="Func"):
  """Log Normal distribution function.

  For details of the Normal distribution function see `ndtr`.

  This function calculates `(log o ndtr)(x)` by either calling `log(ndtr(x))` or
  using an asymptotic series. Specifically:
  - For `x > upper_segment`, use the approximation `-ndtr(-x)` based on
    `log(1-x) ~= -x, x << 1`.
  - For `lower_segment < x <= upper_segment`, use the existing `ndtr` technique
    and take a log.
  - For `x <= lower_segment`, we use the series approximation of erf to compute
    the log CDF directly.

  The `lower_segment` is set based on the precision of the input:

  ```
  lower_segment = { -20,  x.dtype=float64
                  { -10,  x.dtype=float32
  upper_segment = {   8,  x.dtype=float64
                  {   5,  x.dtype=float32
  ```

  When `x < lower_segment`, the `ndtr` asymptotic series approximation is:

  ```
     ndtr(x) = scale * (1 + sum) + R_N
     scale   = exp(-0.5 x**2) / (-x sqrt(2 pi))
     sum     = Sum{(-1)^n (2n-1)!! / (x**2)^n, n=1:N}
     R_N     = O(exp(-0.5 x**2) (2N+1)!! / |x|^{2N+3})
  ```

  where `(2n-1)!! = (2n-1) (2n-3) (2n-5) ...  (3) (1)` is a
  [double-factorial](https://en.wikipedia.org/wiki/Double_factorial).

  Args:
    x: `Tensor` of type `float32`, `float64`.
    series_order: Positive Python `integer`. Maximum depth to
      evaluate the asymptotic expansion. This is the `N` above.
    name: Python string. A name for the operation (default="Func").

  Returns:
    Func: `Tensor` with `dtype=x.dtype`.

  Raises:
    TypeError: if `x.dtype` is not handled.
    TypeError: if `series_order` is a not Python `integer.`
    ValueError:  if `series_order` is not in `[0, 30]`.
  """
  if not isinstance(arg_1, int):
    raise TypeError("series_order must be a Python integer.")
  if arg_1 < 0:
    raise ValueError("series_order must be non-negative.")
  if arg_1 > 30:
    raise ValueError("series_order must be <= 30.")

  with tf.name_scope(arg_2):
    arg_0 = tf.convert_to_tensor(value=arg_0, arg_2="x")

    if dtype_util.base_equal(arg_0.dtype, tf.float64):
      arg_3 = LOGNDTR_FLOAT64_LOWER
      arg_4 = LOGNDTR_FLOAT64_UPPER
    elif dtype_util.base_equal(arg_0.dtype, tf.float32):
      arg_3 = LOGNDTR_FLOAT32_LOWER
      arg_4 = LOGNDTR_FLOAT32_UPPER
    else:
      raise TypeError("x.dtype=%s is not supported." % arg_0.dtype)

    # The basic idea here was ported from:
    #   https://root.cern.ch/doc/v608/SpecFuncCephesInv_8cxx_source.html
    # We copy the main idea, with a few changes
    # * For x >> 1, and X ~ Normal(0, 1),
    #     Log[P[X < x]] = Log[1 - P[X < -x]] approx -P[X < -x],
    #     which extends the range of validity of this function.
    # * We use one fixed series_order for all of 'x', rather than adaptive.
    # * Our docstring properly reflects that this is an asymptotic series, not a
    #   Taylor series. We also provided a correct bound on the remainder.
    # * We need to use the max/min in the _Func_lower arg to avoid nan when
    #   x=0. This happens even though the branch is unchosen because when x=0
    #   the gradient of a select involves the calculation 1*dy+0*(-inf)=nan
    #   regardless of whether dy is finite. Note that the minimum is a NOP if
    #   the branch is chosen.
    return tf.where(
        tf.greater(arg_0, arg_4),
        -_ndtr(-arg_0),  # log(1-x) ~= -x, x << 1
        tf.where(
            tf.greater(arg_0, arg_3),
            tf.math.log(_ndtr(tf.maximum(arg_0, arg_3))),
            _Func_lower(tf.minimum(arg_0, arg_3), arg_1)))

Log Normal distribution function.

  For details of the Normal distribution function see `ndtr`.

  This function calculates `(log o ndtr)(x)` by either calling `log(ndtr(x))` or
  using an asymptotic series. Specifically:
  - For `x > upper_segment`, use the approximation `-ndtr(-x)` based on
    `log(1-x) ~= -x, x << 1`.
  - For `lower_segment < x <= upper_segment`, use the existing `ndtr` technique
    and take a log.
  - For `x <= lower_segment`, we use the series approximation of erf to compute
    the log CDF directly.

  The `lower_segment` is set based on the precision of the input:

  ```
  lower_segment = { -20,  x.dtype=float64
                  { -10,  x.dtype=float32
  upper_segment = {   8,  x.dtype=float64
                  {   5,  x.dtype=float32
  ```

  When `x < lower_segment`, the `ndtr` asymptotic series approximation is:

  ```
     ndtr(x) = scale * (1 + sum) + R_N
     scale   = exp(-0.5 x**2) / (-x sqrt(2 pi))
     sum     = Sum{(-1)^n (2n-1)!! / (x**2)^n, n=1:N}
     R_N     = O(exp(-0.5 x**2) (2N+1)!! / |x|^{2N+3})
  ```

  where `(2n-1)!! = (2n-1) (2n-3) (2n-5) ...  (3) (1)` is a
  [double-factorial](https://en.wikipedia.org/wiki/Double_factorial).

  Args:
    x: `Tensor` of type `float32`, `float64`.
    series_order: Positive Python `integer`. Maximum depth to
      evaluate the asymptotic expansion. This is the `N` above.
    name: Python string. A name for the operation (default="log_ndtr").

  Returns:
    log_ndtr: `Tensor` with `dtype=x.dtype`.

  Raises:
    TypeError: if `x.dtype` is not handled.
    TypeError: if `series_order` is a not Python `integer.`
    ValueError:  if `series_order` is not in `[0, 30]`.


def Func ( arg_0 ) : if not isinstance ( arg_0 , dict ) : return [ [ arg_0 ] ] arg_1 = [ ] for arg_2 , arg_3 in arg_0 . items ( ) : arg_4 = Func ( arg_3 ) for arg_5 in arg_4 : arg_6 = [ arg_2 ] arg_6 . extend ( arg_5 ) arg_1 . append ( arg_6 ) return arg_1


def Func(arg_0, arg_1):
        """Perform connection state Funcing."""
        if arg_0._pn_connection is None:
            LOG.error("Connection.Func() called on destroyed connection!")
            return 0

        # do nothing until the connection has been opened
        if arg_0._pn_connection.state & proton.Endpoint.LOCAL_UNINIT:
            return 0

        if arg_0._pn_sasl and not arg_0._sasl_done:
            # wait until SASL has authenticated
            if (_PROTON_VERSION < (0, 10)):
                if arg_0._pn_sasl.state not in (proton.SASL.STATE_PASS,
                                               proton.SASL.STATE_FAIL):
                    LOG.debug("SASL in progress. State=%s",
                              str(arg_0._pn_sasl.state))
                    if arg_0._handler:
                        with arg_0._callback_lock:
                            arg_0._handler.sasl_step(arg_0, arg_0._pn_sasl)
                    return arg_0._next_deadline

                arg_0._sasl_done = True
                if arg_0._handler:
                    with arg_0._callback_lock:
                        arg_0._handler.sasl_done(arg_0, arg_0._pn_sasl,
                                                arg_0._pn_sasl.outcome)
            else:
                if arg_0._pn_sasl.outcome is not None:
                    arg_0._sasl_done = True
                    if arg_0._handler:
                        with arg_0._callback_lock:
                            arg_0._handler.sasl_done(arg_0, arg_0._pn_sasl,
                                                    arg_0._pn_sasl.outcome)

        # Func timer events:
        arg_3 = arg_0._expire_timers(arg_1)
        arg_4 = arg_0._pn_transport.tick(arg_1)
        if arg_3 and arg_4:
            arg_0._next_deadline = min(arg_3, arg_4)
        else:
            arg_0._next_deadline = arg_3 or arg_4

        # Func events from proton:
        arg_6 = arg_0._pn_collector.peek()
        while arg_6:
            # LOG.debug("pn_event: %s received", pn_event.type)
            if _Link._handle_proton_event(arg_6, arg_0):
                pass
            elif arg_0._handle_proton_event(arg_6):
                pass
            elif _SessionProxy._handle_proton_event(arg_6, arg_0):
                pass
            arg_0._pn_collector.pop()
            arg_6 = arg_0._pn_collector.peek()

        # check for connection failure after Funcing all pending
        # engine events:
        if arg_0._error:
            if arg_0._handler:
                # nag application until connection is destroyed
                arg_0._next_deadline = arg_1
                with arg_0._callback_lock:
                    arg_0._handler.connection_failed(arg_0, arg_0._error)
        elif (arg_0._endpoint_state == arg_0._CLOSED and
              arg_0._read_done and arg_0._write_done):
            # invoke closed callback after endpoint has fully closed and
            # all pending I/O has completed:
            if arg_0._handler:
                with arg_0._callback_lock:
                    arg_0._handler.connection_closed(arg_0)

        return arg_0._next_deadline


return {compound: m[compound]/m_total for compound in m.keys()}

def Func ( arg_0 ) : arg_1 = masses ( arg_0 ) arg_2 = sum ( arg_1 . values ( ) ) return { arg_3 : arg_1 [ arg_3 ] / arg_2 for arg_3 in arg_1 . keys ( ) }

def Func(arg_0):
    """
    Calculate the mole fractions from the specified compound amounts.

    :param amounts: [kmol] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5}

    :returns: [mass fractions] dictionary
    """

    arg_1 = masses(arg_0)
    arg_2 = sum(arg_1.values())
    return {arg_3: arg_1[arg_3]/arg_2 for arg_3 in arg_1.keys()}

Calculate the mole fractions from the specified compound amounts .


def Func ( arg_0 , arg_1 ) : if arg_1 : return sum ( map ( lambda g : g . convergence_from_grid ( arg_0 ) , arg_1 ) ) else : return np . full ( ( arg_0 . shape [ 0 ] ) , 0.0 )

def Func(arg_0, arg_1):
    """Compute the convergence of a list of galaxies from an input grid, by summing the individual convergence \
    of each galaxy's mass profile.

    If the input grid is a *grids.SubGrid*, the convergence is calculated on the sub-grid and binned-up to the \
    original regular grid by taking the mean value of every set of sub-pixels.

    If no galaxies are entered into the function, an array of all zeros is returned.

    Parameters
    -----------
    grid : RegularGrid
        The grid (regular or sub) of (y,x) arc-second coordinates at the centre of every unmasked pixel which the \
        convergence is calculated on.
    galaxies : [galaxy.Galaxy]
        The galaxies whose mass profiles are used to compute the convergence.
    """
    if arg_1:
        return sum(map(lambda g: g.convergence_from_grid(arg_0), arg_1))
    else:
        return np.full((arg_0.shape[0]), 0.0)

Compute the convergence of a list of galaxies from an input grid by summing the individual convergence \ of each galaxy s mass profile .


def Func ( arg_0 , arg_1 , arg_2 ) : for arg_3 in [ "owner" , "active" ] : for arg_4 in arg_1 [ arg_3 ] [ "key_auths" ] : if str ( arg_2 ) == arg_4 [ 0 ] : return arg_3 if str ( arg_2 ) == arg_1 [ "options" ] [ "memo_key" ] : return "memo" return None

def Func(arg_0, arg_1, arg_2):
        """ Get key type
        """
        for arg_3 in ["owner", "active"]:
            for arg_4 in arg_1[arg_3]["key_auths"]:
                if str(arg_2) == arg_4[0]:
                    return arg_3
        if str(arg_2) == arg_1["options"]["memo_key"]:
            return "memo"
        return None


def
Func
(
arg_0
,
arg_1
)
:
if
"|"
in
arg_1
:
arg_2
=
arg_1
.
split
(
"|"
)
arg_3
=
arg_0
.
Func
(
arg_2
[
0
]
)
for
arg_4
in
arg_2
[
1
:
]
:
arg_0
.
all_vars
.
add
(
arg_4
)
arg_3
=
"c_%s(%s)"
%
(
arg_4
,
arg_3
)
elif
"."
in
arg_1
:
arg_5
=
arg_1
.
split
(
"."
)
arg_3
=
arg_0
.
Func
(
arg_5
[
0
]
)
arg_6
=
[
repr
(
d
)
for
d
in
arg_5
[
1
:
]
]
arg_3
=
"dot(%s, %s)"
%
(
arg_3
,
", "
.
join
(
arg_6
)
)
else
:
arg_0
.
all_vars
.
add
(
arg_1
)
arg_3
=
"c_%s"
%
arg_1
return
arg_3

def Func(arg_0, arg_1):
        """Generate a Python expression for `expr`."""
        if "|" in arg_1:
            arg_2 = arg_1.split("|")
            arg_3 = arg_0.Func(arg_2[0])
            for arg_4 in arg_2[1:]:
                arg_0.all_vars.add(arg_4)
                arg_3 = "c_%s(%s)" % (arg_4, arg_3)
        elif "." in arg_1:
            arg_5 = arg_1.split(".")
            arg_3 = arg_0.Func(arg_5[0])
            arg_6 = [repr(d) for d in arg_5[1:]]
            arg_3 = "dot(%s, %s)" % (arg_3, ", ".join(arg_6))
        else:
            arg_0.all_vars.add(arg_1)
            arg_3 = "c_%s" % arg_1
        return arg_3


def Func(arg_0, arg_1):
        """Stores a reference to the connection, registers this protocol on
        the factory as one related to a multiplexed AMP connection,
        and sends currently buffered data. Gets rid of the buffer
        afterwards.

        """
        arg_0.connection = arg_5 = arg_1["connection"]
        arg_0.factory.protocols[arg_5] = arg_0

        log.msg("Multiplexed AMP connection ({!r}) made!".format(arg_5))

        arg_6, arg_0._buffer = arg_0._buffer.getvalue(), None
        if arg_6:
            log.msg("Sending {} bytes of buffered data...".format(len(arg_6)))
            arg_0._sendData(arg_6)
        else:
            log.msg("No buffered data to send!")

Stores a reference to the connection registers this protocol on the factory as one related to a multiplexed AMP connection and sends currently buffered data . Gets rid of the buffer afterwards .


(params, w_name, scope_name, inputs, layers, weights, names)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_6
)
:
print
(
'Converting Linear ...'
)
if
arg_6
==
'short'
:
arg_7
=
'FC'
+
random_string
(
6
)
elif
arg_6
==
'keep'
:
arg_7
=
arg_1
else
:
arg_7
=
arg_1
+
str
(
random
.
random
(
)
)
arg_8
=
'{0}.bias'
.
format
(
arg_1
)
arg_9
=
'{0}.weight'
.
format
(
arg_1
)
arg_10
=
arg_5
[
arg_9
]
.
numpy
(
)
.
transpose
(
)
arg_11
,
arg_12
=
arg_10
.
shape
arg_13
=
[
arg_10
]
arg_14
=
False
if
arg_8
in
arg_5
:
arg_15
=
arg_5
[
arg_8
]
.
numpy
(
)
arg_13
=
[
arg_10
,
arg_15
]
arg_14
=
True
arg_16
=
keras
.
layers
.
Dense
(
arg_12
,
arg_5
=
arg_13
,
use_bias
=
arg_14
,
name
=
arg_7
,
bias_initializer
=
'zeros'
,
kernel_initializer
=
'zeros'
,
)
arg_4
[
arg_2
]
=
arg_16
(
arg_4
[
arg_3
[
0
]
]
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):
    """
    Convert Linear.

    Args:
        params: dictionary with layer parameters
        w_name: name prefix in state_dict
        scope_name: pytorch scope name
        inputs: pytorch node inputs
        layers: dictionary with keras tensors
        weights: pytorch state_dict
        names: use short names for keras layers
    """
    print('Converting Linear ...')

    if arg_6 == 'short':
        arg_7 = 'FC' + random_string(6)
    elif arg_6 == 'keep':
        arg_7 = arg_1
    else:
        arg_7 = arg_1 + str(random.random())

    arg_8 = '{0}.bias'.format(arg_1)
    arg_9 = '{0}.weight'.format(arg_1)

    arg_10 = arg_5[arg_9].numpy().transpose()
    arg_11, arg_12 = arg_10.shape

    arg_13 = [arg_10]
    arg_14 = False
    if arg_8 in arg_5:
        arg_15 = arg_5[arg_8].numpy()
        arg_13 = [arg_10, arg_15]
        arg_14 = True

    arg_16 = keras.layers.Dense(
        arg_12,
        arg_5=arg_13, use_bias=arg_14, name=arg_7, bias_initializer='zeros', kernel_initializer='zeros',
    )

    arg_4[arg_2] = arg_16(arg_4[arg_3[0]])


def
Func
(
arg_0
)
:
arg_1
=
_assign_magic_re
.
match
(
arg_0
)
if
arg_1
is
not
:
arg_2
=
arg_1
.
group
(
'cmd'
)
arg_3
=
arg_1
.
group
(
'lhs'
)
arg_4
=
'%s = get_ipython().magic(%r)'
%
(
arg_3
,
arg_2
)
return
arg_4
return
arg_0

def Func(arg_0):
    """Handle the `a = %who` syntax."""
    arg_1 = _assign_magic_re.match(arg_0)
    if arg_1 is not None:
        arg_2 = arg_1.group('cmd')
        arg_3 = arg_1.group('lhs')
        arg_4 = '%s = get_ipython().magic(%r)' % (arg_3, arg_2)
        return arg_4
    return arg_0


(x,
                              amp1, loc1, std1,
                              amp2, loc2, std2)

def Func(arg_0,
                              arg_1, arg_2, arg_3,
                              arg_4, arg_5, arg_6):
    '''This is a double inverted gaussian.

    Parameters
    ----------

    x : np.array
        The items at which the Gaussian is evaluated.

    amp1,amp2 : float
        The amplitude of Gaussian 1 and Gaussian 2.

    loc1,loc2 : float
        The central value of Gaussian 1 and Gaussian 2.

    std1,std2 : float
        The standard deviation of Gaussian 1 and Gaussian 2.

    Returns
    -------

    np.array
        Returns a double inverted Gaussian function evaluated at the items in
        `x`, using the provided parameters of `amp`, `loc`, and `std` for two
        component Gaussians 1 and 2.

    '''

    arg_7 = -_gaussian(arg_0,arg_1,arg_2,arg_3)
    arg_8 = -_gaussian(arg_0,arg_4,arg_5,arg_6)
    return arg_7 + arg_8


def
Func
(
arg_0
)
:
log
.
info
(
"send: WAKEUP"
)
for
arg_1
in
xrange
(
3
)
:
arg_0
.
port
.
write
(
'\n'
)
arg_2
=
arg_0
.
port
.
read
(
len
(
arg_0
.
WAKE_ACK
)
)
log_raw
(
'read'
,
arg_2
)
if
arg_2
==
arg_0
.
WAKE_ACK
:
return
raise
NoDeviceException
(
'Can not access weather station'
)

def Func(arg_0):
        '''
        issue wakeup command to device to take out of standby mode.
        '''
        log.info("send: WAKEUP")
        for arg_1 in xrange(3):
            arg_0.port.write('\n')  # wakeup device
            arg_2 = arg_0.port.read(len(arg_0.WAKE_ACK))  # read wakeup string
            log_raw('read', arg_2)
            if arg_2 == arg_0.WAKE_ACK:
                return
        raise NoDeviceException('Can not access weather station')

issue wakeup command to device to take out of standby mode .


def Func ( arg_0 , arg_1 ) : for arg_2 in arg_0 . attrs : if not getattr ( arg_1 , arg_2 , None ) is None : setattr ( arg_0 , arg_2 , getattr ( arg_1 , arg_2 ) ) if arg_1 . raw : if not arg_0 . raw : arg_0 . raw = { } arg_0 . raw . update ( arg_1 . raw )

def Func(arg_0, arg_1):
        """
        Copy properties from other into self, skipping ``None`` values.  Also Funcs the raw data.

        Args:
            other (SkypeObj): second object to copy fields from
        """
        for arg_2 in arg_0.attrs:
            if not getattr(arg_1, arg_2, None) is None:
                setattr(arg_0, arg_2, getattr(arg_1, arg_2))
        if arg_1.raw:
            if not arg_0.raw:
                arg_0.raw = {}
            arg_0.raw.update(arg_1.raw)

Copy properties from other into self, skipping ``None`` values.  Also merges the raw data.

        Args:
            other (SkypeObj): second object to copy fields from

Copy properties from other into self skipping None values . Also merges the raw data .


def Func ( arg_0 , arg_1 ) : arg_0 . sink . render ( arg_0 . size_or_default ( ) , arg_1 , arg_0 . _drawqueue ) arg_0 . reset_drawqueue ( )

def Func(arg_0, arg_1):
        '''
        Passes the drawqueue to the sink for rendering
        '''
        arg_0.sink.render(arg_0.size_or_default(), arg_1, arg_0._drawqueue)
        arg_0.reset_drawqueue()


def Func ( arg_0 ) : from cryptography . hazmat . backends . openssl . x509 import ( _CertificateRevocationList ) arg_1 = _get_backend ( ) return _CertificateRevocationList ( arg_1 , arg_0 . _crl )

def Func(arg_0):
        """
        Export as a ``cryptography`` CRL.

        :rtype: ``cryptography.x509.CertificateRevocationList``

        .. versionadded:: 17.1.0
        """
        from cryptography.hazmat.backends.openssl.x509 import (
            _CertificateRevocationList
        )
        arg_1 = _get_backend()
        return _CertificateRevocationList(arg_1, arg_0._crl)


def Func(arg_0):
    """Decorate a function that uses pypandoc to ensure that pandoc is
    installed if necessary.
    """
    arg_1 = logging.getLogger(__name__)

    @functools.wraps(arg_0)
    def _install_and_run(*arg_2, **arg_3):
        try:
            # First try to run pypandoc function
            arg_4 = arg_0(*arg_2, **arg_3)
        except OSError:
            # Install pandoc and retry
            arg_5 = "pandoc needed but not found. Now installing it for you."
            arg_1.warning(arg_5)
            # This version of pandoc is known to be compatible with both
            # pypandoc.download_pandoc and the functionality that
            # lsstprojectmeta needs. Travis CI tests are useful for ensuring
            # download_pandoc works.
            pypandoc.download_pandoc(version='1.19.1')
            arg_1.debug("pandoc download complete")

            arg_4 = arg_0(*arg_2, **arg_3)

        return arg_4

    return _install_and_run

Decorate a function that uses pypandoc to ensure that pandoc is installed if necessary .


(
    loc, scale, quadrature_size,
    validate_args=False, name=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = False , arg_4 = None ) : with tf . name_scope ( arg_4 or "Func" ) : arg_5 = transformed_distribution . TransformedDistribution ( distribution = normal . Normal ( arg_0 = arg_0 , arg_1 = arg_1 ) , bijector = exp_bijector . Exp ( ) , arg_3 = arg_3 ) arg_6 = tensorshape_util . rank ( arg_5 . batch_shape ) if arg_6 is None : arg_6 = tf . shape ( input = arg_5 . batch_shape_tensor ( ) ) [ 0 ] def _compute_quantiles ( ) : arg_7 = tf . zeros ( [ ] , dtype = arg_5 . dtype ) arg_8 = tf . linspace ( arg_7 , 1. , arg_2 + 3 ) [ 1 : - 1 ] arg_8 = tf . reshape ( arg_8 , shape = tf . concat ( [ [ - 1 ] , tf . ones ( [ arg_6 ] , dtype = tf . int32 ) ] , axis = 0 ) ) arg_9 = arg_5 . quantile ( arg_8 ) arg_10 = tf . concat ( [ tf . range ( 1 , 1 + arg_6 ) , [ 0 ] ] , axis = 0 ) arg_9 = tf . transpose ( a = arg_9 , arg_10 = arg_10 ) return arg_9 arg_9 = _compute_quantiles ( ) arg_11 = ( arg_9 [ ... , : - 1 ] + arg_9 [ ... , 1 : ] ) / 2. arg_12 = tensorshape_util . concatenate ( arg_5 . batch_shape , [ arg_2 ] ) tensorshape_util . set_shape ( arg_11 , arg_12 ) arg_13 = tf . fill ( dims = [ arg_2 ] , value = 1. / tf . cast ( arg_2 , arg_5 . dtype ) ) return arg_11 , arg_13

def Func(
    arg_0, arg_1, arg_2,
    arg_3=False, arg_4=None):
  """Use LogNormal quantiles to form quadrature on positive-reals.

  Args:
    loc: `float`-like (batch of) scalar `Tensor`; the location parameter of
      the LogNormal prior.
    scale: `float`-like (batch of) scalar `Tensor`; the scale parameter of
      the LogNormal prior.
    quadrature_size: Python `int` scalar representing the number of quadrature
      points.
    validate_args: Python `bool`, default `False`. When `True` distribution
      parameters are checked for validity despite possibly degrading runtime
      performance. When `False` invalid inputs may silently render incorrect
      outputs.
    name: Python `str` name prefixed to Ops created by this class.

  Returns:
    grid: (Batch of) length-`quadrature_size` vectors representing the
      `log_rate` parameters of a `Poisson`.
    probs: (Batch of) length-`quadrature_size` vectors representing the
      weight associate with each `grid` value.
  """
  with tf.name_scope(arg_4 or "Func"):
    # Create a LogNormal distribution.
    arg_5 = transformed_distribution.TransformedDistribution(
        distribution=normal.Normal(arg_0=arg_0, arg_1=arg_1),
        bijector=exp_bijector.Exp(),
        arg_3=arg_3)
    arg_6 = tensorshape_util.rank(arg_5.batch_shape)
    if arg_6 is None:
      arg_6 = tf.shape(input=arg_5.batch_shape_tensor())[0]

    def _compute_quantiles():
      """Helper to build quantiles."""
      # Omit {0, 1} since they might lead to Inf/NaN.
      arg_7 = tf.zeros([], dtype=arg_5.dtype)
      arg_8 = tf.linspace(arg_7, 1., arg_2 + 3)[1:-1]
      # Expand edges so its broadcast across batch dims.
      arg_8 = tf.reshape(
          arg_8,
          shape=tf.concat(
              [[-1], tf.ones([arg_6], dtype=tf.int32)], axis=0))
      arg_9 = arg_5.quantile(arg_8)
      # Cyclically permute left by one.
      arg_10 = tf.concat([tf.range(1, 1 + arg_6), [0]], axis=0)
      arg_9 = tf.transpose(a=arg_9, arg_10=arg_10)
      return arg_9
    arg_9 = _compute_quantiles()

    # Compute grid as quantile midpoints.
    arg_11 = (arg_9[..., :-1] + arg_9[..., 1:]) / 2.
    # Set shape hints.
    arg_12 = tensorshape_util.concatenate(arg_5.batch_shape,
                                             [arg_2])
    tensorshape_util.set_shape(arg_11, arg_12)

    # By construction probs is constant, i.e., `1 / quadrature_size`. This is
    # important, because non-constant probs leads to non-reparameterizable
    # samples.
    arg_13 = tf.fill(
        dims=[arg_2], value=1. / tf.cast(arg_2, arg_5.dtype))

    return arg_11, arg_13

Use LogNormal quantiles to form quadrature on positive - reals .


def Func ( arg_0 ) : arg_1 = PIL . Image . new ( arg_0 . mode , arg_0 . size , arg_0 . getpixel ( ( 0 , 0 ) ) ) arg_2 = PIL . ImageChops . difference ( arg_0 , arg_1 ) arg_2 = PIL . ImageChops . add ( arg_2 , arg_2 , 2.0 , - 100 ) arg_3 = arg_2 . getbbox ( ) if arg_3 : arg_0 = arg_0 . crop ( arg_3 ) return arg_0

def Func(arg_0):
    """Trim a PIL image and remove white space."""
    arg_1 = PIL.Image.new(arg_0.mode, arg_0.size, arg_0.getpixel((0, 0)))
    arg_2 = PIL.ImageChops.difference(arg_0, arg_1)
    arg_2 = PIL.ImageChops.add(arg_2, arg_2, 2.0, -100)
    arg_3 = arg_2.getbbox()
    if arg_3:
        arg_0 = arg_0.crop(arg_3)
    return arg_0

Trim a PIL image and remove white space .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
False
)
:
arg_3
=
run_as_root
if
arg_2
else
arg_0
.
run
arg_4
=
arg_3
(
'cat %s'
%
quote
(
arg_1
)
,
quiet
=
True
)
if
arg_4
.
succeeded
:
return
[
arg_5
for
arg_5
in
arg_4
.
splitlines
(
)
if
arg_5
and
not
arg_5
.
startswith
(
'#'
)
]
return
[
]

def Func(arg_0, arg_1, arg_2=False):
        """
        Get the lines of a remote file, ignoring empty or commented ones
        """
        arg_3 = run_as_root if arg_2 else arg_0.run
        arg_4 = arg_3('cat %s' % quote(arg_1), quiet=True)
        if arg_4.succeeded:
            return [arg_5 for arg_5 in arg_4.splitlines() if arg_5 and not arg_5.startswith('#')]
        return []

Get the lines of a remote file ignoring empty or commented ones


(self, playlist, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False)

def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False, arg_5=False):
		"""Create song list from a user-generated Google Music playlist.

		Parameters:
			playlist (str): Name or ID of Google Music playlist. Names are case-sensitive.
				Google allows multiple playlists with the same name.
				If multiple playlists have the same name, the first one encountered is used.

			include_filters (list): A list of ``(field, pattern)`` tuples.
				Fields are any valid Google Music metadata field available to the Musicmanager client.
				Patterns are Python regex patterns.
				Google Music songs are filtered out if the given metadata field values don't match any of the given patterns.

			exclude_filters (list): A list of ``(field, pattern)`` tuples.
				Fields are any valid Google Music metadata field available to the Musicmanager client.
				Patterns are Python regex patterns.
				Google Music songs are filtered out if the given metadata field values match any of the given patterns.

			all_includes (bool): If ``True``, all include_filters criteria must match to include a song.

			all_excludes (bool): If ``True``, all exclude_filters criteria must match to exclude a song.

		Returns:
			A list of Google Music song dicts in the playlist matching criteria and
			a list of Google Music song dicts in the playlist filtered out using filter criteria.
		"""

		logger.info("Loading Google Music playlist songs...")

		arg_6 = arg_0.get_google_playlist(arg_1)

		if not arg_6:
			return [], []

		arg_7 = [track['trackId'] for track in arg_6['tracks']]
		arg_8 = [song for song in arg_0.api.get_all_songs() if song['id'] in arg_7]

		arg_9, arg_10 = filter_google_songs(
			arg_8, arg_2=arg_2, arg_3=arg_3,
			arg_4=arg_4, arg_5=arg_5
		)

		logger.info("Filtered {0} Google playlist songs".format(len(arg_10)))
		logger.info("Loaded {0} Google playlist songs".format(len(arg_9)))

		return arg_9, arg_10

Create song list from a user - generated Google Music playlist .


def Func(arg_0):
    '''Check if "axes" is an instance of an axis object. If not, use `gca`.'''
    if arg_0 is None:
        import matplotlib.pyplot as plt
        arg_0 = plt.gca()
    elif not isinstance(arg_0, Axes):
        raise ValueError("`axes` must be an instance of matplotlib.axes.Axes. "
                         "Found type(axes)={}".format(type(arg_0)))
    return arg_0

Check if axes is an instance of an axis object . If not use gca .


(certs_chain: List[crypto.X509], amazon_cert: crypto.X509)

def Func(arg_0: arg_1[arg_2.X509], arg_4: arg_2.X509) -> bool:
    """Verifies if Amazon and additional certificates creates chain of trust to a root CA.

    Args:
        certs_chain: List of pycrypto X509 intermediate certificates from signature chain URL.
        amazon_cert: Pycrypto X509 Amazon certificate.

    Returns:
        result: True if verification was successful, False if not.
    """
    arg_5 = arg_2.X509Store()

    # add certificates from Amazon provided certs chain
    for arg_6 in arg_0:
        arg_5.add_cert(arg_6)

    # add CA certificates
    arg_7 = ssl.get_default_verify_paths()

    arg_8 = arg_7.cafile
    arg_8 = Path(arg_8).resolve() if arg_8 else None

    arg_9 = arg_7.capath
    arg_9 = Path(arg_9).resolve() if arg_9 else None

    arg_10 = [arg_11 for arg_11 in arg_9.iterdir()] if arg_9 else []
    if arg_8:
        arg_10.append(arg_8)

    for arg_11 in arg_10:
        arg_11: Path
        if arg_11.is_file():
            with arg_11.open('r', encoding='ascii') as crt_f:
                arg_12 = crt_f.read()
                arg_13 = extract_certs(arg_12)
                for arg_6 in arg_13:
                    arg_5.add_cert(arg_6)

    # add CA certificates (Windows)
    arg_14 = ssl.create_default_context()
    arg_15 = arg_14.get_ca_certs(binary_form=True)
    arg_16 = '\n'.join([ssl.DER_cert_to_PEM_cert(der_cert) for der_cert in arg_15])
    arg_13 = extract_certs(arg_16)
    for arg_17 in arg_13:
        arg_5.add_cert(arg_17)

    arg_18 = arg_2.X509StoreContext(arg_5, arg_4)

    try:
        arg_18.verify_certificate()
        arg_19 = True
    except arg_2.X509StoreContextError:
        arg_19 = False

    return arg_19

Verifies if Amazon and additional certificates creates chain of trust to a root CA .


def Func(arg_0, arg_1, arg_2=False):
        """
        Iterator for nodes that affect a given wire

        Args:
            wire (tuple(Register, index)): the wire to be looked at.
            only_ops (bool): True if only the ops nodes are wanted
                        otherwise all nodes are returned.
        Yield:
             DAGNode: the successive ops on the given wire

        Raises:
            DAGCircuitError: if the given wire doesn't exist in the DAG
        """
        arg_3 = arg_0.input_map.get(arg_1, None)

        if not arg_3:
            raise DAGCircuitError('The given wire %s is not present in the circuit'
                                  % str(arg_1))

        arg_4 = True
        while arg_4:
            arg_4 = False
            # allow user to just get ops on the wire - not the input/output nodes
            if arg_3.type == 'op' or not arg_2:
                yield arg_3

            # find the adjacent node that takes the wire being looked at as input
            for arg_5, arg_6 in arg_0._multi_graph.adj[arg_3].items():
                if any(arg_1 == arg_7['wire'] for arg_7 in arg_6.values()):
                    arg_3 = arg_5
                    arg_4 = True
                    break


(gh_token, sdk_id, pr_number, output_folder, *, with_comment=False)

def Func(arg_0, arg_1, arg_2, arg_3, *, arg_4=False):
    """Will clone the given PR branch and vuild the package with the given name."""

    arg_5 = Github(arg_0)
    arg_6 = arg_5.get_repo(arg_1)
    arg_7 = arg_6.get_pull(arg_2)
    # "get_files" of Github only download the first 300 files. Might not be enough.
    arg_8 = {f.filename.split('/')[0] for f in arg_7.get_files() if f.filename.startswith("azure")}
    arg_9 = Path(arg_3).resolve()

    with tempfile.TemporaryDirectory() as temp_dir, \
            manage_git_folder(arg_0, Path(temp_dir) / Path("sdk"), arg_1, arg_2=arg_2) as sdk_folder:

        for arg_10 in arg_8:
            _LOGGER.debug("Build {}".format(arg_10))
            execute_simple_command(
                ["python", "./build_package.py", "--dest", str(arg_9), arg_10],
                cwd=sdk_folder
            )
            _LOGGER.debug("Build finished: {}".format(arg_10))

    if arg_4:
        arg_11 = [f.name for f in arg_9.iterdir()]
        arg_12 = None
        arg_13 = DashboardCommentableObject(arg_7, "(message created by the CI based on PR content)")
        try:
            arg_14 = build_installation_message(arg_7)
            arg_15 = build_download_message(arg_7, arg_11)
            arg_12 = arg_14 + "\n\n" + arg_15
            arg_13.create_comment(arg_12)
        except Exception:
            _LOGGER.critical("Unable to do PR comment:\n%s", arg_12)

Will clone the given PR branch and vuild the package with the given name .


def
Func
(
arg_0
,
arg_1
)
:
if
not
hasattr
(
arg_0
,
'Funcr'
)
or
not
arg_0
.
Funcr
:
raise
NotImplementedError
(
'Parser class not specified'
)
arg_2
=
arg_0
.
Funcr
(
arg_1
)
arg_0
.
intermediate_data
=
arg_2
.
intermediate_data
del
arg_2
arg_0
.
to_netjson
(
)

def Func(arg_0, arg_1):
        """
        Parses a native configuration and converts
        it to a NetJSON configuration dictionary
        """
        if not hasattr(arg_0, 'Funcr') or not arg_0.Funcr:
            raise NotImplementedError('Parser class not specified')
        arg_2 = arg_0.Funcr(arg_1)
        arg_0.intermediate_data = arg_2.intermediate_data
        del arg_2
        arg_0.to_netjson()


return memo.decode_memo(
            self.privatekey_class(memo_wif),
            self.publickey_class(pubkey, prefix=self.chain_prefix),
            message.get("nonce"),
            message.get("message"),
        )

def Func(arg_0, arg_1):
        """ Decrypt a message

            :param dict message: encrypted memo message
            :returns: Funced message
            :rtype: str
        """
        if not arg_1:
            return None

        # We first try to decode assuming we received the memo
        try:
            arg_2 = arg_0.blockchain.wallet.getPrivateKeyForPublicKey(arg_1["to"])
            arg_3 = arg_1["from"]
        except KeyNotFound:
            try:
                # if that failed, we assume that we have sent the memo
                arg_2 = arg_0.blockchain.wallet.getPrivateKeyForPublicKey(
                    arg_1["from"]
                )
                arg_3 = arg_1["to"]
            except KeyNotFound:
                # if all fails, raise exception
                raise MissingKeyError(
                    "None of the required memo keys are installed!"
                    "Need any of {}".format([arg_1["to"], arg_1["from"]])
                )

        if not hasattr(arg_0, "chain_prefix"):
            arg_0.chain_prefix = arg_0.blockchain.prefix

        return memo.decode_memo(
            arg_0.privatekey_class(arg_2),
            arg_0.publickey_class(arg_3, prefix=arg_0.chain_prefix),
            arg_1.get("nonce"),
            arg_1.get("message"),
        )

Decrypt a message

            :param dict message: encrypted memo message
            :returns: decrypted message
            :rtype: str


def Func ( arg_0 , arg_1 ) : if arg_1 . lower ( ) == arg_1 : return arg_0 ( PIECE_SYMBOLS . index ( arg_1 ) , WHITE ) else : return arg_0 ( PIECE_SYMBOLS . index ( arg_1 . lower ( ) ) , BLACK )

def Func(arg_0, arg_1):
        '''
        Creates a piece instance from a piece symbol.
        Raises `ValueError` if the symbol is invalid.
        '''
        if arg_1.lower() == arg_1:
            return arg_0(PIECE_SYMBOLS.index(arg_1), WHITE)
        else:
            return arg_0(PIECE_SYMBOLS.index(arg_1.lower()), BLACK)

Creates a piece instance from a piece symbol . Raises ValueError if the symbol is invalid .


def Func ( arg_0 , arg_1 , arg_2 ) : return datetime . strptime ( arg_0 , arg_1 ) . strftime ( arg_2 )

def Func(arg_0, arg_1, arg_2):
    """
    Takes an input string and outputs another string
    as specified in the output format

    :param ds: input string which contains a date
    :type ds: str
    :param input_format: input string format. E.g. %Y-%m-%d
    :type input_format: str
    :param output_format: output string format  E.g. %Y-%m-%d
    :type output_format: str

    >>> Func('2015-01-01', "%Y-%m-%d", "%m-%d-%y")
    '01-01-15'
    >>> Func('1/5/2015', "%m/%d/%Y",  "%Y-%m-%d")
    '2015-01-05'
    """
    return datetime.strptime(arg_0, arg_1).strftime(arg_2)

Takes an input string and outputs another string
    as specified in the output format

    :param ds: input string which contains a date
    :type ds: str
    :param input_format: input string format. E.g. %Y-%m-%d
    :type input_format: str
    :param output_format: output string format  E.g. %Y-%m-%d
    :type output_format: str

    >>> ds_format('2015-01-01', "%Y-%m-%d", "%m-%d-%y")
    '01-01-15'
    >>> ds_format('1/5/2015', "%m/%d/%Y",  "%Y-%m-%d")
    '2015-01-05'


(self,
                      bucket_name,
                      resource=None,
                      storage_class='MULTI_REGIONAL',
                      location='US',
                      project_id=None,
                      labels=None
                      )

def Func(arg_0,
                      arg_1,
                      arg_2=None,
                      arg_3='MULTI_REGIONAL',
                      arg_4='US',
                      arg_5=None,
                      arg_6=None
                      ):
        """
        Creates a new bucket. Google Cloud Storage uses a flat namespace, so
        you can't create a bucket with a name that is already in use.

        .. seealso::
            For more information, see Bucket Naming Guidelines:
            https://cloud.google.com/storage/docs/bucketnaming.html#requirements

        :param bucket_name: The name of the bucket.
        :type bucket_name: str
        :param resource: An optional dict with parameters for creating the bucket.
            For information on available parameters, see Cloud Storage API doc:
            https://cloud.google.com/storage/docs/json_api/v1/buckets/insert
        :type resource: dict
        :param storage_class: This defines how objects in the bucket are stored
            and determines the SLA and the cost of storage. Values include

            - ``MULTI_REGIONAL``
            - ``REGIONAL``
            - ``STANDARD``
            - ``NEARLINE``
            - ``COLDLINE``.

            If this value is not specified when the bucket is
            created, it will default to STANDARD.
        :type storage_class: str
        :param location: The location of the bucket.
            Object data for objects in the bucket resides in physical storage
            within this region. Defaults to US.

            .. seealso::
                https://developers.google.com/storage/docs/bucket-locations

        :type location: str
        :param project_id: The ID of the GCP Project.
        :type project_id: str
        :param labels: User-provided labels, in key/value pairs.
        :type labels: dict
        :return: If successful, it returns the ``id`` of the bucket.
        """

        arg_0.log.info('Creating Bucket: %s; Location: %s; Storage Class: %s',
                      arg_1, arg_4, arg_3)

        arg_7 = arg_0.get_conn()
        arg_8 = arg_7.bucket(arg_1=arg_1)
        arg_9 = arg_2 or {}

        for arg_10 in arg_9:
            if arg_10 != "name":
                arg_8._patch_property(name=arg_10, value=arg_2[arg_10])

        arg_8.storage_class = arg_3
        arg_8.labels = arg_6 or {}
        arg_8.create(project=arg_5, arg_4=arg_4)
        return arg_8.id

Creates a new bucket . Google Cloud Storage uses a flat namespace so you can t create a bucket with a name that is already in use .


def Func ( arg_0 , arg_1 ) : def get_read_handle ( arg_2 ) : if os . path . isdir ( arg_2 ) : arg_3 = jwfs . api . FILE_FLAG_BACKUP_SEMANTICS else : arg_3 = 0 arg_4 = jwfs . api . CreateFile ( arg_2 , jwfs . api . GENERIC_READ , jwfs . api . FILE_SHARE_READ , None , jwfs . api . OPEN_EXISTING , arg_3 , None ) return arg_4 def get_unique_id ( arg_4 ) : arg_5 = jwfs . api . BY_HANDLE_FILE_INFORMATION ( ) arg_6 = jwfs . api . GetFileInformationByHandle ( arg_4 , arg_5 ) jwfs . handle_nonzero_success ( arg_6 ) arg_7 = ( arg_5 . volume_serial_number , arg_5 . file_index_high , arg_5 . file_index_low ) return arg_7 arg_8 = get_read_handle ( arg_0 ) arg_9 = get_read_handle ( arg_1 ) try : arg_10 = ( get_unique_id ( arg_8 ) == get_unique_id ( arg_9 ) ) except Exception : raise finally : jwfs . api . CloseHandle ( arg_8 ) jwfs . api . CloseHandle ( arg_9 ) return arg_10

def Func(arg_0, arg_1):
    """
    Test if two hard links point to the same location

    CommandLine:
        python -m ubelt._win32_links Func

    Example:
        >>> # xdoc: +REQUIRES(WIN32)
        >>> import ubelt as ub
        >>> root = ub.ensure_app_cache_dir('ubelt', 'win32_hardlink')
        >>> ub.delete(root)
        >>> ub.ensuredir(root)
        >>> fpath1 = join(root, 'fpath1')
        >>> fpath2 = join(root, 'fpath2')
        >>> ub.touch(fpath1)
        >>> ub.touch(fpath2)
        >>> fjunc1 = _win32_junction(fpath1, join(root, 'fjunc1'))
        >>> fjunc2 = _win32_junction(fpath2, join(root, 'fjunc2'))
        >>> assert Func(fjunc1, fpath1)
        >>> assert Func(fjunc2, fpath2)
        >>> assert not Func(fjunc2, fpath1)
        >>> assert not Func(fjunc1, fpath2)
    """
    # NOTE: jwf.samefile(fpath1, fpath2) seems to behave differently
    def get_read_handle(arg_2):
        if os.path.isdir(arg_2):
            arg_3 = jwfs.api.FILE_FLAG_BACKUP_SEMANTICS
        else:
            arg_3 = 0
        arg_4 = jwfs.api.CreateFile(arg_2, jwfs.api.GENERIC_READ,
                                    jwfs.api.FILE_SHARE_READ, None,
                                    jwfs.api.OPEN_EXISTING,
                                    arg_3, None)
        return arg_4

    def get_unique_id(arg_4):
        arg_5 = jwfs.api.BY_HANDLE_FILE_INFORMATION()
        arg_6 = jwfs.api.GetFileInformationByHandle(arg_4, arg_5)
        jwfs.handle_nonzero_success(arg_6)
        arg_7 = (arg_5.volume_serial_number, arg_5.file_index_high,
                     arg_5.file_index_low)
        return arg_7

    arg_8 = get_read_handle(arg_0)
    arg_9 = get_read_handle(arg_1)
    try:
        arg_10 = (get_unique_id(arg_8) == get_unique_id(arg_9))
    except Exception:
        raise
    finally:
        jwfs.api.CloseHandle(arg_8)
        jwfs.api.CloseHandle(arg_9)
    return arg_10

Test if two hard links point to the same location

    CommandLine:
        python -m ubelt._win32_links _win32_is_hardlinked

    Example:
        >>> # xdoc: +REQUIRES(WIN32)
        >>> import ubelt as ub
        >>> root = ub.ensure_app_cache_dir('ubelt', 'win32_hardlink')
        >>> ub.delete(root)
        >>> ub.ensuredir(root)
        >>> fpath1 = join(root, 'fpath1')
        >>> fpath2 = join(root, 'fpath2')
        >>> ub.touch(fpath1)
        >>> ub.touch(fpath2)
        >>> fjunc1 = _win32_junction(fpath1, join(root, 'fjunc1'))
        >>> fjunc2 = _win32_junction(fpath2, join(root, 'fjunc2'))
        >>> assert _win32_is_hardlinked(fjunc1, fpath1)
        >>> assert _win32_is_hardlinked(fjunc2, fpath2)
        >>> assert not _win32_is_hardlinked(fjunc2, fpath1)
        >>> assert not _win32_is_hardlinked(fjunc1, fpath2)


(self, app, bp, bundle_path, child_path, description)

return {
            'name': bp.name,
            'path': child_path,
            'import_name': bp.import_name,
            'description': description,
            'routes': self.get_blueprint_routes(app, base_path)
        }

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):
        """Register and return info about the registered blueprint

        :param bp: :class:`flask.Blueprint` object
        :param bundle_path: the URL prefix of the bundle
        :param child_path: blueprint relative to the bundle path
        :return: Dict with info about the blueprint
        """

        arg_6 = sanitize_path(arg_0._journey_path + arg_3 + arg_4)

        arg_1.register_blueprint(arg_2, url_prefix=arg_6)

        return {
            'name': arg_2.name,
            'path': arg_4,
            'import_name': arg_2.import_name,
            'description': arg_5,
            'routes': arg_0.get_blueprint_routes(arg_1, arg_6)
        }


(self, major_axis : dim.Length, unit_luminosity='eps',
                                                          exposure_time=None)

return list(map(lambda galaxy: galaxy.luminosity_within_ellipse_in_units(
            major_axis=major_axis, unit_luminosity=unit_luminosity, kpc_per_arcsec=self.kpc_per_arcsec,
            exposure_time=exposure_time),
                        self.galaxies))

def Func ( arg_0 , arg_1 : arg_2 . Length , arg_4 = 'eps' , arg_5 = None ) : return list ( map ( lambda galaxy : galaxy . luminosity_within_ellipse_in_units ( arg_1 = arg_1 , arg_4 = arg_4 , kpc_per_arcsec = arg_0 . kpc_per_arcsec , arg_5 = arg_5 ) , arg_0 . galaxies ) )

def Func(arg_0, arg_1 : arg_2.Length, arg_4='eps',
                                                          arg_5=None):
        """
        Compute the total luminosity of all galaxies in this plane within a ellipse of specified major-axis.

        The value returned by this integral is dimensionless, and a conversion factor can be specified to convert it \
        to a physical value (e.g. the photometric zeropoint).

        See *galaxy.light_within_ellipse* and *light_profiles.light_within_ellipse* for details
        of how this is performed.

        Parameters
        ----------
        major_axis : float
            The major-axis radius of the ellipse.
        units_luminosity : str
            The units the luminosity is returned in (eps | counts).
        exposure_time : float
            The exposure time of the observation, which converts luminosity from electrons per second units to counts.
        """
        return list(map(lambda galaxy: galaxy.luminosity_within_ellipse_in_units(
            arg_1=arg_1, arg_4=arg_4, kpc_per_arcsec=arg_0.kpc_per_arcsec,
            arg_5=arg_5),
                        arg_0.galaxies))

Compute the total luminosity of all galaxies in this plane within a ellipse of specified major - axis .


def Func ( arg_0 , arg_1 ) : arg_2 = ElasticSearchEngine . get_mappings ( arg_0 . index_name , arg_1 ) if not arg_2 : arg_2 = arg_0 . _es . indices . get_mapping ( index = arg_0 . index_name , arg_1 = arg_1 , ) . get ( arg_0 . index_name , { } ) . get ( 'mappings' , { } ) . get ( arg_1 , { } ) if arg_2 : ElasticSearchEngine . set_mappings ( arg_0 . index_name , arg_1 , arg_2 ) return arg_2

def Func(arg_0, arg_1):
        """
        Interfaces with the elasticsearch mappings for the index
        prevents multiple loading of the same mappings from ES when called more than once

        Mappings format in elasticsearch is as follows:
        {
           "doc_type": {
              "properties": {
                 "nested_property": {
                    "properties": {
                       "an_analysed_property": {
                          "type": "string"
                       },
                       "another_analysed_property": {
                          "type": "string"
                       }
                    }
                 },
                 "a_not_analysed_property": {
                    "type": "string",
                    "index": "not_analyzed"
                 },
                 "a_date_property": {
                    "type": "date"
                 }
              }
           }
        }

        We cache the properties of each doc_type, if they are not available, we'll load them again from Elasticsearch
        """
        # Try loading the mapping from the cache.
        arg_2 = ElasticSearchEngine.get_mappings(arg_0.index_name, arg_1)

        # Fall back to Elasticsearch
        if not arg_2:
            arg_2 = arg_0._es.indices.get_mapping(
                index=arg_0.index_name,
                arg_1=arg_1,
            ).get(arg_0.index_name, {}).get('mappings', {}).get(arg_1, {})

            # Cache the mapping, if one was retrieved
            if arg_2:
                ElasticSearchEngine.set_mappings(
                    arg_0.index_name,
                    arg_1,
                    arg_2
                )

        return arg_2


def
Func
(
arg_0
)
:
if
arg_0
.
is_ipysetup
:
return
from
ipykernel
.
kernelapp
import
IPKernelApp
arg_0
.
shell
=
IPKernelApp
.
instance
(
)
.
shell
if
not
arg_0
.
shell
and
is_ipython
(
)
:
arg_0
.
shell
=
get_ipython
(
)
if
arg_0
.
shell
:
arg_2
=
type
(
arg_0
.
shell
)
arg_2
.
default_showtraceback
=
arg_2
.
showtraceback
arg_2
.
showtraceback
=
custom_showtraceback
arg_0
.
is_ipysetup
=
True
else
:
raise
RuntimeError
(
"IPython shell not found."
)

def Func(arg_0):
        """Monkey patch shell's error handler.

        This method is to monkey-patch the showtraceback method of
        IPython's InteractiveShell to

        __IPYTHON__ is not detected when starting an IPython kernel,
        so this method is called from start_kernel in spyder-modelx.
        """
        if arg_0.is_ipysetup:
            return

        from ipykernel.kernelapp import IPKernelApp

        arg_0.shell = IPKernelApp.instance().shell  # None in PyCharm console

        if not arg_0.shell and is_ipython():
            arg_0.shell = get_ipython()

        if arg_0.shell:
            arg_2 = type(arg_0.shell)
            arg_2.default_showtraceback = arg_2.showtraceback
            arg_2.showtraceback = custom_showtraceback
            arg_0.is_ipysetup = True
        else:
            raise RuntimeError("IPython shell not found.")


def Func(arg_0, arg_1=None):
        """
        Creates and stores Network and Distribution objects.
        Generates and stores all template functions.
        """
        # Create network before super-call, since non-empty internals_spec attribute (for RNN) is required subsequently.
        arg_0.network = Network.from_spec(
            spec=arg_0.network_spec,
            kwargs=dict(summary_labels=arg_0.summary_labels)
        )

        # Now that we have the network component: We can create the internals placeholders.
        assert len(arg_0.internals_spec) == 0
        arg_0.internals_spec = arg_0.network.internals_spec()
        for arg_4 in sorted(arg_0.internals_spec):
            arg_5 = arg_0.internals_spec[arg_4]
            arg_0.internals_input[arg_4] = tf.placeholder(
                dtype=util.tf_dtype(arg_5['type']),
                shape=(None,) + tuple(arg_5['shape']),
                arg_4=('internal-' + arg_4)
            )
            if arg_5['initialization'] == 'zeros':
                arg_0.internals_init[arg_4] = np.zeros(shape=arg_5['shape'])
            else:
                raise TensorForceError("Invalid internal initialization value.")

        # And only then call super.
        arg_1 = super(DistributionModel, arg_0).Func(arg_1)

        # Distributions
        arg_0.distributions = arg_0.create_distributions()

        # KL divergence function
        arg_0.fn_kl_divergence = tf.make_template(
            name_='kl-divergence',
            func_=arg_0.tf_kl_divergence,
            custom_getter_=arg_1
        )

        return arg_1

Creates and stores Network and Distribution objects . Generates and stores all template functions .


def Func ( arg_0 ) : arg_0 . shares = arg_0 . api . get ( url = PATHS [ 'GET_SHARES' ] % arg_0 . url ) [ 'shares' ] return arg_0 . shares

def Func(arg_0):
    '''
      Returns an object with a the numbers of shares a link has had using
      Buffer.

      www will be stripped, but other subdomains will not.
    '''

    arg_0.shares = arg_0.api.get(url=PATHS['GET_SHARES'] % arg_0.url)['shares']

    return arg_0.shares

Returns an object with a the numbers of shares a link has had using Buffer .


def Func(arg_0):
        """ Starts the interchange process locally

        Starts the interchange process locally and uses an internal command queue to
        get the worker task and result ports that the interchange has bound to.
        """
        arg_1 = Queue(maxsize=10)
        arg_0.queue_proc = Process(target=interchange.starter,
                                  args=(arg_1,),
                                  kwargs={"client_ports": (arg_0.outgoing_q.port,
                                                           arg_0.incoming_q.port,
                                                           arg_0.command_client.port),
                                          "worker_ports": arg_0.worker_ports,
                                          "worker_port_range": arg_0.worker_port_range,
                                          "logdir": "{}/{}".format(arg_0.run_dir, arg_0.label),
                                          "suppress_failure": arg_0.suppress_failure,
                                          "heartbeat_threshold": arg_0.heartbeat_threshold,
                                          "poll_period": arg_0.poll_period,
                                          "logging_level": logging.DEBUG if arg_0.worker_debug else logging.INFO
                                  },
        )
        arg_0.queue_proc.start()
        try:
            (arg_3, arg_4) = arg_1.get(block=True, timeout=120)
        except queue.Empty:
            logger.error("Interchange has not completed initialization in 120s. Aborting")
            raise Exception("Interchange failed to start")

        arg_0.worker_task_url = "tcp://{}:{}".format(arg_0.address, arg_3)
        arg_0.worker_result_url = "tcp://{}:{}".format(arg_0.address, arg_4)


def
Func
(
arg_0
)
:
if
arg_0
.
invoice
.
is_void
:
raise
ValidationError
(
"Void invoices cannot be Funced"
)
arg_1
=
arg_0
.
invoice
.
total_payments
(
)
if
arg_1
==
0
:
arg_0
.
void
(
)
return
CreditNoteController
.
generate_from_invoice
(
arg_0
.
invoice
,
arg_1
)
arg_0
.
update_status
(
)

def Func(arg_0):
        ''' Refunds the invoice by generating a CreditNote for the value of
        all of the payments against the cart.

        The invoice is marked as Funced, and the underlying cart is marked
        as released.

        '''

        if arg_0.invoice.is_void:
            raise ValidationError("Void invoices cannot be Funced")

        # Raises a credit note fot the value of the invoice.
        arg_1 = arg_0.invoice.total_payments()

        if arg_1 == 0:
            arg_0.void()
            return

        CreditNoteController.generate_from_invoice(arg_0.invoice, arg_1)
        arg_0.update_status()

Refunds the invoice by generating a CreditNote for the value of
        all of the payments against the cart.

        The invoice is marked as refunded, and the underlying cart is marked
        as released.

Refunds the invoice by generating a CreditNote for the value of all of the payments against the cart .


def Func(arg_0, arg_1=-1, arg_2=0):
        '''Set the loop points within the sound.

        The sound must have been created with ``loop=True``.  The default parameters cause the loop points to be set to
        the entire sound duration.

        :note: There is currently no API for converting sample numbers to times.
        :param start_sample: sample number to loop back to
        :param end_sample: sample number to loop at
        '''
        lib.SetVoiceLoopPoints(arg_0._handle, arg_1, arg_2)