def Func(arg_0, arg_1, arg_2=None):
    """Compute marginal posterior distribution for each state.

    This function computes, for each time step, the marginal
    conditional probability that the hidden Markov model was in
    each possible state given the observations that were made
    at each time step.
    So if the hidden states are `z[0],...,z[num_steps - 1]` and
    the observations are `x[0], ..., x[num_steps - 1]`, then
    this function computes `P(z[i] | x[0], ..., x[num_steps - 1])`
    for all `i` from `0` to `num_steps - 1`.

    This operation is sometimes called smoothing. It uses a form
    of the forward-backward algorithm.

    Note: the behavior of this function is undefined if the
    `observations` argument represents impossible observations
    from the model.

    Args:
      observations: A tensor representing a batch of observations
        made on the hidden Markov model.  The rightmost dimension of this tensor
        gives the steps in a sequence of observations from a single sample from
        the hidden Markov model. The size of this dimension should match the
        `num_steps` parameter of the hidden Markov model object. The other
        dimensions are the dimensions of the batch and these are broadcast with
        the hidden Markov model's parameters.
      name: Python `str` name prefixed to Ops created by this class.
        Default value: "HiddenMarkovModel".

    Returns:
      posterior_marginal: A `Categorical` distribution object representing the
        marginal probability of the hidden Markov model being in each state at
        each step. The rightmost dimension of the `Categorical` distributions
        batch will equal the `num_steps` parameter providing one marginal
        distribution for each step. The other dimensions are the dimensions
        corresponding to the batch of observations.

    Raises:
      ValueError: if rightmost dimension of `observations` does not
      have size `num_steps`.
    """

    with tf.name_scope(arg_2 or "Func"):
      with tf.control_dependencies(arg_0._runtime_assertions):
        arg_3 = tf.shape(input=arg_1)

        with arg_0._observation_shape_preconditions(arg_3):
          arg_4 = arg_3[
              :-1 - arg_0._underlying_event_rank]
          arg_5 = arg_3[
              -1 - arg_0._underlying_event_rank:]

          arg_6 = tf.broadcast_dynamic_shape(arg_4,
                                                   arg_0.batch_shape_tensor())
          arg_7 = tf.broadcast_to(arg_0._log_init,
                                     tf.concat([arg_6,
                                                [arg_0._num_states]],
                                               axis=0))
          arg_8 = arg_0._log_trans

          arg_1 = tf.broadcast_to(arg_1,
                                         tf.concat([arg_6,
                                                    arg_5],
                                                   axis=0))
          arg_9 = tf.rank(arg_1)
          arg_10 = arg_0._underlying_event_rank
          arg_1 = distribution_util.move_dimension(
              arg_1, arg_9 - arg_10 - 1, 0)
          arg_1 = tf.expand_dims(
              arg_1,
              arg_9 - arg_10)
          arg_11 = arg_0._observation_distribution.log_prob(
              arg_1)

          arg_12 = tf.zeros_like(arg_7)

          def forward_step(arg_13, arg_14):
            return _log_vector_matrix(arg_13,
                                      arg_8) + arg_14

          arg_15 = arg_7 + arg_11[0]

          arg_16 = tf.scan(forward_step, arg_11[1:],
                                      initializer=arg_15,
                                      arg_2="forward_log_probs")

          arg_16 = tf.concat([[arg_15], arg_16], axis=0)

          def backward_step(arg_13, arg_14):
            return _log_matrix_vector(arg_8,
                                      arg_14 + arg_13)

          arg_17 = tf.scan(
              backward_step,
              arg_11[1:],
              initializer=arg_12,
              reverse=True,
              arg_2="backward_log_adjoint_probs")

          arg_18 = tf.reduce_logsumexp(
              input_tensor=arg_16[-1], axis=-1)

          arg_17 = tf.concat([arg_17,
                                                  [arg_12]], axis=0)

          arg_19 = arg_16 + arg_17

          arg_20 = distribution_util.move_dimension(
              arg_19 - arg_18[..., tf.newaxis], 0, -2)

          return categorical.Categorical(logits=arg_20)

Compute marginal posterior distribution for each state .


(self, item_with_annotations, node, overwrite=False)

def Func(arg_0, arg_1, arg_2, arg_3=False):
        """Stores annotations into an hdf5 file."""

        # If we overwrite delete all annotations first
        if arg_3 is True or arg_3 == 'v_annotations':
            arg_4 = arg_0._all_get_from_attrs(arg_2, HDF5StorageService.ANNOTATED)
            if arg_4:
                arg_5 = arg_2._v_attrs
                for arg_6 in arg_5._v_attrnames:
                    if arg_6.startswith(HDF5StorageService.ANNOTATION_PREFIX):
                        delattr(arg_5, arg_6)
                delattr(arg_5, HDF5StorageService.ANNOTATED)
                arg_0._hdf5file.flush()

        # Only store annotations if the item has some
        if not arg_1.v_annotations.f_is_empty():

            arg_7 = arg_1.v_annotations._dict

            arg_5 = arg_2._v_attrs

            arg_8 = False

            for arg_9 in arg_7:
                arg_10 = arg_7[arg_9]

                arg_11 = HDF5StorageService.ANNOTATION_PREFIX + arg_9
                if arg_11 not in arg_5:
                    # Only store *new* annotations, if they already exist on disk, skip storage
                    setattr(arg_5, arg_11, arg_10)
                    arg_8 = True

            if arg_8:
                setattr(arg_5, HDF5StorageService.ANNOTATED, True)
                arg_0._hdf5file.flush()


(
        df,
        variable,
        value,
        new_columns,
        groups,
        id_cols=None
)

def Func(
        arg_0,
        arg_1,
        arg_2,
        arg_3,
        arg_4,
        arg_5=None
):
    """
    Pivot a dataframe by group of variables

    ---

    ### Parameters

    *mandatory :*
    * `variable` (*str*): name of the column used to create the groups.
    * `value` (*str*): name of the column containing the value to fill the pivoted df.
    * `new_columns` (*list of str*): names of the new columns.
    * `groups` (*dict*): names of the groups with their corresponding variables.
      **Warning**: the list of variables must have the same order as `new_columns`

    *optional :*
    * `id_cols` (*list of str*) : names of other columns to keep, default `None`.

    ---

    ### Example

    **Input**

    | type |  variable  | montant |
    |:----:|:----------:|:-------:|
    |   A  |    var1    |    5    |
    |   A  | var1_evol  |   0.3   |
    |   A  |    var2    |    6    |
    |   A  | var2_evol  |   0.2   |

    ```cson
    Func :
      id_cols: ['type']
      variable: 'variable'
      value: 'montant'
      new_columns: ['value', 'variation']
      groups:
        'Group 1' : ['var1', 'var1_evol']
        'Group 2' : ['var2', 'var2_evol']
    ```

    **Ouput**

    | type |  variable  |  value  | variation |
    |:----:|:----------:|:-------:|:---------:|
    |   A  |   Group 1  |    5    |    0.3    |
    |   A  |   Group 2  |    6    |    0.2    |

    """
    if arg_5 is None:
        arg_6 = [arg_1]
    else:
        arg_6 = [arg_1] + arg_5

    arg_7 = pd.DataFrame(arg_4, arg_6=arg_3)
    arg_8 = 'tmp'

    arg_0[arg_8] = arg_0[arg_1]
    for arg_9 in arg_7.columns:
        arg_0.loc[arg_0[arg_1].isin(arg_7[arg_9]), arg_1] = arg_9

    arg_7 = arg_7.T
    for arg_9 in arg_7.columns:
        arg_0.loc[
            arg_0[arg_8].isin(arg_7[arg_9]), arg_8] = arg_9

    arg_0 = pivot(arg_0, arg_6, arg_8, arg_2)
    return arg_0

Pivot a dataframe by group of variables

    ---

    ### Parameters

    *mandatory :*
    * `variable` (*str*): name of the column used to create the groups.
    * `value` (*str*): name of the column containing the value to fill the pivoted df.
    * `new_columns` (*list of str*): names of the new columns.
    * `groups` (*dict*): names of the groups with their corresponding variables.
      **Warning**: the list of variables must have the same order as `new_columns`

    *optional :*
    * `id_cols` (*list of str*) : names of other columns to keep, default `None`.

    ---

    ### Example

    **Input**

    | type |  variable  | montant |
    |:----:|:----------:|:-------:|
    |   A  |    var1    |    5    |
    |   A  | var1_evol  |   0.3   |
    |   A  |    var2    |    6    |
    |   A  | var2_evol  |   0.2   |

    ```cson
    pivot_by_group :
      id_cols: ['type']
      variable: 'variable'
      value: 'montant'
      new_columns: ['value', 'variation']
      groups:
        'Group 1' : ['var1', 'var1_evol']
        'Group 2' : ['var2', 'var2_evol']
    ```

    **Ouput**

    | type |  variable  |  value  | variation |
    |:----:|:----------:|:-------:|:---------:|
    |   A  |   Group 1  |    5    |    0.3    |
    |   A  |   Group 2  |    6    |    0.2    |


def Func(arg_0):
    """Transform a GEOS or OGR geometry object into an lxml Element
    for the GML geometry."""
    if arg_0.srs.srid != 4326:
        raise NotImplementedError("Only WGS 84 lat/long geometries (SRID 4326) are supported.")
    # GeoJSON output is far more standard than GML, so go through that
    return geojson_to_gml(json.loads(arg_0.geojson))

Transform a GEOS or OGR geometry object into an lxml Element for the GML geometry .


def Func(arg_0, arg_1, *arg_2, **arg_3):
        """Determine if client authentication is required for current request.

        According to the rfc6749, client authentication is required in the
        following cases:

        Resource Owner Password Credentials Grant: see `Section 4.3.2`_.
        Authorization Code Grant: see `Section 4.1.3`_.
        Refresh Token Grant: see `Section 6`_.

        .. _`Section 4.3.2`: http://tools.ietf.org/html/rfc6749#section-4.3.2
        .. _`Section 4.1.3`: http://tools.ietf.org/html/rfc6749#section-4.1.3
        .. _`Section 6`: http://tools.ietf.org/html/rfc6749#section-6
        """
        def is_confidential(arg_4):
            if hasattr(arg_4, 'is_confidential'):
                return arg_4.is_confidential
            arg_5 = getattr(arg_4, 'client_type', None)
            if arg_5:
                return arg_5 == 'confidential'
            return True

        arg_6 = ('password', 'authorization_code', 'refresh_token')
        arg_7, arg_8 = arg_0._get_client_creds_from_request(arg_1)
        if arg_7 and arg_1.grant_type in arg_6:
            arg_4 = arg_0._clientgetter(arg_7)
            if arg_4:
                return is_confidential(arg_4)
        return False

Determine if client authentication is required for current request .


return sum([zi*(Ki-1.)/(1.+V_over_F*(Ki-1.)) for Ki, zi in zip(Ks, zs)])

def Func ( arg_0 , arg_1 , arg_2 ) : return sum ( [ arg_4 * ( arg_3 - 1. ) / ( 1. + arg_0 * ( arg_3 - 1. ) ) for arg_3 , arg_4 in zip ( arg_2 , arg_1 ) ] )

def Func(arg_0, arg_1, arg_2):
    r'''Calculates the objective function of the Rachford-Rice flash equation.
    This function should be called by a solver seeking a solution to a flash
    calculation. The unknown variable is `V_over_F`, for which a solution
    must be between 0 and 1.

    .. math::
        \sum_i \frac{z_i(K_i-1)}{1 + \frac{V}{F}(K_i-1)} = 0

    Parameters
    ----------
    V_over_F : float
        Vapor fraction guess [-]
    zs : list[float]
        Overall mole fractions of all species, [-]
    Ks : list[float]
        Equilibrium K-values, [-]

    Returns
    -------
    error : float
        Deviation between the objective function at the correct V_over_F
        and the attempted V_over_F, [-]

    Notes
    -----
    The derivation is as follows:

    .. math::
        F z_i = L x_i + V y_i

        x_i = \frac{z_i}{1 + \frac{V}{F}(K_i-1)}

        \sum_i y_i = \sum_i K_i x_i = 1

        \sum_i(y_i - x_i)=0

        \sum_i \frac{z_i(K_i-1)}{1 + \frac{V}{F}(K_i-1)} = 0

    Examples
    --------
    >>> Func(0.5, zs=[0.5, 0.3, 0.2],
    ... Ks=[1.685, 0.742, 0.532])
    0.04406445591174976

    References
    ----------
    .. [1] Rachford, H. H. Jr, and J. D. Rice. "Procedure for Use of Electronic
       Digital Computers in Calculating Flash Vaporization Hydrocarbon
       Equilibrium." Journal of Petroleum Technology 4, no. 10 (October 1,
       1952): 19-3. doi:10.2118/952327-G.
    '''
    return sum([arg_4*(arg_3-1.)/(1.+arg_0*(arg_3-1.)) for arg_3, arg_4 in zip(arg_2, arg_1)])

r'''Calculates the objective function of the Rachford-Rice flash equation.
    This function should be called by a solver seeking a solution to a flash
    calculation. The unknown variable is `V_over_F`, for which a solution
    must be between 0 and 1.

    .. math::
        \sum_i \frac{z_i(K_i-1)}{1 + \frac{V}{F}(K_i-1)} = 0

    Parameters
    ----------
    V_over_F : float
        Vapor fraction guess [-]
    zs : list[float]
        Overall mole fractions of all species, [-]
    Ks : list[float]
        Equilibrium K-values, [-]

    Returns
    -------
    error : float
        Deviation between the objective function at the correct V_over_F
        and the attempted V_over_F, [-]

    Notes
    -----
    The derivation is as follows:

    .. math::
        F z_i = L x_i + V y_i

        x_i = \frac{z_i}{1 + \frac{V}{F}(K_i-1)}

        \sum_i y_i = \sum_i K_i x_i = 1

        \sum_i(y_i - x_i)=0

        \sum_i \frac{z_i(K_i-1)}{1 + \frac{V}{F}(K_i-1)} = 0

    Examples
    --------
    >>> Rachford_Rice_flash_error(0.5, zs=[0.5, 0.3, 0.2],
    ... Ks=[1.685, 0.742, 0.532])
    0.04406445591174976

    References
    ----------
    .. [1] Rachford, H. H. Jr, and J. D. Rice. "Procedure for Use of Electronic
       Digital Computers in Calculating Flash Vaporization Hydrocarbon
       Equilibrium." Journal of Petroleum Technology 4, no. 10 (October 1,
       1952): 19-3. doi:10.2118/952327-G.

r Calculates the objective function of the Rachford - Rice flash equation . This function should be called by a solver seeking a solution to a flash calculation . The unknown variable is V_over_F for which a solution must be between 0 and 1 .


(self, service_name, label, description=None,
                              location=None, affinity_group=None,
                              extended_properties=None)

return self._perform_post(self._get_hosted_service_path(),
                                  _XmlSerializer.create_hosted_service_to_xml(
                                      service_name,
                                      label,
                                      description,
                                      location,
                                      affinity_group,
                                      extended_properties),
                                  as_async=True)

def Func(arg_0, arg_1, arg_2, arg_3=None,
                              arg_4=None, arg_5=None,
                              arg_6=None):
        '''
        Creates a new hosted service in Windows Azure.

        service_name:
            A name for the hosted service that is unique within Windows Azure.
            This name is the DNS prefix name and can be used to access the
            hosted service.
        label:
            A name for the hosted service. The name can be up to 100 characters
            in length. The name can be used to identify the storage account for
            your tracking purposes.
        description:
            A description for the hosted service. The description can be up to
            1024 characters in length.
        location:
            The location where the hosted service will be created. You can
            specify either a location or affinity_group, but not both.
        affinity_group:
            The name of an existing affinity group associated with this
            subscription. This name is a GUID and can be retrieved by examining
            the name element of the response body returned by
            list_affinity_groups. You can specify either a location or
            affinity_group, but not both.
        extended_properties:
            Dictionary containing name/value pairs of storage account
            properties. You can have a maximum of 50 extended property
            name/value pairs. The maximum length of the Name element is 64
            characters, only alphanumeric characters and underscores are valid
            in the Name, and the name must start with a letter. The value has
            a maximum length of 255 characters.
        '''
        _validate_not_none('service_name', arg_1)
        _validate_not_none('label', arg_2)
        if arg_5 is None and arg_4 is None:
            raise ValueError(
                'location or affinity_group must be specified')
        if arg_5 is not None and arg_4 is not None:
            raise ValueError(
                'Only one of location or affinity_group needs to be specified')
        return arg_0._perform_post(arg_0._get_hosted_service_path(),
                                  _XmlSerializer.Func_to_xml(
                                      arg_1,
                                      arg_2,
                                      arg_3,
                                      arg_4,
                                      arg_5,
                                      arg_6),
                                  as_async=True)

Creates a new hosted service in Windows Azure .


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
==
'b37'
:
arg_0
.
cwd
(
DIR_CLINVAR_VCF_B37
)
elif
arg_1
==
'b38'
:
arg_0
.
cwd
(
DIR_CLINVAR_VCF_B38
)
else
:
raise
IOError
(
"Genome build not recognized."
)

def Func(arg_0, arg_1):
    """
    Navigate an open ftplib.FTP to appropriate directory for ClinVar VCF files.

    Args:
        ftp:   (type: ftplib.FTP) an open connection to ftp.ncbi.nlm.nih.gov
        build: (type: string) genome build, either 'b37' or 'b38'
    """
    if arg_1 == 'b37':
        arg_0.cwd(DIR_CLINVAR_VCF_B37)
    elif arg_1 == 'b38':
        arg_0.cwd(DIR_CLINVAR_VCF_B38)
    else:
        raise IOError("Genome build not recognized.")

Navigate an open ftplib . FTP to appropriate directory for ClinVar VCF files .


def Func ( ) : arg_0 = ConfigParser . ConfigParser ( ) arg_0 . read ( [ 'setup.cfg' ] ) if not arg_0 . has_section ( 'check-manifest' ) : return if ( arg_0 . has_option ( 'check-manifest' , 'ignore-default-rules' ) and arg_0 . getboolean ( 'check-manifest' , 'ignore-default-rules' ) ) : del IGNORE [ : ] if arg_0 . has_option ( 'check-manifest' , 'ignore' ) : arg_1 = [ arg_2 . strip ( ) for arg_2 in arg_0 . get ( 'check-manifest' , 'ignore' ) . splitlines ( ) ] IGNORE . extend ( arg_2 for arg_2 in arg_1 if arg_2 )

def Func():
    """Read configuration from setup.cfg."""
    # XXX modifies global state, which is kind of evil
    arg_0 = ConfigParser.ConfigParser()
    arg_0.read(['setup.cfg'])
    if not arg_0.has_section('check-manifest'):
        return
    if (arg_0.has_option('check-manifest', 'ignore-default-rules')
            and arg_0.getboolean('check-manifest', 'ignore-default-rules')):
        del IGNORE[:]
    if arg_0.has_option('check-manifest', 'ignore'):
        arg_1 = [arg_2.strip() for arg_2 in arg_0.get('check-manifest',
                                                  'ignore').splitlines()]
        IGNORE.extend(arg_2 for arg_2 in arg_1 if arg_2)


def Func(arg_0, arg_1):
        """Register a MessageDefinition with consistency in mind.

        :param MessageDefinition message: The message definition being added.
        """
        arg_0._check_id_and_symbol_consistency(arg_1.msgid, arg_1.symbol)
        arg_0._check_symbol(arg_1.msgid, arg_1.symbol)
        arg_0._check_msgid(arg_1.msgid, arg_1.symbol)
        for arg_2 in arg_1.old_names:
            arg_0._check_symbol(arg_1.msgid, arg_2[1])
        arg_0._messages_definitions[arg_1.symbol] = arg_1
        arg_0._register_alternative_name(arg_1, arg_1.msgid, arg_1.symbol)
        for arg_5, arg_6 in arg_1.old_names:
            arg_0._register_alternative_name(arg_1, arg_5, arg_6)
        arg_0._msgs_by_category[arg_1.msgid[0]].append(arg_1.msgid)

Register a MessageDefinition with consistency in mind .


(self, datafield, subfield, i1=None, i2=None,
                      exception=False)

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None,
                      arg_5=False):
        """
        Return content of given `subfield` in `datafield`.

        Args:
            datafield (str): Section name (for example "001", "100", "700").
            subfield (str):  Subfield name (for example "a", "1", etc..).
            i1 (str, default None): Optional i1/ind1 parameter value, which
               will be used for search.
            i2 (str, default None): Optional i2/ind2 parameter value, which
               will be used for search.
            exception (bool): If ``True``, :exc:`~exceptions.KeyError` is
                      raised when method couldn't found given `datafield` /
                      `subfield`. If ``False``, blank array ``[]`` is returned.

        Returns:
            list: of :class:`.MARCSubrecord`.

        Raises:
            KeyError: If the subfield or datafield couldn't be found.

        Note:
            MARCSubrecord is practically same thing as string, but has defined
            :meth:`.MARCSubrecord.i1` and :attr:`.MARCSubrecord.i2`
            methods.

            You may need to be able to get this, because MARC XML depends on
            i/ind parameters from time to time (names of authors for example).

        """
        if len(arg_1) != 3:
            raise ValueError(
                "`datafield` parameter have to be exactly 3 chars long!"
            )
        if len(arg_2) != 1:
            raise ValueError(
                "Bad subfield specification - subfield have to be 1 char long!"
            )

        # if datafield not found, return or raise exception
        if arg_1 not in arg_0.datafields:
            if arg_5:
                raise KeyError(arg_1 + " is not in datafields!")

            return []

        # look for subfield defined by `subfield`, `i1` and `i2` parameters
        arg_6 = []
        for arg_1 in arg_0.datafields[arg_1]:
            if arg_2 not in arg_1:
                continue

            # records are not returned just like plain string, but like
            # MARCSubrecord, because you will need ind1/ind2 values
            for arg_7 in arg_1[arg_2]:
                if arg_3 and arg_7.i1 != arg_3:
                    continue

                if arg_4 and arg_7.i2 != arg_4:
                    continue

                arg_6.append(arg_7)

        if not arg_6 and arg_5:
            raise KeyError(arg_2 + " couldn't be found in subfields!")

        return arg_6

Return content of given subfield in datafield .


def Func(arg_0, arg_1=None):
        """Applies mesh programs to meshes"""
        if not arg_1:
            arg_1 = [ColorProgram(), TextureProgram(), FallbackProgram()]

        for arg_2 in arg_0.meshes:
            for arg_3 in arg_1:
                arg_4 = arg_3.apply(arg_2)
                if arg_4 is not None:
                    if isinstance(arg_4, MeshProgram):
                        arg_2.mesh_program = arg_3
                        break
                    else:
                        raise ValueError("apply() must return a MeshProgram instance, not {}".format(type(arg_4)))

            if not arg_2.mesh_program:
                print("WARING: No mesh program applied to '{}'".format(arg_2.name))


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
logger
.
debug
(
'Sending data: %s'
%
arg_1
)
arg_0
.
client
.
Funcall
(
arg_1
.
encode
(
)
)

def Func(arg_0, arg_1):
        """
        Send encoded instructions to Guacamole guacd server.
        """
        arg_0.logger.debug('Sending data: %s' % arg_1)
        arg_0.client.Funcall(arg_1.encode())

Send encoded instructions to Guacamole guacd server .


def Func ( arg_0 , arg_1 ) : if arg_0 . pkgdiagram : arg_0 . pkgdiagram . add_from_depend ( arg_1 , arg_1 . modname )

def Func(arg_0, arg_1):
        """visit astroid.ImportFrom  and catch modules for package diagram
        """
        if arg_0.pkgdiagram:
            arg_0.pkgdiagram.add_from_depend(arg_1, arg_1.modname)

visit astroid . ImportFrom and catch modules for package diagram


def Func ( arg_0 ) : if arg_0 is None : return None arg_1 = AsynchronousOperationResult ( ) if arg_0 . headers : for arg_2 , arg_3 in arg_0 . headers : if arg_2 . lower ( ) == 'x-ms-request-id' : arg_1 . request_id = arg_3 return arg_1

def Func(arg_0):
    ''' Extracts request id from response header. '''

    if arg_0 is None:
        return None

    arg_1 = AsynchronousOperationResult()
    if arg_0.headers:
        for arg_2, arg_3 in arg_0.headers:
            if arg_2.lower() == 'x-ms-request-id':
                arg_1.request_id = arg_3

    return arg_1

Extracts request id from response header .


async def Func(arg_0, arg_1: arg_2):
        """ Connects to a voice channel. """
        arg_3 = arg_0._lavalink.bot._Funcion._get_websocket(arg_2(arg_0.guild_id))
        await arg_3.voice_state(arg_0.guild_id, str(arg_1))


def Func(arg_0, arg_1, arg_2):
  """Decompose a forecast distribution into contributions from each component.

  Args:
    model: An instance of `tfp.sts.Sum` representing a structural time series
      model.
    forecast_dist: A `Distribution` instance returned by `tfp.sts.forecast()`.
      (specifically, must be a `tfd.MixtureSameFamily` over a
      `tfd.LinearGaussianStateSpaceModel` parameterized by posterior samples).
    parameter_samples: Python `list` of `Tensors` representing posterior samples
      of model parameters, with shapes `[concat([[num_posterior_draws],
      param.prior.batch_shape, param.prior.event_shape]) for param in
      model.parameters]`. This may optionally also be a map (Python `dict`) of
      parameter names to `Tensor` values.
  Returns:
    component_forecasts: A `collections.OrderedDict` instance mapping
      component StructuralTimeSeries instances (elements of `model.components`)
      to `tfd.Distribution` instances representing the marginal forecast for
      each component. Each distribution has batch and event shape matching
      `forecast_dist` (specifically, the event shape is
      `[num_steps_forecast]`).

  #### Examples

  Suppose we've built a model, fit it to data, and constructed a forecast
  distribution:

  ```python
    day_of_week = tfp.sts.Seasonal(
        num_seasons=7,
        observed_time_series=observed_time_series,
        name='day_of_week')
    local_linear_trend = tfp.sts.LocalLinearTrend(
        observed_time_series=observed_time_series,
        name='local_linear_trend')
    model = tfp.sts.Sum(components=[day_of_week, local_linear_trend],
                        observed_time_series=observed_time_series)

    num_steps_forecast = 50
    samples, kernel_results = tfp.sts.fit_with_hmc(model, observed_time_series)
    forecast_dist = tfp.sts.forecast(model, observed_time_series,
                                 parameter_samples=samples,
                                 num_steps_forecast=num_steps_forecast)
  ```

  To extract the forecast for individual components, pass the forecast
  distribution into `Funcs`:

  ```python
    component_forecasts = Func(
      model, forecast_dist, samples)

    # Component mean and stddev have shape `[num_steps_forecast]`.
    day_of_week_effect_mean = forecast_components[day_of_week].mean()
    day_of_week_effect_stddev = forecast_components[day_of_week].stddev()
  ```

  Using the component forecasts, we can visualize the uncertainty for each
  component:

  ```
  from matplotlib import pylab as plt
  num_components = len(component_forecasts)
  xs = np.arange(num_steps_forecast)
  fig = plt.figure(figsize=(12, 3 * num_components))
  for i, (component, component_dist) in enumerate(component_forecasts.items()):

    # If in graph mode, replace `.numpy()` with `.eval()` or `sess.run()`.
    component_mean = component_dist.mean().numpy()
    component_stddev = component_dist.stddev().numpy()

    ax = fig.add_subplot(num_components, 1, 1 + i)
    ax.plot(xs, component_mean, lw=2)
    ax.fill_between(xs,
                    component_mean - 2 * component_stddev,
                    component_mean + 2 * component_stddev,
                    alpha=0.5)
    ax.set_title(component.name)
  ```

  """

  with tf.compat.v1.name_scope('Func'):
    try:
      arg_3 = arg_1.components_distribution
      arg_4, arg_5 = arg_3._joint_mean()  # pylint: disable=protected-access
      arg_6, arg_5 = arg_3._joint_covariances()  # pylint: disable=protected-access
    except AttributeError as e:
      raise ValueError(
          'Forecast distribution must be a MixtureSameFamily of'
          'LinearGaussianStateSpaceModel distributions, such as returned by'
          '`tfp.sts.forecast()`. (saw exception: {})'.format(e))

    # Since `parameter_samples` will have sample shape `[num_posterior_draws]`,
    # we need to move the `num_posterior_draws` dimension of the forecast
    # moments from the trailing batch dimension, where it's currently put by
    # `sts.forecast`, back to the leading (sample shape) dimension.
    arg_4 = dist_util.move_dimension(
        arg_4, source_idx=-3, dest_idx=0)
    arg_6 = dist_util.move_dimension(
        arg_6, source_idx=-4, dest_idx=0)

    return _decompose_from_posterior_marginals(
        arg_0, arg_4, arg_6, arg_2)

Decompose a forecast distribution into contributions from each component.

  Args:
    model: An instance of `tfp.sts.Sum` representing a structural time series
      model.
    forecast_dist: A `Distribution` instance returned by `tfp.sts.forecast()`.
      (specifically, must be a `tfd.MixtureSameFamily` over a
      `tfd.LinearGaussianStateSpaceModel` parameterized by posterior samples).
    parameter_samples: Python `list` of `Tensors` representing posterior samples
      of model parameters, with shapes `[concat([[num_posterior_draws],
      param.prior.batch_shape, param.prior.event_shape]) for param in
      model.parameters]`. This may optionally also be a map (Python `dict`) of
      parameter names to `Tensor` values.
  Returns:
    component_forecasts: A `collections.OrderedDict` instance mapping
      component StructuralTimeSeries instances (elements of `model.components`)
      to `tfd.Distribution` instances representing the marginal forecast for
      each component. Each distribution has batch and event shape matching
      `forecast_dist` (specifically, the event shape is
      `[num_steps_forecast]`).

  #### Examples

  Suppose we've built a model, fit it to data, and constructed a forecast
  distribution:

  ```python
    day_of_week = tfp.sts.Seasonal(
        num_seasons=7,
        observed_time_series=observed_time_series,
        name='day_of_week')
    local_linear_trend = tfp.sts.LocalLinearTrend(
        observed_time_series=observed_time_series,
        name='local_linear_trend')
    model = tfp.sts.Sum(components=[day_of_week, local_linear_trend],
                        observed_time_series=observed_time_series)

    num_steps_forecast = 50
    samples, kernel_results = tfp.sts.fit_with_hmc(model, observed_time_series)
    forecast_dist = tfp.sts.forecast(model, observed_time_series,
                                 parameter_samples=samples,
                                 num_steps_forecast=num_steps_forecast)
  ```

  To extract the forecast for individual components, pass the forecast
  distribution into `decompose_forecast_by_components`:

  ```python
    component_forecasts = decompose_forecast_by_component(
      model, forecast_dist, samples)

    # Component mean and stddev have shape `[num_steps_forecast]`.
    day_of_week_effect_mean = forecast_components[day_of_week].mean()
    day_of_week_effect_stddev = forecast_components[day_of_week].stddev()
  ```

  Using the component forecasts, we can visualize the uncertainty for each
  component:

  ```
  from matplotlib import pylab as plt
  num_components = len(component_forecasts)
  xs = np.arange(num_steps_forecast)
  fig = plt.figure(figsize=(12, 3 * num_components))
  for i, (component, component_dist) in enumerate(component_forecasts.items()):

    # If in graph mode, replace `.numpy()` with `.eval()` or `sess.run()`.
    component_mean = component_dist.mean().numpy()
    component_stddev = component_dist.stddev().numpy()

    ax = fig.add_subplot(num_components, 1, 1 + i)
    ax.plot(xs, component_mean, lw=2)
    ax.fill_between(xs,
                    component_mean - 2 * component_stddev,
                    component_mean + 2 * component_stddev,
                    alpha=0.5)
    ax.set_title(component.name)
  ```

Decompose a forecast distribution into contributions from each component .


def
Func
(
arg_0
)
:
arg_0
.
log
.
info
(
'Shutting down kernels'
)
arg_1
=
arg_0
.
kernel_manager
for
arg_2
in
list
(
arg_1
.
kernel_ids
)
:
arg_1
.
shutdown_kernel
(
arg_2
)

def Func(arg_0):
        """shutdown all kernels

        The kernels will shutdown themselves when this process no longer exists,
        but explicit shutdown allows the KernelManagers to cleanup the connection files.
        """
        arg_0.log.info('Shutting down kernels')
        arg_1 = arg_0.kernel_manager
        # copy list, since shutdown_kernel deletes keys
        for arg_2 in list(arg_1.kernel_ids):
            arg_1.shutdown_kernel(arg_2)

shutdown all kernels The kernels will shutdown themselves when this process no longer exists but explicit shutdown allows the KernelManagers to cleanup the connection files .


(y_true: [list, np.ndarray], y_predicted: [list, np.ndarray])

return correct / examples_len if examples_len else 0

def Func ( arg_0 : [ arg_1 , arg_2 . ndarray ] , arg_4 : [ arg_1 , arg_2 . ndarray ] ) -> float : arg_5 = len ( arg_0 ) arg_6 = sum ( [ y1 == y2 for y1 , y2 in zip ( arg_0 , arg_4 ) ] ) return arg_6 / arg_5 if arg_5 else 0

def Func(arg_0: [arg_1, arg_2.ndarray], arg_4: [arg_1, arg_2.ndarray]) -> float:
    """
    Calculate Func in terms of absolute coincidence

    Args:
        y_true: array of true values
        y_predicted: array of predicted values

    Returns:
        portion of absolutely coincidental samples
    """
    arg_5 = len(arg_0)
    arg_6 = sum([y1 == y2 for y1, y2 in zip(arg_0, arg_4)])
    return arg_6 / arg_5 if arg_5 else 0

Calculate accuracy in terms of absolute coincidence

    Args:
        y_true: array of true values
        y_predicted: array of predicted values

    Returns:
        portion of absolutely coincidental samples


def Func(arg_0):
        """Fills code heatmap and execution count dictionaries."""
        for arg_1, arg_2, arg_3 in arg_0.lines_without_stdlib:
            arg_0._execution_count[arg_1][arg_2] += 1
            arg_0._heatmap[arg_1][arg_2] += arg_3

Fills code heatmap and execution count dictionaries .


def Func ( arg_0 , arg_1 , arg_2 = None ) : with tf . compat . v1 . name_scope ( arg_2 , "Func" , [ arg_0 ] ) : return tf . exp ( arg_0 ) * arg_1 ( - arg_0 )

def Func(arg_0, arg_1, arg_2=None):
  """Calculates the dual Csiszar-function in log-space.

  A Csiszar-function is a member of,

  ```none
  F = { f:R_+ to R : f convex }.
  ```

  The Csiszar-dual is defined as:

  ```none
  f^*(u) = u f(1 / u)
  ```

  where `f` is some other Csiszar-function.

  For example, the dual of `kl_reverse` is `kl_forward`, i.e.,

  ```none
  f(u) = -log(u)
  f^*(u) = u f(1 / u) = -u log(1 / u) = u log(u)
  ```

  The dual of the dual is the original function:

  ```none
  f^**(u) = {u f(1/u)}^*(u) = u (1/u) f(1/(1/u)) = f(u)
  ```

  Warning: this function makes non-log-space calculations and may therefore be
  numerically unstable for `|logu| >> 0`.

  Args:
    logu: `float`-like `Tensor` representing `log(u)` from above.
    csiszar_function: Python `callable` representing a Csiszar-function over
      log-domain.
    name: Python `str` name prefixed to Ops created by this function.

  Returns:
    dual_f_of_u: `float`-like `Tensor` of the result of calculating the dual of
      `f` at `u = exp(logu)`.
  """

  with tf.compat.v1.name_scope(arg_2, "Func", [arg_0]):
    return tf.exp(arg_0) * arg_1(-arg_0)

Calculates the dual Csiszar - function in log - space .


def Func ( arg_0 ) : arg_1 = { } for arg_2 in _EXIF_TAGS : arg_3 = arg_0 . img . attribute ( "EXIF:%s" % arg_2 ) if arg_3 and arg_3 != 'unknown' : arg_1 [ arg_2 ] = arg_3 return arg_1

def Func(arg_0):
        """return exif-tag dict
        """
        arg_1 = {}
        for arg_2 in _EXIF_TAGS:
            arg_3 = arg_0.img.attribute("EXIF:%s" % arg_2)
            if arg_3 and arg_3 != 'unknown':
                arg_1[arg_2] = arg_3
        return arg_1


def
Func
(
arg_0
,
arg_1
,
**
arg_2
)
:
arg_1
=
unicode
(
arg_1
)
if
arg_1
==
u'json'
or
arg_1
==
u'ipynb'
:
return
Func_json
(
arg_0
,
**
arg_2
)
elif
arg_1
==
u'py'
:
return
Func_py
(
arg_0
,
**
arg_2
)
else
:
raise
NBFormatError
(
'Unsupported format: %s'
%
arg_1
)

def Func(arg_0, arg_1, **arg_2):
    """Read a notebook from a string and return the NotebookNode object.

    This function properly handles notebooks of any version. The notebook
    returned will always be in the current version's format.

    Parameters
    ----------
    s : unicode
        The raw unicode string to read the notebook from.
    format : (u'json', u'ipynb', u'py')
        The format that the string is in.

    Returns
    -------
    nb : NotebookNode
        The notebook that was read.
    """
    arg_1 = unicode(arg_1)
    if arg_1 == u'json' or arg_1 == u'ipynb':
        return Func_json(arg_0, **arg_2)
    elif arg_1 == u'py':
        return Func_py(arg_0, **arg_2)
    else:
        raise NBFormatError('Unsupported format: %s' % arg_1)

Read a notebook from a string and return the NotebookNode object .


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , basestring ) : return len ( arg_0 . screen . markup . clean_markup ( arg_1 ) ) elif isinstance ( arg_1 , tuple ) or isinstance ( arg_1 , list ) : arg_2 = arg_0 . screen . markup . get_markup_vars ( ) arg_3 = 0 for arg_4 in arg_1 : if arg_4 not in arg_2 : arg_3 += len ( arg_4 ) return arg_3

def Func(arg_0, arg_1):
        '''  Calculate wisible length of string  '''
        if isinstance(arg_1, basestring):
            return len(arg_0.screen.markup.clean_markup(arg_1))
        elif isinstance(arg_1, tuple) or isinstance(arg_1, list):
            arg_2 = arg_0.screen.markup.get_markup_vars()
            arg_3 = 0
            for arg_4 in arg_1:
                if arg_4 not in arg_2:
                    arg_3 += len(arg_4)
            return arg_3


(
        time, flux, err_flux,
        blsfit_savpath=None,
        trapfit_savpath=None,
        in_out_transit_savpath=None,
        sigclip=None,
        magsarefluxes=True,
        nworkers=1,
        extra_maskfrac=0.03
)

return time[out_of_transit], flux[out_of_transit], err_flux[out_of_transit]

def Func(
        arg_0, arg_1, arg_2,
        arg_3=None,
        arg_4=None,
        arg_5=None,
        arg_6=None,
        arg_7=True,
        arg_8=1,
        arg_9=0.03
):
    '''This gets the out-of-transit light curve points.

    Relevant during iterative masking of transits for multiple planet system
    search.

    Parameters
    ----------

    time,flux,err_flux : np.array
        The input flux time-series measurements and their associated measurement
        errors

    blsfit_savpath : str or None
        If provided as a str, indicates the path of the fit plot to make for a
        simple BLS model fit to the transit using the obtained period and epoch.

    trapfit_savpath : str or None
        If provided as a str, indicates the path of the fit plot to make for a
        trapezoidal transit model fit to the transit using the obtained period
        and epoch.

    in_out_transit_savpath : str or None
        If provided as a str, indicates the path of the plot file that will be
        made for a plot showing the in-transit points and out-of-transit points
        tagged separately.

    sigclip : float or int or sequence of two floats/ints or None
        If a single float or int, a symmetric sigma-clip will be performed using
        the number provided as the sigma-multiplier to cut out from the input
        time-series.

        If a list of two ints/floats is provided, the function will perform an
        'asymmetric' sigma-clip. The first element in this list is the sigma
        value to use for fainter flux/mag values; the second element in this
        list is the sigma value to use for brighter flux/mag values. For
        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma
        dimmings and greater than 3-sigma brightenings. Here the meaning of
        "dimming" and "brightening" is set by *physics* (not the magnitude
        system), which is why the `magsarefluxes` kwarg must be correctly set.

        If `sigclip` is None, no sigma-clipping will be performed, and the
        time-series (with non-finite elems removed) will be passed through to
        the output.

    magsarefluxes : bool
        This is by default True for this function, since it works on fluxes only
        at the moment.

    nworkers : int
        The number of parallel BLS period-finder workers to use.

    extra_maskfrac : float
        This is the separation (N) from in-transit points you desire, in units
        of the transit duration. `extra_maskfrac = 0` if you just want points
        inside transit, otherwise::

            t_starts = t_Is - N*tdur, t_ends = t_IVs + N*tdur

        Thus setting N=0.03 masks slightly more than the guessed transit
        duration.

    Returns
    -------

    (times_oot, fluxes_oot, errs_oot) : tuple of np.array
        The `times`, `flux`, `err_flux` values from the input at the time values
        out-of-transit are returned.

    '''

    arg_10, arg_11, arg_12 = (
        given_lc_get_transit_tmids_tstarts_tends(
            arg_0, arg_1, arg_2, arg_3=arg_3,
            arg_4=arg_4, arg_7=arg_7,
            arg_8=arg_8, arg_6=arg_6, arg_9=arg_9
        )
    )

    arg_13 = np.zeros_like(arg_0).astype(bool)

    for arg_14, arg_15 in zip(arg_11, arg_12):

        arg_16 = ( (arg_0 > arg_14) & (arg_0 < arg_15) )

        arg_13 |= arg_16

    arg_17 = ~arg_13

    if arg_5:
        _in_out_transit_plot(arg_0, arg_1, arg_13, arg_17,
                             arg_5)

    return arg_0[arg_17], arg_1[arg_17], arg_2[arg_17]

This gets the out - of - transit light curve points .


def Func ( arg_0 ) : arg_1 = callBigDlFunc ( arg_0 . bigdl_type , "getOutputShape" , arg_0 . value ) return arg_0 . __process_shape ( arg_1 )

def Func(arg_0):
        """
        Return a list of shape tuples if there are multiple outputs.
        Return one shape tuple otherwise.
        """
        arg_1 = callBigDlFunc(arg_0.bigdl_type, "getOutputShape",
                               arg_0.value)
        return arg_0.__process_shape(arg_1)

Return a list of shape tuples if there are multiple outputs . Return one shape tuple otherwise .


def
Func
(
arg_0
,
arg_1
=
False
)
:
arg_2
=
dns
.
resolver
.
Resolver
(
)
arg_3
=
[
]
for
arg_4
in
arg_0
:
print_notification
(
"Resolving {}"
.
format
(
arg_4
)
)
try
:
arg_5
=
arg_2
.
query
(
arg_4
,
'A'
)
for
arg_6
in
arg_5
.
response
.
answer
[
0
]
:
arg_3
.
append
(
str
(
arg_6
)
)
if
not
arg_1
:
arg_3
.
extend
(
zone_transfer
(
str
(
arg_6
)
,
arg_4
)
)
except
dns
.
resolver
.
NXDOMAIN
as
e
:
print_error
(
e
)
return
arg_3

def Func(arg_0, arg_1=False):
    """
        Resolves the list of domains and returns the ips.
    """
    arg_2 = dns.resolver.Resolver()

    arg_3 = []

    for arg_4 in arg_0:
        print_notification("Resolving {}".format(arg_4))
        try:
            arg_5 = arg_2.query(arg_4, 'A')
            for arg_6 in arg_5.response.answer[0]:
                arg_3.append(str(arg_6))
                if not arg_1:
                    arg_3.extend(zone_transfer(str(arg_6), arg_4))
        except dns.resolver.NXDOMAIN as e:
            print_error(e)
    return arg_3

Resolves the list of domains and returns the ips .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
3
)
:
logger
.
debug
(
"Retrieve certificate with token."
)
arg_3
=
crypto
.
PKey
(
)
arg_3
.
generate_key
(
crypto
.
TYPE_RSA
,
2048
)
arg_4
=
crypto
.
dump_privatekey
(
crypto
.
FILETYPE_PEM
,
arg_3
)
.
decode
(
"utf-8"
)
arg_5
=
crypto
.
X509Req
(
)
arg_5
.
set_pubkey
(
arg_3
)
arg_5
.
sign
(
arg_3
,
'md5'
)
arg_6
=
crypto
.
dump_certificate_request
(
crypto
.
FILETYPE_ASN1
,
arg_5
)
arg_7
=
base64
.
b64encode
(
arg_6
)
arg_8
=
{
'access_token'
:
arg_1
,
'token_type'
:
'Bearer'
}
arg_9
=
OAuth2Session
(
arg_8
=
arg_8
)
arg_10
=
arg_9
.
post
(
arg_0
.
certificate_url
,
data
=
{
'certificate_request'
:
arg_7
}
,
verify
=
False
,
arg_2
=
arg_2
,
)
if
arg_10
.
ok
:
arg_11
=
"{} {}"
.
format
(
arg_10
.
text
,
arg_4
)
with
open
(
arg_0
.
esgf_credentials
,
'w'
)
as
fh
:
fh
.
write
(
arg_11
)
logger
.
debug
(
'Fetched certificate successfully.'
)
else
:
arg_12
=
"Could not get certificate: {} {}"
.
format
(
arg_10
.
status_code
,
arg_10
.
reason
)
raise
Exception
(
arg_12
)
return
True

def Func(arg_0, arg_1, arg_2=3):
        """
        Generates a new private key and certificate request, submits the request to be
        signed by the SLCS CA and returns the certificate.
        """
        logger.debug("Retrieve certificate with token.")

        # Generate a new key pair
        arg_3 = crypto.PKey()
        arg_3.generate_key(crypto.TYPE_RSA, 2048)
        arg_4 = crypto.dump_privatekey(crypto.FILETYPE_PEM, arg_3).decode("utf-8")

        # Generate a certificate request using that key-pair
        arg_5 = crypto.X509Req()

        # Create public key object
        arg_5.set_pubkey(arg_3)

        # Add the public key to the request
        arg_5.sign(arg_3, 'md5')
        arg_6 = crypto.dump_certificate_request(crypto.FILETYPE_ASN1, arg_5)

        arg_7 = base64.b64encode(arg_6)

        # Build the OAuth session object
        arg_8 = {'access_token': arg_1, 'token_type': 'Bearer'}
        arg_9 = OAuth2Session(arg_8=arg_8)

        arg_10 = arg_9.post(
            arg_0.certificate_url,
            data={'certificate_request': arg_7},
            verify=False,
            arg_2=arg_2,
        )

        if arg_10.ok:
            arg_11 = "{} {}".format(arg_10.text, arg_4)
            with open(arg_0.esgf_credentials, 'w') as fh:
                fh.write(arg_11)
            logger.debug('Fetched certificate successfully.')
        else:
            arg_12 = "Could not get certificate: {} {}".format(arg_10.status_code, arg_10.reason)
            raise Exception(arg_12)
        return True

Generates a new private key and certificate request submits the request to be signed by the SLCS CA and returns the certificate .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . _rows_in_grid [ arg_1 . row ] . xy arg_3 = arg_1 . index_of_first_consumed_mesh_in_row arg_4 = Point ( arg_2 . x + arg_3 , arg_2 . y ) return InstructionInGrid ( arg_1 , arg_4 )

def Func(arg_0, arg_1):
        """Returns an `InstructionInGrid` object for the `instruction`"""
        arg_2 = arg_0._rows_in_grid[arg_1.row].xy
        arg_3 = arg_1.index_of_first_consumed_mesh_in_row
        arg_4 = Point(arg_2.x + arg_3, arg_2.y)
        return InstructionInGrid(arg_1, arg_4)

Returns an InstructionInGrid object for the instruction


def Func(arg_0, arg_1, arg_2=False):
        """
        Executes a Sox command in a platform-independent manner.

        `cmd` must be a format string that includes {inputfile} and {outputfile}.
        """
        arg_3 = platform.system().lower() == "windows"

        # On Windows, a temporary file cannot be shared outside the process that creates it
        # so we need to create a "permanent" file that we will use and delete afterwards
        def _get_random_tmp_file():
            if arg_3:
                arg_4 = "".join(random.choice(string.ascii_uppercase + string.digits) for _ in range(8))
                arg_5 = arg_0.name + "_" + arg_4
                arg_6 = collections.namedtuple("WinTempFile", "name")
                arg_5 = arg_6(arg_5)
            else:
                arg_5 = tempfile.NamedTemporaryFile()
            return arg_5

        # Get a temp file to put our data and a temp file to store the result
        arg_5 = _get_random_tmp_file()
        arg_7 = _get_random_tmp_file()

        # Store our data in the temp file
        arg_0.export(arg_5.name, format="WAV")

        # Write the command to sox
        arg_8 = stderr = subprocess.PIPE if arg_2 else subprocess.DEVNULL
        arg_9 = arg_1.format(inputfile=arg_5.name, outputfile=arg_7.name)
        arg_10 = subprocess.call(arg_9.split(' '), arg_8=arg_8, stderr=stderr)
        assert arg_10 == 0, "Sox did not work as intended, or perhaps you don't have Sox installed?"

        # Create a new AudioSegment from the other temp file (where Sox put the result)
        arg_11 = AudioSegment(pydub.AudioSegment.from_wav(arg_7.name), arg_0.name)

        # Clean up the temp files
        if arg_3:
            os.remove(arg_5.name)
            os.remove(arg_7.name)
        else:
            arg_5.close()
            arg_7.close()

        return arg_11

Executes a Sox command in a platform - independent manner .


def Func(arg_0, arg_1, **arg_2):
        """Asserts that val is equal to other."""
        if arg_0._check_dict_like(arg_0.val, check_values=False, return_as_bool=True) and \
                arg_0._check_dict_like(arg_1, check_values=False, return_as_bool=True):
            if arg_0._dict_not_equal(arg_0.val, arg_1, ignore=arg_2.get('ignore'), include=arg_2.get('include')):
                arg_0._dict_err(arg_0.val, arg_1, ignore=arg_2.get('ignore'), include=arg_2.get('include'))
        else:
            if arg_0.val != arg_1:
                arg_0._err('Expected <%s> to be equal to <%s>, but was not.' % (arg_0.val, arg_1))
        return arg_0


def
Func
(
arg_0
)
:
arg_1
=
make_get_request
(
arg_0
,
'self'
)
if
arg_1
.
status_code
==
200
:
return
arg_1
.
json
(
)
[
'result'
]
[
'id'
]
else
:
raise
UserIdNotRetrievedException
(
'Error retrieving user id: %s'
%
arg_1
.
text
,
arg_1
.
text
)

def Func(arg_0):
    """
    Get the currently authenticated user ID
    """
    arg_1 = make_get_request(arg_0, 'self')
    if arg_1.status_code == 200:
        return arg_1.json()['result']['id']
    else:
        raise UserIdNotRetrievedException(
            'Error retrieving user id: %s' % arg_1.text, arg_1.text)


def Func(arg_0, **arg_1):
        """
        Get the Func for a particular movie id.

        Args:
            page: (optional) Minimum value of 1.  Expected value is an integer.
            language: (optional) ISO 639-1 code.
            append_to_response: (optional) Comma separated, any movie method.

        Returns:
            A dict representation of the JSON returned from the API.
        """
        arg_2 = arg_0._get_id_path('Func')

        arg_3 = arg_0._GET(arg_2, arg_1)
        arg_0._set_attrs_to_values(arg_3)
        return arg_3

Get the reviews for a particular movie id.

        Args:
            page: (optional) Minimum value of 1.  Expected value is an integer.
            language: (optional) ISO 639-1 code.
            append_to_response: (optional) Comma separated, any movie method.

        Returns:
            A dict representation of the JSON returned from the API.

Get the reviews for a particular movie id .


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

def Func(
    arg_0, arg_1, arg_2=True, arg_3='bond', arg_4=arg_5, arg_6=40
):
    """
    Helper function to compute percolation Func

    See Also
    --------

    canonical_averages

    microcanonical_averages

    sample_states

    """

    arg_7 = microcanonical_averages(
        arg_0=arg_0, arg_6=arg_6, arg_2=arg_2, arg_3=arg_3,
        arg_4=arg_4
    )

    arg_8 = microcanonical_averages_arrays(
        arg_7
    )

    return canonical_averages(arg_1, arg_8)

Helper function to compute percolation statistics

    See Also
    --------

    canonical_averages

    microcanonical_averages

    sample_states


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in arg_0 . _registry . values ( ) : for arg_3 in arg_2 . stats : if arg_3 not in arg_1 : arg_1 . append ( arg_3 ) return arg_1

def Func(arg_0):
        """
        Returns all of the active statistics for the gadgets currently registered.
        """
        arg_1 = []
        for arg_2 in arg_0._registry.values():
            for arg_3 in arg_2.stats:
                if arg_3 not in arg_1:
                    arg_1.append(arg_3)
        return arg_1

Returns all of the active statistics for the gadgets currently registered .


def Func ( arg_0 ) : if isinstance ( arg_0 . application , str ) : return util . import_app ( arg_0 . application ) else : return arg_0 . application

def Func(arg_0):
        """ Attempt an import of the specified application """

        if isinstance(arg_0.application, str):
            return util.import_app(arg_0.application)
        else:
            return arg_0.application


def
Func
(
arg_0
,
arg_1
,
arg_2
=
True
)
:
with
TemporaryDirectory
(
prefix
=
'airflow_pigop_'
)
as
tmp_dir
:
with
NamedTemporaryFile
(
dir
=
tmp_dir
)
as
f
:
f
.
write
(
arg_1
.
encode
(
'utf-8'
)
)
f
.
flush
(
)
arg_3
=
f
.
name
arg_4
=
'pig'
arg_5
=
[
]
arg_6
=
[
arg_4
,
'-f'
,
arg_3
]
+
arg_5
if
arg_0
.
pig_properties
:
arg_7
=
arg_0
.
pig_properties
.
split
(
)
arg_6
.
extend
(
arg_7
)
if
arg_2
:
arg_0
.
log
.
info
(
"%s"
,
" "
.
join
(
arg_6
)
)
arg_8
=
subprocess
.
Popen
(
arg_6
,
arg_9
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
cwd
=
tmp_dir
,
close_fds
=
True
)
arg_0
.
sp
=
arg_8
arg_9
=
''
for
arg_10
in
iter
(
arg_8
.
stdout
.
readline
,
b''
)
:
arg_9
+=
arg_10
.
decode
(
'utf-8'
)
if
arg_2
:
arg_0
.
log
.
info
(
arg_10
.
strip
(
)
)
arg_8
.
wait
(
)
if
arg_8
.
returncode
:
raise
AirflowException
(
arg_9
)
return
arg_9

def Func(arg_0, arg_1, arg_2=True):
        """
        Run an pig script using the pig cli

        >>> ph = PigCliHook()
        >>> result = ph.Func("ls /;")
        >>> ("hdfs://" in result)
        True
        """

        with TemporaryDirectory(prefix='airflow_pigop_') as tmp_dir:
            with NamedTemporaryFile(dir=tmp_dir) as f:
                f.write(arg_1.encode('utf-8'))
                f.flush()
                arg_3 = f.name
                arg_4 = 'pig'
                arg_5 = []

                arg_6 = [arg_4, '-f', arg_3] + arg_5

                if arg_0.pig_properties:
                    arg_7 = arg_0.pig_properties.split()
                    arg_6.extend(arg_7)
                if arg_2:
                    arg_0.log.info("%s", " ".join(arg_6))
                arg_8 = subprocess.Popen(
                    arg_6,
                    arg_9=subprocess.PIPE,
                    stderr=subprocess.STDOUT,
                    cwd=tmp_dir,
                    close_fds=True)
                arg_0.sp = arg_8
                arg_9 = ''
                for arg_10 in iter(arg_8.stdout.readline, b''):
                    arg_9 += arg_10.decode('utf-8')
                    if arg_2:
                        arg_0.log.info(arg_10.strip())
                arg_8.wait()

                if arg_8.returncode:
                    raise AirflowException(arg_9)

                return arg_9

Run an pig script using the pig cli

        >>> ph = PigCliHook()
        >>> result = ph.run_cli("ls /;")
        >>> ("hdfs://" in result)
        True


return {
            "template": "main::collection.html",
            "current_label": collection.get_label(lang),
            "collections": {
                "members": self.make_members(collection, lang=lang)
            }
        }

def Func ( arg_0 , arg_1 = None ) : arg_2 = arg_0 . resolver . getMetadata ( ) return { "template" : "main::collection.html" , "current_label" : arg_2 . get_label ( arg_1 ) , "collections" : { "members" : arg_0 . make_members ( arg_2 , arg_1 = arg_1 ) } }

def Func(arg_0, arg_1=None):
        """ Retrieve the top collections of the inventory

        :param lang: Lang in which to express main data
        :type lang: str
        :return: Collections information and template
        :rtype: {str: Any}
        """
        arg_2 = arg_0.resolver.getMetadata()
        return {
            "template": "main::collection.html",
            "current_label": arg_2.get_label(arg_1),
            "collections": {
                "members": arg_0.make_members(arg_2, arg_1=arg_1)
            }
        }


def Func ( arg_0 , arg_1 , ** arg_2 ) : check . str_param ( arg_1 , 'msg' ) check . subclass_param ( arg_0 , 'error_cls' , DagsterUserCodeExecutionError ) try : yield except Exception as e : if isinstance ( e , DagsterError ) : raise e else : raise_from ( arg_0 ( arg_1 , user_exception = e , original_exc_info = sys . exc_info ( ) , ** arg_2 ) , e )

def Func(arg_0, arg_1, **arg_2):
    '''
    Wraps the execution of user-space code in an error boundary. This places a uniform
    policy around an user code invoked by the framework. This ensures that all user
    errors are wrapped in the DagsterUserCodeExecutionError, and that the original stack
    trace of the user error is preserved, so that it can be reported without confusing
    framework code in the stack trace, if a tool author wishes to do so. This has
    been especially help in a notebooking context.
    '''
    check.str_param(arg_1, 'msg')
    check.subclass_param(arg_0, 'error_cls', DagsterUserCodeExecutionError)

    try:
        yield
    except Exception as e:  # pylint: disable=W0703
        if isinstance(e, DagsterError):
            # The system has thrown an error that is part of the user-framework contract
            raise e
        else:
            # An exception has been thrown by user code and computation should cease
            # with the error reported further up the stack
            raise_from(
                arg_0(arg_1, user_exception=e, original_exc_info=sys.exc_info(), **arg_2), e
            )

Wraps the execution of user - space code in an error boundary . This places a uniform policy around an user code invoked by the framework . This ensures that all user errors are wrapped in the DagsterUserCodeExecutionError and that the original stack trace of the user error is preserved so that it can be reported without confusing framework code in the stack trace if a tool author wishes to do so . This has been especially help in a notebooking context .


def Func(arg_0=None, arg_1=None):
    """Validate and return zoom levels."""
    arg_0 = _validate_zooms(arg_0)
    if arg_1 is None:
        return arg_0
    else:
        arg_1 = _validate_zooms(arg_1)
        if not set(arg_1).issubset(set(arg_0)):
            raise MapcheteConfigError(
                "init zooms must be a subset of process zoom")
        return arg_1


(self, datacenter_id, server_id,
                             nic_id, firewall_rule_id)

def Func(arg_0, arg_1, arg_2,
                             arg_3, arg_4):
        """
        Removes a firewall rule from the NIC.

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

        :param      server_id: The unique ID of the server.
        :type       server_id: ``str``

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

        :param      firewall_rule_id: The unique ID of the firewall rule.
        :type       firewall_rule_id: ``str``

        """
        arg_5 = arg_0._perform_request(
            url='/datacenters/%s/servers/%s/nics/%s/firewallrules/%s' % (
                arg_1,
                arg_2,
                arg_3,
                arg_4),
            method='DELETE')

        return arg_5


def Func ( arg_0 , arg_1 ) : arg_2 = inspect . getmodule ( arg_1 ) arg_3 = ( arg_2 in arg_0 . _valid_modules or ( hasattr ( arg_2 , '__file__' ) and arg_2 . __file__ in arg_0 . _valid_named_modules ) ) return arg_3 and not private ( arg_1 )

def Func(arg_0, arg_1):
        """
        Needs to be its own method so it can be called from both wantClass and
        registerGoodClass.
        """
        arg_2 = inspect.getmodule(arg_1)
        arg_3 = (
            arg_2 in arg_0._valid_modules
            or (
                hasattr(arg_2, '__file__')
                and arg_2.__file__ in arg_0._valid_named_modules
            )
        )
        return arg_3 and not private(arg_1)

Needs to be its own method so it can be called from both wantClass and registerGoodClass .


def Func ( arg_0 , arg_1 , arg_2 = None ) : for arg_3 in arg_0 : if arg_2 and arg_3 . get ( arg_1 ) == arg_2 : return arg_3 if not arg_2 and arg_3 . get ( arg_1 ) : return arg_3 return None

def Func(arg_0, arg_1, arg_2=None):
    """Check if specific message is present.

    Parameters
    ----------
    cmd : string
        Command to check for in bytestring from microscope CAM interface. If
        ``value`` is falsey, value of received command does not matter.
    value : string
        Check if ``cmd:value`` is received.

    Returns
    -------
    collections.OrderedDict
        Correct messsage or None if no correct message if found.

    """
    for arg_3 in arg_0:
        if arg_2 and arg_3.get(arg_1) == arg_2:
            return arg_3
        if not arg_2 and arg_3.get(arg_1):
            return arg_3
    return None


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] for arg_3 in arg_1 : if hasattr ( arg_3 , '_fields' ) : for arg_4 in arg_3 . _fields : arg_2 . extend ( [ arg_4 , _to_str ( getattr ( arg_3 , arg_4 ) ) ] ) continue if isinstance ( arg_3 , ( list , tuple ) ) : for arg_5 in arg_3 : arg_2 . append ( _to_str ( arg_5 ) ) continue arg_2 . append ( _to_str ( arg_3 ) ) return tf . compat . v1 . Print ( arg_0 , arg_2 )

def Func(arg_0, arg_1):
  """Wrapper for tf.Print which supports lists and namedtuples for printing."""
  arg_2 = []
  for arg_3 in arg_1:
    # Checks if it is a namedtuple.
    if hasattr(arg_3, '_fields'):
      for arg_4 in arg_3._fields:
        arg_2.extend([arg_4, _to_str(getattr(arg_3, arg_4))])
      continue
    if isinstance(arg_3, (list, tuple)):
      for arg_5 in arg_3:
        arg_2.append(_to_str(arg_5))
      continue
    arg_2.append(_to_str(arg_3))
  return tf.compat.v1.Print(arg_0, arg_2)

Wrapper for tf . Print which supports lists and namedtuples for printing .


return lobj.lrepr(
        o,
        human_readable=human_readable,
        print_dup=core_ns.find(sym.symbol(_PRINT_DUP_VAR_NAME)).value,  # type: ignore
        print_length=core_ns.find(  # type: ignore
            sym.symbol(_PRINT_LENGTH_VAR_NAME)
        ).value,
        print_level=core_ns.find(  # type: ignore
            sym.symbol(_PRINT_LEVEL_VAR_NAME)
        ).value,
        print_meta=core_ns.find(sym.symbol(_PRINT_META_VAR_NAME)).value,  # type: ignore
        print_readably=core_ns.find(  # type: ignore
            sym.symbol(_PRINT_READABLY_VAR_NAME)
        ).value,
    )

def Func ( arg_0 , arg_1 : arg_2 = False ) -> str : arg_3 = Namespace . get ( sym . symbol ( CORE_NS ) ) assert arg_3 is not None return lobj . Func ( arg_0 , arg_1 = arg_1 , print_dup = arg_3 . find ( sym . symbol ( _PRINT_DUP_VAR_NAME ) ) . value , print_length = arg_3 . find ( sym . symbol ( _PRINT_LENGTH_VAR_NAME ) ) . value , print_level = arg_3 . find ( sym . symbol ( _PRINT_LEVEL_VAR_NAME ) ) . value , print_meta = arg_3 . find ( sym . symbol ( _PRINT_META_VAR_NAME ) ) . value , print_readably = arg_3 . find ( sym . symbol ( _PRINT_READABLY_VAR_NAME ) ) . value , )

def Func(arg_0, arg_1: arg_2 = False) -> str:
    """Produce a string representation of an object. If human_readable is False,
    the string representation of Lisp objects is something that can be read back
    in by the reader as the same object."""
    arg_3 = Namespace.get(sym.symbol(CORE_NS))
    assert arg_3 is not None
    return lobj.Func(
        arg_0,
        arg_1=arg_1,
        print_dup=arg_3.find(sym.symbol(_PRINT_DUP_VAR_NAME)).value,  # type: ignore
        print_length=arg_3.find(  # type: ignore
            sym.symbol(_PRINT_LENGTH_VAR_NAME)
        ).value,
        print_level=arg_3.find(  # type: ignore
            sym.symbol(_PRINT_LEVEL_VAR_NAME)
        ).value,
        print_meta=arg_3.find(sym.symbol(_PRINT_META_VAR_NAME)).value,  # type: ignore
        print_readably=arg_3.find(  # type: ignore
            sym.symbol(_PRINT_READABLY_VAR_NAME)
        ).value,
    )

Produce a string representation of an object . If human_readable is False the string representation of Lisp objects is something that can be read back in by the reader as the same object .


def Func ( arg_0 ) : try : arg_1 = 0xFFFFFFFF - _dot_to_dec ( arg_0 , check = True ) except ValueError : return False if arg_1 in _NETMASKS_VALUES : return True return False

def Func(arg_0):
    """Return true if the netmask is in wildcard bits notatation."""
    try:
        arg_1 = 0xFFFFFFFF - _dot_to_dec(arg_0, check=True)
    except ValueError:
        return False
    if arg_1 in _NETMASKS_VALUES:
        return True
    return False

Return true if the netmask is in wildcard bits notatation .


return self._compute_http_digest_a1(realm, user_name, password)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = arg_0 . _get_realm_entry ( arg_1 , arg_2 ) if arg_4 is None : return False arg_5 = arg_4 . get ( "password" ) arg_3 [ "wsgidav.auth.roles" ] = arg_4 . get ( "roles" , [ ] ) return arg_0 . _compute_http_digest_a1 ( arg_1 , arg_2 , arg_5 )

def Func(arg_0, arg_1, arg_2, arg_3):
        """Computes digest hash A1 part."""
        arg_4 = arg_0._get_realm_entry(arg_1, arg_2)
        if arg_4 is None:
            return False
        arg_5 = arg_4.get("password")
        arg_3["wsgidav.auth.roles"] = arg_4.get("roles", [])
        return arg_0._compute_http_digest_a1(arg_1, arg_2, arg_5)


(self, effect, verb, resource, conditions)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
)
:
if
arg_2
!=
'*'
and
not
hasattr
(
HttpVerb
,
arg_2
)
:
raise
NameError
(
'Invalid HTTP verb '
+
arg_2
+
'. Allowed verbs in HttpVerb class'
)
arg_5
=
re
.
compile
(
arg_0
.
path_regex
)
if
not
arg_5
.
match
(
arg_3
)
:
raise
NameError
(
'Invalid resource path: '
+
arg_3
+
'. Path should match '
+
arg_0
.
path_regex
)
if
arg_3
[
:
1
]
==
'/'
:
arg_3
=
arg_3
[
1
:
]
arg_6
=
(
'arn:aws:execute-api:'
+
arg_0
.
region
+
':'
+
arg_0
.
aws_account_id
+
':'
+
arg_0
.
rest_api_id
+
'/'
+
arg_0
.
stage
+
'/'
+
arg_2
+
'/'
+
arg_3
)
if
arg_1
.
lower
(
)
==
'allow'
:
arg_0
.
allowMethods
.
append
(
{
'resource_arn'
:
arg_6
,
'conditions'
:
arg_4
}
)
elif
arg_1
.
lower
(
)
==
'deny'
:
arg_0
.
denyMethods
.
append
(
{
'resource_arn'
:
arg_6
,
'conditions'
:
arg_4
}
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """
        Adds a method to the internal lists of allowed or denied methods.
        Each object in the internal list contains a resource ARN and a
        condition statement. The condition statement can be null.
        """
        if arg_2 != '*' and not hasattr(HttpVerb, arg_2):
            raise NameError('Invalid HTTP verb ' + arg_2 +
                            '. Allowed verbs in HttpVerb class')
        arg_5 = re.compile(arg_0.path_regex)
        if not arg_5.match(arg_3):
            raise NameError('Invalid resource path: ' + arg_3 +
                            '. Path should match ' + arg_0.path_regex)

        if arg_3[:1] == '/':
            arg_3 = arg_3[1:]

        arg_6 = ('arn:aws:execute-api:' +
                        arg_0.region + ':' +
                        arg_0.aws_account_id + ':' +
                        arg_0.rest_api_id + '/' +
                        arg_0.stage + '/' +
                        arg_2 + '/' +
                        arg_3)

        if arg_1.lower() == 'allow':
            arg_0.allowMethods.append({
                'resource_arn': arg_6,
                'conditions': arg_4
            })
        elif arg_1.lower() == 'deny':
            arg_0.denyMethods.append({
                'resource_arn': arg_6,
                'conditions': arg_4
            })

Adds a method to the internal lists of allowed or denied methods . Each object in the internal list contains a resource ARN and a condition statement . The condition statement can be null .


def Func(arg_0, arg_1):
        """Returns the integer id of a word string."""
        if arg_1 in arg_0._vocab:
            return arg_0._vocab[arg_1]
        else:
            return arg_0._unk_id

Returns the integer id of a word string .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 . pop ( '()' ) if not hasattr ( arg_2 , '__call__' ) and hasattr ( types , 'ClassType' ) and isinstance ( arg_2 , types . ClassType ) : arg_2 = arg_0 . resolve ( arg_2 ) arg_3 = arg_1 . pop ( '.' , None ) arg_4 = dict ( ( k , arg_1 [ k ] ) for k in arg_1 if valid_ident ( k ) ) arg_5 = arg_2 ( ** arg_4 ) if arg_3 : for arg_6 , arg_7 in arg_3 . items ( ) : setattr ( arg_5 , arg_6 , arg_7 ) return arg_5

def Func(arg_0, arg_1):
        """Configure an object with a user-supplied factory."""
        arg_2 = arg_1.pop('()')
        if not hasattr(arg_2, '__call__') and \
                hasattr(types, 'ClassType') and isinstance(arg_2, types.ClassType):
            arg_2 = arg_0.resolve(arg_2)
        arg_3 = arg_1.pop('.', None)
        # Check for valid identifiers
        arg_4 = dict((k, arg_1[k]) for k in arg_1 if valid_ident(k))
        arg_5 = arg_2(**arg_4)
        if arg_3:
            for arg_6, arg_7 in arg_3.items():
                setattr(arg_5, arg_6, arg_7)
        return arg_5

Configure an object with a user - supplied factory .


return max(1,
                   int(math.ceil(1.0 * to_send_count / self._sync_parallelism)))

def Func ( arg_0 , arg_1 ) : return max ( 1 , int ( math . ceil ( 1.0 * arg_1 / arg_0 . _sync_parallelism ) ) )

def Func(arg_0, arg_1):
        """
        How many Celery tasks should each worker process send.

        :return: Number of tasks that should be sent per process
        :rtype: int
        """
        return max(1,
                   int(math.ceil(1.0 * arg_1 / arg_0._sync_parallelism)))

How many Celery tasks should each worker process send .


def Func(arg_0):
        """
        Copy registers and written memory back into Manticore
        """
        arg_0.write_backs_disabled = True
        for arg_2 in arg_0.registers:
            arg_3 = arg_0._emu.reg_read(arg_0._to_unicorn_id(arg_2))
            arg_0._cpu.write_register(arg_2, arg_3)
        if len(arg_0._mem_delta) > 0:
            logger.debug(f"Syncing {len(self._mem_delta)} writes back into Manticore")
        for arg_4 in arg_0._mem_delta:
            arg_5, arg_6 = arg_0._mem_delta[arg_4]
            arg_0._cpu.write_int(arg_4, arg_5, arg_6 * 8)
        arg_0.write_backs_disabled = False
        arg_0._mem_delta = {}


def Func ( arg_0 ) : arg_1 = _Validator ( schemas . pin ) if arg_1 . validate ( arg_0 ) : return else : raise schemas . DocumentError ( errors = arg_1 . errors )

def Func(arg_0):
    """ Validate the given pin against the schema.

    :param dict pin: The pin to validate:
    :raises pypebbleapi.schemas.DocumentError: If the pin is not valid.
    """
    arg_1 = _Validator(schemas.pin)
    if arg_1.validate(arg_0):
        return
    else:
        raise schemas.DocumentError(errors=arg_1.errors)

Validate the given pin against the schema .


def Func(arg_0, arg_1, arg_2=None):
        """
        get file information dict from the repository given its relative path and name.

        :Parameters:
            #. relativePath (string): The relative to the repository path of the directory where the file is.
            #. name (string): The file name.
               If None is given, name will be split from relativePath.

        :Returns:
            #. info (None, dictionary): The file information dictionary.
               If None, it means an error has occurred.
            #. errorMessage (string): The error message if any error occurred.
        """
        # normalize relative path and name
        arg_1 = os.path.normpath(arg_1)
        if arg_1 == '.':
            arg_1 = ''
            assert arg_2 != '.pyrepinfo', "'.pyrepinfo' can't be a file name."
        if arg_2 is None:
            assert len(arg_1), "name must be given when relative path is given as empty string or as a simple dot '.'"
            arg_1,arg_2 = os.path.split(arg_1)
        # initialize message
        arg_3 = ""
        # get directory info
        arg_4, arg_3 = arg_0.get_directory_info(arg_1)
        if arg_4 is None:
            return None, arg_3
        # get file info
        arg_5 = dict.__getitem__(arg_4, "files").get(arg_2, None)
        if arg_5 is None:
            arg_3 = "file %s does not exist in relative path '%s'"%(arg_2, arg_1)
        return arg_5, arg_3

get file information dict from the repository given its relative path and name .


def
Func
(
arg_0
=
''
)
:
arg_1
=
simplesoapy
.
Func
(
arg_0
,
as_string
=
True
)
arg_2
=
[
]
arg_2
.
append
(
'Detected SoapySDR devices:'
)
if
arg_1
:
for
arg_3
,
arg_4
in
enumerate
(
arg_1
)
:
arg_2
.
append
(
'  {}'
.
format
(
arg_4
)
)
else
:
arg_2
.
append
(
'  No devices found!'
)
return
(
arg_1
,
'\n'
.
join
(
arg_2
)
)

def Func(arg_0=''):
    """Returns detected SoapySDR devices"""
    arg_1 = simplesoapy.Func(arg_0, as_string=True)
    arg_2 = []
    arg_2.append('Detected SoapySDR devices:')
    if arg_1:
        for arg_3, arg_4 in enumerate(arg_1):
            arg_2.append('  {}'.format(arg_4))
    else:
        arg_2.append('  No devices found!')
    return (arg_1, '\n'.join(arg_2))


Overrides construct_formset to attach the model class as
        an attribute of the returned formset instance.

def Func ( arg_0 ) : arg_1 = super ( InlineFormSetFactory , arg_0 ) . Func ( ) arg_1 . model = arg_0 . inline_model return arg_1

def Func(arg_0):
        """
        Overrides Func to attach the model class as
        an attribute of the returned formset instance.
        """
        arg_1 = super(InlineFormSetFactory, arg_0).Func()
        arg_1.model = arg_0.inline_model
        return arg_1

Overrides construct_formset to attach the model class as an attribute of the returned formset instance .


def Func(arg_0):
        """
        Obtain the number of secret bits of the currently used cipher.

        :returns: The number of secret bits of the currently used cipher
            or :obj:`None` if no connection has been established.
        :rtype: :class:`int` or :class:`NoneType`

        .. versionadded:: 0.15
        """
        arg_1 = _lib.SSL_get_current_cipher(arg_0._ssl)
        if arg_1 == _ffi.NULL:
            return None
        else:
            return _lib.SSL_CIPHER_get_bits(arg_1, _ffi.NULL)

Obtain the number of secret bits of the currently used cipher .


(u, from_date, with_json=True, latest_only=False, **kwargs)

return dict(id=u.id, method=u.method, id_user=u.id_user)

def Func ( arg_0 , arg_1 , arg_2 = True , arg_3 = False , ** arg_4 ) : return dict ( id = arg_0 . id , method = arg_0 . method , id_user = arg_0 . id_user )

def Func(arg_0, arg_1, arg_2=True, arg_3=False, **arg_4):
    """Dump the UserEXt objects as a list of dictionaries.

    :param u: UserEXT to be Funced.
    :type u: `invenio_accounts.models.UserEXT [Invenio2.x]`
    :returns: User serialized to dictionary.
    :rtype: dict
    """
    return dict(id=arg_0.id, method=arg_0.method, id_user=arg_0.id_user)

Dump the UserEXt objects as a list of dictionaries.

    :param u: UserEXT to be dumped.
    :type u: `invenio_accounts.models.UserEXT [Invenio2.x]`
    :returns: User serialized to dictionary.
    :rtype: dict

Dump the UserEXt objects as a list of dictionaries .


def Func(arg_0, arg_1):
        """Returns the official Clinvar submission ID for a submission object

            Args:
                submission_id(str): submission_id(str) : id of the submission

            Returns:
                clinvar_subm_id(str): a string with a format: SUB[0-9]. It is obtained from clinvar portal when starting a new submission

        """
        arg_2 = arg_0.clinvar_submission_collection.find_one({'_id': ObjectId(arg_1)})
        arg_3 = arg_2.get('clinvar_subm_id') # This key does not exist if it was not previously provided by user
        return arg_3


Configure and return a new logger for hivy modules

(name=__name__, output=None, uuid=False, timestamp=False)

return structlog.wrap_logger(
        logbook.Logger(name),
        processors=processors
    )

def Func ( arg_0 = arg_1 , arg_2 = None , arg_3 = False , arg_4 = False ) : arg_5 = [ ] if arg_2 == 'json' : arg_5 . append ( structlog . processors . JSONRenderer ( ) ) if arg_3 : arg_5 . append ( add_unique_id ) if arg_3 : arg_5 . append ( add_timestamp ) return structlog . wrap_Func ( logbook . Logger ( arg_0 ) , arg_5 = arg_5 )

def Func(arg_0=arg_1, arg_2=None, arg_3=False, arg_4=False):
    ''' Configure and return a new Func for hivy modules '''
    arg_5 = []
    if arg_2 == 'json':
        arg_5.append(structlog.processors.JSONRenderer())

    if arg_3:
        arg_5.append(add_unique_id)
    if arg_3:
        arg_5.append(add_timestamp)
    return structlog.wrap_Func(
        logbook.Logger(arg_0),
        arg_5=arg_5
    )


(self,
                   derivation_method,
                   derivation_length,
                   derivation_data=None,
                   key_material=None,
                   hash_algorithm=None,
                   salt=None,
                   iteration_count=None,
                   encryption_algorithm=None,
                   cipher_mode=None,
                   padding_method=None,
                   iv_nonce=None)

def Func(arg_0,
                   arg_1,
                   arg_2,
                   arg_3=None,
                   arg_4=None,
                   arg_5=None,
                   arg_6=None,
                   arg_7=None,
                   arg_8=None,
                   arg_9=None,
                   arg_10=None,
                   arg_11=None):
        """
        Derive key data using a variety of key derivation functions.

        Args:
            derivation_method (DerivationMethod): An enumeration specifying
                the key derivation method to use. Required.
            derivation_length (int): An integer specifying the size of the
                derived key data in bytes. Required.
            derivation_data (bytes): The non-cryptographic bytes to be used
                in the key derivation process (e.g., the data to be encrypted,
                hashed, HMACed). Required in the general case. Optional if the
                derivation method is Hash and the key material is provided.
                Optional, defaults to None.
            key_material (bytes): The bytes of the key material to use for
                key derivation. Required in the general case. Optional if
                the derivation_method is HASH and derivation_data is provided.
                Optional, defaults to None.
            hash_algorithm (HashingAlgorithm): An enumeration specifying the
                hashing algorithm to use with the key derivation method.
                Required in the general case, optional if the derivation
                method specifies encryption. Optional, defaults to None.
            salt (bytes): Bytes representing a randomly generated salt.
                Required if the derivation method is PBKDF2. Optional,
                defaults to None.
            iteration_count (int): An integer representing the number of
                iterations to use when deriving key material. Required if
                the derivation method is PBKDF2. Optional, defaults to None.
            encryption_algorithm (CryptographicAlgorithm): An enumeration
                specifying the symmetric encryption algorithm to use for
                encryption-based key derivation. Required if the derivation
                method specifies encryption. Optional, defaults to None.
            cipher_mode (BlockCipherMode): An enumeration specifying the
                block cipher mode to use with the encryption algorithm.
                Required in in the general case if the derivation method
                specifies encryption and the encryption algorithm is
                specified. Optional if the encryption algorithm is RC4 (aka
                ARC4). Optional, defaults to None.
            padding_method (PaddingMethod): An enumeration specifying the
                padding method to use on the data before encryption. Required
                in in the general case if the derivation method specifies
                encryption and the encryption algorithm is specified. Required
                if the cipher mode is for block ciphers (e.g., CBC, ECB).
                Optional otherwise, defaults to None.
            iv_nonce (bytes): The IV/nonce value to use to initialize the mode
                of the encryption algorithm. Required in the general case if
                the derivation method specifies encryption and the encryption
                algorithm is specified. Optional, defaults to None. If
                required and not provided, it will be autogenerated.

        Returns:
            bytes: the bytes of the derived data

        Raises:
            InvalidField: Raised when cryptographic data and/or settings are
                unsupported or incompatible with the derivation method.

        Example:
            >>> engine = CryptographyEngine()
            >>> result = engine.Func(
            ...     derivation_method=enums.DerivationMethod.HASH,
            ...     derivation_length=16,
            ...     derivation_data=b'abc',
            ...     hash_algorithm=enums.HashingAlgorithm.MD5
            ... )
            >>> result
            b'\x90\x01P\x98<\xd2O\xb0\xd6\x96?}(\xe1\x7fr'
        """
        if arg_1 == enums.DerivationMethod.ENCRYPT:
            arg_12 = arg_0.encrypt(
                arg_8=arg_8,
                encryption_key=arg_4,
                plain_text=arg_3,
                arg_9=arg_9,
                arg_10=arg_10,
                arg_11=arg_11
            )
            return arg_12.get('cipher_text')
        else:
            # Handle key derivation functions that use hash algorithms

            # Set up the hashing algorithm
            if arg_5 is None:
                raise exceptions.InvalidField("Hash algorithm is required.")
            arg_13 = arg_0._encryption_hash_algorithms.get(
                arg_5,
                None
            )
            if arg_13 is None:
                raise exceptions.InvalidField(
                    "Hash algorithm '{0}' is not a supported hashing "
                    "algorithm.".format(arg_5)
                )

            if arg_1 == enums.DerivationMethod.HMAC:
                arg_14 = hkdf.HKDF(
                    algorithm=arg_13(),
                    length=arg_2,
                    arg_6=arg_6,
                    info=arg_3,
                    backend=default_backend()
                )
                arg_15 = arg_14.derive(arg_4)
                return arg_15
            elif arg_1 == enums.DerivationMethod.HASH:
                if None not in [arg_3, arg_4]:
                    raise exceptions.InvalidField(
                        "For hash-based key derivation, specify only "
                        "derivation data or key material, not both."
                    )
                elif arg_3 is not None:
                    arg_16 = arg_3
                elif arg_4 is not None:
                    arg_16 = arg_4
                else:
                    raise exceptions.InvalidField(
                        "For hash-based key derivation, derivation data or "
                        "key material must be specified."
                    )

                arg_14 = hashes.Hash(
                    algorithm=arg_13(),
                    backend=default_backend()
                )
                arg_14.update(arg_16)
                arg_15 = arg_14.finalize()
                return arg_15
            elif arg_1 == enums.DerivationMethod.PBKDF2:
                if arg_6 is None:
                    raise exceptions.InvalidField(
                        "For PBKDF2 key derivation, salt must be specified."
                    )
                if arg_7 is None:
                    raise exceptions.InvalidField(
                        "For PBKDF2 key derivation, iteration count must be "
                        "specified."
                    )

                arg_14 = pbkdf2.PBKDF2HMAC(
                    algorithm=arg_13(),
                    length=arg_2,
                    arg_6=arg_6,
                    iterations=arg_7,
                    backend=default_backend()
                )
                arg_15 = arg_14.derive(arg_4)
                return arg_15
            elif arg_1 == enums.DerivationMethod.NIST800_108_C:
                arg_14 = kbkdf.KBKDFHMAC(
                    algorithm=arg_13(),
                    mode=kbkdf.Mode.CounterMode,
                    length=arg_2,
                    rlen=4,
                    llen=None,
                    location=kbkdf.CounterLocation.BeforeFixed,
                    label=None,
                    context=None,
                    fixed=arg_3,
                    backend=default_backend()
                )
                arg_15 = arg_14.derive(arg_4)
                return arg_15
            else:
                raise exceptions.InvalidField(
                    "Derivation method '{0}' is not a supported key "
                    "derivation method.".format(arg_1)
                )

Derive key data using a variety of key derivation functions.

        Args:
            derivation_method (DerivationMethod): An enumeration specifying
                the key derivation method to use. Required.
            derivation_length (int): An integer specifying the size of the
                derived key data in bytes. Required.
            derivation_data (bytes): The non-cryptographic bytes to be used
                in the key derivation process (e.g., the data to be encrypted,
                hashed, HMACed). Required in the general case. Optional if the
                derivation method is Hash and the key material is provided.
                Optional, defaults to None.
            key_material (bytes): The bytes of the key material to use for
                key derivation. Required in the general case. Optional if
                the derivation_method is HASH and derivation_data is provided.
                Optional, defaults to None.
            hash_algorithm (HashingAlgorithm): An enumeration specifying the
                hashing algorithm to use with the key derivation method.
                Required in the general case, optional if the derivation
                method specifies encryption. Optional, defaults to None.
            salt (bytes): Bytes representing a randomly generated salt.
                Required if the derivation method is PBKDF2. Optional,
                defaults to None.
            iteration_count (int): An integer representing the number of
                iterations to use when deriving key material. Required if
                the derivation method is PBKDF2. Optional, defaults to None.
            encryption_algorithm (CryptographicAlgorithm): An enumeration
                specifying the symmetric encryption algorithm to use for
                encryption-based key derivation. Required if the derivation
                method specifies encryption. Optional, defaults to None.
            cipher_mode (BlockCipherMode): An enumeration specifying the
                block cipher mode to use with the encryption algorithm.
                Required in in the general case if the derivation method
                specifies encryption and the encryption algorithm is
                specified. Optional if the encryption algorithm is RC4 (aka
                ARC4). Optional, defaults to None.
            padding_method (PaddingMethod): An enumeration specifying the
                padding method to use on the data before encryption. Required
                in in the general case if the derivation method specifies
                encryption and the encryption algorithm is specified. Required
                if the cipher mode is for block ciphers (e.g., CBC, ECB).
                Optional otherwise, defaults to None.
            iv_nonce (bytes): The IV/nonce value to use to initialize the mode
                of the encryption algorithm. Required in the general case if
                the derivation method specifies encryption and the encryption
                algorithm is specified. Optional, defaults to None. If
                required and not provided, it will be autogenerated.

        Returns:
            bytes: the bytes of the derived data

        Raises:
            InvalidField: Raised when cryptographic data and/or settings are
                unsupported or incompatible with the derivation method.

        Example:
            >>> engine = CryptographyEngine()
            >>> result = engine.derive_key(
            ...     derivation_method=enums.DerivationMethod.HASH,
            ...     derivation_length=16,
            ...     derivation_data=b'abc',
            ...     hash_algorithm=enums.HashingAlgorithm.MD5
            ... )
            >>> result
            b'\x90\x01P\x98<\xd2O\xb0\xd6\x96?}(\xe1\x7fr'

Derive key data using a variety of key derivation functions .


return {
            'elapsed': job['elapsed'],
            'failed': job['failed'],
            'status': job['status'],
        }

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
False
,
**
arg_3
)
:
arg_0
.
_pop_none
(
arg_3
)
if
not
arg_1
:
arg_4
=
arg_0
.
get
(
include_debug_header
=
True
,
**
arg_3
)
else
:
debug
.
log
(
'Asking for job Func.'
,
header
=
'details'
)
arg_5
=
'%s%s/'
%
(
arg_0
.
endpoint
,
arg_1
)
arg_4
=
client
.
get
(
arg_5
)
.
json
(
)
if
arg_2
:
return
arg_4
return
{
'elapsed'
:
arg_4
[
'elapsed'
]
,
'failed'
:
arg_4
[
'failed'
]
,
'Func'
:
arg_4
[
'Func'
]
,
}

def Func(arg_0, arg_1=None, arg_2=False, **arg_3):
        """Print the current job Func. This is used to check a running job. You can look up the job with
        the same parameters used for a get request.

        =====API DOCS=====
        Retrieve the current job Func.

        :param pk: Primary key of the resource to retrieve Func from.
        :type pk: int
        :param detail: Flag that if set, return the full JSON of the job resource rather than a Func summary.
        :type detail: bool
        :param `**kwargs`: Keyword arguments used to look up resource object to retrieve Func from if ``pk``
                           is not provided.
        :returns: full loaded JSON of the specified unified job if ``detail`` flag is on; trimed JSON containing
                  only "elapsed", "failed" and "Func" fields of the unified job if ``detail`` flag is off.
        :rtype: dict

        =====API DOCS=====
        """
        # Remove default values (anything where the value is None).
        arg_0._pop_none(arg_3)

        # Search for the record if pk not given
        if not arg_1:
            arg_4 = arg_0.get(include_debug_header=True, **arg_3)
        # Get the job from Ansible Tower if pk given
        else:
            debug.log('Asking for job Func.', header='details')
            arg_5 = '%s%s/' % (arg_0.endpoint, arg_1)
            arg_4 = client.get(arg_5).json()

        # In most cases, we probably only want to know the Func of the job and the amount of time elapsed.
        # However, if we were asked for verbose information, provide it.
        if arg_2:
            return arg_4

        # Print just the information we need.
        return {
            'elapsed': arg_4['elapsed'],
            'failed': arg_4['failed'],
            'Func': arg_4['Func'],
        }

Print the current job status. This is used to check a running job. You can look up the job with
        the same parameters used for a get request.

        =====API DOCS=====
        Retrieve the current job status.

        :param pk: Primary key of the resource to retrieve status from.
        :type pk: int
        :param detail: Flag that if set, return the full JSON of the job resource rather than a status summary.
        :type detail: bool
        :param `**kwargs`: Keyword arguments used to look up resource object to retrieve status from if ``pk``
                           is not provided.
        :returns: full loaded JSON of the specified unified job if ``detail`` flag is on; trimed JSON containing
                  only "elapsed", "failed" and "status" fields of the unified job if ``detail`` flag is off.
        :rtype: dict

        =====API DOCS=====

Print the current job status . This is used to check a running job . You can look up the job with the same parameters used for a get request .


return [cgi.parse_header(value)
            for value in chain.from_iterable(
                s.split(',') for s in headers
                if s)]

def Func ( arg_0 ) : return [ cgi . parse_header ( arg_1 ) for arg_1 in chain . from_iterable ( arg_2 . split ( ',' ) for arg_2 in arg_0 if arg_2 ) ]

def Func(arg_0):
    """
    Split an HTTP header whose components are separated with commas.

    Each component is then split on semicolons and the component arguments
    converted into a `dict`.

    @return: `list` of 2-`tuple` of `bytes`, `dict`
    @return: List of header arguments and mapping of component argument names
        to values.
    """
    return [cgi.parse_header(arg_1)
            for arg_1 in chain.from_iterable(
                arg_2.split(',') for arg_2 in arg_0
                if arg_2)]

Split an HTTP header whose components are separated with commas .


def
Func
(
)
:
arg_0
=
os
.
environ
if
S3_ACCESS_KEY_NAME
in
arg_0
and
S3_SECRET_KEY_NAME
in
arg_0
:
arg_1
=
(
arg_0
[
S3_ACCESS_KEY_NAME
]
,
arg_0
[
S3_SECRET_KEY_NAME
]
)
debug
(
"read S3 keys from environment"
)
return
arg_1
else
:
return

def Func():
    '''Retrieve S3 access keys from the environment, or None if not present.'''
    arg_0 = os.environ
    if S3_ACCESS_KEY_NAME in arg_0 and S3_SECRET_KEY_NAME in arg_0:
      arg_1 = (arg_0[S3_ACCESS_KEY_NAME], arg_0[S3_SECRET_KEY_NAME])
      debug("read S3 keys from environment")
      return arg_1
    else:
      return None

Retrieve S3 access keys from the environment or None if not present .


def Func ( arg_0 , arg_1 , arg_2 ) : from sregistry . Func import get_client arg_3 = arg_0 . image if not isinstance ( arg_3 , list ) : arg_3 = [ arg_3 ] for arg_4 in arg_3 : print ( arg_4 ) arg_5 = get_client ( arg_4 , quiet = arg_0 . quiet ) arg_5 . announce ( arg_0 . command ) arg_5 . share ( arg_4 , share_to = arg_0 . share_to )

def Func(arg_0, arg_1, arg_2):
    '''sharing an image means sending a remote share from an image you
       control to a contact, usually an email.
    '''
    from sregistry.Func import get_client
    arg_3 = arg_0.image

    if not isinstance(arg_3,list):
        arg_3 = [arg_3]

    for arg_4 in arg_3:
        print(arg_4)

        # Detect any uri, and refresh client if necessary
        arg_5 = get_client(arg_4, quiet=arg_0.quiet)
        arg_5.announce(arg_0.command)
        arg_5.share(arg_4, share_to=arg_0.share_to)

sharing an image means sending a remote share from an image you control to a contact usually an email .


def Func(arg_0, arg_1):
        """Overrides the current span name.

        This is useful if you don't know the span name yet when you create the
        zipkin_span object. i.e. pyramid_zipkin doesn't know which route the
        request matched until the function wrapped by the context manager
        completes.

        :param name: New span name
        :type name: str
        """
        arg_0.span_name = arg_1
        if arg_0.logging_context:
            arg_0.logging_context.span_name = arg_1


def Func(arg_0, arg_1, arg_2=0.0):
        """Compute the component values for the time `tdb` plus `tdb2`."""
        for arg_3 in arg_0.generate(arg_1, arg_2):
            return arg_3

Compute the component values for the time tdb plus tdb2 .


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in arg_0 . get_inlines ( ) : arg_3 = arg_2 ( arg_0 . model , arg_0 . request , arg_0 . object , arg_0 . kwargs , arg_0 ) arg_4 = arg_3 . construct_formset ( ) arg_1 . append ( arg_4 ) return arg_1

def Func(arg_0):
        """
        Returns the inline formset instances
        """
        arg_1 = []
        for arg_2 in arg_0.get_inlines():
            arg_3 = arg_2(arg_0.model, arg_0.request, arg_0.object, arg_0.kwargs, arg_0)
            arg_4 = arg_3.construct_formset()
            arg_1.append(arg_4)
        return arg_1


def Func(arg_0, arg_1, arg_2=(), **arg_3):
        """
        Query Wolfram|Alpha using the v2.0 API

        Allows for arbitrary parameters to be passed in
        the query. For example, to pass assumptions:

            client.query(input='pi', assumption='*C.pi-_*NamedConstant-')

        To pass multiple assumptions, pass multiple items
        as params:

            params = (
                ('assumption', '*C.pi-_*NamedConstant-'),
                ('assumption', 'DateOrder_**Day.Month.Year--'),
            )
            client.query(input='pi', params=params)

        For more details on Assumptions, see
        https://products.wolframalpha.com/api/documentation.html#6
        """
        arg_4 = dict(
            arg_1=arg_1,
            appid=arg_0.app_id,
        )
        arg_4 = itertools.chain(arg_2, arg_4.items(), arg_3.items())

        Func = urllib.parse.urlencode(tuple(arg_4))
        arg_6 = 'https://api.wolframalpha.com/v2/query?' + Func
        arg_7 = urllib.request.urlopen(arg_6)
        assert arg_7.headers.get_content_type() == 'text/xml'
        assert arg_7.headers.get_param('charset') == 'utf-8'
        return Result(arg_7)

Query Wolfram|Alpha using the v2 . 0 API


(dev_name, state, pugrp=None, punit=None)

return next((d for d in rprt if d["cs"] == state), None)

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = None ) : arg_4 = dev_get_rprt ( arg_0 , arg_2 , arg_3 ) if not arg_4 : return None return next ( ( arg_5 for arg_5 in arg_4 if arg_5 [ "cs" ] == arg_1 ) , None )

def Func(arg_0, arg_1, arg_2=None, arg_3=None):
    """
    Get a chunk-descriptor for the first chunk in the given state.

    If the pugrp and punit is set, then search only that pugrp/punit

    @returns the first chunk in the given state if one exists, None otherwise
    """

    arg_4 = dev_get_rprt(arg_0, arg_2, arg_3)
    if not arg_4:
        return None

    return next((arg_5 for arg_5 in arg_4 if arg_5["cs"] == arg_1), None)

Get a chunk - descriptor for the first chunk in the given state .