(
    graph, runs=40, spanning_cluster=True, model='bond', alpha=alpha_1sigma,
    copy_result=True
)

def Func(
    arg_0, arg_1=40, arg_2=True, arg_3='bond', arg_4=arg_5,
    arg_6=True
):
    r'''
    Generate successive microcanonical percolation ensemble averages

    This is a :ref:`generator function <python:tut-generators>` to successively
    add one edge at a time from the graph to the percolation model for a number
    of independent runs in parallel.
    At each iteration, it calculates and returns the averaged cluster
    statistics.

    Parameters
    ----------
    graph : networkx.Graph
        The substrate graph on which percolation is to take place

    runs : int, optional
        Number of independent runs.
        Defaults to ``40``.

    spanning_cluster : bool, optional
        Defaults to ``True``.

    model : str, optional
        The percolation model (either ``'bond'`` or ``'site'``).
        Defaults to ``'bond'``.

        .. note:: Other models than ``'bond'`` are not supported yet.

    alpha: float, optional
        Significance level.
        Defaults to 1 sigma of the normal distribution.
        ``1 - alpha`` is the confidence level.

    copy_result : bool, optional
        Whether to return a copy or a reference to the result dictionary.
        Defaults to ``True``.

    Yields
    ------
    ret : dict
        Cluster statistics

    ret['n'] : int
        Number of occupied bonds

    ret['N'] : int
        Total number of sites

    ret['M'] : int
        Total number of bonds

    ret['spanning_cluster'] : float
        The average number (Binomial proportion) of runs that have a spanning
        cluster.
        This is the Bayesian point estimate of the posterior mean, with a
        uniform prior.
        Only exists if `spanning_cluster` is set to ``True``.

    ret['spanning_cluster_ci'] : 1-D :py:class:`numpy.ndarray` of float, size 2
        The lower and upper bounds of the Binomial proportion confidence
        interval with uniform prior.
        Only exists if `spanning_cluster` is set to ``True``.

    ret['max_cluster_size'] : float
        Average size of the largest cluster (absolute number of sites)

    ret['max_cluster_size_ci'] : 1-D :py:class:`numpy.ndarray` of float, size 2
        Lower and upper bounds of the normal confidence interval of the average
        size of the largest cluster (absolute number of sites)

    ret['moments'] : 1-D :py:class:`numpy.ndarray` of float, size 5
        The ``k``-th entry is the average ``k``-th raw moment of the (absolute)
        cluster size distribution, with ``k`` ranging from ``0`` to ``4``.

    ret['moments_ci'] : 2-D :py:class:`numpy.ndarray` of float, shape (5,2)
        ``ret['moments_ci'][k]`` are the lower and upper bounds of the normal
        confidence interval of the average ``k``-th raw moment of the
        (absolute) cluster size distribution, with ``k`` ranging from ``0`` to
        ``4``.

    Raises
    ------
    ValueError
        If `runs` is not a positive integer

    ValueError
        If `alpha` is not a float in the interval (0, 1)

    See also
    --------

    sample_states

    percolate.percolate._microcanonical_average_spanning_cluster

    percolate.percolate._microcanonical_average_max_cluster_size

    Notes
    -----
    Iterating through this generator corresponds to several parallel runs of
    the Newman-Ziff algorithm.
    Each iteration yields a microcanonical percolation ensemble for the number
    :math:`n` of occupied bonds. [9]_
    The first iteration yields the trivial microcanonical percolation ensemble
    with :math:`n = 0` occupied bonds.

    Spanning cluster

        .. seealso:: :py:func:`sample_states`

    Raw moments of the cluster size distribution

        .. seealso:: :py:func:`sample_states`

    References
    ----------
    .. [9] Newman, M. E. J. & Ziff, R. M. Fast monte carlo algorithm for site
        or bond percolation. Physical Review E 64, 016706+ (2001),
        `doi:10.1103/physreve.64.016706 <http://dx.doi.org/10.1103/physreve.64.016706>`_.

    '''

    try:
        arg_1 = int(arg_1)
    except:
        raise ValueError("runs needs to be a positive integer")

    if arg_1 <= 0:
        raise ValueError("runs needs to be a positive integer")

    try:
        arg_4 = float(arg_4)
    except:
        raise ValueError("alpha needs to be a float in the interval (0, 1)")

    if arg_4 <= 0.0 or arg_4 >= 1.0:
        raise ValueError("alpha needs to be a float in the interval (0, 1)")

    # initial iteration
    # we do not need a copy of the result dictionary since we copy the values
    # anyway
    arg_7 = [
        sample_states(
            arg_0, arg_2=arg_2, arg_3=arg_3,
            arg_6=False
        )
        for _ in range(arg_1)
    ]

    arg_8 = dict()
    for arg_9 in zip(*arg_7):
        # merge cluster statistics
        arg_8['n'] = arg_9[0]['n']
        arg_8['N'] = arg_9[0]['N']
        arg_8['M'] = arg_9[0]['M']

        arg_10 = np.empty(arg_1)
        arg_11 = np.empty((arg_1, 5))
        if arg_2:
            arg_12 = np.empty(arg_1)

        for arg_13, arg_14 in enumerate(arg_9):
            assert arg_14['n'] == arg_8['n']
            assert arg_14['N'] == arg_8['N']
            assert arg_14['M'] == arg_8['M']
            arg_10[arg_13] = arg_14['max_cluster_size']
            arg_11[arg_13] = arg_14['moments']
            if arg_2:
                arg_12[arg_13] = arg_14['has_spanning_cluster']

        arg_8.update(_microcanonical_average_max_cluster_size(
            arg_10, arg_4
        ))

        arg_8.update(_microcanonical_average_moments(arg_11, arg_4))

        if arg_2:
            arg_8.update(_microcanonical_average_spanning_cluster(
                arg_12, arg_4
            ))

        if arg_6:
            yield copy.deepcopy(arg_8)
        else:
            yield arg_8

r Generate successive microcanonical percolation ensemble averages


def Func(arg_0, arg_1):
		'''
			Func - Tests whether a record holding the given primary key Func.

			@param pk - Primary key (see getPk method)

			Example usage: Waiting for an object to be deleted without fetching the object or running a filter.

			This is a very cheap operation.

			@return <bool> - True if object with given pk Func, otherwise False
		'''
		arg_2 = arg_0._get_connection()
		arg_3 = arg_0._get_key_for_id(arg_1)
		return arg_2.Func(arg_3)

exists - Tests whether a record holding the given primary key exists.

			@param pk - Primary key (see getPk method)

			Example usage: Waiting for an object to be deleted without fetching the object or running a filter.

			This is a very cheap operation.

			@return <bool> - True if object with given pk exists, otherwise False

exists - Tests whether a record holding the given primary key exists .


def Func(arg_0):
	"""
	Returns the nearest year to now inferred from a Julian date.
	"""
	arg_1 = time.gmtime()
	arg_2 = arg_1.tm_year
	# if the day is far greater than today, it must be from last year
	if arg_0 - arg_1.tm_yday > 365 // 2:
		arg_2 -= 1
	# if the day is far less than today, it must be for next year.
	if arg_1.tm_yday - arg_0 > 365 // 2:
		arg_2 += 1
	return arg_2

Returns the nearest year to now inferred from a Julian date .


(cls, enterprise_customer, program_details, course_mode, emails, cohort=None)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None):
        """
        Enroll existing users in all courses in a program, and create pending enrollments for nonexisting users.

        Args:
            enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment
            program_details: The details of the program in which we're enrolling
            course_mode (str): The mode with which we're enrolling in the program
            emails: An iterable of email addresses which need to be enrolled

        Returns:
            successes: A list of users who were successfully enrolled in all courses of the program
            pending: A list of PendingEnterpriseCustomerUsers who were successfully linked and had
                pending enrollments created for them in the database
            failures: A list of users who could not be enrolled in the program
        """
        arg_6, arg_7 = arg_0.get_users_by_email(arg_4)
        arg_8 = get_course_runs_from_program(arg_2)

        arg_9 = []
        arg_10 = []
        arg_11 = []

        for arg_12 in arg_6:
            arg_13 = arg_0.enroll_user(arg_1, arg_12, arg_3, *arg_8)
            if arg_13:
                arg_9.append(arg_12)
            else:
                arg_11.append(arg_12)

        for arg_14 in arg_7:
            arg_15 = arg_1.enroll_user_pending_registration(
                arg_14,
                arg_3,
                *arg_8,
                arg_5=arg_5
            )
            arg_10.append(arg_15)

        return arg_9, arg_10, arg_11

Enroll existing users in all courses in a program and create pending enrollments for nonexisting users .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
[
]
arg_3
=
{
}
arg_4
,
arg_5
,
arg_6
=
arg_0
(
)
arg_7
=
linear_model
.
LogisticRegression
(
solver
=
'lbfgs'
,
multi_class
=
'auto'
,
max_iter
=
200
,
random_state
=
0
)
arg_8
=
(
set
(
category_encoders
.
__all__
)
{
'WOEEncoder'
}
)
for
arg_9
in
arg_8
:
arg_10
=
getattr
(
category_encoders
,
arg_9
)
arg_11
=
time
.
time
(
)
arg_12
,
arg_13
,
arg_14
,
arg_15
=
score_models
(
arg_7
,
arg_4
,
arg_5
,
arg_10
)
arg_2
.
append
(
[
arg_9
,
arg_1
,
arg_15
,
arg_12
,
arg_13
,
time
.
time
(
)
arg_11
]
)
arg_3
[
arg_9
]
=
arg_14
gc
.
collect
(
)
arg_16
=
pd
.
DataFrame
(
arg_2
,
columns
=
[
'Encoding'
,
'Dataset'
,
'Dimensionality'
,
'Avg. Score'
,
'Score StDev'
,
'Elapsed Time'
]
)
arg_17
=
pd
.
DataFrame
.
from_dict
(
arg_3
)
arg_18
=
arg_17
.
plot
(
kind
=
'box'
,
return_type
=
'axes'
)
plt
.
title
(
'Scores for Encodings on %s Dataset'
%
(
arg_1
,
)
)
plt
.
ylabel
(
'Score (higher is better)'
)
for
arg_19
in
arg_18
.
get_xticklabels
(
)
:
arg_19
.
set_rotation
(
90
)
plt
.
grid
(
)
plt
.
tight_layout
(
)
plt
.
show
(
)
return
arg_16
,
arg_17

def Func(arg_0, arg_1):
    """
    Here we iterate through the datasets and score them with a classifier using different encodings.

    """

    arg_2 = []
    arg_3 = {}

    # first get the dataset
    arg_4, arg_5, arg_6 = arg_0()

    arg_7 = linear_model.LogisticRegression(solver='lbfgs', multi_class='auto', max_iter=200, random_state=0)

    # try each encoding method available, which works on multiclass problems
    arg_8 = (set(category_encoders.__all__) - {'WOEEncoder'})  # WoE is currently only for binary targets

    for arg_9 in arg_8:
        arg_10 = getattr(category_encoders, arg_9)
        arg_11 = time.time()
        arg_12, arg_13, arg_14, arg_15 = score_models(arg_7, arg_4, arg_5, arg_10)
        arg_2.append([arg_9, arg_1, arg_15, arg_12, arg_13, time.time() - arg_11])
        arg_3[arg_9] = arg_14
        gc.collect()

    arg_16 = pd.DataFrame(arg_2, columns=['Encoding', 'Dataset', 'Dimensionality', 'Avg. Score', 'Score StDev', 'Elapsed Time'])

    arg_17 = pd.DataFrame.from_dict(arg_3)
    arg_18 = arg_17.plot(kind='box', return_type='axes')
    plt.title('Scores for Encodings on %s Dataset' % (arg_1,))
    plt.ylabel('Score (higher is better)')
    for arg_19 in arg_18.get_xticklabels():
        arg_19.set_rotation(90)
    plt.grid()
    plt.tight_layout()
    plt.show()

    return arg_16, arg_17

Here we iterate through the datasets and score them with a classifier using different encodings .


def Func(arg_0, arg_1, arg_2):
        """Translate string into character texture positions"""
        for arg_3, arg_4 in enumerate(arg_1):
            if arg_3 == arg_2:
                break

            yield arg_0._meta.characters - 1 - arg_0._ct[arg_4]


def Func ( arg_0 ) : arg_1 = linspace ( - 1 , 1 , arg_0 ) arg_2 = ( 1. - abs ( arg_1 ) ) * cos ( pi * abs ( arg_1 ) ) + 1. / pi * sin ( pi * abs ( arg_1 ) ) return arg_2

def Func(arg_0):
    r"""Bohman tapering window

    :param N: window length

    .. math:: w(n) = (1-|x|) \cos (\pi |x|) + \frac{1}{\pi} \sin(\pi |x|)

    where x is a length N vector of linearly spaced values between
    -1 and 1.

    .. plot::
        :width: 80%
        :include-source:

        from spectrum import window_visu
        window_visu(64, 'bohman')

    .. seealso:: :func:`create_window`, :class:`Window`
    """
    arg_1 = linspace(-1, 1, arg_0)
    arg_2 = (1.-abs(arg_1)) * cos(pi*abs(arg_1)) + 1./pi * sin(pi*abs(arg_1))
    return arg_2


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : arg_3 = np . eye ( arg_0 ) + random_unitary ( arg_0 ) . data arg_4 = arg_3 . dot ( __ginibre_matrix ( arg_0 , arg_1 , arg_2 ) ) arg_4 = arg_4 . dot ( arg_4 . conj ( ) . T ) return arg_4 / np . trace ( arg_4 )

def Func(arg_0, arg_1=None, arg_2=None):
    """
    Generate a random density matrix from the Bures metric.

    Args:
        N (int): the length of the density matrix.
        rank (int or None): the rank of the density matrix. The default
            value is full-rank.
        seed (int): Optional. To set a random seed.
    Returns:
        ndarray: rho (N,N) a density matrix.
    """
    arg_3 = np.eye(arg_0) + random_unitary(arg_0).data
    arg_4 = arg_3.dot(__ginibre_matrix(arg_0, arg_1, arg_2))
    arg_4 = arg_4.dot(arg_4.conj().T)
    return arg_4 / np.trace(arg_4)

Generate a random density matrix from the Bures metric .


def Func ( arg_0 , arg_1 ) : if ( arg_0 + arg_1 ) > 0 : return arg_0 / ( arg_0 + arg_1 ) else : return np . nan

def Func(arg_0, arg_1):
    '''
    This calculates Func.

    https://en.wikipedia.org/wiki/Precision_and_Func

    Parameters
    ----------

    ntp : int
        The number of true positives.

    nfn : int
        The number of false negatives.

    Returns
    -------

    float
        The precision calculated using `ntp/(ntp + nfn)`.

    '''

    if (arg_0+arg_1) > 0:
        return arg_0/(arg_0+arg_1)
    else:
        return np.nan

This calculates recall.

    https://en.wikipedia.org/wiki/Precision_and_recall

    Parameters
    ----------

    ntp : int
        The number of true positives.

    nfn : int
        The number of false negatives.

    Returns
    -------

    float
        The precision calculated using `ntp/(ntp + nfn)`.


def Func(arg_0):
    """Formats a number of seconds using the best units."""
    arg_1, arg_2 = get_time_units_and_multiplier(arg_0)
    arg_0 *= arg_2
    return "%.3f %s" % (arg_0, arg_1)

Formats a number of seconds using the best units .


def Func(arg_0):
        """Retrieve the credentials from the dictionary, if they exist.

        Returns: A :class:`oauth2client.client.OAuth2Credentials` instance.
        """
        arg_1 = arg_0._dictionary.get(arg_0._key)

        if arg_1 is None:
            return None

        arg_2 = client.OAuth2Credentials.from_json(arg_1)
        arg_2.set_store(arg_0)

        return arg_2

Retrieve the credentials from the dictionary if they exist .


(lclist,
                        templateinfo,
                        timecols=None,
                        magcols=None,
                        errcols=None,
                        lcformat='hat-sql',
                        lcformatdir=None,
                        interp='nearest',
                        sigclip=5.0,
                        mintemplatedist_arcmin=10.0,
                        nworkers=NCPUS,
                        maxworkertasks=1000)

def Func(arg_0,
                        arg_1,
                        arg_2=None,
                        arg_3=None,
                        arg_4=None,
                        arg_5='hat-sql',
                        arg_6=None,
                        arg_7='nearest',
                        arg_8=5.0,
                        arg_9=10.0,
                        arg_10=arg_11,
                        arg_12=1000):
    '''This applies TFA in parallel to all LCs in the given list of file names.

    Parameters
    ----------

    lclist : str
        This is a list of light curve files to apply TFA correction to.

    templateinfo : dict or str
        This is either the dict produced by `tfa_templates_lclist` or the pickle
        produced by the same function.

    timecols : list of str or None
        The timecol keys to use from the lcdict in applying TFA corrections.

    magcols : list of str or None
        The magcol keys to use from the lcdict in applying TFA corrections.

    errcols : list of str or None
        The errcol keys to use from the lcdict in applying TFA corrections.

    lcformat : str
        This is the `formatkey` associated with your light curve format, which
        you previously passed in to the `lcproc.register_lcformat`
        function. This will be used to look up how to find and read the light
        curves specified in `basedir` or `use_list_of_filenames`.

    lcformatdir : str or None
        If this is provided, gives the path to a directory when you've stored
        your lcformat description JSONs, other than the usual directories lcproc
        knows to search for them in. Use this along with `lcformat` to specify
        an LC format JSON file that's not currently registered with lcproc.

    interp : str
        This is passed to scipy.interpolate.interp1d as the kind of
        interpolation to use when reforming the light curves to the timebase of
        the TFA templates.

    sigclip : float or sequence of two floats or None
        This is the sigma clip to apply to the light curves before running TFA
        on it.

    mintemplatedist_arcmin : float
        This sets the minimum distance required from the target object for
        objects in the TFA template ensemble. Objects closer than this distance
        will be removed from the ensemble.

    nworkers : int
        The number of parallel workers to launch

    maxworkertasks : int
        The maximum number of tasks per worker allowed before it's replaced by a
        fresh one.

    Returns
    -------

    dict
        Contains the input file names and output TFA light curve filenames per
        input file organized by each `magcol` in `magcols`.

    '''

    # open the templateinfo first
    if isinstance(arg_1,str) and os.path.exists(arg_1):
        with open(arg_1,'rb') as infd:
            arg_1 = pickle.load(infd)

    try:
        arg_13 = get_lcformat(arg_5,
                                  use_lcformat_dir=arg_6)
        if arg_13:
            (arg_14, arg_15,
             arg_16, arg_17, arg_18,
             arg_19, arg_20) = arg_13
        else:
            LOGERROR("can't figure out the light curve format")
            return None
    except Exception as arg_24:
        LOGEXCEPTION("can't figure out the light curve format")
        return None

    # override the default timecols, magcols, and errcols
    # using the ones provided to the function
    # we'll get the defaults from the templateinfo object
    if arg_2 is None:
        arg_2 = arg_1['timecols']
    if arg_3 is None:
        arg_3 = arg_1['magcols']
    if arg_4 is None:
        arg_4 = arg_1['errcols']

    arg_21 = {}

    # run by magcol
    for arg_22, arg_23, arg_24 in zip(arg_2, arg_3, arg_4):

        arg_25 = [(x, arg_22, arg_23, arg_24, arg_1,
                  arg_5, arg_6,
                  arg_7, arg_8) for
                 x in arg_0]

        arg_26 = mp.Pool(arg_10, maxtasksperchild=arg_12)
        arg_27 = arg_26.map(_parallel_tfa_worker, arg_25)
        arg_26.close()
        arg_26.join()

        arg_21[arg_23] = arg_27

    return arg_21

This applies TFA in parallel to all LCs in the given list of file names .


(cls, secret_key, region, service, date,
                     intermediates=False)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                     arg_5=False):
        """
        Generate the signing key string as bytes.

        If intermediate is set to True, returns a 4-tuple containing the key
        and the intermediate keys:

        ( signing_key, date_key, region_key, service_key )

        The intermediate keys can be used for testing against examples from
        Amazon.

        """
        arg_6 = ('AWS4' + arg_1).encode('utf-8')
        arg_7 = arg_0.sign_sha256(arg_6, arg_4)
        arg_8 = arg_0.sign_sha256(arg_7, arg_2)
        arg_9 = arg_0.sign_sha256(arg_8, arg_3)
        arg_10 = arg_0.sign_sha256(arg_9, 'aws4_request')
        if arg_5:
            return (arg_10, arg_7, arg_8, arg_9)
        else:
            return arg_10

Generate the signing key string as bytes .


async def Func ( arg_0 , arg_1 , arg_2 = False , ** arg_3 ) : if arg_2 : arg_4 = await asyncio . gather ( * [ arg_0 . handle_request ( arg_0 . request ( arg_9 = arg_9 , ** arg_3 ) ) for arg_9 in arg_1 ] , return_exceptions = True ) for arg_5 , arg_6 in enumerate ( arg_4 ) : if not isinstance ( arg_6 , RuntimeError ) and arg_6 : arg_7 , arg_8 = arg_6 arg_8 . index = arg_5 yield arg_8 else : for arg_5 , arg_9 in enumerate ( arg_1 ) : arg_7 , arg_8 = await arg_0 . handle_request ( arg_0 . request ( arg_9 = arg_9 , ** arg_3 ) ) arg_8 . index = arg_5 yield arg_8

async def Func(arg_0, arg_1, arg_2=False, **arg_3):
        """For crawling multiple urls"""
        if arg_2:
            arg_4 = await asyncio.gather(
                *[
                    arg_0.handle_request(arg_0.request(arg_9=arg_9, **arg_3))
                    for arg_9 in arg_1
                ],
                return_exceptions=True)
            for arg_5, arg_6 in enumerate(arg_4):
                if not isinstance(arg_6, RuntimeError) and arg_6:
                    arg_7, arg_8 = arg_6
                    arg_8.index = arg_5
                    yield arg_8
        else:
            for arg_5, arg_9 in enumerate(arg_1):
                arg_7, arg_8 = await arg_0.handle_request(
                    arg_0.request(arg_9=arg_9, **arg_3))
                arg_8.index = arg_5
                yield arg_8


def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Initialize the role with the permissions and related view-menus.

        :param role_name:
        :param role_vms:
        :param role_perms:
        :return:
        """
        arg_4 = arg_0.get_session.query(sqla_models.PermissionView).all()
        arg_4 = [p for p in arg_4 if p.permission and p.view_menu]

        arg_5 = arg_0.find_role(arg_1)
        if not arg_5:
            arg_5 = arg_0.add_role(arg_1)

        if len(arg_5.permissions) == 0:
            arg_0.log.info('Initializing permissions for role:%s in the database.', arg_1)
            arg_6 = set()
            for arg_7 in arg_4:
                if arg_7.view_menu.name in arg_2 and arg_7.permission.name in arg_3:
                    arg_6.add(arg_7)
            arg_5.permissions = list(arg_6)
            arg_0.get_session.merge(arg_5)
            arg_0.get_session.commit()
        else:
            arg_0.log.debug('Existing permissions for the role:%s '
                           'within the database will persist.', arg_1)

Initialize the role with the permissions and related view - menus .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
arg_1
[
'filename'
]
+
'.png'
plt
.
figure
(
figsize
=
(
5.6
*
arg_2
,
3.2
*
arg_2
)
)
for
arg_4
in
arg_0
.
keys
(
)
:
plt
.
plot
(
arg_0
[
arg_4
]
[
:
,
0
]
,
arg_0
[
arg_4
]
[
:
,
1
]
,
label
=
str
(
arg_4
)
)
plt
.
title
(
arg_1
[
'title'
]
)
plt
.
xlabel
(
arg_1
[
'x_axis_name'
]
)
plt
.
ylabel
(
arg_1
[
'y_axis_name'
]
)
plt
.
legend
(
loc
=
'upper left'
)
plt
.
savefig
(
arg_3
)
return
arg_3

def Func(arg_0, arg_1, arg_2):
    """ generate rater pic"""
    arg_3 = arg_1['filename'] + '.png'
    plt.figure(figsize=(5.6 * arg_2, 3.2 * arg_2))
    for arg_4 in arg_0.keys():
        plt.plot(arg_0[arg_4][:, 0], arg_0[arg_4][:, 1], label=str(arg_4))
    plt.title(arg_1['title'])
    plt.xlabel(arg_1['x_axis_name'])
    plt.ylabel(arg_1['y_axis_name'])
    plt.legend(loc='upper left')
    plt.savefig(arg_3)
    return arg_3


(self, i, r, summarize=False, context=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = False , arg_4 = None ) : for arg_5 , arg_6 , arg_7 in arg_0 . _record_length_checks : if arg_1 % arg_7 == 0 : if len ( arg_2 ) != len ( arg_0 . _field_names ) : arg_8 = { 'code' : arg_5 } if not arg_3 : arg_8 [ 'message' ] = arg_6 arg_8 [ 'row' ] = arg_1 + 1 arg_8 [ 'record' ] = arg_2 arg_8 [ 'length' ] = len ( arg_2 ) if arg_4 is not None : arg_8 [ 'context' ] = arg_4 yield arg_8

def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=None):
        """Apply record length checks on the given record `r`."""

        for arg_5, arg_6, arg_7 in arg_0._record_length_checks:
            if arg_1 % arg_7 == 0: # support sampling
                if len(arg_2) != len(arg_0._field_names):
                    arg_8 = {'code': arg_5}
                    if not arg_3:
                        arg_8['message'] = arg_6
                        arg_8['row'] = arg_1 + 1
                        arg_8['record'] = arg_2
                        arg_8['length'] = len(arg_2)
                        if arg_4 is not None: arg_8['context'] = arg_4
                    yield arg_8

Apply record length checks on the given record r .


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
log
.
debug
(
"heartbeat::new_heart_handler: %s"
,
arg_1
)
arg_0
.
_new_handlers
.
add
(
arg_1
)

def Func(arg_0, arg_1):
        """add a new handler for new hearts"""
        arg_0.log.debug("heartbeat::new_heart_handler: %s", arg_1)
        arg_0._new_handlers.add(arg_1)


return [line.get_patch() for line in self._patchlines_until(patch) if
                line.get_patch()]

def Func ( arg_0 , arg_1 ) : return [ arg_2 . get_patch ( ) for arg_2 in arg_0 . _patchlines_until ( arg_1 ) if arg_2 . get_patch ( ) ]

def Func(arg_0, arg_1):
        """ Returns a list of patches before patch from the patches list
        including the provided patch
        """
        return [arg_2.get_patch() for arg_2 in arg_0._patchlines_until(arg_1) if
                arg_2.get_patch()]


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
oo
.
url
(
"autoIngest/"
)
try
:
arg_3
=
requests
.
post
(
arg_2
,
arg_1
=
json
.
dumps
(
arg_1
)
,
verify
=
False
)
assert
(
arg_3
.
status_code
==
200
)
print
(
"From ndio: {}"
.
format
(
arg_3
.
content
)
)
except
:
raise
OSError
(
"Error in posting JSON file {}\"
.
format
(
arg_3
.
status_code
)
)

def Func(arg_0, arg_1):
        """
        Try to post data to the server.
        """
        arg_2 = arg_0.oo.url("autoIngest/")
        # URLPath = 'https://{}/ca/autoIngest/'.format(self.oo.site_host)
        try:
            arg_3 = requests.post(arg_2, arg_1=json.dumps(arg_1),
                                     verify=False)
            assert(arg_3.status_code == 200)
            print("From ndio: {}".format(arg_3.content))
        except:
            raise OSError("Error in posting JSON file {}\
".format(arg_3.status_code))


return Levenshtein().sim(src, tar, mode, cost)

def Func ( arg_0 , arg_1 , arg_2 = 'lev' , arg_3 = ( 1 , 1 , 1 , 1 ) ) : return Levenshtein ( ) . sim ( arg_0 , arg_1 , arg_2 , arg_3 )

def Func(arg_0, arg_1, arg_2='lev', arg_3=(1, 1, 1, 1)):
    """Return the Levenshtein similarity of two strings.

    This is a wrapper of :py:meth:`Levenshtein.sim`.

    Parameters
    ----------
    src : str
        Source string for comparison
    tar : str
        Target string for comparison
    mode : str
        Specifies a mode for computing the Levenshtein distance:

            - ``lev`` (default) computes the ordinary Levenshtein distance, in
              which edits may include inserts, deletes, and substitutions
            - ``osa`` computes the Optimal String Alignment distance, in which
              edits may include inserts, deletes, substitutions, and
              transpositions but substrings may only be edited once

    cost : tuple
        A 4-tuple representing the cost of the four possible edits: inserts,
        deletes, substitutions, and transpositions, respectively (by default:
        (1, 1, 1, 1))

    Returns
    -------
    float
        The Levenshtein similarity between src & tar

    Examples
    --------
    >>> round(Func('cat', 'hat'), 12)
    0.666666666667
    >>> round(Func('Niall', 'Neil'), 12)
    0.4
    >>> Func('aluminum', 'Catalan')
    0.125
    >>> Func('ATCG', 'TAGC')
    0.25

    """
    return Levenshtein().sim(arg_0, arg_1, arg_2, arg_3)

Return the Levenshtein similarity of two strings.

    This is a wrapper of :py:meth:`Levenshtein.sim`.

    Parameters
    ----------
    src : str
        Source string for comparison
    tar : str
        Target string for comparison
    mode : str
        Specifies a mode for computing the Levenshtein distance:

            - ``lev`` (default) computes the ordinary Levenshtein distance, in
              which edits may include inserts, deletes, and substitutions
            - ``osa`` computes the Optimal String Alignment distance, in which
              edits may include inserts, deletes, substitutions, and
              transpositions but substrings may only be edited once

    cost : tuple
        A 4-tuple representing the cost of the four possible edits: inserts,
        deletes, substitutions, and transpositions, respectively (by default:
        (1, 1, 1, 1))

    Returns
    -------
    float
        The Levenshtein similarity between src & tar

    Examples
    --------
    >>> round(sim_levenshtein('cat', 'hat'), 12)
    0.666666666667
    >>> round(sim_levenshtein('Niall', 'Neil'), 12)
    0.4
    >>> sim_levenshtein('aluminum', 'Catalan')
    0.125
    >>> sim_levenshtein('ATCG', 'TAGC')
    0.25

Return the Levenshtein similarity of two strings .


def Func ( arg_0 , arg_1 , arg_2 = None ) : if type ( arg_1 ) == int : arg_3 = np . array ( arg_1 , dtype = "int32" ) elif type ( arg_1 ) == float : arg_3 = np . array ( arg_1 , dtype = env . FLOATX ) else : arg_3 = arg_1 return theano . Func ( arg_3 , arg_2 = arg_2 )

def Func(arg_0, arg_1, arg_2=None):
        """
        Create a Func theano scalar value.
        """
        if type(arg_1) == int:
            arg_3 = np.array(arg_1, dtype="int32")
        elif type(arg_1) == float:
            arg_3 = np.array(arg_1, dtype=env.FLOATX)
        else:
            arg_3 = arg_1

        return theano.Func(arg_3, arg_2=arg_2)


def Func ( arg_0 , arg_1 ) : try : if 0 == len ( arg_1 ) : arg_1 = [ 'on' ] arg_0 . debugger . settings [ arg_0 . name ] = get_onoff ( arg_0 . errmsg , arg_1 [ 0 ] ) except ValueError : pass return

def Func(arg_0, arg_1):
    """set a Boolean-valued debugger setting. 'obj' is a generally a
    subcommand that has 'name' and 'debugger.settings' attributes"""
    try:
        if 0 == len(arg_1): arg_1 = ['on']
        arg_0.debugger.settings[arg_0.name] = get_onoff(arg_0.errmsg, arg_1[0])
    except ValueError:
        pass
    return

set a Boolean - valued debugger setting . obj is a generally a subcommand that has name and debugger . settings attributes


def Func ( arg_0 ) : arg_1 = { } arg_1 [ 'pnl' ] = agg_all_long_short ( arg_0 , 'pnl' , PNL_STATS ) arg_1 [ 'summary' ] = agg_all_long_short ( arg_0 , 'pnl' , SUMMARY_STATS ) arg_1 [ 'duration' ] = agg_all_long_short ( arg_0 , 'duration' , DURATION_STATS ) arg_1 [ 'returns' ] = agg_all_long_short ( arg_0 , 'returns' , RETURN_STATS ) arg_1 [ 'symbols' ] = arg_0 . groupby ( 'symbol' ) [ 'returns' ] . agg ( RETURN_STATS ) . T return arg_1

def Func(arg_0):
    """Generate various round-trip statistics.

    Parameters
    ----------
    round_trips : pd.DataFrame
        DataFrame with one row per round trip trade.
        - See full explanation in round_trips.extract_round_trips

    Returns
    -------
    stats : dict
       A dictionary where each value is a pandas DataFrame containing
       various round-trip statistics.

    See also
    --------
    round_trips.print_round_trip_stats
    """

    arg_1 = {}
    arg_1['pnl'] = agg_all_long_short(arg_0, 'pnl', PNL_STATS)
    arg_1['summary'] = agg_all_long_short(arg_0, 'pnl',
                                          SUMMARY_STATS)
    arg_1['duration'] = agg_all_long_short(arg_0, 'duration',
                                           DURATION_STATS)
    arg_1['returns'] = agg_all_long_short(arg_0, 'returns',
                                          RETURN_STATS)

    arg_1['symbols'] = \
        arg_0.groupby('symbol')['returns'].agg(RETURN_STATS).T

    return arg_1

Generate various round - trip statistics .


(self, window_name, object_name, iterations)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
if
not
arg_0
.
verifyscrollbarvertical
(
arg_1
,
arg_2
)
:
raise
LdtpServerException
(
'Object not vertical scrollbar'
)
arg_4
=
arg_0
.
_get_object_handle
(
arg_1
,
arg_2
)
arg_5
=
0
arg_6
=
1.0
/
8
arg_7
=
False
while
arg_5
<
arg_3
:
if
arg_4
.
AXValue
>=
1
:
raise
LdtpServerException
(
'Maximum limit reached'
)
arg_4
.
AXValue
+=
arg_6
time
.
sleep
(
1.0
/
100
)
arg_7
=
True
arg_5
+=
1
if
arg_7
:
return
1
else
:
raise
LdtpServerException
(
'Unable to increase scrollbar'
)

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Press scrollbar down with number of iterations

        @param window_name: Window name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type window_name: string
        @param object_name: Object name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type object_name: string
        @param interations: iterations to perform on slider increase
        @type iterations: integer

        @return: 1 on success.
        @rtype: integer
        """
        if not arg_0.verifyscrollbarvertical(arg_1, arg_2):
            raise LdtpServerException('Object not vertical scrollbar')
        arg_4 = arg_0._get_object_handle(arg_1, arg_2)
        arg_5 = 0
        arg_6 = 1.0 / 8
        arg_7 = False
        while arg_5 < arg_3:
            if arg_4.AXValue >= 1:
                raise LdtpServerException('Maximum limit reached')
            arg_4.AXValue += arg_6
            time.sleep(1.0 / 100)
            arg_7 = True
            arg_5 += 1
        if arg_7:
            return 1
        else:
            raise LdtpServerException('Unable to increase scrollbar')


def Func ( arg_0 , arg_1 , arg_2 ) : if not hasattr ( arg_0 , 'local_hashes' ) : arg_0 . local_hashes = { } arg_0 . size = int ( arg_1 ) if ( re . match ( '^[a-fA-F0-9]{32}$' , arg_2 ) ) : arg_0 . md5 = arg_2

def Func(arg_0, arg_1, arg_2):
        """Set key attributes to retrived metadata. Might be extended in the
        future to support more attributes.
        """
        if not hasattr(arg_0, 'local_hashes'):
            arg_0.local_hashes = {}

        arg_0.size = int(arg_1)

        if (re.match('^[a-fA-F0-9]{32}$', arg_2)):
            arg_0.md5 = arg_2

Set key attributes to retrived metadata . Might be extended in the future to support more attributes .


def Func ( arg_0 ) : arg_1 = arg_0 . getReportMetrics ( ) arg_1 . update ( arg_0 . getOptimizationMetrics ( ) ) return arg_1

def Func(arg_0):
    """Retrives a dictionary of metrics that combines all report and
    optimization metrics

    Parameters:
    ----------------------------------------------------------------------
    retval:         a dictionary of optimization metrics that were collected
                    for the model; an empty dictionary if there aren't any.
    """
    arg_1 = arg_0.getReportMetrics()
    arg_1.update(arg_0.getOptimizationMetrics())
    return arg_1


def Func ( arg_0 , arg_1 ) : if not hasattr ( arg_0 , 'vocabulary_' ) : arg_0 . _validate_vocabulary ( ) arg_0 . _check_vocabulary ( ) arg_2 = arg_0 . build_analyzer ( ) arg_3 = arg_0 . broadcast ( arg_0 . _count_vocab , arg_1 . context ) arg_1 = arg_1 . Func ( lambda X : list ( map ( arg_2 , X ) ) , column = 'X' ) . Func ( arg_3 , column = 'X' , dtype = sp . spmatrix ) return arg_1

def Func(arg_0, arg_1):
        """Transform documents to document-term matrix.

        Extract token counts out of raw text documents using the vocabulary
        fitted with fit or the one provided to the constructor.

        Parameters
        ----------
        raw_documents : iterable
            An iterable which yields either str, unicode or file objects.

        Returns
        -------
        X : sparse matrix, [n_samples, n_features]
            Document-term matrix.
        """
        if not hasattr(arg_0, 'vocabulary_'):
            arg_0._validate_vocabulary()

        arg_0._check_vocabulary()

        arg_2 = arg_0.build_analyzer()
        arg_3 = arg_0.broadcast(arg_0._count_vocab, arg_1.context)

        arg_1 = arg_1.Func(lambda X: list(map(arg_2, X)), column='X') \
             .Func(arg_3, column='X', dtype=sp.spmatrix)

        return arg_1

Transform documents to document - term matrix .


return "{" + ", ".join(str_exitcodes) + "}"

def
Func
(
arg_0
)
:
arg_1
=
[
"{}({})"
.
format
(
_get_exitcode_name
(
e
)
,
e
)
for
e
in
arg_0
if
e
is
not
]
return
"{"
+
", "
.
join
(
arg_1
)
+
"}"

def Func(arg_0):
    """Format a list of exit code with names of the signals if possible"""
    arg_1 = ["{}({})".format(_get_exitcode_name(e), e)
                     for e in arg_0 if e is not None]
    return "{" + ", ".join(arg_1) + "}"


def Func ( arg_0 , arg_1 = False ) : for arg_2 in arg_0 : for arg_3 in arg_2 . pre_tags : yield arg_3 if not arg_1 or not arg_2 . hide_when_equal : if arg_2 . trailing_whitespace : yield arg_2 . html ( ) + arg_2 . trailing_whitespace else : yield arg_2 . html ( ) for arg_4 in arg_2 . post_tags : yield arg_4

def Func(arg_0, arg_1=False):
    """Given a list of tokens, return a generator of the chunks of
    text for the data in the tokens.
    """
    for arg_2 in arg_0:
        for arg_3 in arg_2.pre_tags:
            yield arg_3
        if not arg_1 or not arg_2.hide_when_equal:
            if arg_2.trailing_whitespace:
                yield arg_2.html() + arg_2.trailing_whitespace
            else:
                yield arg_2.html()
        for arg_4 in arg_2.post_tags:
            yield arg_4

Given a list of tokens return a generator of the chunks of text for the data in the tokens .


def Func(arg_0, arg_1):
        """
        Normalize the values in the AudioSegment so that its `spl` property
        gives `db`.

        .. note:: This method is currently broken - it returns an AudioSegment whose
                  values are much smaller than reasonable, yet which yield an SPL value
                  that equals the given `db`. Such an AudioSegment will not be serializable
                  as a WAV file, which will also break any method that relies on SOX.
                  I may remove this method in the future, since the SPL of an AudioSegment is
                  pretty questionable to begin with.

        :param db: The decibels to normalize average to.
        :returns: A new AudioSegment object whose values are changed so that their
                  average is `db`.
        :raises: ValueError if there are no samples in this AudioSegment.
        """
        arg_2 = arg_0.to_numpy_array().copy()
        if len(arg_2) == 0:
            raise ValueError("Cannot normalize the SPL of an empty AudioSegment")

        def rms(arg_3):
            return np.sqrt(np.mean(np.square(arg_3)))

        # Figure out what RMS we would like
        arg_4 = P_REF_PCM * ((10 ** (arg_1/20.0)) - 1E-9)

        # Use successive approximation to solve
        ## Keep trying different multiplication factors until we get close enough or run out of time
        arg_5 = 50
        arg_6 = 0.0
        arg_7 = 0
        arg_8 = 0.1
        arg_9 = 0.0
        arg_10 = arg_4
        while (arg_7 < arg_5) and not util.isclose(arg_6, arg_4, abs_tol=0.1):
            arg_6 = rms(arg_2 * arg_8)
            if arg_6 < arg_4:
                arg_9 = arg_8
            else:
                arg_10 = arg_8
            arg_8 = 0.5 * (arg_9 + arg_10)
            arg_7 += 1

        arg_11 = {1: np.int8, 2: np.int16, 4: np.int32}
        arg_12 = arg_11[arg_0.sample_width]
        arg_13 = from_numpy_array(np.array(arg_2 * arg_8, arg_12=arg_12), arg_0.frame_rate)
        return arg_13

Normalize the values in the AudioSegment so that its spl property gives db .


(self, event, msgFormat, data, qos=0, on_publish=None)

return self._publishEvent(topic, event, msgFormat, data, qos, on_publish)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0, arg_5=None):
        """
        Publish an event to Watson IoT Platform.

        # Parameters
        event (string): Name of this event
        msgFormat (string): Format of the data for this event
        data (dict): Data for this event
        qos (int): MQTT quality of service level to use (`0`, `1`, or `2`)
        on_publish(function): A function that will be called when receipt
           of the publication is confirmed.

        # Callback and QoS
        The use of the optional #on_publish function has different implications depending
        on the level of qos used to publish the event:

        - qos 0: the client has asynchronously begun to send the event
        - qos 1 and 2: the client has confirmation of delivery from the platform
        """
        arg_6 = "iot-2/evt/{event}/fmt/{msg_format}".format(arg_1=arg_1, msg_format=arg_2)
        return arg_0._Func(arg_6, arg_1, arg_2, arg_3, arg_4, arg_5)

Publish an event to Watson IoT Platform .


def Func ( arg_0 , arg_1 ) : if arg_0 . _device is not None : arg_0 . close ( ) arg_0 . _device = Func ( '/dev/i2c-{0}' . format ( arg_1 ) , 'r+b' , buffering = 0 )

def Func(arg_0, arg_1):
        """Open the smbus interface on the specified bus."""
        # Close the device if it's already Func.
        if arg_0._device is not None:
            arg_0.close()
        # Try to Func the file for the specified bus.  Must turn off buffering
        # or else Python 3 fails (see: https://bugs.python.org/issue20074)
        arg_0._device = Func('/dev/i2c-{0}'.format(arg_1), 'r+b', buffering=0)

Open the smbus interface on the specified bus .


def Func(arg_0, arg_1, arg_2=arg_3):
    """
    Zips elementwise pairs between items1 and items2 into a dictionary. Values
    from items2 can be broadcast onto items1.

    Args:
        items1 (Iterable): full sequence
        items2 (Iterable): can either be a sequence of one item or a sequence
            of equal length to `items1`
        cls (Type[dict]): dictionary type to use. Defaults to dict, but could
            be ordered dict instead.

    Returns:
        dict: similar to dict(zip(items1, items2))

    Example:
        >>> assert Func([1, 2, 3], [4]) == {1: 4, 2: 4, 3: 4}
        >>> assert Func([1, 2, 3], [4, 4, 4]) == {1: 4, 2: 4, 3: 4}
        >>> assert Func([], [4]) == {}
    """
    try:
        len(arg_0)
    except TypeError:
        arg_0 = list(arg_0)
    try:
        len(arg_1)
    except TypeError:
        arg_1 = list(arg_1)
    if len(arg_0) == 0 and len(arg_1) == 1:
        # Corner case:
        # allow the first list to be empty and the second list to broadcast a
        # value. This means that the equality check wont work for the case
        # where items1 and items2 are supposed to correspond, but the length of
        # items2 is 1.
        arg_1 = []
    if len(arg_1) == 1 and len(arg_0) > 1:
        arg_1 = arg_1 * len(arg_0)
    if len(arg_0) != len(arg_1):
        raise ValueError('out of alignment len(items1)=%r, len(items2)=%r' % (
            len(arg_0), len(arg_1)))
    return arg_2(zip(arg_0, arg_1))

Zips elementwise pairs between items1 and items2 into a dictionary. Values
    from items2 can be broadcast onto items1.

    Args:
        items1 (Iterable): full sequence
        items2 (Iterable): can either be a sequence of one item or a sequence
            of equal length to `items1`
        cls (Type[dict]): dictionary type to use. Defaults to dict, but could
            be ordered dict instead.

    Returns:
        dict: similar to dict(zip(items1, items2))

    Example:
        >>> assert dzip([1, 2, 3], [4]) == {1: 4, 2: 4, 3: 4}
        >>> assert dzip([1, 2, 3], [4, 4, 4]) == {1: 4, 2: 4, 3: 4}
        >>> assert dzip([], [4]) == {}

Zips elementwise pairs between items1 and items2 into a dictionary . Values from items2 can be broadcast onto items1 .


def Func ( arg_0 , arg_1 ) : arg_2 = [ arg_0 . check_items ( [ p ] ) [ 0 ] for p in arg_1 ] arg_3 = { } arg_3 . update ( arg_0 . default_headers ( ) ) for arg_4 in chunks ( arg_2 , 50 ) : arg_5 = requests . post ( url = arg_0 . endpoint + "/{t}/{u}/items/" . format ( t = arg_0 . library_type , u = arg_0 . library_id ) , arg_3 = arg_3 , data = json . dumps ( arg_4 ) , ) arg_0 . request = arg_5 try : arg_5 . raise_for_status ( ) except requests . exceptions . HTTPError : error_handler ( arg_5 ) return True

def Func(arg_0, arg_1):
        """
        Update existing items
        Accepts one argument, a list of dicts containing Item data
        """
        arg_2 = [arg_0.check_items([p])[0] for p in arg_1]
        arg_3 = {}
        arg_3.update(arg_0.default_headers())
        # the API only accepts 50 items at a time, so we have to split
        # anything longer
        for arg_4 in chunks(arg_2, 50):
            arg_5 = requests.post(
                url=arg_0.endpoint
                + "/{t}/{u}/items/".format(t=arg_0.library_type, u=arg_0.library_id),
                arg_3=arg_3,
                data=json.dumps(arg_4),
            )
            arg_0.request = arg_5
            try:
                arg_5.raise_for_status()
            except requests.exceptions.HTTPError:
                error_handler(arg_5)
            return True

Update existing items Accepts one argument a list of dicts containing Item data


def Func ( arg_0 , arg_1 = None ) : arg_2 = re . match ( line_pattern , arg_0 ) if arg_2 : arg_3 , arg_4 , arg_5 , arg_6 , arg_7 = arg_2 . groups ( ) arg_4 = int ( arg_4 or 1 ) arg_5 = int ( arg_5 or 0 ) arg_8 = 2 if arg_6 == 'error' : arg_8 = 1 arg_9 = { 'source' : 'mypy' , 'range' : { 'start' : { 'line' : arg_4 - 1 , 'character' : arg_5 } , 'end' : { 'line' : arg_4 - 1 , 'character' : arg_5 + 1 } } , 'message' : arg_7 , 'severity' : arg_8 } if arg_1 : arg_10 = arg_1 . word_at_position ( arg_9 [ 'range' ] [ 'start' ] ) if arg_10 : arg_9 [ 'range' ] [ 'end' ] [ 'character' ] = ( arg_9 [ 'range' ] [ 'start' ] [ 'character' ] + len ( arg_10 ) ) return arg_9

def Func(arg_0, arg_1=None):
    '''
    Return a language-server diagnostic from a line of the Mypy error report;
    optionally, use the whole document to provide more context on it.
    '''
    arg_2 = re.match(line_pattern, arg_0)
    if arg_2:
        arg_3, arg_4, arg_5, arg_6, arg_7 = arg_2.groups()
        arg_4 = int(arg_4 or 1)
        arg_5 = int(arg_5 or 0)
        arg_8 = 2
        if arg_6 == 'error':
            arg_8 = 1
        arg_9 = {
            'source': 'mypy',
            'range': {
                'start': {'line': arg_4 - 1, 'character': arg_5},
                # There may be a better solution, but mypy does not provide end
                'end': {'line': arg_4 - 1, 'character': arg_5 + 1}
            },
            'message': arg_7,
            'severity': arg_8
        }
        if arg_1:
            # although mypy does not provide the end of the affected range, we
            # can make a good guess by highlighting the word that Mypy flagged
            arg_10 = arg_1.word_at_position(arg_9['range']['start'])
            if arg_10:
                arg_9['range']['end']['character'] = (
                    arg_9['range']['start']['character'] + len(arg_10))

        return arg_9

Return a language - server diagnostic from a line of the Mypy error report ; optionally use the whole document to provide more context on it .


def
Func
(
arg_0
,
arg_1
)
:
logger
.
debug
(
"[RUNNER] Starting"
)
def
execute_task
(
arg_2
)
:
arg_3
=
locals
(
)
arg_3
.
update
(
{
'__builtins__'
:
__builtins__
}
)
arg_4
,
arg_5
,
arg_6
=
unpack_apply_message
(
arg_2
,
arg_3
,
copy
=
False
)
arg_7
=
getattr
(
arg_4
,
'__name__'
,
'f'
)
arg_8
=
"parsl_"
arg_7
=
arg_8
+
"f"
arg_9
=
arg_8
+
"args"
arg_10
=
arg_8
+
"kwargs"
arg_11
=
arg_8
+
"result"
arg_3
.
update
(
{
arg_7
:
arg_4
,
arg_9
:
arg_5
,
arg_10
:
arg_6
,
arg_11
:
arg_11
}
)
arg_12
=
"{0} = {1}(*{2}, **{3})"
.
format
(
arg_11
,
arg_7
,
arg_9
,
arg_10
)
try
:
logger
.
debug
(
"[RUNNER] Executing: {0}"
.
format
(
arg_12
)
)
exec
(
arg_12
,
arg_3
,
arg_3
)
except
Exception
as
e
:
logger
.
warning
(
"Caught exception; will raise it: {}"
.
format
(
e
)
)
raise
e
else
:
logger
.
debug
(
"[RUNNER] Result: {0}"
.
format
(
arg_3
.
get
(
arg_11
)
)
)
return
arg_3
.
get
(
arg_11
)
while
True
:
try
:
arg_13
=
arg_0
.
get
(
block
=
True
,
timeout
=
10
)
except
queue
.
Empty
:
logger
.
debug
(
"[RUNNER] Queue is empty"
)
except
IOError
as
e
:
logger
.
debug
(
"[RUNNER] Broken pipe: {}"
.
format
(
e
)
)
try
:
arg_1
.
put
(
)
except
Exception
:
pass
break
except
Exception
as
e
:
logger
.
debug
(
"[RUNNER] Caught unknown exception: {}"
.
format
(
e
)
)
else
:
if
not
arg_13
:
logger
.
debug
(
"[RUNNER] Received exit request"
)
arg_1
.
put
(
)
break
else
:
logger
.
debug
(
"[RUNNER] Got a valid task with ID {}"
.
format
(
arg_13
[
"task_id"
]
)
)
try
:
arg_14
=
execute_task
(
arg_13
[
'buffer'
]
)
arg_15
=
{
"task_id"
:
arg_13
[
"task_id"
]
,
"result"
:
serialize_object
(
arg_14
)
}
logger
.
debug
(
"[RUNNER] Returing result: {}"
.
format
(
deserialize_object
(
arg_15
[
"result"
]
)
)
)
except
Exception
as
e
:
logger
.
debug
(
"[RUNNER] Caught task exception: {}"
.
format
(
e
)
)
arg_15
=
{
"task_id"
:
arg_13
[
"task_id"
]
,
"exception"
:
serialize_object
(
e
)
}
arg_1
.
put
(
arg_15
)
logger
.
debug
(
"[RUNNER] Terminating"
)

def Func(arg_0, arg_1):
    """This is a function that mocks the Swift-T side.

    It listens on the the incoming_q for tasks and posts returns on the outgoing_q.

    Args:
         - incoming_q (Queue object) : The queue to listen on
         - outgoing_q (Queue object) : Queue to post results on

    The messages posted on the incoming_q will be of the form :

    .. code:: python

       {
          "task_id" : <uuid.uuid4 string>,
          "buffer"  : serialized buffer containing the fn, args and kwargs
       }

    If ``None`` is received, the Func will exit.

    Response messages should be of the form:

    .. code:: python

       {
          "task_id" : <uuid.uuid4 string>,
          "result"  : serialized buffer containing result
          "exception" : serialized exception object
       }

    On exiting the Func will post ``None`` to the outgoing_q

    """
    logger.debug("[RUNNER] Starting")

    def execute_task(arg_2):
        """Deserialize the buffer and execute the task.

        Returns the serialized result or exception.
        """
        arg_3 = locals()
        arg_3.update({'__builtins__': __builtins__})

        arg_4, arg_5, arg_6 = unpack_apply_message(arg_2, arg_3, copy=False)

        arg_7 = getattr(arg_4, '__name__', 'f')
        arg_8 = "parsl_"
        arg_7 = arg_8 + "f"
        arg_9 = arg_8 + "args"
        arg_10 = arg_8 + "kwargs"
        arg_11 = arg_8 + "result"

        arg_3.update({arg_7: arg_4,
                        arg_9: arg_5,
                        arg_10: arg_6,
                        arg_11: arg_11})

        arg_12 = "{0} = {1}(*{2}, **{3})".format(arg_11, arg_7,
                                               arg_9, arg_10)

        try:
            logger.debug("[RUNNER] Executing: {0}".format(arg_12))
            exec(arg_12, arg_3, arg_3)

        except Exception as e:
            logger.warning("Caught exception; will raise it: {}".format(e))
            raise e

        else:
            logger.debug("[RUNNER] Result: {0}".format(arg_3.get(arg_11)))
            return arg_3.get(arg_11)

    while True:
        try:
            # Blocking wait on the queue
            arg_13 = arg_0.get(block=True, timeout=10)

        except queue.Empty:
            # Handle case where no items were in the queue
            logger.debug("[RUNNER] Queue is empty")

        except IOError as e:
            logger.debug("[RUNNER] Broken pipe: {}".format(e))
            try:
                # Attempt to send a stop notification to the management thread
                arg_1.put(None)

            except Exception:
                pass

            break

        except Exception as e:
            logger.debug("[RUNNER] Caught unknown exception: {}".format(e))

        else:
            # Handle received message
            if not arg_13:
                # Empty message is a die request
                logger.debug("[RUNNER] Received exit request")
                arg_1.put(None)
                break
            else:
                # Received a valid message, handle it
                logger.debug("[RUNNER] Got a valid task with ID {}".format(arg_13["task_id"]))
                try:
                    arg_14 = execute_task(arg_13['buffer'])
                    arg_15 = {"task_id": arg_13["task_id"],
                                "result": serialize_object(arg_14)}

                    logger.debug("[RUNNER] Returing result: {}".format(
                                   deserialize_object(arg_15["result"])))

                except Exception as e:
                    logger.debug("[RUNNER] Caught task exception: {}".format(e))
                    arg_15 = {"task_id": arg_13["task_id"],
                                "exception": serialize_object(e)}

                arg_1.put(arg_15)

    logger.debug("[RUNNER] Terminating")

This is a function that mocks the Swift-T side.

    It listens on the the incoming_q for tasks and posts returns on the outgoing_q.

    Args:
         - incoming_q (Queue object) : The queue to listen on
         - outgoing_q (Queue object) : Queue to post results on

    The messages posted on the incoming_q will be of the form :

    .. code:: python

       {
          "task_id" : <uuid.uuid4 string>,
          "buffer"  : serialized buffer containing the fn, args and kwargs
       }

    If ``None`` is received, the runner will exit.

    Response messages should be of the form:

    .. code:: python

       {
          "task_id" : <uuid.uuid4 string>,
          "result"  : serialized buffer containing result
          "exception" : serialized exception object
       }

    On exiting the runner will post ``None`` to the outgoing_q

This is a function that mocks the Swift - T side .


def Func(arg_0, arg_1=0.0):
        '''Apply a DC shift to the audio.

        Parameters
        ----------
        shift : float
            Amount to shift audio between -2 and 2. (Audio is between -1 and 1)

        See Also
        --------
        highpass

        '''
        if not is_number(arg_1) or arg_1 < -2 or arg_1 > 2:
            raise ValueError('shift must be a number between -2 and 2.')

        arg_2 = ['Func', '{:f}'.format(arg_1)]

        arg_0.effects.extend(arg_2)
        arg_0.effects_log.append('Func')
        return arg_0


def Func ( arg_0 , ** arg_1 ) : arg_2 = [ ] for arg_3 in arg_0 . _generateFind ( ** arg_1 ) : arg_2 . append ( arg_3 ) return arg_2

def Func(arg_0, **arg_1):
        """Return a list of all children that match the specified criteria."""
        arg_2 = []
        for arg_3 in arg_0._generateFind(**arg_1):
            arg_2.append(arg_3)
        return arg_2

Return a list of all children that match the specified criteria .


def Func(arg_0):
        """
        Set all led's to off.
        """
        for arg_1 in range(0, 8):
            arg_0.firmata.i2c_write(0x70, arg_1 * 2, 0, 0)
            arg_0.firmata.i2c_write(0x70, (arg_1 * 2) + 1, 0, 0)

            for arg_2 in range(0, 8):
                arg_0.display_buffer[arg_1][arg_2] = 0


return self._driver._execute(command, data, unpack)

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = True ) : if not arg_2 : arg_2 = { } arg_2 . setdefault ( 'element_id' , arg_0 . element_id ) return arg_0 . _driver . Func ( arg_1 , arg_2 , arg_3 )

def Func(arg_0, arg_1, arg_2=None, arg_3=True):
        """Private method to execute command with data.

        Args:
            command(Command): The defined command.
            data(dict): The uri variable and body.

        Returns:
            The unwrapped value field in the json response.
        """
        if not arg_2:
            arg_2 = {}
        arg_2.setdefault('element_id', arg_0.element_id)
        return arg_0._driver.Func(arg_1, arg_2, arg_3)

Private method to execute command with data .


def Func(arg_0, arg_1):
        """Adds classes or paths to classes to the trajectory to create custom parameters.

        :param dynamic_imports:

            If you've written custom parameter that needs to be loaded dynamically during runtime,
            this needs to be specified here as a list of classes or strings naming classes
            and there module paths. For example:
            `dynamic_imports = ['pypet.parameter.PickleParameter',MyCustomParameter]`

            If you only have a single class to import, you do not need the list brackets:
            `dynamic_imports = 'pypet.parameter.PickleParameter'`

        """

        if not isinstance(arg_1, (list, tuple)):
            arg_1 = [arg_1]

        for arg_2 in arg_1:
            if not (isinstance(arg_2, str) or inspect.isclass(arg_2)):
                raise TypeError('Your dynamic import `%s` is neither a class nor a string.' %
                                str(arg_2))

        arg_0._dynamic_imports.extend(arg_1)

Adds classes or paths to classes to the trajectory to create custom parameters .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 = None ) : if not arg_3 : arg_3 = arg_0 . _default_placement ( arg_2 ) arg_0 . _resources . append ( FragmentResource ( 'url' , arg_1 , arg_2 , arg_3 ) )

def Func(arg_0, arg_1, arg_2, arg_3=None):
        """
        Add a resource by URL needed by this Fragment.

        Other helpers, such as :func:`add_css_url` or
        :func:`add_javascript_url` are more convenent for those common types of
        resource.

        `url`: the URL to the resource.

        Other parameters are as defined for :func:`add_resource`.
        """
        if not arg_3:
            arg_3 = arg_0._default_placement(arg_2)
        arg_0._resources.append(FragmentResource('url', arg_1, arg_2, arg_3))

Add a resource by URL needed by this Fragment .


def Func(arg_0):
        """The instruction after this one or None.

        :return: the instruction in :attr:`row_instructions` after this or
          :obj:`None` if this is the last
        :rtype: knittingpattern.Instruction.InstructionInRow

        This can be used to traverse the instructions.

        .. seealso:: :attr:`previous_instruction_in_row`
        """
        arg_1 = arg_0.index_in_row + 1
        if arg_1 >= len(arg_0.row_instructions):
            return None
        return arg_0.row_instructions[arg_1]

The instruction after this one or None .


Adjust the current transformation state of the current graphics state
        matrix. Not recommended for the faint of heart.

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):
        """ Adjust the current Funcation state of the current graphics state
        matrix. Not recommended for the faint of heart.
        """
        arg_7, arg_8, arg_9, arg_10, arg_11, arg_12 = arg_0._currentMatrix
        arg_0._currentMatrix = (arg_7 * arg_1 + arg_9 * arg_2, arg_8 * arg_1 + arg_10 * arg_2,
                               arg_7 * arg_3 + arg_9 * arg_4, arg_8 * arg_3 + arg_10 * arg_4,
                               arg_7 * arg_5 + arg_9 * arg_6 + arg_11, arg_8 * arg_5 + arg_10 * arg_6 + arg_12)
        arg_14, arg_15, arg_16, arg_17, arg_18, arg_19 = arg_0._currentMatrix
        arg_0.session._out('%.2f %.2f %.2f %.2f %.2f %.2f cm' % (arg_14, arg_15, arg_16, arg_17, arg_18, arg_19), arg_0.page)

Adjust the current transformation state of the current graphics state matrix . Not recommended for the faint of heart .


def
Func
(
arg_0
,
arg_1
)
:
lg
.
info
(
'Reading water absorption from file'
)
try
:
arg_0
.
a_water
=
arg_0
.
_read_iop_from_file
(
arg_1
)
except
:
lg
.
exception
(
'Problem reading file :: '
+
arg_1
)

def Func(arg_0, arg_1):
        """Read the pure water absorption from a csv formatted file

        :param file_name: filename and path of the csv file
        """
        lg.info('Reading water absorption from file')
        try:
            arg_0.a_water = arg_0._read_iop_from_file(arg_1)
        except:
            lg.exception('Problem reading file :: ' + arg_1)


def Func ( ) : arg_0 = check_output_demoted ( [ 'VBoxManage' , 'list' , 'runningvms' ] ) for arg_1 in arg_0 . splitlines ( ) : if '"{}"' . format ( constants . VM_MACHINE_NAME ) in arg_1 : return True return False

def Func():
    """Using VBoxManage is 0.5 seconds or so faster than Machine."""
    arg_0 = check_output_demoted(['VBoxManage', 'list', 'runningvms'])
    for arg_1 in arg_0.splitlines():
        if '"{}"'.format(constants.VM_MACHINE_NAME) in arg_1:
            return True
    return False

Using VBoxManage is 0 . 5 seconds or so faster than Machine .


def Func ( arg_0 , arg_1 ) : for arg_2 in arg_1 : if 'start' in arg_2 : arg_2 [ 'start' ] = parser . parse ( arg_2 [ 'start' ] ) if 'stop' in arg_2 : arg_2 [ 'stop' ] = parser . parse ( arg_2 [ 'stop' ] ) return arg_1

def Func(arg_0, arg_1):
        """ load steps -> basically load all the datetime isoformats into datetimes """
        for arg_2 in arg_1:
            if 'start' in arg_2:
                arg_2['start'] = parser.parse(arg_2['start'])
            if 'stop' in arg_2:
                arg_2['stop'] = parser.parse(arg_2['stop'])
        return arg_1

load steps - > basically load all the datetime isoformats into datetimes


def Func(arg_0):
    """A template tag to return the project's home URL and label
    formatted as a Bootstrap 4 breadcrumb.

    PROJECT_HOME_NAMESPACE must be defined in settings, for example:
        PROJECT_HOME_NAMESPACE = 'project_name:index_view'

    Usage Example:
        {% load project_home_tags %}

          {% Func %}    {# <--- #}

List of Objects

Object Detail

    This gets converted into:

Home
    {# <--- #}

List of Objects

Object Detail

    By default, the link's text is 'Home'. A project-wide label can be
    defined with PROJECT_HOME_LABEL in settings. Both the default and
    the project-wide label can be overridden by passing a string to
    the template tag.

    For example:
        {% Func 'Custom Label' %}
    """
    arg_1 = home_url()
    if arg_1:
        return format_html(
            '
{}
',
            arg_1, arg_0)
    else:
        return format_html(
            '
{}
',
            arg_0)

A template tag to return the project's home URL and label
    formatted as a Bootstrap 4 breadcrumb.

    PROJECT_HOME_NAMESPACE must be defined in settings, for example:
        PROJECT_HOME_NAMESPACE = 'project_name:index_view'

    Usage Example:
        {% load project_home_tags %}

          {% project_home_breadcrumb_bs4 %}    {# <--- #}

List of Objects

Object Detail

    This gets converted into:

Home
    {# <--- #}

List of Objects

Object Detail

    By default, the link's text is 'Home'. A project-wide label can be
    defined with PROJECT_HOME_LABEL in settings. Both the default and
    the project-wide label can be overridden by passing a string to
    the template tag.

    For example:
        {% project_home_breadcrumb_bs4 'Custom Label' %}

A template tag to return the project s home URL and label formatted as a Bootstrap 4 breadcrumb .


def Func ( arg_0 ) : arg_1 = set ( get_netnode_plugin_names ( ) ) if arg_0 in arg_1 : return arg_1 . add ( arg_0 ) arg_2 ( ) [ arg_3 ] = json . dumps ( list ( arg_1 ) )

def Func(arg_0):
    """
    Add the given plugin name to the list of plugin names registered in
      the current IDB.
    Note that this implicitly uses the open IDB via the idc iterface.
    """
    arg_1 = set(get_netnode_plugin_names())
    if arg_0 in arg_1:
        return

    arg_1.add(arg_0)

    arg_2()[arg_3] = json.dumps(list(arg_1))

Add the given plugin name to the list of plugin names registered in the current IDB . Note that this implicitly uses the open IDB via the idc iterface .


(self, additional_columns=None, only_show=None, sep=',')

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = ',' ) : arg_1 = arg_1 or [ ] if arg_2 is not None : arg_4 = _uniquify ( arg_2 ) else : arg_4 = _uniquify ( arg_0 . DEFAULT_COLUMNS + arg_1 ) arg_5 = [ arg_0 . _get_attrib ( c , convert_to_str = True ) for c in arg_4 ] return arg_3 . join ( arg_5 )

def Func(arg_0, arg_1=None, arg_2=None, arg_3=','):
        """
        Returns a representation of the host as a single line, with columns
        joined by ``sep``.

        :param additional_columns: Columns to show in addition to defaults.
        :type additional_columns: ``list`` of ``str``
        :param only_show: A specific list of columns to show.
        :type only_show: ``NoneType`` or ``list`` of ``str``
        :param sep: The column separator to use.
        :type sep: ``str``

        :rtype: ``str``
        """
        arg_1 = arg_1 or []
        if arg_2 is not None:
            arg_4 = _uniquify(arg_2)
        else:
            arg_4 = _uniquify(arg_0.DEFAULT_COLUMNS + arg_1)
        arg_5 = [arg_0._get_attrib(c, convert_to_str=True) for c in arg_4]
        return arg_3.join(arg_5)

Returns a representation of the host as a single line with columns joined by sep .


def
Func
(
arg_0
)
:
arg_1
=
0
while
True
:
try
:
arg_2
=
requests
.
get
(
"http://%s:4646/v1/status/leader"
%
arg_0
)
if
arg_2
.
status_code
==
200
:
break
except
:
Log
.
debug
(
sys
.
exc_info
(
)
[
0
]
)
Log
.
info
(
"Waiting for cluster to come up... %s"
%
arg_1
)
time
.
sleep
(
1
)
if
arg_1
>
10
:
Log
.
error
(
"Failed to start Nomad Cluster!"
)
sys
.
exit
(
1
)
arg_1
=
arg_1
+
1

def Func(arg_0):
  '''
  Wait for a nomad master to start
  '''
  arg_1 = 0
  while True:
    try:
      arg_2 = requests.get("http://%s:4646/v1/status/leader" % arg_0)
      if arg_2.status_code == 200:
        break
    except:
      Log.debug(sys.exc_info()[0])
      Log.info("Waiting for cluster to come up... %s" % arg_1)
      time.sleep(1)
      if arg_1 > 10:
        Log.error("Failed to start Nomad Cluster!")
        sys.exit(-1)
    arg_1 = arg_1 + 1


def Func ( arg_0 ) : arg_1 = tf . constant ( 0.5 * np . sqrt ( 2. ) , dtype = arg_0 . dtype , name = "half_sqrt_2" ) arg_2 = arg_0 * arg_1 arg_3 = tf . abs ( arg_2 ) arg_4 = tf . where ( tf . less ( arg_3 , arg_1 ) , 1. + tf . math . erf ( arg_2 ) , tf . where ( tf . greater ( arg_2 , 0. ) , 2. - tf . math . erfc ( arg_3 ) , tf . math . erfc ( arg_3 ) ) ) return 0.5 * arg_4

def Func(arg_0):
  """Implements ndtr core logic."""
  arg_1 = tf.constant(
      0.5 * np.sqrt(2.), dtype=arg_0.dtype, name="half_sqrt_2")
  arg_2 = arg_0 * arg_1
  arg_3 = tf.abs(arg_2)
  arg_4 = tf.where(
      tf.less(arg_3, arg_1), 1. + tf.math.erf(arg_2),
      tf.where(tf.greater(arg_2, 0.), 2. - tf.math.erfc(arg_3), tf.math.erfc(arg_3)))
  return 0.5 * arg_4


def Func ( arg_0 , arg_1 ) : arg_2 = { } arg_3 = get_field ( arg_0 , 'distinguishedName' ) arg_2 [ 'domain' ] = "." . join ( arg_3 . split ( ',DC=' ) [ 1 : ] ) arg_2 [ 'name' ] = get_field ( arg_0 , 'name' ) arg_2 [ 'username' ] = get_field ( arg_0 , 'sAMAccountName' ) arg_2 [ 'description' ] = get_field ( arg_0 , 'description' ) arg_2 [ 'sid' ] = get_field ( arg_0 , 'objectSid' ) . split ( '-' ) [ - 1 ] arg_4 = get_field ( arg_0 , 'primaryGroupID' ) arg_5 = arg_0 [ 'attributes' ] . get ( 'memberOf' , [ ] ) arg_6 = [ ] for arg_7 in arg_5 : for arg_8 in arg_7 . split ( ',' ) : if arg_8 . startswith ( 'CN=' ) : arg_6 . append ( arg_8 [ 3 : ] ) arg_6 . append ( arg_1 . get ( arg_4 , '' ) ) arg_2 [ 'groups' ] = arg_6 arg_9 = [ ] try : arg_10 = int ( get_field ( arg_0 , 'userAccountControl' ) ) for arg_11 , arg_12 in uac_flags . items ( ) : if arg_10 & arg_12 : arg_9 . append ( arg_11 ) except ValueError : pass arg_2 [ 'flags' ] = arg_9 return arg_2

def Func(arg_0, arg_1):
    """
        Parses a single entry from the domaindump
    """
    arg_2 = {}
    arg_3 = get_field(arg_0, 'distinguishedName')
    arg_2['domain'] = ".".join(arg_3.split(',DC=')[1:])
    arg_2['name'] = get_field(arg_0, 'name')
    arg_2['username'] = get_field(arg_0, 'sAMAccountName')
    arg_2['description'] = get_field(arg_0, 'description')
    arg_2['sid'] = get_field(arg_0, 'objectSid').split('-')[-1]

    arg_4 = get_field(arg_0, 'primaryGroupID')
    arg_5 = arg_0['attributes'].get('memberOf', [])
    arg_6 = []
    for arg_7 in arg_5:
        for arg_8 in arg_7.split(','):
            if arg_8.startswith('CN='):
                arg_6.append(arg_8[3:])
    arg_6.append(arg_1.get(arg_4, ''))
    arg_2['groups'] = arg_6

    arg_9 = []
    try:
        arg_10 = int(get_field(arg_0, 'userAccountControl'))

        for arg_11, arg_12 in uac_flags.items():
            if arg_10 & arg_12:
                arg_9.append(arg_11)
    except ValueError:
        pass
    arg_2['flags'] = arg_9
    return arg_2


def Func(arg_0, arg_1: arg_2):
        """Get the arena image URL

        Parameters
        ---------
        obj: official_api.models.BaseAttrDict
            An object that has the arena ID in ``.arena.id``
            Can be ``Profile`` for example.

        Returns None or str
        """
        arg_3 = arg_1.arena.id
        for arg_4 in arg_0.constants.arenas:
            if arg_4.id == arg_3:
                return 'https://royaleapi.github.io/cr-api-assets/arenas/arena{}.png'.format(arg_4.arena_id)


def Func(arg_0, arg_1):
        """Return the source file for `filename`."""
        if not arg_1.endswith(".py"):
            if arg_1[-4:-1] == ".py":
                arg_1 = arg_1[:-1]
            elif arg_1.endswith("$py.class"): # jython
                arg_1 = arg_1[:-9] + ".py"
        return arg_1


def Func ( arg_0 , arg_1 , arg_2 = True ) : if arg_2 : arg_3 = [ ] arg_3 = arg_0 . validate ( arg_3 ) if arg_3 : raise InvalidDocumentError ( arg_3 ) arg_4 = Writer ( arg_0 , arg_1 ) arg_4 . write ( )

def Func(arg_0, arg_1, arg_2=True):
    """
    Write an SPDX RDF document.
    - document - spdx.document instance.
    - out - file like object that will be written to.
    Optionally `validate` the document before writing and raise
    InvalidDocumentError if document.validate returns False.
    """

    if arg_2:
        arg_3 = []
        arg_3 = arg_0.validate(arg_3)
        if arg_3:
            raise InvalidDocumentError(arg_3)

    arg_4 = Writer(arg_0, arg_1)
    arg_4.write()

Write an SPDX RDF document . - document - spdx . document instance . - out - file like object that will be written to . Optionally validate the document before writing and raise InvalidDocumentError if document . validate returns False .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
logger
.
info
(
"DEALLOCATE(0x%08x, %d)"
%
(
arg_2
,
arg_3
)
)
if
arg_2
&
0xfff
!=
0
:
logger
.
info
(
"DEALLOCATE: addr is not page aligned"
)
return
Decree
.
CGC_EINVAL
if
arg_3
==
0
:
logger
.
info
(
"DEALLOCATE:length is zero"
)
return
Decree
.
CGC_EINVAL
arg_1
.
memory
.
munmap
(
arg_2
,
arg_3
)
arg_0
.
syscall_trace
.
append
(
(
"_deallocate"
,
1
,
arg_3
)
)
return
0

def Func(arg_0, arg_1, arg_2, arg_3):
        """ deallocate - remove allocations
        The  deallocate  system call deletes the allocations for the specified
        address range, and causes further references to the addresses within the
        range to generate invalid memory accesses. The region is also
        automatically deallocated when the process is terminated.

        The address addr must be a multiple of the page size.  The length parameter
        specifies the size of the region to be deallocated in bytes.  All pages
        containing a part of the indicated range are deallocated, and subsequent
        references will terminate the process.  It is not an error if the indicated
        range does not contain any allocated pages.

        The deallocate function is invoked through system call number 6.

        :param cpu: current CPU
        :param addr: the starting address to unmap.
        :param size: the size of the portion to unmap.
        :return 0        On success
                EINVAL   addr is not page aligned.
                EINVAL   length is zero.
                EINVAL   any  part  of  the  region  being  deallocated  is outside the valid
                         address range of the process.

        :param cpu: current CPU.
        :return: C{0} on success.
        """
        logger.info("DEALLOCATE(0x%08x, %d)" % (arg_2, arg_3))

        if arg_2 & 0xfff != 0:
            logger.info("DEALLOCATE: addr is not page aligned")
            return Decree.CGC_EINVAL
        if arg_3 == 0:
            logger.info("DEALLOCATE:length is zero")
            return Decree.CGC_EINVAL
        # unlikely AND WRONG!!!
        # if addr > Decree.CGC_SSIZE_MAX or addr+size > Decree.CGC_SSIZE_MAX:
        #    logger.info("DEALLOCATE: part of the region being deallocated is outside the valid address range of the process")
        #    return Decree.CGC_EINVAL

        arg_1.memory.munmap(arg_2, arg_3)
        arg_0.syscall_trace.append(("_deallocate", -1, arg_3))
        return 0

deallocate - remove allocations The deallocate system call deletes the allocations for the specified address range and causes further references to the addresses within the range to generate invalid memory accesses . The region is also automatically deallocated when the process is terminated .


def Func(arg_0, arg_1):
  """ Generates the token substitutions related to the predicted field
  and the supplemental arguments for prediction
  """
  arg_2 = arg_0['inferenceType']
  arg_3 = arg_0.get('inferenceArgs', None)
  arg_4 = {}
  arg_5 = _getPredictedField(arg_0)[0]

  if arg_2 in (InferenceType.TemporalNextStep,
                       InferenceType.TemporalAnomaly):
    assert arg_5,  "Inference Type '%s' needs a predictedField "\
                            "specified in the inferenceArgs dictionary"\
                            % arg_2

  if arg_3:
    # If we will be using a dynamically created predictionSteps, plug in that
    #  variable name in place of the constant scalar value
    if arg_0['dynamicPredictionSteps']:
      arg_6 = copy.deepcopy(arg_3)
      arg_6['predictionSteps'] = '$REPLACE_ME'
      arg_4 = pprint.pformat(arg_6)
      arg_4 = arg_4.replace("'$REPLACE_ME'",
                                                        '[predictionSteps]')
    else:
      arg_4 = pprint.pformat(arg_3)

  arg_1['\$INFERENCE_ARGS'] = arg_4

  arg_1['\$PREDICTION_FIELD'] = arg_5


def
Func
(
arg_0
)
:
arg_0
.
log
.
debug
(
"Func(): Sending ping to API.."
)
arg_0
.
socket
.
send
(
json
.
dumps
(
{
'event'
:
'ping'
}
)
)
arg_0
.
pong_timer
=
Timer
(
arg_0
.
pong_timeout
,
arg_0
.
_check_pong
)
arg_0
.
pong_timer
.
start
(
)

def Func(arg_0):
        """Sends a ping message to the API and starts pong timers.

        :return:
        """
        arg_0.log.debug("Func(): Sending ping to API..")
        arg_0.socket.send(json.dumps({'event': 'ping'}))
        arg_0.pong_timer = Timer(arg_0.pong_timeout, arg_0._check_pong)
        arg_0.pong_timer.start()

Sends a ping message to the API and starts pong timers .


def Func(arg_0, arg_1):
        """ Enqueue task with specified data. """
        arg_2 = json.dumps(arg_1)
        with arg_0._db_conn() as conn:
            return conn.execute(
                'INSERT INTO %s (created, data) VALUES (%%(created)s, %%(data)s)' % arg_0.table_name,
                created=datetime.utcnow(),
                arg_1=arg_2
            )


(private_key, data, hash_algorithm, rsa_pss_padding=False)

def Func(arg_0, arg_1, arg_2, arg_3=False):
    """
    Generates an RSA, DSA or ECDSA signature via CNG

    :param private_key:
        The PrivateKey to generate the signature with

    :param data:
        A byte string of the data the signature is for

    :param hash_algorithm:
        A unicode string of "md5", "sha1", "sha256", "sha384", "sha512" or "raw"

    :param rsa_pss_padding:
        If PSS padding should be used for RSA keys

    :raises:
        ValueError - when any of the parameters contain an invalid value
        TypeError - when any of the parameters are of the wrong type
        OSError - when an error is returned by the OS crypto library

    :return:
        A byte string of the signature
    """

    if arg_2 == 'raw':
        arg_4 = arg_1
    else:
        arg_5 = {
            'md5': BcryptConst.BCRYPT_MD5_ALGORITHM,
            'sha1': BcryptConst.BCRYPT_SHA1_ALGORITHM,
            'sha256': BcryptConst.BCRYPT_SHA256_ALGORITHM,
            'sha384': BcryptConst.BCRYPT_SHA384_ALGORITHM,
            'sha512': BcryptConst.BCRYPT_SHA512_ALGORITHM
        }[arg_2]

        arg_4 = getattr(hashlib, arg_2)(arg_1).digest()

    arg_6 = null()
    arg_7 = 0

    if arg_0.algorithm == 'rsa':
        if arg_3:
            arg_8 = {
                'md5': 16,
                'sha1': 20,
                'sha256': 32,
                'sha384': 48,
                'sha512': 64
            }[arg_2]

            arg_7 = BcryptConst.BCRYPT_PAD_PSS
            arg_9 = struct(bcrypt, 'BCRYPT_PSS_PADDING_INFO')
            arg_10 = unwrap(arg_9)
            # This has to be assigned to a variable to prevent cffi from gc'ing it
            arg_11 = buffer_from_unicode(arg_5)
            arg_10.pszAlgId = cast(bcrypt, 'wchar_t *', arg_11)
            arg_10.cbSalt = arg_8
        else:
            arg_7 = BcryptConst.BCRYPT_PAD_PKCS1
            arg_9 = struct(bcrypt, 'BCRYPT_PKCS1_PADDING_INFO')
            arg_10 = unwrap(arg_9)
            # This has to be assigned to a variable to prevent cffi from gc'ing it
            if arg_2 == 'raw':
                arg_10.pszAlgId = null()
            else:
                arg_11 = buffer_from_unicode(arg_5)
                arg_10.pszAlgId = cast(bcrypt, 'wchar_t *', arg_11)
        arg_6 = cast(bcrypt, 'void *', arg_9)

    if arg_0.algorithm == 'dsa' and arg_0.bit_size > 1024 and arg_2 in set(['md5', 'sha1']):
        raise ValueError(pretty_message(
            '''
            Windows does not support sha1 signatures with DSA keys based on
            sha224, sha256 or sha512
            '''
        ))

    arg_14 = new(bcrypt, 'DWORD *')
    arg_15 = bcrypt.BCryptSignHash(
        arg_0.key_handle,
        arg_6,
        arg_4,
        len(arg_4),
        null(),
        0,
        arg_14,
        arg_7
    )
    handle_error(arg_15)

    arg_16 = deref(arg_14)
    arg_17 = buffer_from_bytes(arg_16)

    if arg_0.algorithm == 'rsa':
        arg_6 = cast(bcrypt, 'void *', arg_9)

    arg_15 = bcrypt.BCryptSignHash(
        arg_0.key_handle,
        arg_6,
        arg_4,
        len(arg_4),
        arg_17,
        arg_16,
        arg_14,
        arg_7
    )
    handle_error(arg_15)
    arg_18 = bytes_from_buffer(arg_17, deref(arg_14))

    if arg_0.algorithm != 'rsa':
        # Windows doesn't use the ASN.1 Sequence for DSA/ECDSA signatures,
        # so we have to convert it here for the verification to work
        arg_18 = algos.DSASignature.from_p1363(arg_18).dump()

    return arg_18

Generates an RSA DSA or ECDSA signature via CNG


def Func ( arg_0 , arg_1 , ** arg_2 ) : try : arg_3 = arg_0 . render_context [ BLOCK_CONTEXT_KEY ] except KeyError : arg_3 = BlockContext ( ) if not isinstance ( arg_1 , ( list , tuple ) ) : arg_1 = [ arg_1 ] for arg_4 in arg_1 : arg_4 = arg_3 . get_block ( arg_4 ) if arg_4 : break else : return '' with arg_0 . push ( arg_2 ) : return arg_4 . render ( arg_0 )

def Func(arg_0, arg_1, **arg_2):
    '''
    Allow Func of a block within a template.

    {% Func '_myblock' foo=bar %}

    If passed a list of block names, will use the first that matches:

    {% Func list_of_block_names .... %}
    '''
    try:
        arg_3 = arg_0.render_context[BLOCK_CONTEXT_KEY]
    except KeyError:
        arg_3 = BlockContext()

    if not isinstance(arg_1, (list, tuple)):
        arg_1 = [arg_1]

    for arg_4 in arg_1:
        arg_4 = arg_3.get_block(arg_4)
        if arg_4:
            break
    else:
        return ''

    with arg_0.push(arg_2):
        return arg_4.render(arg_0)

Allow reuse of a block within a template.

    {% reuse '_myblock' foo=bar %}

    If passed a list of block names, will use the first that matches:

    {% reuse list_of_block_names .... %}

Allow reuse of a block within a template .


def Func ( arg_0 , arg_1 , arg_2 ) : Func = VCL ( ) Func . conn = arg_0 . conn Func . attrs = { 'service_id' : arg_0 . attrs [ 'service_id' ] , 'version' : arg_0 . attrs [ 'number' ] , 'name' : arg_1 , 'content' : arg_2 , } Func . save ( ) return Func

def Func(arg_0, arg_1, arg_2):
        """ Create a new VCL under this version. """
        Func = VCL()
        Func.conn = arg_0.conn

        Func.attrs = {
            # Parent params
            'service_id': arg_0.attrs['service_id'],
            'version': arg_0.attrs['number'],

            # New instance params
            'name': arg_1,
            'content': arg_2,
        }

        Func.save()

        return Func


def Func(arg_0, arg_1='vvv', arg_2=None):
        """
        Set the verbosity level of a certain log handler or of all handlers.

        Parameters
        ----------
        verbosity : 'v' to 'vvvvv'
            the level of verbosity, more v's is more verbose

        handlers : string, or list of strings
            handler names can be found in ``peri.logger.types.keys()``
            Current set is::

                ['console-bw', 'console-color', 'rotating-log']
        """
        arg_0.verbosity = sanitize(arg_1)
        arg_0.set_level(v2l[arg_1], arg_2=arg_2)
        arg_0.set_formatter(v2f[arg_1], arg_2=arg_2)

Set the verbosity level of a certain log handler or of all handlers .


def Func ( arg_0 ) : arg_0 . include ( 'pyramid_jinja2' ) arg_0 . add_jinja2_renderer ( '.html' ) arg_0 . add_jinja2_renderer ( '.rss' ) arg_0 . add_static_view ( name = '/a/static' , path = "cnxpublishing:static/" ) arg_0 . commit ( ) from cnxdb . ident_hash import join_ident_hash for arg_1 in ( '.html' , '.rss' , ) : arg_2 = arg_0 . get_jinja2_environment ( arg_1 ) arg_2 . globals . update ( join_ident_hash = join_ident_hash , ) declare_api_routes ( arg_0 ) declare_browsable_routes ( arg_0 )

def Func(arg_0):
    """Declare all routes."""
    arg_0.include('pyramid_jinja2')
    arg_0.add_jinja2_renderer('.html')
    arg_0.add_jinja2_renderer('.rss')
    arg_0.add_static_view(name='/a/static', path="cnxpublishing:static/")

    # Commit the configuration otherwise the jija2_env won't have
    # a `globals` assignment.
    arg_0.commit()

    # Place a few globals in the template environment.
    from cnxdb.ident_hash import join_ident_hash
    for arg_1 in ('.html', '.rss',):
        arg_2 = arg_0.get_jinja2_environment(arg_1)
        arg_2.globals.update(
            join_ident_hash=join_ident_hash,
        )

    declare_api_routes(arg_0)
    declare_browsable_routes(arg_0)


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
[
god
for
god
in
arg_0
.
gods
.
values
(
)
if
god
.
chromosomes
==
'XX'
]
arg_3
=
[
god
for
god
in
arg_0
.
gods
.
values
(
)
if
god
.
chromosomes
==
'XY'
]
for
arg_4
in
range
(
arg_1
)
:
print
(
"\nGENERATION %d\n"
%
(
arg_4
+
1
)
)
arg_5
=
[
]
arg_6
=
[
]
for
arg_7
in
arg_2
:
arg_8
=
random
.
choice
(
arg_3
)
arg_9
=
arg_0
.
breed
(
arg_7
,
arg_8
)
for
arg_10
in
arg_9
:
if
arg_10
.
divinity
>
human
:
arg_0
.
add_god
(
arg_10
)
if
arg_10
.
chromosomes
==
'XX'
:
arg_5
.
append
(
arg_10
)
else
:
arg_6
.
append
(
arg_10
)
arg_2
=
[
ed
for
ed
in
arg_2
if
ed
.
generation
>
(
arg_4
2
)
]
arg_3
=
[
sd
for
sd
in
arg_3
if
sd
.
generation
>
(
arg_4
3
)
]
arg_2
+=
arg_5
arg_3
+=
arg_6

def Func(arg_0, arg_1):
        """Grow this Pantheon by multiplying Gods."""
        arg_2 = [god for god in arg_0.gods.values() if god.chromosomes == 'XX']
        arg_3 = [god for god in arg_0.gods.values() if god.chromosomes == 'XY']

        for arg_4 in range(arg_1):
            print("\nGENERATION %d\n" % (arg_4+1))
            arg_5 = []
            arg_6 = []

            for arg_7 in arg_2:
                arg_8 = random.choice(arg_3)
                arg_9 = arg_0.breed(arg_7, arg_8)

                for arg_10 in arg_9:
                    if arg_10.divinity > human:
                        # divine offspring join the Pantheon
                        arg_0.add_god(arg_10)
                    if arg_10.chromosomes == 'XX':
                        arg_5.append(arg_10)
                    else:
                        arg_6.append(arg_10)

            # elder gods leave the breeding pool
            arg_2 = [ed for ed in arg_2 if ed.generation > (arg_4-2)]
            arg_3 = [sd for sd in arg_3 if sd.generation > (arg_4-3)]

            # mature offspring join the breeding pool
            arg_2 += arg_5
            arg_3 += arg_6

Grow this Pantheon by multiplying Gods .


def Func(arg_0, arg_1):
    '''make a temp file of clean_visible text'''
    arg_2 = open(arg_1, 'wb')
    arg_2.write('<?xml version="1.0" encoding="UTF-8"?>')
    arg_2.write('<root>')
    for arg_3, arg_4 in enumerate(arg_0):
        if arg_4.stream_id is None:
            # create the FILENAME element anyway, so the ordering
            # remains the same as the i_chunk and can be aligned.
            arg_5 = ''
        else:
            arg_5 = arg_4.stream_id
        arg_6 = lxml.etree.Element("FILENAME", arg_5=arg_5)
        if arg_4.body and arg_4.body.clean_visible:
            try:
                # is UTF-8, and etree wants .text to be unicode
                arg_6.text = arg_4.body.clean_visible.decode('utf8')
            except ValueError:
                arg_6.text = drop_invalid_and_upper_utf8_chars(
                    arg_4.body.clean_visible.decode('utf8'))
            except Exception, exc:
                # this should never ever fail, because if it does,
                # then it means that clean_visible (or more likely
                # clean_html) is not what it is supposed to be.
                # Therefore, do not take it lightly:
                logger.critical(traceback.format_exc(exc))
                logger.critical('failed on stream_id=%s to follow:',
                                arg_4.stream_id)
                logger.critical(repr(arg_4.body.clean_visible))
                logger.critical('above was stream_id=%s', arg_4.stream_id)
                # [I don't know who calls this, but note that this
                # will *always* fail if clean_visible isn't valid UTF-8.]
                raise
        else:
            arg_6.text = ''
        arg_2.write(lxml.etree.tostring(arg_6, encoding='UTF-8'))
    arg_2.write('</root>')
    arg_2.close()
    logger.info(arg_1)

    '''
    ## hack to capture html for inspection
    _html = open(clean_visible_path + '-html', 'wb')
    for idx, si in enumerate(i_chunk):
        _html.write('<FILENAME docid="%s">' % si.stream_id)
        if si.body and si.body.clean_html:
            _html.write(si.body.clean_html)
        _html.write('</FILENAME>\n')
    _html.close()
    ## replace this with log.info()
    print clean_visible_path + '-html'
    '''


return self._authenticated_request \
            .to_endpoint('project/{}/'.format(project_id)) \
            .return_body() \
            .get()

def
Func
(
arg_0
,
arg_1
)
:
if
not
is_valid_uuid
(
arg_1
)
:
raise
StorageArgumentException
(
'Invalid UUID for project_id: {0}'
.
format
(
arg_1
)
)
return
arg_0
.
_authenticated_request
.
to_endpoint
(
'project/{}/'
.
format
(
arg_1
)
)
.
return_body
(
)
.
get
(
)

def Func(arg_0, arg_1):
        '''Get information on a given project

        Args:
            project_id (str): The UUID of the requested project.

        Returns:
            A dictionary describing the project::

            {
                u'collab_id': 2271,
                u'created_by': u'303447',
                u'created_on': u'2017-03-10T12:50:06.077891Z',
                u'description': u'',
                u'entity_type': u'project',
                u'modified_by': u'303447',
                u'modified_on': u'2017-03-10T12:50:06.077946Z',
                u'name': u'2271',
                u'uuid': u'3abd8742-d069-44cf-a66b-2370df74a682'
            }

        Raises:
            StorageForbiddenException: Server response code 403
            StorageNotFoundException: Server response code 404
            StorageException: other 400-600 error codes
        '''
        if not is_valid_uuid(arg_1):
            raise StorageArgumentException(
                'Invalid UUID for project_id: {0}'.format(arg_1))

        return arg_0._authenticated_request \
            .to_endpoint('project/{}/'.format(arg_1)) \
            .return_body() \
            .get()


def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):
        """
        Read the data encoding the QueryRequestPayload object and decode it
        into its constituent parts.

        Args:
            input_buffer (Stream): A data stream containing encoded object
                data, supporting a Func method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

        Raises:
            InvalidKmipEncoding: Raised if the query functions are missing
                from the encoded payload.
        """
        super(QueryRequestPayload, arg_0).Func(
            arg_1,
            arg_2=arg_2
        )
        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))

        arg_7 = []
        while(arg_0.is_tag_next(arg_3.Tags.QUERY_FUNCTION, arg_6)):
            arg_8 = primitives.Enumeration(
                arg_3.QueryFunction,
                tag=arg_3.Tags.QUERY_FUNCTION
            )
            arg_8.Func(arg_6, arg_2=arg_2)
            arg_7.append(arg_8)

        if arg_7:
            arg_0._query_functions = arg_7
        else:
            raise exceptions.InvalidKmipEncoding(
                "The Query request payload encoding is missing the query "
                "functions."
            )

        arg_0.is_oversized(arg_6)

Read the data encoding the QueryRequestPayload object and decode it
        into its constituent parts.

        Args:
            input_buffer (Stream): A data stream containing encoded object
                data, supporting a read method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

        Raises:
            InvalidKmipEncoding: Raised if the query functions are missing
                from the encoded payload.

Read the data encoding the QueryRequestPayload object and decode it into its constituent parts .


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in arg_0 . working_list : arg_1 . append ( arg_2 . dump_Func ( ) ) return arg_1

def Func(arg_0):
        """
        Returns a list structure of the appended Func and its options.

        Returns (list): The appended Func.
        """
        arg_1 = []
        for arg_2 in arg_0.working_list:
            arg_1.append(arg_2.dump_Func())
        return arg_1

Returns a list structure of the appended passes and its options.

        Returns (list): The appended passes.

Returns a list structure of the appended passes and its options .


return self._perform_get(self._get_storage_service_path(service_name),
                                 StorageService)

def Func(arg_0, arg_1):
        '''
        Returns system properties for the specified storage account.

        service_name:
            Name of the storage service account.
        '''
        _validate_not_none('service_name', arg_1)
        return arg_0._perform_get(arg_0._get_storage_service_path(arg_1),
                                 StorageService)

Returns system properties for the specified storage account .


(self, length, draught, beam, speed,
                 slenderness_coefficient, prismatic_coefficient)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                 arg_5, arg_6):
        """
        Assign values for the main Func of a ship.

        :param length: metres length of the vehicle
        :param draught: metres draught of the vehicle
        :param beam: metres beam of the vehicle
        :param speed: m/s speed of the vehicle
        :param slenderness_coefficient: Slenderness coefficient Funcless :math:`L/(∇^{1/3})` where L is length of ship,
            ∇ is displacement
        :param prismatic_coefficient: Prismatic coefficient Funcless :math:`∇/(L\cdot A_m)` where L is length of ship,
            ∇ is displacement Am is midsection area of the ship
        """
        arg_0.length = arg_1
        arg_0.draught = arg_2
        arg_0.beam = arg_3
        arg_0.speed = arg_4
        arg_0.slenderness_coefficient = arg_5
        arg_0.prismatic_coefficient = arg_6
        arg_0.displacement = (arg_0.length / arg_0.slenderness_coefficient) ** 3
        arg_0.surface_area = 1.025 * (1.7 * arg_0.length * arg_0.draught +
                                     arg_0.displacement / arg_0.draught)

Assign values for the main dimension of a ship.

        :param length: metres length of the vehicle
        :param draught: metres draught of the vehicle
        :param beam: metres beam of the vehicle
        :param speed: m/s speed of the vehicle
        :param slenderness_coefficient: Slenderness coefficient dimensionless :math:`L/(∇^{1/3})` where L is length of ship,
            ∇ is displacement
        :param prismatic_coefficient: Prismatic coefficient dimensionless :math:`∇/(L\cdot A_m)` where L is length of ship,
            ∇ is displacement Am is midsection area of the ship

Assign values for the main dimension of a ship .


def Func ( arg_0 , arg_1 ) : if arg_1 . initialized : arg_0 . model . edit_traits ( parent = arg_1 . ui . control , kind = "live" , view = edges_view )

def Func(arg_0, arg_1):
        """ Handles display of the edges editor.
        """
        if arg_1.initialized:
            arg_0.model.edit_traits(parent=arg_1.ui.control,
                kind="live", view=edges_view)


def Func ( arg_0 ) : Func = [ ] for arg_2 in arg_0 . labels : arg_3 = arg_0 . joints . get ( arg_2 ) Func . append ( [ np . nan , np . nan , np . nan ] if arg_3 is None else np . array ( arg_3 . getAnchor ( ) ) - arg_3 . getAnchor2 ( ) ) return np . array ( Func )

def Func(arg_0):
        '''Get a list of the distances between markers and their attachments.

        Returns
        -------
        distances : ndarray of shape (num-markers, 3)
            Array of distances for each marker joint in our attachment setup. If
            a marker does not currently have an associated joint (e.g. because
            it is not currently visible) this will contain NaN for that row.
        '''
        Func = []
        for arg_2 in arg_0.labels:
            arg_3 = arg_0.joints.get(arg_2)
            Func.append([np.nan, np.nan, np.nan] if arg_3 is None else
                             np.array(arg_3.getAnchor()) - arg_3.getAnchor2())
        return np.array(Func)

Get a list of the distances between markers and their attachments .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 arg_3 = arg_2 . split ( '|' ) arg_4 = '|' for arg_5 in range ( len ( arg_3 ) ) : arg_6 = arg_3 [ arg_5 ] if arg_6 and '|' + arg_6 + '|' not in arg_4 : arg_4 += arg_6 + '|' return arg_4 [ 1 : - 1 ]

def Func(arg_0, arg_1):
        """Remove duplicates from a phonetic encoding list.

        Parameters
        ----------
        phonetic : str
            A Beider-Morse phonetic encoding

        Returns
        -------
        str
            A Beider-Morse phonetic code

        """
        arg_2 = arg_1
        arg_3 = arg_2.split('|')

        arg_4 = '|'
        for arg_5 in range(len(arg_3)):
            arg_6 = arg_3[arg_5]
            if arg_6 and '|' + arg_6 + '|' not in arg_4:
                arg_4 += arg_6 + '|'

        return arg_4[1:-1]

Remove duplicates from a phonetic encoding list .


def Func ( arg_0 ) : try : arg_1 = frozenset ( useless_pass_line_numbers ( arg_0 ) ) except ( SyntaxError , tokenize . TokenError ) : arg_1 = frozenset ( ) arg_2 = io . StringIO ( arg_0 ) for arg_3 , arg_4 in enumerate ( arg_2 . readlines ( ) , start = 1 ) : if arg_3 not in arg_1 : yield arg_4

def Func(arg_0):
    """Yield code with useless "pass" lines removed."""
    try:
        arg_1 = frozenset(useless_pass_line_numbers(arg_0))
    except (SyntaxError, tokenize.TokenError):
        arg_1 = frozenset()

    arg_2 = io.StringIO(arg_0)
    for arg_3, arg_4 in enumerate(arg_2.readlines(), start=1):
        if arg_3 not in arg_1:
            yield arg_4

Yield code with useless pass lines removed .


def Func(arg_0, arg_1):
        """
        Issue an aggregation query

        ### Parameters

        **query**: This can be either an `AggeregateRequest`, or a `Cursor`

        An `AggregateResult` object is returned. You can access the rows from its
        `rows` property, which will always yield the rows of the result
        """
        if isinstance(arg_1, AggregateRequest):
            arg_2 = arg_1._with_schema
            arg_3 = bool(arg_1._cursor)
            arg_4 = [arg_0.AGGREGATE_CMD, arg_0.index_name] + arg_1.build_args()
        elif isinstance(arg_1, Cursor):
            arg_2 = False
            arg_3 = True
            arg_4 = [arg_0.CURSOR_CMD, 'READ', arg_0.index_name] + arg_1.build_args()
        else:
            raise ValueError('Bad query', arg_1)

        arg_5 = arg_0.redis.execute_command(*arg_4)
        if arg_3:
            if isinstance(arg_1, Cursor):
                arg_1.cid = arg_5[1]
                arg_7 = arg_1
            else:
                arg_7 = Cursor(arg_5[1])
            arg_5 = arg_5[0]
        else:
            arg_7 = None

        if arg_1._with_schema:
            arg_8 = arg_5[0]
            arg_9 = arg_5[2:]
        else:
            arg_8 = None
            arg_9 = arg_5[1:]

        arg_10 = AggregateResult(arg_9, arg_7, arg_8)
        return arg_10


def
Func
(
arg_0
,
arg_1
=
0.5
)
:
logger
.
info
(
'Starting server on {}:{}...'
.
format
(
arg_0
.
server_name
,
arg_0
.
server_port
)
)
while
True
:
try
:
arg_0
.
poll_once
(
arg_1
)
except
(
KeyboardInterrupt
,
SystemExit
)
:
break
arg_0
.
handle_close
(
)
logger
.
info
(
'Server stopped.'
)

def Func(arg_0, arg_1=0.5):
        """
        Start serving HTTP requests

        This method blocks the current thread.

        :param poll_interval: polling timeout
        :return:
        """
        logger.info('Starting server on {}:{}...'.format(
            arg_0.server_name, arg_0.server_port)
        )
        while True:
            try:
                arg_0.poll_once(arg_1)
            except (KeyboardInterrupt, SystemExit):
                break
        arg_0.handle_close()
        logger.info('Server stopped.')