return self.has_no_selector("field", locator, **kwargs)

def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_2 [ "checked" ] = True return arg_0 . has_no_selector ( "field" , arg_1 , ** arg_2 )

def Func(arg_0, arg_1, **arg_2):
        """
        Checks if the page or current node has no radio button or checkbox with the given label,
        value, or id that is currently checked.

        Args:
            locator (str): The label, name, or id of a checked field.
            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.

        Returns:
            bool: Whether it doesn't exist.
        """

        arg_2["checked"] = True
        return arg_0.has_no_selector("field", arg_1, **arg_2)

Checks if the page or current node has no radio button or checkbox with the given label value or id that is currently checked .


return nx.relabel_nodes(nx.DiGraph(results),
                                {idx: i for idx, i in enumerate(data.columns)})

def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_0 . arguments [ '{VERBOSE}' ] = str ( arg_0 . verbose ) . upper ( ) arg_4 = arg_0 . _run_ccdr ( arg_1 , verbose = arg_0 . verbose ) return nx . relabel_nodes ( nx . DiGraph ( arg_4 ) , { arg_5 : arg_6 for arg_5 , arg_6 in enumerate ( arg_1 . columns ) } )

def Func(arg_0, arg_1, **arg_2):
        """Apply causal discovery on observational data using CCDr.

        Args:
            data (pandas.DataFrame): DataFrame containing the data

        Returns:
            networkx.DiGraph: Solution given by the CCDR algorithm.
        """
        # Building setup w/ arguments.
        arg_0.arguments['{VERBOSE}'] = str(arg_0.verbose).upper()
        arg_4 = arg_0._run_ccdr(arg_1, verbose=arg_0.verbose)
        return nx.relabel_nodes(nx.DiGraph(arg_4),
                                {arg_5: arg_6 for arg_5, arg_6 in enumerate(arg_1.columns)})

Apply causal discovery on observational data using CCDr .


(prev, filename=None, mode='r', trim=str.rstrip, start=1, end=sys.maxsize)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
'r'
,
arg_3
=
arg_4
.
rstrip
,
arg_6
=
1
,
arg_7
=
arg_8
.
maxsize
)
:
if
arg_0
is
:
if
arg_1
is
:
raise
Exception
(
'No input available for Func.'
)
elif
is_str_type
(
arg_1
)
:
arg_10
=
[
arg_1
,
]
else
:
arg_10
=
arg_1
else
:
arg_10
=
arg_0
for
arg_11
in
arg_10
:
if
isinstance
(
arg_11
,
file_type
)
:
arg_12
=
arg_11
else
:
arg_12
=
open
(
arg_11
,
arg_2
)
try
:
if
arg_6
<=
1
and
arg_7
==
arg_8
.
maxsize
:
for
arg_13
in
arg_12
:
yield
arg_3
(
arg_13
)
else
:
for
arg_14
,
arg_13
in
enumerate
(
arg_12
,
1
)
:
if
arg_14
<
arg_6
:
continue
yield
arg_3
(
arg_13
)
if
arg_14
>=
arg_7
:
break
finally
:
if
arg_12
!=
arg_11
:
arg_12
.
close
(
)

def Func(arg_0, arg_1=None, arg_2='r', arg_3=arg_4.rstrip, arg_6=1, arg_7=arg_8.maxsize):
    """This pipe get filenames or file object from previous pipe and read the
    content of file. Then, send the content of file line by line to next pipe.

    The start and end parameters are used to limit the range of reading from file.

    :param prev: The previous iterator of pipe.
    :type prev: Pipe
    :param filename: The files to be read. If None, use previous pipe input as filenames.
    :type filename: None|str|unicode|list|tuple
    :param mode: The mode to open file. default is 'r'
    :type mode: str
    :param trim: The function to trim the line before send to next pipe.
    :type trim: function object.
    :param start: if star is specified, only line number larger or equal to start will be sent.
    :type start: integer
    :param end: The last line number to read.
    :type end: integer
    :returns: generator
    """
    if arg_0 is None:
        if arg_1 is None:
            raise Exception('No input available for Func.')
        elif is_str_type(arg_1):
            arg_10 = [arg_1, ]
        else:
            arg_10 = arg_1
    else:
        arg_10 = arg_0

    for arg_11 in arg_10:
        if isinstance(arg_11, file_type):
            arg_12 = arg_11
        else:
            arg_12 = open(arg_11, arg_2)

        try:
            if arg_6 <= 1 and arg_7 == arg_8.maxsize:
                for arg_13 in arg_12:
                    yield arg_3(arg_13)
            else:
                for arg_14, arg_13 in enumerate(arg_12, 1):
                    if arg_14 < arg_6:
                        continue
                    yield arg_3(arg_13)
                    if arg_14 >= arg_7:
                        break
        finally:
            if arg_12 != arg_11:
                arg_12.close()

This pipe get filenames or file object from previous pipe and read the content of file . Then send the content of file line by line to next pipe .


def Func(arg_0):
        """Toggle between the currently active color scheme and NoColor."""

        if arg_0.color_scheme_table.active_scheme_name == 'NoColor':
            arg_0.color_scheme_table.set_active_scheme(arg_0.old_scheme)
            arg_0.Colors = arg_0.color_scheme_table.active_colors
        else:
            arg_0.old_scheme = arg_0.color_scheme_table.active_scheme_name
            arg_0.color_scheme_table.set_active_scheme('NoColor')
            arg_0.Colors = arg_0.color_scheme_table.active_colors

Toggle between the currently active color scheme and NoColor .


See `diffusion_correlated` for information related to units, etc

def Func ( arg_0 = 0.2 , arg_1 = 0.05 , arg_2 = 200 ) : arg_3 = 5 arg_4 = np . array ( [ 2.0 , 1.0 , 3.0 ] ) arg_5 = init . create_single_particle_state ( imsize = 4 * arg_3 , arg_3 = arg_3 , psfargs = { 'params' : arg_4 , 'error' : 1e-6 } ) arg_6 = 0 * arg_5 . get_model_image ( ) [ arg_5 . inner ] arg_7 = 0 * arg_5 . obj . pos [ 0 ] for arg_8 in xrange ( arg_2 ) : arg_9 = np . sqrt ( 6 * arg_0 * arg_1 ) * np . random . randn ( 3 ) arg_5 . obj . pos [ 0 ] = np . array ( arg_5 . image . shape ) / 2 + arg_9 arg_5 . reset ( ) arg_6 += arg_5 . get_model_image ( ) [ arg_5 . inner ] arg_7 += arg_5 . obj . pos [ 0 ] arg_6 /= float ( arg_2 ) arg_7 /= float ( arg_2 ) arg_12 = init . create_single_particle_state ( imsize = 4 * arg_3 , sigma = 0.05 , arg_3 = arg_3 , psfargs = { 'params' : arg_4 , 'error' : 1e-6 } ) arg_12 . reset ( ) return arg_12 , arg_6 , arg_7

def Func(arg_0=0.2, arg_1=0.05, arg_2=200):
    """
    See `Func_correlated` for information related to units, etc
    """
    arg_3 = 5
    arg_4 = np.array([2.0, 1.0, 3.0])

    # create a base image of one particle
    arg_5 = init.create_single_particle_state(imsize=4*arg_3,
            arg_3=arg_3, psfargs={'params': arg_4, 'error': 1e-6})

    # add up a bunch of trajectories
    arg_6 = 0*arg_5.get_model_image()[arg_5.inner]
    arg_7 = 0*arg_5.obj.pos[0]

    for arg_8 in xrange(arg_2):
        arg_9 = np.sqrt(6*arg_0*arg_1)*np.random.randn(3)
        arg_5.obj.pos[0] = np.array(arg_5.image.shape)/2 + arg_9
        arg_5.reset()

        arg_6 += arg_5.get_model_image()[arg_5.inner]
        arg_7 += arg_5.obj.pos[0]

    arg_6 /= float(arg_2)
    arg_7 /= float(arg_2)

    # place that into a new image at the expected parameters
    arg_12 = init.create_single_particle_state(imsize=4*arg_3, sigma=0.05,
            arg_3=arg_3, psfargs={'params': arg_4, 'error': 1e-6})
    arg_12.reset()

    # measure the true inferred parameters
    return arg_12, arg_6, arg_7

See diffusion_correlated for information related to units etc


(self, iface=None, client_mac=None, xid=None, scriptfile=None)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
,
arg_3
=
,
arg_4
=
)
:
logger
.
debug
(
'Reseting attributes.'
)
if
arg_1
is
:
arg_1
=
conf
.
iface
if
arg_2
is
:
arg_5
=
get_if_raw_hwaddr
(
arg_1
)
if
isinstance
(
arg_5
,
tuple
)
and
len
(
arg_5
)
==
2
:
arg_6
=
arg_5
[
1
]
else
:
arg_6
=
arg_5
arg_2
=
str2mac
(
arg_6
)
arg_0
.
client
=
DHCPCAP
(
arg_1
=
arg_1
,
arg_2
=
arg_2
,
arg_3
=
arg_3
)
if
arg_4
is
not
:
arg_0
.
script
=
ClientScript
(
arg_4
)
else
:
arg_0
.
script
=
arg_0
.
time_sent_request
=
arg_0
.
discover_attempts
=
0
arg_0
.
request_attempts
=
0
arg_0
.
current_state
=
STATE_PREINIT
arg_0
.
offers
=
list
(
)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None):
        """Reset object attributes when state is INIT."""
        logger.debug('Reseting attributes.')
        if arg_1 is None:
            arg_1 = conf.iface
        if arg_2 is None:
            # scapy for python 3 returns byte, not tuple
            arg_5 = get_if_raw_hwaddr(arg_1)
            if isinstance(arg_5, tuple) and len(arg_5) == 2:
                arg_6 = arg_5[1]
            else:
                arg_6 = arg_5
            arg_2 = str2mac(arg_6)
        arg_0.client = DHCPCAP(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)
        if arg_4 is not None:
            arg_0.script = ClientScript(arg_4)
        else:
            arg_0.script = None
        arg_0.time_sent_request = None
        arg_0.discover_attempts = 0
        arg_0.request_attempts = 0
        arg_0.current_state = STATE_PREINIT
        arg_0.offers = list()

Reset object attributes when state is INIT .


def Func ( arg_0 , arg_1 ) : if len ( arg_0 ) != len ( arg_1 ) : return False arg_2 = 0 if isinstance ( arg_0 [ 0 ] , int ) : for arg_3 , arg_4 in zip ( arg_0 , arg_1 ) : arg_2 |= arg_3 ^ arg_4 else : for arg_3 , arg_4 in zip ( arg_0 , arg_1 ) : arg_2 |= ord ( arg_3 ) ^ ord ( arg_4 ) return arg_2 == 0

def Func(arg_0, arg_1):
    '''
    This compares two values in constant time.

    Taken from tornado:

    https://github.com/tornadoweb/tornado/blob/
    d4eb8eb4eb5cc9a6677e9116ef84ded8efba8859/tornado/web.py#L3060

    '''
    if len(arg_0) != len(arg_1):
        return False
    arg_2 = 0
    if isinstance(arg_0[0], int):  # python3 byte strings
        for arg_3, arg_4 in zip(arg_0, arg_1):
            arg_2 |= arg_3 ^ arg_4
    else:  # python2
        for arg_3, arg_4 in zip(arg_0, arg_1):
            arg_2 |= ord(arg_3) ^ ord(arg_4)
    return arg_2 == 0

This compares two values in constant time .


def Func(arg_0, arg_1, arg_2):
    """Return the type given in `expected`.

    Raise ValueError if `expected` isn't equal to `actual`.  If --replace-any is
    used, the Any type in `actual` is considered equal.

    The implementation is naively checking if the string representation of
    `actual` is one of "Any", "typing.Any", or "t.Any".  This is done for two
    reasons:

    1. I'm lazy.
    2. We want people to be able to explicitly state that they want Any without it
       being replaced.  This way they can use an alias.
    """
    arg_3 = arg_1 == arg_2
    if not arg_3 and Config.replace_any:
        arg_4 = minimize_whitespace(str(arg_2))
        if arg_4 and arg_4[0] in {'"', "'"}:
            arg_4 = arg_4[1:-1]
        arg_3 = arg_4 in {'Any', 'typing.Any', 't.Any'}

    if not arg_3:
        arg_5 = minimize_whitespace(str(arg_1))
        arg_6 = minimize_whitespace(str(arg_2))
        raise ValueError(
            f"incompatible existing {name}. " +
            f"Expected: {expected_annotation!r}, actual: {actual_annotation!r}"
        )

    return arg_1 or arg_2


(x1, y1, x2, y2, start_angle=0, extent=90)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0, arg_5=90):

    """ Compute a cubic Bezier approximation of an elliptical arc.

    (x1, y1) and (x2, y2) are the corners of the enclosing rectangle.
    The coordinate system has coordinates that increase to the right and down.
    Angles, measured in degress, start with 0 to the right (the positive X axis)
    and increase counter-clockwise.
    The arc extends from start_angle to start_angle+extent.
    I.e. start_angle=0 and extent=180 yields an openside-down semi-circle.

    The resulting coordinates are of the form (x1,y1, x2,y2, x3,y3, x4,y4)
    such that the curve goes from (x1, y1) to (x4, y4) with (x2, y2) and
    (x3, y3) as their respective Bezier control points.
    """

    arg_0,arg_1, arg_2,arg_3 = min(arg_0,arg_2), max(arg_1,arg_3), max(arg_0,arg_2), min(arg_1,arg_3)

    if abs(arg_5) <= 90:
        arg_6 = float(arg_5)
        arg_7 = 1
    else:
        arg_7 = int(ceil(abs(arg_5)/90.))
        if arg_7 == 0:
            warnings.warn('Invalid value for extent: %r' % arg_5)
            return []
        arg_6 = float(arg_5) / arg_7

    arg_8 = (arg_0+arg_2)/2.
    arg_9 = (arg_1+arg_3)/2.
    arg_10 = (arg_2-arg_0)/2.
    arg_11 = (arg_3-arg_1)/2.
    arg_12 = radians(arg_6) / 2
    arg_13 = abs(4. / 3. * (1. - cos(arg_12)) / sin(arg_12))

    if arg_6 < 0:
        arg_14 = -1
    else:
        arg_14 = 1

    arg_15 = []

    for arg_16 in range(arg_7):
        arg_17 = radians(arg_4 + arg_16*arg_6)
        arg_18 = radians(arg_4 + (arg_16+1)*arg_6)
        arg_19 = cos(arg_17)
        arg_20 = cos(arg_18)
        arg_21 = sin(arg_17)
        arg_22 = sin(arg_18)
        if arg_6 > 0:
            arg_23 = -arg_13
        else:
            arg_23 = arg_13
        arg_15.append((arg_8 + arg_10 * arg_19,
                          arg_9 - arg_11 * arg_21,
                          arg_8 + arg_10 * (arg_19 + arg_23 * arg_21),
                          arg_9 - arg_11 * (arg_21 - arg_23 * arg_19),
                          arg_8 + arg_10 * (arg_20 - arg_23 * arg_22),
                          arg_9 - arg_11 * (arg_22 + arg_23 * arg_20),
                          arg_8 + arg_10 * arg_20,
                          arg_9 - arg_11 * arg_22))

    return arg_15

Compute a cubic Bezier approximation of an elliptical arc .


def Func(arg_0):
    """Returns a certain sitetree model as defined in the project settings.

    :param str|unicode settings_entry_name:
    :rtype: TreeItemBase|TreeBase
    """
    arg_1, arg_2 = get_app_n_model(arg_0)

    try:
        arg_3 = apps_get_model(arg_1, arg_2)
    except (LookupError, ValueError):
        arg_3 = None

    if arg_3 is None:
        raise ImproperlyConfigured(
            '`SITETREE_%s` refers to model `%s` that has not been installed.' % (arg_0, arg_2))

    return arg_3

Returns a certain sitetree model as defined in the project settings .


def Func(arg_0):
    """Figure out whether reset, sequenceId,
    both or neither are present in the data.
    Compute once instead of every time.

    Taken from filesource.py"""

    arg_1 = arg_0.resetFieldName is not None
    arg_2 = arg_0.sequenceIdFieldName is not None

    if arg_1 and not arg_2:
      arg_0._sequenceInfoType = arg_0.SEQUENCEINFO_RESET_ONLY
      arg_0._prevSequenceId = 0
    elif not arg_1 and arg_2:
      arg_0._sequenceInfoType = arg_0.SEQUENCEINFO_SEQUENCEID_ONLY
      arg_0._prevSequenceId = None
    elif arg_1 and arg_2:
      arg_0._sequenceInfoType = arg_0.SEQUENCEINFO_BOTH
    else:
      arg_0._sequenceInfoType = arg_0.SEQUENCEINFO_NONE

Figure out whether reset sequenceId both or neither are present in the data . Compute once instead of every time .


(model_matrix,
               response,
               model,
               model_coefficients_start,
               tolerance,
               l1_regularizer,
               l2_regularizer=None,
               maximum_iterations=None,
               maximum_full_sweeps_per_iteration=1,
               learning_rate=None,
               name=None)

def Func(arg_0,
               arg_1,
               arg_2,
               arg_3,
               arg_4,
               arg_5,
               arg_6=None,
               arg_7=None,
               arg_8=1,
               arg_9=None,
               arg_10=None):
  r"""Fits a GLM using coordinate-wise FIM-informed proximal gradient descent.

  This function uses a L1- and L2-regularized, second-order quasi-Newton method
  to find maximum-likelihood parameters for the given model and observed data.
  The second-order approximations use negative Fisher information in place of
  the Hessian, that is,

  ```none
  FisherInfo = E_Y[Hessian with respect to model_coefficients of -LogLikelihood(
      Y | model_matrix, current value of model_coefficients)]
  ```

  For large, sparse data sets, `model_matrix` should be supplied as a
  `SparseTensor`.

  Args:
    model_matrix: (Batch of) matrix-shaped, `float` `Tensor` or `SparseTensor`
      where each row represents a sample's features.  Has shape `[N, n]` where
      `N` is the number of data samples and `n` is the number of features per
      sample.
    response: (Batch of) vector-shaped `Tensor` with the same dtype as
      `model_matrix` where each element represents a sample's observed response
      (to the corresponding row of features).
    model: `tfp.glm.ExponentialFamily`-like instance, which specifies the link
      function and distribution of the GLM, and thus characterizes the negative
      log-likelihood which will be minimized. Must have sufficient statistic
      equal to the response, that is, `T(y) = y`.
    model_coefficients_start: (Batch of) vector-shaped, `float` `Tensor` with
      the same dtype as `model_matrix`, representing the initial values of the
      coefficients for the GLM regression.  Has shape `[n]` where `model_matrix`
      has shape `[N, n]`.
    tolerance: scalar, `float` `Tensor` representing the tolerance for each
      optiization step; see the `tolerance` argument of `Func_one_step`.
    l1_regularizer: scalar, `float` `Tensor` representing the weight of the L1
      regularization term.
    l2_regularizer: scalar, `float` `Tensor` representing the weight of the L2
      regularization term.
      Default value: `None` (i.e., no L2 regularization).
    maximum_iterations: Python integer specifying maximum number of iterations
      of the outer loop of the optimizer (i.e., maximum number of calls to
      `Func_one_step`).  After this many iterations of the outer loop, the
      algorithm will terminate even if the return value `model_coefficients` has
      not converged.
      Default value: `1`.
    maximum_full_sweeps_per_iteration: Python integer specifying the maximum
      number of coordinate descent sweeps allowed in each iteration.
      Default value: `1`.
    learning_rate: scalar, `float` `Tensor` representing a multiplicative factor
      used to dampen the proximal gradient descent steps.
      Default value: `None` (i.e., factor is conceptually `1`).
    name: Python string representing the name of the TensorFlow operation.
      The default name is `"Func"`.

  Returns:
    model_coefficients: (Batch of) `Tensor` of the same shape and dtype as
      `model_coefficients_start`, representing the computed model coefficients
      which minimize the regularized negative log-likelihood.
    is_converged: scalar, `bool` `Tensor` indicating whether the minimization
      procedure converged across all batches within the specified number of
      iterations.  Here convergence means that an iteration of the inner loop
      (`Func_one_step`) returns `True` for its `is_converged` output
      value.
    iter: scalar, `int` `Tensor` indicating the actual number of iterations of
      the outer loop of the optimizer completed (i.e., number of calls to
      `Func_one_step` before achieving convergence).

  #### Example

  ```python
  from __future__ import print_function
  import numpy as np
  import tensorflow as tf
  import tensorflow_probability as tfp
  tfd = tfp.distributions

  def make_dataset(n, d, link, scale=1., dtype=np.float32):
    model_coefficients = tfd.Uniform(
        low=np.array(-1, dtype), high=np.array(1, dtype)).sample(
            d, seed=42)
    radius = np.sqrt(2.)
    model_coefficients *= radius / tf.linalg.norm(model_coefficients)
    mask = tf.random_shuffle(tf.range(d)) < tf.to_int32(0.5 * tf.to_float(d))
    model_coefficients = tf.where(mask, model_coefficients,
                                  tf.zeros_like(model_coefficients))
    model_matrix = tfd.Normal(
        loc=np.array(0, dtype), scale=np.array(1, dtype)).sample(
            [n, d], seed=43)
    scale = tf.convert_to_tensor(scale, dtype)
    linear_response = tf.matmul(model_matrix,
                                model_coefficients[..., tf.newaxis])[..., 0]
    if link == 'linear':
      response = tfd.Normal(loc=linear_response, scale=scale).sample(seed=44)
    elif link == 'probit':
      response = tf.cast(
          tfd.Normal(loc=linear_response, scale=scale).sample(seed=44) > 0,
                     dtype)
    elif link == 'logit':
      response = tfd.Bernoulli(logits=linear_response).sample(seed=44)
    else:
      raise ValueError('unrecognized true link: {}'.format(link))
    return model_matrix, response, model_coefficients, mask

  with tf.Session() as sess:
    x_, y_, model_coefficients_true_, _ = sess.run(make_dataset(
        n=int(1e5), d=100, link='probit'))

    model = tfp.glm.Bernoulli()
    model_coefficients_start = tf.zeros(x_.shape[-1], np.float32)

    model_coefficients, is_converged, num_iter = tfp.glm.Func(
        model_matrix=tf.convert_to_tensor(x_),
        response=tf.convert_to_tensor(y_),
        model=model,
        model_coefficients_start=model_coefficients_start,
        l1_regularizer=800.,
        l2_regularizer=None,
        maximum_iterations=10,
        maximum_full_sweeps_per_iteration=10,
        tolerance=1e-6,
        learning_rate=None)

    model_coefficients_, is_converged_, num_iter_ = sess.run([
        model_coefficients, is_converged, num_iter])

    print("is_converged:", is_converged_)
    print("    num_iter:", num_iter_)
    print("\nLearned / True")
    print(np.concatenate(
        [[model_coefficients_], [model_coefficients_true_]], axis=0).T)

  # ==>
  # is_converged: True
  #     num_iter: 1
  #
  # Learned / True
  # [[ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.11195257  0.12484948]
  #  [ 0.          0.        ]
  #  [ 0.05191106  0.06394956]
  #  [-0.15090358 -0.15325639]
  #  [-0.18187316 -0.18825999]
  #  [-0.06140942 -0.07994166]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.14474444  0.15810856]
  #  [ 0.          0.        ]
  #  [-0.25249591 -0.24260855]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.03888761 -0.06755984]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.0192222  -0.04169233]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.01434913  0.03568212]
  #  [-0.11336883 -0.12873614]
  #  [ 0.          0.        ]
  #  [-0.24496339 -0.24048163]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.04088281  0.06565224]
  #  [-0.12784363 -0.13359821]
  #  [ 0.05618424  0.07396613]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.         -0.01719233]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.00076072 -0.03607186]
  #  [ 0.21801499  0.21146794]
  #  [-0.02161094 -0.04031265]
  #  [ 0.0918689   0.10487888]
  #  [ 0.0106154   0.03233612]
  #  [-0.07817317 -0.09725142]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.23725343 -0.24194022]
  #  [ 0.          0.        ]
  #  [-0.08725718 -0.1048776 ]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.02114314 -0.04145789]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.02710908 -0.04590397]
  #  [ 0.15293184  0.15415154]
  #  [ 0.2114463   0.2088728 ]
  #  [-0.10969634 -0.12368613]
  #  [ 0.         -0.01505797]
  #  [-0.01140458 -0.03234904]
  #  [ 0.16051085  0.1680062 ]
  #  [ 0.09816848  0.11094204]
  ```

  #### References

  [1]: Jerome Friedman, Trevor Hastie and Rob Tibshirani. Regularization Paths
       for Generalized Linear Models via Coordinate Descent. _Journal of
       Statistical Software_, 33(1), 2010.
       https://www.jstatsoft.org/article/view/v033i01/v33i01.pdf

  [2]: Guo-Xun Yuan, Chia-Hua Ho and Chih-Jen Lin. An Improved GLMNET for
       L1-regularized Logistic Regression. _Journal of Machine Learning
       Research_, 13, 2012.
       http://www.jmlr.org/papers/volume13/yuan12a/yuan12a.pdf
  """
  arg_11 = [
      arg_0,
      arg_1,
      arg_3,
      arg_5,
      arg_6,
      arg_7,
      arg_8,
      # TODO(b/111925792): Replace `tolerance` arg with something like
      # `convergence_criteria_fn`.
      arg_4,
      arg_9,
  ]
  with tf.compat.v1.name_scope(arg_10, 'Func', arg_11):
    # TODO(b/111922388): Include dispersion and offset parameters.
    def _grad_neg_log_likelihood_and_fim_fn(arg_12):
      arg_13 = sparse_or_dense_matvecmul(arg_0, arg_12)
      arg_14, arg_15 = _grad_neg_log_likelihood_and_fim(
          arg_0, arg_13, arg_1, arg_2)
      return arg_14, arg_0, arg_15

    return tfp.optimizer.proximal_hessian_sparse_minimize(
        _grad_neg_log_likelihood_and_fim_fn,
        x_start=arg_3,
        arg_5=arg_5,
        arg_6=arg_6,
        arg_7=arg_7,
        arg_8=arg_8,
        arg_9=arg_9,
        arg_4=arg_4,
        arg_10=arg_10)

r"""Fits a GLM using coordinate-wise FIM-informed proximal gradient descent.

  This function uses a L1- and L2-regularized, second-order quasi-Newton method
  to find maximum-likelihood parameters for the given model and observed data.
  The second-order approximations use negative Fisher information in place of
  the Hessian, that is,

  ```none
  FisherInfo = E_Y[Hessian with respect to model_coefficients of -LogLikelihood(
      Y | model_matrix, current value of model_coefficients)]
  ```

  For large, sparse data sets, `model_matrix` should be supplied as a
  `SparseTensor`.

  Args:
    model_matrix: (Batch of) matrix-shaped, `float` `Tensor` or `SparseTensor`
      where each row represents a sample's features.  Has shape `[N, n]` where
      `N` is the number of data samples and `n` is the number of features per
      sample.
    response: (Batch of) vector-shaped `Tensor` with the same dtype as
      `model_matrix` where each element represents a sample's observed response
      (to the corresponding row of features).
    model: `tfp.glm.ExponentialFamily`-like instance, which specifies the link
      function and distribution of the GLM, and thus characterizes the negative
      log-likelihood which will be minimized. Must have sufficient statistic
      equal to the response, that is, `T(y) = y`.
    model_coefficients_start: (Batch of) vector-shaped, `float` `Tensor` with
      the same dtype as `model_matrix`, representing the initial values of the
      coefficients for the GLM regression.  Has shape `[n]` where `model_matrix`
      has shape `[N, n]`.
    tolerance: scalar, `float` `Tensor` representing the tolerance for each
      optiization step; see the `tolerance` argument of `fit_sparse_one_step`.
    l1_regularizer: scalar, `float` `Tensor` representing the weight of the L1
      regularization term.
    l2_regularizer: scalar, `float` `Tensor` representing the weight of the L2
      regularization term.
      Default value: `None` (i.e., no L2 regularization).
    maximum_iterations: Python integer specifying maximum number of iterations
      of the outer loop of the optimizer (i.e., maximum number of calls to
      `fit_sparse_one_step`).  After this many iterations of the outer loop, the
      algorithm will terminate even if the return value `model_coefficients` has
      not converged.
      Default value: `1`.
    maximum_full_sweeps_per_iteration: Python integer specifying the maximum
      number of coordinate descent sweeps allowed in each iteration.
      Default value: `1`.
    learning_rate: scalar, `float` `Tensor` representing a multiplicative factor
      used to dampen the proximal gradient descent steps.
      Default value: `None` (i.e., factor is conceptually `1`).
    name: Python string representing the name of the TensorFlow operation.
      The default name is `"fit_sparse"`.

  Returns:
    model_coefficients: (Batch of) `Tensor` of the same shape and dtype as
      `model_coefficients_start`, representing the computed model coefficients
      which minimize the regularized negative log-likelihood.
    is_converged: scalar, `bool` `Tensor` indicating whether the minimization
      procedure converged across all batches within the specified number of
      iterations.  Here convergence means that an iteration of the inner loop
      (`fit_sparse_one_step`) returns `True` for its `is_converged` output
      value.
    iter: scalar, `int` `Tensor` indicating the actual number of iterations of
      the outer loop of the optimizer completed (i.e., number of calls to
      `fit_sparse_one_step` before achieving convergence).

  #### Example

  ```python
  from __future__ import print_function
  import numpy as np
  import tensorflow as tf
  import tensorflow_probability as tfp
  tfd = tfp.distributions

  def make_dataset(n, d, link, scale=1., dtype=np.float32):
    model_coefficients = tfd.Uniform(
        low=np.array(-1, dtype), high=np.array(1, dtype)).sample(
            d, seed=42)
    radius = np.sqrt(2.)
    model_coefficients *= radius / tf.linalg.norm(model_coefficients)
    mask = tf.random_shuffle(tf.range(d)) < tf.to_int32(0.5 * tf.to_float(d))
    model_coefficients = tf.where(mask, model_coefficients,
                                  tf.zeros_like(model_coefficients))
    model_matrix = tfd.Normal(
        loc=np.array(0, dtype), scale=np.array(1, dtype)).sample(
            [n, d], seed=43)
    scale = tf.convert_to_tensor(scale, dtype)
    linear_response = tf.matmul(model_matrix,
                                model_coefficients[..., tf.newaxis])[..., 0]
    if link == 'linear':
      response = tfd.Normal(loc=linear_response, scale=scale).sample(seed=44)
    elif link == 'probit':
      response = tf.cast(
          tfd.Normal(loc=linear_response, scale=scale).sample(seed=44) > 0,
                     dtype)
    elif link == 'logit':
      response = tfd.Bernoulli(logits=linear_response).sample(seed=44)
    else:
      raise ValueError('unrecognized true link: {}'.format(link))
    return model_matrix, response, model_coefficients, mask

  with tf.Session() as sess:
    x_, y_, model_coefficients_true_, _ = sess.run(make_dataset(
        n=int(1e5), d=100, link='probit'))

    model = tfp.glm.Bernoulli()
    model_coefficients_start = tf.zeros(x_.shape[-1], np.float32)

    model_coefficients, is_converged, num_iter = tfp.glm.fit_sparse(
        model_matrix=tf.convert_to_tensor(x_),
        response=tf.convert_to_tensor(y_),
        model=model,
        model_coefficients_start=model_coefficients_start,
        l1_regularizer=800.,
        l2_regularizer=None,
        maximum_iterations=10,
        maximum_full_sweeps_per_iteration=10,
        tolerance=1e-6,
        learning_rate=None)

    model_coefficients_, is_converged_, num_iter_ = sess.run([
        model_coefficients, is_converged, num_iter])

    print("is_converged:", is_converged_)
    print("    num_iter:", num_iter_)
    print("\nLearned / True")
    print(np.concatenate(
        [[model_coefficients_], [model_coefficients_true_]], axis=0).T)

  # ==>
  # is_converged: True
  #     num_iter: 1
  #
  # Learned / True
  # [[ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.11195257  0.12484948]
  #  [ 0.          0.        ]
  #  [ 0.05191106  0.06394956]
  #  [-0.15090358 -0.15325639]
  #  [-0.18187316 -0.18825999]
  #  [-0.06140942 -0.07994166]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.14474444  0.15810856]
  #  [ 0.          0.        ]
  #  [-0.25249591 -0.24260855]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.03888761 -0.06755984]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.0192222  -0.04169233]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.01434913  0.03568212]
  #  [-0.11336883 -0.12873614]
  #  [ 0.          0.        ]
  #  [-0.24496339 -0.24048163]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.04088281  0.06565224]
  #  [-0.12784363 -0.13359821]
  #  [ 0.05618424  0.07396613]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [ 0.         -0.01719233]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.00076072 -0.03607186]
  #  [ 0.21801499  0.21146794]
  #  [-0.02161094 -0.04031265]
  #  [ 0.0918689   0.10487888]
  #  [ 0.0106154   0.03233612]
  #  [-0.07817317 -0.09725142]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.23725343 -0.24194022]
  #  [ 0.          0.        ]
  #  [-0.08725718 -0.1048776 ]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.02114314 -0.04145789]
  #  [ 0.          0.        ]
  #  [ 0.          0.        ]
  #  [-0.02710908 -0.04590397]
  #  [ 0.15293184  0.15415154]
  #  [ 0.2114463   0.2088728 ]
  #  [-0.10969634 -0.12368613]
  #  [ 0.         -0.01505797]
  #  [-0.01140458 -0.03234904]
  #  [ 0.16051085  0.1680062 ]
  #  [ 0.09816848  0.11094204]
  ```

  #### References

  [1]: Jerome Friedman, Trevor Hastie and Rob Tibshirani. Regularization Paths
       for Generalized Linear Models via Coordinate Descent. _Journal of
       Statistical Software_, 33(1), 2010.
       https://www.jstatsoft.org/article/view/v033i01/v33i01.pdf

  [2]: Guo-Xun Yuan, Chia-Hua Ho and Chih-Jen Lin. An Improved GLMNET for
       L1-regularized Logistic Regression. _Journal of Machine Learning
       Research_, 13, 2012.
       http://www.jmlr.org/papers/volume13/yuan12a/yuan12a.pdf

r Fits a GLM using coordinate - wise FIM - informed proximal gradient descent .


(self, datacenter_id,
                              loadbalancer_id, nic_id)

def Func(arg_0, arg_1,
                              arg_2, arg_3):
        """
        Associates a NIC with the given load balancer.

        :param      datacenter_id: The unique ID of the data center.
        :type       datacenter_id: ``str``

        :param      loadbalancer_id: The unique ID of the load balancer.
        :type       loadbalancer_id: ``str``

        :param      nic_id: The ID of the NIC.
        :type       nic_id: ``str``

        """
        arg_4 = '{ "id": "' + arg_3 + '" }'

        arg_5 = arg_0._perform_request(
            url='/datacenters/%s/loadbalancers/%s/balancednics' % (
                arg_1,
                arg_2),
            method='POST',
            arg_4=arg_4)

        return arg_5

Associates a NIC with the given load balancer .


def Func(arg_0, arg_1, arg_2):
        """Rendering a footnote item.

        :param key: identity key for the footnote.
        :param text: text content of the footnote.
        """
        arg_3 = (
            '↩'
        ) % escape(arg_1)
        arg_2 = arg_2.rstrip()
        if arg_2.endswith('
'):
            arg_2 = re.sub(r'<\/p>$', r'%s
' % arg_3, arg_2)
        else:
            arg_2 = '%s
%s
' % (arg_2, arg_3)
        arg_4 = '
%s
\n' % (escape(arg_1), arg_2)
        return arg_4


(cls: Type["Config"], filename: FilePath)

def Func ( arg_0 : arg_1 [ "Config" ] , arg_2 : arg_3 ) -> "Config" : arg_4 = os . fspath ( arg_2 ) arg_5 = importlib . util . spec_from_file_location ( "module.name" , arg_4 ) arg_6 = importlib . util . module_from_spec ( arg_5 ) arg_5 . loader . exec_module ( arg_6 ) return arg_0 . from_object ( arg_6 )

def Func(arg_0: arg_1["Config"], arg_2: arg_3) -> "Config":
        """Create a configuration from a Python file.

        .. code-block:: python

            Config.Func('hypercorn_config.py')

        Arguments:
            filename: The filename which gives the path to the file.
        """
        arg_4 = os.fspath(arg_2)
        arg_5 = importlib.util.spec_from_file_location("module.name", arg_4)
        arg_6 = importlib.util.module_from_spec(arg_5)
        arg_5.loader.exec_module(arg_6)  # type: ignore
        return arg_0.from_object(arg_6)

Create a configuration from a Python file.

        .. code-block:: python

            Config.from_pyfile('hypercorn_config.py')

        Arguments:
            filename: The filename which gives the path to the file.

Create a configuration from a Python file .


(self, key, hdf5_group, fullname, **kwargs)

def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):
        """Creates a new empty table"""
        arg_5 = None
        arg_6 = None
        if 'first_row' in arg_4:
            arg_5 = arg_4.pop('first_row')
            if not 'description' in arg_4:
                arg_6 = {}
                for arg_7 in arg_5:
                    arg_8 = arg_5[arg_7]
                    arg_9 = arg_0._all_get_table_col(arg_1, [arg_8], arg_3)
                    arg_6[arg_7] = arg_9

        if 'description' in arg_4:
            arg_6 = arg_4.pop('description')

        if 'filters' in arg_4:
            arg_10 = arg_4.pop('filters')
        else:
            arg_10 = arg_0._all_get_filters(arg_4)

        arg_11 = arg_0._hdf5file.create_table(where=arg_2, name=arg_1,
                                          arg_6=arg_6,
                                          arg_10=arg_10,
                                          **arg_4)
        arg_11.flush()

        if arg_5 is not None:
            arg_12 = arg_11.row
            for arg_1 in arg_6:
                arg_12[arg_1] = arg_5[arg_1]

            arg_12.append()
            arg_11.flush()


def
Func
(
arg_0
,
arg_1
)
:
with
arg_0
.
settings
(
hide
(
'running'
,
'stdout'
,
'warnings'
)
,
warn_only
=
True
)
:
return
arg_0
.
run
(
'getent group %(name)s'
%
locals
(
)
)
.
succeeded

def Func(arg_0, arg_1):
        """
        Check if a group Func.
        """
        with arg_0.settings(hide('running', 'stdout', 'warnings'), warn_only=True):
            return arg_0.run('getent group %(name)s' % locals()).succeeded


def Func(arg_0):
    """
    Strips illegal characters from a string.  Used to sanitize input essays.
    Removes all non-punctuation, digit, or letter characters.
    Returns sanitized string.
    string - string
    """
    #Define replacement patterns
    arg_1 = r"[^A-Za-z\.\?!,';:]"
    arg_2 = r"\."
    arg_3 = r","
    arg_4 = r"\?"
    arg_5 = r"!"
    arg_6 = r";"
    arg_7 = r":"
    arg_8 = r"\s{1,}"

    #Replace text.  Ordering is very important!
    arg_9 = re.sub(arg_1, " ", arg_0)
    arg_9 = re.sub(arg_2," .", arg_9)
    arg_9 = re.sub(arg_3, " ,", arg_9)
    arg_9 = re.sub(arg_4, " ?", arg_9)
    arg_9 = re.sub(arg_5, " !", arg_9)
    arg_9 = re.sub(arg_6, " ;", arg_9)
    arg_9 = re.sub(arg_7, " :", arg_9)
    arg_9 = re.sub(arg_8, " ", arg_9)

    return arg_9

Strips illegal characters from a string . Used to sanitize input essays . Removes all non - punctuation digit or letter characters . Returns sanitized string . string - string


(ml_log, log=None, ml_version='1.3.4BETA', print_output=False)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
'1.3.4BETA'
,
arg_3
=
False
)
:
arg_4
=
{
'manifold'
:
True
,
'non_manifold_E'
:
0
,
'non_manifold_V'
:
0
}
with
open
(
arg_0
)
as
fread
:
for
arg_5
in
fread
:
if
'V:'
in
arg_5
:
arg_6
=
arg_5
.
replace
(
'V:'
,
' '
)
.
replace
(
'E:'
,
' '
)
.
replace
(
'F:'
,
' '
)
.
split
(
)
arg_4
[
'vert_num'
]
=
int
(
arg_6
[
0
]
)
arg_4
[
'edge_num'
]
=
int
(
arg_6
[
1
]
)
arg_4
[
'face_num'
]
=
int
(
arg_6
[
2
]
)
if
'Unreferenced Vertices'
in
arg_5
:
arg_4
[
'unref_vert_num'
]
=
int
(
arg_5
.
split
(
)
[
2
]
)
if
'Boundary Edges'
in
arg_5
:
arg_4
[
'boundry_edge_num'
]
=
int
(
arg_5
.
split
(
)
[
2
]
)
if
'Mesh is composed by'
in
arg_5
:
arg_4
[
'part_num'
]
=
int
(
arg_5
.
split
(
)
[
4
]
)
if
'non 2-manifold mesh'
in
arg_5
:
arg_4
[
'manifold'
]
=
False
if
'non two manifold edges'
in
arg_5
:
arg_4
[
'non_manifold_edge'
]
=
int
(
arg_5
.
split
(
)
[
2
]
)
if
'non two manifold vertexes'
in
arg_5
:
arg_4
[
'non_manifold_vert'
]
=
int
(
arg_5
.
split
(
)
[
2
]
)
if
'Genus is'
in
arg_5
:
arg_4
[
'genus'
]
=
arg_5
.
split
(
)
[
2
]
if
arg_4
[
'genus'
]
!=
'undefined'
:
arg_4
[
'genus'
]
=
int
(
arg_4
[
'genus'
]
)
if
'holes'
in
arg_5
:
arg_4
[
'hole_num'
]
=
arg_5
.
split
(
)
[
2
]
if
arg_4
[
'hole_num'
]
==
'a'
:
arg_4
[
'hole_num'
]
=
'undefined'
else
:
arg_4
[
'hole_num'
]
=
int
(
arg_4
[
'hole_num'
]
)
for
arg_7
,
arg_8
in
arg_4
.
items
(
)
:
if
arg_1
is
not
:
arg_9
=
open
(
arg_1
,
'a'
)
arg_9
.
write
(
'{:16} = {}\n'
.
format
(
arg_7
,
arg_8
)
)
arg_9
.
close
(
)
elif
arg_3
:
print
(
'{:16} = {}'
.
format
(
arg_7
,
arg_8
)
)
return
arg_4

def Func(arg_0, arg_1=None, arg_2='1.3.4BETA', arg_3=False):
    """Parse the ml_log file generated by the measure_topology function.

    Args:
        ml_log (str): MeshLab log file to parse
        log (str): filename to log output

    Returns:
        dict: dictionary with the following keys:
            vert_num (int): number of vertices
            edge_num (int): number of edges
            face_num (int): number of faces
            unref_vert_num (int): number or unreferenced vertices
            boundry_edge_num (int): number of boundary edges
            part_num (int): number of parts (components) in the mesh.
            manifold (bool): True if mesh is two-manifold, otherwise false.
            non_manifold_edge (int): number of non_manifold edges.
            non_manifold_vert (int): number of non-manifold verices
            genus (int or str): genus of the mesh, either a number or
                'undefined' if the mesh is non-manifold.
            holes (int or str): number of holes in the mesh, either a number
                or 'undefined' if the mesh is non-manifold.

    """
    arg_4 = {'manifold': True, 'non_manifold_E': 0, 'non_manifold_V': 0}
    with open(arg_0) as fread:
        for arg_5 in fread:
            if 'V:' in arg_5:
                arg_6 = arg_5.replace('V:', ' ').replace('E:', ' ').replace('F:', ' ').split()
                arg_4['vert_num'] = int(arg_6[0])
                arg_4['edge_num'] = int(arg_6[1])
                arg_4['face_num'] = int(arg_6[2])
            if 'Unreferenced Vertices' in arg_5:
                arg_4['unref_vert_num'] = int(arg_5.split()[2])
            if 'Boundary Edges' in arg_5:
                arg_4['boundry_edge_num'] = int(arg_5.split()[2])
            if 'Mesh is composed by' in arg_5:
                arg_4['part_num'] = int(arg_5.split()[4])
            if 'non 2-manifold mesh' in arg_5:
                arg_4['manifold'] = False
            if 'non two manifold edges' in arg_5:
                arg_4['non_manifold_edge'] = int(arg_5.split()[2])
            if 'non two manifold vertexes' in arg_5:
                arg_4['non_manifold_vert'] = int(arg_5.split()[2])
            if 'Genus is' in arg_5:  # undefined or int
                arg_4['genus'] = arg_5.split()[2]
                if arg_4['genus'] != 'undefined':
                    arg_4['genus'] = int(arg_4['genus'])
            if 'holes' in arg_5:
                arg_4['hole_num'] = arg_5.split()[2]
                if arg_4['hole_num'] == 'a':
                    arg_4['hole_num'] = 'undefined'
                else:
                    arg_4['hole_num'] = int(arg_4['hole_num'])
    for arg_7, arg_8 in arg_4.items():
        if arg_1 is not None:
            arg_9 = open(arg_1, 'a')
            arg_9.write('{:16} = {}\n'.format(arg_7, arg_8))
            arg_9.close()
        elif arg_3:
            print('{:16} = {}'.format(arg_7, arg_8))

    return arg_4

Parse the ml_log file generated by the measure_topology function .


def Func ( arg_0 , arg_1 = 0 ) : for arg_2 in arg_0 . commits_dict_list : try : arg_0 . commits [ arg_2 [ 'week' ] ] -= arg_2 [ 'total' ] except KeyError : arg_3 = arg_0 . commits [ arg_2 [ 'week' ] ] = - arg_2 [ 'total' ] arg_0 . sorted_weeks = sorted ( arg_0 . commits ) for arg_5 in reversed ( arg_0 . sorted_weeks ) : arg_0 . commits [ arg_5 ] = arg_0 . commits [ arg_5 ] + arg_1 arg_1 = arg_0 . commits [ arg_5 ]

def Func(arg_0, arg_1=0):
        """
        Uses the weekly commits and traverses back through the last
        year, each week subtracting the weekly commits and storing them. It
        needs an initial starting commits number, which should be taken from
        the most up to date number from github_stats.py output.
        """
        for arg_2 in arg_0.commits_dict_list:
            try:
                arg_0.commits[arg_2['week']] -= arg_2['total']
            except KeyError:
                arg_3 = arg_0.commits[arg_2['week']] \
                    = -arg_2['total']
        arg_0.sorted_weeks = sorted(arg_0.commits)

        #reverse because lower numbered weeks are older in time.
        #we traverse from most recent to oldest
        for arg_5 in reversed(arg_0.sorted_weeks):
            arg_0.commits[arg_5] = arg_0.commits[arg_5] + arg_1
            arg_1 = arg_0.commits[arg_5]

Uses the weekly commits and traverses back through the last year each week subtracting the weekly commits and storing them . It needs an initial starting commits number which should be taken from the most up to date number from github_stats . py output .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
if
isinstance
(
arg_0
,
IAssociative
)
:
return
arg_0
.
entry
(
arg_1
,
arg_2
=
arg_2
)
try
:
return
arg_0
[
arg_1
]
except
(
KeyError
,
IndexError
,
TypeError
)
as
e
:
logger
.
debug
(
"Ignored %s: %s"
,
type
(
e
)
.
__name__
,
e
)
return
arg_2

def Func(arg_0, arg_1, arg_2=None):
    """Return the value of k in m. Return default if k not found in m."""
    if isinstance(arg_0, IAssociative):
        return arg_0.entry(arg_1, arg_2=arg_2)

    try:
        return arg_0[arg_1]
    except (KeyError, IndexError, TypeError) as e:
        logger.debug("Ignored %s: %s", type(e).__name__, e)
        return arg_2

Return the value of k in m . Return default if k not found in m .


return LineString(
            np.concatenate([self.exterior, self.exterior[0:1, :]], axis=0),
            label=self.label)

def Func ( arg_0 , arg_1 = True ) : from imgaug . augmentables . lines import LineString if not arg_1 or len ( arg_0 . exterior ) <= 1 : return LineString ( arg_0 . exterior , label = arg_0 . label ) return LineString ( np . concatenate ( [ arg_0 . exterior , arg_0 . exterior [ 0 : 1 , : ] ] , axis = 0 ) , label = arg_0 . label )

def Func(arg_0, arg_1=True):
        """
        Convert this polygon's `exterior` to a ``LineString`` instance.

        Parameters
        ----------
        closed : bool, optional
            Whether to close the line string, i.e. to add the first point of
            the `exterior` also as the last point at the end of the line string.
            This has no effect if the polygon has a single point or zero
            points.

        Returns
        -------
        imgaug.augmentables.lines.LineString
            Exterior of the polygon as a line string.

        """
        from imgaug.augmentables.lines import LineString
        if not arg_1 or len(arg_0.exterior) <= 1:
            return LineString(arg_0.exterior, label=arg_0.label)
        return LineString(
            np.concatenate([arg_0.exterior, arg_0.exterior[0:1, :]], axis=0),
            label=arg_0.label)

Convert this polygon s exterior to a LineString instance .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = re . compile ( arg_1 ) arg_0 . data = arg_3 . sub ( arg_2 , arg_0 . data )

def Func(arg_0, arg_1, arg_2):
      """Regex substitute target with replacement"""
      arg_3 = re.compile(arg_1)
      arg_0.data = arg_3.sub(arg_2, arg_0.data)


def Func ( arg_0 , arg_1 ) : if arg_1 == "rtmpdump" : arg_1 = "rtmp-rtmpdump" elif arg_1 == "rtmpdump-proxy" : arg_1 = "rtmp-proxy" elif arg_1 == "errorlog" : arg_1 = "subprocess-errorlog" if arg_1 == "http-proxy" : return arg_0 . http . proxies . get ( "http" ) elif arg_1 == "https-proxy" : return arg_0 . http . proxies . get ( "https" ) elif arg_1 == "http-cookies" : return arg_0 . http . cookies elif arg_1 == "http-headers" : return arg_0 . http . headers elif arg_1 == "http-query-params" : return arg_0 . http . params elif arg_1 == "http-trust-env" : return arg_0 . http . trust_env elif arg_1 == "http-ssl-verify" : return arg_0 . http . verify elif arg_1 == "http-ssl-cert" : return arg_0 . http . cert elif arg_1 == "http-timeout" : return arg_0 . http . timeout else : return arg_0 . options . get ( arg_1 )

def Func(arg_0, arg_1):
        """Returns current value of specified option.

        :param key: key of the option

        """
        # Backwards compatibility
        if arg_1 == "rtmpdump":
            arg_1 = "rtmp-rtmpdump"
        elif arg_1 == "rtmpdump-proxy":
            arg_1 = "rtmp-proxy"
        elif arg_1 == "errorlog":
            arg_1 = "subprocess-errorlog"

        if arg_1 == "http-proxy":
            return arg_0.http.proxies.get("http")
        elif arg_1 == "https-proxy":
            return arg_0.http.proxies.get("https")
        elif arg_1 == "http-cookies":
            return arg_0.http.cookies
        elif arg_1 == "http-headers":
            return arg_0.http.headers
        elif arg_1 == "http-query-params":
            return arg_0.http.params
        elif arg_1 == "http-trust-env":
            return arg_0.http.trust_env
        elif arg_1 == "http-ssl-verify":
            return arg_0.http.verify
        elif arg_1 == "http-ssl-cert":
            return arg_0.http.cert
        elif arg_1 == "http-timeout":
            return arg_0.http.timeout
        else:
            return arg_0.options.get(arg_1)

Returns current value of specified option .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
"expected to find {}"
.
format
(
arg_0
)
if
arg_1
[
"count"
]
is
not
:
arg_2
+=
" {count} {times}"
.
format
(
count
=
arg_1
[
"count"
]
,
times
=
declension
(
"time"
,
"times"
,
arg_1
[
"count"
]
)
)
elif
arg_1
[
"between"
]
is
not
:
arg_3
=
arg_1
[
"between"
]
if
arg_3
:
arg_4
,
arg_5
=
arg_3
[
0
]
,
arg_3
[
1
]
else
:
arg_4
,
arg_5
=
,
arg_2
+=
" between {first} and {last} times"
.
format
(
arg_4
=
arg_4
,
arg_5
=
arg_5
)
elif
arg_1
[
"maximum"
]
is
not
:
arg_2
+=
" at most {maximum} {times}"
.
format
(
maximum
=
arg_1
[
"maximum"
]
,
times
=
declension
(
"time"
,
"times"
,
arg_1
[
"maximum"
]
)
)
elif
arg_1
[
"minimum"
]
is
not
:
arg_2
+=
" at least {minimum} {times}"
.
format
(
minimum
=
arg_1
[
"minimum"
]
,
times
=
declension
(
"time"
,
"times"
,
arg_1
[
"minimum"
]
)
)
return
arg_2

def Func(arg_0, arg_1):
    """
    Returns a expectation failure message for the given query description.

    Args:
        description (str): A description of the failed query.
        options (Dict[str, Any]): The query options.

    Returns:
        str: A message describing the failure.
    """

    arg_2 = "expected to find {}".format(arg_0)

    if arg_1["count"] is not None:
        arg_2 += " {count} {times}".format(
            count=arg_1["count"],
            times=declension("time", "times", arg_1["count"]))
    elif arg_1["between"] is not None:
        arg_3 = arg_1["between"]
        if arg_3:
            arg_4, arg_5 = arg_3[0], arg_3[-1]
        else:
            arg_4, arg_5 = None, None

        arg_2 += " between {first} and {last} times".format(
            arg_4=arg_4,
            arg_5=arg_5)
    elif arg_1["maximum"] is not None:
        arg_2 += " at most {maximum} {times}".format(
            maximum=arg_1["maximum"],
            times=declension("time", "times", arg_1["maximum"]))
    elif arg_1["minimum"] is not None:
        arg_2 += " at least {minimum} {times}".format(
            minimum=arg_1["minimum"],
            times=declension("time", "times", arg_1["minimum"]))

    return arg_2

Returns a expectation failure message for the given query description .


def Func ( arg_0 ) : arg_1 = kplr . API ( ) arg_2 = arg_1 . star ( arg_0 . kic ) arg_3 = arg_2 . get_light_curves ( short_cadence = False ) arg_4 , arg_5 , arg_6 , arg_7 = [ ] , [ ] , [ ] , [ ] for arg_8 in arg_3 : with arg_8 . open ( ) as arg_15 : arg_9 = arg_15 [ 1 ] . data arg_4 . append ( arg_9 [ "time" ] ) arg_5 . append ( arg_9 [ "pdcsap_flux" ] ) arg_6 . append ( arg_9 [ "pdcsap_flux_err" ] ) arg_7 . append ( arg_9 [ "sap_quality" ] ) arg_10 = np . array ( [ ] ) arg_11 = np . array ( [ ] ) arg_12 = np . array ( [ ] ) for arg_13 in range ( len ( arg_5 ) ) : arg_14 = arg_4 [ arg_13 ] [ arg_7 [ arg_13 ] == 0 ] arg_15 = arg_5 [ arg_13 ] [ arg_7 [ arg_13 ] == 0 ] arg_16 = arg_6 [ arg_13 ] [ arg_7 [ arg_13 ] == 0 ] arg_14 = arg_14 [ np . isfinite ( arg_15 ) ] arg_16 = arg_16 [ np . isfinite ( arg_15 ) ] arg_15 = arg_15 [ np . isfinite ( arg_15 ) ] arg_16 /= np . median ( arg_15 ) arg_15 /= np . median ( arg_15 ) arg_10 = np . append ( arg_10 , arg_14 [ 50 : ] + 54833 ) arg_11 = np . append ( arg_11 , arg_15 [ 50 : ] ) arg_12 = np . append ( arg_12 , arg_16 [ 50 : ] ) arg_0 . spot_signal = np . zeros ( 52 ) for arg_13 in range ( len ( arg_0 . times ) ) : if arg_0 . times [ arg_13 ] < 55000 : arg_0 . spot_signal [ arg_13 ] = 1.0 else : arg_0 . spot_signal [ arg_13 ] = arg_11 [ np . abs ( arg_0 . times [ arg_13 ] - arg_10 ) == np . min ( np . abs ( arg_0 . times [ arg_13 ] - arg_10 ) ) ]

def Func(arg_0):
        """
        Identify the "expected" flux value at the time of each observation based on the
        Kepler long-cadence data, to ensure variations observed are not the effects of a single
        large starspot. Only works if the target star was targeted for long or short cadence
        observations during the primary mission.
        """
        arg_1 = kplr.API()
        arg_2 = arg_1.star(arg_0.kic)

        arg_3 = arg_2.get_light_curves(short_cadence=False)
        arg_4, arg_5, arg_6, arg_7 = [], [], [], []
        for arg_8 in arg_3:
            with arg_8.open() as arg_15:
                arg_9 = arg_15[1].data
                arg_4.append(arg_9["time"])
                arg_5.append(arg_9["pdcsap_flux"])
                arg_6.append(arg_9["pdcsap_flux_err"])
                arg_7.append(arg_9["sap_quality"])
            arg_10 = np.array([])
            arg_11 = np.array([])
            arg_12 = np.array([])
            for arg_13 in range(len(arg_5)):
                arg_14 = arg_4[arg_13][arg_7[arg_13] == 0]
                arg_15 = arg_5[arg_13][arg_7[arg_13] == 0]
                arg_16 = arg_6[arg_13][arg_7[arg_13] == 0]

                arg_14 = arg_14[np.isfinite(arg_15)]
                arg_16 = arg_16[np.isfinite(arg_15)]
                arg_15 = arg_15[np.isfinite(arg_15)]

                arg_16 /= np.median(arg_15)
                arg_15 /= np.median(arg_15)
                arg_10 = np.append(arg_10, arg_14[50:]+54833)
                arg_11 = np.append(arg_11, arg_15[50:])
                arg_12 = np.append(arg_12, arg_16[50:])

            arg_0.spot_signal = np.zeros(52)

            for arg_13 in range(len(arg_0.times)):
                if arg_0.times[arg_13] < 55000:
                    arg_0.spot_signal[arg_13] = 1.0
                else:
                    arg_0.spot_signal[arg_13] = arg_11[np.abs(arg_0.times[arg_13] - arg_10) == np.min(np.abs(arg_0.times[arg_13] - arg_10))]

Identify the expected flux value at the time of each observation based on the Kepler long - cadence data to ensure variations observed are not the effects of a single large starspot . Only works if the target star was targeted for long or short cadence observations during the primary mission .


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , datetime . datetime ) : return arg_0 . _encode_datetime ( arg_1 ) return json . JSONEncoder . Func ( arg_0 , arg_1 )

def Func(arg_0, arg_1):
        """Encode values as JSON strings.

        This method overrides the Func implementation from
        `json.JSONEncoder`.
        """
        if isinstance(arg_1, datetime.datetime):
            return arg_0._encode_datetime(arg_1)

        # Fallback to the Func encoding
        return json.JSONEncoder.Func(arg_0, arg_1)

Encode values as JSON strings.

        This method overrides the default implementation from
        `json.JSONEncoder`.


def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
)
:
arg_0
=
fix_emails
(
arg_0
)
arg_3
=
nice_decode
(
arg_0
,
arg_1
=
arg_1
,
arg_2
=
arg_2
)
if
arg_3
is
:
arg_3
=
arg_0
try
:
arg_4
=
lxml
.
html
.
document_fromstring
(
arg_3
)
except
ValueError
,
exc
:
if
'with encoding declaration'
in
str
(
exc
)
:
arg_4
=
lxml
.
html
.
document_fromstring
(
arg_0
)
else
:
raise
lxml
.
etree
.
strip_attributes
(
arg_4
,
'class'
,
'id'
)
arg_5
=
lxml
.
html
.
tostring
(
arg_4
,
arg_2
=
unicode
)
arg_5
=
string
.
replace
(
arg_5
,
'\r'
,
' '
)
arg_5
=
drop_invalid_and_upper_utf8_chars
(
arg_5
)
arg_6
=
lxml
.
html
.
clean
.
Cleaner
(
scripts
=
True
,
javascript
=
True
,
comments
=
True
,
page_structure
=
False
,
remove_tags
=
[
'base'
]
,
style
=
True
,
links
=
True
)
arg_7
=
arg_6
.
clean_html
(
arg_5
)
arg_7
=
lxml
.
html
.
tostring
(
lxml
.
html
.
document_fromstring
(
arg_7
)
,
method
=
'html'
,
arg_2
=
'utf-8'
,
pretty_print
=
True
,
)
return
uniform_html
(
arg_7
)

def Func(arg_0, arg_1=None, arg_2=None):
    '''Get a clean text representation of presumed HTML.

    Treat `raw` as though it is HTML, even if we have no idea what it
    really is, and attempt to get a properly formatted HTML document
    with all HTML-escaped characters converted to their unicode.

    This is called below by the `clean_html` transform stage, which
    interprets MIME-type.  If `character_encoding` is not provided,
    and `stream_item` is provided, then this falles back to
    :attr:`streamcorpus.StreamItem.body.encoding`.

    :param str raw: raw text to clean up
    :param stream_item: optional stream item with encoding metadata
    :type stream_item: :class:`streamcorpus.StreamItem`
    :returns: UTF-8-encoded byte string of cleaned HTML text
    :returntype: :class:`str`

    '''
    # Fix emails by protecting the <,> from HTML
    arg_0 = fix_emails(arg_0)
    arg_3 = nice_decode(arg_0, arg_1=arg_1, arg_2=arg_2)
    if arg_3 is None:
        # give up on decoding it... maybe this should use force_unicode
        arg_3 = arg_0

    # default attempt uses vanilla lxml.html
    try:
        arg_4 = lxml.html.document_fromstring(arg_3)
    except ValueError, exc:
        if 'with encoding declaration' in str(exc):
            arg_4 = lxml.html.document_fromstring(arg_0)
        else:
            raise

    # While we have the document parsed as a DOM, let's strip attributes.
    # (The HTML cleaner seems to only support whitelisting attributes.
    # As of now, we just want to blacklist a few.)
    lxml.etree.strip_attributes(arg_4, 'class', 'id')

    # if that worked, then we will be able to generate a
    # valid HTML string
    arg_5 = lxml.html.tostring(arg_4, arg_2=unicode)

    # remove any ^M characters
    arg_5 = string.replace(arg_5, '\r', ' ')

    # We drop utf8 characters that are above 0xFFFF as
    # Lingpipe seems to be doing the wrong thing with them.
    arg_5 = drop_invalid_and_upper_utf8_chars(arg_5)

    # construct a Cleaner that removes any ``<script>`` tags,
    # Javascript, like an ``onclick`` attribute, comments, style
    # tags or attributes, ``<link>`` tags
    arg_6 = lxml.html.clean.Cleaner(
        scripts=True, javascript=True,
        comments=True,
        # do not remove <html> <head> <title> etc
        page_structure=False,
        remove_tags=['base'],
        style=True, links=True)

    # now get the really sanitized HTML
    arg_7 = arg_6.clean_html(arg_5)

    # generate pretty HTML in utf-8
    arg_7 = lxml.html.tostring(
        lxml.html.document_fromstring(arg_7),
        method='html', arg_2='utf-8',
        pretty_print=True,
        # include_meta_content_type=True
        )

    return uniform_html(arg_7)

Get a clean text representation of presumed HTML .


def Func ( arg_0 ) : arg_0 . _tryfinallys = [ ] arg_0 . stats = arg_0 . linter . add_stats ( module = 0 , function = 0 , method = 0 , class_ = 0 )

def Func(arg_0):
        """initialize visit variables and statistics
        """
        arg_0._tryfinallys = []
        arg_0.stats = arg_0.linter.add_stats(module=0, function=0, method=0, class_=0)


(self, url, name, callback=None, params=None, headers=None)

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None):
        """
        Asynchronous GET request with the process pool.
        """
        if arg_2 is None: arg_2 = ''
        arg_4 = arg_4 or {}
        arg_5 = arg_5 or {}
        arg_6 = arg_0._build_endpoint_url(arg_1, arg_2)
        arg_0._authenticate(arg_4, arg_5)
        process_pool.apply_async(make_get_request,
            args=(arg_6, arg_4, arg_5), arg_3=arg_3)

Asynchronous GET request with the process pool .


def Func ( arg_0 ) : arg_1 = re . compile ( r'\\$' , re . MULTILINE ) arg_0 = arg_1 . sub ( '' , arg_0 ) return arg_0

def Func(arg_0):
    """Format a string for screen printing.

    This removes some latex-type format codes."""
    # Paragraph continue
    arg_1 = re.compile(r'\\$',re.MULTILINE)
    arg_0 = arg_1.sub('',arg_0)
    return arg_0


def Func ( ) : _load_plugins ( ) arg_0 = KeyringBackend . get_viable_backends ( ) arg_1 = util . suppress_exceptions ( arg_0 , exceptions = TypeError ) return list ( arg_1 )

def Func():
    """
    Return a list of all implemented keyrings that can be constructed without
    parameters.
    """
    _load_plugins()
    arg_0 = KeyringBackend.get_viable_backends()
    arg_1 = util.suppress_exceptions(arg_0, exceptions=TypeError)
    return list(arg_1)

Return a list of all implemented keyrings that can be constructed without parameters .


def Func ( arg_0 , arg_1 , arg_2 = 0 ) : arg_1 = BytesIO ( arg_1 ) arg_1 . seek ( arg_2 ) arg_3 = BytesIO ( ) for arg_4 in arg_0 : arg_5 = arg_1 . read ( int ( arg_4 ) ) [ : : - 1 ] arg_3 . write ( arg_5 ) return arg_3 . getvalue ( )

def Func(arg_0, arg_1, arg_2=0):
    """Swap bytes in `data` according to `fmt`, starting at byte `offset`
    and return the result. `fmt` must be an iterable, iterating over
    number of bytes to swap. For example, the format string ``'24'``
    applied to the bytes ``b'\\x00\\x11\\x22\\x33\\x44\\x55'`` will
    produce the result ``b'\\x11\\x00\\x55\\x44\\x33\\x22'``.

    """

    arg_1 = BytesIO(arg_1)
    arg_1.seek(arg_2)
    arg_3 = BytesIO()

    for arg_4 in arg_0:
        arg_5 = arg_1.read(int(arg_4))[::-1]
        arg_3.write(arg_5)

    return arg_3.getvalue()


def
Func
(
arg_0
)
:
logging
.
info
(
"%s train=%d valid=%d test=%d"
%
(
arg_0
.
__class__
.
__name__
,
len
(
list
(
arg_0
.
_train_set
)
)
if
arg_0
.
_train_set
else
0
,
len
(
list
(
arg_0
.
_valid_set
)
)
if
arg_0
.
_valid_set
else
0
,
len
(
list
(
arg_0
.
_test_set
)
)
if
arg_0
.
_test_set
else
0
)
)

def Func(arg_0):
        """
        Print dataset statistics.
        """
        logging.info("%s train=%d valid=%d test=%d" % (arg_0.__class__.__name__,
                                                       len(list(arg_0._train_set)) if arg_0._train_set else 0,
                                                       len(list(arg_0._valid_set)) if arg_0._valid_set else 0,
                                                       len(list(arg_0._test_set)) if arg_0._test_set else 0))


def Func ( arg_0 ) : @ interceptable @ functools . wraps ( arg_0 , assigned = ( '__module__' , '__name__' ) ) @ docstring_util . expand_docstring ( cls = arg_0 . __name__ , doc = inspect . cleandoc ( arg_0 . __init__ . __doc__ or '' ) ) def func ( * arg_1 , ** arg_2 ) : arg_3 = arg_2 . pop ( 'sample_shape' , ( ) ) arg_4 = arg_2 . pop ( 'value' , None ) return RandomVariable ( distribution = arg_0 ( * arg_1 , ** arg_2 ) , arg_3 = arg_3 , arg_4 = arg_4 ) return func

def Func(arg_0):
  """Factory function to make random variable given distribution class."""

  @interceptable
  @functools.wraps(arg_0, assigned=('__module__', '__name__'))
  @docstring_util.expand_docstring(
      cls=arg_0.__name__,
      doc=inspect.cleandoc(arg_0.__init__.__doc__ or ''))
  def func(*arg_1, **arg_2):
    # pylint: disable=g-doc-args
    """Create a random variable for ${cls}.

    See ${cls} for more details.

    Returns:
      RandomVariable.

    #### Original Docstring for Distribution

    ${doc}
    """
    # pylint: enable=g-doc-args
    arg_3 = arg_2.pop('sample_shape', ())
    arg_4 = arg_2.pop('value', None)
    return RandomVariable(distribution=arg_0(*arg_1, **arg_2),
                          arg_3=arg_3,
                          arg_4=arg_4)
  return func

Factory function to make random variable given distribution class .


(self, name="default", i1=None, i2=None, selection=None, cache=False)

def Func(arg_0, arg_1="default", arg_2=None, arg_3=None, arg_4=None, arg_5=False):
        """Internal use, ignores the filter"""
        arg_2 = arg_2 or 0
        arg_3 = arg_3 or len(arg_0)
        arg_6 = scopes._BlockScopeSelection(arg_0, arg_2, arg_3, arg_4, arg_5=arg_5)
        return arg_6.evaluate(arg_1)


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . _perform_request ( url = '/images/' + arg_1 , method = 'DELETE' ) return arg_2

def Func(arg_0, arg_1):
        """
        Removes only user created images.

        :param      image_id: The unique ID of the image.
        :type       image_id: ``str``

        """
        arg_2 = arg_0._perform_request(url='/images/' + arg_1,
                                         method='DELETE')
        return arg_2


return cls(client.http.client_id, *args, **kwargs)

def Func ( arg_0 , arg_1 , * arg_2 , ** arg_3 ) : return arg_0 ( arg_1 . http . client_id , * arg_2 , ** arg_3 )

def Func(arg_0, arg_1, *arg_2, **arg_3):
        """Construct a OAuth2 object from a `spotify.Client`."""
        return arg_0(arg_1.http.client_id, *arg_2, **arg_3)

Construct a OAuth2 object from a spotify . Client .


def
Func
(
arg_0
=
,
arg_1
=
False
)
:
if
arg_0
is
:
return
partial
(
Func
,
arg_1
=
arg_1
)
@
wraps
(
arg_0
)
def
wrapper
(
arg_2
,
*
arg_3
,
**
arg_4
)
:
arg_5
=
arg_0
(
arg_2
,
*
arg_3
,
**
arg_4
)
try
:
if
arg_1
:
arg_2
.
Funcer
.
delete
(
arg_5
)
else
:
arg_2
.
Funcer
.
Func
(
arg_5
)
except
RequestError
:
current_app
.
logger
.
exception
(
'Could not Func {0}.'
.
format
(
arg_5
)
)
return
arg_5
return
wrapper

def Func(arg_0=None, arg_1=False):
    """Decorator to update Func.

    :param method: Function wrapped. (Default: ``None``)
    :param delete: If `True` delete the Funced record. (Default: ``None``)
    """
    if arg_0 is None:
        return partial(Func, arg_1=arg_1)

    @wraps(arg_0)
    def wrapper(arg_2, *arg_3, **arg_4):
        """Send record for Funcing."""
        arg_5 = arg_0(arg_2, *arg_3, **arg_4)
        try:
            if arg_1:
                arg_2.Funcer.delete(arg_5)
            else:
                arg_2.Funcer.Func(arg_5)
        except RequestError:
            current_app.logger.exception('Could not Func {0}.'.format(arg_5))
        return arg_5
    return wrapper

Decorator to update index.

    :param method: Function wrapped. (Default: ``None``)
    :param delete: If `True` delete the indexed record. (Default: ``None``)


(self, data, position=111, xlabel=None, ylabel=None, cmap=None,
                 aspect="auto", interpolation="nearest", name=None)

def Func ( arg_0 , arg_1 , arg_2 = 111 , arg_3 = None , arg_4 = None , arg_5 = None , arg_6 = "auto" , arg_7 = "nearest" , arg_8 = None ) : if arg_5 is None : arg_5 = cm . Greys arg_9 = arg_0 . _addBase ( arg_2 , arg_3 = arg_3 , arg_4 = arg_4 ) arg_9 . imshow ( arg_1 , arg_5 = arg_5 , arg_6 = arg_6 , arg_7 = arg_7 ) if arg_0 . _show : plt . draw ( ) if arg_8 is not None : if not os . path . exists ( "log" ) : os . mkdir ( "log" ) plt . savefig ( "log/{name}.png" . format ( arg_8 = arg_8 ) , bbox_inches = "tight" , figsize = ( 8 , 6 ) , dpi = 400 )

def Func(arg_0, arg_1, arg_2=111, arg_3=None, arg_4=None, arg_5=None,
                 arg_6="auto", arg_7="nearest", arg_8=None):
    """ Adds an image to the plot's figure.

    @param data a 2D array. See matplotlib.Axes.imshow documentation.
    @param position A 3-digit number. The first two digits define a 2D grid
            where subplots may be added. The final digit specifies the nth grid
            location for the added subplot
    @param xlabel text to be displayed on the x-axis
    @param ylabel text to be displayed on the y-axis
    @param cmap color map used in the rendering
    @param aspect how aspect ratio is handled during resize
    @param interpolation interpolation method
    """
    if arg_5 is None:
      # The default colormodel is an ugly blue-red model.
      arg_5 = cm.Greys

    arg_9 = arg_0._addBase(arg_2, arg_3=arg_3, arg_4=arg_4)
    arg_9.imshow(arg_1, arg_5=arg_5, arg_6=arg_6, arg_7=arg_7)

    if arg_0._show:
      plt.draw()

    if arg_8 is not None:
      if not os.path.exists("log"):
        os.mkdir("log")
      plt.savefig("log/{name}.png".format(arg_8=arg_8), bbox_inches="tight",
                  figsize=(8, 6), dpi=400)


def Func ( arg_0 , arg_1 ) : if ( type ( arg_1 . next_sibling ) == element . Tag and arg_1 . next_sibling . name == 'a' ) : arg_2 = arg_1 . next_sibling if arg_1 . get ( 'href' ) and arg_2 . get ( 'href' ) : arg_3 = arg_0 . _parse_href ( arg_1 . get ( 'href' ) ) arg_4 = arg_0 . _parse_href ( arg_2 . get ( 'href' ) ) if arg_3 == arg_4 : arg_5 = arg_2 . get_text ( ) arg_1 . append ( arg_5 ) arg_0 . tags_blacklist . append ( arg_2 )

def Func(arg_0, arg_1):
        """
        If next tag is link with same href, combine them.
        """
        if (type(arg_1.next_sibling) == element.Tag and
                arg_1.next_sibling.name == 'a'):

            arg_2 = arg_1.next_sibling
            if arg_1.get('href') and arg_2.get('href'):
                arg_3 = arg_0._parse_href(arg_1.get('href'))
                arg_4 = arg_0._parse_href(arg_2.get('href'))

                if arg_3 == arg_4:
                    arg_5 = arg_2.get_text()
                    arg_1.append(arg_5)
                    arg_0.tags_blacklist.append(arg_2)

If next tag is link with same href combine them .


def Func ( arg_0 ) : arg_1 = 0 if arg_0 . attachments : if isinstance ( arg_0 . attachments , str ) : arg_0 . attachments = [ arg_0 . attachments ] for arg_3 in arg_0 . attachments : arg_4 = MIMEApplication ( open ( arg_3 , "rb" ) . read ( ) ) arg_4 . add_header ( "Content-Disposition" , "attachment" , filename = arg_3 ) arg_0 . message . attach ( arg_4 ) arg_1 += 1 return arg_1

def Func(arg_0):
        """Add required attachments."""
        arg_1 = 0
        if arg_0.attachments:
            if isinstance(arg_0.attachments, str):
                arg_0.attachments = [arg_0.attachments]

            for arg_3 in arg_0.attachments:
                arg_4 = MIMEApplication(open(arg_3, "rb").read())
                arg_4.add_header("Content-Disposition", "attachment", filename=arg_3)
                arg_0.message.attach(arg_4)
                arg_1 += 1
        return arg_1


def Func ( arg_0 , arg_1 ) : def _inner ( arg_2 ) : if hasattr ( arg_2 , 'parse' ) : arg_3 = arg_2 . parse else : arg_3 = arg_2 arg_0 . tag ( arg_1 , arg_3 ) return arg_2 return _inner

def Func(arg_0, arg_1):
    """
    Decorator to register class tags

    :param library: The template tag library, typically instantiated as ``register = Library()``.
    :type library: :class:`~django.template.Library`
    :param name: The name of the template tag
    :type name: str

    Example:

    .. code-block:: python

        @Func(register, 'my_tag')
        class MyTag(BaseNode):
            pass
    """
    def _inner(arg_2):
        if hasattr(arg_2, 'parse'):
            arg_3 = arg_2.parse
        else:
            # Hope that it's either a function, or cls with __init__(self, parser, token) method.
            arg_3 = arg_2

        arg_0.tag(arg_1, arg_3)
        return arg_2  # Return the class body to keep it in the namespace of the module

    return _inner

Decorator to register class tags

    :param library: The template tag library, typically instantiated as ``register = Library()``.
    :type library: :class:`~django.template.Library`
    :param name: The name of the template tag
    :type name: str

    Example:

    .. code-block:: python

        @template_tag(register, 'my_tag')
        class MyTag(BaseNode):
            pass


def Func ( arg_0 ) : arg_1 = _load_yaml_ ( f'{PKG_PATH}/markets/{cat}.yml' ) arg_2 = os . environ . get ( 'BBG_ROOT' , '' ) . replace ( '\\' , '/' ) if not arg_2 : return arg_1 for arg_0 , arg_3 in _load_yaml_ ( f'{root}/markets/{cat}.yml' ) . items ( ) : if isinstance ( arg_3 , dict ) : if arg_0 in arg_1 : arg_1 [ arg_0 ] . update ( arg_3 ) else : arg_1 [ arg_0 ] = arg_3 if isinstance ( arg_3 , list ) and isinstance ( arg_1 [ arg_0 ] , list ) : arg_1 [ arg_0 ] += arg_3 return arg_1

def Func(arg_0):
    """
    Load parameters for assets

    Args:
        cat: category

    Returns:
        dict

    Examples:
        >>> import pandas as pd
        >>>
        >>> assets = Func(cat='assets')
        >>> all(cat in assets for cat in ['Equity', 'Index', 'Curncy', 'Corp'])
        True
        >>> os.environ['BBG_PATH'] = ''
        >>> exch = Func(cat='exch')
        >>> pd.Series(exch['EquityUS']).allday
        [400, 2000]
        >>> test_root = f'{PKG_PATH}/tests'
        >>> os.environ['BBG_PATH'] = test_root
        >>> ovrd_exch = Func(cat='exch')
        >>> # Somehow os.environ is not set properly in doctest environment
        >>> ovrd_exch.update(_load_yaml_(f'{test_root}/markets/exch.yml'))
        >>> pd.Series(ovrd_exch['EquityUS']).allday
        [300, 2100]
    """
    arg_1 = _load_yaml_(f'{PKG_PATH}/markets/{cat}.yml')
    arg_2 = os.environ.get('BBG_ROOT', '').replace('\\', '/')
    if not arg_2: return arg_1
    for arg_0, arg_3 in _load_yaml_(f'{root}/markets/{cat}.yml').items():
        if isinstance(arg_3, dict):
            if arg_0 in arg_1: arg_1[arg_0].update(arg_3)
            else: arg_1[arg_0] = arg_3
        if isinstance(arg_3, list) and isinstance(arg_1[arg_0], list): arg_1[arg_0] += arg_3
    return arg_1

Load parameters for assets

    Args:
        cat: category

    Returns:
        dict

    Examples:
        >>> import pandas as pd
        >>>
        >>> assets = load_info(cat='assets')
        >>> all(cat in assets for cat in ['Equity', 'Index', 'Curncy', 'Corp'])
        True
        >>> os.environ['BBG_PATH'] = ''
        >>> exch = load_info(cat='exch')
        >>> pd.Series(exch['EquityUS']).allday
        [400, 2000]
        >>> test_root = f'{PKG_PATH}/tests'
        >>> os.environ['BBG_PATH'] = test_root
        >>> ovrd_exch = load_info(cat='exch')
        >>> # Somehow os.environ is not set properly in doctest environment
        >>> ovrd_exch.update(_load_yaml_(f'{test_root}/markets/exch.yml'))
        >>> pd.Series(ovrd_exch['EquityUS']).allday
        [300, 2100]


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = ( arg_0 . instruction . address + 4 ) & 0xfffffffc arg_1 . write ( arg_3 + arg_2 . read ( ) )

def Func(arg_0, arg_1, arg_2):
        """
        Address to Register adds an immediate value to the PC value, and writes the result to the destination register.

        :param ARMv7Operand dest: Specifies the destination register.
        :param ARMv7Operand src:
            Specifies the label of an instruction or literal data item whose address is to be loaded into
            <Rd>. The assembler calculates the required value of the offset from the Align(PC,4)
            value of the Func instruction to this label.
        """
        arg_3 = (arg_0.instruction.address + 4) & 0xfffffffc
        arg_1.write(arg_3 + arg_2.read())

Address to Register adds an immediate value to the PC value, and writes the result to the destination register.

        :param ARMv7Operand dest: Specifies the destination register.
        :param ARMv7Operand src:
            Specifies the label of an instruction or literal data item whose address is to be loaded into
            <Rd>. The assembler calculates the required value of the offset from the Align(PC,4)
            value of the ADR instruction to this label.

Address to Register adds an immediate value to the PC value and writes the result to the destination register .


def Func(arg_0):
    """
    Returns content of the given 'fpath' with HTML annotations for syntax
    highlighting
    """

    if not os.path.exists(arg_0):
        return "COULD-NOT-FIND-TESTCASE-SRC-AT-FPATH:%r" % arg_0

    # NOTE: Do SYNTAX highlight?

    return open(arg_0, "r").read()

Returns content of the given fpath with HTML annotations for syntax highlighting


def
Func
(
)
:
arg_0
=
os
.
path
.
join
(
SCHEMA_DIR
,
'jams_schema.json'
)
arg_1
=
with
open
(
resource_filename
(
__name__
,
arg_0
)
,
mode
=
'r'
)
as
fdesc
:
arg_1
=
json
.
load
(
fdesc
)
if
arg_1
is
:
raise
JamsError
(
'Unable to load JAMS schema'
)
return
arg_1

def Func():
    '''Load the schema file from the package.'''

    arg_0 = os.path.join(SCHEMA_DIR, 'jams_schema.json')

    arg_1 = None
    with open(resource_filename(__name__, arg_0), mode='r') as fdesc:
        arg_1 = json.load(fdesc)

    if arg_1 is None:
        raise JamsError('Unable to load JAMS schema')

    return arg_1


def
Func
(
arg_0
,
arg_1
,
**
arg_2
)
:
arg_3
=
arg_0
.
session
.
get
(
arg_1
=
arg_1
,
headers
=
arg_0
.
_get_api_headers
(
)
,
**
arg_2
)
if
not
arg_3
.
ok
:
raise
ServerException
(
'{0}: {1}'
.
format
(
arg_3
.
status_code
,
arg_3
.
text
or
arg_3
.
reason
)
)
return
arg_3
.
json
(
)

def Func(arg_0, arg_1, **arg_2):
        """
        Convenience method for getting
        """
        arg_3 = arg_0.session.get(
            arg_1=arg_1,
            headers=arg_0._get_api_headers(),
            **arg_2
        )
        if not arg_3.ok:
            raise ServerException(
                '{0}: {1}'.format(
                    arg_3.status_code,
                    arg_3.text or arg_3.reason
                ))
        return arg_3.json()


return {
            'import_labels_as_tags':
            self.config.get('import_labels_as_tags', False, asbool),
            'label_template':
            self.config.get('label_template', DEFAULT_LABEL_TEMPLATE),
            }

def Func ( arg_0 ) : return { 'import_labels_as_tags' : arg_0 . config . get ( 'import_labels_as_tags' , False , asbool ) , 'label_template' : arg_0 . config . get ( 'label_template' , DEFAULT_LABEL_TEMPLATE ) , }

def Func(arg_0):
        """
        Return extra config options to be passed to the TrelloIssue class
        """
        return {
            'import_labels_as_tags':
            arg_0.config.get('import_labels_as_tags', False, asbool),
            'label_template':
            arg_0.config.get('label_template', DEFAULT_LABEL_TEMPLATE),
            }


def Func ( arg_0 , arg_1 , ** arg_2 ) : with closing ( _apns_create_socket_to_push ( ** arg_2 ) ) as socket : for arg_3 , arg_4 in enumerate ( arg_0 ) : _apns_send ( arg_4 , arg_1 , arg_3 = arg_3 , socket = socket , ** arg_2 ) _apns_check_errors ( socket )

def Func(arg_0, arg_1, **arg_2):
    """
    Sends an APNS notification to one or more registration_ids.
    The registration_ids argument needs to be a list.

    Note that if set alert should always be a string. If it is not set,
    it won't be included in the notification. You will need to pass None
    to this for silent notifications.
    """
    with closing(_apns_create_socket_to_push(**arg_2)) as socket:
        for arg_3, arg_4 in enumerate(arg_0):
            _apns_send(arg_4, arg_1, arg_3=arg_3, socket=socket, **arg_2)
        _apns_check_errors(socket)

Sends an APNS notification to one or more registration_ids . The registration_ids argument needs to be a list .


def Func ( arg_0 = ( ) ) : arg_1 = [ '*{0}*' . format ( p ) for p in arg_0 ] + [ '*' ] arg_2 = [ ] arg_3 = len ( PROJ_ARCHIVE ) + 1 for arg_4 in arg_1 : arg_5 = os . path . join ( PROJ_ARCHIVE , '*' , '*' , arg_4 ) arg_2 . append ( set ( arg_6 [ arg_3 : ] for arg_6 in glob . glob ( arg_5 ) ) ) arg_2 = reduce ( lambda x , y : x . intersection ( y ) , arg_2 ) for arg_7 in sorted ( arg_2 ) : print ( arg_7 )

def Func(arg_0=()):
    "List the contents of the archive directory."
    # strategy: pick the intersection of all the patterns the user provides
    arg_1 = ['*{0}*'.format(p) for p in arg_0] + ['*']

    arg_2 = []
    arg_3 = len(PROJ_ARCHIVE) + 1
    for arg_4 in arg_1:
        arg_5 = os.path.join(PROJ_ARCHIVE, '*', '*', arg_4)
        arg_2.append(set(
            arg_6[arg_3:] for arg_6 in glob.glob(arg_5)
        ))

    arg_2 = reduce(lambda x, y: x.intersection(y),
                     arg_2)

    for arg_7 in sorted(arg_2):
        print(arg_7)

List the contents of the archive directory .


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] arg_3 = re . findall ( arg_0 . re [ "table" ] , arg_1 ) for arg_4 in arg_3 : arg_5 = WikipediaTable ( ) arg_5 . properties = arg_4 . split ( "\n" ) [ 0 ] . strip ( "{|" ) . strip ( ) arg_0 . connect_table ( arg_5 , arg_4 , arg_1 ) arg_7 = None for arg_4 in arg_4 . split ( "\n" ) : arg_4 = arg_4 . strip ( ) if arg_4 . startswith ( "|+" ) : arg_8 = arg_0 . plain ( arg_4 . strip ( "|+" ) ) arg_5 . title = arg_8 elif arg_4 . startswith ( "|-" ) : if arg_7 : arg_7 . properties = arg_4 . strip ( "|-" ) . strip ( ) arg_5 . append ( arg_7 ) arg_7 = None elif arg_4 . startswith ( "|}" ) : pass elif arg_4 . startswith ( "|" ) or arg_4 . startswith ( "!" ) : arg_7 = arg_0 . parse_table_row ( arg_4 , arg_7 ) if arg_7 : arg_5 . append ( arg_7 ) if len ( arg_5 ) > 0 : arg_2 . append ( arg_5 ) return arg_2

def Func(arg_0, arg_1):

        """ Returns a list of tables in the markup.

        A Wikipedia table looks like:
        {| border="1"
        |-
        |Cell 1 (no modifier - not aligned)
        |-
        |align="right" |Cell 2 (right aligned)
        |-
        |}

        """

        arg_2 = []
        arg_3 = re.findall(arg_0.re["table"], arg_1)
        for arg_4 in arg_3:

            arg_5 = WikipediaTable()
            arg_5.properties = arg_4.split("\n")[0].strip("{|").strip()
            arg_0.connect_table(arg_5, arg_4, arg_1)

            # Tables start with "{|".
            # On the same line can be properties, e.g. {| border="1"
            # The table heading starts with "|+".
            # A new row in the table starts with "|-".
            # The end of the table is marked with "|}".
            arg_7 = None
            for arg_4 in arg_4.split("\n"):
                arg_4 = arg_4.strip()
                if arg_4.startswith("|+"):
                    arg_8 = arg_0.plain(arg_4.strip("|+"))
                    arg_5.title = arg_8
                elif arg_4.startswith("|-"):
                    if arg_7:
                        arg_7.properties = arg_4.strip("|-").strip()
                        arg_5.append(arg_7)
                    arg_7 = None
                elif arg_4.startswith("|}"):
                    pass
                elif arg_4.startswith("|") \
                  or arg_4.startswith("!"):
                    arg_7 = arg_0.parse_table_row(arg_4, arg_7)

            # Append the last row.
            if arg_7: arg_5.append(arg_7)
            if len(arg_5) > 0:
                arg_2.append(arg_5)

        return arg_2

Returns a list of tables in the markup .


def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_2_0):
        """
        Write the AttributeReference structure encoding to the data stream.

        Args:
            output_buffer (stream): A data stream in which to encode
                Attributes structure data, supporting a Func method.
            kmip_version (enum): A KMIPVersion enumeration defining the KMIP
                version with which the object will be encoded. Optional,
                defaults to KMIP 2.0.

        Raises:
            InvalidField: Raised if the vendor identification or attribute name
                fields are not defined.
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the AttributeReference structure.
        """
        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:
            raise exceptions.VersionNotSupported(
                "KMIP {} does not support the AttributeReference "
                "object.".format(
                    arg_2.value
                )
            )

        arg_6 = BytearrayStream()

        if arg_0._vendor_identification:
            arg_0._vendor_identification.Func(
                arg_6,
                arg_2=arg_2
            )
        else:
            raise exceptions.InvalidField(
                "The AttributeReference is missing the vendor identification "
                "field."
            )

        if arg_0._attribute_name:
            arg_0._attribute_name.Func(
                arg_6,
                arg_2=arg_2
            )
        else:
            raise exceptions.InvalidField(
                "The AttributeReference is missing the attribute name field."
            )

        arg_0.length = arg_6.length()
        super(AttributeReference, arg_0).Func(
            arg_1,
            arg_2=arg_2
        )
        arg_1.Func(arg_6.buffer)

Write the AttributeReference structure encoding to the data stream.

        Args:
            output_buffer (stream): A data stream in which to encode
                Attributes structure data, supporting a write method.
            kmip_version (enum): A KMIPVersion enumeration defining the KMIP
                version with which the object will be encoded. Optional,
                defaults to KMIP 2.0.

        Raises:
            InvalidField: Raised if the vendor identification or attribute name
                fields are not defined.
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the AttributeReference structure.

Write the AttributeReference structure encoding to the data stream .


(session, project_id, bidder_id, amount,
                             reason, description)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 , arg_5 ) : arg_6 = { 'project_id' : arg_1 , 'bidder_id' : arg_2 , 'amount' : arg_3 , 'reason' : arg_4 , 'description' : arg_5 } arg_7 = make_post_request ( arg_0 , 'milestones' , arg_8 = arg_6 ) arg_8 = arg_7 . json ( ) if arg_7 . status_code == 200 : arg_6 = arg_8 [ 'result' ] return Milestone ( arg_6 ) else : raise MilestoneNotCreatedException ( message = arg_8 [ 'message' ] , error_code = arg_8 [ 'error_code' ] , request_id = arg_8 [ 'request_id' ] )

def Func(arg_0, arg_1, arg_2, arg_3,
                             arg_4, arg_5):
    """
    Create a milestone payment
    """
    arg_6 = {
        'project_id': arg_1,
        'bidder_id': arg_2,
        'amount': arg_3,
        'reason': arg_4,
        'description': arg_5
    }
    # POST /api/projects/0.1/milestones/
    arg_7 = make_post_request(arg_0, 'milestones',
                                 arg_8=arg_6)
    arg_8 = arg_7.json()
    if arg_7.status_code == 200:
        arg_6 = arg_8['result']
        return Milestone(arg_6)
    else:
        raise MilestoneNotCreatedException(message=arg_8['message'],
                                           error_code=arg_8['error_code'],
                                           request_id=arg_8['request_id'])


return (settings.wordlist, settings.sowpods, settings.length,
            settings.starts_with, settings.ends_with)

def Func(arg_0):
    """Argparse logic, command line options.

    Args:
        args: sys.argv[1:], everything passed to the program after its name

    Returns:
        A tuple of:
            a list of words/letters to search
            a boolean to declare if we want to use the sowpods words file
            a boolean to declare if we want to output anagrams by length
            a string of starting characters to find anagrams based on
            a string of ending characters to find anagrams based on

    Raises:
        SystemExit if the user passes invalid arguments, --version or --help
    """

    arg_1 = argparse.ArgumentParser(
        prog="nagaram",
        description="Finds Scabble anagrams.",
        formatter_class=argparse.RawDescriptionHelpFormatter,
        add_help=False,
    )

    arg_1.add_argument(
        "-h", "--help",
        dest="help",
        action="store_true",
        default=False,
    )

    arg_1.add_argument(
        "--sowpods",
        dest="sowpods",
        action="store_true",
        default=False,
    )

    arg_1.add_argument(
        "--length",
        "-l",
        dest="length",
        action="store_true",
        default=False,
    )

    arg_1.add_argument(
        "--starts-with",
        "-s",
        dest="starts_with",
        metavar="chars",
        default="",
        nargs=1,
        type=str,
    )

    arg_1.add_argument(
        "--ends-with",
        "-e",
        dest="ends_with",
        metavar="chars",
        default="",
        nargs=1,
        type=str,
    )

    arg_1.add_argument(
        "--version",
        "-v",
        action="version",
        version="Nagaram {0} (Released: {1})".format(
            nagaram.__version__,
            nagaram.__release_date__,
        )
    )

    arg_1.add_argument(
        dest="wordlist",
        metavar="letters to find anagrams with (? for anything, _ for blanks)",
        nargs=argparse.REMAINDER,
    )

    arg_2 = arg_1.parse_args(arg_0)

    if arg_2.help:
        raise SystemExit(nagaram.__doc__.strip())

    if not arg_2.wordlist:
        raise SystemExit(arg_1.print_usage())

    if arg_2.starts_with:
        arg_2.starts_with = arg_2.starts_with[0]
    if arg_2.ends_with:
        arg_2.ends_with = arg_2.ends_with[0]

    return (arg_2.wordlist, arg_2.sowpods, arg_2.length,
            arg_2.starts_with, arg_2.ends_with)


def
Func
(
arg_0
)
:
arg_1
=
arg_0
if
isinstance
(
arg_1
,
str
)
:
arg_2
=
'{}_trans'
.
format
(
arg_1
)
arg_1
=
globals
(
)
[
arg_2
]
(
)
if
callable
(
arg_1
)
:
arg_1
=
arg_1
(
)
if
isinstance
(
arg_1
,
type
)
:
arg_1
=
arg_1
(
)
if
not
isinstance
(
arg_1
,
trans
)
:
raise
ValueError
(
"Could not get transform object."
)
return
arg_1

def Func(arg_0):
    """
    Return a trans object

    Parameters
    ----------
    t : str | callable | type | trans
        name of transformation function

    Returns
    -------
    out : trans
    """
    arg_1 = arg_0
    # Make sure trans object is instantiated
    if isinstance(arg_1, str):
        arg_2 = '{}_trans'.format(arg_1)
        arg_1 = globals()[arg_2]()
    if callable(arg_1):
        arg_1 = arg_1()
    if isinstance(arg_1, type):
        arg_1 = arg_1()

    if not isinstance(arg_1, trans):
        raise ValueError("Could not get transform object.")

    return arg_1


return 0 == len(graph.predecessors(node)) and 1 == len(graph.successors(node))

def Func ( arg_0 : arg_1 , arg_2 : arg_3 ) -> bool : return 0 == len ( arg_0 . predecessors ( arg_2 ) ) and 1 == len ( arg_0 . successors ( arg_2 ) )

def Func(arg_0: arg_1, arg_2: arg_3) -> bool:
    """Return if the node is an upstream leaf.

    An upstream leaf is defined as a node that has no in-edges, and exactly 1 out-edge.
    """
    return 0 == len(arg_0.predecessors(arg_2)) and 1 == len(arg_0.successors(arg_2))

Return if the node is an upstream leaf .


def Func ( arg_0 ) : def decorator ( arg_1 ) : if "_pyxmpp_Funcs" not in arg_1 . __dict__ : arg_1 . _pyxmpp_Funcs = set ( ) arg_1 . _pyxmpp_Funcs . add ( arg_0 ) return arg_1 return decorator

def Func(arg_0):
    """Decorating attaching a feature URI (for Service Discovery or Capability
    to a XMPPFeatureHandler class."""
    def decorator(arg_1):
        """Returns a decorated class"""
        if "_pyxmpp_Funcs" not in arg_1.__dict__:
            arg_1._pyxmpp_Funcs = set()
        arg_1._pyxmpp_Funcs.add(arg_0)
        return arg_1
    return decorator

Decorating attaching a feature URI ( for Service Discovery or Capability to a XMPPFeatureHandler class .


def
Func
(
arg_0
,
arg_1
=
,
**
arg_2
)
:
if
arg_0
==
"chrome"
:
return
webdriver
.
Chrome
(
desired_capabilities
=
arg_1
,
**
arg_2
)
if
arg_0
==
"edge"
:
return
webdriver
.
Edge
(
arg_1
=
arg_1
,
**
arg_2
)
if
arg_0
in
[
"ff"
,
"firefox"
]
:
return
webdriver
.
Firefox
(
arg_1
=
arg_1
,
**
arg_2
)
if
arg_0
in
[
"ie"
,
"internet_explorer"
]
:
return
webdriver
.
Ie
(
arg_1
=
arg_1
,
**
arg_2
)
if
arg_0
==
"phantomjs"
:
return
webdriver
.
PhantomJS
(
desired_capabilities
=
arg_1
,
**
arg_2
)
if
arg_0
==
"remote"
:
return
webdriver
.
Remote
(
desired_capabilities
=
arg_1
,
**
arg_2
)
if
arg_0
==
"safari"
:
return
webdriver
.
Safari
(
desired_capabilities
=
arg_1
,
**
arg_2
)
raise
ValueError
(
"unsupported browser: {}"
.
format
(
repr
(
arg_0
)
)
)

def Func(arg_0, arg_1=None, **arg_2):
    """
    Returns an instance of the given browser with the given capabilities.

    Args:
        browser_name (str): The name of the desired browser.
        capabilities (Dict[str, str | bool], optional): The desired capabilities of the browser.
            Defaults to None.
        options: Arbitrary keyword arguments for the browser-specific subclass of
            :class:`webdriver.Remote`.

    Returns:
        WebDriver: An instance of the desired browser.
    """

    if arg_0 == "chrome":
        return webdriver.Chrome(desired_capabilities=arg_1, **arg_2)
    if arg_0 == "edge":
        return webdriver.Edge(arg_1=arg_1, **arg_2)
    if arg_0 in ["ff", "firefox"]:
        return webdriver.Firefox(arg_1=arg_1, **arg_2)
    if arg_0 in ["ie", "internet_explorer"]:
        return webdriver.Ie(arg_1=arg_1, **arg_2)
    if arg_0 == "phantomjs":
        return webdriver.PhantomJS(desired_capabilities=arg_1, **arg_2)
    if arg_0 == "remote":
        return webdriver.Remote(desired_capabilities=arg_1, **arg_2)
    if arg_0 == "safari":
        return webdriver.Safari(desired_capabilities=arg_1, **arg_2)

    raise ValueError("unsupported browser: {}".format(repr(arg_0)))

Returns an instance of the given browser with the given capabilities .


def Func ( arg_0 , arg_1 ) : if arg_0 . _first_non_import_node : arg_0 . add_message ( "wrong-import-position" , arg_1 = arg_1 , args = arg_1 . as_string ( ) )

def Func(arg_0, arg_1):
        """Check `node` import or importfrom node position is correct

        Send a message  if `node` comes before another instruction
        """
        # if a first non-import instruction has already been encountered,
        # it means the import comes after it and therefore is not well placed
        if arg_0._first_non_import_node:
            arg_0.add_message("wrong-import-position", arg_1=arg_1, args=arg_1.as_string())

Check node import or importfrom node position is correct


def
Func
(
arg_0
)
:
for
arg_1
in
reversed
(
arg_0
.
instructions
)
:
if
arg_1
.
consumes_meshes
(
)
:
return
arg_1
.
Func
raise
IndexError
(
"{} consumes no meshes"
.
format
(
arg_0
)
)

def Func(arg_0):
        """The last consumed mesh.

        :return: the last consumed mesh
        :rtype: knittingpattern.Mesh.Mesh
        :raises IndexError: if no mesh is consumed

        .. seealso:: :attr:`number_of_consumed_meshes`
        """
        for arg_1 in reversed(arg_0.instructions):
            if arg_1.consumes_meshes():
                return arg_1.Func
        raise IndexError("{} consumes no meshes".format(arg_0))


return (0, 0) if not self.timeslots else\
            (min(self.timeslots.values()), max(self.timeslots.values()))

def Func ( arg_0 ) : return ( 0 , 0 ) if not arg_0 . timeslots else ( min ( arg_0 . timeslots . values ( ) ) , max ( arg_0 . timeslots . values ( ) ) )

def Func(arg_0):
        """Give the full time interval of the file. Note that the real interval
        can be longer because the sound file attached can be longer.

        :returns: Tuple of the form: ``(min_time, max_time)``.
        """
        return (0, 0) if not arg_0.timeslots else\
            (min(arg_0.timeslots.values()), max(arg_0.timeslots.values()))

Give the full time interval of the file . Note that the real interval can be longer because the sound file attached can be longer .


def Func(arg_0, arg_1):
  """Creates a Func that can be referenced from gin config files.

  After calling this function in Python, the Func can be referenced from
  within a Gin config file using the macro syntax. For example, in Python:

      gin.Func('THE_ANSWER', 42)

  Then, in a Gin config file:

      meaning.of_life = %THE_ANSWER

  Note that any Python object can be used as the value of a Func (including
  objects not representable as Gin literals). Values will be stored until
  program termination in a Gin-internal dictionary, so avoid creating Funcs
  with values that should have a limited lifetime.

  Optionally, a disambiguating module may be prefixed onto the Func
  name. For instance:

      gin.Func('some.modules.PI', 3.14159)

  Args:
    name: The name of the Func, possibly prepended by one or more
      disambiguating module components separated by periods. An macro with this
      name (including the modules) will be created.
    value: The value of the Func. This can be anything (including objects
      not representable as Gin literals). The value will be stored and returned
      whenever the Func is referenced.

  Raises:
    ValueError: If the Func's selector is invalid, or a Func with the
      given selector already exists.
  """
  if not config_parser.MODULE_RE.match(arg_0):
    raise ValueError("Invalid Func selector '{}'.".format(arg_0))

  if arg_3.matching_selectors(arg_0):
    arg_2 = "Constants matching selector '{}' already exist ({})."
    raise ValueError(arg_2.format(arg_0, arg_3.matching_selectors(arg_0)))

  arg_3[arg_0] = arg_1

Creates a constant that can be referenced from gin config files.

  After calling this function in Python, the constant can be referenced from
  within a Gin config file using the macro syntax. For example, in Python:

      gin.constant('THE_ANSWER', 42)

  Then, in a Gin config file:

      meaning.of_life = %THE_ANSWER

  Note that any Python object can be used as the value of a constant (including
  objects not representable as Gin literals). Values will be stored until
  program termination in a Gin-internal dictionary, so avoid creating constants
  with values that should have a limited lifetime.

  Optionally, a disambiguating module may be prefixed onto the constant
  name. For instance:

      gin.constant('some.modules.PI', 3.14159)

  Args:
    name: The name of the constant, possibly prepended by one or more
      disambiguating module components separated by periods. An macro with this
      name (including the modules) will be created.
    value: The value of the constant. This can be anything (including objects
      not representable as Gin literals). The value will be stored and returned
      whenever the constant is referenced.

  Raises:
    ValueError: If the constant's selector is invalid, or a constant with the
      given selector already exists.

Creates a constant that can be referenced from gin config files .