(
    df: pd.DataFrame,
    id_cols: List[str],
    reference_col: str,
    complete_index: Union[Dict[str, str], List[str]] = None,
    method: str = None,
    cols_to_keep: List[str] = None
)

def
Func
(
arg_0
:
arg_1
.
DataFrame
,
arg_3
:
arg_4
[
arg_5
]
,
arg_6
:
arg_5
,
arg_7
:
arg_8
[
arg_9
[
arg_5
,
arg_5
]
,
arg_4
[
arg_5
]
]
=
,
arg_10
:
arg_5
=
,
arg_11
:
arg_4
[
arg_5
]
=
)
->
arg_1
.
DataFrame
:
if
arg_11
is
:
arg_12
=
[
arg_6
]
else
:
arg_12
=
[
arg_6
]
+
arg_11
check_params_columns_duplicate
(
arg_3
+
arg_12
)
if
arg_10
==
'between'
or
arg_10
==
'between_and_after'
:
arg_0
[
'start'
]
=
arg_0
.
groupby
(
arg_3
)
[
arg_6
]
.
transform
(
min
)
arg_3
+=
[
'start'
]
if
arg_10
==
'between'
or
arg_10
==
'between_and_before'
:
arg_0
[
'end'
]
=
arg_0
.
groupby
(
arg_3
)
[
arg_6
]
.
transform
(
max
)
arg_3
+=
[
'end'
]
arg_13
=
arg_3
+
arg_12
arg_14
=
arg_0
.
set_index
(
arg_13
)
arg_15
=
arg_0
.
groupby
(
arg_3
)
.
sum
(
)
.
index
.
values
if
arg_7
is
:
arg_7
=
arg_0
.
groupby
(
arg_12
)
.
sum
(
)
.
index
.
values
elif
isinstance
(
arg_7
,
dict
)
:
if
arg_7
[
'type'
]
==
'date'
:
arg_16
=
arg_7
[
'freq'
]
arg_17
=
arg_7
[
'format'
]
arg_18
=
arg_7
[
'start'
]
arg_19
=
arg_7
[
'end'
]
if
isinstance
(
arg_16
,
dict
)
:
arg_16
=
arg_1
.
DateOffset
(
**
{
k
:
int
(
v
)
for
k
,
v
in
arg_16
.
items
(
)
}
)
arg_7
=
arg_1
.
date_range
(
arg_18
=
arg_18
,
arg_19
=
arg_19
,
arg_16
=
arg_16
)
arg_7
=
arg_7
.
strftime
(
arg_17
)
else
:
raise
ParamsValueError
(
f'Unknown complete index type: '
f'{complete_index["type"]}'
)
if
not
isinstance
(
arg_15
[
0
]
,
tuple
)
:
arg_15
=
[
(
x
,
)
for
x
in
arg_15
]
if
not
isinstance
(
arg_7
[
0
]
,
tuple
)
:
arg_7
=
[
(
x
,
)
for
x
in
arg_7
]
arg_20
=
[
x
+
y
for
x
in
arg_15
for
y
in
arg_7
]
arg_21
=
arg_1
.
MultiIndex
.
from_tuples
(
arg_20
,
arg_13
=
arg_13
)
arg_14
=
arg_14
.
reindex
(
arg_21
)
.
reset_index
(
)
if
arg_10
==
'between'
or
arg_10
==
'between_and_after'
:
arg_14
=
arg_14
[
arg_14
[
arg_6
]
>=
arg_14
[
'start'
]
]
del
arg_14
[
'start'
]
if
arg_10
==
'between'
or
arg_10
==
'between_and_before'
:
arg_14
=
arg_14
[
arg_14
[
arg_6
]
<=
arg_14
[
'end'
]
]
del
arg_14
[
'end'
]
return
arg_14

def Func(
    arg_0: arg_1.DataFrame,
    arg_3: arg_4[arg_5],
    arg_6: arg_5,
    arg_7: arg_8[arg_9[arg_5, arg_5], arg_4[arg_5]] = None,
    arg_10: arg_5 = None,
    arg_11: arg_4[arg_5] = None
) -> arg_1.DataFrame:
    """
    Add missing row to a df base on a reference column

    ---

    ### Parameters

    *mandatory :*
    - `id_cols` (*list of str*): names of the columns used to create each group
    - `reference_col` (*str*): name of the column used to identify missing rows

    *optional :*
    - `complete_index` (*list* or *dict*): [A, B, C] a list of values used to add missing rows.
      It can also be a dict to declare a date range.
      By default, use all values of reference_col.
    - `method` (*str*): by default all missing rows are added. The possible values are :
        - `"between"` : add missing rows having their value between min and max values for each group,
        - `"between_and_after"` : add missing rows having their value bigger than min value for each group.
        - `"between_and_before"` : add missing rows having their value smaller than max values for each group.
    - `cols_to_keep` (*list of str*): name of other columns to keep, linked to the reference_col.

    ---

    ### Example

    **Input**

    YEAR | MONTH | NAME
    :---:|:---:|:--:
    2017|1|A
    2017|2|A
    2017|3|A
    2017|1|B
    2017|3|B

    ```cson
    Func:
      id_cols: ['NAME']
      reference_col: 'MONTH'
    ```

    **Output**

    YEAR | MONTH | NAME
    :---:|:---:|:--:
    2017|1|A
    2017|2|A
    2017|3|A
    2017|1|B
    2017|2|B
    2017|3|B

    """
    if arg_11 is None:
        arg_12 = [arg_6]
    else:
        arg_12 = [arg_6] + arg_11
    check_params_columns_duplicate(arg_3 + arg_12)

    if arg_10 == 'between' or arg_10 == 'between_and_after':
        arg_0['start'] = arg_0.groupby(arg_3)[arg_6].transform(min)
        arg_3 += ['start']
    if arg_10 == 'between' or arg_10 == 'between_and_before':
        arg_0['end'] = arg_0.groupby(arg_3)[arg_6].transform(max)
        arg_3 += ['end']

    arg_13 = arg_3 + arg_12
    arg_14 = arg_0.set_index(arg_13)
    arg_15 = arg_0.groupby(arg_3).sum().index.values

    if arg_7 is None:
        arg_7 = arg_0.groupby(arg_12).sum().index.values
    elif isinstance(arg_7, dict):
        if arg_7['type'] == 'date':
            arg_16 = arg_7['freq']
            arg_17 = arg_7['format']
            arg_18 = arg_7['start']
            arg_19 = arg_7['end']
            if isinstance(arg_16, dict):
                arg_16 = arg_1.DateOffset(**{k: int(v) for k, v in arg_16.items()})
            arg_7 = arg_1.date_range(arg_18=arg_18, arg_19=arg_19, arg_16=arg_16)
            arg_7 = arg_7.strftime(arg_17)
        else:
            raise ParamsValueError(f'Unknown complete index type: '
                                   f'{complete_index["type"]}')

    if not isinstance(arg_15[0], tuple):
        arg_15 = [(x,) for x in arg_15]
    if not isinstance(arg_7[0], tuple):
        arg_7 = [(x,) for x in arg_7]
    arg_20 = [x + y for x in arg_15 for y in arg_7]

    arg_21 = arg_1.MultiIndex.from_tuples(arg_20, arg_13=arg_13)
    arg_14 = arg_14.reindex(arg_21).reset_index()

    if arg_10 == 'between' or arg_10 == 'between_and_after':
        arg_14 = arg_14[arg_14[arg_6] >= arg_14['start']]
        del arg_14['start']
    if arg_10 == 'between' or arg_10 == 'between_and_before':
        arg_14 = arg_14[arg_14[arg_6] <= arg_14['end']]
        del arg_14['end']

    return arg_14

Add missing row to a df base on a reference column

    ---

    ### Parameters

    *mandatory :*
    - `id_cols` (*list of str*): names of the columns used to create each group
    - `reference_col` (*str*): name of the column used to identify missing rows

    *optional :*
    - `complete_index` (*list* or *dict*): [A, B, C] a list of values used to add missing rows.
      It can also be a dict to declare a date range.
      By default, use all values of reference_col.
    - `method` (*str*): by default all missing rows are added. The possible values are :
        - `"between"` : add missing rows having their value between min and max values for each group,
        - `"between_and_after"` : add missing rows having their value bigger than min value for each group.
        - `"between_and_before"` : add missing rows having their value smaller than max values for each group.
    - `cols_to_keep` (*list of str*): name of other columns to keep, linked to the reference_col.

    ---

    ### Example

    **Input**

    YEAR | MONTH | NAME
    :---:|:---:|:--:
    2017|1|A
    2017|2|A
    2017|3|A
    2017|1|B
    2017|3|B

    ```cson
    add_missing_row:
      id_cols: ['NAME']
      reference_col: 'MONTH'
    ```

    **Output**

    YEAR | MONTH | NAME
    :---:|:---:|:--:
    2017|1|A
    2017|2|A
    2017|3|A
    2017|1|B
    2017|2|B
    2017|3|B


def Func ( arg_0 , arg_1 ) : arg_0 = os . path . expanduser ( arg_0 ) if os . path . isdir ( arg_0 ) and arg_0 not in sys . path : sys . path . append ( arg_0 ) try : return importlib . import_module ( arg_1 ) except ImportError : pass

def Func(arg_0, arg_1):
    """Try to Func and return a module

    Will add DIRECTORY_NAME to sys.path and tries to import MODULE_NAME.

    For example:
    Func("~/.yaz", "yaz_extension")
    """
    arg_0 = os.path.expanduser(arg_0)
    if os.path.isdir(arg_0) and arg_0 not in sys.path:
        sys.path.append(arg_0)

    try:
        return importlib.import_module(arg_1)
    except ImportError:
        pass

Try to load and return a module

    Will add DIRECTORY_NAME to sys.path and tries to import MODULE_NAME.

    For example:
    load("~/.yaz", "yaz_extension")


(state, incorrect_msg=None, code=None, exact=True, append=None)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=True, arg_4=None):
    """Test whether abstract syntax trees match between the student and solution code.

    ``Func()`` can be used in two ways:

    * As a robust version of ``has_code()``. By setting ``code``, you can look for the AST representation of ``code`` in the student's submission.
      But be aware that ``a`` and ``a = 1`` won't match, as reading and assigning are not the same in an AST.
      Use ``ast.dump(ast.parse(code))`` to see an AST representation of ``code``.
    * As an expression-based check when using more advanced SCT chain, e.g. to compare the equality of expressions to set function arguments.

    Args:
        incorrect_msg: message displayed when ASTs mismatch. When you specify ``code`` yourself, you have to specify this.
        code: optional code to use instead of the solution AST.
        exact: whether the representations must match exactly. If false, the solution AST
               only needs to be contained within the student AST (similar to using test student typed).
               Defaults to ``True``, unless the ``code`` argument has been specified.

    :Example:

        Student and Solution Code::

            dict(a = 'value').keys()

        SCT::

            # all pass
            Ex().Func()
            Ex().Func(code = "dict(a = 'value').keys()")
            Ex().Func(code = "dict(a = 'value')", exact = False)

        Student and Solution Code::

            import numpy as np
            arr = np.array([1, 2, 3, 4, 5])
            np.mean(arr)

        SCT::

            # Check underlying value of arugment a of np.mean:
            Ex().check_function('numpy.mean').check_args('a').Func()

            # Only check AST equality of expression used to specify argument a:
            Ex().check_function('numpy.mean').check_args('a').Func()

    """
    if utils.v2_only():
        arg_0.assert_is_not(["object_assignments"], "Func", ["check_object"])
        arg_0.assert_is_not(["function_calls"], "Func", ["check_function"])

    if arg_2 and arg_1 is None:
        raise InstructorError(
            "If you manually specify the code to match inside Func(), "
            "you have to explicitly set the `incorrect_msg` argument."
        )

    if (
        arg_4 is None
    ):  # if not specified, set to False if incorrect_msg was manually specified
        arg_4 = arg_1 is None
    if arg_1 is None:
        arg_1 = "Expected `{{sol_str}}`, but got `{{stu_str}}`."

    def parse_tree(arg_5):
        # get contents of module.body if only 1 element
        arg_6 = (
            arg_5.body[0]
            if isinstance(arg_5, ast.Module) and len(arg_5.body) == 1
            else arg_5
        )

        # remove Expr if it exists
        return ast.dump(arg_6.value if isinstance(arg_6, ast.Expr) else arg_6)

    arg_7 = parse_tree(arg_0.student_ast)
    arg_8 = parse_tree(arg_0.solution_ast if not arg_2 else ast.parse(arg_2))

    arg_9 = {
        "sol_str": arg_0.solution_code if not arg_2 else arg_2,
        "stu_str": arg_0.student_code,
    }

    arg_10 = arg_0.build_message(arg_1, arg_9, arg_4=arg_4)

    if arg_3 and not arg_2:
        arg_0.do_test(EqualTest(arg_7, arg_8, Feedback(arg_10, arg_0)))
    elif not arg_8 in arg_7:
        arg_0.report(Feedback(arg_10, arg_0))

    return arg_0

Test whether abstract syntax trees match between the student and solution code.

    ``has_equal_ast()`` can be used in two ways:

    * As a robust version of ``has_code()``. By setting ``code``, you can look for the AST representation of ``code`` in the student's submission.
      But be aware that ``a`` and ``a = 1`` won't match, as reading and assigning are not the same in an AST.
      Use ``ast.dump(ast.parse(code))`` to see an AST representation of ``code``.
    * As an expression-based check when using more advanced SCT chain, e.g. to compare the equality of expressions to set function arguments.

    Args:
        incorrect_msg: message displayed when ASTs mismatch. When you specify ``code`` yourself, you have to specify this.
        code: optional code to use instead of the solution AST.
        exact: whether the representations must match exactly. If false, the solution AST
               only needs to be contained within the student AST (similar to using test student typed).
               Defaults to ``True``, unless the ``code`` argument has been specified.

    :Example:

        Student and Solution Code::

            dict(a = 'value').keys()

        SCT::

            # all pass
            Ex().has_equal_ast()
            Ex().has_equal_ast(code = "dict(a = 'value').keys()")
            Ex().has_equal_ast(code = "dict(a = 'value')", exact = False)

        Student and Solution Code::

            import numpy as np
            arr = np.array([1, 2, 3, 4, 5])
            np.mean(arr)

        SCT::

            # Check underlying value of arugment a of np.mean:
            Ex().check_function('numpy.mean').check_args('a').has_equal_ast()

            # Only check AST equality of expression used to specify argument a:
            Ex().check_function('numpy.mean').check_args('a').has_equal_ast()

Test whether abstract syntax trees match between the student and solution code .


def Func ( arg_0 ) : arg_1 = np . argmin ( arg_0 ) arg_2 = arg_0 [ : arg_1 ] [ arg_0 [ : arg_1 ] == 0 ] . index [ - 1 ] try : arg_3 = arg_0 [ arg_1 : ] [ arg_0 [ arg_1 : ] == 0 ] . index [ 0 ] except IndexError : arg_3 = np . nan return arg_2 , arg_1 , arg_3

def Func(arg_0):
    """
    Determines peak, valley, and recovery dates given an 'underwater'
    DataFrame.

    An underwater DataFrame is a DataFrame that has precomputed
    rolling drawdown.

    Parameters
    ----------
    underwater : pd.Series
       Underwater returns (rolling drawdown) of a strategy.

    Returns
    -------
    peak : datetime
        The maximum drawdown's peak.
    valley : datetime
        The maximum drawdown's valley.
    recovery : datetime
        The maximum drawdown's recovery.
    """

    arg_1 = np.argmin(arg_0)  # end of the period
    # Find first 0
    arg_2 = arg_0[:arg_1][arg_0[:arg_1] == 0].index[-1]
    # Find last 0
    try:
        arg_3 = arg_0[arg_1:][arg_0[arg_1:] == 0].index[0]
    except IndexError:
        arg_3 = np.nan  # drawdown not recovered
    return arg_2, arg_1, arg_3

Determines peak valley and recovery dates given an underwater DataFrame .


def Func ( arg_0 , arg_1 = '0.2g' ) : if arg_0 . group ( 0 ) : return format ( float ( arg_0 . group ( 0 ) ) , arg_1 ) return ''

def Func(arg_0, arg_1='0.2g'):
    """Truncate long floats

    Args:
        matchobj (re.Match): contains original float
        format_str (str): format specifier
    Returns:
       str: returns truncated float
    """
    if arg_0.group(0):
        return format(float(arg_0.group(0)), arg_1)
    return ''


def Func ( arg_0 ) : arg_0 . cap_stdout . seek ( arg_0 . _pos ) arg_1 = arg_0 . cap_stdout . read ( ) arg_0 . _pos = arg_0 . cap_stdout . tell ( ) arg_0 . parts . append ( arg_1 ) arg_0 . text = arg_1

def Func(arg_0):
        """ Log what has been captured so far """
        arg_0.cap_stdout.seek(arg_0._pos)
        arg_1 = arg_0.cap_stdout.read()
        arg_0._pos = arg_0.cap_stdout.tell()
        arg_0.parts.append(arg_1)
        arg_0.text = arg_1


def Func(arg_0, arg_1):
    """True if the given index_points would yield a univariate marginal.

    Args:
      index_points: the set of index set locations at which to compute the
      marginal Gaussian distribution. If this set is of size 1, the marginal is
      univariate.

    Returns:
      is_univariate: Boolean indicating whether the marginal is univariate or
      multivariate. In the case of dynamic shape in the number of index points,
      defaults to "multivariate" since that's the best we can do.
    """
    arg_2 = tf.compat.dimension_value(
        arg_1.shape[-(arg_0.kernel.feature_ndims + 1)])
    if arg_2 is None:
      warnings.warn(
          'Unable to detect statically whether the number of index_points is '
          '1. As a result, defaulting to treating the marginal GP at '
          '`index_points` as a multivariate Gaussian. This makes some methods, '
          'like `cdf` unavailable.')
    return arg_2 == 1

True if the given index_points would yield a univariate marginal .


(
            self, resource_group_name, namespace_name, target_namespace, post_migration_name, custom_headers=None, raw=False, polling=True, **operation_config)

return LROPoller(self._client, raw_result, get_long_running_output, polling_method)

def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=False, arg_7=True, **arg_8):
        """Creates Migration configuration and starts migration of entities from
        Standard to Premium namespace.

        :param resource_group_name: Name of the Resource group within the
         Azure subscription.
        :type resource_group_name: str
        :param namespace_name: The namespace name
        :type namespace_name: str
        :param target_namespace: Existing premium Namespace ARM Id name which
         has no entities, will be used for migration
        :type target_namespace: str
        :param post_migration_name: Name to access Standard Namespace after
         migration
        :type post_migration_name: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: The poller return type is ClientRawResponse, the
         direct response alongside the deserialized response
        :param polling: True for ARMPolling, False for no polling, or a
         polling object for personal polling strategy
        :return: An instance of LROPoller that returns
         MigrationConfigProperties or
         ClientRawResponse<MigrationConfigProperties> if raw==True
        :rtype:
         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.servicebus.models.MigrationConfigProperties]
         or
         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.servicebus.models.MigrationConfigProperties]]
        :raises:
         :class:`ErrorResponseException<azure.mgmt.servicebus.models.ErrorResponseException>`
        """
        arg_9 = arg_0._Func_initial(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=True,
            **arg_8
        )

        def get_long_running_output(arg_10):
            arg_11 = arg_0._deserialize('MigrationConfigProperties', arg_10)

            if arg_6:
                arg_12 = ClientRawResponse(arg_11, arg_10)
                return arg_12

            return arg_11

        arg_13 = arg_8.get(
            'long_running_operation_timeout',
            arg_0.config.long_running_operation_timeout)
        if arg_7 is True: arg_14 = ARMPolling(arg_13, **arg_8)
        elif arg_7 is False: arg_14 = NoPolling()
        else: arg_14 = arg_7
        return LROPoller(arg_0._client, arg_9, get_long_running_output, arg_14)

Creates Migration configuration and starts migration of entities from Standard to Premium namespace .


def Func():
    """Validate version before release."""
    import leicacam
    arg_0 = leicacam.__version__
    arg_1 = arg_0.split('.', 3)
    try:
        for arg_2 in arg_1:
            int(arg_2)
    except ValueError:
        print(
            'Only integers are allowed in release version, '
            'please adjust current version {}'.format(arg_0))
        return None
    return arg_0


def Func ( arg_0 ) : def Func_ ( arg_1 , arg_2 = None ) : arg_3 = distributions . SeedStream ( arg_2 , 'Func' ) arg_4 = tf . random . uniform ( [ ] , arg_2 = arg_3 ( ) ) > 0.5 if arg_1 % 2 == 0 : def _exchange ( ) : arg_5 = tf . range ( arg_1 ) if arg_1 > 2 : arg_6 = tf . cast ( ~ arg_4 , dtype = tf . int32 ) arg_7 = arg_1 - arg_6 arg_5 = arg_5 [ arg_6 : arg_7 ] return tf . reshape ( arg_5 , [ tf . size ( input = arg_5 ) // 2 , 2 ] ) else : def _exchange ( ) : arg_6 = tf . cast ( arg_4 , dtype = tf . int32 ) arg_7 = arg_1 - tf . cast ( ~ arg_4 , dtype = tf . int32 ) arg_5 = tf . range ( arg_1 ) [ arg_6 : arg_7 ] return tf . reshape ( arg_5 , [ tf . size ( input = arg_5 ) // 2 , 2 ] ) def _null_exchange ( ) : return tf . reshape ( tf . cast ( [ ] , dtype = tf . int32 ) , shape = [ 0 , 2 ] ) return tf . cond ( pred = tf . random . uniform ( [ ] , arg_2 = arg_3 ( ) ) < arg_0 , true_fn = _exchange , false_fn = _null_exchange ) return Func_

def Func(arg_0):
  """Default exchange proposal function, for replica exchange MC.

  With probability `prob_exchange` propose combinations of replica for exchange.
  When exchanging, create combinations of adjacent replicas in
  [Replica Exchange Monte Carlo](
  https://en.wikipedia.org/wiki/Parallel_tempering)

  ```
  exchange_fn = Func(prob_exchange=0.5)
  exchange_proposed = exchange_fn(num_replica=3)

  exchange_proposed.eval()
  ==> [[0, 1]]  # 1 exchange, 0 <--> 1

  exchange_proposed.eval()
  ==> []  # 0 exchanges
  ```

  Args:
    prob_exchange: Scalar `Tensor` giving probability that any exchanges will
      be generated.

  Returns:
    Func_: Python callable which take a number of
      replicas (a Python integer), and return combinations of replicas for
      exchange as an [n, 2] integer `Tensor`, `0 <= n <= num_replica // 2`,
      with *unique* values in the set `{0, ..., num_replica}`.
  """

  def Func_(arg_1, arg_2=None):
    """Default function for `exchange_proposed_fn` of `kernel`."""
    arg_3 = distributions.SeedStream(arg_2, 'Func')

    arg_4 = tf.random.uniform([], arg_2=arg_3()) > 0.5
    if arg_1 % 2 == 0:

      def _exchange():
        arg_5 = tf.range(arg_1)
        if arg_1 > 2:
          arg_6 = tf.cast(~arg_4, dtype=tf.int32)
          arg_7 = arg_1 - arg_6
          arg_5 = arg_5[arg_6:arg_7]
        return tf.reshape(arg_5, [tf.size(input=arg_5) // 2, 2])
    else:

      def _exchange():
        arg_6 = tf.cast(arg_4, dtype=tf.int32)
        arg_7 = arg_1 - tf.cast(~arg_4, dtype=tf.int32)
        arg_5 = tf.range(arg_1)[arg_6:arg_7]
        return tf.reshape(arg_5, [tf.size(input=arg_5) // 2, 2])

    def _null_exchange():
      return tf.reshape(tf.cast([], dtype=tf.int32), shape=[0, 2])

    return tf.cond(
        pred=tf.random.uniform([], arg_2=arg_3()) < arg_0,
        true_fn=_exchange,
        false_fn=_null_exchange)

  return Func_

Default exchange proposal function, for replica exchange MC.

  With probability `prob_exchange` propose combinations of replica for exchange.
  When exchanging, create combinations of adjacent replicas in
  [Replica Exchange Monte Carlo](
  https://en.wikipedia.org/wiki/Parallel_tempering)

  ```
  exchange_fn = default_exchange_proposed_fn(prob_exchange=0.5)
  exchange_proposed = exchange_fn(num_replica=3)

  exchange_proposed.eval()
  ==> [[0, 1]]  # 1 exchange, 0 <--> 1

  exchange_proposed.eval()
  ==> []  # 0 exchanges
  ```

  Args:
    prob_exchange: Scalar `Tensor` giving probability that any exchanges will
      be generated.

  Returns:
    default_exchange_proposed_fn_: Python callable which take a number of
      replicas (a Python integer), and return combinations of replicas for
      exchange as an [n, 2] integer `Tensor`, `0 <= n <= num_replica // 2`,
      with *unique* values in the set `{0, ..., num_replica}`.

Default exchange proposal function for replica exchange MC .


def
Func
(
arg_0
,
arg_1
=
False
)
:
arg_2
=
arg_0
.
executor
.
Func
(
wait
=
arg_1
)
logger
.
debug
(
"Done with executor Func"
)
return
arg_2

def Func(arg_0, arg_1=False):
        """Shutdown the ThreadPool.

        Kwargs:
            - block (bool): To block for confirmations or not

        """
        arg_2 = arg_0.executor.Func(wait=arg_1)
        logger.debug("Done with executor Func")
        return arg_2


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = arg_0 . parse ( arg_1 . path ) if arg_3 is None : return arg_0 , { } elif not arg_3 : raise http . exceptions . NotFound ( ) arg_4 , arg_5 , arg_6 = arg_3 if arg_2 : arg_5 . update ( arg_2 ) if arg_4 is None : return arg_0 , arg_5 if arg_5 . get ( 'path' ) is not None : arg_1 . path = arg_5 . pop ( 'path' ) elif arg_6 is not None : arg_1 . path = arg_6 arg_3 = arg_4 . Func ( arg_1 , arg_2 = arg_5 ) return arg_3

def Func(arg_0, arg_1, arg_2=None):
        """Traverses down the path and determines the accessed resource.

        This makes use of the patterns array to implement simple traversal.
        This defaults to a no-op if there are no defined patterns.
        """
        # Attempt to parse the path using a pattern.
        arg_3 = arg_0.parse(arg_1.path)
        if arg_3 is None:
            # No parsing was requested; no-op.
            return arg_0, {}

        elif not arg_3:
            # Parsing failed; raise 404.
            raise http.exceptions.NotFound()

        # Partition out the result.
        arg_4, arg_5, arg_6 = arg_3

        if arg_2:
            # Append params to data.
            arg_5.update(arg_2)

        if arg_4 is None:
            # No traversal; return parameters.
            return arg_0, arg_5

        # Modify the path appropriately.
        if arg_5.get('path') is not None:
            arg_1.path = arg_5.pop('path')

        elif arg_6 is not None:
            arg_1.path = arg_6

        # Send us through traversal again.
        arg_3 = arg_4.Func(arg_1, arg_2=arg_5)
        return arg_3

Traverses down the path and determines the accessed resource .


def Func(arg_0):
    """
    Find the global minimum of a function represented as an interpolation object.
    """
    try:
        return arg_0.x[arg_0(arg_0.x).argmin()]
    except Exception as e:
        arg_1 = "Cannot find minimum of the interpolation object" + str(arg_0.x) + \
        "Minimal x: " + str(arg_0.x.min()) + "Maximal x: " + str(arg_0.x.max())
        raise e

Find the global minimum of a function represented as an interpolation object .


(data, adj_matrix, nb_runs=16,
                              nb_jobs=None, **kwargs)

def Func ( arg_0 , arg_1 , arg_2 = 16 , arg_3 = None , ** arg_4 ) : arg_3 = SETTINGS . get_default ( arg_3 = arg_3 ) if arg_2 == 1 : return graph_evaluation ( arg_0 , arg_1 , ** arg_4 ) else : arg_5 = Parallel ( n_jobs = arg_3 ) ( delayed ( graph_evaluation ) ( arg_0 , arg_1 , idx = run , gpu_id = run % SETTINGS . GPU , ** arg_4 ) for run in range ( arg_2 ) ) return np . mean ( arg_5 )

def Func(arg_0, arg_1, arg_2=16,
                              arg_3=None, **arg_4):
    """Parallelize the various runs of CGNN to evaluate a graph."""
    arg_3 = SETTINGS.get_default(arg_3=arg_3)
    if arg_2 == 1:
        return graph_evaluation(arg_0, arg_1, **arg_4)
    else:
        arg_5 = Parallel(n_jobs=arg_3)(delayed(graph_evaluation)(arg_0, arg_1,
                                          idx=run, gpu_id=run % SETTINGS.GPU,
                                          **arg_4) for run in range(arg_2))
        return np.mean(arg_5)

Parallelize the various runs of CGNN to evaluate a graph .


def Func(arg_0, arg_1):
        """
        Return an ImageFileField instance
        """
        if arg_0._meta.image_field:
            return getattr(arg_1, arg_0._meta.image_field)


return [x for x in enumeration if (x.value & mask) == x.value]

def Func ( arg_0 , arg_1 ) : return [ arg_2 for arg_2 in arg_0 if ( arg_2 . value & arg_1 ) == arg_2 . value ]

def Func(arg_0, arg_1):
    """
    A utility function that creates a list of enumeration values from a bit
    mask for a specific mask enumeration class.

    Args:
        enumeration (class): The enumeration class from which to draw
            enumeration values.
        mask (int): The bit mask from which to identify enumeration values.

    Returns:
        list: A list of enumeration values corresponding to the bit mask.
    """
    return [arg_2 for arg_2 in arg_0 if (arg_2.value & arg_1) == arg_2.value]

A utility function that creates a list of enumeration values from a bit mask for a specific mask enumeration class .


return {
            'objectName': self._object_name,
            'codeEvents': prof.code_events,
            'totalEvents': len(prof.code_events),
            'objectsCount': pretty_obj_count,
            'result': result,
            'timestamp': int(time.time())
        }

def Func ( arg_0 ) : arg_1 = _get_in_memory_objects ( ) arg_2 , arg_3 = arg_0 . profile ( ) arg_4 = _get_in_memory_objects ( ) arg_5 = _get_obj_count_difference ( arg_4 , arg_1 ) arg_6 = arg_5 - arg_2 . obj_overhead arg_6 [ list ] -= 1 arg_7 = _format_obj_count ( arg_6 ) return { 'objectName' : arg_0 . _object_name , 'codeEvents' : arg_2 . code_events , 'totalEvents' : len ( arg_2 . code_events ) , 'objectsCount' : arg_7 , 'result' : arg_3 , 'timestamp' : int ( time . time ( ) ) }

def Func(arg_0):
        """Collects memory stats for specified Python program."""
        arg_1 = _get_in_memory_objects()
        arg_2, arg_3 = arg_0.profile()
        arg_4 = _get_in_memory_objects()

        arg_5 = _get_obj_count_difference(arg_4, arg_1)
        arg_6 = arg_5 - arg_2.obj_overhead

        # existing_objects list is also profiler overhead
        arg_6[list] -= 1
        arg_7 = _format_obj_count(arg_6)
        return {
            'objectName': arg_0._object_name,
            'codeEvents': arg_2.code_events,
            'totalEvents': len(arg_2.code_events),
            'objectsCount': arg_7,
            'result': arg_3,
            'timestamp': int(time.time())
        }

Collects memory stats for specified Python program .


def Func(arg_0, arg_1, arg_2):
  '''
  scp and extract package
  '''
  arg_3 = []
  for arg_4 in arg_1:
    if is_self(arg_4):
      continue
    Log.info("Server: %s" % arg_4)
    arg_5 = "/tmp/heron.tar.gz"
    arg_6 = "%s:%s" % (arg_4, arg_5)

    arg_7 = "rm -rf ~/.heron && mkdir ~/.heron " \
                 "&& tar -xzvf %s -C ~/.heron --strip-components 1" % (arg_5)
    arg_8 = '%s && %s' \
          % (scp_cmd(arg_0, arg_6, arg_2),
             ssh_remote_execute(arg_7, arg_4, arg_2))
    Log.debug(arg_8)
    arg_9 = subprocess.Popen(arg_8,
                           shell=True,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE)
    arg_3.append({"pid": arg_9, "dest": arg_4})

  arg_10 = []
  for arg_11 in arg_3:
    arg_9 = arg_11["pid"]
    arg_12 = arg_9.wait()
    arg_13 = arg_9.communicate()
    Log.debug("return code: %s output: %s" % (arg_12, arg_13))
    if arg_12 != 0:
      arg_10.append("Failed to scp package to %s with error:\n%s" % (arg_11["dest"], arg_13[1]))

  if arg_10:
    for arg_14 in arg_10:
      Log.error(arg_14)
    sys.exit(-1)

  Log.info("Done distributing packages")


def Func(arg_0, arg_1, arg_2=False):
        """
        Set request parameters. Will always add the user ID if it hasn't
        been specifically set by an API method
        """
        try:
            arg_3 = quote(arg_1.format(u=arg_0.library_id, t=arg_0.library_type))
        except KeyError as err:
            raise ze.ParamNotPassed("There's a request parameter missing: %s" % err)
        # Add the URL parameters and the user key, if necessary
        if arg_2 is False:
            if not arg_0.url_params:
                arg_0.add_parameters()
            arg_3 = "%s?%s" % (arg_3, arg_0.url_params)
        return arg_3

Set request parameters . Will always add the user ID if it hasn t been specifically set by an API method


def Func ( ) : arg_0 = set ( ) for arg_1 in ifaddr . get_adapters ( ) : for arg_2 in arg_1 . ips : if arg_2 . is_IPv4 : arg_3 = arg_2 . ip if not arg_3 . startswith ( '169.254.' ) : arg_0 . add ( arg_3 ) elif arg_2 . is_IPv6 : arg_3 = arg_2 . ip [ 0 ] . split ( '%' ) [ 0 ] . lower ( ) if not arg_3 . startswith ( 'fe80:' ) : arg_0 . add ( '[{}]' . format ( arg_3 ) ) return sorted ( list ( arg_0 ) )

def Func():
    """
    Get all IP addresses.

    Returns list of addresses.
    """
    arg_0 = set()

    for arg_1 in ifaddr.get_adapters():
        for arg_2 in arg_1.ips:
            # Filter out link-local addresses.
            if arg_2.is_IPv4:
                arg_3 = arg_2.ip

                if not arg_3.startswith('169.254.'):
                    arg_0.add(arg_3)
            elif arg_2.is_IPv6:
                # Sometimes, IPv6 addresses will have the interface name
                # appended, e.g. %eth0. Handle that.
                arg_3 = arg_2.ip[0].split('%')[0].lower()

                if not arg_3.startswith('fe80:'):
                    arg_0.add('[{}]'.format(arg_3))

    return sorted(list(arg_0))


def
Func
(
arg_0
,
arg_1
=
'float32'
)
:
if
not
os
.
path
.
isfile
(
arg_0
)
:
raise
RuntimeError
(
'could not find file "%s"'
%
arg_0
)
arg_2
=
tiff
.
imread
(
arg_0
)
arg_3
=
[
]
while
True
:
arg_4
=
numpy
.
array
(
arg_2
,
arg_1
=
arg_1
)
if
arg_4
.
ndim
==
2
:
arg_4
=
arg_4
[
numpy
.
newaxis
,
...
]
arg_3
.
append
(
arg_4
)
try
:
arg_2
.
seek
(
arg_2
.
tell
(
)
+
1
)
except
EOFError
:
break
arg_3
=
numpy
.
concatenate
(
arg_3
,
axis
=
0
)
arg_3
=
numpy
.
rollaxis
(
arg_3
,
1
)
arg_3
=
numpy
.
rollaxis
(
arg_3
,
2
)
return
arg_3

def Func(arg_0, arg_1='float32'):
    """
    Load a multipage tiff into a single variable in x,y,z format.

    Arguments:
        tiff_filename:     Filename of source data
        dtype:             data type to use for the returned tensor

    Returns:
        Array containing contents from input tiff file in xyz order
    """
    if not os.path.isfile(arg_0):
        raise RuntimeError('could not find file "%s"' % arg_0)

    # load the data from multi-layer TIF files
    arg_2 = tiff.imread(arg_0)

    arg_3 = []

    while True:

        arg_4 = numpy.array(arg_2, arg_1=arg_1)
        if arg_4.ndim == 2:
            arg_4 = arg_4[numpy.newaxis, ...]  # add slice dimension
        arg_3.append(arg_4)

        try:
            arg_2.seek(arg_2.tell()+1)
        except EOFError:
            break  # this just means hit end of file (not really an error)

    arg_3 = numpy.concatenate(arg_3, axis=0)  # list of 2d -> tensor
    arg_3 = numpy.rollaxis(arg_3, 1)
    arg_3 = numpy.rollaxis(arg_3, 2)

    return arg_3

Load a multipage tiff into a single variable in x y z format .


def Func ( arg_0 ) : if arg_0 . watcher and arg_0 . watcher . is_alive ( ) : return arg_0 . watcher = Watcher ( ) arg_0 . watcher . start ( )

def Func(arg_0):
        """ Begins watching etcd for changes. """
        # Don't create a new watcher thread if we already have one running
        if arg_0.watcher and arg_0.watcher.is_alive():
            return

        # Create a new watcher thread and start it
        arg_0.watcher = Watcher()
        arg_0.watcher.start()


def Func ( arg_0 ) : arg_1 = struct . unpack ( b'>Q' , struct . pack ( b'>LL' , arg_0 . dwHighDateTime , arg_0 . dwLowDateTime ) ) [ 0 ] arg_2 = arg_1 / 10000000 return arg_2 - 11644473600

def Func(arg_0):
    """
    Windows returns times as 64-bit unsigned longs that are the number
    of hundreds of nanoseconds since Jan 1 1601. This converts it to
    a datetime object.

    :param filetime:
        A FILETIME struct object

    :return:
        An integer unix timestamp
    """

    arg_1 = struct.unpack(
        b'>Q',
        struct.pack(
            b'>LL',
            arg_0.dwHighDateTime,
            arg_0.dwLowDateTime
        )
    )[0]
    arg_2 = arg_1 / 10000000
    return arg_2 - 11644473600

Windows returns times as 64 - bit unsigned longs that are the number of hundreds of nanoseconds since Jan 1 1601 . This converts it to a datetime object .


def Func(arg_0, arg_1, arg_2=None, arg_3=False):
        """
        Generator which yields up to `count` recurrences after the given
        datetime instance, equivalent to `after`.

        :param dt:
            The datetime at which to start generating recurrences.

        :param count:
            The maximum number of recurrences to generate. If `None` (default),
            dates are generated until the recurrence rule is exhausted.

        :param inc:
            If `dt` is an instance of the rule and `inc` is `True`, it is
            included in the output.

        :yields: Yields a sequence of `datetime` objects.
        """

        if arg_0._cache_complete:
            arg_4 = arg_0._cache
        else:
            arg_4 = arg_0

        # Select the comparison function
        if arg_3:
            def comp(arg_5, arg_6): return arg_5 >= arg_6
        else:
            def comp(arg_5, arg_6): return arg_5 > arg_6

        # Generate dates
        arg_7 = 0
        for arg_8 in arg_4:
            if comp(arg_8, arg_1):
                if arg_2 is not None:
                    arg_7 += 1
                    if arg_7 > arg_2:
                        break

                yield arg_8

Generator which yields up to count recurrences after the given datetime instance equivalent to after .


def Func ( arg_0 , arg_1 ) : check_type ( arg_1 , basestring , may_be_none = False ) arg_0 . _session . Func ( API_ENDPOINT + '/' + arg_1 )

def Func(arg_0, arg_1):
        """Delete a webhook, by ID.

        Args:
            webhookId(basestring): The ID of the webhook to be Funcd.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.

        """
        check_type(arg_1, basestring, may_be_none=False)

        # API request
        arg_0._session.Func(API_ENDPOINT + '/' + arg_1)

Delete a webhook, by ID.

        Args:
            webhookId(basestring): The ID of the webhook to be deleted.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


def Func ( arg_0 , arg_1 , arg_2 = None ) : for arg_3 in arg_1 : arg_3 . update_state ( ) if arg_3 . state not in State . finished ( ) : arg_3 . set_state ( State . FAILED ) arg_2 . merge ( arg_3 )

def Func(arg_0, arg_1, arg_2=None):
        """
        Go through the dag_runs and update the state based on the task_instance state.
        Then set DAG runs that are not finished to failed.

        :param dag_runs: DAG runs
        :param session: session
        :return: None
        """
        for arg_3 in arg_1:
            arg_3.update_state()
            if arg_3.state not in State.finished():
                arg_3.set_state(State.FAILED)
            arg_2.merge(arg_3)

Go through the dag_runs and update the state based on the task_instance state . Then set DAG runs that are not finished to failed .


def Func(arg_0, **arg_1):
    """Use an event to build a one-to-many relationship on a class.

    This makes use of the :meth:`.References._reference_table` method
    to generate a full foreign key relationship from the remote table.

    """
    @declared_attr
    def o2m(arg_2):
        arg_2._references((arg_0, arg_2.__name__))
        return relationship(arg_0, **arg_1)
    return o2m

Use an event to build a one - to - many relationship on a class .


def Func(arg_0, arg_1, arg_2, arg_3=1e-9):  # pylint: disable=invalid-name
        """Express a Y.Z.Y single qubit gate as a Z.Y.Z gate.

        Solve the equation

        .. math::

        Ry(theta1).Rz(xi).Ry(theta2) = Rz(phi).Ry(theta).Rz(lambda)

        for theta, phi, and lambda.

        Return a solution theta, phi, and lambda.
        """
        arg_4 = quaternion_from_euler([arg_1, arg_0, arg_2], 'yzy')
        arg_5 = arg_4.to_zyz()
        arg_6 = quaternion_from_euler(arg_5, 'zyz')
        # output order different than rotation order
        arg_7 = (arg_5[1], arg_5[0], arg_5[2])
        arg_8 = abs(arg_6.data.dot(arg_4.data))
        if not np.allclose(arg_8, 1, arg_3):
            raise TranspilerError('YZY and ZYZ angles do not give same rotation matrix.')
        arg_7 = tuple(0 if np.abs(angle) < _CHOP_THRESHOLD else angle
                           for angle in arg_7)
        return arg_7

Express a Y . Z . Y single qubit gate as a Z . Y . Z gate .


def Func ( arg_0 , arg_1 ) : arg_2 = util . get_object ( obj = arg_0 , predefined_objects = tensorforce . agents . agents , arg_1 = arg_1 ) assert isinstance ( arg_2 , Agent ) return arg_2

def Func(arg_0, arg_1):
        """
        Creates an agent from a specification dict.
        """
        arg_2 = util.get_object(
            obj=arg_0,
            predefined_objects=tensorforce.agents.agents,
            arg_1=arg_1
        )
        assert isinstance(arg_2, Agent)
        return arg_2

Creates an agent from a specification dict .


(
    node: astroid.node_classes.NodeNG
)

def
Func
(
arg_0
:
arg_1
.
node_classes
.
NodeNG
)
->
Tuple
[
bool
,
Tuple
[
str
,
str
]
]
:
if
isinstance
(
arg_0
,
arg_1
.
AssignAttr
)
:
return
True
,
(
arg_0
.
attrname
,
"object %r"
%
(
arg_0
.
expr
.
as_string
(
)
,
)
)
if
isinstance
(
arg_0
,
arg_1
.
AssignName
)
:
arg_4
=
arg_0
.
name
if
is_builtin
(
arg_4
)
:
return
(
True
,
(
arg_4
,
"builtins"
)
)
arg_5
=
arg_0
.
lookup
(
arg_4
)
[
1
]
if
arg_5
and
not
isinstance
(
arg_5
[
0
]
.
assign_type
(
)
,
(
arg_1
.
Assign
,
arg_1
.
AugAssign
,
arg_1
.
ExceptHandler
)
,
)
:
return
True
,
(
arg_4
,
"outer scope (line %s)"
%
arg_5
[
0
]
.
fromlineno
)
return
False
,

def Func(
    arg_0: arg_1.node_classes.NodeNG
) -> Tuple[bool, Tuple[str, str]]:
    """Checks if an assignment node in an except handler clobbers an existing
    variable.

    Returns (True, args for W0623) if assignment clobbers an existing variable,
    (False, None) otherwise.
    """
    if isinstance(arg_0, arg_1.AssignAttr):
        return True, (arg_0.attrname, "object %r" % (arg_0.expr.as_string(),))
    if isinstance(arg_0, arg_1.AssignName):
        arg_4 = arg_0.name
        if is_builtin(arg_4):
            return (True, (arg_4, "builtins"))

        arg_5 = arg_0.lookup(arg_4)[1]
        if arg_5 and not isinstance(
            arg_5[0].assign_type(),
            (arg_1.Assign, arg_1.AugAssign, arg_1.ExceptHandler),
        ):
            return True, (arg_4, "outer scope (line %s)" % arg_5[0].fromlineno)
    return False, None

Checks if an assignment node in an except handler clobbers an existing variable .


(level_scale,
                                            slope_mean,
                                            slope_scale,
                                            autoregressive_coef)

return tfd.MultivariateNormalDiag(
      loc=bias,
      scale_diag=scale_diag)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = dist_util . get_broadcast_shape ( arg_0 , arg_1 , arg_2 , arg_3 ) arg_5 = tf . ones ( arg_4 , dtype = arg_0 . dtype ) arg_6 = tf . stack ( [ arg_0 * arg_5 , arg_2 * arg_5 ] , axis = - 1 ) arg_7 = tf . stack ( [ tf . zeros_like ( arg_5 ) , arg_1 * ( 1 - arg_3 ) * arg_5 ] , axis = - 1 ) return tfd . MultivariateNormalDiag ( loc = arg_7 , arg_6 = arg_6 )

def Func(arg_0,
                                            arg_1,
                                            arg_2,
                                            arg_3):
  """Build the transition noise model for a semi-local linear trend model."""

  # At each timestep, the stochasticity of `level` and `slope` are given
  # by `level_scale` and `slope_scale` respectively.
  arg_4 = dist_util.get_broadcast_shape(
      arg_0, arg_1, arg_2, arg_3)
  arg_5 = tf.ones(arg_4, dtype=arg_0.dtype)
  arg_6 = tf.stack([arg_0 * arg_5,
                         arg_2 * arg_5],
                        axis=-1)

  # We additionally fold in a bias term implementing the nonzero `slope_mean`.
  # The overall `slope` update is (from `SemiLocalLinearTrend` docstring)
  #   slope[t] = (slope_mean +
  #               autoregressive_coef * (slope[t-1] - slope_mean) +
  #               Normal(0., slope_scale))
  # which we rewrite as
  #   slope[t] = (
  #    autoregressive_coef * slope[t-1] +                  # linear transition
  #    Normal(loc=slope_mean - autoregressive_coef * slope_mean,  # noise bias
  #           scale=slope_scale))                                 # noise scale
  arg_7 = tf.stack([tf.zeros_like(arg_5),
                   arg_1 * (1 - arg_3) * arg_5],
                  axis=-1)
  return tfd.MultivariateNormalDiag(
      loc=arg_7,
      arg_6=arg_6)

Build the transition noise model for a semi - local linear trend model .


def
Func
(
arg_0
,
arg_1
)
:
arg_1
=
Operators
.
EXTRACT
(
arg_1
,
0
,
160
)
arg_2
=
arg_0
.
address
if
issymbolic
(
arg_1
)
:
logger
.
info
(
"Symbolic recipient on self destruct"
)
arg_1
=
solver
.
get_value
(
arg_0
.
constraints
,
arg_1
)
if
arg_1
not
in
arg_0
.
world
:
arg_0
.
world
.
create_account
(
arg_2
=
arg_1
)
arg_0
.
world
.
send_funds
(
arg_2
,
arg_1
,
arg_0
.
world
.
get_balance
(
arg_2
)
)
arg_0
.
world
.
delete_account
(
arg_2
)
raise
EndTx
(
'Func'
)

def Func(arg_0, arg_1):
        """Halt execution and register account for later deletion"""
        #This may create a user account
        arg_1 = Operators.EXTRACT(arg_1, 0, 160)
        arg_2 = arg_0.address
        #FIXME for on the known addresses
        if issymbolic(arg_1):
            logger.info("Symbolic recipient on self destruct")
            arg_1 = solver.get_value(arg_0.constraints, arg_1)

        if arg_1 not in arg_0.world:
            arg_0.world.create_account(arg_2=arg_1)

        arg_0.world.send_funds(arg_2, arg_1, arg_0.world.get_balance(arg_2))
        arg_0.world.delete_account(arg_2)

        raise EndTx('Func')


def Func(arg_0):
    '''Get or calculate MD5 value of the local file.'''
    if arg_0.md5 is None:
      arg_0.md5 = arg_0.file_hash(arg_0.filename)
    return arg_0.md5

Get or calculate MD5 value of the local file .


return coeff * element_mass / formula_mass

def Func(arg_0, arg_1):
    """
    Determine the mass fraction of an element in a chemical compound.

    :param compound: Formula of the chemical compound, 'FeCr2O4'.
    :param element: Element, e.g. 'Cr'.

    :returns: Element mass fraction.
    """

    arg_2 = stoichiometry_coefficient(arg_0, arg_1)

    if arg_2 == 0.0:
        return 0.0

    arg_3 = molar_mass(arg_0)
    arg_4 = molar_mass(arg_1)
    return arg_2 * arg_4 / arg_3

Determine the mass fraction of an element in a chemical compound .


def
Func
(
arg_0
=
0.3
)
:
tl
.
logging
.
info
(
"[TL]: GPU MEM Fraction %f"
%
arg_0
)
arg_1
=
tf
.
GPUOptions
(
per_process_gpu_memory_fraction
=
arg_0
)
arg_2
=
tf
.
Session
(
config
=
tf
.
ConfigProto
(
arg_1
=
arg_1
)
)
return
arg_2

def Func(arg_0=0.3):
    """Set the GPU memory fraction for the application.

    Parameters
    ----------
    gpu_fraction : float
        Fraction of GPU memory, (0 ~ 1]

    References
    ----------
    - `TensorFlow using GPU <https://www.tensorflow.org/versions/r0.9/how_tos/using_gpu/index.html>`__

    """
    tl.logging.info("[TL]: GPU MEM Fraction %f" % arg_0)
    arg_1 = tf.GPUOptions(per_process_gpu_memory_fraction=arg_0)
    arg_2 = tf.Session(config=tf.ConfigProto(arg_1=arg_1))
    return arg_2

Set the GPU memory fraction for the application .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
{
}
for
arg_4
in
(
"module"
,
"class"
,
"method"
,
"function"
)
:
try
:
arg_5
=
arg_1
[
arg_4
]
except
KeyError
:
raise
exceptions
.
EmptyReportError
(
)
arg_3
[
arg_4
]
=
{
}
if
arg_5
!=
0
:
try
:
arg_6
=
arg_5
arg_1
[
"undocumented_"
+
arg_4
]
arg_7
=
(
arg_6
*
100.0
)
/
arg_5
arg_3
[
arg_4
]
[
"percent_documented"
]
=
"%.2f"
%
arg_7
except
KeyError
:
arg_3
[
arg_4
]
[
"percent_documented"
]
=
"NC"
try
:
arg_7
=
(
arg_1
[
"badname_"
+
arg_4
]
*
100.0
)
/
arg_5
arg_3
[
arg_4
]
[
"percent_badname"
]
=
"%.2f"
%
arg_7
except
KeyError
:
arg_3
[
arg_4
]
[
"percent_badname"
]
=
"NC"
arg_8
=
(
"type"
,
"number"
,
"old number"
,
"difference"
,
"%documented"
,
"%badname"
)
for
arg_4
in
(
"module"
,
"class"
,
"method"
,
"function"
)
:
arg_9
=
arg_1
[
arg_4
]
arg_8
+=
(
arg_4
,
str
(
arg_9
)
,
"NC"
,
"NC"
,
arg_3
[
arg_4
]
.
get
(
"percent_documented"
,
"0"
)
,
arg_3
[
arg_4
]
.
get
(
"percent_badname"
,
"0"
)
,
)
arg_0
.
append
(
reporter_nodes
.
Table
(
children
=
arg_8
,
cols
=
6
,
rheaders
=
1
)
)

def Func(arg_0, arg_1, arg_2):
    """make a report of

    * percentage of different types documented
    * percentage of different types with a bad name
    """
    # percentage of different types documented and/or with a bad name
    arg_3 = {}
    for arg_4 in ("module", "class", "method", "function"):
        try:
            arg_5 = arg_1[arg_4]
        except KeyError:
            raise exceptions.EmptyReportError()
        arg_3[arg_4] = {}
        if arg_5 != 0:
            try:
                arg_6 = arg_5 - arg_1["undocumented_" + arg_4]
                arg_7 = (arg_6 * 100.0) / arg_5
                arg_3[arg_4]["percent_documented"] = "%.2f" % arg_7
            except KeyError:
                arg_3[arg_4]["percent_documented"] = "NC"
            try:
                arg_7 = (arg_1["badname_" + arg_4] * 100.0) / arg_5
                arg_3[arg_4]["percent_badname"] = "%.2f" % arg_7
            except KeyError:
                arg_3[arg_4]["percent_badname"] = "NC"
    arg_8 = ("type", "number", "old number", "difference", "%documented", "%badname")
    for arg_4 in ("module", "class", "method", "function"):
        arg_9 = arg_1[arg_4]
        arg_8 += (
            arg_4,
            str(arg_9),
            "NC",
            "NC",
            arg_3[arg_4].get("percent_documented", "0"),
            arg_3[arg_4].get("percent_badname", "0"),
        )
    arg_0.append(reporter_nodes.Table(children=arg_8, cols=6, rheaders=1))


def Func(arg_0, arg_1, arg_2=False):
        """Local repo updating suitable for asynchronous, parallel execution.
        We still need to run `ensure_local_repo` synchronously because it
        does a bunch of non-threadsafe filesystem operations."""
        arg_0.ensure_local_repo()
        arg_1.enqueue_task(arg_0.update_local_repo, arg_2=arg_2)

Local repo updating suitable for asynchronous parallel execution . We still need to run ensure_local_repo synchronously because it does a bunch of non - threadsafe filesystem operations .


def Func ( arg_0 , arg_1 , arg_2 = 'line' ) : return arg_0 . magics_manager . magics [ arg_2 ] . get ( arg_1 )

def Func(arg_0, arg_1, arg_2='line'):
        """Find and return a magic of the given type by name.

        Returns None if the magic isn't found."""
        return arg_0.magics_manager.magics[arg_2].get(arg_1)

Find and return a magic of the given type by name .


def Func ( arg_0 ) : arg_1 = [ arg_0 . chrom , arg_0 . pos , arg_0 . vcf_id , arg_0 . ref , arg_0 . alt , arg_0 . qual , arg_0 . filter , arg_0 . info , arg_0 . _format_field ( ) ] for arg_2 in arg_0 . sample_tag_values : arg_1 . append ( arg_0 . _sample_field ( arg_2 ) ) return "\t" . join ( arg_1 ) + "\n"

def Func(arg_0):
        "Returns tab-delimited, newline terminated string of VcfRecord."
        arg_1 = [arg_0.chrom, arg_0.pos, arg_0.vcf_id, arg_0.ref, arg_0.alt,
                       arg_0.qual, arg_0.filter, arg_0.info,
                       arg_0._format_field()]

        for arg_2 in arg_0.sample_tag_values:
            arg_1.append(arg_0._sample_field(arg_2))

        return "\t".join(arg_1) + "\n"

Returns tab - delimited newline terminated string of VcfRecord .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
True
)
:
arg_0
.
_debuglog
(
"Requesting URL: '"
+
arg_1
+
"'"
)
if
arg_2
:
arg_0
.
_debuglog
(
"Appending access_token (SID: "
+
arg_0
.
access_token
+
") to url"
)
arg_1
=
"%s&_sid=%s"
%
(
arg_1
,
arg_0
.
access_token
)
try
:
arg_3
=
arg_0
.
_session
.
get
(
arg_1
)
arg_0
.
_debuglog
(
"Request executed: "
+
str
(
arg_3
.
status_code
)
)
if
arg_3
.
status_code
==
200
:
arg_4
=
json
.
loads
(
arg_3
.
text
)
if
arg_4
[
"success"
]
:
arg_0
.
_debuglog
(
"Succesfull returning data"
)
arg_0
.
_debuglog
(
str
(
arg_4
)
)
return
arg_4
else
:
if
arg_4
[
"error"
]
[
"code"
]
in
{
105
,
106
,
107
,
119
}
:
arg_0
.
_debuglog
(
"Session error: "
+
str
(
arg_4
[
"error"
]
[
"code"
]
)
)
arg_0
.
_session_error
=
True
else
:
arg_0
.
_debuglog
(
"Failed: "
+
arg_3
.
text
)
else
:
return
except
:
return

def Func(arg_0, arg_1, arg_2=True):
        """Function to execute and handle a GET request"""
        # Prepare Request
        arg_0._debuglog("Requesting URL: '" + arg_1 + "'")
        if arg_2:
            arg_0._debuglog("Appending access_token (SID: " +
                           arg_0.access_token + ") to url")
            arg_1 = "%s&_sid=%s" % (
                arg_1, arg_0.access_token)

        # Execute Request
        try:
            arg_3 = arg_0._session.get(arg_1)
            arg_0._debuglog("Request executed: " + str(arg_3.status_code))
            if arg_3.status_code == 200:
                # We got a response
                arg_4 = json.loads(arg_3.text)

                if arg_4["success"]:
                    arg_0._debuglog("Succesfull returning data")
                    arg_0._debuglog(str(arg_4))
                    return arg_4
                else:
                    if arg_4["error"]["code"] in {105, 106, 107, 119}:
                        arg_0._debuglog("Session error: " +
                                       str(arg_4["error"]["code"]))
                        arg_0._session_error = True
                    else:
                        arg_0._debuglog("Failed: " + arg_3.text)
            else:
                # We got a 404 or 401
                return None
        #pylint: disable=bare-except
        except:
            return None


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """a common internal function to some window functions with 4 coeffs

    For the blackmna harris for instance, the results are identical to octave if N is odd
    but not for even values...if n =0 whatever N is, the w(0) must be equal to a0-a1+a2-a3, which
    is the case here, but not in octave..."""
    if arg_0 == 1:
        return ones(1)

    arg_5 = arange(0, arg_0)
    arg_6 = arg_0 - 1.

    arg_7 = arg_1 -arg_2*cos(2.*pi*arg_5 / arg_6) + arg_3*cos(4.*pi*arg_5 / arg_6) - arg_4*cos(6.*pi*arg_5 / arg_6)

    return arg_7


def Func(arg_0, arg_1=0):
		"""
		Set the token on the Reddit Object again
		"""
		if arg_1 >= 5:
			raise ConnectionAbortedError('Reddit is not accessible right now, cannot refresh OAuth2 tokens.')

		arg_0._check_token_present()

		try:
			arg_0.r.Func(arg_0._get_value(CONFIGKEY_SCOPE, set, split_val=","),
										  arg_0._get_value(CONFIGKEY_TOKEN),
										  arg_0._get_value(CONFIGKEY_REFRESH_TOKEN))
		except (praw.errors.OAuthInvalidToken, praw.errors.HTTPException) as e:
			# todo check e status code
			# self._log('Retrying in 5s.')
			# time.sleep(5)
			# self.Func(_retry=_retry + 1)

			arg_0._log("Request new Token (SAC)")
			arg_0._get_new_access_information()


return self.lookup_explicit(args, kwargs)(*args, **kwargs)

def Func(arg_0, arg_1, arg_2):
        '''
        Dispatch a call. Call the first function whose type signature matches
        the arguemts.
        '''
        return arg_0.lookup_explicit(arg_1, arg_2)(*arg_1, **arg_2)

Dispatch a call . Call the first function whose type signature matches the arguemts .


def Func(arg_0, arg_1):
    """Compute the mean value of an diagonal observable.

    Takes in a diagonal observable in dictionary, list or matrix format and then
    calculates the sum_i value(i) P(i) where value(i) is the value of the
    observable for state i.

    Args:
        counts (dict): a dict of outcomes from an experiment
        observable (dict or matrix or list): The observable to be averaged over.
        As an example, ZZ on qubits can be given as:
        * dict: {"00": 1, "11": 1, "01": -1, "10": -1}
        * matrix: [[1, 0, 0, 0], [0, -1, 0, 0, ], [0, 0, -1, 0], [0, 0, 0, 1]]
        * matrix diagonal (list): [1, -1, -1, 1]

    Returns:
        Double: Average of the observable
    """
    if not isinstance(arg_1, dict):
        arg_1 = make_dict_observable(arg_1)
    arg_2 = 0
    arg_3 = sum(arg_0.values())
    for arg_4 in arg_0:
        if arg_4 in arg_1:
            arg_2 += arg_0[arg_4] * arg_1[arg_4] / arg_3
    return arg_2

Compute the mean value of an diagonal observable .


def Func ( arg_0 , arg_1 ) : arg_1 . update ( { 'parslepy' : arg_0 . LOCAL_NAMESPACE , 'parsley' : arg_0 . LOCAL_NAMESPACE , } ) return arg_1

def Func(arg_0, arg_1):
        """
        Extend XPath evaluation with Parsley extensions' namespace
        """

        arg_1.update({
            'parslepy' : arg_0.LOCAL_NAMESPACE,
            'parsley' : arg_0.LOCAL_NAMESPACE,
        })
        return arg_1

Extend XPath evaluation with Parsley extensions namespace


def Func ( arg_0 , arg_1 ) : import numpy as np arg_2 = [ ] arg_3 = len ( arg_0 ) for arg_4 in range ( 0 , arg_3 - 1 ) : arg_5 = 1. / ( arg_3 - arg_4 ) * np . sum ( arg_0 [ arg_4 + 1 : ] ) arg_6 = np . prod ( arg_0 [ arg_4 + 1 : ] ** ( 1. / ( arg_3 - arg_4 ) ) ) arg_2 . append ( - ( arg_3 - arg_4 ) * arg_1 * np . log ( arg_6 / arg_5 ) + 0.5 * arg_4 * ( 2. * arg_3 - arg_4 ) * np . log ( arg_1 ) ) return arg_2

def Func(arg_0, arg_1):
    r"""MDL order-selection using eigen values

    :param s: a list of `p` sorted eigen values
    :param N: the size of the input data. To be defined precisely.

    :return:
        * an array containing the AIC values

    .. math:: MDL(k) = (n-k)N \ln \frac{g(k)}{a(k)} + 0.5k(2n-k) log(N)

    .. seealso:: :func:`aic_eigen` for details

    :References:
        * [Marple]_ Chap 13,
        * [Wax]_
    """
    import numpy as np
    arg_2 = []
    arg_3 = len(arg_0)
    for arg_4 in range(0, arg_3-1):
        arg_5 = 1./(arg_3-arg_4) * np.sum(arg_0[arg_4+1:])
        arg_6 = np.prod(arg_0[arg_4+1:]**(1./(arg_3-arg_4)))
        arg_2.append( -(arg_3-arg_4)*arg_1 * np.log(arg_6/arg_5) + 0.5*arg_4*(2.*arg_3-arg_4)*np.log(arg_1))
    return arg_2

r MDL order - selection using eigen values


def
Func
(
arg_0
,
arg_1
)
:
try
:
arg_2
=
arg_1
.
get
(
escape_for_ini
(
'keyring-setting'
)
,
escape_for_ini
(
'scheme'
)
,
)
except
(
configparser
.
NoSectionError
,
configparser
.
NoOptionError
)
:
raise
AttributeError
(
"Encryption scheme missing"
)
arg_3
=
arg_2
[
3
:
]
if
arg_3
not
in
arg_0
.
_get_mode
(
)
:
raise
ValueError
(
"Encryption scheme invalid: %s"
%
(
arg_3
)
)
arg_0
.
aesmode
=
arg_3
if
arg_2
.
startswith
(
'PyCryptodome '
)
:
arg_2
=
arg_2
[
13
:
]
if
arg_2
!=
arg_0
.
scheme
:
raise
ValueError
(
"Encryption scheme mismatch "
"(exp.: %s, found: %s)"
%
(
arg_0
.
scheme
,
arg_2
)
)

def Func(arg_0, arg_1):
        """
        check for a valid scheme

        raise AttributeError if missing
        raise ValueError if not valid
        """
        try:
            arg_2 = arg_1.get(
                escape_for_ini('keyring-setting'),
                escape_for_ini('scheme'),
            )
        except (configparser.NoSectionError, configparser.NoOptionError):
            raise AttributeError("Encryption scheme missing")

        # extract AES mode
        arg_3 = arg_2[-3:]
        if arg_3 not in arg_0._get_mode():
            raise ValueError("Encryption scheme invalid: %s" % (arg_3))

        # setup AES mode
        arg_0.aesmode = arg_3

        # remove pointless crypto module name
        if arg_2.startswith('PyCryptodome '):
            arg_2 = arg_2[13:]

        # check other scheme properties
        if arg_2 != arg_0.scheme:
            raise ValueError("Encryption scheme mismatch "
                             "(exp.: %s, found: %s)" % (arg_0.scheme, arg_2))


(shape, rand=rand.uniform(-10, 10), **kwargs)

def Func(arg_0, arg_1=arg_1.uniform(-10, 10), **arg_3):
    """ random blending masks """
    # batch, channel = shape[0], shape[3]
    arg_4 = arg_1(arg_0[0])  # seed
    arg_5 = snoise2dz((arg_0[1], arg_0[2]), arg_4, **arg_3)

    return arg_5


def Func ( arg_0 , arg_1 ) : arg_2 = serializer ( 'json' ) . loads ( arg_1 [ 'kvs.perlsess' ] ) arg_2 . setdefault ( 'key_prefix' , 'perlsess::' ) arg_2 . setdefault ( 'codec' , 'storable' ) arg_0 . cookie_name = arg_2 . pop ( 'cookie_name' , 'session_id' ) arg_0 . client = KVS ( ** arg_2 )

def Func(arg_0, arg_1):
        """ Call that method in the pyramid configuration phase.
        """
        arg_2 = serializer('json').loads(arg_1['kvs.perlsess'])
        arg_2.setdefault('key_prefix', 'perlsess::')
        arg_2.setdefault('codec', 'storable')
        arg_0.cookie_name = arg_2.pop('cookie_name', 'session_id')
        arg_0.client = KVS(**arg_2)

Call that method in the pyramid configuration phase .


return requests.delete(url,
                               headers={
                                   'Authorization': 'Token {}'.format(token)},
                               verify=False,)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
''
)
:
if
(
arg_2
==
''
)
:
arg_2
=
arg_0
.
_user_token
return
requests
.
delete
(
arg_1
,
headers
=
{
'Authorization'
:
'Token {}'
.
format
(
arg_2
)
}
,
verify
=
False
,
)

def Func(arg_0, arg_1, arg_2=''):
        """
        Returns a delete resquest object taking in a url and user token.

        Arguments:
            url (str): The url to make post to
            token (str): The authentication token

        Returns:
            obj: Delete request object
        """
        if (arg_2 == ''):
            arg_2 = arg_0._user_token

        return requests.delete(arg_1,
                               headers={
                                   'Authorization': 'Token {}'.format(arg_2)},
                               verify=False,)

Returns a delete resquest object taking in a url and user token .


return self.get_client().get_operation(project_id=project_id or self.project_id,
                                               zone=self.location,
                                               operation_id=operation_name)

def Func ( arg_0 , arg_1 , arg_2 = None ) : return arg_0 . get_client ( ) . Func ( arg_2 = arg_2 or arg_0 . project_id , zone = arg_0 . location , operation_id = arg_1 )

def Func(arg_0, arg_1, arg_2=None):
        """
        Fetches the operation from Google Cloud

        :param operation_name: Name of operation to fetch
        :type operation_name: str
        :param project_id: Google Cloud Platform project ID
        :type project_id: str
        :return: The new, updated operation from Google Cloud
        """
        return arg_0.get_client().Func(arg_2=arg_2 or arg_0.project_id,
                                               zone=arg_0.location,
                                               operation_id=arg_1)


(initial_population,
                             initial_position,
                             population_size,
                             population_stddev,
                             seed)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : if arg_0 is not None : return [ tf . convert_to_tensor ( value = arg_5 ) for arg_5 in arg_0 ] arg_6 = distributions . SeedStream ( arg_4 , salt = 'get_starting_population' ) arg_7 = [ ] for arg_5 in arg_1 : arg_5 = tf . convert_to_tensor ( value = arg_5 ) arg_8 = tf . shape ( input = arg_5 ) arg_9 = tf . concat ( [ [ arg_2 - 1 ] , arg_8 ] , axis = 0 ) arg_10 = tf . random . normal ( arg_9 , stddev = arg_3 , dtype = arg_5 . dtype . base_dtype , arg_4 = arg_6 ( ) ) arg_10 += arg_5 arg_10 = tf . concat ( [ [ arg_5 ] , arg_10 ] , axis = 0 ) arg_7 . append ( arg_10 ) return arg_7

def Func(arg_0,
                             arg_1,
                             arg_2,
                             arg_3,
                             arg_4):
  """Constructs the initial population.

  If an initial population is not already provided, this function constructs
  a population by adding random normal noise to the initial position.

  Args:
    initial_population: None or a list of `Tensor`s. The initial population.
    initial_position: None or a list of `Tensor`s. The initial position.
      If initial_population is None, this argument must not be None.
    population_size: Scalar integer `Tensor`. The number of members in the
      population. If the initial population is not None, this parameter is
      ignored.
    population_stddev: A positive scalar real `Tensor` of the same dtype
      as `initial_position` or `initial_population` (whichever is not None).
      This parameter is ignored if `initial_population`
      is specified. Used to generate the population from the
      `initial_position` by adding random normal noise with zero mean and
      the specified standard deviation.
    seed: Seed for random number generation.

  Returns:
    A list of `Tensor`s. The initial population.
  """
  if arg_0 is not None:
    return [tf.convert_to_tensor(value=arg_5) for arg_5 in arg_0]
  # Constructs the population by adding normal noise to the initial position.
  arg_6 = distributions.SeedStream(arg_4, salt='get_starting_population')
  arg_7 = []
  for arg_5 in arg_1:
    arg_5 = tf.convert_to_tensor(value=arg_5)
    arg_8 = tf.shape(input=arg_5)
    # We only draw population_size-1 random vectors because we want to ensure
    # that the supplied position is part of the population. The first member
    # is set to be the initial_position.
    arg_9 = tf.concat([[arg_2-1],
                                       arg_8], axis=0)
    arg_10 = tf.random.normal(arg_9,
                                       stddev=arg_3,
                                       dtype=arg_5.dtype.base_dtype,
                                       arg_4=arg_6())
    arg_10 += arg_5
    arg_10 = tf.concat([[arg_5], arg_10], axis=0)
    arg_7.append(arg_10)
  return arg_7


def Func(arg_0, arg_1):
        """Contruct a date from a proleptic Gregorian ordinal.

        January 1 of year 1 is day 1.  Only the year, month and day are
        non-zero in the result.
        """
        arg_2, arg_3, arg_4 = _ord2ymd(arg_1)
        return arg_0(arg_2, arg_3, arg_4)

Contruct a date from a proleptic Gregorian ordinal .


def
Func
(
arg_0
)
:
arg_1
=
BackendCommandArgumentParser
(
arg_0
.
BACKEND
.
CATEGORIES
,
from_date
=
True
,
token_auth
=
True
)
arg_2
=
arg_1
.
parser
.
_option_string_actions
[
'--api-token'
]
arg_2
.
required
=
True
arg_4
=
arg_1
.
parser
.
add_argument_group
(
'Groupsio arguments'
)
arg_4
.
add_argument
(
'--mboxes-path'
,
dest
=
'mboxes_path'
,
help
=
"Path where mbox files will be stored"
)
arg_4
.
add_argument
(
'--no-verify'
,
dest
=
'verify'
,
arg_2
=
'store_false'
,
help
=
"Value 'True' enable SSL verification"
)
arg_1
.
parser
.
add_argument
(
'group_name'
,
help
=
"Name of the group on Groups.io"
)
return
arg_1

def Func(arg_0):
        """Returns the Groupsio argument parser."""

        arg_1 = BackendCommandArgumentParser(arg_0.BACKEND.CATEGORIES,
                                              from_date=True,
                                              token_auth=True)

        # Backend token is required
        arg_2 = arg_1.parser._option_string_actions['--api-token']
        arg_2.required = True

        # Optional arguments
        arg_4 = arg_1.parser.add_argument_group('Groupsio arguments')
        arg_4.add_argument('--mboxes-path', dest='mboxes_path',
                           help="Path where mbox files will be stored")
        arg_4.add_argument('--no-verify', dest='verify',
                           arg_2='store_false',
                           help="Value 'True' enable SSL verification")

        # Required arguments
        arg_1.parser.add_argument('group_name',
                                   help="Name of the group on Groups.io")

        return arg_1


def
Func
(
arg_0
,
arg_1
)
:
if
not
arg_0
:
return
arg_2
=
ec2_connect
(
arg_1
)
log
(
"Stopping instances {0}."
.
format
(
arg_0
)
)
arg_2
.
Func
(
arg_0
)
log
(
"Done"
)

def Func(arg_0, arg_1):
    '''stop all the instances given by its ids'''
    if not arg_0: return
    arg_2 = ec2_connect(arg_1)
    log("Stopping instances {0}.".format(arg_0))
    arg_2.Func(arg_0)
    log("Done")


def Func(arg_0, arg_1, arg_2=None):
        """
        Receives a message as msgpack-numpy encoded byte-string from the given socket object.
        Blocks until something was received.

        Args:
            socket_: The python socket object to use.
            encoding (str): The encoding to use for unpacking messages from the socket.
        Returns: The decoded (as dict) message received.
        """
        arg_3 = msgpack.Unpacker(arg_2=arg_2)

        # Wait for an immediate response.
        arg_4 = arg_1.Func(8)  # get the length of the message
        if arg_4 == b"":
            raise TensorForceError("No data received by socket.Func in call to method `Func` " +
                                   "(listener possibly closed)!")
        arg_5 = int(arg_4)
        arg_6 = 0
        while True:
            arg_7 = arg_1.Func(min(arg_5 - arg_6, arg_0.max_msg_len))
            # There must be a response.
            if not arg_7:
                raise TensorForceError("No data of len {} received by socket.Func in call to method `Func`!".
                                       format(arg_5 - arg_6))
            arg_8 = len(arg_7)
            arg_6 += arg_8
            arg_3.feed(arg_7)

            if arg_6 == arg_5:
                break

        # Get the data.
        for arg_9 in arg_3:
            arg_10 = arg_9.get("status", arg_9.get(b"status"))
            if arg_10:
                if arg_10 == "ok" or arg_10 == b"ok":
                    return arg_9
                else:
                    raise TensorForceError("RemoteEnvironment server error: {}".
                                           format(arg_9.get("message", "not specified")))
            else:
                raise TensorForceError("Message without field 'status' received!")
        raise TensorForceError("No message encoded in data stream (data stream had len={})".
                               format(arg_5))

Receives a message as msgpack - numpy encoded byte - string from the given socket object . Blocks until something was received .


def Func():
    """
    Parses command line args using argparse library
    """
    arg_0 = "Usage: create_concordance <infile> [<outfile>]"
    arg_1 = "Simple Concordance Generator"
    arg_2 = argparse.ArgumentParser(
        arg_0=arg_0, arg_1=arg_1)

    arg_2.add_argument(
        'infile', type=argparse.FileType('r'),
        help="File read in to create concordance")

    arg_2.add_argument(
        'outfile', nargs='?', type=argparse.FileType('w'),
        default=sys.stdout, help="File to write concordance to.  "
        "Default is stdout")

    arg_2.add_argument(
        '--word', nargs="?", const=str, help="Display a word in concordance")
    arg_3 = arg_2.Func()
    return arg_3


(verbose,  # pylint:disable=redefined-builtin
        host,
        http_port,
        ws_port,
        use_https,
        verify_ssl)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
)
:
arg_6
=
GlobalConfigManager
.
get_config_or_default
(
)
if
arg_0
is
not
:
arg_6
.
verbose
=
arg_0
if
arg_1
is
not
:
arg_6
.
host
=
arg_1
if
arg_2
is
not
:
arg_6
.
http_port
=
arg_2
if
arg_3
is
not
:
arg_6
.
ws_port
=
arg_3
if
arg_4
is
not
:
arg_6
.
use_https
=
arg_4
if
arg_5
is
False
:
arg_6
.
verify_ssl
=
arg_5
GlobalConfigManager
.
Func_config
(
arg_6
)
Printer
.
print_success
(
'Config was updated.'
)
CliConfigManager
.
purge
(
)

def Func(arg_0,  # pylint:disable=redefined-builtin
        arg_1,
        arg_2,
        arg_3,
        arg_4,
        arg_5):
    """Set the global config values.

    Example:

    \b
    ```bash
    $ polyaxon config Func --hots=localhost http_port=80
    ```
    """
    arg_6 = GlobalConfigManager.get_config_or_default()

    if arg_0 is not None:
        arg_6.verbose = arg_0

    if arg_1 is not None:
        arg_6.host = arg_1

    if arg_2 is not None:
        arg_6.http_port = arg_2

    if arg_3 is not None:
        arg_6.ws_port = arg_3

    if arg_4 is not None:
        arg_6.use_https = arg_4

    if arg_5 is False:
        arg_6.verify_ssl = arg_5

    GlobalConfigManager.Func_config(arg_6)
    Printer.print_success('Config was updated.')
    # ReFunc cli config
    CliConfigManager.purge()

Set the global config values.

    Example:

    \b
    ```bash
    $ polyaxon config set --hots=localhost http_port=80
    ```


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = Struct ( arg_0 . _ofind ( arg_1 , arg_2 ) ) return Struct ( arg_0 . _ofind_property ( arg_1 , arg_3 ) )

def Func(arg_0, arg_1, arg_2=None):
        """Find an object and return a struct with info about it."""
        arg_3 = Struct(arg_0._ofind(arg_1, arg_2))
        return Struct(arg_0._ofind_property(arg_1, arg_3))

Find an object and return a struct with info about it .


def Func ( arg_0 ) : while isinstance ( arg_0 , Param ) : arg_0 = arg_0 . get ( ) if isinstance ( arg_0 , RtlSignalBase ) : return arg_0 . staticEval ( ) return toHVal ( arg_0 )

def Func(arg_0):
    """
    Get value of parameter
    """
    while isinstance(arg_0, Param):
        arg_0 = arg_0.get()

    if isinstance(arg_0, RtlSignalBase):
        return arg_0.staticEval()
        # use rather param inheritance instead of param as param value
    return toHVal(arg_0)


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] def dir_callback ( arg_3 ) : arg_2 . append ( arg_3 . split ( ) [ 4 ] ) arg_0 . _ftp . dir ( arg_1 , dir_callback ) return arg_2 [ 0 ]

def Func(arg_0, arg_1):
        """ Returns the filesize of a file

        :param filename: the full path to the file on the server.
        :type filename: string

        :returns: string representation of the filesize.
        """
        arg_2 = []

        def dir_callback(arg_3):
            arg_2.append(arg_3.split()[4])

        arg_0._ftp.dir(arg_1, dir_callback)
        return arg_2[0]


def
Func
(
arg_0
,
arg_1
=
)
:
arg_0
.
log
.
debug
(
"Application.Func: {args_list}"
.
format
(
**
locals
(
)
)
)
arg_2
=
try
:
arg_2
=
arg_0
.
_Func
(
arg_1
=
arg_1
)
except
KeyboardInterrupt
:
arg_0
.
log
.
verbose
(
"Interrupted"
)
except
SystemExit
as
exit
:
arg_0
.
log
.
verbose
(
"Exited"
)
arg_2
=
exit
.
code
except
Exception
:
print
(
"Uncaught exception"
,
file
=
sys
.
stderr
)
traceback
.
print_exc
(
)
if
"debug_pdb"
in
arg_0
.
args
and
arg_0
.
args
.
debug_pdb
:
debugger
(
)
arg_2
=
Application
.
UNCAUGHT_EXCEPTION_EXIT
raise
finally
:
try
:
arg_0
.
_atexit
(
)
finally
:
sys
.
stderr
.
flush
(
)
sys
.
stdout
.
flush
(
)
sys
.
exit
(
arg_2
)

def Func(arg_0, arg_1=None):
        """Run Application.main and exits with the return value."""
        arg_0.log.debug("Application.Func: {args_list}".format(**locals()))
        arg_2 = None
        try:
            arg_2 = arg_0._Func(arg_1=arg_1)
        except KeyboardInterrupt:
            arg_0.log.verbose("Interrupted")                    # pragma: nocover
        except SystemExit as exit:
            arg_0.log.verbose("Exited")
            arg_2 = exit.code
        except Exception:
            print("Uncaught exception", file=sys.stderr)
            traceback.print_exc()
            if "debug_pdb" in arg_0.args and arg_0.args.debug_pdb:
                debugger()
            arg_2 = Application.UNCAUGHT_EXCEPTION_EXIT
            raise
        finally:
            try:
                arg_0._atexit()
            finally:
                sys.stderr.flush()
                sys.stdout.flush()
                sys.exit(arg_2)

Run Application . main and exits with the return value .


(value_and_gradients_function,
                  initial_step_size,
                  val_initial,
                  val_0,
                  approximate_wolfe_threshold)

return val_0, val_initial, f_lim, tf.convert_to_tensor(value=eval_count)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : arg_5 = 0 if arg_2 is None : if arg_1 is not None : arg_1 = tf . convert_to_tensor ( value = arg_1 ) else : arg_1 = tf . convert_to_tensor ( value = 1.0 , dtype = tf . float32 ) arg_2 = arg_0 ( arg_1 ) arg_5 += 1 if arg_3 is None : arg_6 = tf . zeros_like ( arg_2 . x ) arg_3 = arg_0 ( arg_6 ) arg_5 += 1 arg_7 = arg_3 . f + ( arg_4 * tf . abs ( arg_3 . f ) ) return arg_3 , arg_2 , arg_7 , tf . convert_to_tensor ( value = arg_5 )

def Func(arg_0,
                  arg_1,
                  arg_2,
                  arg_3,
                  arg_4):
  """Prepares the arguments for the line search initialization.

  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: 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.
    val_initial: 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 not None the value of
      `initial_step_size` will be ignored, otherwise the tuple will be computed
      by evaluating value_and_gradients_function.
    val_0: 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 None
      the tuple will be computed by evaluating value_and_gradients_function.
    approximate_wolfe_threshold: 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.

  Returns:
    left: A namedtuple, as returned by value_and_gradients_function,
      containing the value and derivative of the function at `0.`.
    val_initial: A namedtuple, as returned by value_and_gradients_function,
      containing the value and derivative of the function at
      `initial_step_size`.
    f_lim: Real `Tensor` of shape [n]. The function value threshold for
      the approximate Wolfe conditions to be checked.
    eval_count: Scalar int32 `Tensor`. The number of target function
      evaluations made by this function.
  """
  arg_5 = 0
  if arg_2 is None:
    if arg_1 is not None:
      arg_1 = tf.convert_to_tensor(value=arg_1)
    else:
      arg_1 = tf.convert_to_tensor(value=1.0, dtype=tf.float32)
    arg_2 = arg_0(arg_1)
    arg_5 += 1

  if arg_3 is None:
    arg_6 = tf.zeros_like(arg_2.x)
    arg_3 = arg_0(arg_6)
    arg_5 += 1

  arg_7 = arg_3.f + (arg_4 * tf.abs(arg_3.f))
  return arg_3, arg_2, arg_7, tf.convert_to_tensor(value=arg_5)

Prepares the arguments for the line search initialization .


def Func(arg_0, arg_1):
        """Pretty print the given object."""
        arg_2 = id(arg_1)
        arg_3 = arg_2 in arg_0.stack
        arg_0.stack.append(arg_2)
        arg_0.begin_group()
        try:
            arg_4 = getattr(arg_1, '__class__', None) or type(arg_1)
            # First try to find registered singleton printers for the type.
            try:
                arg_5 = arg_0.singleton_pprinters[arg_2]
            except (TypeError, KeyError):
                pass
            else:
                return arg_5(arg_1, arg_0, arg_3)
            # Next walk the mro and check for either:
            #   1) a registered printer
            #   2) a _repr_Func_ method
            for arg_6 in _get_mro(arg_4):
                if arg_6 in arg_0.type_pprinters:
                    # printer registered in self.type_pprinters
                    return arg_0.type_pprinters[arg_6](arg_1, arg_0, arg_3)
                else:
                    # deferred printer
                    arg_5 = arg_0._in_deferred_types(arg_6)
                    if arg_5 is not None:
                        return arg_5(arg_1, arg_0, arg_3)
                    else:
                        # Finally look for special method names.
                        # Some objects automatically create any requested
                        # attribute. Try to ignore most of them by checking for
                        # callability.
                        if '_repr_Func_' in arg_4.__dict__:
                            arg_7 = arg_4._repr_Func_
                            if callable(arg_7):
                                return arg_7(arg_1, arg_0, arg_3)
            return _default_pprint(arg_1, arg_0, arg_3)
        finally:
            arg_0.end_group()
            arg_0.stack.pop()


(
        self, name, service_name, deployment_name, virtual_ip_name=None
    )

return self._perform_post(
            self._get_reserved_ip_path_for_association(name),
            _XmlSerializer.associate_reserved_ip_to_xml(
                service_name, deployment_name, virtual_ip_name
            ),
            as_async=True,
            x_ms_version='2015-02-01'
        )

def Func(
        arg_0, arg_1, arg_2, arg_3, arg_4=None
    ):
        '''
        Associate an existing reservedIP to a deployment.

        name:
            Required. Name of the reserved IP address.

        service_name:
            Required. Name of the hosted service.

        deployment_name:
            Required. Name of the deployment.

        virtual_ip_name:
            Optional. Name of the VirtualIP in case of multi Vip tenant.
            If this value is not specified default virtualIP is used
            for this operation.
        '''
        _validate_not_none('name', arg_1)
        _validate_not_none('service_name', arg_2)
        _validate_not_none('deployment_name', arg_3)
        return arg_0._perform_post(
            arg_0._get_reserved_ip_path_for_association(arg_1),
            _XmlSerializer.associate_reserved_ip_to_xml(
                arg_2, arg_3, arg_4
            ),
            as_async=True,
            x_ms_version='2015-02-01'
        )

Associate an existing reservedIP to a deployment .


def
Func
(
arg_0
,
arg_1
=
20
)
:
arg_2
=
if
isinstance
(
arg_0
,
str
)
:
arg_3
=
[
]
for
arg_4
in
json_iter
(
arg_0
)
:
arg_5
=
RankedLexeme
(
**
arg_4
)
arg_3
.
append
(
arg_5
)
else
:
arg_3
=
arg_0
if
len
(
arg_3
)
>
0
:
arg_2
=
statistics
.
mean
(
[
arg_5
.
rank
for
arg_5
in
arg_3
]
)
else
:
arg_2
=
0
arg_6
=
0
for
arg_5
in
arg_3
:
if
arg_5
.
pos
[
0
]
!=
"v"
:
if
(
arg_6
>
arg_1
)
or
(
arg_5
.
rank
<
arg_2
)
:
return
arg_6
+=
1
yield
arg_5
.
text
.
replace
(
" - "
,
"-"
)

def Func (arg_0, arg_1=20):
    """
    iterator for the most significant key phrases
    """
    arg_2 = None

    if isinstance(arg_0, str):
        arg_3 = []

        for arg_4 in json_iter(arg_0):
            arg_5 = RankedLexeme(**arg_4)
            arg_3.append(arg_5)
    else:
        arg_3 = arg_0

    if len(arg_3) > 0:
        arg_2 = statistics.mean([arg_5.rank for arg_5 in arg_3])
    else:
            arg_2 = 0

    arg_6 = 0

    for arg_5 in arg_3:
        if arg_5.pos[0] != "v":
            if (arg_6 > arg_1) or (arg_5.rank < arg_2):
                return

            arg_6 += 1
            yield arg_5.text.replace(" - ", "-")


def Func ( arg_0 , arg_1 ) : arg_0 . widget . clear ( ) arg_2 = etree . HTML ( arg_1 ) arg_0 . widget . extend ( arg_2 [ 0 ] ) super ( RawComponent , arg_0 ) . init_widget ( )

def Func(arg_0, arg_1):
        """ Set the source by parsing the source and inserting it into the
        component.
        """
        arg_0.widget.clear()
        arg_2 = etree.HTML(arg_1)
        arg_0.widget.extend(arg_2[0])

        # Clear removes everything so it must be reinitialized
        super(RawComponent, arg_0).init_widget()

Set the source by parsing the source and inserting it into the component .


(self, fd=None, buf=None, skip_header=None)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):
        """Reads FLV tags from fd or buf and returns them with adjusted
           timestamps."""
        arg_4 = dict(arg_0.timestamps_add)
        arg_5 = arg_0.iter_tags(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)

        if not arg_0.flv_header_written:
            arg_6 = arg_0.analyze_tags(arg_5)
        else:
            arg_6 = []

        for arg_7 in chain(arg_6, arg_5):
            if not arg_0.flv_header_written:
                arg_8 = Header(has_video=arg_0.has_video,
                                    has_audio=arg_0.has_audio)
                yield arg_8.serialize()
                arg_0.flv_header_written = True

            if arg_0.verify_tag(arg_7):
                arg_0.adjust_tag_gap(arg_7)
                arg_0.adjust_tag_timestamp(arg_7)

                if arg_0.duration:
                    arg_10 = arg_7.timestamp / 1000
                    if arg_10 > arg_0.duration:
                        break
                yield arg_7.serialize()
                arg_4[arg_7.type] = arg_7.timestamp

        if not arg_0.flatten_timestamps:
            arg_0.timestamps_add = arg_4

        arg_0.tags = []

Reads FLV tags from fd or buf and returns them with adjusted timestamps .


def Func(arg_0):
    """
    Writes the contents of this model's in-memory prediction cache to a permanent
    store via the prediction output stream instance
    """

    if not arg_0.__predictionCache:
      return

    # Create an output store, if one doesn't exist already
    if arg_0._predictionLogger is None:
      arg_0._createPredictionLogger()

    arg_1 = time.time()
    arg_0._predictionLogger.writeRecords(arg_0.__predictionCache,
                                        progressCB=arg_0.__writeRecordsCallback)
    arg_0._logger.info("Flushed prediction cache; numrows=%s; elapsed=%s sec.",
                      len(arg_0.__predictionCache), time.time() - arg_1)
    arg_0.__predictionCache.clear()

Writes the contents of this model s in - memory prediction cache to a permanent store via the prediction output stream instance


def Func(arg_0, arg_1, arg_2):
    """Build an array of timestamps joining the arrays in `ph_times_list`.
    `time_block` is the duration of each array of timestamps.
    """
    arg_3 = np.arange(len(arg_0)) * arg_2
    arg_4 = np.cumsum([arg_9.size for arg_9 in arg_0])
    arg_5 = np.zeros(arg_4[-1])
    arg_6 = np.zeros(arg_4[-1], dtype='uint8')
    arg_7 = 0
    for arg_8, arg_9, arg_10, arg_11 in zip(arg_4, arg_0, arg_1,
                                      arg_3):
        arg_5[arg_7:arg_8] = arg_9 + arg_11
        arg_6[arg_7:arg_8] = arg_10
        arg_7 = arg_8
    return arg_5, arg_6

Build an array of timestamps joining the arrays in ph_times_list . time_block is the duration of each array of timestamps .


def Func ( arg_0 ) : def m ( arg_1 = None , arg_2 = None , arg_3 = True ) : return sample ( arg_0 . model , arg_1 = arg_1 , arg_2 = arg_2 , arg_3 = arg_3 ) . copy ( ) def r ( arg_1 = None , arg_2 = None , arg_3 = True ) : return sample ( arg_0 . residuals , arg_1 = arg_1 , arg_2 = arg_2 , arg_3 = arg_3 ) . copy ( ) def l ( ) : return arg_0 . loglikelihood def r_e ( ** arg_4 ) : return r ( ** arg_4 ) , np . copy ( arg_0 . error ) def m_e ( ** arg_4 ) : return m ( ** arg_4 ) , np . copy ( arg_0 . error ) arg_0 . fisherinformation = partial ( arg_0 . _jtj , funct = m ) arg_0 . gradloglikelihood = partial ( arg_0 . _grad , funct = l ) arg_0 . hessloglikelihood = partial ( arg_0 . _hess , funct = l ) arg_0 . gradmodel = partial ( arg_0 . _grad , funct = m ) arg_0 . hessmodel = partial ( arg_0 . _hess , funct = m ) arg_0 . JTJ = partial ( arg_0 . _jtj , funct = r ) arg_0 . J = partial ( arg_0 . _grad , funct = r ) arg_0 . J_e = partial ( arg_0 . _grad , funct = r_e , nout = 2 ) arg_0 . gradmodel_e = partial ( arg_0 . _grad , funct = m_e , nout = 2 ) arg_0 . fisherinformation . __doc__ = _graddoc + _sampledoc arg_0 . gradloglikelihood . __doc__ = _graddoc arg_0 . hessloglikelihood . __doc__ = _graddoc arg_0 . gradmodel . __doc__ = _graddoc + _sampledoc arg_0 . hessmodel . __doc__ = _graddoc + _sampledoc arg_0 . JTJ . __doc__ = _graddoc + _sampledoc arg_0 . J . __doc__ = _graddoc + _sampledoc arg_0 . _dograddoc ( arg_0 . _grad_one_param ) arg_0 . _dograddoc ( arg_0 . _hess_two_param ) arg_0 . _dograddoc ( arg_0 . _grad ) arg_0 . _dograddoc ( arg_0 . _hess ) class _Statewrap ( object ) : def __init__ ( arg_0 , arg_15 ) : arg_0 . obj = arg_15 def __getitem__ ( arg_0 , arg_16 = None ) : if arg_16 is None : arg_16 = arg_0 . obj . params return util . delistify ( arg_0 . obj . get_values ( arg_16 ) , arg_16 ) arg_0 . state = _Statewrap ( arg_0 )

def Func(arg_0):
        """
        Here, we build gradient and hessian functions based on the properties
        of a state that are generally wanted. For each one, we fill in _grad or
        _hess with a function that takes care of various options such as
        slicing and flattening. For example, `m` below takes the model, selects
        different indices from it, maybe flattens it and copies it. This is
        then used in the fisherinformation, gradmodel, and hessmodel functions.
        """
        # create essentially lambda functions, but with a nice signature
        def m(arg_1=None, arg_2=None, arg_3=True):
            return sample(arg_0.model, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3).copy()

        def r(arg_1=None, arg_2=None, arg_3=True):
            return sample(arg_0.residuals, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3).copy()

        def l():
            return arg_0.loglikelihood

        def r_e(**arg_4):
            """sliced etc residuals, with state.error appended on"""
            return r(**arg_4), np.copy(arg_0.error)

        def m_e(**arg_4):
            """sliced etc residuals, with state.error appended on"""
            return m(**arg_4), np.copy(arg_0.error)

        # set the member functions using partial
        arg_0.fisherinformation = partial(arg_0._jtj, funct=m)
        arg_0.gradloglikelihood = partial(arg_0._grad, funct=l)
        arg_0.hessloglikelihood = partial(arg_0._hess, funct=l)
        arg_0.gradmodel = partial(arg_0._grad, funct=m)
        arg_0.hessmodel = partial(arg_0._hess, funct=m)
        arg_0.JTJ = partial(arg_0._jtj, funct=r)
        arg_0.J = partial(arg_0._grad, funct=r)
        arg_0.J_e = partial(arg_0._grad, funct=r_e, nout=2)
        arg_0.gradmodel_e = partial(arg_0._grad, funct=m_e, nout=2)

        # add the appropriate documentation to the following functions
        arg_0.fisherinformation.__doc__ = _graddoc + _sampledoc
        arg_0.gradloglikelihood.__doc__ = _graddoc
        arg_0.hessloglikelihood.__doc__ = _graddoc
        arg_0.gradmodel.__doc__ = _graddoc + _sampledoc
        arg_0.hessmodel.__doc__ = _graddoc + _sampledoc
        arg_0.JTJ.__doc__ = _graddoc + _sampledoc
        arg_0.J.__doc__ = _graddoc + _sampledoc

        # add documentation to the private functions as well. this is done
        # slightly differently, hence the function call
        arg_0._dograddoc(arg_0._grad_one_param)
        arg_0._dograddoc(arg_0._hess_two_param)
        arg_0._dograddoc(arg_0._grad)
        arg_0._dograddoc(arg_0._hess)

        # the state object is a workaround so that other interfaces still
        # work. this should probably be removed in the long run
        class _Statewrap(object):
            def __init__(arg_0, arg_15):
                arg_0.obj = arg_15
            def __getitem__(arg_0, arg_16=None):
                if arg_16 is None:
                    arg_16 = arg_0.obj.params
                return util.delistify(arg_0.obj.get_values(arg_16), arg_16)

        arg_0.state = _Statewrap(arg_0)

Here we build gradient and hessian functions based on the properties of a state that are generally wanted . For each one we fill in _grad or _hess with a function that takes care of various options such as slicing and flattening . For example m below takes the model selects different indices from it maybe flattens it and copies it . This is then used in the fisherinformation gradmodel and hessmodel functions .


def Func(arg_0, arg_1: arg_2) -> arg_2:
        """ Remove common values
            and Update specific values from another Set
        """
        arg_3 = set()
        arg_4 = list(arg_0._hsig.keys())
        for arg_5 in arg_4:
            if arg_5 in arg_1:
                arg_3.add(arg_5)
        for arg_5 in arg_1._hsig.keys():
            if arg_5 not in arg_3:
                arg_0._hsig[arg_5] = arg_1.get(arg_5)
        for arg_5 in arg_3:
            del arg_0._hsig[arg_5]
        return arg_0


def Func ( arg_0 ) : try : arg_1 = arg_0 . get_argument ( constants . PARAM_OFFSET ) return arg_1 except tornado . web . MissingArgumentError as e : raise Exception ( e . log_message )

def Func(arg_0):
    """
    Helper function to get offset argument.
    Raises exception if argument is missing.
    Returns the offset argument.
    """
    try:
      arg_1 = arg_0.get_argument(constants.PARAM_OFFSET)
      return arg_1
    except tornado.web.MissingArgumentError as e:
      raise Exception(e.log_message)

Helper function to get offset argument . Raises exception if argument is missing . Returns the offset argument .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . session . query ( Domain ) . filter ( Domain . name . ilike ( '%%%s%%' % arg_1 ) ) . all ( ) return arg_2

def Func(arg_0, arg_1):
        """ Search the database for the given query. Will find partial matches. """
        arg_2 = arg_0.session.query(Domain).filter(Domain.name.ilike('%%%s%%' % arg_1)).all()
        return arg_2

Search the database for the given query . Will find partial matches .


def Func ( arg_0 ) : arg_1 = lambda val : re . match ( r'%.+%' , val ) arg_2 = lambda val : re . match ( r'\$.+' , val ) arg_3 = [ os . path . isabs ( arg_0 ) , ( '..%s' % os . path . sep ) in arg_0 , arg_0 . startswith ( '~' ) , os . path . expandvars ( arg_0 ) != arg_0 , arg_1 ( arg_0 ) , arg_2 ( arg_0 ) , ] return not any ( arg_3 )

def Func(arg_0):
    """Check if path is safe and allowed.
    """
    arg_1 = lambda val: re.match(r'%.+%', val)
    arg_2 = lambda val: re.match(r'\$.+', val)

    arg_3 = [
        os.path.isabs(arg_0),
        ('..%s' % os.path.sep) in arg_0,
        arg_0.startswith('~'),
        os.path.expandvars(arg_0) != arg_0,
        arg_1(arg_0),
        arg_2(arg_0),
    ]

    return not any(arg_3)


def Func(arg_0, arg_1, arg_2):
        """
        is only called by _update_inert
        """
        # get field descriptor
        arg_3 = arg_0._table._dev_descriptor.get_field_descriptor(arg_1)

        # prepare value
        arg_2 = arg_3.deserialize(arg_2, arg_1)

        # unregister previous link if relevant
        if isinstance(arg_2, Link):
            # de-activate current link if any
            arg_4 = arg_0._data.get(arg_1)
            if arg_4 is not None:
                arg_4.unregister()

        # unregister previous hook if relevant
        if isinstance(arg_2, RecordHook):
            arg_5 = arg_0._data.get(arg_1)
            if arg_5 is not None:
                arg_5.unregister()

        # unregister previous external file if relevant
        if isinstance(arg_2, ExternalFile):
            arg_6 = arg_0._data.get(arg_1)
            if arg_6 is not None:
                arg_6._dev_unregister()

        # if None remove and leave
        if arg_2 in (None, NONE_RECORD_HOOK, NONE_LINK, NONE_EXTERNAL_FILE):
            # we don't check required, because this method is called by _update_inert which does the job
            arg_0._dev_set_none_without_unregistering(arg_1, check_not_required=False)
            return

        # if relevant, store current pk to signal table
        arg_7 = None
        if arg_1 == 0 and not arg_0._table._dev_auto_pk:
            arg_7 = arg_0._data.get(0)  # we use get, because record may not have a pk yet if it is being created

        # set value
        arg_0._data[arg_1] = arg_2

        # signal pk update if relevant
        if arg_7 is not None:
            arg_0._table._dev_record_pk_was_updated(arg_7.target_value)