def Func(arg_0, arg_1):
    r""" Allele expectation.

    Compute the expectation of each allele from the genotype probabilities.

    Parameters
    ----------
    bgen : bgen_file
        Bgen file handler.
    variant_idx : int
        Variant index.

    Returns
    -------
    :class:`numpy.ndarray`
        Samples-by-alleles matrix of allele expectations.

    Note
    ----
    This function supports unphased genotypes only.

    Examples
    --------
    .. doctest::

        >>> from bgen_reader import Func, example_files, read_bgen
        >>>
        >>> from texttable import Texttable
        >>>
        >>> # Download an example.
        >>> example = example_files("example.32bits.bgen")
        >>> filepath = example.filepath
        >>>
        >>> # Read the example.
        >>> bgen = read_bgen(filepath, verbose=False)
        >>>
        >>> variants = bgen["variants"]
        >>> samples = bgen["samples"]
        >>> genotype = bgen["genotype"]
        >>>
        >>> genotype = bgen["genotype"]
        >>> # This `compute` call will return a pandas data frame,
        >>> variant = variants[variants["rsid"] == "RSID_6"].compute()
        >>> # from which we retrieve the variant index.
        >>> variant_idx = variant.index.item()
        >>> print(variant)
                id    rsid chrom   pos  nalleles allele_ids  vaddr
        4  SNPID_6  RSID_6    01  6000         2        A,G  19377
        >>> genotype = bgen["genotype"]
        >>> # Samples is a pandas series, and we retrieve the
        >>> # sample index from the sample name.
        >>> sample_idx = samples[samples == "sample_005"].index.item()
        >>>
        >>> genotype = bgen["genotype"]
        >>> # This `compute` call will return a dictionary from which
        >>> # we can get the probability matrix the corresponding
        >>> # variant.
        >>> p = genotype[variant_idx].compute()["probs"][sample_idx]
        >>>
        >>> genotype = bgen["genotype"]
        >>> # Allele expectation makes sense for unphased genotypes only,
        >>> # which is the case here.
        >>> e = Func(bgen, variant_idx)[sample_idx]
        >>>
        >>> genotype = bgen["genotype"]
        >>> alleles = variant["allele_ids"].item().split(",")
        >>>
        >>> genotype = bgen["genotype"]
        >>>
        >>> # Print what we have got in a nice format.
        >>> table = Texttable()
        >>> table = table.add_rows(
        ...     [
        ...         ["", "AA", "AG", "GG", "E[.]"],
        ...         ["p"] + list(p) + ["na"],
        ...         ["#" + alleles[0], 2, 1, 0, e[0]],
        ...         ["#" + alleles[1], 0, 1, 2, e[1]],
        ...     ]
        ... )
        >>> print(table.draw())
        +----+-------+-------+-------+-------+
        |    |  AA   |  AG   |  GG   | E[.]  |
        +====+=======+=======+=======+=======+
        | p  | 0.012 | 0.987 | 0.001 | na    |
        +----+-------+-------+-------+-------+
        | #A | 2     | 1     | 0     | 1.011 |
        +----+-------+-------+-------+-------+
        | #G | 0     | 1     | 2     | 0.989 |
        +----+-------+-------+-------+-------+
        >>>
        >>> # Clean-up.
        >>> example.close()
    """
    arg_2 = arg_0["genotype"][arg_1].compute()
    if arg_2["phased"]:
        raise ValueError("Allele expectation is define for unphased genotypes only.")

    arg_3 = arg_0["variants"].loc[arg_1, "nalleles"].compute().item()
    arg_4 = get_genotypes(arg_2["ploidy"], arg_3)
    arg_5 = []
    for arg_6 in range(len(arg_4)):
        arg_7 = asarray(genotypes_to_allele_counts(arg_4[arg_6]), float)
        arg_8 = arg_7.shape[0]
        arg_5.append((arg_7.T * arg_2["probs"][arg_6, :arg_8]).sum(1))

    return stack(arg_5, axis=0)

r""" Allele expectation.

    Compute the expectation of each allele from the genotype probabilities.

    Parameters
    ----------
    bgen : bgen_file
        Bgen file handler.
    variant_idx : int
        Variant index.

    Returns
    -------
    :class:`numpy.ndarray`
        Samples-by-alleles matrix of allele expectations.

    Note
    ----
    This function supports unphased genotypes only.

    Examples
    --------
    .. doctest::

        >>> from bgen_reader import allele_expectation, example_files, read_bgen
        >>>
        >>> from texttable import Texttable
        >>>
        >>> # Download an example.
        >>> example = example_files("example.32bits.bgen")
        >>> filepath = example.filepath
        >>>
        >>> # Read the example.
        >>> bgen = read_bgen(filepath, verbose=False)
        >>>
        >>> variants = bgen["variants"]
        >>> samples = bgen["samples"]
        >>> genotype = bgen["genotype"]
        >>>
        >>> genotype = bgen["genotype"]
        >>> # This `compute` call will return a pandas data frame,
        >>> variant = variants[variants["rsid"] == "RSID_6"].compute()
        >>> # from which we retrieve the variant index.
        >>> variant_idx = variant.index.item()
        >>> print(variant)
                id    rsid chrom   pos  nalleles allele_ids  vaddr
        4  SNPID_6  RSID_6    01  6000         2        A,G  19377
        >>> genotype = bgen["genotype"]
        >>> # Samples is a pandas series, and we retrieve the
        >>> # sample index from the sample name.
        >>> sample_idx = samples[samples == "sample_005"].index.item()
        >>>
        >>> genotype = bgen["genotype"]
        >>> # This `compute` call will return a dictionary from which
        >>> # we can get the probability matrix the corresponding
        >>> # variant.
        >>> p = genotype[variant_idx].compute()["probs"][sample_idx]
        >>>
        >>> genotype = bgen["genotype"]
        >>> # Allele expectation makes sense for unphased genotypes only,
        >>> # which is the case here.
        >>> e = allele_expectation(bgen, variant_idx)[sample_idx]
        >>>
        >>> genotype = bgen["genotype"]
        >>> alleles = variant["allele_ids"].item().split(",")
        >>>
        >>> genotype = bgen["genotype"]
        >>>
        >>> # Print what we have got in a nice format.
        >>> table = Texttable()
        >>> table = table.add_rows(
        ...     [
        ...         ["", "AA", "AG", "GG", "E[.]"],
        ...         ["p"] + list(p) + ["na"],
        ...         ["#" + alleles[0], 2, 1, 0, e[0]],
        ...         ["#" + alleles[1], 0, 1, 2, e[1]],
        ...     ]
        ... )
        >>> print(table.draw())
        +----+-------+-------+-------+-------+
        |    |  AA   |  AG   |  GG   | E[.]  |
        +====+=======+=======+=======+=======+
        | p  | 0.012 | 0.987 | 0.001 | na    |
        +----+-------+-------+-------+-------+
        | #A | 2     | 1     | 0     | 1.011 |
        +----+-------+-------+-------+-------+
        | #G | 0     | 1     | 2     | 0.989 |
        +----+-------+-------+-------+-------+
        >>>
        >>> # Clean-up.
        >>> example.close()


def Func ( arg_0 , arg_1 ) : try : return arg_0 in VERSION_TO_POINT_FMT [ str ( arg_1 ) ] except KeyError : raise errors . FileVersionNotSupported ( arg_1 )

def Func(arg_0, arg_1):
    """  Returns true if the file version support the point_format_id
    """
    try:
        return arg_0 in VERSION_TO_POINT_FMT[str(arg_1)]
    except KeyError:
        raise errors.FileVersionNotSupported(arg_1)


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = th . FloatTensor ( [ 0 ] ) for arg_4 in range ( 1 , arg_0 . moments ) : arg_5 = th . mean ( th . pow ( arg_1 , arg_4 ) , 0 ) arg_6 = th . mean ( th . pow ( arg_2 , arg_4 ) , 0 ) arg_3 . add_ ( th . mean ( ( arg_5 - arg_6 ) ** 2 ) ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """Compute the loss model.

        :param pred: predicted Variable
        :param target: Target Variable
        :return: Loss
        """
        arg_3 = th.FloatTensor([0])
        for arg_4 in range(1, arg_0.moments):
            arg_5 = th.mean(th.pow(arg_1, arg_4), 0)
            arg_6 = th.mean(th.pow(arg_2, arg_4), 0)

            arg_3.add_(th.mean((arg_5 - arg_6) ** 2))  # L2

        return arg_3


def Func ( arg_0 , arg_1 : arg_2 ) : arg_3 = arg_0 . _normalize_field_name ( arg_1 ) if arg_3 == 'pk' and arg_0 . query . model . _meta . pk : return arg_0 . query . model . _meta . pk for arg_4 in arg_0 . query . model . _meta . local_concrete_fields : if arg_4 . name == arg_3 or arg_4 . column == arg_3 : return arg_4 return None

def Func(arg_0, arg_1: arg_2):
        """Gets the field on a model with the specified name.

        Arguments:
            name:
                The name of the field to look for.

                This can be both the actual field name, or
                the name of the column, both will work :)

        Returns:
            The field with the specified name or None if
            no such field exists.
        """

        arg_3 = arg_0._normalize_field_name(arg_1)

        # 'pk' has special meaning and always refers to the primary
        # key of a model, we have to respect this de-facto standard behaviour
        if arg_3 == 'pk' and arg_0.query.model._meta.pk:
            return arg_0.query.model._meta.pk

        for arg_4 in arg_0.query.model._meta.local_concrete_fields:
            if arg_4.name == arg_3 or arg_4.column == arg_3:
                return arg_4

        return None

Gets the field on a model with the specified name .


return time(self.hour, self.minute, self.second, self.microsecond)

def Func ( arg_0 ) : return Func ( arg_0 . hour , arg_0 . minute , arg_0 . second , arg_0 . microsecond )

def Func(arg_0):
        "Return the Func part, with tzinfo None."
        return Func(arg_0.hour, arg_0.minute, arg_0.second, arg_0.microsecond)


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : if arg_1 is None : arg_1 = arg_0 if arg_2 is not None : np . random . seed ( arg_2 ) arg_3 = np . random . normal ( size = ( arg_0 , arg_1 ) ) + np . random . normal ( size = ( arg_0 , arg_1 ) ) * 1j return arg_3

def Func(arg_0, arg_1=None, arg_2=None):
    """
    Return a normally distributed complex random matrix.

    Args:
        nrow (int): number of rows in output matrix.
        ncol (int): number of columns in output matrix.
        seed (int): Optional. To set a random seed.
    Returns:
        ndarray: A complex rectangular matrix where each real and imaginary
            entry is sampled from the normal distribution.
    """
    if arg_1 is None:
        arg_1 = arg_0
    if arg_2 is not None:
        np.random.seed(arg_2)
    arg_3 = np.random.normal(size=(arg_0, arg_1)) + \
        np.random.normal(size=(arg_0, arg_1)) * 1j
    return arg_3

Return a normally distributed complex random matrix .


def Func ( arg_0 ) : if arg_0 . import_Func == '__main__' : arg_1 = getattr ( sys . modules [ '__main__' ] , '__file__' , None ) if arg_1 is None : return '__main__' return os . path . splitext ( os . path . baseFunc ( arg_1 ) ) [ 0 ] return arg_0 . import_Func

def Func(arg_0):
        """The Func of the application.  This is usually the import Func
        with the difference that it's guessed from the run file if the
        import Func is main.  This Func is used as a display Func when
        Flask needs the Func of the application.  It can be set and overridden
        to change the value.

        .. versionadded:: 0.8
        """
        if arg_0.import_Func == '__main__':
            arg_1 = getattr(sys.modules['__main__'], '__file__', None)
            if arg_1 is None:
                return '__main__'
            return os.path.splitext(os.path.baseFunc(arg_1))[0]
        return arg_0.import_Func

The name of the application.  This is usually the import name
        with the difference that it's guessed from the run file if the
        import name is main.  This name is used as a display name when
        Flask needs the name of the application.  It can be set and overridden
        to change the value.

        .. versionadded:: 0.8

The name of the application . This is usually the import name with the difference that it s guessed from the run file if the import name is main . This name is used as a display name when Flask needs the name of the application . It can be set and overridden to change the value .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . get_setting ( arg_1 ) if arg_3 is None : arg_3 = models . DashboardWidgetSettings . objects . create ( widget_name = arg_0 . get_name ( ) , arg_1 = arg_1 , arg_2 = arg_2 ) arg_3 . value = arg_2 arg_3 . save ( ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """Saves the setting value into the database."""
        arg_3 = arg_0.get_setting(arg_1)
        if arg_3 is None:
            arg_3 = models.DashboardWidgetSettings.objects.create(
                widget_name=arg_0.get_name(),
                arg_1=arg_1,
                arg_2=arg_2)
        arg_3.value = arg_2
        arg_3.save()
        return arg_3

Saves the setting value into the database .


def Func ( arg_0 ) : super ( Configuration , arg_0 ) . Func ( ) _CustomConfigurationFileWrapper . Func ( persistent = False )

def Func(arg_0):
    """ Clear all configuration properties from in-memory cache, but do NOT
    alter the custom configuration file. Used in unit-testing.
    """
    # Clear the in-memory settings cache, forcing reload upon subsequent "get"
    # request.
    super(Configuration, arg_0).Func()

    # Reset in-memory custom configuration info.
    _CustomConfigurationFileWrapper.Func(persistent=False)

Clear all configuration properties from in - memory cache but do NOT alter the custom configuration file . Used in unit - testing .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = arg_0 . __class__ if arg_2 is None : arg_2 = copy . copy ( arg_0 . __dict__ ) else : arg_2 = copy . copy ( arg_2 ) for arg_4 in arg_1 : if arg_4 in arg_2 : del arg_2 [ arg_4 ] arg_2 [ 'token_expiry' ] = _parse_expiry ( arg_2 . get ( 'token_expiry' ) ) arg_2 [ '_class' ] = arg_3 . __name__ arg_2 [ '_module' ] = arg_3 . __module__ for arg_5 , arg_6 in arg_2 . items ( ) : if isinstance ( arg_6 , bytes ) : arg_2 [ arg_5 ] = arg_6 . decode ( 'utf-8' ) if isinstance ( arg_6 , set ) : arg_2 [ arg_5 ] = list ( arg_6 ) return json . dumps ( arg_2 )

def Func(arg_0, arg_1, arg_2=None):
        """Utility function that creates JSON repr. of a Credentials object.

        Args:
            strip: array, An array of names of members to exclude from the
                   JSON.
            to_serialize: dict, (Optional) The properties for this object
                          that will be serialized. This allows callers to
                          modify before serializing.

        Returns:
            string, a JSON representation of this instance, suitable to pass to
            from_json().
        """
        arg_3 = arg_0.__class__
        if arg_2 is None:
            arg_2 = copy.copy(arg_0.__dict__)
        else:
            # Assumes it is a str->str dictionary, so we don't deep copy.
            arg_2 = copy.copy(arg_2)
        for arg_4 in arg_1:
            if arg_4 in arg_2:
                del arg_2[arg_4]
        arg_2['token_expiry'] = _parse_expiry(
            arg_2.get('token_expiry'))
        # Add in information we will need later to reconstitute this instance.
        arg_2['_class'] = arg_3.__name__
        arg_2['_module'] = arg_3.__module__
        for arg_5, arg_6 in arg_2.items():
            if isinstance(arg_6, bytes):
                arg_2[arg_5] = arg_6.decode('utf-8')
            if isinstance(arg_6, set):
                arg_2[arg_5] = list(arg_6)
        return json.dumps(arg_2)

Utility function that creates JSON repr . of a Credentials object .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_0 . cat_groups . setdefault ( arg_1 , { } ) . setdefault ( arg_2 , deque ( ) ) . append ( arg_3 )

def Func(arg_0, arg_1, arg_2, arg_3):
        """Associate the provided rule definition name ``def_name`` with the
        category group ``cat_group`` in the category ``cat``.

        :param str cat: The category the rule definition was declared in
        :param str cat_group: The group within the category the rule belongs to
        :param str def_name: The name of the rule definition
        """
        arg_0.cat_groups.setdefault(arg_1, {}).setdefault(arg_2, deque()).append(arg_3)

Associate the provided rule definition name def_name with the category group cat_group in the category cat .


def Func ( arg_0 : arg_1 [ ... , arg_2 ] ) -> arg_1 [ [ Iterable ] , arg_2 ] : def Functed ( arg_3 ) : return arg_0 ( * arg_3 ) return Functed

def Func(arg_0: arg_1[..., arg_2]) -> arg_1[[Iterable], arg_2]:
    """Convert a function taking multiple arguments into a function taking a single iterable argument.

    Args:
        f: Any function

    Returns:
        A function that accepts a single iterable argument. Each element of this iterable argument is passed as an
        argument to ``f``.

    Example:
        $ def f(a, b, c):
        $     return a + b + c
        $
        $ f(1, 2, 3)  # 6
        $ g = Func(f)
        $ g([1, 2, 3])  # 6
    """

    def Functed(arg_3):
        return arg_0(*arg_3)

    return Functed

Convert a function taking multiple arguments into a function taking a single iterable argument.

    Args:
        f: Any function

    Returns:
        A function that accepts a single iterable argument. Each element of this iterable argument is passed as an
        argument to ``f``.

    Example:
        $ def f(a, b, c):
        $     return a + b + c
        $
        $ f(1, 2, 3)  # 6
        $ g = splat(f)
        $ g([1, 2, 3])  # 6

Convert a function taking multiple arguments into a function taking a single iterable argument .


def Func(arg_0, arg_1, arg_2=False):
        """ Sets the continuation prompt.

        Parameters
        ----------
        prompt : str
            The prompt to show when more input is needed.

        html : bool, optional (default False)
            If set, the prompt will be inserted as formatted HTML. Otherwise,
            the prompt will be treated as plain text, though ANSI color codes
            will be handled.
        """
        if arg_2:
            arg_0._continuation_prompt_html = arg_1
        else:
            arg_0._continuation_prompt = arg_1
            arg_0._continuation_prompt_html = None


def Func ( arg_0 ) : arg_1 = [ arg_2 for arg_2 in arg_0 if 'git' in arg_0 [ arg_2 ] ] for arg_2 in arg_1 : arg_3 = [ arg_4 for arg_4 in arg_0 [ arg_2 ] [ 'git' ] if 'gitroot' in arg_4 ] if len ( arg_3 ) > 0 : arg_0 [ arg_2 ] [ 'gerrit' ] = [ ] for arg_4 in arg_3 : arg_5 = arg_4 . replace ( "http://git.eclipse.org/gitroot/" , "" ) arg_5 = arg_5 . replace ( ".git" , "" ) arg_0 [ arg_2 ] [ 'gerrit' ] . append ( "git.eclipse.org_" + arg_5 ) return arg_0

def Func(arg_0):
    """ Compose projects.json for gerrit, but using the git lists

    change: 'http://git.eclipse.org/gitroot/xwt/org.eclipse.xwt.git'
    to: 'git.eclipse.org_xwt/org.eclipse.xwt

    :param projects: projects.json
    :return: projects.json with gerrit
    """
    arg_1 = [arg_2 for arg_2 in arg_0 if 'git' in arg_0[arg_2]]
    for arg_2 in arg_1:
        arg_3 = [arg_4 for arg_4 in arg_0[arg_2]['git'] if 'gitroot' in arg_4]
        if len(arg_3) > 0:
            arg_0[arg_2]['gerrit'] = []
        for arg_4 in arg_3:
            arg_5 = arg_4.replace("http://git.eclipse.org/gitroot/", "")
            arg_5 = arg_5.replace(".git", "")
            arg_0[arg_2]['gerrit'].append("git.eclipse.org_" + arg_5)

    return arg_0

Compose projects . json for gerrit but using the git lists


(cls, recid=None, receiver=None, sender_full_name=None,
               sender_email=None, justification=None, sender=None)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,
               arg_4=None, arg_5=None, arg_6=None):
        """Create a new access request.

        :param recid: Record id (required).
        :param receiver: User object of receiver (required).
        :param sender_full_name: Full name of sender (required).
        :param sender_email: Email address of sender (required).
        :param justification: Justification message (required).
        :param sender: User object of sender (optional).
        """
        arg_7 = None if arg_6 is None else arg_6.id

        assert arg_1
        assert arg_2
        assert arg_3
        assert arg_4
        assert arg_5

        # Determine status
        arg_8 = RequestStatus.EMAIL_VALIDATION
        if arg_6 and arg_6.confirmed_at:
            arg_8 = RequestStatus.PENDING

        with db.session.begin_nested():
            # Create object
            arg_9 = arg_0(
                arg_8=arg_8,
                arg_1=arg_1,
                receiver_user_id=arg_2.id,
                arg_7=arg_7,
                arg_3=arg_3,
                arg_4=arg_4,
                arg_5=arg_5
            )

            db.session.add(arg_9)

        # Send signal
        if arg_9.status == RequestStatus.EMAIL_VALIDATION:
            request_Funcd.send(arg_9)
        else:
            request_confirmed.send(arg_9)
        return arg_9


def
Func
(
arg_0
)
:
arg_0
.
results
.
update
(
{
'cycles'
:
[
]
,
'misses'
:
arg_0
.
predictor
.
get_misses
(
)
,
'hits'
:
arg_0
.
predictor
.
get_hits
(
)
,
'evicts'
:
arg_0
.
predictor
.
get_evicts
(
)
,
'verbose infos'
:
arg_0
.
predictor
.
get_infos
(
)
}
)

def Func(arg_0):
        """Dispatch to cache predictor to get cache stats."""
        arg_0.results.update({
                        'cycles': [],  # will be filled by caclculate_cycles()
                        'misses': arg_0.predictor.get_misses(),
                        'hits': arg_0.predictor.get_hits(),
                        'evicts': arg_0.predictor.get_evicts(),
                        'verbose infos': arg_0.predictor.get_infos()})

Dispatch to cache predictor to get cache stats .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
logging
.
getLogger
(
__name__
)
try
:
arg_4
=
subprocess
.
run
(
arg_0
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
except
KeyboardInterrupt
:
arg_3
.
debug
(
'Process terminated, removing file %s'
,
arg_2
)
if
os
.
path
.
isfile
(
arg_2
)
:
os
.
remove
(
arg_2
)
raise
if
arg_4
.
returncode
:
arg_3
.
debug
(
'STDOUT:\n %s'
,
arg_4
.
stdout
.
decode
(
'utf8'
)
)
arg_3
.
debug
(
'STDERR:\n %s'
,
arg_4
.
stderr
.
decode
(
'utf8'
)
)
if
os
.
path
.
isfile
(
arg_2
)
:
arg_3
.
debug
(
'Removing file %s'
,
arg_2
)
os
.
remove
(
arg_2
)
raise
SubprocessException
(
'Failed to process '
+
arg_1
)

def Func(arg_0, arg_1, arg_2):
    """Run the command to resize the video and remove the output file if the
    processing fails.

    """
    arg_3 = logging.getLogger(__name__)
    try:
        arg_4 = subprocess.run(arg_0, stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
    except KeyboardInterrupt:
        arg_3.debug('Process terminated, removing file %s', arg_2)
        if os.path.isfile(arg_2):
            os.remove(arg_2)
        raise

    if arg_4.returncode:
        arg_3.debug('STDOUT:\n %s', arg_4.stdout.decode('utf8'))
        arg_3.debug('STDERR:\n %s', arg_4.stderr.decode('utf8'))
        if os.path.isfile(arg_2):
            arg_3.debug('Removing file %s', arg_2)
            os.remove(arg_2)
        raise SubprocessException('Failed to process ' + arg_1)

Run the command to resize the video and remove the output file if the processing fails .


def Func ( arg_0 ) : for arg_1 , arg_2 , arg_3 in os . walk ( arg_0 , followlinks = True ) : for arg_4 in arg_2 : yield os . path . relpath ( os . path . join ( arg_1 , arg_4 ) , arg_0 )

def Func(arg_0):
        """
        Return all dirs in base_path, relative to base_path
        """
        for arg_1, arg_2, arg_3 in os.walk(arg_0, followlinks=True):
            for arg_4 in arg_2:
                yield os.path.relpath(os.path.join(arg_1, arg_4), arg_0)

Return all dirs in base_path relative to base_path


Execute command and wait for it to finish. Proceed with caution because
        if you run a command that causes a prompt this will hang

def Func ( arg_0 , arg_1 , arg_2 = True ) : arg_3 , arg_4 , arg_5 = arg_0 . exec_command ( arg_1 ) arg_4 . channel . recv_exit_status ( ) arg_6 = arg_4 . read ( ) if arg_0 . interactive : print ( arg_6 ) arg_7 = arg_5 . read ( ) if arg_0 . interactive : print ( arg_7 ) if arg_7 and arg_2 : raise ValueError ( arg_7 ) return arg_6

def Func(arg_0, arg_1, arg_2=True):
        """
        Execute command and Func for it to finish. Proceed with caution because
        if you run a command that causes a prompt this will hang
        """
        arg_3, arg_4, arg_5 = arg_0.exec_command(arg_1)
        arg_4.channel.recv_exit_status()
        arg_6 = arg_4.read()
        if arg_0.interactive:
            print(arg_6)
        arg_7 = arg_5.read()
        if arg_0.interactive:
            print(arg_7)
        if arg_7 and arg_2:
            raise ValueError(arg_7)
        return arg_6

Execute command and wait for it to finish . Proceed with caution because if you run a command that causes a prompt this will hang


def
Func
(
arg_0
,
arg_1
)
:
with
open
(
arg_1
,
'w'
)
as
f
:
f
.
write
(
'Z   N   M\n'
)
arg_0
.
df
.
to_csv
(
arg_1
,
sep
=
'\t'
,
mode
=
'a'
)

def Func(arg_0, arg_1):
        """Export the contents to a file as comma separated values.

        Parameters
        ----------
        path : string
            File path where the data should be saved to

        Example
        -------
        Export the last ten elements of AME2012 to a new file:

        >>> Table('AME2012').tail(10).Func('last_ten.txt')
        """
        with open(arg_1, 'w') as f:
            f.write('Z   N   M\n')
        arg_0.df.to_csv(arg_1, sep='\t', mode='a')

Export the contents to a file as comma separated values.

        Parameters
        ----------
        path : string
            File path where the data should be saved to

        Example
        -------
        Export the last ten elements of AME2012 to a new file:

        >>> Table('AME2012').tail(10).to_file('last_ten.txt')

Export the contents to a file as comma separated values .


def Func ( arg_0 , arg_1 ) : arg_2 = lambda i : arg_0 [ i : i + arg_1 ] return map ( arg_2 , xrange ( 0 , len ( arg_0 ) , arg_1 ) )

def Func(arg_0, arg_1):
    """Chop a sequence into chunks of the given size."""
    arg_2 = lambda i: arg_0[i:i+arg_1]
    return map(arg_2,xrange(0,len(arg_0),arg_1))

Chop a sequence into chunks of the given size .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
for
arg_3
,
arg_4
in
arg_2
.
items
(
)
:
try
:
arg_1
[
arg_3
]
=
arg_4
except
KeyError
as
ke
:
arg_0
.
_logger
.
warning
(
'Could not write `%s` into a table, '
%
arg_3
+
repr
(
ke
)
)

def Func(arg_0, arg_1, arg_2):
        """Copies data from `insert_dict` into a pytables `row`."""
        for arg_3, arg_4 in arg_2.items():
            try:
                arg_1[arg_3] = arg_4
            except KeyError as ke:
                arg_0._logger.warning('Could not write `%s` into a table, ' % arg_3 + repr(ke))

Copies data from insert_dict into a pytables row .


def Func(arg_0):
    """Get the changeset using the OSM API and return the content as a XML
    ElementTree.

    Args:
        changeset: the id of the changeset.
    """
    arg_1 = 'https://www.openstreetmap.org/api/0.6/changeset/{}/download'.format(
        arg_0
        )
    return ET.fromstring(requests.get(arg_1).content)

Get the changeset using the OSM API and return the content as a XML ElementTree .


def Func(arg_0, arg_1, arg_2=None):
    """Attempt to make an ssh connection without a password.
    This is mainly used for requiring password input only once
    when many tunnels may be connected to the same server.

    If paramiko is None, the default for the platform is chosen.
    """
    if arg_2 is None:
        arg_2 = sys.platform == 'win32'
    if not arg_2:
        arg_3 = _try_passwordless_openssh
    else:
        arg_3 = _try_passwordless_paramiko
    return arg_3(arg_0, arg_1)

Attempt to make an ssh connection without a password . This is mainly used for requiring password input only once when many tunnels may be connected to the same server .


def Func ( arg_0 ) : if len ( arg_0 ) > 1 : if arg_0 . startswith ( '"' ) and arg_0 . endswith ( '"' ) : return arg_0 [ 1 : - 1 ] . replace ( '\\\\' , '\\' ) . replace ( '\\"' , '"' ) if arg_0 . startswith ( '<' ) and arg_0 . endswith ( '>' ) : return arg_0 [ 1 : - 1 ] return arg_0

def Func(arg_0):
    """Remove quotes from a string."""
    if len(arg_0) > 1:
        if arg_0.startswith('"') and arg_0.endswith('"'):
            return arg_0[1:-1].replace('\\\\', '\\').replace('\\"', '"')
        if arg_0.startswith('<') and arg_0.endswith('>'):
            return arg_0[1:-1]
    return arg_0


def Func ( arg_0 ) : arg_1 = None arg_2 = - 1 arg_3 = None for arg_4 , arg_5 , ( arg_6 , arg_7 ) , ( arg_8 , arg_9 ) , arg_10 in arg_0 : if arg_2 != arg_8 : if arg_1 and arg_1 . endswith ( "\\\n" ) : arg_11 = True if arg_3 == tokenize . COMMENT : arg_11 = False elif arg_4 == token . STRING : if "\n" in arg_5 and arg_5 . split ( '\n' , 1 ) [ 0 ] [ - 1 ] == '\\' : arg_11 = False if arg_11 : arg_12 = len ( arg_1 . split ( "\n" ) [ - 2 ] ) - 1 yield ( 99999 , "\\\n" , ( arg_6 , arg_12 ) , ( arg_6 , arg_12 + 2 ) , arg_1 ) arg_1 = arg_10 arg_3 = arg_4 yield arg_4 , arg_5 , ( arg_6 , arg_7 ) , ( arg_8 , arg_9 ) , arg_10 arg_2 = arg_8

def Func(arg_0):
    """Return all physical tokens, even line continuations.

    tokenize.generate_tokens() doesn't return a token for the backslash that
    continues lines.  This wrapper provides those tokens so that we can
    re-create a faithful representation of the original source.

    Returns the same values as generate_tokens()

    """
    arg_1 = None
    arg_2 = -1
    arg_3 = None
    for arg_4, arg_5, (arg_6, arg_7), (arg_8, arg_9), arg_10 in arg_0:
        if arg_2 != arg_8:
            if arg_1 and arg_1.endswith("\\\n"):
                # We are at the beginning of a new line, and the last line
                # ended with a backslash.  We probably have to inject a
                # backslash token into the stream. Unfortunately, there's more
                # to figure out.  This code::
                #
                #   usage = """\
                #   HEY THERE
                #   """
                #
                # triggers this condition, but the token text is::
                #
                #   '"""\\\nHEY THERE\n"""'
                #
                # so we need to figure out if the backslash is already in the
                # string token or not.
                arg_11 = True
                if arg_3 == tokenize.COMMENT:
                    # Comments like this \
                    # should never result in a new token.
                    arg_11 = False
                elif arg_4 == token.STRING:
                    if "\n" in arg_5 and arg_5.split('\n', 1)[0][-1] == '\\':
                        # It's a multiline string and the first line ends with
                        # a backslash, so we don't need to inject another.
                        arg_11 = False
                if arg_11:
                    # Figure out what column the backslash is in.
                    arg_12 = len(arg_1.split("\n")[-2]) - 1
                    # Yield the token, with a fake token type.
                    yield (
                        99999, "\\\n",
                        (arg_6, arg_12), (arg_6, arg_12+2),
                        arg_1
                        )
            arg_1 = arg_10
            arg_3 = arg_4
        yield arg_4, arg_5, (arg_6, arg_7), (arg_8, arg_9), arg_10
        arg_2 = arg_8

Return all physical tokens even line continuations .


return _colmean((y_predicted - y_actual) ** 2)

def Func(arg_0, arg_1, arg_2=None):
    """
    Mean squared error regression loss

    :param y_actual: H2OFrame of actual response.
    :param y_predicted: H2OFrame of predicted response.
    :param weights: (Optional) sample weights
    :returns: mean squared error loss (best is 0.0).
    """
    ModelBase._check_targets(arg_0, arg_1)
    return _colmean((arg_1 - arg_0) ** 2)


(self, pk=None, create_on_missing=False, monitor=False,
               wait=False, timeout=None, name=None, organization=None)

return {
            'id': project_update_id,
            'changed': True,
        }

def Func(arg_0, arg_1=None, arg_2=False, arg_3=False,
               arg_4=False, arg_5=None, arg_6=None, arg_7=None):
        """Trigger a project Func job within Ansible Tower.
        Only meaningful on non-manual projects.

        =====API DOCS=====
        Update the given project.

        :param pk: Primary key of the project to be Funcd.
        :type pk: int
        :param monitor: Flag that if set, immediately calls ``monitor`` on the newly launched project Func
                        rather than exiting with a success.
        :type monitor: bool
        :param wait: Flag that if set, monitor the status of the project Func, but do not print while it is
                     in progress.
        :type wait: bool
        :param timeout: If provided with ``monitor`` flag set, this attempt will time out after the given number
                        of seconds.
        :type timeout: int
        :param name: Name of the project to be Funcd if ``pk`` is not set.
        :type name: str
        :param organization: Primary key or name of the organization the project to be Funcd belonging to if
                             ``pk`` is not set.
        :type organization: str
        :returns: Result of subsequent ``monitor`` call if ``monitor`` flag is on; Result of subsequent ``wait``
                  call if ``wait`` flag is on; dictionary of "status" if none of the two flags are on.
        :rtype: dict
        :raises tower_cli.exceptions.CannotStartJob: When the project cannot be Funcd.

        =====API DOCS=====
        """
        # First, get the appropriate project.
        # This should be uniquely identified at this point, and if not, then
        # we just want the error that `get` will throw to bubble up.
        arg_8 = arg_0.get(arg_1, arg_6=arg_6, arg_7=arg_7)
        arg_1 = arg_8['id']

        # Determine whether this project is able to be Funcd.
        debug.log('Asking whether the project can be Funcd.',
                  header='details')
        arg_9 = client.get('/projects/%d/Func/' % arg_1)
        if not arg_9.json()['can_Func']:
            raise exc.CannotStartJob('Cannot Func project.')

        # Okay, this project can be Funcd, according to Tower.
        # Commence the Func.
        debug.log('Updating the project.', header='details')
        arg_9 = client.post('/projects/%d/Func/' % arg_1)

        arg_10 = arg_9.json()['project_Func']

        # If we were told to monitor the project Func's status, do so.
        if arg_3:
            return arg_0.monitor(arg_10, parent_pk=arg_1,
                                arg_5=arg_5)
        elif arg_4:
            return arg_0.wait(arg_10, parent_pk=arg_1, arg_5=arg_5)

        # Return the project Func ID.
        return {
            'id': arg_10,
            'changed': True,
        }

Trigger a project update job within Ansible Tower.
        Only meaningful on non-manual projects.

        =====API DOCS=====
        Update the given project.

        :param pk: Primary key of the project to be updated.
        :type pk: int
        :param monitor: Flag that if set, immediately calls ``monitor`` on the newly launched project update
                        rather than exiting with a success.
        :type monitor: bool
        :param wait: Flag that if set, monitor the status of the project update, but do not print while it is
                     in progress.
        :type wait: bool
        :param timeout: If provided with ``monitor`` flag set, this attempt will time out after the given number
                        of seconds.
        :type timeout: int
        :param name: Name of the project to be updated if ``pk`` is not set.
        :type name: str
        :param organization: Primary key or name of the organization the project to be updated belonging to if
                             ``pk`` is not set.
        :type organization: str
        :returns: Result of subsequent ``monitor`` call if ``monitor`` flag is on; Result of subsequent ``wait``
                  call if ``wait`` flag is on; dictionary of "status" if none of the two flags are on.
        :rtype: dict
        :raises tower_cli.exceptions.CannotStartJob: When the project cannot be updated.

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

Trigger a project update job within Ansible Tower . Only meaningful on non - manual projects .


return eval_step(self.vim)(io.map(lambda a: a))

def Func ( arg_0 , arg_1 : arg_2 [ arg_3 ] ) -> NvimIO [ B ] : return eval_step ( arg_0 . vim ) ( arg_1 . map ( lambda a : a ) )

def Func(arg_0, arg_1: arg_2[arg_3]) -> NvimIO[B]:
        '''calls `map` to shift the recover execution to flat_map_nvim_io
        '''
        return eval_step(arg_0.vim)(arg_1.map(lambda a: a))

calls map to shift the recover execution to flat_map_nvim_io


def Func ( arg_0 ) : arg_1 = list ( ) for arg_2 in arg_0 . ops : if isinstance ( arg_2 , ProposalBuilder ) : arg_3 = arg_2 . get_raw ( ) if arg_3 : arg_1 . append ( arg_3 ) elif isinstance ( arg_2 , arg_0 . operation_class ) : arg_1 . extend ( [ arg_2 ] ) else : arg_1 . extend ( [ arg_0 . operation_class ( arg_2 ) ] ) arg_1 = arg_0 . add_required_fees ( arg_1 , asset_id = arg_0 . fee_asset_id ) arg_4 = formatTimeFromNow ( arg_0 . expiration or arg_0 . blockchain . expiration or 30 ) arg_5 , arg_6 = arg_0 . get_block_params ( ) arg_0 . tx = arg_0 . signed_transaction_class ( arg_5 = arg_5 , arg_6 = arg_6 , arg_4 = arg_4 , operations = arg_1 , ) dict . update ( arg_0 , arg_0 . tx . json ( ) ) arg_0 . _unset_require_reconstruction ( )

def Func(arg_0):
        """ Construct the actual transaction and store it in the class's dict
            store
        """
        arg_1 = list()
        for arg_2 in arg_0.ops:
            if isinstance(arg_2, ProposalBuilder):
                # This operation is a proposal an needs to be deal with
                # differently
                arg_3 = arg_2.get_raw()
                if arg_3:
                    arg_1.append(arg_3)
            elif isinstance(arg_2, arg_0.operation_class):
                arg_1.extend([arg_2])
            else:
                # otherwise, we simply wrap ops into Operations
                arg_1.extend([arg_0.operation_class(arg_2)])

        # We now wrap everything into an actual transaction
        arg_1 = arg_0.add_required_fees(arg_1, asset_id=arg_0.fee_asset_id)
        arg_4 = formatTimeFromNow(
            arg_0.expiration
            or arg_0.blockchain.expiration
            or 30  # defaults to 30 seconds
        )
        arg_5, arg_6 = arg_0.get_block_params()
        arg_0.tx = arg_0.signed_transaction_class(
            arg_5=arg_5,
            arg_6=arg_6,
            arg_4=arg_4,
            operations=arg_1,
        )
        dict.update(arg_0, arg_0.tx.json())
        arg_0._unset_require_reconstruction()

Construct the actual transaction and store it in the class s dict store


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_1 in arg_0 . available_events : arg_0 . available_events [ arg_1 ] [ 'subscribers' ] . add ( arg_2 )

def Func(arg_0, arg_1, arg_2):
        """
        Add a new websocket subscriber to an event.

        name -- name of the event
        ws -- the websocket
        """
        if arg_1 in arg_0.available_events:
            arg_0.available_events[arg_1]['subscribers'].add(arg_2)

Add a new websocket subscriber to an event .


def Func ( arg_0 ) : arg_1 = [ ] arg_0 . cnxn . xfer ( [ 0x3F ] ) sleep ( 9e-3 ) for arg_2 in range ( 60 ) : arg_3 = arg_0 . cnxn . xfer ( [ 0x00 ] ) [ 0 ] arg_1 . append ( chr ( arg_3 ) ) sleep ( 0.1 ) return '' . join ( arg_1 )

def Func(arg_0):
        """Reads the information string for the OPC

        :rtype: string

        :Example:

        >>> alpha.Func()
        'OPC-N2 FirmwareVer=OPC-018.2....................BD'
        """
        arg_1 = []

        # Send the command byte and sleep for 9 ms
        arg_0.cnxn.xfer([0x3F])
        sleep(9e-3)

        # Read the info string by sending 60 empty bytes
        for arg_2 in range(60):
            arg_3 = arg_0.cnxn.xfer([0x00])[0]
            arg_1.append(chr(arg_3))

        sleep(0.1)

        return ''.join(arg_1)

Reads the information string for the OPC

        :rtype: string

        :Example:

        >>> alpha.read_info_string()
        'OPC-N2 FirmwareVer=OPC-018.2....................BD'


(
            self, location, name, type, custom_headers=None, raw=False, **operation_config)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
=
,
arg_5
=
False
,
**
arg_6
)
:
arg_7
=
models
.
CheckNameAvailabilityRequest
(
arg_2
=
arg_2
,
arg_3
=
arg_3
)
arg_8
=
arg_0
.
Func
.
metadata
[
'url'
]
arg_9
=
{
'subscriptionId'
:
arg_0
.
_serialize
.
url
(
"self.config.subscription_id"
,
arg_0
.
config
.
subscription_id
,
'str'
)
,
'location'
:
arg_0
.
_serialize
.
url
(
"location"
,
arg_1
,
'str'
,
max_length
=
90
,
min_length
=
1
,
pattern
=
r'^[-\w\._\(\)]+$'
)
}
arg_8
=
arg_0
.
_client
.
format_url
(
arg_8
,
**
arg_9
)
arg_10
=
{
}
arg_10
[
'api-version'
]
=
arg_0
.
_serialize
.
query
(
"self.api_version"
,
arg_0
.
api_version
,
'str'
)
arg_11
=
{
}
arg_11
[
'Accept'
]
=
'application/json'
arg_11
[
'Content-Type'
]
=
'application/json; charset=utf-8'
if
arg_0
.
config
.
generate_client_request_id
:
arg_11
[
'x-ms-client-request-id'
]
=
str
(
uuid
.
uuid1
(
)
)
if
arg_4
:
arg_11
.
update
(
arg_4
)
if
arg_0
.
config
.
accept_language
is
not
:
arg_11
[
'accept-language'
]
=
arg_0
.
_serialize
.
header
(
"self.config.accept_language"
,
arg_0
.
config
.
accept_language
,
'str'
)
arg_12
=
arg_0
.
_serialize
.
body
(
arg_7
,
'CheckNameAvailabilityRequest'
)
arg_13
=
arg_0
.
_client
.
post
(
arg_8
,
arg_10
,
arg_11
,
arg_12
)
arg_14
=
arg_0
.
_client
.
send
(
arg_13
,
stream
=
False
,
**
arg_6
)
if
arg_14
.
status_code
not
in
[
200
]
:
raise
models
.
ErrorResponseException
(
arg_0
.
_deserialize
,
arg_14
)
arg_15
=
if
arg_14
.
status_code
==
200
:
arg_15
=
arg_0
.
_deserialize
(
'CheckNameAvailabilityResponse'
,
arg_14
)
if
arg_5
:
arg_16
=
ClientRawResponse
(
arg_15
,
arg_14
)
return
arg_16
return
arg_15

def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=False, **arg_6):
        """Check Name Availability for global uniqueness.

        :param location: The location in which uniqueness will be verified.
        :type location: str
        :param name: Resource Name To Verify
        :type name: str
        :param type: Fully qualified resource type which includes provider
         namespace
        :type type: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: CheckNameAvailabilityResponse or ClientRawResponse if
         raw=true
        :rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse
         or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
        """
        arg_7 = models.CheckNameAvailabilityRequest(arg_2=arg_2, arg_3=arg_3)

        # Construct URL
        arg_8 = arg_0.Func.metadata['url']
        arg_9 = {
            'subscriptionId': arg_0._serialize.url("self.config.subscription_id", arg_0.config.subscription_id, 'str'),
            'location': arg_0._serialize.url("location", arg_1, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
        }
        arg_8 = arg_0._client.format_url(arg_8, **arg_9)

        # Construct parameters
        arg_10 = {}
        arg_10['api-version'] = arg_0._serialize.query("self.api_version", arg_0.api_version, 'str')

        # Construct headers
        arg_11 = {}
        arg_11['Accept'] = 'application/json'
        arg_11['Content-Type'] = 'application/json; charset=utf-8'
        if arg_0.config.generate_client_request_id:
            arg_11['x-ms-client-request-id'] = str(uuid.uuid1())
        if arg_4:
            arg_11.update(arg_4)
        if arg_0.config.accept_language is not None:
            arg_11['accept-language'] = arg_0._serialize.header("self.config.accept_language", arg_0.config.accept_language, 'str')

        # Construct body
        arg_12 = arg_0._serialize.body(arg_7, 'CheckNameAvailabilityRequest')

        # Construct and send request
        arg_13 = arg_0._client.post(arg_8, arg_10, arg_11, arg_12)
        arg_14 = arg_0._client.send(arg_13, stream=False, **arg_6)

        if arg_14.status_code not in [200]:
            raise models.ErrorResponseException(arg_0._deserialize, arg_14)

        arg_15 = None

        if arg_14.status_code == 200:
            arg_15 = arg_0._deserialize('CheckNameAvailabilityResponse', arg_14)

        if arg_5:
            arg_16 = ClientRawResponse(arg_15, arg_14)
            return arg_16

        return arg_15

Check Name Availability for global uniqueness .


(self, method, params, id_, randomSeed=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = None ) : if arg_4 is not None : arg_5 . random_streams . random_seed = arg_4 arg_5 . alea_random = alea . Alea ( arg_4 ) arg_0 . api . method ( arg_1 , arg_2 , arg_3 ) arg_0 . reply ( 'updated' , methods = [ arg_3 ] )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):
        """DDP method handler."""
        if arg_4 is not None:
            arg_5.random_streams.random_seed = arg_4
            arg_5.alea_random = alea.Alea(arg_4)
        arg_0.api.method(arg_1, arg_2, arg_3)
        arg_0.reply('updated', methods=[arg_3])


(self, data, assert_ss=True, deassert_ss=True)

def Func(arg_0, arg_1, arg_2=True, arg_3=True):
        """Full-duplex SPI read and write.  If assert_ss is true, the SS line
        will be asserted low, the specified bytes will be clocked out the MOSI
        line while bytes will also be read from the MISO line, and if
        deassert_ss is true the SS line will be put back high.  Bytes which are
        read will be returned as a bytearray object.
        """
        if arg_0._mosi is None:
            raise RuntimeError('Write attempted with no MOSI pin specified.')
        if arg_0._miso is None:
            raise RuntimeError('Read attempted with no MISO pin specified.')
        if arg_2 and arg_0._ss is not None:
            arg_0._gpio.set_low(arg_0._ss)
        arg_4 = bytearray(len(arg_1))
        for arg_5 in range(len(arg_1)):
            for arg_6 in range(8):
                # Write bit to MOSI.
                if arg_0._write_shift(arg_1[arg_5], arg_6) & arg_0._mask:
                    arg_0._gpio.set_high(arg_0._mosi)
                else:
                    arg_0._gpio.set_low(arg_0._mosi)
                # Flip clock off base.
                arg_0._gpio.output(arg_0._sclk, not arg_0._clock_base)
                # Handle read on leading edge of clock.
                if arg_0._read_leading:
                    if arg_0._gpio.is_high(arg_0._miso):
                        # Set bit to 1 at appropriate location.
                        arg_4[arg_5] |= arg_0._read_shift(arg_0._mask, arg_6)
                    else:
                        # Set bit to 0 at appropriate location.
                        arg_4[arg_5] &= ~arg_0._read_shift(arg_0._mask, arg_6)
                # Return clock to base.
                arg_0._gpio.output(arg_0._sclk, arg_0._clock_base)
                # Handle read on trailing edge of clock.
                if not arg_0._read_leading:
                    if arg_0._gpio.is_high(arg_0._miso):
                        # Set bit to 1 at appropriate location.
                        arg_4[arg_5] |= arg_0._read_shift(arg_0._mask, arg_6)
                    else:
                        # Set bit to 0 at appropriate location.
                        arg_4[arg_5] &= ~arg_0._read_shift(arg_0._mask, arg_6)
        if arg_3 and arg_0._ss is not None:
            arg_0._gpio.set_high(arg_0._ss)
        return arg_4

Full - duplex SPI read and write . If assert_ss is true the SS line will be asserted low the specified bytes will be clocked out the MOSI line while bytes will also be read from the MISO line and if deassert_ss is true the SS line will be put back high . Bytes which are read will be returned as a bytearray object .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
arg_0
.
_format_message
(
arg_1
,
arg_2
)
if
arg_3
is
not
:
logger
.
info
(
'Sending message: %r'
,
truncate
(
arg_3
,
max_len
=
50
)
,
)
arg_0
.
socket
.
send_str
(
arg_3
)

def Func(arg_0, arg_1, arg_2):
        """Respond to a message on the current socket.

        Args:
          channel (:py:class:`str`): The channel to send to.
          text (:py:class:`str`): The message text to send.

        """
        arg_3 = arg_0._format_message(arg_1, arg_2)
        if arg_3 is not None:
            logger.info(
                'Sending message: %r',
                truncate(arg_3, max_len=50),
            )
        arg_0.socket.send_str(arg_3)

Respond to a message on the current socket .


def Func(arg_0=None):
    """Entry point for pkginfo tool
    """
    arg_1, arg_2 = _parse_options(arg_0)
    arg_3 = getattr(arg_1, 'output', 'simple')
    arg_4 = _FORMATTERS[arg_3](arg_1)

    for arg_5 in arg_2:
        arg_6 = get_metadata(arg_5, arg_1.metadata_version)
        if arg_6 is None:
            continue

        if arg_1.download_url_prefix:
            if arg_6.download_url is None:
                arg_7 = os.path.basename(arg_5)
                arg_6.download_url = '%s/%s' % (arg_1.download_url_prefix,
                                               arg_7)

        arg_4(arg_6)

    arg_4.finish()


def Func ( arg_0 ) : with open ( arg_0 ) as f : arg_1 = f . readlines ( ) arg_2 = [ ] for arg_3 in arg_1 : arg_4 = ast . literal_eval ( arg_3 ) arg_2 . append ( arg_4 ) return arg_2

def Func(arg_0):
    """Load the positions of an image.

    Positions correspond to a set of pixels in the lensed source galaxy that are anticipated to come from the same \
    multiply-imaged region of the source-plane. Mass models which do not trace the pixels within a threshold value of \
    one another are resampled during the non-linear search.

    Positions are stored in a .dat file, where each line of the file gives a list of list of (y,x) positions which \
    correspond to the same region of the source-plane. Thus, multiple source-plane regions can be input over multiple \
    lines of the same positions file.

    Parameters
    ----------
    positions_path : str
        The path to the positions .dat file containing the positions (e.g. '/path/to/positions.dat')
    """
    with open(arg_0) as f:
        arg_1 = f.readlines()

    arg_2 = []

    for arg_3 in arg_1:
        arg_4 = ast.literal_eval(arg_3)
        arg_2.append(arg_4)

    return arg_2


def Func ( arg_0 , arg_1 ) : try : arg_2 = arg_1 . get ( "ExtraBytesVlr" ) [ 0 ] . type_of_extra_dims ( ) except IndexError : arg_2 = None arg_3 = PointFormat ( arg_0 . header . point_format_id , arg_2 = arg_2 ) if arg_0 . header . are_points_compressed : arg_4 = arg_1 . pop ( arg_1 . index ( "LasZipVlr" ) ) arg_5 = arg_0 . _read_compressed_points_data ( arg_4 , arg_3 ) else : arg_5 = record . PackedPointRecord . from_stream ( arg_0 . stream , arg_3 , arg_0 . header . point_count ) return arg_5

def Func(arg_0, arg_1):
        """ private function to handle reading of the points record parts
        of the las file.

        the header is needed for the point format and number of points
        the vlrs are need to get the potential laszip vlr as well as the extra bytes vlr
        """
        try:
            arg_2 = arg_1.get("ExtraBytesVlr")[0].type_of_extra_dims()
        except IndexError:
            arg_2 = None

        arg_3 = PointFormat(arg_0.header.point_format_id, arg_2=arg_2)
        if arg_0.header.are_points_compressed:
            arg_4 = arg_1.pop(arg_1.index("LasZipVlr"))
            arg_5 = arg_0._read_compressed_points_data(arg_4, arg_3)
        else:
            arg_5 = record.PackedPointRecord.from_stream(
                arg_0.stream, arg_3, arg_0.header.point_count
            )
        return arg_5

private function to handle reading of the points record parts of the las file .


def
Func
(
arg_0
)
:
arg_1
=
LatexCommand
(
'documentclass'
,
{
'name'
:
'options'
,
'required'
:
False
,
'bracket'
:
'['
}
,
{
'name'
:
'class_name'
,
'required'
:
True
,
'bracket'
:
'{'
}
)
try
:
arg_2
=
next
(
arg_1
.
parse
(
arg_0
.
_tex
)
)
except
StopIteration
:
arg_0
.
_logger
.
warning
(
'lsstdoc has no documentclass'
)
arg_0
.
_document_options
=
[
]
try
:
arg_4
=
arg_2
[
'options'
]
arg_0
.
_document_options
=
[
opt
.
strip
(
)
for
opt
in
arg_4
.
split
(
','
)
]
except
KeyError
:
arg_0
.
_logger
.
warning
(
'lsstdoc has no documentclass options'
)
arg_0
.
_document_options
=
[
]

def Func(arg_0):
        """Parse documentclass options.

        Sets the the ``_document_options`` attribute.
        """
        arg_1 = LatexCommand(
            'documentclass',
            {'name': 'options', 'required': False, 'bracket': '['},
            {'name': 'class_name', 'required': True, 'bracket': '{'})
        try:
            arg_2 = next(arg_1.parse(arg_0._tex))
        except StopIteration:
            arg_0._logger.warning('lsstdoc has no documentclass')
            arg_0._document_options = []

        try:
            arg_4 = arg_2['options']
            arg_0._document_options = [opt.strip()
                                      for opt in arg_4.split(',')]
        except KeyError:
            arg_0._logger.warning('lsstdoc has no documentclass options')
            arg_0._document_options = []


def Func(arg_0, arg_1):
        """
        Validate the provided 'is_primary' parameter.

        Returns:
            The validated 'is_primary' value.

        Raises:
            serializers.ValidationError:
                If the user attempted to mark an unverified email as
                their primary email address.
        """
        # TODO: Setting 'is_primary' to 'False' should probably not be
        #       allowed.
        if arg_1 and not (arg_0.instance and arg_0.instance.is_verified):
            raise serializers.ValidationError(
                _(
                    "Unverified email addresses may not be used as the "
                    "primary address."
                )
            )

        return arg_1

Validate the provided is_primary parameter .


def
Func
(
arg_0
,
arg_1
)
:
arg_1
=
arg_1
.
lower
(
)
for
arg_2
in
"_- "
:
arg_1
=
arg_1
.
replace
(
arg_2
,
""
)
if
named_colors
.
has_key
(
arg_1
)
:
return
named_colors
[
arg_1
]
for
arg_3
in
[
"ish"
,
"ed"
,
"y"
,
"like"
]
:
arg_1
=
re
.
sub
(
"(.*?)"
+
arg_3
+
"$"
,
"\\1"
,
arg_1
)
arg_1
=
re
.
sub
(
"(.*?)dd$"
,
"\\1d"
,
arg_1
)
arg_4
=
[
]
for
arg_5
in
named_colors
:
if
arg_5
in
arg_1
or
arg_1
in
arg_5
:
arg_4
.
append
(
named_colors
[
arg_5
]
)
if
len
(
arg_4
)
>
0
:
return
choice
(
arg_4
)
return
named_colors
[
"transparent"
]

def Func(arg_0, arg_1):

        """ Returns RGB values based on a descriptive string.

        If the given str is a named color, return its RGB values.
        Otherwise, return a random named color that has str
        in its name, or a random named color which name appears in str.

        Specific suffixes (-ish, -ed, -y and -like) are recognised
        as well, for example, if you need a random variation of "red"
        you can use reddish (or greenish, yellowy, etc.)

        """

        arg_1 = arg_1.lower()
        for arg_2 in "_- ":
            arg_1 = arg_1.replace(arg_2, "")

        # if named_hues.has_key(str):
        #    clr = color(named_hues[str], 1, 1, mode="hsb")
        #    return clr.r, clr.g, clr.b

        if named_colors.has_key(arg_1):
            return named_colors[arg_1]

        for arg_3 in ["ish", "ed", "y", "like"]:
            arg_1 = re.sub("(.*?)" + arg_3 + "$", "\\1", arg_1)
        arg_1 = re.sub("(.*?)dd$", "\\1d", arg_1)

        arg_4 = []
        for arg_5 in named_colors:
            if arg_5 in arg_1 or arg_1 in arg_5:
                arg_4.append(named_colors[arg_5])
        if len(arg_4) > 0:
            return choice(arg_4)

        return named_colors["transparent"]

Returns RGB values based on a descriptive string .


def Func(arg_0, arg_1, arg_2=False):
        """
        Updates the current set of parameter values and previous values,
        sets a flag to re-calculate J.

        Parameters
        ----------
            new_vals : numpy.ndarray
                The new values to update to
            incremental : Bool, optional
                Set to True to make it an incremental update relative
                to the old parameters. Default is False
        """
        arg_0._last_vals = arg_0.param_vals.copy()
        if arg_2:
            arg_0.param_vals += arg_1
        else:
            arg_0.param_vals = arg_1.copy()
        #And we've updated, so JTJ is no longer valid:
        arg_0._fresh_JTJ = False

Updates the current set of parameter values and previous values sets a flag to re - calculate J .


def Func ( arg_0 ) : arg_1 = list ( ) arg_2 = arg_0 . get_data ( "droplets/%s/kernels/" % arg_0 . id ) while True : for arg_3 in arg_2 [ u'kernels' ] : arg_4 = Kernel ( ** arg_3 ) arg_4 . token = arg_0 . token arg_1 . append ( arg_4 ) try : arg_6 = arg_2 [ u'links' ] [ u'pages' ] . get ( u'next' ) if not arg_6 : break arg_2 = arg_0 . get_data ( arg_6 ) except KeyError : break return arg_1

def Func(arg_0):
        """
            Get a list of kernels available
        """

        arg_1 = list()
        arg_2 = arg_0.get_data("droplets/%s/kernels/" % arg_0.id)
        while True:
            for arg_3 in arg_2[u'kernels']:
                arg_4 = Kernel(**arg_3)
                arg_4.token = arg_0.token
                arg_1.append(arg_4)
            try:
                arg_6 = arg_2[u'links'][u'pages'].get(u'next')
                if not arg_6:
                        break
                arg_2 = arg_0.get_data(arg_6)
            except KeyError:  # No links.
                break

        return arg_1


def
Func
(
arg_0
)
:
arg_1
=
datetime
.
now
(
)
.
strftime
(
'%Y-%m-%d %H:%M:%S.%f'
)
print_error
(
'%s: Exception %s: %s'
%
(
arg_1
,
type
(
arg_0
)
.
__name__
,
str
(
arg_0
)
)
)
return
isinstance
(
arg_0
,
oauth2client
.
client
.
AccessTokenRefreshError
)

def Func(arg_0):
  """Return True if we should retry, False otherwise."""
  arg_1 = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
  print_error(
      '%s: Exception %s: %s' % (arg_1, type(arg_0).__name__, str(arg_0)))
  return isinstance(arg_0, oauth2client.client.AccessTokenRefreshError)

Return True if we should retry False otherwise .


return itertools.ifilter(
        lambda x: x is not None,
        itertools.imap(_make_stream_item, reader))

def Func ( arg_0 ) : arg_1 = ProtoStreamReader ( arg_0 ) return itertools . ifilter ( lambda x : x is not None , itertools . imap ( _make_stream_item , arg_1 ) )

def Func(arg_0):
    """Given a spinn3r feed, produce a sequence of valid StreamItems.

    Because of goopy Python interactions, you probably need to call
    this and re-yield its results, as

    >>> with open(filename, 'rb') as f:
    ...   for si in Func(f):
    ...     yield si

    """
    arg_1 = ProtoStreamReader(arg_0)
    return itertools.ifilter(
        lambda x: x is not None,
        itertools.imap(_make_stream_item, arg_1))

Given a spinn3r feed, produce a sequence of valid StreamItems.

    Because of goopy Python interactions, you probably need to call
    this and re-yield its results, as

    >>> with open(filename, 'rb') as f:
    ...   for si in _make_stream_items(f):
    ...     yield si

Given a spinn3r feed produce a sequence of valid StreamItems .


def Func(arg_0, arg_1):
        """Prefilter a line that has been converted to a LineInfo object.

        This implements the checker/handler part of the prefilter pipe.
        """
        # print "Func: ", line_info
        arg_2 = arg_0.find_handler(arg_1)
        return arg_2.handle(arg_1)

Prefilter a line that has been converted to a LineInfo object .


def
Func
(
arg_0
)
:
logger
.
info
(
'Loading refresh_token from %s'
,
repr
(
arg_0
.
_filename
)
)
try
:
with
open
(
arg_0
.
_filename
)
as
f
:
return
f
.
read
(
)
except
IOError
as
e
:
logger
.
info
(
'Failed to load refresh_token: %s'
,
e
)

def Func(arg_0):
        """Get cached refresh token.

        Returns:
            Cached refresh token, or ``None`` on failure.
        """
        logger.info(
            'Loading refresh_token from %s', repr(arg_0._filename)
        )
        try:
            with open(arg_0._filename) as f:
                return f.read()
        except IOError as e:
            logger.info('Failed to load refresh_token: %s', e)


def Func(arg_0, arg_1, arg_2=None):
    '''
    Writes a certificate file to the specified location.  This can then be used
    to instantiate ServiceManagementService.  Returns the subscription ID.

    publish_settings_path:
        Path to subscription file downloaded from
        http://go.microsoft.com/fwlink/?LinkID=301775
    path_to_write_certificate:
        Path to write the certificate file.
    subscription_id:
        (optional)  Provide a subscription id here if you wish to use a
        specific subscription under the publish settings file.
    '''
    import base64

    try:
        from xml.etree import cElementTree as ET
    except ImportError:
        from xml.etree import ElementTree as ET

    try:
        import OpenSSL.crypto as crypto
    except:
        raise Exception("pyopenssl is required to use Func")

    _validate_not_none('publish_settings_path', arg_0)
    _validate_not_none('path_to_write_certificate', arg_1)

    # parse the publishsettings file and find the ManagementCertificate Entry
    arg_3 = ET.parse(arg_0)
    arg_4 = arg_3.getroot().findall("./PublishProfile/Subscription")

    # Default to the first subscription in the file if they don't specify
    # or get the matching subscription or return none.
    if arg_2:
        arg_5 = next((s for s in arg_4 if s.get('Id').lower() == arg_2.lower()), None)
    else:
        arg_5 = arg_4[0]

    # validate that subscription was found
    if arg_5 is None:
        raise ValueError("The provided subscription_id '{}' was not found in the publish settings file provided at '{}'".format(arg_2, arg_0))

    arg_6 = _decode_base64_to_bytes(arg_5.get('ManagementCertificate'))

    # Load the string in pkcs12 format.  Don't provide a password as it isn't encrypted.
    arg_7 = crypto.load_pkcs12(arg_6, b'')

    # Write the data out as a PEM format to a random location in temp for use under this run.
    with open(arg_1, 'wb') as f:
        f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, arg_7.get_certificate()))
        f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, arg_7.get_privatekey()))

    return arg_5.get('Id')

Writes a certificate file to the specified location . This can then be used to instantiate ServiceManagementService . Returns the subscription ID .


def Func(arg_0, arg_1):
        """Unregister a checker instance."""
        if arg_1 in arg_0._checkers:
            arg_0._checkers.remove(arg_1)


def Func ( arg_0 , arg_1 ) : arg_0 . Clear ( ) for arg_2 in arg_1 . split ( ',' ) : arg_0 . paths . append ( arg_2 )

def Func(arg_0, arg_1):
    """Converts string to FieldMask according to proto3 JSON spec."""
    arg_0.Clear()
    for arg_2 in arg_1.split(','):
      arg_0.paths.append(arg_2)

Converts string to FieldMask according to proto3 JSON spec .


(df, method, pos, neg, classes, ascending)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):
    """The main function to rank an expression table.

       :param df:      gene_expression DataFrame.
       :param method:  The method used to calculate a correlation or ranking. Default: 'log2_ratio_of_classes'.
                       Others methods are:

                       1. 'signal_to_noise'

                          You must have at least three samples for each phenotype to use this metric.
                          The larger the signal-to-noise ratio, the larger the differences of the means (scaled by the standard deviations);
                          that is, the more distinct the gene expression is in each phenotype and the more the gene acts as a “class marker.”

                       2. 't_test'

                          Uses the difference of means scaled by the standard deviation and number of samples.
                          Note: You must have at least three samples for each phenotype to use this metric.
                          The larger the tTest ratio, the more distinct the gene expression is in each phenotype
                          and the more the gene acts as a “class marker.”

                       3. 'ratio_of_classes' (also referred to as fold change).

                          Uses the ratio of class means to calculate fold change for natural scale data.

                       4. 'diff_of_classes'

                          Uses the difference of class means to calculate fold change for natural scale data

                       5. 'log2_ratio_of_classes'

                          Uses the log2 ratio of class means to calculate fold change for natural scale data.
                          This is the recommended statistic for calculating fold change for log scale data.

       :param str pos: one of labels of phenotype's names.
       :param str neg: one of labels of phenotype's names.
       :param list classes:  a list of phenotype labels, to specify which column of dataframe belongs to what category of phenotype.
       :param bool ascending:  bool or list of bool. Sort ascending vs. descending.
       :return:

            returns a pd.Series of correlation to class of each variable. Gene_name is index, and value is rankings.

            visit here for more docs: http://software.broadinstitute.org/gsea/doc/GSEAUserGuideFrame.html
    """

    # exclude any zero stds.
    arg_6 = arg_0.groupby(by=arg_4, axis=1).mean()
    arg_7 =  arg_0.groupby(by=arg_4, axis=1).std()

    if arg_1 == 'signal_to_noise':
        arg_8 = (arg_6[arg_2] - arg_6[arg_3])/(arg_7[arg_2] + arg_7[arg_3])
    elif arg_1 == 't_test':
        arg_8 = (arg_6[arg_2] - arg_6[arg_3])/ np.sqrt(arg_7[arg_2]**2/len(arg_7)+arg_7[arg_3]**2/len(arg_7) )
    elif arg_1 == 'ratio_of_classes':
        arg_8 = arg_6[arg_2] / arg_6[arg_3]
    elif arg_1 == 'diff_of_classes':
        arg_8  = arg_6[arg_2] - arg_6[arg_3]
    elif arg_1 == 'log2_ratio_of_classes':
        arg_8  =  np.log2(arg_6[arg_2] / arg_6[arg_3])
    else:
        logging.error("Please provide correct method name!!!")
        sys.exit(0)
    arg_8 = arg_8.sort_values(arg_5=arg_5)

    return arg_8

The main function to rank an expression table .


def
Func
(
arg_0
)
:
if
isinstance
(
arg_0
,
numbers
.
Number
)
:
return
arg_0
,
arg_0
,
arg_0
if
not
arg_0
:
raise
ValueError
(
'Cannot create color from empty "%s"'
%
arg_0
)
if
isinstance
(
arg_0
,
str
)
:
return
name_Func
(
arg_0
)
if
isinstance
(
arg_0
,
list
)
:
arg_0
=
tuple
(
arg_0
)
if
isinstance
(
arg_0
,
tuple
)
:
if
len
(
arg_0
)
>
3
:
return
arg_0
[
:
3
]
while
len
(
arg_0
)
<
3
:
arg_0
+=
(
arg_0
[
1
]
,
)
return
arg_0
raise
ValueError
(
'Cannot create color from "%s"'
%
arg_0
)

def Func(arg_0):
    """Try to coerce the argument into a color - a 3-tuple of numbers-"""
    if isinstance(arg_0, numbers.Number):
        return arg_0, arg_0, arg_0

    if not arg_0:
        raise ValueError('Cannot create color from empty "%s"' % arg_0)

    if isinstance(arg_0, str):
        return name_Func(arg_0)

    if isinstance(arg_0, list):
        arg_0 = tuple(arg_0)

    if isinstance(arg_0, tuple):
        if len(arg_0) > 3:
            return arg_0[:3]
        while len(arg_0) < 3:
            arg_0 += (arg_0[-1],)
        return arg_0

    raise ValueError('Cannot create color from "%s"' % arg_0)

Try to coerce the argument into a color - a 3 - tuple of numbers -


return _cputimes_ntuple(user, system, idle)

def Func():
    """Return system CPU times as a named tuple."""
    arg_0, arg_1, arg_2 = 0, 0, 0
    # computes system global times summing each processor value
    for arg_3 in _psutil_mswindows.Func():
        arg_0 += arg_3[0]
        arg_1 += arg_3[1]
        arg_2 += arg_3[2]
    return _cputimes_ntuple(arg_0, arg_1, arg_2)

Return system CPU times as a named tuple .


def Func ( arg_0 ) : try : re . compile ( arg_0 ) arg_1 = True except re . error : arg_1 = False return arg_1

def Func(arg_0):
    """
    Checks whether the re module can compile the given regular expression.

    Parameters
    ----------
    string: str

    Returns
    -------
    boolean
    """
    try:
        re.compile(arg_0)
        arg_1 = True
    except re.error:
        arg_1 = False
    return arg_1

Checks whether the re module can compile the given regular expression .


def Func ( arg_0 , arg_1 = '' ) : arg_2 = os . listdir ( arg_0 ) arg_2 . sort ( ) if arg_1 : arg_2 = search_list ( arg_2 , arg_1 ) arg_2 = [ op . join ( arg_0 , fname ) for fname in arg_2 ] return arg_2

def Func(arg_0, arg_1=''):
    """
    Creates a list of files that match the search_regex within file_dir.
    The list of files will have file_dir as path prefix.

    Parameters
    ----------
    @param file_dir:

    @param search_regex:

    Returns:
    --------
    List of paths to files that match the search_regex
    """
    arg_2 = os.listdir(arg_0)
    arg_2.sort()

    if arg_1:
        arg_2 = search_list(arg_2, arg_1)

    arg_2 = [op.join(arg_0, fname) for fname in arg_2]

    return arg_2

Creates a list of files that match the search_regex within file_dir . The list of files will have file_dir as path prefix .


def Func(arg_0):
    """Calls right function according to file extension
    """
    arg_1, arg_2 = get_file_extension(arg_0)
    arg_3 = json_Func if arg_2 == '.json' else yaml_Func
    return arg_3(arg_0)


def Func(arg_0, arg_1, arg_2=None):
        """
        Apply a function to tensors.
        """
        arg_3 = arg_2 if arg_2 else arg_0.output_dim
        return NeuralVariable(arg_1(arg_0.tensor), arg_3)


def Func(arg_0):
        """Returns a single percentage value for coverage."""
        if arg_0.n_statements > 0:
            arg_1 = (100.0 * (arg_0.n_executed + arg_0.n_executed_branches) /
                        (arg_0.n_statements + arg_0.n_branches))
        else:
            arg_1 = 100.0
        return arg_1

Returns a single percentage value for coverage .


(self, draw_color=None, fill_color=None, text_color=None)

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = None ) : if arg_1 is None : arg_1 = PDFColor ( ) arg_1 . _set_type ( 'd' ) if arg_2 is None : arg_2 = PDFColor ( ) arg_2 . _set_type ( 'f' ) if arg_3 is None : arg_3 = PDFColor ( ) arg_3 . _set_type ( 't' ) arg_0 . draw_color = arg_1 arg_0 . fill_color = arg_2 arg_0 . text_color = arg_3

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):
        """ Default color object is black letters
            & black lines."""
        if arg_1 is None:
            arg_1 = PDFColor()
            arg_1._set_type('d')
        if arg_2 is None:
            arg_2 = PDFColor()
            arg_2._set_type('f')
        if arg_3 is None:
            arg_3 = PDFColor()
            arg_3._set_type('t')

        arg_0.draw_color = arg_1
        arg_0.fill_color = arg_2
        arg_0.text_color = arg_3

Default color object is black letters & black lines .


def Func ( arg_0 ) : arg_1 = arg_0 . getparent ( ) assert arg_1 is not None arg_2 = arg_0 . getprevious ( ) if arg_0 . text and isinstance ( arg_0 . tag , basestring ) : if arg_2 is None : arg_1 . text = ( arg_1 . text or '' ) + arg_0 . text else : arg_2 . tail = ( arg_2 . tail or '' ) + arg_0 . text if arg_0 . tail : if len ( arg_0 ) : arg_5 = arg_0 [ - 1 ] arg_5 . tail = ( arg_5 . tail or '' ) + arg_0 . tail elif arg_2 is None : arg_1 . text = ( arg_1 . text or '' ) + arg_0 . tail else : arg_2 . tail = ( arg_2 . tail or '' ) + arg_0 . tail arg_6 = arg_1 . index ( arg_0 ) arg_1 [ arg_6 : arg_6 + 1 ] = arg_0 [ : ]

def Func(arg_0):
        """
        Remove the tag, but not its children or text.  The children and text
        are merged into the parent.

        Example::

            >>> h = fragment_fromstring('
Hello World!
')
            >>> h.find('.//b').Func()
            >>> print(tostring(h, encoding='unicode'))

Hello World!

        """
        arg_1 = arg_0.getparent()
        assert arg_1 is not None
        arg_2 = arg_0.getprevious()
        if arg_0.text and isinstance(arg_0.tag, basestring):
            # not a Comment, etc.
            if arg_2 is None:
                arg_1.text = (arg_1.text or '') + arg_0.text
            else:
                arg_2.tail = (arg_2.tail or '') + arg_0.text
        if arg_0.tail:
            if len(arg_0):
                arg_5 = arg_0[-1]
                arg_5.tail = (arg_5.tail or '') + arg_0.tail
            elif arg_2 is None:
                arg_1.text = (arg_1.text or '') + arg_0.tail
            else:
                arg_2.tail = (arg_2.tail or '') + arg_0.tail
        arg_6 = arg_1.index(arg_0)
        arg_1[arg_6:arg_6+1] = arg_0[:]

Remove the tag, but not its children or text.  The children and text
        are merged into the parent.

        Example::

            >>> h = fragment_fromstring('
Hello World!
')
            >>> h.find('.//b').drop_tag()
            >>> print(tostring(h, encoding='unicode'))

Hello World!

Remove the tag but not its children or text . The children and text are merged into the parent .


(self, start_node, name, predicate=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
)
:
def
_delete_from_children
(
arg_4
,
arg_5
)
:
del
arg_4
.
_children
[
arg_5
]
if
arg_5
in
arg_4
.
_groups
:
del
arg_4
.
_groups
[
arg_5
]
elif
arg_5
in
arg_4
.
_leaves
:
del
arg_4
.
_leaves
[
arg_5
]
else
:
raise
RuntimeError
(
'You shall not pass!'
)
def
Func_inner
(
arg_4
,
arg_3
)
:
if
not
arg_3
(
arg_4
)
:
return
False
elif
arg_4
.
v_is_group
:
for
arg_6
in
itools
.
chain
(
list
(
arg_4
.
_leaves
.
keys
(
)
)
,
list
(
arg_4
.
_groups
.
keys
(
)
)
)
:
arg_7
=
arg_4
.
_children
[
arg_6
]
arg_8
=
Func_inner
(
arg_7
,
arg_3
)
if
arg_8
:
_delete_from_children
(
arg_4
,
arg_6
)
del
arg_7
for
arg_9
in
list
(
arg_4
.
_links
.
keys
(
)
)
:
arg_4
.
f_remove_link
(
arg_9
)
if
len
(
arg_4
.
_children
)
==
0
:
arg_0
.
_delete_node
(
arg_4
)
return
True
else
:
return
False
else
:
arg_0
.
_delete_node
(
arg_4
)
return
True
if
arg_2
in
arg_1
.
_links
:
arg_1
.
f_remove_link
(
arg_2
)
else
:
arg_10
=
arg_1
.
_children
[
arg_2
]
if
arg_3
is
:
arg_3
=
lambda
x
:
True
if
Func_inner
(
arg_10
,
arg_3
)
:
_delete_from_children
(
arg_1
,
arg_2
)
del
arg_10
return
True
else
:
return
False

def Func(arg_0, arg_1, arg_2, arg_3=None):
        """Removes a subtree from the trajectory tree.

        Does not delete stuff from disk only from RAM.

        :param start_node: The parent node from where to start
        :param name: Name of child which will be deleted and recursively all nodes below the child
        :param predicate:

            Predicate that can be used to compute for individual nodes if they should be removed
            ``True`` or kept ``False``.

        """
        def _delete_from_children(arg_4, arg_5):
            del arg_4._children[arg_5]
            if arg_5 in arg_4._groups:
                del arg_4._groups[arg_5]
            elif arg_5 in arg_4._leaves:
                del arg_4._leaves[arg_5]
            else:
                raise RuntimeError('You shall not pass!')

        def Func_inner(arg_4, arg_3):

            if not arg_3(arg_4):
                return False
            elif arg_4.v_is_group:
                for arg_6 in itools.chain(list(arg_4._leaves.keys()),
                                          list(arg_4._groups.keys())):
                    arg_7 = arg_4._children[arg_6]
                    arg_8 = Func_inner(arg_7, arg_3)
                    if arg_8:
                        _delete_from_children(arg_4, arg_6)
                        del arg_7

                for arg_9 in list(arg_4._links.keys()):
                    arg_4.f_remove_link(arg_9)

                if len(arg_4._children) == 0:
                    arg_0._delete_node(arg_4)
                    return True
                else:
                    return False
            else:
                arg_0._delete_node(arg_4)
                return True

        if arg_2 in arg_1._links:
            arg_1.f_remove_link(arg_2)
        else:
            arg_10 = arg_1._children[arg_2]
            if arg_3 is None:
                arg_3 = lambda x: True

            if Func_inner(arg_10, arg_3):
                _delete_from_children(arg_1, arg_2)
                del arg_10
                return True
            else:
                return False

Removes a subtree from the trajectory tree .


def Func(arg_0, arg_1, arg_2, arg_3):
        """Drops a UNIQUE constraint for the specified hstore keys."""

        arg_4 = arg_0._unique_constraint_name(
            arg_1._meta.db_table, arg_2, arg_3)
        arg_5 = arg_0.sql_hstore_unique_drop.format(arg_4=arg_0.quote_name(arg_4))
        arg_0.execute(arg_5)

Drops a UNIQUE constraint for the specified hstore keys .


(self, filename=None, f_start=None, f_stop=None,
                        t_start=None, t_stop=None, load_data=True)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,
                        arg_4=None, arg_5=None, arg_6=True):
        """ Populate Filterbank instance with data from Filterbank file

        Note:
            This is to be deprecated in future, please use Waterfall() to open files.
        """
        if arg_1 is None:
            arg_1 = arg_0.filename
        else:
            arg_0.filename = arg_1

        arg_0.header = read_header(arg_1)

        #convert input frequencies into what their corresponding index would be
        arg_8, arg_9, arg_10, arg_11 = arg_0._setup_freqs(arg_2=arg_2, arg_3=arg_3)

        arg_12  = arg_0.header[b'nbits']
        arg_13  = int(arg_0.header[b'nbits'] / 8)
        arg_14 = arg_0.header[b'nchans']
        arg_15 = arg_0.freqs.shape[0]
        arg_16   = arg_0.header[b'nifs']

        # Load binary data
        arg_0.idx_data = len_header(arg_1)
        arg_18 = open(arg_1, 'rb')
        arg_18.seek(arg_0.idx_data)
        arg_19 = os.path.getsize(arg_0.filename)
        arg_20 = arg_19 - arg_0.idx_data

        # Finally add some other info to the class as objects
        arg_0.n_ints_in_file  = calc_n_ints_in_file(arg_0.filename)
        arg_0.file_size_bytes = arg_19

        ## Setup time axis
        arg_23, arg_24, arg_25 = arg_0._setup_time_axis(arg_4=arg_4, arg_5=arg_5)

        # Seek to first integration
        arg_18.seek(int(arg_23 * arg_12 * arg_16 * arg_14 / 8), 1)

        # Set up indexes used in file read (taken out of loop for speed)
        arg_26 = np.min((arg_10, arg_11))
        arg_27 = np.max((arg_10, arg_11))

        #Set up the data type (taken out of loop for speed)
        if arg_12 == 2:
            arg_28 = b'uint8'
            arg_15 = int(arg_15/4)
        elif arg_13 == 4:
            arg_28 = b'float32'
        elif arg_13 == 2:
            arg_28 = b'uint16'
        elif arg_13 == 1:
            arg_28 = b'uint8'

        if arg_6:

            if arg_25 * arg_16 * arg_15 > MAX_DATA_ARRAY_SIZE:
                print("[Filterbank]  Error: data array is too large to load. Either select fewer points or manually increase MAX_DATA_ARRAY_SIZE. Large files are now handle with Waterfall .")
                sys.exit()

            if arg_12 == 2:
                arg_0.data = np.zeros((arg_25, arg_16, arg_15*4), dtype=arg_28)
            else:
                arg_0.data = np.zeros((arg_25, arg_16, arg_15), dtype=arg_28)

            for arg_30 in range(arg_25):
                """d = f.read(n_bytes * n_chans * n_ifs)
                """

                for arg_31 in range(arg_16):

                    arg_18.seek(arg_13 * arg_26, 1) # 1 = from current location
                    #d = f.read(n_bytes * n_chans_selected)
                    #bytes_to_read = n_bytes * n_chans_selected

                    arg_32 = np.fromfile(arg_18, count=arg_15, dtype=arg_28)

                    # Reverse array if frequency axis is flipped
#                     if f_delt < 0:
#                         dd = dd[::-1]

                    if arg_12 == 2:
                        arg_32 = unpack_2to8(arg_32)
                    arg_0.data[arg_30, arg_31] = arg_32

                    arg_18.seek(arg_13 * (arg_14 - arg_27), 1)  # Seek to start of next block
        else:
            print("Skipping data load...")
            arg_0.data = np.array([0], dtype=arg_28)


def Func ( arg_0 ) : arg_1 = { } for arg_2 in arg_0 . fields : arg_3 = arg_0 . data . get ( arg_2 . name ) arg_1 [ arg_2 . name ] = arg_2 . Func ( arg_3 ) return arg_1

def Func(arg_0):
        """Prepare widget data for template."""
        arg_1 = {}

        for arg_2 in arg_0.fields:
            arg_3 = arg_0.data.get(arg_2.name)
            arg_1[arg_2.name] = arg_2.Func(arg_3)

        return arg_1


def Func ( ) : arg_0 = os . environ . get ( 'MODE' ) try : if arg_0 == 'PRODUCTION' : from . production import ProductionConfig return ProductionConfig elif arg_0 == 'TESTING' : from . testing import TestingConfig return TestingConfig else : from . development import DevelopmentConfig return DevelopmentConfig except ImportError : from . default import Config return Config

def Func():
    """Load config."""
    arg_0 = os.environ.get('MODE')
    try:
        if arg_0 == 'PRODUCTION':
            from .production import ProductionConfig
            return ProductionConfig
        elif arg_0 == 'TESTING':
            from .testing import TestingConfig
            return TestingConfig
        else:
            from .development import DevelopmentConfig
            return DevelopmentConfig
    except ImportError:
        from .default import Config
        return Config


def Func ( arg_0 = None , ** arg_1 ) : def actual_decorator ( arg_0 ) : arg_0 . _cli_Func = True arg_0 . _cli_Func_attrs = arg_1 return arg_0 if arg_0 and isinstance ( arg_0 , types . FunctionType ) : return actual_decorator ( arg_0 ) else : return actual_decorator

def Func(arg_0=None, **arg_1):
    """Mark this method as a CLI Func.

    This will only have any meaningful effect in methods that are members of a
    Resource subclass.
    """
    # Create the actual decorator to be applied.
    # This is done in such a way to make `@resources.Func`,
    # `@resources.Func()`, and `@resources.Func(foo='bar')` all work.
    def actual_decorator(arg_0):
        arg_0._cli_Func = True
        arg_0._cli_Func_attrs = arg_1
        return arg_0

    # If we got the method straight-up, apply the decorator and return
    # the decorated method; otherwise, return the actual decorator for
    # the Python interpreter to apply.
    if arg_0 and isinstance(arg_0, types.FunctionType):
        return actual_decorator(arg_0)
    else:
        return actual_decorator

Mark this method as a CLI command.

    This will only have any meaningful effect in methods that are members of a
    Resource subclass.


def Func(arg_0=1024, arg_1=0.1, arg_2=1024., arg_3=200):
    r"""Return a noisy cosine at a given frequency.

    :param N:           the final data size
    :param A:           the strength of the noise
    :param float sampling: sampling frequency of the input :attr:`data`.
    :param float freq:  the frequency :math:`f_0` of the cosine.

    .. math:: x[t] = cos(2\pi t * f_0) + A w[t]

    where w[t] is a white noise of variance 1.

    .. doctest::

        >>> from spectrum import Func
        >>> a = Func(N=1024, sampling=1024, A=0.5, freq=100)

    """
    arg_4 = arange(0, float(arg_0)/arg_2, 1./arg_2)
    arg_5 = cos(2.*pi*arg_4*arg_3) + arg_1 * randn(arg_4.size)
    return arg_5

r"""Return a noisy cosine at a given frequency.

    :param N:           the final data size
    :param A:           the strength of the noise
    :param float sampling: sampling frequency of the input :attr:`data`.
    :param float freq:  the frequency :math:`f_0` of the cosine.

    .. math:: x[t] = cos(2\pi t * f_0) + A w[t]

    where w[t] is a white noise of variance 1.

    .. doctest::

        >>> from spectrum import data_cosine
        >>> a = data_cosine(N=1024, sampling=1024, A=0.5, freq=100)

r Return a noisy cosine at a given frequency .


def Func(arg_0, arg_1, arg_2):
        """
        If the form and formsets are valid, save the associated models.
        """
        arg_3 = arg_0.form_valid(arg_1)
        for arg_4 in arg_2:
            arg_4.save()
        return arg_3

If the form and formsets are valid save the associated models .


def Func ( ) : arg_0 = pd . read_csv ( 'source_data/splice/splice.csv' ) arg_1 = arg_0 . reindex ( columns = [ x for x in arg_0 . columns . values if x != 'class' ] ) arg_1 [ 'dna' ] = arg_1 [ 'dna' ] . map ( lambda x : list ( str ( x ) . strip ( ) ) ) for arg_2 in range ( 60 ) : arg_1 [ 'dna_%d' % ( arg_2 , ) ] = arg_1 [ 'dna' ] . map ( lambda x : x [ arg_2 ] ) del arg_1 [ 'dna' ] arg_3 = arg_0 . reindex ( columns = [ 'class' ] ) arg_3 = preprocessing . LabelEncoder ( ) . fit_transform ( arg_3 . values . reshape ( - 1 , ) ) arg_4 = None return arg_1 , arg_3 , arg_4

def Func():
    """
    Load the mushroom dataset, split it into X and y, and then call the label encoder to get an integer y column.

    :return:
    """

    arg_0 = pd.read_csv('source_data/splice/splice.csv')
    arg_1 = arg_0.reindex(columns=[x for x in arg_0.columns.values if x != 'class'])
    arg_1['dna'] = arg_1['dna'].map(lambda x: list(str(x).strip()))
    for arg_2 in range(60):
        arg_1['dna_%d' % (arg_2, )] = arg_1['dna'].map(lambda x: x[arg_2])
    del arg_1['dna']

    arg_3 = arg_0.reindex(columns=['class'])
    arg_3 = preprocessing.LabelEncoder().fit_transform(arg_3.values.reshape(-1, ))

    # this data is truly categorical, with no known concept of ordering
    arg_4 = None

    return arg_1, arg_3, arg_4

Load the mushroom dataset split it into X and y and then call the label encoder to get an integer y column .


def
Func
(
arg_0
)
:
if
arg_0
.
v_is_root
:
raise
TypeError
(
'Root does not have a parent'
)
elif
arg_0
.
v_location
==
''
:
return
arg_0
.
v_root
else
:
return
arg_0
.
v_root
.
f_get
(
arg_0
.
v_location
,
fast_access
=
False
,
shortcuts
=
False
)

def Func(arg_0):
        """Returns the parent of the node.

        Raises a TypeError if current node is root.

        """
        if arg_0.v_is_root:
            raise TypeError('Root does not have a parent')
        elif arg_0.v_location == '':
            return arg_0.v_root
        else:
            return arg_0.v_root.f_get(arg_0.v_location, fast_access=False, shortcuts=False)


def
Func
(
*
arg_0
)
:
sh
(
'make %s'
%
' '
.
join
(
arg_0
)
,
cwd
=
options
.
paved
.
docs
.
path
)

def Func(*arg_0):
    """Call the Sphinx Makefile with the specified targets.

    `options.paved.docs.path`: the path to the Sphinx folder (where the Makefile resides).
    """
    sh('make %s' % ' '.join(arg_0), cwd=options.paved.docs.path)

Call the Sphinx Makefile with the specified targets .


def Func ( arg_0 , arg_1 ) : if arg_0 . __class__ not in arg_1 . context . accept : arg_2 = set ( ) for arg_3 in arg_1 . context . accept : arg_2 |= { arg_5 for arg_4 in arg_0 [ arg_3 ] for arg_5 in Func ( arg_4 , arg_1 ) } return arg_2 if isinstance ( arg_0 , Text ) : if arg_1 . index is not None : return { arg_0 . children [ arg_1 . index ] } return set ( arg_0 . children ) if isinstance ( arg_0 , ( Fact , Theory ) ) : return Func_tree_graph ( arg_0 . tree_graph , arg_1 ) if isinstance ( arg_0 , Topic ) : if arg_1 . kind == 'r' : if arg_1 . index is not None : return { arg_0 . root [ arg_1 . index ] } return set ( arg_0 . root ) else : if arg_1 . index is not None : return { arg_0 . flexing [ arg_1 . index ] } return set ( arg_0 . flexing )

def Func(arg_0, arg_1):
    """path is a mul of coord or a coord"""
    if arg_0.__class__ not in arg_1.context.accept:
        arg_2 = set()
        for arg_3 in arg_1.context.accept:
            arg_2 |= {arg_5 for arg_4 in arg_0[arg_3] for arg_5 in Func(arg_4, arg_1)}

        return arg_2

    if isinstance(arg_0, Text):
        if arg_1.index is not None:
            return {arg_0.children[arg_1.index]}

        return set(arg_0.children)

    if isinstance(arg_0, (Fact, Theory)):
        return Func_tree_graph(arg_0.tree_graph, arg_1)

    if isinstance(arg_0, Topic):
        if arg_1.kind == 'r':
            if arg_1.index is not None:
                return {arg_0.root[arg_1.index]}
            return set(arg_0.root)
        else:
            if arg_1.index is not None:
                return {arg_0.flexing[arg_1.index]}
            return set(arg_0.flexing)


(returns, live_start_date=None, ax=None, **kwargs)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
,
**
arg_3
)
:
if
arg_2
is
:
arg_2
=
plt
.
gca
(
)
arg_4
=
arg_0
if
arg_1
is
else
arg_0
.
loc
[
arg_0
.
index
<
arg_1
]
arg_5
=
ep
.
aggregate_returns
(
arg_4
,
'weekly'
)
arg_6
=
ep
.
aggregate_returns
(
arg_4
,
'monthly'
)
sns
.
boxplot
(
data
=
[
arg_4
,
arg_5
,
arg_6
]
,
palette
=
[
"#4c72B0"
,
"#55A868"
,
"#CCB974"
]
,
arg_2
=
arg_2
,
**
arg_3
)
if
arg_1
is
not
:
arg_7
=
arg_0
.
loc
[
arg_0
.
index
>=
arg_1
]
arg_8
=
ep
.
aggregate_returns
(
arg_7
,
'weekly'
)
arg_9
=
ep
.
aggregate_returns
(
arg_7
,
'monthly'
)
sns
.
swarmplot
(
data
=
[
arg_7
,
arg_8
,
arg_9
]
,
arg_2
=
arg_2
,
color
=
"red"
,
marker
=
"d"
,
**
arg_3
)
arg_10
=
matplotlib
.
lines
.
Line2D
(
[
]
,
[
]
,
color
=
"red"
,
marker
=
"d"
,
label
=
"Out-of-sample data"
,
linestyle
=
''
)
arg_2
.
legend
(
handles
=
[
arg_10
]
,
frameon
=
True
,
framealpha
=
0.5
)
arg_2
.
set_xticklabels
(
[
'Daily'
,
'Weekly'
,
'Monthly'
]
)
arg_2
.
set_title
(
'Return quantiles'
)
return
arg_2

def Func(arg_0, arg_1=None, arg_2=None, **arg_3):
    """
    Creates a box plot of daily, weekly, and monthly return
    distributions.

    Parameters
    ----------
    returns : pd.Series
        Daily returns of the strategy, noncumulative.
         - See full explanation in tears.create_full_tear_sheet.
    live_start_date : datetime, optional
        The point in time when the strategy began live trading, after
        its backtest period.
    ax : matplotlib.Axes, optional
        Axes upon which to plot.
    **kwargs, optional
        Passed to seaborn plotting function.

    Returns
    -------
    ax : matplotlib.Axes
        The axes that were plotted on.
    """

    if arg_2 is None:
        arg_2 = plt.gca()

    arg_4 = arg_0 if arg_1 is None \
        else arg_0.loc[arg_0.index < arg_1]
    arg_5 = ep.aggregate_returns(arg_4, 'weekly')
    arg_6 = ep.aggregate_returns(arg_4, 'monthly')
    sns.boxplot(data=[arg_4, arg_5, arg_6],
                palette=["#4c72B0", "#55A868", "#CCB974"],
                arg_2=arg_2, **arg_3)

    if arg_1 is not None:
        arg_7 = arg_0.loc[arg_0.index >= arg_1]
        arg_8 = ep.aggregate_returns(arg_7, 'weekly')
        arg_9 = ep.aggregate_returns(arg_7, 'monthly')

        sns.swarmplot(data=[arg_7, arg_8, arg_9], arg_2=arg_2,
                      color="red",
                      marker="d", **arg_3)
        arg_10 = matplotlib.lines.Line2D([], [], color="red", marker="d",
                                           label="Out-of-sample data",
                                           linestyle='')
        arg_2.legend(handles=[arg_10], frameon=True, framealpha=0.5)
    arg_2.set_xticklabels(['Daily', 'Weekly', 'Monthly'])
    arg_2.set_title('Return quantiles')

    return arg_2

Creates a box plot of daily weekly and monthly return distributions .


def Func(arg_0=(0.5, 0.5), arg_1=None):
    """Choice and return an an action by given the action probability distribution.

    Parameters
    ------------
    probs : list of float.
        The probability distribution of all actions.
    action_list : None or a list of int or others
        A list of action in integer, string or others. If None, returns an integer range between 0 and len(probs)-1.

    Returns
    --------
    float int or str
        The chosen action.

    Examples
    ----------
    >>> for _ in range(5):
    >>>     a = Func([0.2, 0.4, 0.4])
    >>>     print(a)
    0
    1
    1
    2
    1
    >>> for _ in range(3):
    >>>     a = Func([0.5, 0.5], ['a', 'b'])
    >>>     print(a)
    a
    b
    b

    """
    if arg_1 is None:
        arg_2 = len(arg_0)
        arg_1 = np.arange(arg_2)
    else:
        if len(arg_1) != len(arg_0):
            raise Exception("number of actions should equal to number of probabilities.")
    return np.random.choice(arg_1, p=arg_0)

Choice and return an an action by given the action probability distribution.

    Parameters
    ------------
    probs : list of float.
        The probability distribution of all actions.
    action_list : None or a list of int or others
        A list of action in integer, string or others. If None, returns an integer range between 0 and len(probs)-1.

    Returns
    --------
    float int or str
        The chosen action.

    Examples
    ----------
    >>> for _ in range(5):
    >>>     a = choice_action_by_probs([0.2, 0.4, 0.4])
    >>>     print(a)
    0
    1
    1
    2
    1
    >>> for _ in range(3):
    >>>     a = choice_action_by_probs([0.5, 0.5], ['a', 'b'])
    >>>     print(a)
    a
    b
    b

Choice and return an an action by given the action probability distribution .


def
Func
(
arg_0
,
arg_1
)
:
from
pprint
import
pformat
print
(
'% 5s: %s'
%
(
arg_0
,
'\n       '
.
join
(
pformat
(
arg_1
,
indent
=
4
,
width
=
75
,
)
.
split
(
'\n'
)
)
,
)
,
)

def Func(arg_0, arg_1):
    """Debug print name and val."""
    from pprint import pformat
    print(
        '% 5s: %s' % (
            arg_0,
            '\n       '.join(
                pformat(
                    arg_1, indent=4, width=75,
                ).split('\n')
            ),
        ),
    )


(x, y, z, normalize=False, kfki=0.889, zint=100.,
        polar_angle=0., wrap=True, **kwargs)

return hdet if normalize else hdet / hdet.sum()

def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=0.889, arg_5=100.,
        arg_6=0., arg_7=True, **arg_8):
    """
    Calculates the point spread function of a line-scanning confocal.

    Make x,y,z  __1D__ numpy.arrays, with x the direction along the
    scan line. (to make the calculation faster since I dont' need the line
    ilm for each x).

    Parameters
    ----------
        x : numpy.ndarray
            _One_dimensional_ array of the x grid points (along the line
            illumination) at which to evaluate the psf. In units of
            1/k_incoming.
        y : numpy.ndarray
            _One_dimensional_ array of the y grid points (in plane,
            perpendicular to the line illumination) at which to evaluate
            the psf. In units of 1/k_incoming.
        z : numpy.ndarray
            _One_dimensional_ array of the z grid points (along the
            optical axis) at which to evaluate the psf. In units of
            1/k_incoming.
        normalize : Bool, optional
            Set to True to include the effects of PSF normalization on
            the image intensity. Default is False.
        kfki : Float, optional
            The ratio of the final light's wavevector to the incoming.
            Default is 0.889
        zint : Float, optional
            The position of the optical interface, in units of 1/k_incoming
            Default is 100.
        wrap : Bool, optional
            If True, wraps the psf calculation for speed, assuming that
            the input x, y are regularly-spaced points. If x,y are not
            regularly spaced then `wrap` must be set to False. Default is True.
        polar_angle : Float, optional
            The polarization angle of the light (radians) with respect to
            the line direction (x). Default is 0.

    Other Parameters
    ----------------
        alpha : Float
            The opening angle of the lens. Default is 1.
        n2n1 : Float
            The ratio of the index in the 2nd medium to that in the first.
            Default is 0.95

    Returns
    -------
        numpy.ndarray
            A 3D- numpy.array of the point-spread function. Indexing is
            psf[x,y,z]; shape is [x.size, y,size, z.size]
    """

    #0. Set up vecs
    if arg_7:
        arg_9 = vec_to_halfvec(arg_0)
        arg_10 = vec_to_halfvec(arg_1)
        arg_11, arg_12, arg_13 = np.meshgrid(arg_9, arg_10, arg_2, indexing='ij')
    else:
        arg_11,arg_12,arg_13 = np.meshgrid(arg_0, arg_1, arg_2, indexing='ij')
    arg_14 = np.sqrt(arg_11*arg_11 + arg_12*arg_12)

    #1. Hilm
    if arg_7:
        arg_15,arg_16 = np.meshgrid(arg_10, arg_2, indexing='ij')
        arg_17 = calculate_linescan_ilm_psf(arg_15, arg_16, arg_5=arg_5,
                arg_6=arg_6, **arg_8)
        if arg_10[0] == 0:
            arg_18 = np.append(arg_17[-1:0:-1], arg_17, axis=0)
        else:
            arg_18 = np.append(arg_17[::-1], arg_17, axis=0)
    else:
        arg_15,arg_16 = np.meshgrid(arg_1, arg_2, indexing='ij')
        arg_18 = calculate_linescan_ilm_psf(arg_15, arg_16, arg_5=arg_5,
                arg_6=arg_6, **arg_8)

    #2. Hdet
    if arg_7:
        #Lambda function that ignores its args but still returns correct values
        arg_19 = lambda *args: get_hsym_asym(arg_14*arg_4, arg_13*arg_4, arg_5=arg_4*arg_5,
                    get_hdet=True, **arg_8)[0]
        arg_20 = wrap_and_calc_psf(arg_9, arg_10, arg_2, arg_19)
    else:
        arg_20, arg_21 = get_hsym_asym(arg_14*arg_4, arg_13*arg_4, arg_5=arg_4*arg_5,
                get_hdet=True, **arg_8)

    if arg_3:
        arg_18 /= arg_18.sum()
        arg_20 /= arg_20.sum()

    for arg_22 in range(arg_0.size):
        arg_20[arg_22] *= arg_18

    return arg_20 if arg_3 else arg_20 / arg_20.sum()

Calculates the point spread function of a line - scanning confocal .