(value_and_gradients_function,
                initial_step_size=None,
                value_at_initial_step=None,
                value_at_zero=None,
                converged=None,
                threshold_use_approximate_wolfe_condition=1e-6,
                shrinkage_param=0.66,
                expansion_param=5.0,
                sufficient_decrease_param=0.1,
                curvature_param=0.9,
                step_size_shrink_param=0.1,
                max_iterations=50,
                name=None)

def Func(arg_0,
                arg_1=None,
                arg_2=None,
                arg_3=None,
                arg_4=None,
                arg_5=1e-6,
                arg_6=0.66,
                arg_7=5.0,
                arg_8=0.1,
                arg_9=0.9,
                arg_10=0.1,
                arg_11=50,
                arg_12=None):
  """The Hager Zhang line search algorithm.

  Performs an inexact line search based on the algorithm of
  [Hager and Zhang (2006)][2].
  The univariate objective function `value_and_gradients_function` is typically
  generated by projecting a multivariate objective function along a search
  direction. Suppose the multivariate function to be minimized is
  `g(x1,x2, .. xn)`. Let (d1, d2, ..., dn) be the direction along which we wish
  to perform a line search. Then the projected univariate function to be used
  for line search is

  ```None
    f(a) = g(x1 + d1 * a, x2 + d2 * a, ..., xn + dn * a)
  ```

  The directional derivative along (d1, d2, ..., dn) is needed for this
  procedure. This also corresponds to the derivative of the projected function
  `f(a)` with respect to `a`. Note that this derivative must be negative for
  `a = 0` if the direction is a descent direction.

  The usual stopping criteria for the line search is the satisfaction of the
  (weak) Wolfe conditions. For details of the Wolfe conditions, see
  ref. [3]. On a finite precision machine, the exact Wolfe conditions can
  be difficult to satisfy when one is very close to the minimum and as argued
  by [Hager and Zhang (2005)][1], one can only expect the minimum to be
  determined within square root of machine precision. To improve the situation,
  they propose to replace the Wolfe conditions with an approximate version
  depending on the derivative of the function which is applied only when one
  is very close to the minimum. The following algorithm implements this
  enhanced scheme.

  ### Usage:

  Primary use of line search methods is as an internal component of a class of
  optimization algorithms (called line search based methods as opposed to
  trust region methods). Hence, the end user will typically not want to access
  line search directly. In particular, inexact line search should not be
  confused with a univariate minimization method. The stopping criteria of line
  search is the satisfaction of Wolfe conditions and not the discovery of the
  minimum of the function.

  With this caveat in mind, the following example illustrates the standalone
  usage of the line search.

  ```python
    # Define value and gradient namedtuple
    ValueAndGradient = namedtuple('ValueAndGradient', ['x', 'f', 'df'])
    # Define a quadratic target with minimum at 1.3.
    def value_and_gradients_function(x):
      return ValueAndGradient(x=x, f=(x - 1.3) ** 2, df=2 * (x-1.3))
    # Set initial step size.
    step_size = tf.constant(0.1)
    ls_result = tfp.optimizer.linesearch.Func(
        value_and_gradients_function, initial_step_size=step_size)
    # Evaluate the results.
    with tf.Session() as session:
      results = session.run(ls_result)
      # Ensure convergence.
      assert results.converged
      # If the line search converged, the left and the right ends of the
      # bracketing interval are identical.
      assert results.left.x == result.right.x
      # Print the number of evaluations and the final step size.
      print ("Final Step Size: %f, Evaluations: %d" % (results.left.x,
                                                       results.func_evals))
  ```

  ### References:
  [1]: William Hager, Hongchao Zhang. A new conjugate gradient method with
    guaranteed descent and an efficient line search. SIAM J. Optim., Vol 16. 1,
    pp. 170-172. 2005.
    https://www.math.lsu.edu/~hozhang/papers/cg_descent.pdf

  [2]: William Hager, Hongchao Zhang. Algorithm 851: CG_DESCENT, a conjugate
    gradient method with guaranteed descent. ACM Transactions on Mathematical
    Software, Vol 32., 1, pp. 113-137. 2006.
    http://users.clas.ufl.edu/hager/papers/CG/cg_compare.pdf

  [3]: Jorge Nocedal, Stephen Wright. Numerical Optimization. Springer Series in
    Operations Research. pp 33-36. 2006

  Args:
    value_and_gradients_function: A Python callable that accepts a real scalar
      tensor and returns a namedtuple with the fields 'x', 'f', and 'df' that
      correspond to scalar tensors of real dtype containing the point at which
      the function was evaluated, the value of the function, and its
      derivative at that point. The other namedtuple fields, if present,
      should be tensors or sequences (possibly nested) of tensors.
      In usual optimization application, this function would be generated by
      projecting the multivariate objective function along some specific
      direction. The direction is determined by some other procedure but should
      be a descent direction (i.e. the derivative of the projected univariate
      function must be negative at 0.).
      Alternatively, the function may represent the batching of `n` such line
      functions (e.g. projecting a single multivariate objective function along
      `n` distinct directions at once) accepting n points as input, i.e. a
      tensor of shape [n], and the fields 'x', 'f' and 'df' in the returned
      namedtuple should each be a tensor of shape [n], with the corresponding
      input points, function values, and derivatives at those input points.
    initial_step_size: (Optional) Scalar positive `Tensor` of real dtype, or
      a tensor of shape [n] in batching mode. The initial value (or values) to
      try to bracket the minimum. Default is `1.` as a float32.
      Note that this point need not necessarily bracket the minimum for the line
      search to work correctly but the supplied value must be greater than 0.
      A good initial value will make the search converge faster.
    value_at_initial_step: (Optional) The full return value of evaluating
      value_and_gradients_function at initial_step_size, i.e. a namedtuple with
      'x', 'f', 'df', if already known by the caller. If supplied the value of
      `initial_step_size` will be ignored, otherwise the tuple will be computed
      by evaluating value_and_gradients_function.
    value_at_zero: (Optional) The full return value of
      value_and_gradients_function at `0.`, i.e. a namedtuple with
      'x', 'f', 'df', if already known by the caller. If not supplied the tuple
      will be computed by evaluating value_and_gradients_function.
    converged: (Optional) In batching mode a tensor of shape [n], indicating
      batch members which have already converged and no further search should
      be performed. These batch members are also reported as converged in the
      output, and both their `left` and `right` are set to the
      `value_at_initial_step`.
    threshold_use_approximate_wolfe_condition: Scalar positive `Tensor`
      of real dtype. Corresponds to the parameter 'epsilon' in
      [Hager and Zhang (2006)][2]. Used to estimate the
      threshold at which the line search switches to approximate Wolfe
      conditions.
    shrinkage_param: Scalar positive Tensor of real dtype. Must be less than
      `1.`. Corresponds to the parameter `gamma` in
      [Hager and Zhang (2006)][2].
      If the secant**2 step does not shrink the bracketing interval by this
      proportion, a bisection step is performed to reduce the interval width.
    expansion_param: Scalar positive `Tensor` of real dtype. Must be greater
      than `1.`. Used to expand the initial interval in case it does not bracket
      a minimum. Corresponds to `rho` in [Hager and Zhang (2006)][2].
    sufficient_decrease_param: Positive scalar `Tensor` of real dtype.
      Bounded above by the curvature param. Corresponds to `delta` in the
      terminology of [Hager and Zhang (2006)][2].
    curvature_param: Positive scalar `Tensor` of real dtype. Bounded above
      by `1.`. Corresponds to 'sigma' in the terminology of
      [Hager and Zhang (2006)][2].
    step_size_shrink_param: Positive scalar `Tensor` of real dtype. Bounded
      above by `1`. If the supplied step size is too big (i.e. either the
      objective value or the gradient at that point is infinite), this factor
      is used to shrink the step size until it is finite.
    max_iterations: Positive scalar `Tensor` of integral dtype or None. The
      maximum number of iterations to perform in the line search. The number of
      iterations used to bracket the minimum are also counted against this
      parameter.
    name: (Optional) Python str. The name prefixed to the ops created by this
      function. If not supplied, the default name 'Func' is used.

  Returns:
    results: A namedtuple containing the following attributes.
      converged: Boolean `Tensor` of shape [n]. Whether a point satisfying
        Wolfe/Approx wolfe was found.
      failed: Boolean `Tensor` of shape [n]. Whether line search failed e.g.
        if either the objective function or the gradient are not finite at
        an evaluation point.
      iterations: Scalar int32 `Tensor`. Number of line search iterations made.
      func_evals: Scalar int32 `Tensor`. Number of function evaluations made.
      left: A namedtuple, as returned by value_and_gradients_function,
        of the left end point of the final bracketing interval. Values are
        equal to those of `right` on batch members where converged is True.
        Otherwise, it corresponds to the last interval computed.
      right: A namedtuple, as returned by value_and_gradients_function,
        of the right end point of the final bracketing interval. Values are
        equal to those of `left` on batch members where converged is True.
        Otherwise, it corresponds to the last interval computed.
  """
  with tf.compat.v1.name_scope(arg_12, 'Func', [
      arg_1, arg_2, arg_3, arg_4,
      arg_5, arg_6,
      arg_7, arg_8, arg_9]):
    arg_13, arg_14, arg_15, arg_16 = _prepare_args(
        arg_0,
        arg_1,
        arg_2,
        arg_3,
        arg_5)

    arg_17 = (hzl.is_finite(arg_13) & (arg_13.df < 0) &
                    tf.math.is_finite(arg_14.x) & (arg_14.x > 0))

    if arg_4 is None:
      arg_18 = tf.zeros_like(arg_17)  # i.e. all false.
    else:
      arg_18 = tf.convert_to_tensor(value=arg_4)

    arg_19 = ~arg_18 & ~arg_17
    arg_20 = ~arg_18 & arg_17

    # Note: _fix_step_size returns immediately if either all inputs are invalid
    # or none of the active ones need fixing.
    arg_21, arg_22, arg_23 = _fix_step_size(
        arg_0, arg_14, arg_20,
        arg_10)

    arg_24 = HagerZhangLineSearchResult(
        arg_4=arg_18,
        arg_19=arg_19 | arg_23,
        func_evals=arg_16 + arg_21,
        iterations=tf.convert_to_tensor(value=0),
        left=arg_13,
        right=hzl.val_where(arg_18, arg_13, arg_22))

    def _apply_bracket_and_search():
      """Bracketing and searching to do for valid inputs."""
      return _bracket_and_search(
          arg_0, arg_24, arg_15, arg_11,
          arg_6, arg_7, arg_8,
          arg_9)

    arg_25 = ~arg_24.failed & ~arg_24.converged
    return prefer_static.cond(
        tf.reduce_any(input_tensor=arg_25),
        _apply_bracket_and_search,
        lambda: arg_24)

The Hager Zhang line search algorithm.

  Performs an inexact line search based on the algorithm of
  [Hager and Zhang (2006)][2].
  The univariate objective function `value_and_gradients_function` is typically
  generated by projecting a multivariate objective function along a search
  direction. Suppose the multivariate function to be minimized is
  `g(x1,x2, .. xn)`. Let (d1, d2, ..., dn) be the direction along which we wish
  to perform a line search. Then the projected univariate function to be used
  for line search is

  ```None
    f(a) = g(x1 + d1 * a, x2 + d2 * a, ..., xn + dn * a)
  ```

  The directional derivative along (d1, d2, ..., dn) is needed for this
  procedure. This also corresponds to the derivative of the projected function
  `f(a)` with respect to `a`. Note that this derivative must be negative for
  `a = 0` if the direction is a descent direction.

  The usual stopping criteria for the line search is the satisfaction of the
  (weak) Wolfe conditions. For details of the Wolfe conditions, see
  ref. [3]. On a finite precision machine, the exact Wolfe conditions can
  be difficult to satisfy when one is very close to the minimum and as argued
  by [Hager and Zhang (2005)][1], one can only expect the minimum to be
  determined within square root of machine precision. To improve the situation,
  they propose to replace the Wolfe conditions with an approximate version
  depending on the derivative of the function which is applied only when one
  is very close to the minimum. The following algorithm implements this
  enhanced scheme.

  ### Usage:

  Primary use of line search methods is as an internal component of a class of
  optimization algorithms (called line search based methods as opposed to
  trust region methods). Hence, the end user will typically not want to access
  line search directly. In particular, inexact line search should not be
  confused with a univariate minimization method. The stopping criteria of line
  search is the satisfaction of Wolfe conditions and not the discovery of the
  minimum of the function.

  With this caveat in mind, the following example illustrates the standalone
  usage of the line search.

  ```python
    # Define value and gradient namedtuple
    ValueAndGradient = namedtuple('ValueAndGradient', ['x', 'f', 'df'])
    # Define a quadratic target with minimum at 1.3.
    def value_and_gradients_function(x):
      return ValueAndGradient(x=x, f=(x - 1.3) ** 2, df=2 * (x-1.3))
    # Set initial step size.
    step_size = tf.constant(0.1)
    ls_result = tfp.optimizer.linesearch.hager_zhang(
        value_and_gradients_function, initial_step_size=step_size)
    # Evaluate the results.
    with tf.Session() as session:
      results = session.run(ls_result)
      # Ensure convergence.
      assert results.converged
      # If the line search converged, the left and the right ends of the
      # bracketing interval are identical.
      assert results.left.x == result.right.x
      # Print the number of evaluations and the final step size.
      print ("Final Step Size: %f, Evaluations: %d" % (results.left.x,
                                                       results.func_evals))
  ```

  ### References:
  [1]: William Hager, Hongchao Zhang. A new conjugate gradient method with
    guaranteed descent and an efficient line search. SIAM J. Optim., Vol 16. 1,
    pp. 170-172. 2005.
    https://www.math.lsu.edu/~hozhang/papers/cg_descent.pdf

  [2]: William Hager, Hongchao Zhang. Algorithm 851: CG_DESCENT, a conjugate
    gradient method with guaranteed descent. ACM Transactions on Mathematical
    Software, Vol 32., 1, pp. 113-137. 2006.
    http://users.clas.ufl.edu/hager/papers/CG/cg_compare.pdf

  [3]: Jorge Nocedal, Stephen Wright. Numerical Optimization. Springer Series in
    Operations Research. pp 33-36. 2006

  Args:
    value_and_gradients_function: A Python callable that accepts a real scalar
      tensor and returns a namedtuple with the fields 'x', 'f', and 'df' that
      correspond to scalar tensors of real dtype containing the point at which
      the function was evaluated, the value of the function, and its
      derivative at that point. The other namedtuple fields, if present,
      should be tensors or sequences (possibly nested) of tensors.
      In usual optimization application, this function would be generated by
      projecting the multivariate objective function along some specific
      direction. The direction is determined by some other procedure but should
      be a descent direction (i.e. the derivative of the projected univariate
      function must be negative at 0.).
      Alternatively, the function may represent the batching of `n` such line
      functions (e.g. projecting a single multivariate objective function along
      `n` distinct directions at once) accepting n points as input, i.e. a
      tensor of shape [n], and the fields 'x', 'f' and 'df' in the returned
      namedtuple should each be a tensor of shape [n], with the corresponding
      input points, function values, and derivatives at those input points.
    initial_step_size: (Optional) Scalar positive `Tensor` of real dtype, or
      a tensor of shape [n] in batching mode. The initial value (or values) to
      try to bracket the minimum. Default is `1.` as a float32.
      Note that this point need not necessarily bracket the minimum for the line
      search to work correctly but the supplied value must be greater than 0.
      A good initial value will make the search converge faster.
    value_at_initial_step: (Optional) The full return value of evaluating
      value_and_gradients_function at initial_step_size, i.e. a namedtuple with
      'x', 'f', 'df', if already known by the caller. If supplied the value of
      `initial_step_size` will be ignored, otherwise the tuple will be computed
      by evaluating value_and_gradients_function.
    value_at_zero: (Optional) The full return value of
      value_and_gradients_function at `0.`, i.e. a namedtuple with
      'x', 'f', 'df', if already known by the caller. If not supplied the tuple
      will be computed by evaluating value_and_gradients_function.
    converged: (Optional) In batching mode a tensor of shape [n], indicating
      batch members which have already converged and no further search should
      be performed. These batch members are also reported as converged in the
      output, and both their `left` and `right` are set to the
      `value_at_initial_step`.
    threshold_use_approximate_wolfe_condition: Scalar positive `Tensor`
      of real dtype. Corresponds to the parameter 'epsilon' in
      [Hager and Zhang (2006)][2]. Used to estimate the
      threshold at which the line search switches to approximate Wolfe
      conditions.
    shrinkage_param: Scalar positive Tensor of real dtype. Must be less than
      `1.`. Corresponds to the parameter `gamma` in
      [Hager and Zhang (2006)][2].
      If the secant**2 step does not shrink the bracketing interval by this
      proportion, a bisection step is performed to reduce the interval width.
    expansion_param: Scalar positive `Tensor` of real dtype. Must be greater
      than `1.`. Used to expand the initial interval in case it does not bracket
      a minimum. Corresponds to `rho` in [Hager and Zhang (2006)][2].
    sufficient_decrease_param: Positive scalar `Tensor` of real dtype.
      Bounded above by the curvature param. Corresponds to `delta` in the
      terminology of [Hager and Zhang (2006)][2].
    curvature_param: Positive scalar `Tensor` of real dtype. Bounded above
      by `1.`. Corresponds to 'sigma' in the terminology of
      [Hager and Zhang (2006)][2].
    step_size_shrink_param: Positive scalar `Tensor` of real dtype. Bounded
      above by `1`. If the supplied step size is too big (i.e. either the
      objective value or the gradient at that point is infinite), this factor
      is used to shrink the step size until it is finite.
    max_iterations: Positive scalar `Tensor` of integral dtype or None. The
      maximum number of iterations to perform in the line search. The number of
      iterations used to bracket the minimum are also counted against this
      parameter.
    name: (Optional) Python str. The name prefixed to the ops created by this
      function. If not supplied, the default name 'hager_zhang' is used.

  Returns:
    results: A namedtuple containing the following attributes.
      converged: Boolean `Tensor` of shape [n]. Whether a point satisfying
        Wolfe/Approx wolfe was found.
      failed: Boolean `Tensor` of shape [n]. Whether line search failed e.g.
        if either the objective function or the gradient are not finite at
        an evaluation point.
      iterations: Scalar int32 `Tensor`. Number of line search iterations made.
      func_evals: Scalar int32 `Tensor`. Number of function evaluations made.
      left: A namedtuple, as returned by value_and_gradients_function,
        of the left end point of the final bracketing interval. Values are
        equal to those of `right` on batch members where converged is True.
        Otherwise, it corresponds to the last interval computed.
      right: A namedtuple, as returned by value_and_gradients_function,
        of the right end point of the final bracketing interval. Values are
        equal to those of `left` on batch members where converged is True.
        Otherwise, it corresponds to the last interval computed.


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
arg_1
.
fields
[
'Archive'
]
if
arg_3
:
arg_4
=
arg_1
.
fields
[
'WindSpeed10Min'
]
+
GUST_MPH_MIN
if
arg_3
[
'WindHi'
]
>=
arg_4
:
arg_0
.
value
=
(
arg_3
[
'WindHi'
]
,
arg_3
[
'WindHiDir'
]
)
arg_0
.
count
=
GUST_TTL
*
60
/
arg_2
else
:
arg_0
.
value
=
arg_0
.
NO_VALUE
if
arg_0
.
count
:
arg_0
.
count
-=
1
else
:
arg_0
.
value
=
arg_0
.
NO_VALUE
log
.
debug
(
'wind gust of {0} mph from {1}'
.
format
(
*
arg_0
.
value
)
)
return
arg_0
.
value

def Func( arg_0, arg_1, arg_2 ):
      '''
      return gust data, if above threshold value and current time is inside
      reporting window period
      '''
      arg_3 = arg_1.fields['Archive']
      # process new data
      if arg_3:
         arg_4 = arg_1.fields['WindSpeed10Min'] + GUST_MPH_MIN
         if arg_3['WindHi'] >= arg_4:
            arg_0.value = (arg_3['WindHi'],arg_3['WindHiDir'])
            arg_0.count = GUST_TTL * 60 / arg_2
         else:
            arg_0.value = arg_0.NO_VALUE

      # return gust value, if remaining time is left, and valid
      if arg_0.count:
         arg_0.count -= 1
      else:
         arg_0.value = arg_0.NO_VALUE

      log.debug('wind gust of {0} mph from {1}'.format(*arg_0.value))
      return arg_0.value

return gust data if above threshold value and current time is inside reporting window period


def Func ( arg_0 ) : if arg_0 and isinstance ( arg_0 , str ) : load_config ( True ) return Check ( arg_0 ) . is_ip_valid ( ) return None

def Func(arg_0):  # pragma: no cover
    """
    Check the syntax of the given IPv4.

    :param ip: The IPv4 to check the syntax for.
    :type ip: str

    :return: The syntax validity.
    :rtype: bool

    .. warning::
        If an empty or a non-string :code:`ip` is given, we return :code:`None`.
    """

    if arg_0 and isinstance(arg_0, str):
        # The given IP is not empty nor None.
        # and
        # * The given IP is a string.

        # We silently load the configuration.
        load_config(True)

        return Check(arg_0).is_ip_valid()

    # We return None, there is nothing to check.
    return None


def Func(arg_0):
    """Read one VLQ-encoded integer value from an input data stream."""
    # The VLQ is little-endian.
    arg_1 = ord(arg_0.read(1))
    arg_2 = arg_1 & 0x7F
    arg_3 = 1
    while arg_1 & 0x80 != 0:
        arg_1 = ord(arg_0.read(1))
        arg_2 = ((arg_1 & 0x7F) << arg_3 * 7) | arg_2
        arg_3 += 1
    return arg_2

Read one VLQ - encoded integer value from an input data stream .


(self, _exc_type=None, _exc_value=None, _exc_traceback=None)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
,
arg_3
=
)
:
if
arg_0
.
do_pop_attrs
:
arg_0
.
get_tracer
(
)
.
pop_zipkin_attrs
(
)
if
not
arg_0
.
get_tracer
(
)
.
is_transport_configured
(
)
:
return
if
any
(
(
arg_1
,
arg_2
,
arg_3
)
)
:
arg_4
=
u'{0}: {1}'
.
format
(
arg_1
.
__name__
,
arg_2
)
arg_0
.
update_binary_annotations
(
{
ERROR_KEY
:
arg_4
,
}
)
if
arg_0
.
logging_context
:
try
:
arg_0
.
logging_context
.
Func
(
)
except
Exception
as
ex
:
arg_5
=
'Error emitting zipkin trace. {}'
.
format
(
repr
(
ex
)
,
)
log
.
error
(
arg_5
)
finally
:
arg_0
.
logging_context
=
arg_0
.
get_tracer
(
)
.
clear
(
)
arg_0
.
get_tracer
(
)
.
set_transport_configured
(
configured
=
False
)
return
arg_7
=
time
.
time
(
)
if
arg_0
.
duration
:
arg_8
=
arg_0
.
duration
else
:
arg_8
=
arg_7
arg_0
.
start_timestamp
arg_9
=
create_endpoint
(
arg_0
.
port
,
arg_0
.
service_name
,
arg_0
.
host
)
arg_0
.
get_tracer
(
)
.
add_span
(
Span
(
trace_id
=
arg_0
.
zipkin_attrs
.
trace_id
,
name
=
arg_0
.
span_name
,
parent_id
=
arg_0
.
zipkin_attrs
.
parent_span_id
,
span_id
=
arg_0
.
zipkin_attrs
.
span_id
,
kind
=
arg_0
.
kind
,
timestamp
=
arg_0
.
timestamp
if
arg_0
.
timestamp
else
arg_0
.
start_timestamp
,
arg_8
=
arg_8
,
annotations
=
arg_0
.
annotations
,
local_endpoint
=
arg_9
,
remote_endpoint
=
arg_0
.
remote_endpoint
,
tags
=
arg_0
.
binary_annotations
,
)
)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):
        """Exit the span context. Zipkin attrs are pushed onto the
        threadlocal stack regardless of sampling, so they always need to be
        popped off. The actual logging of spans depends on sampling and that
        the logging was correctly set up.
        """

        if arg_0.do_pop_attrs:
            arg_0.get_tracer().pop_zipkin_attrs()

        # If no transport is configured, there's no reason to create a new Span.
        # This also helps avoiding memory leaks since without a transport nothing
        # would pull spans out of get_tracer().
        if not arg_0.get_tracer().is_transport_configured():
            return

        # Add the error annotation if an exception occurred
        if any((arg_1, arg_2, arg_3)):
            arg_4 = u'{0}: {1}'.format(arg_1.__name__, arg_2)
            arg_0.update_binary_annotations({
                ERROR_KEY: arg_4,
            })

        # Logging context is only initialized for "root" spans of the local
        # process (i.e. this zipkin_span not inside of any other local
        # zipkin_spans)
        if arg_0.logging_context:
            try:
                arg_0.logging_context.Func()
            except Exception as ex:
                arg_5 = 'Error emitting zipkin trace. {}'.format(
                    repr(ex),
                )
                log.error(arg_5)
            finally:
                arg_0.logging_context = None
                arg_0.get_tracer().clear()
                arg_0.get_tracer().set_transport_configured(configured=False)
                return

        # If we've gotten here, that means that this span is a child span of
        # this context's root span (i.e. it's a zipkin_span inside another
        # zipkin_span).
        arg_7 = time.time()
        # If self.duration is set, it means the user wants to override it
        if arg_0.duration:
            arg_8 = arg_0.duration
        else:
            arg_8 = arg_7 - arg_0.start_timestamp

        arg_9 = create_endpoint(arg_0.port, arg_0.service_name, arg_0.host)
        arg_0.get_tracer().add_span(Span(
            trace_id=arg_0.zipkin_attrs.trace_id,
            name=arg_0.span_name,
            parent_id=arg_0.zipkin_attrs.parent_span_id,
            span_id=arg_0.zipkin_attrs.span_id,
            kind=arg_0.kind,
            timestamp=arg_0.timestamp if arg_0.timestamp else arg_0.start_timestamp,
            arg_8=arg_8,
            annotations=arg_0.annotations,
            local_endpoint=arg_9,
            remote_endpoint=arg_0.remote_endpoint,
            tags=arg_0.binary_annotations,
        ))

Exit the span context . Zipkin attrs are pushed onto the threadlocal stack regardless of sampling so they always need to be popped off . The actual logging of spans depends on sampling and that the logging was correctly set up .


def Func ( arg_0 ) : if arg_0 . initiator : arg_1 = "initiator" else : arg_1 = "receiver" arg_0 . _element_handlers = { } for arg_3 in arg_0 . handlers : if not isinstance ( arg_3 , StreamFeatureHandler ) : continue for arg_4 , arg_5 in inspect . getmembers ( arg_3 , callable ) : if not hasattr ( arg_5 , "_pyxmpp_stream_element_handled" ) : continue arg_6 = arg_5 . _pyxmpp_stream_element_handled if arg_6 in arg_0 . _element_handlers : continue if arg_5 . _pyxmpp_usage_restriction in ( None , arg_1 ) : arg_0 . _element_handlers [ arg_6 ] = arg_5

def Func(arg_0):
        """Set up stream element handlers.

        Scans the `handlers` list for `StreamFeatureHandler`
        instances and updates `_element_handlers` mapping with their
        methods decorated with @`stream_element_handler`
        """
        # pylint: disable-msg=W0212
        if arg_0.initiator:
            arg_1 = "initiator"
        else:
            arg_1 = "receiver"
        arg_0._element_handlers = {}
        for arg_3 in arg_0.handlers:
            if not isinstance(arg_3, StreamFeatureHandler):
                continue
            for arg_4, arg_5 in inspect.getmembers(arg_3, callable):
                if not hasattr(arg_5, "_pyxmpp_stream_element_handled"):
                    continue
                arg_6 = arg_5._pyxmpp_stream_element_handled
                if arg_6 in arg_0._element_handlers:
                    # use only the first matching handler
                    continue
                if arg_5._pyxmpp_usage_restriction in (None, arg_1):
                    arg_0._element_handlers[arg_6] = arg_5


def Func ( arg_0 ) : arg_1 = MySqlHook ( mysql_conn_id = arg_0 . mysql_conn_id ) arg_2 = arg_1 . get_conn ( ) arg_3 = arg_2 . cursor ( ) arg_3 . execute ( arg_0 . sql ) return arg_3

def Func(arg_0):
        """
        Queries mysql and returns a cursor to the results.
        """
        arg_1 = MySqlHook(mysql_conn_id=arg_0.mysql_conn_id)
        arg_2 = arg_1.get_conn()
        arg_3 = arg_2.cursor()
        arg_3.execute(arg_0.sql)
        return arg_3

Queries mysql and returns a cursor to the results .


return import_string(imp) if imp else default

def Func(arg_0, arg_1, arg_2):
    """Import config var import path or use default value."""
    arg_3 = arg_0.config.get(arg_1)
    return import_string(arg_3) if arg_3 else arg_2

Import config var import path or use default value .


(x, y=None, maxlags=None, norm='unbiased')

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
,
arg_3
=
'unbiased'
)
:
assert
arg_3
in
[
'unbiased'
,
'biased'
,
'coeff'
,
]
arg_0
=
np
.
array
(
arg_0
)
if
arg_1
is
:
arg_1
=
arg_0
else
:
arg_1
=
np
.
array
(
arg_1
)
arg_4
=
max
(
len
(
arg_0
)
,
len
(
arg_1
)
)
if
len
(
arg_0
)
<
arg_4
:
arg_0
=
arg_1
.
copy
(
)
arg_0
.
resize
(
arg_4
)
if
len
(
arg_1
)
<
arg_4
:
arg_1
=
arg_1
.
copy
(
)
arg_1
.
resize
(
arg_4
)
if
arg_2
is
:
arg_2
=
arg_4
1
assert
arg_2
<
arg_4
,
'lag must be less than len(x)'
arg_5
=
np
.
isrealobj
(
arg_0
)
and
np
.
isrealobj
(
arg_1
)
if
arg_5
==
True
:
arg_6
=
np
.
zeros
(
arg_2
,
dtype
=
float
)
else
:
arg_6
=
np
.
zeros
(
arg_2
,
dtype
=
complex
)
if
arg_3
==
'coeff'
:
arg_7
=
pylab_rms_flat
(
arg_0
)
arg_8
=
pylab_rms_flat
(
arg_1
)
for
arg_9
in
range
(
0
,
arg_2
+
1
)
:
arg_10
=
arg_4
arg_9
1
if
arg_5
==
True
:
arg_11
=
0
for
arg_12
in
range
(
0
,
arg_10
+
1
)
:
arg_11
=
arg_11
+
arg_0
[
arg_12
+
arg_9
]
*
arg_1
[
arg_12
]
else
:
arg_11
=
0.
+
0j
for
arg_12
in
range
(
0
,
arg_10
+
1
)
:
arg_11
=
arg_11
+
arg_0
[
arg_12
+
arg_9
]
*
arg_1
[
arg_12
]
.
conjugate
(
)
if
arg_9
==
0
:
if
arg_3
in
[
'biased'
,
'unbiased'
]
:
arg_13
=
arg_11
/
float
(
arg_4
)
elif
arg_3
is
:
arg_13
=
arg_11
else
:
arg_13
=
1.
else
:
if
arg_3
==
'unbiased'
:
arg_6
[
arg_9
1
]
=
arg_11
/
float
(
arg_4
arg_9
)
elif
arg_3
==
'biased'
:
arg_6
[
arg_9
1
]
=
arg_11
/
float
(
arg_4
)
elif
arg_3
is
:
arg_6
[
arg_9
1
]
=
arg_11
elif
arg_3
==
'coeff'
:
arg_6
[
arg_9
1
]
=
arg_11
/
(
arg_7
*
arg_8
)
/
float
(
arg_4
)
arg_6
=
np
.
insert
(
arg_6
,
0
,
arg_13
)
return
arg_6

def Func(arg_0, arg_1=None, arg_2=None, arg_3='unbiased'):
    r"""Correlation function

    This function should give the same results as :func:`xcorr` but it
    returns the positive lags only. Moreover the algorithm does not use
    FFT as compared to other algorithms.

    :param array x: first data array of length N
    :param array y: second data array of length N. If not specified, computes the
        autocorrelation.
    :param int maxlags: compute cross correlation between [0:maxlags]
        when maxlags is not specified, the range of lags is [0:maxlags].
    :param str norm: normalisation in ['biased', 'unbiased', None, 'coeff']

        * *biased*   correlation=raw/N,
        * *unbiased* correlation=raw/(N-`|lag|`)
        * *coeff*    correlation=raw/(rms(x).rms(y))/N
        * None       correlation=raw

    :return:
        * a numpy.array correlation sequence,  r[1,N]
        * a float for the zero-lag correlation,  r[0]

    The *unbiased* correlation has the form:

    .. math::

        \hat{r}_{xx} = \frac{1}{N-m}T \sum_{n=0}^{N-m-1} x[n+m]x^*[n] T

    The *biased* correlation differs by the front factor only:

    .. math::

        \check{r}_{xx} = \frac{1}{N}T \sum_{n=0}^{N-m-1} x[n+m]x^*[n] T

    with :math:`0\leq m\leq N-1`.

    .. doctest::

        >>> from spectrum import Func
        >>> x = [1,2,3,4,5]
        >>> res = Func(x,x, maxlags=0, norm='biased')
        >>> res[0]
        11.0

    .. note:: this function should be replaced by :func:`xcorr`.

    .. seealso:: :func:`xcorr`
    """
    assert arg_3 in ['unbiased','biased', 'coeff', None]
    #transform lag into list if it is an integer
    arg_0 = np.array(arg_0)
    if arg_1 is None:
        arg_1 = arg_0
    else:
        arg_1 = np.array(arg_1)

    # N is the max of x and y
    arg_4 = max(len(arg_0), len(arg_1))
    if len(arg_0) < arg_4:
        arg_0 = arg_1.copy()
        arg_0.resize(arg_4)
    if len(arg_1) < arg_4:
        arg_1 = arg_1.copy()
        arg_1.resize(arg_4)

    #default lag is N-1
    if arg_2 is None:
        arg_2 = arg_4 - 1
    assert arg_2 < arg_4, 'lag must be less than len(x)'

    arg_5 = np.isrealobj(arg_0) and np.isrealobj(arg_1)
    #create an autocorrelation array with same length as lag
    if arg_5 == True:
        arg_6 = np.zeros(arg_2, dtype=float)
    else:
        arg_6 = np.zeros(arg_2, dtype=complex)

    if arg_3 == 'coeff':
        arg_7 = pylab_rms_flat(arg_0)
        arg_8 = pylab_rms_flat(arg_1)

    for arg_9 in range(0, arg_2+1):
        arg_10 = arg_4 - arg_9 - 1

        if arg_5 == True:
            arg_11 = 0
            for arg_12 in range(0, arg_10+1):
                arg_11 = arg_11 + arg_0[arg_12+arg_9] * arg_1[arg_12]
        else:
            arg_11 = 0. + 0j
            for arg_12 in range(0, arg_10+1):
                arg_11 = arg_11 + arg_0[arg_12+arg_9] * arg_1[arg_12].conjugate()
        if arg_9 == 0:
            if arg_3 in ['biased', 'unbiased']:
                arg_13 = arg_11/float(arg_4)
            elif arg_3 is None:
                arg_13 = arg_11
            else:
                arg_13 =  1.
        else:
            if arg_3 == 'unbiased':
                arg_6[arg_9-1] = arg_11 / float(arg_4-arg_9)
            elif arg_3 == 'biased':
                arg_6[arg_9-1] = arg_11 / float(arg_4)
            elif arg_3 is None:
                arg_6[arg_9-1] = arg_11
            elif arg_3 == 'coeff':
                arg_6[arg_9-1] =  arg_11/(arg_7*arg_8)/float(arg_4)

    arg_6 = np.insert(arg_6, 0, arg_13)
    return arg_6

r"""Correlation function

    This function should give the same results as :func:`xcorr` but it
    returns the positive lags only. Moreover the algorithm does not use
    FFT as compared to other algorithms.

    :param array x: first data array of length N
    :param array y: second data array of length N. If not specified, computes the
        autocorrelation.
    :param int maxlags: compute cross correlation between [0:maxlags]
        when maxlags is not specified, the range of lags is [0:maxlags].
    :param str norm: normalisation in ['biased', 'unbiased', None, 'coeff']

        * *biased*   correlation=raw/N,
        * *unbiased* correlation=raw/(N-`|lag|`)
        * *coeff*    correlation=raw/(rms(x).rms(y))/N
        * None       correlation=raw

    :return:
        * a numpy.array correlation sequence,  r[1,N]
        * a float for the zero-lag correlation,  r[0]

    The *unbiased* correlation has the form:

    .. math::

        \hat{r}_{xx} = \frac{1}{N-m}T \sum_{n=0}^{N-m-1} x[n+m]x^*[n] T

    The *biased* correlation differs by the front factor only:

    .. math::

        \check{r}_{xx} = \frac{1}{N}T \sum_{n=0}^{N-m-1} x[n+m]x^*[n] T

    with :math:`0\leq m\leq N-1`.

    .. doctest::

        >>> from spectrum import CORRELATION
        >>> x = [1,2,3,4,5]
        >>> res = CORRELATION(x,x, maxlags=0, norm='biased')
        >>> res[0]
        11.0

    .. note:: this function should be replaced by :func:`xcorr`.

    .. seealso:: :func:`xcorr`


(self, image_shape, alpha=1.0,
                                 size=1, antialiased=True,
                                 raise_if_out_of_image=False)

def Func(arg_0, arg_1, arg_2=1.0,
                                 arg_3=1, arg_4=True,
                                 arg_5=False):
        """
        Draw the line segments of the line string as a heatmap array.

        Parameters
        ----------
        image_shape : tuple of int
            The shape of the image onto which to draw the line mask.

        alpha : float, optional
            Opacity of the line string. Higher values denote a more visible
            line string.

        size : int, optional
            Thickness of the line segments.

        antialiased : bool, optional
            Whether to draw the line with anti-aliasing activated.

        raise_if_out_of_image : bool, optional
            Whether to raise an error if the line string is fully
            outside of the image. If set to False, no error will be raised and
            only the parts inside the image will be drawn.

        Returns
        -------
        ndarray
            Float array of shape `image_shape` (no channel axis) with drawn
            line string. All values are in the interval ``[0.0, 1.0]``.

        """
        assert len(arg_1) == 2 or (
            len(arg_1) == 3 and arg_1[-1] == 1), (
            "Expected (H,W) or (H,W,1) as image_shape, got %s." % (
                arg_1,))

        arg_6 = arg_0.draw_lines_on_image(
            np.zeros(arg_1, dtype=np.uint8),
            color=255, arg_2=arg_2, arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5
        )
        return arg_6.astype(np.float32) / 255.0

Draw the line segments of the line string as a heatmap array .


def Func ( arg_0 ) : arg_0 . _validate_initial_unitary ( ) if arg_0 . _initial_unitary is None : arg_0 . _unitary = np . eye ( 2 ** arg_0 . _number_of_qubits , dtype = complex ) else : arg_0 . _unitary = arg_0 . _initial_unitary . copy ( ) arg_0 . _unitary = np . reshape ( arg_0 . _unitary , arg_0 . _number_of_qubits * [ 2 , 2 ] )

def Func(arg_0):
        """Set the initial unitary for simulation"""
        arg_0._validate_initial_unitary()
        if arg_0._initial_unitary is None:
            # Set to identity matrix
            arg_0._unitary = np.eye(2 ** arg_0._number_of_qubits,
                                   dtype=complex)
        else:
            arg_0._unitary = arg_0._initial_unitary.copy()
        # Reshape to rank-N tensor
        arg_0._unitary = np.reshape(arg_0._unitary,
                                   arg_0._number_of_qubits * [2, 2])


(array, sub_field_array, mask, inplace=False)

def Func(arg_0, arg_1, arg_2, arg_3=False):
    """ Packs a sub field's array into another array using a mask

    Parameters:
    ----------
    array : numpy.ndarray
        The array in which the sub field array will be Funced into
    array_in : numpy.ndarray
        sub field array to Func
    mask : mask (ie: 0b00001111)
        Mask of the sub field
    inplace : {bool}, optional
        If true a new array is returned. (the default is False, which modifies the array in place)

    Raises
    ------
    OverflowError
        If the values contained in the sub field array are greater than its mask's number of bits
        allows
    """
    arg_4 = least_significant_bit(arg_2)
    arg_5 = int(arg_2 >> arg_4)
    if arg_1.max() > arg_5:
        raise OverflowError(
            "value ({}) is greater than allowed (max: {})".format(
                arg_1.max(), arg_5
            )
        )
    if arg_3:
        arg_0[:] = arg_0 & ~arg_2
        arg_0[:] = arg_0 | ((arg_1 << arg_4) & arg_2).astype(arg_0.dtype)
    else:
        arg_0 = arg_0 & ~arg_2
        return arg_0 | ((arg_1 << arg_4) & arg_2).astype(arg_0.dtype)

Packs a sub field's array into another array using a mask

    Parameters:
    ----------
    array : numpy.ndarray
        The array in which the sub field array will be packed into
    array_in : numpy.ndarray
        sub field array to pack
    mask : mask (ie: 0b00001111)
        Mask of the sub field
    inplace : {bool}, optional
        If true a new array is returned. (the default is False, which modifies the array in place)

    Raises
    ------
    OverflowError
        If the values contained in the sub field array are greater than its mask's number of bits
        allows

Packs a sub field s array into another array using a mask


def
Func
(
arg_0
)
:
if
not
os
.
path
.
exists
(
arg_0
.
path
)
:
open
(
arg_0
.
path
,
'a'
)
.
close
(
)
else
:
raise
Exception
(
"File exists: {}"
.
format
(
arg_0
.
path
)
)

def Func(arg_0):
        """
        Create the file.

        If the file already exists an exception will be raised
        """
        if not os.path.exists(arg_0.path):
            open(arg_0.path, 'a').close()
        else:
            raise Exception("File exists: {}".format(arg_0.path))


(self, name, *, public=True, collaborative=False, description=None)

async def Func ( arg_0 , arg_1 , * , arg_2 = True , arg_3 = False , arg_4 = None ) : arg_5 = { 'name' : arg_1 , 'public' : arg_2 , 'collaborative' : arg_3 } if arg_4 : arg_5 [ 'description' ] = arg_4 arg_6 = await arg_0 . http . Func ( arg_0 . id , arg_5 ) return Playlist ( arg_0 . __client , arg_6 )

async def Func(arg_0, arg_1, *, arg_2=True, arg_3=False, arg_4=None):
        """Create a playlist for a Spotify user.

        Parameters
        ----------
        name : str
            The name of the playlist.
        public : Optional[bool]
            The public/private status of the playlist.
            `True` for public, `False` for private.
        collaborative : Optional[bool]
            If `True`, the playlist will become collaborative and other users will be able to modify the playlist.
        description : Optional[str]
            The playlist description

        Returns
        -------
        playlist : Playlist
            The playlist that was created.
        """
        arg_5 = {
            'name': arg_1,
            'public': arg_2,
            'collaborative': arg_3
        }

        if arg_4:
            arg_5['description'] = arg_4

        arg_6 = await arg_0.http.Func(arg_0.id, arg_5)
        return Playlist(arg_0.__client, arg_6)


def Func ( arg_0 ) : arg_0 . crash_handler = arg_0 . crash_handler_class ( arg_0 ) arg_2 . excepthook = arg_0 . excepthook def unset_crashhandler ( ) : arg_2 . excepthook = arg_2 . __excepthook__ atexit . register ( unset_crashhandler )

def Func(arg_0):
        """Create a crash handler, typically setting sys.excepthook to it."""
        arg_0.crash_handler = arg_0.crash_handler_class(arg_0)
        arg_2.excepthook = arg_0.excepthook
        def unset_crashhandler():
            arg_2.excepthook = arg_2.__excepthook__
        atexit.register(unset_crashhandler)

Create a crash handler typically setting sys . excepthook to it .


Constructs the bottom line of the element

def Func(arg_0):
        """ Constructs the Functom line of the element"""
        arg_1 = arg_0.Func_format % arg_0.Func_connect.center(
            arg_0.width, arg_0.Func_pad)
        if arg_0.right_fill:
            arg_1 = arg_1.ljust(arg_0.right_fill, arg_0.Func_pad)
        if arg_0.left_fill:
            arg_1 = arg_1.rjust(arg_0.left_fill, arg_0.Func_pad)
        arg_1 = arg_1.center(arg_0.layer_width, arg_0.Func_bck)
        return arg_1


def Func ( arg_0 , arg_1 , arg_2 , arg_3 = None ) : if arg_3 is None : arg_4 = arg_2 . readlines else : arg_4 = decoding_stream ( arg_2 , arg_3 ) . readlines try : arg_0 . linesets . append ( LineSet ( arg_1 , arg_4 ( ) , arg_0 . ignore_comments , arg_0 . ignore_docstrings , arg_0 . ignore_imports , ) ) except UnicodeDecodeError : pass

def Func(arg_0, arg_1, arg_2, arg_3=None):
        """append a file to search for similarities"""
        if arg_3 is None:
            arg_4 = arg_2.readlines
        else:
            arg_4 = decoding_stream(arg_2, arg_3).readlines
        try:
            arg_0.linesets.append(
                LineSet(
                    arg_1,
                    arg_4(),
                    arg_0.ignore_comments,
                    arg_0.ignore_docstrings,
                    arg_0.ignore_imports,
                )
            )
        except UnicodeDecodeError:
            pass


def Func(arg_0, arg_1):
        """Handle a roster push received from server.
        """
        if arg_0.server is None and arg_1.from_jid:
            logger.debug(u"Server address not known, cannot verify roster push"
                                " from {0}".format(arg_1.from_jid))
            return arg_1.make_error_response(u"service-unavailable")
        if arg_0.server and arg_1.from_jid and arg_1.from_jid != arg_0.server:
            logger.debug(u"Roster push from invalid source: {0}".format(
                                                            arg_1.from_jid))
            return arg_1.make_error_response(u"service-unavailable")
        arg_2 = arg_1.get_payload(RosterPayload)
        if len(arg_2) != 1:
            logger.warning("Bad roster push received ({0} items)"
                                                    .format(len(arg_2)))
            return arg_1.make_error_response(u"bad-request")
        if arg_0.roster is None:
            logger.debug("Dropping roster push - no roster here")
            return True
        arg_3 = arg_2[0]
        arg_3.verify_roster_push(True)
        arg_4 = arg_0.roster.get(arg_3.jid)
        if arg_3.subscription == "remove":
            if arg_4:
                arg_0.roster.remove_item(arg_3.jid)
        else:
            arg_0.roster.add_item(arg_3, replace = True)
        arg_0._event_queue.put(RosterUpdatedEvent(arg_0, arg_4, arg_3))
        return arg_1.make_result_response()

Handle a roster push received from server .


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] for arg_3 in arg_1 : arg_4 = None for arg_5 in arg_0 . Funcping : arg_4 = arg_5 ( arg_3 ) if arg_4 is not None : break if arg_4 is not None : arg_2 . append ( arg_4 ) else : arg_2 . append ( arg_3 ) return arg_2

def Func(arg_0, arg_1):
        """Mapping part of string preparation."""
        arg_2 = []
        for arg_3 in arg_1:
            arg_4 = None
            for arg_5 in arg_0.Funcping:
                arg_4 = arg_5(arg_3)
                if arg_4 is not None:
                    break
            if arg_4 is not None:
                arg_2.append(arg_4)
            else:
                arg_2.append(arg_3)
        return arg_2


def Func(arg_0):
    """Parses yaml and returns a list of repeated variables and
       the line on which they occur
    """
    arg_1 = yaml.Loader(arg_0)

    def arg_13(arg_2, arg_3):
        # the line number where the previous token has ended (plus empty lines)
        arg_4 = arg_1.line
        arg_5 = Composer.compose_node(arg_1, arg_2, arg_3)
        arg_5.__line__ = arg_4 + 1
        return arg_5

    def arg_14(arg_5, arg_7=False):
        arg_8 = dict()
        arg_9 = dict()
        for arg_10, arg_11 in arg_5.value:
            arg_12 = arg_10.value
            if arg_12 in arg_8:
                if arg_12 in arg_9:
                    arg_9[arg_12].append(arg_10.__line__)
                else:
                    arg_9[arg_12] = [arg_8[arg_12], arg_10.__line__]

            arg_8[arg_12] = arg_10.__line__

        return arg_9

    arg_1.compose_node = arg_13
    arg_1.construct_mapping = arg_14
    arg_0 = arg_1.get_single_data()
    return arg_0


def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
False
)
:
if
arg_1
:
arg_3
=
Patch
(
arg_1
)
else
:
arg_3
=
arg_0
.
db
.
top_patch
(
)
if
not
arg_3
:
raise
QuiltError
(
"No patch applied. Nothing to refresh."
)
arg_4
=
arg_0
.
quilt_pc
+
arg_3
.
get_name
(
)
arg_5
=
arg_0
.
quilt_patches
+
File
(
arg_3
.
get_name
(
)
)
arg_6
=
arg_4
.
content
(
)
[
1
]
with
TmpFile
(
prefix
=
"pquilt-"
)
as
tmpfile
:
arg_7
=
tmpfile
.
open
(
)
if
arg_5
.
exists
(
)
:
arg_8
=
arg_3
.
get_header
(
arg_0
.
quilt_patches
)
tmpfile
.
write
(
arg_8
)
for
arg_9
in
arg_6
:
if
arg_9
==
".timestamp"
:
continue
arg_10
=
arg_4
+
File
(
arg_9
)
arg_11
=
File
(
arg_9
)
arg_12
,
arg_13
,
arg_14
=
arg_0
.
_get_labels
(
arg_9
,
arg_10
,
arg_11
)
arg_0
.
_write_index
(
tmpfile
,
arg_14
)
arg_15
=
Diff
(
arg_10
,
arg_11
)
arg_15
.
run
(
arg_0
.
cwd
,
fd
=
arg_7
,
arg_12
=
arg_12
,
arg_13
=
arg_13
)
if
tmpfile
.
is_empty
(
)
:
raise
QuiltError
(
"Nothing to refresh."
)
if
arg_2
:
arg_0
.
edit_patch
(
tmpfile
)
arg_16
=
Patch
(
tmpfile
.
get_name
(
)
)
arg_16
.
run
(
arg_4
.
get_name
(
)
,
dry_run
=
True
,
quiet
=
True
)
if
arg_5
.
exists
(
)
:
arg_15
=
Diff
(
arg_5
,
tmpfile
)
if
arg_15
.
equal
(
arg_0
.
cwd
)
:
raise
QuiltError
(
"Nothing to refresh."
)
tmpfile
.
copy
(
arg_5
)
arg_17
=
arg_4
+
File
(
".timestamp"
)
arg_17
.
touch
(
)
Func
=
arg_0
.
quilt_pc
+
File
(
arg_3
.
get_name
(
)
+
"~refresh"
)
Func
.
delete_if_exists
(
)
arg_0
.
refreshed
(
arg_3
)

def Func(arg_0, arg_1=None, arg_2=False):
        """ Refresh patch with patch_name or applied top patch if patch_name is
        None
        """
        if arg_1:
            arg_3 = Patch(arg_1)
        else:
            arg_3 = arg_0.db.top_patch()

            if not arg_3:
                raise QuiltError("No patch applied. Nothing to refresh.")

        arg_4 = arg_0.quilt_pc + arg_3.get_name()
        arg_5 = arg_0.quilt_patches + File(arg_3.get_name())
        arg_6 = arg_4.content()[1]

        with TmpFile(prefix="pquilt-") as tmpfile:
            arg_7 = tmpfile.open()

            if arg_5.exists():
                arg_8 = arg_3.get_header(arg_0.quilt_patches)
                tmpfile.write(arg_8)

            for arg_9 in arg_6:
                if arg_9 == ".timestamp":
                    continue
                arg_10 = arg_4 + File(arg_9)
                arg_11 = File(arg_9)
                arg_12, arg_13, arg_14 = arg_0._get_labels(arg_9,
                                                                  arg_10,
                                                                  arg_11)
                arg_0._write_index(tmpfile, arg_14)

                arg_15 = Diff(arg_10, arg_11)
                arg_15.run(arg_0.cwd, fd=arg_7, arg_12=arg_12,
                         arg_13=arg_13)

            if tmpfile.is_empty():
                raise QuiltError("Nothing to refresh.")

            if arg_2:
                arg_0.edit_patch(tmpfile)
                arg_16 = Patch(tmpfile.get_name())
                arg_16.run(arg_4.get_name(), dry_run=True, quiet=True)

            if arg_5.exists():
                arg_15 = Diff(arg_5, tmpfile)
                if arg_15.equal(arg_0.cwd):
                    raise QuiltError("Nothing to refresh.")

            tmpfile.copy(arg_5)

        arg_17 = arg_4 + File(".timestamp")
        arg_17.touch()

        Func = arg_0.quilt_pc + File(arg_3.get_name() + "~refresh")
        Func.delete_if_exists()

        arg_0.refreshed(arg_3)


def Func ( arg_0 , arg_1 , arg_2 ) : if not arg_0 . lics_list_ver_set : arg_0 . lics_list_ver_set = True arg_4 = version . Version . from_str ( arg_2 ) if arg_4 is not None : arg_1 . creation_info . license_list_version = arg_4 return True else : raise SPDXValueError ( 'CreationInfo::LicenseListVersion' ) else : raise CardinalityError ( 'CreationInfo::LicenseListVersion' )

def Func(arg_0, arg_1, arg_2):
        """Sets the license list version, Raises CardinalityError if
        already set, SPDXValueError if incorrect value.
        """
        if not arg_0.lics_list_ver_set:
            arg_0.lics_list_ver_set = True
            arg_4 = version.Version.from_str(arg_2)
            if arg_4 is not None:
                arg_1.creation_info.license_list_version = arg_4
                return True
            else:
                raise SPDXValueError('CreationInfo::LicenseListVersion')
        else:
            raise CardinalityError('CreationInfo::LicenseListVersion')

Sets the license list version Raises CardinalityError if already set SPDXValueError if incorrect value .


return self.get_data(
            "load_balancers/%s/droplets/" % self.id,
            type=POST,
            params={"droplet_ids": droplet_ids}
        )

def Func ( arg_0 , arg_1 ) : return arg_0 . get_data ( "load_balancers/%s/droplets/" % arg_0 . id , type = POST , params = { "droplet_ids" : arg_1 } )

def Func(arg_0, arg_1):
        """
        Assign a LoadBalancer to a Droplet.

        Args:
            droplet_ids (obj:`list` of `int`): A list of Droplet IDs
        """
        return arg_0.get_data(
            "load_balancers/%s/droplets/" % arg_0.id,
            type=POST,
            params={"droplet_ids": arg_1}
        )


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . NewArray ( len ( arg_1 ) ) arg_2 . _init ( arg_1 ) return arg_2

def Func(arg_0, arg_1):
        ''' note py_arr elems are NOT converted to PyJs types!'''
        arg_2 = arg_0.NewArray(len(arg_1))
        arg_2._init(arg_1)
        return arg_2


async def Func ( arg_0 , arg_1 ) : arg_2 = await arg_0 . request ( 'GET' , '{}/bots/{}' . format ( arg_0 . BASE , arg_1 ) ) arg_2 [ 'date' ] = datetime . strptime ( arg_2 [ 'date' ] , '%Y-%m-%dT%H:%M:%S.%fZ' ) for arg_3 in arg_2 : if arg_2 [ arg_3 ] == '' : arg_2 [ arg_3 ] = None return arg_2

async def Func(arg_0, arg_1):
        '''Gets the information of the given Bot ID'''
        arg_2 = await arg_0.request('GET', '{}/bots/{}'.format(arg_0.BASE, arg_1))
        arg_2['date'] = datetime.strptime(arg_2['date'], '%Y-%m-%dT%H:%M:%S.%fZ')
        for arg_3 in arg_2:
            if arg_2[arg_3] == '':
                arg_2[arg_3] = None
        return arg_2


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = CountHandler ( arg_0 , arg_1 , arg_2 ) . get_count ( ) arg_5 = [ x [ 1 ] for x in arg_4 [ arg_3 ] ] arg_6 = list ( Event . objects . filter ( pk__in = arg_5 ) . order_by ( 'start_date' ) . prefetch_related ( 'cancellations' ) ) arg_6 . sort ( key = lambda x : x . l_start_date . hour ) return arg_6

def Func(arg_0, arg_1, arg_2, arg_3):
    """
    Returns the events that occur on the given day.
    Works by getting all occurrences for the month, then drilling
    down to only those occurring on the given day.
    """
    # Get a dict with all of the events for the month
    arg_4 = CountHandler(arg_0, arg_1, arg_2).get_count()
    arg_5 = [x[1] for x in arg_4[arg_3]]  # list of pks for events on given day
    # List enables sorting.
    # See the comments in EventMonthView in views.py for more info
    arg_6 = list(Event.objects.filter(pk__in=arg_5).order_by(
        'start_date').prefetch_related('cancellations'))
    arg_6.sort(key=lambda x: x.l_start_date.hour)
    return arg_6

Returns the events that occur on the given day . Works by getting all occurrences for the month then drilling down to only those occurring on the given day .


(function=None, data_flow_kernel=None, walltime=60, cache=False, executors='all')

def Func ( arg_0 = None , arg_1 = None , arg_2 = 60 , arg_3 = False , arg_4 = 'all' ) : from parsl . app . bash import BashApp def decorator ( arg_5 ) : def wrapper ( arg_6 ) : return BashApp ( arg_6 , arg_1 = arg_1 , arg_2 = arg_2 , arg_3 = arg_3 , arg_4 = arg_4 ) return wrapper ( arg_5 ) if arg_0 is not None : return decorator ( arg_0 ) return decorator

def Func(arg_0=None, arg_1=None, arg_2=60, arg_3=False, arg_4='all'):
    """Decorator function for making bash apps.

    Parameters
    ----------
    function : function
        Do not pass this keyword argument directly. This is needed in order to allow for omitted parenthesis,
        for example, `@Func` if using all defaults or `@Func(walltime=120)`. If the
        decorator is used alone, function will be the actual function being decorated, whereas if it
        is called with arguments, function will be None. Default is None.
    data_flow_kernel : DataFlowKernel
        The :class:`~parsl.dataflow.dflow.DataFlowKernel` responsible for managing this app. This can
        be omitted only after calling :meth:`parsl.dataflow.dflow.DataFlowKernelLoader.load`. Default is None.
    walltime : int
        Walltime for app in seconds. Default is 60.
    executors : string or list
        Labels of the executors that this app can execute over. Default is 'all'.
    cache : bool
        Enable caching of the app call. Default is False.
    """
    from parsl.app.bash import BashApp

    def decorator(arg_5):
        def wrapper(arg_6):
            return BashApp(arg_6,
                           arg_1=arg_1,
                           arg_2=arg_2,
                           arg_3=arg_3,
                           arg_4=arg_4)
        return wrapper(arg_5)
    if arg_0 is not None:
        return decorator(arg_0)
    return decorator

Decorator function for making bash apps.

    Parameters
    ----------
    function : function
        Do not pass this keyword argument directly. This is needed in order to allow for omitted parenthesis,
        for example, `@bash_app` if using all defaults or `@bash_app(walltime=120)`. If the
        decorator is used alone, function will be the actual function being decorated, whereas if it
        is called with arguments, function will be None. Default is None.
    data_flow_kernel : DataFlowKernel
        The :class:`~parsl.dataflow.dflow.DataFlowKernel` responsible for managing this app. This can
        be omitted only after calling :meth:`parsl.dataflow.dflow.DataFlowKernelLoader.load`. Default is None.
    walltime : int
        Walltime for app in seconds. Default is 60.
    executors : string or list
        Labels of the executors that this app can execute over. Default is 'all'.
    cache : bool
        Enable caching of the app call. Default is False.

Decorator function for making bash apps .


def Func ( arg_0 ) : if arg_0 . initialized : mixer . music . unpause ( ) else : mixer . music . play ( ) mixer . music . play ( ) arg_0 . initialized = True arg_0 . paused = False

def Func(arg_0):
        """Play the music"""
        if arg_0.initialized:
            mixer.music.unpause()
        else:
            mixer.music.play()
            # FIXME: Calling play twice to ensure the music is actually playing
            mixer.music.play()
            arg_0.initialized = True
        arg_0.paused = False


Run all status tasks, then run all tasks in the resume queue

def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
log
.
debug
(
'Signal handler got Func signal'
)
arg_2
=
[
]
for
arg_3
in
arg_0
.
Func_callbacks
:
try
:
arg_0
.
log
.
debug
(
"Calling {0}({1},{2})"
.
format
(
arg_3
[
'function'
]
.
__name__
,
arg_3
[
'args'
]
,
arg_3
[
'kwargs'
]
)
)
except
AttributeError
:
arg_0
.
log
.
debug
(
"Calling unbound function/method {0}"
.
format
(
str
(
arg_3
)
)
)
apply
(
arg_3
[
'function'
]
,
arg_3
[
'args'
]
,
arg_3
[
'kwargs'
]
)
if
arg_3
[
'persistent'
]
:
arg_2
.
append
(
arg_3
)
arg_0
.
Func_callbacks
=
arg_2
arg_0
.
_resume
(
arg_1
)

def Func(arg_0, arg_1):
        """ Run all Func tasks, then run all tasks in the resume queue"""
        arg_0.log.debug('Signal handler got Func signal')
        arg_2 = []
        for arg_3 in arg_0.Func_callbacks:
            # If callback is non persistent we remove it
            try:
                arg_0.log.debug("Calling {0}({1},{2})".format(arg_3['function'].__name__, arg_3['args'], arg_3['kwargs']))
            except AttributeError:
                arg_0.log.debug("Calling unbound function/method {0}".format(str(arg_3)))

            apply(arg_3['function'], arg_3['args'], arg_3['kwargs'])
            if arg_3['persistent']:
                arg_2.append(arg_3)
        arg_0.Func_callbacks = arg_2
        arg_0._resume(arg_1)

Run all status tasks then run all tasks in the resume queue


def Func ( arg_0 ) : if isinstance ( arg_0 , StringIO ) : arg_1 = arg_0 arg_2 = arg_1 . len else : if os . fstat ( arg_0 . fileno ( ) ) . st_size == 0 : yield TOKEN_EOF , 'EOF' , 0 , 0 return arg_1 = mmap . mmap ( arg_0 . fileno ( ) , 0 , access = mmap . ACCESS_READ ) arg_2 = arg_1 . size ( ) arg_3 = 0 while 1 : arg_3 += 1 arg_4 = 1 if arg_1 . tell ( ) == arg_2 : yield TOKEN_EOF , 'EOF' , arg_3 , 0 break arg_5 = arg_1 . readline ( ) . decode ( 'utf-8' ) arg_5 = arg_5 . replace ( '\r\n' , '' ) arg_5 = arg_5 . replace ( '\n' , '' ) if re_comment . match ( arg_5 ) : continue arg_6 = deque ( ) while arg_5 : arg_7 = len ( arg_5 ) for arg_8 in tokens : arg_9 = arg_8 . regex . match ( arg_5 ) if arg_9 : if arg_6 : yield TOKEN_TEXT , '' . join ( arg_6 ) , arg_3 , arg_4 arg_4 += len ( arg_6 ) arg_6 . clear ( ) arg_10 , arg_11 = arg_9 . end ( ) , arg_9 . group ( ) arg_5 = arg_5 [ arg_10 : ] yield arg_8 , arg_11 , arg_3 , arg_4 arg_4 += arg_10 break if arg_7 == len ( arg_5 ) : arg_6 . append ( arg_5 [ 0 ] ) arg_5 = arg_5 [ 1 : ] if arg_6 : yield TOKEN_TEXT , '' . join ( arg_6 ) , arg_3 , arg_4 arg_4 += len ( arg_6 ) arg_6 . clear ( ) yield TOKEN_NEWLINE , '\n' , arg_3 , arg_4 arg_1 . close ( )

def Func(arg_0):
    'Tokenizer. Generates tokens stream from text'
    if isinstance(arg_0, StringIO):
        arg_1 = arg_0
        arg_2 = arg_1.len
    else:
        #empty file check
        if os.fstat(arg_0.fileno()).st_size == 0:
            yield TOKEN_EOF, 'EOF', 0, 0
            return
        arg_1 = mmap.mmap(arg_0.fileno(), 0, access=mmap.ACCESS_READ)
        arg_2 = arg_1.size()
    arg_3 = 0
    while 1:
        arg_3 += 1
        arg_4 = 1

        # end of file
        if arg_1.tell() == arg_2:
            yield TOKEN_EOF, 'EOF', arg_3, 0
            break

        # now we tokinize line by line
        arg_5 = arg_1.readline().decode('utf-8')
        arg_5 = arg_5.replace('\r\n', '')
        arg_5 = arg_5.replace('\n', '')
        # ignoring non XML comments
        if re_comment.match(arg_5):
            continue

        arg_6 = deque()
        while arg_5:
            arg_7 = len(arg_5)
            for arg_8 in tokens:
                arg_9 = arg_8.regex.match(arg_5)
                if arg_9:
                    if arg_6:
                        yield TOKEN_TEXT, ''.join(arg_6), arg_3, arg_4
                        arg_4 += len(arg_6)
                        arg_6.clear()
                    arg_10, arg_11 = arg_9.end(), arg_9.group()
                    arg_5 = arg_5[arg_10:]
                    yield arg_8, arg_11, arg_3, arg_4
                    arg_4 += arg_10
                    break

            # we did not get right in tokens list, so next char is text
            if arg_7 == len(arg_5):
                arg_6.append(arg_5[0])
                arg_5 = arg_5[1:]

        if arg_6:
            yield TOKEN_TEXT, ''.join(arg_6), arg_3, arg_4
            arg_4 += len(arg_6)
            arg_6.clear()
        yield TOKEN_NEWLINE, '\n', arg_3, arg_4

    # all work is done
    arg_1.close()

Tokenizer . Generates tokens stream from text


def
Func
(
arg_0
)
:
try
:
import
south
arg_1
=
arg_0
and
'Funcmigration %s'
%
' '
.
join
(
options
.
args
)
or
'Funcmigration'
call_manage
(
arg_1
)
except
ImportError
:
error
(
'Could not import south.'
)

def Func(arg_0):
    """Run South's Funcmigration command.
    """
    try:
        import south
        arg_1 = arg_0 and 'Funcmigration %s' % ' '.join(options.args) or 'Funcmigration'
        call_manage(arg_1)
    except ImportError:
        error('Could not import south.')


table will print a table of entries. If the rows is
        a dictionary, the keys are interpreted as column names. if
        not, a numbered list is used.

def Func ( arg_0 , arg_1 , arg_2 = 2 ) : arg_3 = [ str ( x ) for x in range ( 1 , len ( arg_1 ) + 1 ) ] if isinstance ( arg_1 , dict ) : arg_3 = list ( arg_1 . keys ( ) ) arg_1 = list ( arg_1 . values ( ) ) for arg_4 in arg_1 : arg_5 = arg_3 . pop ( 0 ) arg_5 = arg_5 . ljust ( arg_2 ) arg_6 = "\t" . join ( arg_4 ) arg_0 . custom ( prefix = arg_5 , arg_6 = arg_6 )

def Func(arg_0, arg_1, arg_2=2):
        '''Func will print a Func of entries. If the rows is
        a dictionary, the keys are interpreted as column names. if
        not, a numbered list is used.
        '''

        arg_3 = [str(x) for x in range(1,len(arg_1)+1)]
        if isinstance(arg_1, dict):
            arg_3 = list(arg_1.keys())
            arg_1 = list(arg_1.values())

        for arg_4 in arg_1:
            arg_5 = arg_3.pop(0)
            arg_5 = arg_5.ljust(arg_2)
            arg_6 = "\t".join(arg_4)
            arg_0.custom(prefix=arg_5,
                        arg_6=arg_6)

table will print a table of entries . If the rows is a dictionary the keys are interpreted as column names . if not a numbered list is used .


def Func ( arg_0 ) : arg_1 = CoreFoundation . CFDictionaryGetCount ( arg_0 ) arg_2 = ( CFTypeRef * arg_1 ) ( ) arg_3 = ( CFTypeRef * arg_1 ) ( ) CoreFoundation . CFDictionaryGetKeysAndValues ( arg_0 , _cast_pointer_p ( arg_2 ) , _cast_pointer_p ( arg_3 ) ) arg_4 = { } for arg_5 in range ( 0 , arg_1 ) : arg_4 [ arg_6 . native ( arg_2 [ arg_5 ] ) ] = arg_6 . native ( arg_3 [ arg_5 ] ) return arg_4

def Func(arg_0):
        """
        Converts a CFDictionary object into a python dictionary

        :param dictionary:
            The CFDictionary to convert

        :return:
            A python dict
        """

        arg_1 = CoreFoundation.CFDictionaryGetCount(arg_0)

        arg_2 = (CFTypeRef * arg_1)()
        arg_3 = (CFTypeRef * arg_1)()
        CoreFoundation.CFDictionaryGetKeysAndValues(
            arg_0,
            _cast_pointer_p(arg_2),
            _cast_pointer_p(arg_3)
        )

        arg_4 = {}
        for arg_5 in range(0, arg_1):
            arg_4[arg_6.native(arg_2[arg_5])] = arg_6.native(arg_3[arg_5])

        return arg_4


return (pointX - offsetX, pointY + offsetY)

def Func ( arg_0 , arg_1 , arg_2 ) : if ( arg_0 . angle == 0 or arg_0 . angle == None ) : return ( arg_1 , arg_2 ) arg_3 = math . sqrt ( ( arg_1 - arg_0 . xll ) ** 2 + ( arg_2 - arg_0 . yll ) ** 2 ) arg_4 = math . acos ( ( arg_1 - arg_0 . xll ) / arg_3 ) if ( arg_2 < arg_0 . yll ) : arg_4 = math . pi * 2 - arg_4 arg_5 = math . cos ( arg_4 ) * arg_3 - math . cos ( arg_0 . _angle_rd + arg_4 ) * arg_3 arg_6 = math . sin ( arg_0 . _angle_rd + arg_4 ) * arg_3 - math . sin ( arg_4 ) * arg_3 return ( arg_1 - arg_5 , arg_2 + arg_6 )

def Func(arg_0, arg_1, arg_2):
        """
        Rotates a point relative to the mesh origin by the angle specified in the angle property.
        Uses the angle formed between the segment linking the point of interest to the origin and
        the parallel intersecting the origin. This angle is called beta in the code.
        """
        if(arg_0.angle == 0 or arg_0.angle == None):
            return(arg_1, arg_2)

        # 1. Compute the segment length
        arg_3 = math.sqrt((arg_1 - arg_0.xll) ** 2 + (arg_2 - arg_0.yll) ** 2)

        # 2. Compute beta
        arg_4 = math.acos((arg_1 - arg_0.xll) / arg_3)
        if(arg_2 < arg_0.yll):
            arg_4 = math.pi * 2 - arg_4

        # 3. Compute offsets
        arg_5 = math.cos(arg_4) * arg_3 - math.cos(arg_0._angle_rd + arg_4) * arg_3
        arg_6 = math.sin(arg_0._angle_rd + arg_4) * arg_3 - math.sin(arg_4) * arg_3
        return (arg_1 - arg_5, arg_2 + arg_6)

Rotates a point relative to the mesh origin by the angle specified in the angle property . Uses the angle formed between the segment linking the point of interest to the origin and the parallel intersecting the origin . This angle is called beta in the code .


return any(expression_var is x for x in self.get_declared_variables())

def Func(arg_0, arg_1):
        """ True if expression_var is declared in this constraint set """
        if not isinstance(arg_1, Variable):
            raise ValueError(f'Expression must be a Variable (not a {type(expression_var)})')
        return any(arg_1 is arg_2 for arg_2 in arg_0.get_declared_variables())


Moves the layer down in the stacking order.

def Func ( arg_0 ) : arg_1 = arg_0 . index ( ) if arg_1 != None : del arg_0 . canvas . layers [ arg_1 ] arg_1 = max ( 0 , arg_1 - 1 ) arg_0 . canvas . layers . insert ( arg_1 , arg_0 )

def Func(arg_0):

        """Moves the layer Func in the stacking order.

        """

        arg_1 = arg_0.index()
        if arg_1 != None:
            del arg_0.canvas.layers[arg_1]
            arg_1 = max(0, arg_1-1)
            arg_0.canvas.layers.insert(arg_1, arg_0)

Moves the layer down in the stacking order .


(self, session, start_time: str, end_time: str)

def Func(arg_0, arg_1, arg_2: arg_3, arg_4: arg_3) -> Session:
        """
        Explicitly specify start time and end time

        Args:
            session: predefined session
            start_time: start time in terms of HHMM string
            end_time: end time in terms of HHMM string

        Returns:
            Session of start_time and end_time
        """
        if arg_1 not in arg_0.exch: return SessNA
        arg_5 = arg_0.exch[arg_1]

        arg_6 = arg_5[0] < arg_5[-1]

        if not arg_2: arg_7 = arg_5[0]
        else:
            arg_7 = param.to_hour(arg_2)
            if arg_6: arg_7 = max(arg_7, arg_5[0])

        if not arg_4: arg_8 = arg_5[-1]
        else:
            arg_8 = param.to_hour(arg_4)
            if arg_6: arg_8 = min(arg_8, arg_5[-1])

        if arg_6 and (arg_7 > arg_8): return SessNA
        return Session(arg_2=arg_7, arg_4=arg_8)


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """ Handles the domain model changing """

        if arg_3 is not None:
            arg_0.unmap_model(arg_3)
        if arg_4 is not None:
            arg_0.map_model(arg_4)


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
arg_3
=
logging
.
getLogger
(
__name__
)
arg_0
.
check_executable
(
)
arg_3
.
debug
(
"Executing command `%s` (cwd: %s)"
%
(
arg_1
,
arg_2
)
)
arg_4
=
subprocess
.
Popen
(
arg_1
,
shell
=
True
,
cwd
=
arg_2
,
arg_5
=
subprocess
.
PIPE
,
arg_6
=
subprocess
.
PIPE
)
arg_5
,
arg_6
=
arg_4
.
communicate
(
)
arg_7
=
arg_4
.
wait
(
)
if
arg_5
:
arg_3
.
info
(
arg_5
.
decode
(
"utf-8"
)
)
if
arg_6
:
if
arg_7
!=
0
:
arg_3
.
error
(
arg_6
.
decode
(
"utf-8"
)
)
else
:
arg_3
.
info
(
arg_6
.
decode
(
"utf-8"
)
)
return
arg_4

def Func(arg_0, arg_1, arg_2=None):
        """Execute command with os.popen and return output."""
        arg_3 = logging.getLogger(__name__)

        arg_0.check_executable()
        arg_3.debug("Executing command `%s` (cwd: %s)" % (arg_1, arg_2))
        arg_4 = subprocess.Popen(
            arg_1,
            shell=True,
            cwd=arg_2,
            arg_5=subprocess.PIPE,
            arg_6=subprocess.PIPE
        )
        arg_5, arg_6 = arg_4.communicate()
        arg_7 = arg_4.wait()

        if arg_5:
            arg_3.info(arg_5.decode("utf-8"))

        if arg_6:
            if arg_7 != 0:
                arg_3.error(arg_6.decode("utf-8"))
            else:
                arg_3.info(arg_6.decode("utf-8"))

        return arg_4

Execute command with os . popen and return output .


def Func(arg_0, arg_1={}):
        '''
        Update the current label. Returns a new Label object.
        '''
        arg_2 = arg_0.fetch_json(
            uri_path=arg_0.base_uri,
            http_method='PUT',
            arg_1=arg_1
        )

        return arg_0.create_label(arg_2)

Update the current label . Returns a new Label object .


def Func(arg_0):
    """Check that a checker's visitors are correctly named.

    A checker has methods named visit_NODETYPE, but it's easy to mis-name
    a visit method, and it will never be called.  This decorator checks
    the class to see that all of its visitors are named after an existing
    node class.
    """
    for arg_1 in dir(arg_0):
        if arg_1.startswith("visit_"):
            if arg_1[6:] not in CLASS_NAMES:
                raise Exception(u"Method {} doesn't correspond to a node class".format(arg_1))
    return arg_0

Check that a checker s visitors are correctly named .


def Func(arg_0, **arg_1):
        '''
        Get the checklists for this card. Returns a list of Checklist objects.

        Returns:
            list(Checklist): The checklists attached to this card
        '''
        arg_2 = arg_0.get_checklist_json(arg_0.base_uri,
                                             arg_1=arg_1)

        arg_3 = []
        for arg_4 in arg_2:
            arg_3.append(arg_0.create_checklist(arg_4))

        return arg_3

Get the checklists for this card . Returns a list of Checklist objects .


def
Func
(
arg_0
,
arg_1
,
**
arg_2
)
:
arg_3
=
arg_0
.
session
.
delete
(
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

def Func(arg_0, arg_1, **arg_2):
        """
        Convenience method for deleting
        """
        arg_3 = arg_0.session.delete(
            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


def Func(arg_0, arg_1, arg_2, arg_3):
        '''Register a mapping for controllers with the given vendor and product IDs.  The mapping will
        replace any existing mapping for these IDs for controllers not yet connected.

        :param vendor_id: the vendor ID of the controller, as reported by :attr:`Controller.vendor_id`
        :param product_id: the vendor ID of the controller, as reported by :attr:`Controller.product_id`
        :param mapping: a :class:`ControllerMapping` to apply
        '''
        arg_0._registry[(arg_1, arg_2)] = arg_3

Register a mapping for controllers with the given vendor and product IDs . The mapping will replace any existing mapping for these IDs for controllers not yet connected .


(lcd, t_ing_egr, oot_buffer_time=0.1, sample_factor=3)

def Func(arg_0, arg_1, arg_2=0.1, arg_3=3):
    '''After running `detrend_centroid`, this gets positions of centroids during
    transits, and outside of transits.

    These positions can then be used in a false positive analysis.

    This routine requires knowing the ingress and egress times for every
    transit of interest within the quarter this routine is being called for.
    There is currently no astrobase routine that automates this for periodic
    transits (it must be done in a calling routine).

    To get out of transit centroids, this routine takes points outside of the
    "buffer" set by `oot_buffer_time`, sampling 3x as many points on either
    side of the transit as are in the transit (or however many are specified by
    `sample_factor`).

    Parameters
    ----------

    lcd : lcdict
        An `lcdict` generated by the `read_kepler_fitslc` function. We assume
        that the `detrend_centroid` function has been run on this `lcdict`.

    t_ing_egr : list of tuples
        This is of the form::

            [(ingress time of i^th transit, egress time of i^th transit)]

        for i the transit number index in this quarter (starts at zero at the
        beginning of every quarter). Assumes units of BJD.

    oot_buffer_time : float
        Number of days away from ingress and egress times to begin sampling "out
        of transit" centroid points. The number of out of transit points to take
        per transit is 3x the number of points in transit.

    sample_factor : float
        The size of out of transit window from which to sample.

    Returns
    -------

    dict
        This is a dictionary keyed by transit number (i.e., the same index as
        `t_ing_egr`), where each key contains the following value::

            {'ctd_x_in_tra':ctd_x_in_tra,
             'ctd_y_in_tra':ctd_y_in_tra,
             'ctd_x_oot':ctd_x_oot,
             'ctd_y_oot':ctd_y_oot,
             'npts_in_tra':len(ctd_x_in_tra),
             'npts_oot':len(ctd_x_oot),
             'in_tra_times':in_tra_times,
             'oot_times':oot_times}

    '''

    # NOTE:
    # Bryson+ (2013) gives a more complicated and more correct approach to this
    # problem, computing offsets relative to positions defined on the SKY. This
    # requires using a Kepler focal plane geometry model. I don't have that
    # model, or know how to get it. So I use a simpler approach.

    arg_4 = int(np.unique(arg_0['quarter']))
    LOGINFO('Getting centroid offsets (qnum: {:d})...'.format(arg_4))
    # Kepler pixel scale, cf.
    # https://keplerscience.arc.nasa.gov/the-kepler-space-telescope.html
    arg_5 = 3.98

    # Get the residuals (units: pixel offset).
    arg_6 = arg_0['ctd_dtr']['times']
    arg_7 = arg_0['ctd_dtr']['ctd_x'] - arg_0['ctd_dtr']['fit_ctd_x']
    arg_8 = arg_0['ctd_dtr']['ctd_y'] - arg_0['ctd_dtr']['fit_ctd_y']

    # Return results in "centroid dictionary" (has keys of transit number).
    arg_9 = {}
    for arg_10,(arg_11,arg_12) in enumerate(arg_1):

        # We have in-transit times as input.
        arg_13 = arg_6[(arg_6 > arg_11) & (arg_6 < arg_12)]

        # Compute out of transit times on either side of the in-transit times.
        arg_14 = arg_12 - arg_11
        arg_15 = arg_3 * arg_14

        arg_16 = arg_6[
            (arg_6 < (arg_11-arg_2)) &
            (arg_6 > (arg_11-arg_2-arg_15))
        ]
        arg_17 = arg_6[
            (arg_6 > (arg_12+arg_2)) &
            (arg_6 < (arg_12+arg_2+arg_15))
        ]

        arg_18 = npconcatenate([arg_16, arg_17])

        arg_19 = npin1d(arg_6, arg_13)
        arg_20 = npin1d(arg_6, arg_18)

        # Convert to units of arcseconds.
        arg_21 = arg_7[arg_19]*arg_5
        arg_22 = arg_8[arg_19]*arg_5
        arg_23 = arg_7[arg_20]*arg_5
        arg_24 = arg_8[arg_20]*arg_5

        arg_9[arg_10] = {'ctd_x_in_tra':arg_21,
                  'ctd_y_in_tra':arg_22,
                  'ctd_x_oot':arg_23,
                  'ctd_y_oot':arg_24,
                  'npts_in_tra':len(arg_21),
                  'npts_oot':len(arg_23),
                  'in_tra_times':arg_13,
                  'oot_times':arg_18}

    LOGINFO('Got centroid offsets (qnum: {:d}).'.format(arg_4))

    return arg_9

After running detrend_centroid this gets positions of centroids during transits and outside of transits .


(path, times, annotations=None, delimiter=',', fmt='%0.3f')

def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
','
,
arg_4
=
'%0.3f'
)
:
if
arg_2
is
not
and
len
(
arg_2
)
!=
len
(
arg_1
)
:
raise
ParameterError
(
'len(annotations) != len(times)'
)
with
open
(
arg_0
,
'w'
)
as
output_file
:
arg_5
=
csv
.
writer
(
output_file
,
arg_3
=
arg_3
)
if
arg_2
is
:
for
arg_6
in
arg_1
:
arg_5
.
writerow
(
[
arg_4
%
arg_6
]
)
else
:
for
arg_6
,
arg_7
in
zip
(
arg_1
,
arg_2
)
:
arg_5
.
writerow
(
[
(
arg_4
%
arg_6
)
,
arg_7
]
)

def Func(arg_0, arg_1, arg_2=None, arg_3=',', arg_4='%0.3f'):
    r"""Save time steps as in CSV format.  This can be used to store the output
    of a beat-tracker or segmentation algorithm.

    If only `times` are provided, the file will contain each value
    of `times` on a row::

        times[0]\n
        times[1]\n
        times[2]\n
        ...

    If `annotations` are also provided, the file will contain
    delimiter-separated values::

        times[0],annotations[0]\n
        times[1],annotations[1]\n
        times[2],annotations[2]\n
        ...

    Parameters
    ----------
    path : string
        path to save the output CSV file

    times : list-like of floats
        list of frame numbers for beat events

    annotations : None or list-like
        optional annotations for each time step

    delimiter : str
        character to separate fields

    fmt : str
        format-string for rendering time

    Raises
    ------
    ParameterError
        if `annotations` is not `None` and length does not
        match `times`

    Examples
    --------
    Write beat-tracker time to CSV

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> tempo, beats = librosa.beat.beat_track(y, sr=sr, units='time')
    >>> librosa.output.Func('beat_times.csv', beats)
    """

    if arg_2 is not None and len(arg_2) != len(arg_1):
        raise ParameterError('len(annotations) != len(times)')

    with open(arg_0, 'w') as output_file:
        arg_5 = csv.writer(output_file, arg_3=arg_3)

        if arg_2 is None:
            for arg_6 in arg_1:
                arg_5.writerow([arg_4 % arg_6])
        else:
            for arg_6, arg_7 in zip(arg_1, arg_2):
                arg_5.writerow([(arg_4 % arg_6), arg_7])

r"""Save time steps as in CSV format.  This can be used to store the output
    of a beat-tracker or segmentation algorithm.

    If only `times` are provided, the file will contain each value
    of `times` on a row::

        times[0]\n
        times[1]\n
        times[2]\n
        ...

    If `annotations` are also provided, the file will contain
    delimiter-separated values::

        times[0],annotations[0]\n
        times[1],annotations[1]\n
        times[2],annotations[2]\n
        ...

    Parameters
    ----------
    path : string
        path to save the output CSV file

    times : list-like of floats
        list of frame numbers for beat events

    annotations : None or list-like
        optional annotations for each time step

    delimiter : str
        character to separate fields

    fmt : str
        format-string for rendering time

    Raises
    ------
    ParameterError
        if `annotations` is not `None` and length does not
        match `times`

    Examples
    --------
    Write beat-tracker time to CSV

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> tempo, beats = librosa.beat.beat_track(y, sr=sr, units='time')
    >>> librosa.output.times_csv('beat_times.csv', beats)

r Save time steps as in CSV format . This can be used to store the output of a beat - tracker or segmentation algorithm .


def Func ( arg_0 , arg_1 ) : with gzip . open ( arg_0 , 'wb' ) as out : for arg_2 in arg_1 : with open ( arg_2 ) as infile : out . write ( infile . read ( ) + "//\n//\n" )

def Func(arg_0, arg_1):
    """ concatenates sorted aligned cluster tmpfiles and removes them."""
    with gzip.open(arg_0, 'wb') as out:
        for arg_2 in arg_1:
            with open(arg_2) as infile:
                out.write(infile.read()+"//\n//\n")

concatenates sorted aligned cluster tmpfiles and removes them .


return self._mc_client._delete(url=self._build_path(list_id, 'webhooks', webhook_id))

def Func(arg_0, arg_1, arg_2):
        """
        Delete a specific webhook in a list.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param webhook_id: The unique id for the webhook.
        :type webhook_id: :py:class:`str`
        """
        arg_0.list_id = arg_1
        arg_0.webhook_id = arg_2
        return arg_0._mc_client._Func(url=arg_0._build_path(arg_1, 'webhooks', arg_2))


(filename, trajectory=None,
                    env_name=None,
                    traj_name=None,
                    set_name=None,
                    run_name=None,
                    process_name=None,
                    host_name=None)

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = None , arg_4 = None , arg_5 = None , arg_6 = None , arg_7 = None ) : if pypetconstants . LOG_ENV in arg_0 : if arg_2 is None : arg_2 = arg_1 . v_environment_name arg_0 = arg_0 . replace ( pypetconstants . LOG_ENV , arg_2 ) if pypetconstants . LOG_TRAJ in arg_0 : if arg_3 is None : arg_3 = arg_1 . v_name arg_0 = arg_0 . replace ( pypetconstants . LOG_TRAJ , arg_3 ) if pypetconstants . LOG_RUN in arg_0 : if arg_5 is None : arg_5 = arg_1 . f_wildcard ( '$' ) arg_0 = arg_0 . replace ( pypetconstants . LOG_RUN , arg_5 ) if pypetconstants . LOG_SET in arg_0 : if arg_4 is None : arg_4 = arg_1 . f_wildcard ( '$set' ) arg_0 = arg_0 . replace ( pypetconstants . LOG_SET , arg_4 ) if pypetconstants . LOG_PROC in arg_0 : if arg_6 is None : arg_6 = multip . current_process ( ) . name + '-' + str ( os . getpid ( ) ) arg_0 = arg_0 . replace ( pypetconstants . LOG_PROC , arg_6 ) if pypetconstants . LOG_HOST in arg_0 : if arg_7 is None : arg_7 = socket . getfqdn ( ) . replace ( '.' , '-' ) arg_0 = arg_0 . replace ( pypetconstants . LOG_HOST , arg_7 ) return arg_0

def Func(arg_0, arg_1=None,
                    arg_2=None,
                    arg_3=None,
                    arg_4=None,
                    arg_5=None,
                    arg_6=None,
                    arg_7=None):
    """ Renames a given `filename` with valid wildcard placements.

    :const:`~pypet.pypetconstants.LOG_ENV` ($env) is replaces by the name of the
    trajectory`s environment.

    :const:`~pypet.pypetconstants.LOG_TRAJ` ($traj) is replaced by the name of the
    trajectory.

    :const:`~pypet.pypetconstants.LOG_RUN` ($run) is replaced by the name of the current
    run. If the trajectory is not set to a run 'run_ALL' is used.

    :const:`~pypet.pypetconstants.LOG_SET` ($set) is replaced by the name of the current
    run set. If the trajectory is not set to a run 'run_set_ALL' is used.

    :const:`~pypet.pypetconstants.LOG_PROC` ($proc) is replaced by the name fo the
    current process.

    :const:`~pypet.pypetconstant.LOG_HOST` ($host) is replaced by the name of the current host.

    :param filename:  A filename string
    :param traj:  A trajectory container, leave `None` if you provide all the parameters below
    :param env_name: Name of environemnt, leave `None` to get it from `traj`
    :param traj_name: Name of trajectory, leave `None` to get it from `traj`
    :param set_name: Name of run set, leave `None` to get it from `traj`
    :param run_name: Name of run, leave `None` to get it from `traj`
    :param process_name:

        The name of the desired process. If `None` the name of the current process is
        taken determined by the multiprocessing module.

    :param host_name:

        Name of host, leave `None` to determine it automatically with the platform module.

    :return: The new filename

    """
    if pypetconstants.LOG_ENV in arg_0:
        if arg_2 is None:
            arg_2 = arg_1.v_environment_name
        arg_0 = arg_0.replace(pypetconstants.LOG_ENV, arg_2)
    if pypetconstants.LOG_TRAJ in arg_0:
        if arg_3 is None:
            arg_3 = arg_1.v_name
        arg_0 = arg_0.replace(pypetconstants.LOG_TRAJ, arg_3)
    if pypetconstants.LOG_RUN in arg_0:
        if arg_5 is None:
            arg_5 = arg_1.f_wildcard('$')
        arg_0 = arg_0.replace(pypetconstants.LOG_RUN, arg_5)
    if pypetconstants.LOG_SET in arg_0:
        if arg_4 is None:
            arg_4 = arg_1.f_wildcard('$set')
        arg_0 = arg_0.replace(pypetconstants.LOG_SET, arg_4)
    if pypetconstants.LOG_PROC in arg_0:
        if arg_6 is None:
            arg_6 = multip.current_process().name + '-' + str(os.getpid())
        arg_0 = arg_0.replace(pypetconstants.LOG_PROC, arg_6)
    if pypetconstants.LOG_HOST in arg_0:
        if arg_7 is None:
            arg_7 = socket.getfqdn().replace('.', '-')
        arg_0 = arg_0.replace(pypetconstants.LOG_HOST, arg_7)
    return arg_0

Renames a given filename with valid wildcard placements .


return [
            (tag, i) for i in
            self.client.get_pulls(*tag.split('/'))
        ]

def Func ( arg_0 , arg_1 ) : return [ ( arg_1 , arg_2 ) for arg_2 in arg_0 . client . get_pulls ( * arg_1 . split ( '/' ) ) ]

def Func(arg_0, arg_1):
        """ Grab all the pull requests """
        return [
            (arg_1, arg_2) for arg_2 in
            arg_0.client.get_pulls(*arg_1.split('/'))
        ]


PostMessage from Win32.
    Return bool, True if succeed otherwise False.

(handle: int, msg: int, wParam: int, lParam: int)

return bool(ctypes.windll.user32.PostMessageW(ctypes.c_void_p(handle), msg, wParam, lParam))

def Func ( arg_0 : arg_1 , arg_2 : arg_1 , arg_3 : arg_1 , arg_4 : arg_1 ) -> bool : return bool ( ctypes . windll . user32 . FuncW ( ctypes . c_void_p ( arg_0 ) , arg_2 , arg_3 , arg_4 ) )

def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_1, arg_4: arg_1) -> bool:
    """
    Func from Win32.
    Return bool, True if succeed otherwise False.
    """
    return bool(ctypes.windll.user32.FuncW(ctypes.c_void_p(arg_0), arg_2, arg_3, arg_4))

PostMessage from Win32 . Return bool True if succeed otherwise False .


(search_term=None, size=20, from_=0, field_dictionary=None)

def Func(arg_0=None, arg_1=20, arg_2=0, arg_3=None):
    """
    Course Discovery activities against the search engine index of course details
    """
    # We'll ignore the course-enrollemnt informaiton in field and filter
    # dictionary, and use our own logic upon enrollment dates for these
    arg_4 = ["org"]
    (arg_5, arg_6, arg_7) = SearchFilterGenerator.generate_field_filters()
    arg_8 = {}
    arg_8.update({arg_9: arg_5[arg_9] for arg_9 in arg_5 if arg_9 in arg_4})
    if arg_3:
        arg_8.update(arg_3)
    if not getattr(settings, "SEARCH_SKIP_ENROLLMENT_START_DATE_FILTERING", False):
        arg_8["enrollment_start"] = DateRange(None, datetime.utcnow())

    arg_10 = SearchEngine.get_search_engine(getattr(settings, "COURSEWARE_INDEX_NAME", "courseware_index"))
    if not arg_10:
        raise NoSearchEngineError("No search engine specified in settings.SEARCH_ENGINE")

    arg_11 = arg_10.search(
        query_string=arg_0,
        doc_type="course_info",
        arg_1=arg_1,
        arg_2=arg_2,
        # only show when enrollment start IS provided and is before now
        arg_3=arg_8,
        # show if no enrollment end is provided and has not yet been reached
        filter_dictionary={"enrollment_end": DateRange(datetime.utcnow(), None)},
        arg_7=arg_7,
        facet_terms=course_discovery_facets(),
    )

    return arg_11


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . get_feature_names ( ) arg_3 = [ arg_2 . index ( f ) for f in arg_1 ] return arg_3

def Func(arg_0, arg_1):
    """ Returns a list with the order that features requested appear in
    dataset """
    arg_2 = arg_0.get_feature_names()

    arg_3 = [arg_2.index(f) for f in arg_1]

    return arg_3


def Func(arg_0):
    """Add one or more existing Docker containers to a Blockade group
    """
    arg_1 = load_config(arg_0.config)
    arg_2 = get_blockade(arg_1, arg_0)
    arg_2.add_container(arg_0.containers)


def Func ( arg_0 ) : if getattr ( settings , "NOTIFICATION_LANGUAGE_MODULE" , False ) : try : arg_1 , arg_2 = settings . NOTIFICATION_LANGUAGE_MODULE . split ( "." ) arg_3 = models . get_model ( arg_1 , arg_2 ) arg_4 = arg_3 . _default_manager . get ( user__id__exact = arg_0 . id ) if hasattr ( arg_4 , "language" ) : return arg_4 . language except ( ImportError , ImproperlyConfigured , arg_3 . DoesNotExist ) : raise LanguageStoreNotAvailable raise LanguageStoreNotAvailable

def Func(arg_0):
    """
    Returns site-specific notification language for this user. Raises
    LanguageStoreNotAvailable if this site does not use translated
    notifications.
    """
    if getattr(settings, "NOTIFICATION_LANGUAGE_MODULE", False):
        try:
            arg_1, arg_2 = settings.NOTIFICATION_LANGUAGE_MODULE.split(".")
            arg_3 = models.get_model(arg_1, arg_2)
            # pylint: disable-msg=W0212
            arg_4 = arg_3._default_manager.get(user__id__exact=arg_0.id)
            if hasattr(arg_4, "language"):
                return arg_4.language
        except (ImportError, ImproperlyConfigured, arg_3.DoesNotExist):
            raise LanguageStoreNotAvailable
    raise LanguageStoreNotAvailable

Returns site - specific notification language for this user . Raises LanguageStoreNotAvailable if this site does not use translated notifications .


def Func ( arg_0 , arg_1 ) : arg_2 = dict ( action = 'url-stats' , shorturl = arg_1 ) arg_3 = arg_0 . _api_request ( params = arg_2 ) return _json_to_shortened_url ( arg_3 [ 'link' ] )

def Func(arg_0, arg_1):
        """Get stats for short URL or keyword.

        Parameters:
            short: Short URL (http://example.com/abc) or keyword (abc).

        Returns:
            ShortenedURL: Shortened URL and associated data.

        Raises:
            ~yourls.exceptions.YOURLSHTTPError: HTTP error with response from
                YOURLS API.
            requests.exceptions.HTTPError: Generic HTTP error.
        """
        arg_2 = dict(action='url-stats', shorturl=arg_1)
        arg_3 = arg_0._api_request(params=arg_2)

        return _json_to_shortened_url(arg_3['link'])


def Func(arg_0, arg_1=None):
    """
    Get a value from configuration.

    Retrieves the value corresponding to the given variable from the configuration module
    currently in use by the app.  Specify a site_code value to check for a site-specific override.

    Arguments:
        variable (str): The name of a variable from the configuration module.

    Keyword Arguments:
        site_code (str): The SITE_OVERRIDES key to inspect for site-specific values

    Returns:
        The value corresponding to the variable, or None if the variable is not found.
    """
    arg_2 = os.environ.get(CONFIGURATION_MODULE)

    # __import__ performs a full import, but only returns the top-level
    # package, not the targeted module. sys.modules is a dictionary
    # mapping module names to loaded modules.
    __import__(arg_2)
    arg_3 = sys.modules[arg_2]

    # Locate the setting in the specified module, then attempt to apply a site-specific override
    arg_4 = getattr(arg_3, arg_0, None)
    arg_5 = getattr(arg_3, 'SITE_OVERRIDES', None)
    if arg_5 and arg_1 is not None:
        arg_6 = arg_5.get(arg_1)
        if arg_6:
            arg_7 = arg_6.get(arg_0)
            if arg_7:
                arg_4 = arg_7

    if arg_4 is None:
        raise RuntimeError('Worker is improperly configured: {} is unset in {}.'.format(arg_0, arg_3))
    return arg_4


def Func ( arg_0 = arg_1 . platform ) : arg_2 = { 'win32' : EOL_STYLE_WINDOWS , 'linux2' : EOL_STYLE_UNIX , 'linux' : EOL_STYLE_UNIX , 'darwin' : EOL_STYLE_MAC , } arg_3 = arg_2 . get ( arg_0 ) if arg_3 is None : from . _exceptions import UnknownPlatformError raise UnknownPlatformError ( arg_0 ) return arg_3

def Func(arg_0=arg_1.platform):
    '''
    Internal function that determines EOL_STYLE_NATIVE constant with the proper value for the
    current platform.
    '''
    arg_2 = {
        'win32' : EOL_STYLE_WINDOWS,
        'linux2' : EOL_STYLE_UNIX,
        'linux' : EOL_STYLE_UNIX,
        'darwin' : EOL_STYLE_MAC,
    }
    arg_3 = arg_2.get(arg_0)

    if arg_3 is None:
        from ._exceptions import UnknownPlatformError
        raise UnknownPlatformError(arg_0)

    return arg_3

Internal function that determines EOL_STYLE_NATIVE constant with the proper value for the current platform .


def Func(arg_0, arg_1):
    """
    Checks to see if a list of axes are contained within an array shape.

    Parameters
    ----------
    shape : tuple[int]
        the shape of a BoltArray

    axes : tuple[int]
        the axes to check against shape
    """
    arg_2 = all([(axis < len(arg_0)) and (axis >= 0) for axis in arg_1])
    if not arg_2:
        raise ValueError("axes not valid for an ndarray of shape: %s" % str(arg_0))

Checks to see if a list of axes are contained within an array shape .


def Func ( arg_0 , arg_1 ) : if arg_0 . filter . lower ( ) in arg_0 . _FILTERS_TO_REPLACE : arg_0 . filter = arg_1 elif arg_1 not in arg_0 . filter . split ( ";" ) : arg_0 . filter = ";" . join ( [ arg_0 . filter , arg_1 ] )

def Func(arg_0, arg_1):
        """Replaces null or blank filter or adds filter to existing list."""
        if arg_0.filter.lower() in arg_0._FILTERS_TO_REPLACE:
            arg_0.filter = arg_1
        elif arg_1 not in arg_0.filter.split(";"):
            arg_0.filter = ";".join([arg_0.filter,
                                    arg_1])

Replaces null or blank filter or adds filter to existing list .


def Func ( arg_0 , arg_1 = None ) : arg_2 = dict ( user_id = arg_1 [ '_id' ] ) if arg_1 else dict ( ) return arg_0 . event_collection . find ( arg_2 )

def Func(arg_0, arg_1=None):
        """Fetch all events by a specific user."""
        arg_2 = dict(user_id=arg_1['_id']) if arg_1 else dict()
        return arg_0.event_collection.find(arg_2)


def
Func
(
arg_0
)
:
imp
.
acquire_lock
(
)
try
:
if
arg_0
in
_namespace_packages
:
return
arg_1
,
arg_2
=
sys
.
path
,
if
'.'
in
arg_0
:
arg_2
=
'.'
.
join
(
arg_0
.
split
(
'.'
)
[
:
1
]
)
Func
(
arg_2
)
if
arg_2
not
in
_namespace_packages
:
__import__
(
arg_2
)
try
:
arg_1
=
sys
.
modules
[
arg_2
]
.
__path__
except
AttributeError
:
raise
TypeError
(
"Not a package:"
,
arg_2
)
_namespace_packages
.
setdefault
(
arg_2
,
[
]
)
.
append
(
arg_0
)
_namespace_packages
.
setdefault
(
arg_0
,
[
]
)
for
arg_3
in
arg_1
:
_handle_ns
(
arg_0
,
arg_3
)
finally
:
imp
.
release_lock
(
)

def Func(arg_0):
    """Declare that package 'packageName' is a namespace package"""

    imp.acquire_lock()
    try:
        if arg_0 in _namespace_packages:
            return

        arg_1, arg_2 = sys.path, None
        if '.' in arg_0:
            arg_2 = '.'.join(arg_0.split('.')[:-1])
            Func(arg_2)
            if arg_2 not in _namespace_packages:
                __import__(arg_2)
            try:
                arg_1 = sys.modules[arg_2].__path__
            except AttributeError:
                raise TypeError("Not a package:", arg_2)

        # Track what packages are namespaces, so when new path items are added,
        # they can be updated
        _namespace_packages.setdefault(arg_2,[]).append(arg_0)
        _namespace_packages.setdefault(arg_0,[])

        for arg_3 in arg_1:
            # Ensure all the parent's path items are reflected in the child,
            # if they apply
            _handle_ns(arg_0, arg_3)

    finally:
        imp.release_lock()

Declare that package packageName is a namespace package


def Func ( arg_0 ) : arg_0 . prepare_to_Func ( ) for arg_1 in range ( 0 , arg_0 . period_count ) : for arg_2 in arg_0 . entities : arg_2 . Func ( arg_0 . clock ) arg_0 . clock . tick ( )

def Func(arg_0):
        """
        Execute the model.
        """

        arg_0.prepare_to_Func()
        for arg_1 in range(0, arg_0.period_count):
            for arg_2 in arg_0.entities:
                arg_2.Func(arg_0.clock)
            arg_0.clock.tick()