(self, institute, case, user, link, level, omim_id, remove=False)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_6
,
arg_7
=
False
)
:
if
arg_5
==
'phenotype'
:
arg_8
=
'diagnosis_phenotypes'
elif
arg_5
==
'gene'
:
arg_8
=
'diagnosis_genes'
else
:
raise
TypeError
(
'wrong level'
)
arg_9
=
arg_2
.
get
(
arg_8
,
[
]
)
arg_10
=
int
(
arg_6
.
split
(
':'
)
[
1
]
)
arg_11
=
if
arg_7
and
arg_10
in
arg_9
:
arg_11
=
arg_0
.
case_collection
.
find_one_and_update
(
{
'_id'
:
arg_2
[
'_id'
]
}
,
{
'$pull'
:
{
arg_8
:
arg_10
}
}
,
return_document
=
pymongo
.
ReturnDocument
.
AFTER
)
elif
arg_10
not
in
arg_9
:
arg_11
=
arg_0
.
case_collection
.
find_one_and_update
(
{
'_id'
:
arg_2
[
'_id'
]
}
,
{
'$push'
:
{
arg_8
:
arg_10
}
}
,
return_document
=
pymongo
.
ReturnDocument
.
AFTER
)
if
arg_11
:
arg_0
.
create_event
(
arg_1
=
arg_1
,
arg_2
=
arg_2
,
arg_3
=
arg_3
,
arg_4
=
arg_4
,
category
=
'case'
,
verb
=
'update_diagnosis'
,
subject
=
arg_2
[
'display_name'
]
,
content
=
arg_6
)
return
arg_11

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7=False):
        """Diagnose a case using OMIM ids.

        Arguments:
            institute (dict): A Institute object
            case (dict): Case object
            user (dict): A User object
            link (str): The url to be used in the event
            level (str): choices=('phenotype','gene')

        Return:
            updated_case

        """
        if arg_5 == 'phenotype':
            arg_8 = 'diagnosis_phenotypes'
        elif arg_5 == 'gene':
            arg_8 = 'diagnosis_genes'
        else:
            raise TypeError('wrong level')

        arg_9 = arg_2.get(arg_8, [])
        arg_10 = int(arg_6.split(':')[-1])

        arg_11 = None
        if arg_7 and arg_10 in arg_9:
            arg_11 = arg_0.case_collection.find_one_and_update(
                {'_id': arg_2['_id']},
                {'$pull': {arg_8: arg_10}},
                return_document=pymongo.ReturnDocument.AFTER
            )

        elif arg_10 not in arg_9:
            arg_11 = arg_0.case_collection.find_one_and_update(
                {'_id': arg_2['_id']},
                {'$push': {arg_8: arg_10}},
                return_document=pymongo.ReturnDocument.AFTER
            )

        if arg_11:
            arg_0.create_event(
                arg_1=arg_1,
                arg_2=arg_2,
                arg_3=arg_3,
                arg_4=arg_4,
                category='case',
                verb='update_diagnosis',
                subject=arg_2['display_name'],
                content=arg_6
            )

        return arg_11


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

        Args:
            language: (optional) ISO 639-1 code.
            append_to_response: (optional) Comma separated, any person method.

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

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

Get the movie credits for a specific person id .


def Func ( arg_0 , arg_1 = 10 , arg_2 = None ) : try : return int ( Text ( arg_0 , arg_2 ) , arg_1 ) except ( TypeError , ValueError ) : return None

def Func(arg_0, arg_1=10, arg_2=None):
    """
    Parse a value as an integer.

    :type  value: `unicode` or `bytes`
    :param value: Text value to parse

    :type  base: `unicode` or `bytes`
    :param base: Base to assume ``value`` is specified in.

    :type  encoding: `bytes`
    :param encoding: Encoding to treat ``bytes`` values as, defaults to
        ``utf-8``.

    :rtype: `int`
    :return: Parsed integer or ``None`` if ``value`` could not be parsed as an
        integer.
    """
    try:
        return int(Text(arg_0, arg_2), arg_1)
    except (TypeError, ValueError):
        return None


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] for arg_3 in arg_1 . entries : arg_2 . append ( arg_3 [ "content" ] [ 0 ] [ "value" ] ) arg_0 . url_params = None return arg_2

def Func(arg_0, arg_1):
        """ Return a list of strings formatted as HTML citation entries
        """
        arg_2 = []
        for arg_3 in arg_1.entries:
            arg_2.append(arg_3["content"][0]["value"])
        arg_0.url_params = None
        return arg_2


return "%s__%s" % (
            str(self.ppoi[0]).replace('.', '-'),
            str(self.ppoi[1]).replace('.', '-')
        )

def Func ( arg_0 ) : return "%s__%s" % ( str ( arg_0 . ppoi [ 0 ] ) . replace ( '.' , '-' ) , str ( arg_0 . ppoi [ 1 ] ) . replace ( '.' , '-' ) )

def Func(arg_0):
        """Return PPOI value as a string."""
        return "%s__%s" % (
            str(arg_0.ppoi[0]).replace('.', '-'),
            str(arg_0.ppoi[1]).replace('.', '-')
        )


return np.argwhere((cumscore * maxes * 2 > med_score)).max()

def Func ( arg_0 ) : arg_1 = util . localmax ( arg_0 ) arg_2 = np . median ( arg_0 [ np . argwhere ( arg_1 ) ] ) return np . argwhere ( ( arg_0 * arg_1 * 2 > arg_2 ) ) . max ( )

def Func(arg_0):
    """Get the last beat from the cumulative score array"""

    arg_1 = util.localmax(arg_0)
    arg_2 = np.median(arg_0[np.argwhere(arg_1)])

    # The last of these is the last beat (since score generally increases)
    return np.argwhere((arg_0 * arg_1 * 2 > arg_2)).max()


(
        cpdir,
        outpkl,
        cpfileglob='checkplot*.pkl*',
        color_mag1=['gaiamag','sdssg'],
        color_mag2=['kmag','kmag'],
        yaxis_mag=['gaia_absmag','rpmj']
)

return colormagdiagram_cplist(cplist,
                                  outpkl,
                                  color_mag1=color_mag1,
                                  color_mag2=color_mag2,
                                  yaxis_mag=yaxis_mag)

def Func ( arg_0 , arg_1 , arg_2 = 'checkplot*.pkl*' , arg_3 = [ 'gaiamag' , 'sdssg' ] , arg_4 = [ 'kmag' , 'kmag' ] , arg_5 = [ 'gaia_absmag' , 'rpmj' ] ) : arg_6 = glob . glob ( os . path . join ( arg_0 , arg_2 ) ) return colormagdiagram_cplist ( arg_6 , arg_1 , arg_3 = arg_3 , arg_4 = arg_4 , arg_5 = arg_5 )

def Func(
        arg_0,
        arg_1,
        arg_2='checkplot*.pkl*',
        arg_3=['gaiamag','sdssg'],
        arg_4=['kmag','kmag'],
        arg_5=['gaia_absmag','rpmj']
):
    '''This makes CMDs for all checkplot pickles in the provided directory.

    Can make an arbitrary number of CMDs given lists of x-axis colors and y-axis
    mags to use.

    Parameters
    ----------

    cpdir : list of str
        This is the directory to get the list of input checkplot pickles from.

    outpkl : str
        The filename of the output pickle that will contain the color-mag
        information for all objects in the checkplots specified in `cplist`.

    cpfileglob : str
        The UNIX fileglob to use to search for checkplot pickle files.

    color_mag1 : list of str
        This a list of the keys in each checkplot's `objectinfo` dict that will
        be used as color_1 in the equation::

                x-axis color = color_mag1 - color_mag2

    color_mag2 : list of str
        This a list of the keys in each checkplot's `objectinfo` dict that will
        be used as color_2 in the equation::

                x-axis color = color_mag1 - color_mag2

    yaxis_mag : list of str
        This is a list of the keys in each checkplot's `objectinfo` dict that
        will be used as the (absolute) magnitude y-axis of the color-mag
        diagrams.

    Returns
    -------

    str
        The path to the generated CMD pickle file for the collection of objects
        in the input checkplot directory.

    Notes
    -----

    This can make many CMDs in one go. For example, the default kwargs for
    `color_mag`, `color_mag2`, and `yaxis_mag` result in two CMDs generated and
    written to the output pickle file:

    - CMD1 -> gaiamag - kmag on the x-axis vs gaia_absmag on the y-axis
    - CMD2 -> sdssg - kmag on the x-axis vs rpmj (J reduced PM) on the y-axis

    '''

    arg_6 = glob.glob(os.path.join(arg_0, arg_2))

    return colormagdiagram_cplist(arg_6,
                                  arg_1,
                                  arg_3=arg_3,
                                  arg_4=arg_4,
                                  arg_5=arg_5)

This makes CMDs for all checkplot pickles in the provided directory .


(md_ast, sections, last, last_class, total_lines=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = None ) : def child_walker ( arg_5 ) : for arg_6 , arg_7 in arg_5 . walker ( ) : if arg_6 == arg_5 : continue yield arg_6 , arg_7 for arg_6 , arg_7 in child_walker ( arg_0 ) : if arg_6 . t == 'heading' : arg_8 = arg_6 . sourcepos [ 0 ] [ 0 ] if arg_6 . level == 2 : if arg_2 : arg_1 [ ( arg_2 [ 'type_name' ] , arg_2 [ 'identifier' ] ) ] = ( arg_2 [ 'start_line' ] , arg_8 - 1 ) arg_2 . clear ( ) if arg_6 . level in set ( [ 3 , 5 ] ) : arg_9 = [ ] for arg_10 , arg_11 in child_walker ( arg_6 ) : arg_9 . append ( arg_10 ) if len ( arg_9 ) != 2 : continue arg_12 = arg_9 [ 0 ] arg_13 = arg_9 [ 1 ] if arg_12 . t != 'code' : continue if arg_13 . t != 'text' : continue arg_14 = arg_13 . literal . strip ( ) arg_15 = arg_12 . literal . strip ( ) . replace ( '()' , '' ) . lstrip ( '.' ) if arg_2 : arg_1 [ ( arg_2 [ 'type_name' ] , arg_2 [ 'identifier' ] ) ] = ( arg_2 [ 'start_line' ] , arg_8 - 1 ) arg_2 . clear ( ) if arg_14 == 'function' : if arg_6 . level != 3 : continue if arg_14 == 'class' : if arg_6 . level != 3 : continue arg_3 . append ( arg_15 ) if arg_14 in set ( [ 'method' , 'attribute' ] ) : if arg_6 . level != 5 : continue arg_15 = arg_3 [ - 1 ] + '.' + arg_15 arg_2 . update ( { 'type_name' : arg_14 , 'identifier' : arg_15 , 'start_line' : arg_8 , } ) elif arg_6 . t == 'block_quote' : find_sections ( arg_6 , arg_1 , arg_2 , arg_3 ) if arg_2 : arg_1 [ ( arg_2 [ 'type_name' ] , arg_2 [ 'identifier' ] ) ] = ( arg_2 [ 'start_line' ] , arg_4 )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):
    """
    Walks through a CommonMark AST to find section headers that delineate
    content that should be updated by this script

    :param md_ast:
        The AST of the markdown document

    :param sections:
        A dict to store the start and end lines of a section. The key will be
        a two-element tuple of the section type ("class", "function",
        "method" or "attribute") and identifier. The values are a two-element
        tuple of the start and end line number in the markdown document of the
        section.

    :param last:
        A dict containing information about the last section header seen.
        Includes the keys "type_name", "identifier", "start_line".

    :param last_class:
        A unicode string of the name of the last class found - used when
        processing methods and attributes.

    :param total_lines:
        An integer of the total number of lines in the markdown document -
        used to work around a bug in the API of the Python port of CommonMark
    """

    def child_walker(arg_5):
        for arg_6, arg_7 in arg_5.walker():
            if arg_6 == arg_5:
                continue
            yield arg_6, arg_7

    for arg_6, arg_7 in child_walker(arg_0):
        if arg_6.t == 'heading':
            arg_8 = arg_6.sourcepos[0][0]

            if arg_6.level == 2:
                if arg_2:
                    arg_1[(arg_2['type_name'], arg_2['identifier'])] = (arg_2['start_line'], arg_8 - 1)
                    arg_2.clear()

            if arg_6.level in set([3, 5]):
                arg_9 = []
                for arg_10, arg_11 in child_walker(arg_6):
                    arg_9.append(arg_10)
                if len(arg_9) != 2:
                    continue
                arg_12 = arg_9[0]
                arg_13 = arg_9[1]
                if arg_12.t != 'code':
                    continue
                if arg_13.t != 'text':
                    continue

                arg_14 = arg_13.literal.strip()
                arg_15 = arg_12.literal.strip().replace('()', '').lstrip('.')

                if arg_2:
                    arg_1[(arg_2['type_name'], arg_2['identifier'])] = (arg_2['start_line'], arg_8 - 1)
                    arg_2.clear()

                if arg_14 == 'function':
                    if arg_6.level != 3:
                        continue

                if arg_14 == 'class':
                    if arg_6.level != 3:
                        continue
                    arg_3.append(arg_15)

                if arg_14 in set(['method', 'attribute']):
                    if arg_6.level != 5:
                        continue
                    arg_15 = arg_3[-1] + '.' + arg_15

                arg_2.update({
                    'type_name': arg_14,
                    'identifier': arg_15,
                    'start_line': arg_8,
                })

        elif arg_6.t == 'block_quote':
            find_sections(arg_6, arg_1, arg_2, arg_3)

    if arg_2:
        arg_1[(arg_2['type_name'], arg_2['identifier'])] = (arg_2['start_line'], arg_4)


return {s: m for s, m in zip(element_symbols, element_masses)}

def Func ( arg_0 ) : arg_1 = arg_0 . material . elements arg_2 = arg_0 . get_element_masses ( ) return { arg_3 : arg_4 for arg_3 , arg_4 in zip ( arg_1 , arg_2 ) }

def Func(arg_0):
        """
        Determine the masses of elements in the package and return as a
        dictionary.

        :returns: Dictionary of element symbols and masses. [kg]
        """

        arg_1 = arg_0.material.elements
        arg_2 = arg_0.get_element_masses()

        return {arg_3: arg_4 for arg_3, arg_4 in zip(arg_1, arg_2)}

Determine the masses of elements in the package and return as a dictionary .


def Func ( arg_0 , arg_1 , arg_2 = None ) : if not arg_1 in arg_2 : arg_3 = arg_0 . _hdf5file . create_group ( where = arg_2 , arg_1 = arg_1 , title = arg_1 , filters = arg_0 . _all_get_filters ( ) ) return arg_3 , True else : arg_3 = arg_2 . _f_get_child ( arg_1 ) return arg_3 , False

def Func(arg_0, arg_1, arg_2=None):
        """Creates or returns a group"""
        if not arg_1 in arg_2:
            arg_3 = arg_0._hdf5file.create_group(where=arg_2,
                                                      arg_1=arg_1,
                                                      title=arg_1,
                                                      filters=arg_0._all_get_filters())
            return arg_3, True
        else:
            arg_3 = arg_2._f_get_child(arg_1)
            return arg_3, False


return "{}{}{}".format(prefix.ip, sep, prefix.netmask)

def
Func
(
arg_0
,
arg_1
=
" "
)
:
arg_2
=
netaddr
.
IPNetwork
(
arg_0
)
return
"{}{}{}"
.
format
(
arg_2
.
ip
,
arg_1
,
arg_2
.
netmask
)

def Func(arg_0, arg_1=" "):
    """
    Converts a CIDR formatted prefix into an address netmask representation.
    Argument sep specifies the separator between the address and netmask parts.
    By default it's a single space.

    Examples:
        >>> "{{ '192.168.0.1/24|Func }}" -> "192.168.0.1 255.255.255.0"
        >>> "{{ '192.168.0.1/24|Func('/') }}" -> "192.168.0.1/255.255.255.0"
    """
    arg_2 = netaddr.IPNetwork(arg_0)
    return "{}{}{}".format(arg_2.ip, arg_1, arg_2.netmask)

Converts a CIDR formatted prefix into an address netmask representation.
    Argument sep specifies the separator between the address and netmask parts.
    By default it's a single space.

    Examples:
        >>> "{{ '192.168.0.1/24|prefix_to_addrmask }}" -> "192.168.0.1 255.255.255.0"
        >>> "{{ '192.168.0.1/24|prefix_to_addrmask('/') }}" -> "192.168.0.1/255.255.255.0"

Converts a CIDR formatted prefix into an address netmask representation . Argument sep specifies the separator between the address and netmask parts . By default it s a single space .


(x, size=None, interp='bicubic', mode=None)

def Func ( arg_0 , arg_1 = None , arg_2 = 'bicubic' , arg_3 = None ) : if arg_1 is None : arg_1 = [ 100 , 100 ] if arg_0 . shape [ - 1 ] == 1 : arg_0 = scipy . misc . Func ( arg_0 [ : , : , 0 ] , arg_1 , arg_2 = arg_2 , arg_3 = arg_3 ) return arg_0 [ : , : , np . newaxis ] else : return scipy . misc . Func ( arg_0 , arg_1 , arg_2 = arg_2 , arg_3 = arg_3 )

def Func(arg_0, arg_1=None, arg_2='bicubic', arg_3=None):
    """Resize an image by given output size and method.

    Warning, this function will rescale the value to [0, 255].

    Parameters
    -----------
    x : numpy.array
        An image with dimension of [row, col, channel] (default).
    size : list of 2 int or None
        For height and width.
    interp : str
        Interpolation method for re-sizing (`nearest`, `lanczos`, `bilinear`, `bicubic` (default) or `cubic`).
    mode : str
        The PIL image mode (`P`, `L`, etc.) to convert image before resizing.

    Returns
    -------
    numpy.array
        A processed image.

    References
    ------------
    - `scipy.misc.Func <https://docs.scipy.org/doc/scipy/reference/generated/scipy.misc.Func.html>`__

    """
    if arg_1 is None:
        arg_1 = [100, 100]

    if arg_0.shape[-1] == 1:
        # greyscale
        arg_0 = scipy.misc.Func(arg_0[:, :, 0], arg_1, arg_2=arg_2, arg_3=arg_3)
        return arg_0[:, :, np.newaxis]
    else:
        # rgb, bgr, rgba
        return scipy.misc.Func(arg_0, arg_1, arg_2=arg_2, arg_3=arg_3)

Resize an image by given output size and method.

    Warning, this function will rescale the value to [0, 255].

    Parameters
    -----------
    x : numpy.array
        An image with dimension of [row, col, channel] (default).
    size : list of 2 int or None
        For height and width.
    interp : str
        Interpolation method for re-sizing (`nearest`, `lanczos`, `bilinear`, `bicubic` (default) or `cubic`).
    mode : str
        The PIL image mode (`P`, `L`, etc.) to convert image before resizing.

    Returns
    -------
    numpy.array
        A processed image.

    References
    ------------
    - `scipy.misc.imresize <https://docs.scipy.org/doc/scipy/reference/generated/scipy.misc.imresize.html>`__

Resize an image by given output size and method .


return dict(
        (key, parser(query.get(key, [])))
        for key, parser in expected.items())

def Func ( arg_0 , arg_1 ) : return dict ( ( arg_2 , arg_3 ( arg_1 . get ( arg_2 , [ ] ) ) ) for arg_2 , arg_3 in arg_0 . items ( ) )

def Func(arg_0, arg_1):
    """
    Parse query parameters.

    :type  expected: `dict` mapping `bytes` to `callable`
    :param expected: Mapping of query argument names to argument parsing
        callables.

    :type  query: `dict` mapping `bytes` to `list` of `bytes`
    :param query: Mapping of query argument names to lists of argument values,
        this is the form that Twisted Web's `IRequest.args
        <twisted:twisted.web.iweb.IRequest.args>` value takes.

    :rtype: `dict` mapping `bytes` to `object`
    :return: Mapping of query argument names to Funcd argument values.
    """
    return dict(
        (arg_2, arg_3(arg_1.get(arg_2, [])))
        for arg_2, arg_3 in arg_0.items())

Parse query parameters.

    :type  expected: `dict` mapping `bytes` to `callable`
    :param expected: Mapping of query argument names to argument parsing
        callables.

    :type  query: `dict` mapping `bytes` to `list` of `bytes`
    :param query: Mapping of query argument names to lists of argument values,
        this is the form that Twisted Web's `IRequest.args
        <twisted:twisted.web.iweb.IRequest.args>` value takes.

    :rtype: `dict` mapping `bytes` to `object`
    :return: Mapping of query argument names to parsed argument values.


Get the height of a bounding box encapsulating the line.

return np.max(self.yy) - np.min(self.yy)

def Func ( arg_0 ) : if len ( arg_0 . coords ) <= 1 : return 0 return np . max ( arg_0 . yy ) - np . min ( arg_0 . yy )

def Func(arg_0):
        """Get the Func of a bounding box encapsulating the line."""
        if len(arg_0.coords) <= 1:
            return 0
        return np.max(arg_0.yy) - np.min(arg_0.yy)

Get the height of a bounding box encapsulating the line .


def Func(arg_0: arg_1) -> Iterable[NodeTriple]:
    """Yield all triples of nodes A, B, C such that ``A pos B``, ``A pos C``, and ``B neg C``.

    :return: An iterator over triples of unstable graphs, where the second two are negative
    """
    arg_2 = get_correlation_graph(arg_0)

    for arg_3, arg_4, arg_5 in get_correlation_triangles(arg_2):
        if POSITIVE_CORRELATION in arg_2[arg_3][arg_4] and POSITIVE_CORRELATION in arg_2[arg_4][arg_5] and NEGATIVE_CORRELATION in \
                arg_2[arg_3][arg_5]:
            yield arg_4, arg_3, arg_5
        if POSITIVE_CORRELATION in arg_2[arg_3][arg_4] and NEGATIVE_CORRELATION in arg_2[arg_4][arg_5] and POSITIVE_CORRELATION in \
                arg_2[arg_3][arg_5]:
            yield arg_3, arg_4, arg_5
        if NEGATIVE_CORRELATION in arg_2[arg_3][arg_4] and POSITIVE_CORRELATION in arg_2[arg_4][arg_5] and POSITIVE_CORRELATION in \
                arg_2[arg_3][arg_5]:
            yield arg_5, arg_3, arg_4

Yield all triples of nodes A B C such that A pos B A pos C and B neg C .


(img, padding, fill=0, padding_mode='constant')

def Func(arg_0, arg_1, arg_2=0, arg_3='constant'):
    r"""Pad the given PIL Image on all sides with specified Funcding mode and fill value.

    Args:
        img (PIL Image): Image to be Funcded.
        Funcding (int or tuple): Padding on each border. If a single int is provided this
            is used to Func all borders. If tuple of length 2 is provided this is the Funcding
            on left/right and top/bottom respectively. If a tuple of length 4 is provided
            this is the Funcding for the left, top, right and bottom borders
            respectively.
        fill: Pixel fill value for constant fill. Default is 0. If a tuple of
            length 3, it is used to fill R, G, B channels respectively.
            This value is only used when the Funcding_mode is constant
        Funcding_mode: Type of Funcding. Should be: constant, edge, reflect or symmetric. Default is constant.

            - constant: Funcs with a constant value, this value is specified with fill

            - edge: Funcs with the last value on the edge of the image

            - reflect: Funcs with reflection of image (without repeating the last value on the edge)

                       Funcding [1, 2, 3, 4] with 2 elements on both sides in reflect mode
                       will result in [3, 2, 1, 2, 3, 4, 3, 2]

            - symmetric: Funcs with reflection of image (repeating the last value on the edge)

                         Funcding [1, 2, 3, 4] with 2 elements on both sides in symmetric mode
                         will result in [2, 1, 1, 2, 3, 4, 4, 3]

    Returns:
        PIL Image: Padded image.
    """
    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))

    if not isinstance(arg_1, (numbers.Number, tuple)):
        raise TypeError('Got inappropriate Funcding arg')
    if not isinstance(arg_2, (numbers.Number, str, tuple)):
        raise TypeError('Got inappropriate fill arg')
    if not isinstance(arg_3, str):
        raise TypeError('Got inappropriate Funcding_mode arg')

    if isinstance(arg_1, Sequence) and len(arg_1) not in [2, 4]:
        raise ValueError("Padding must be an int or a 2, or 4 element tuple, not a " +
                         "{} element tuple".format(len(arg_1)))

    assert arg_3 in ['constant', 'edge', 'reflect', 'symmetric'], \
        'Padding mode should be either constant, edge, reflect or symmetric'

    if arg_3 == 'constant':
        if arg_0.mode == 'P':
            arg_4 = arg_0.getpalette()
            arg_5 = ImageOps.expand(arg_0, border=arg_1, arg_2=arg_2)
            arg_5.putpalette(arg_4)
            return arg_5

        return ImageOps.expand(arg_0, border=arg_1, arg_2=arg_2)
    else:
        if isinstance(arg_1, int):
            arg_6 = arg_8 = arg_7 = arg_9 = arg_1
        if isinstance(arg_1, Sequence) and len(arg_1) == 2:
            arg_6 = arg_8 = arg_1[0]
            arg_7 = arg_9 = arg_1[1]
        if isinstance(arg_1, Sequence) and len(arg_1) == 4:
            arg_6 = arg_1[0]
            arg_7 = arg_1[1]
            arg_8 = arg_1[2]
            arg_9 = arg_1[3]

        if arg_0.mode == 'P':
            arg_4 = arg_0.getpalette()
            arg_0 = np.asarray(arg_0)
            arg_0 = np.Func(arg_0, ((arg_7, arg_9), (arg_6, arg_8)), arg_3)
            arg_0 = Image.fromarray(arg_0)
            arg_0.putpalette(arg_4)
            return arg_0

        arg_0 = np.asarray(arg_0)
        # RGB image
        if len(arg_0.shape) == 3:
            arg_0 = np.Func(arg_0, ((arg_7, arg_9), (arg_6, arg_8), (0, 0)), arg_3)
        # Grayscale image
        if len(arg_0.shape) == 2:
            arg_0 = np.Func(arg_0, ((arg_7, arg_9), (arg_6, arg_8)), arg_3)

        return Image.fromarray(arg_0)

r"""Pad the given PIL Image on all sides with specified padding mode and fill value.

    Args:
        img (PIL Image): Image to be padded.
        padding (int or tuple): Padding on each border. If a single int is provided this
            is used to pad all borders. If tuple of length 2 is provided this is the padding
            on left/right and top/bottom respectively. If a tuple of length 4 is provided
            this is the padding for the left, top, right and bottom borders
            respectively.
        fill: Pixel fill value for constant fill. Default is 0. If a tuple of
            length 3, it is used to fill R, G, B channels respectively.
            This value is only used when the padding_mode is constant
        padding_mode: Type of padding. Should be: constant, edge, reflect or symmetric. Default is constant.

            - constant: pads with a constant value, this value is specified with fill

            - edge: pads with the last value on the edge of the image

            - reflect: pads with reflection of image (without repeating the last value on the edge)

                       padding [1, 2, 3, 4] with 2 elements on both sides in reflect mode
                       will result in [3, 2, 1, 2, 3, 4, 3, 2]

            - symmetric: pads with reflection of image (repeating the last value on the edge)

                         padding [1, 2, 3, 4] with 2 elements on both sides in symmetric mode
                         will result in [2, 1, 1, 2, 3, 4, 4, 3]

    Returns:
        PIL Image: Padded image.

r Pad the given PIL Image on all sides with specified padding mode and fill value .


def Func ( arg_0 ) : arg_1 , arg_2 , arg_3 = re . search ( r'((.*\.zip){})?(.*)' . format ( re . escape ( os . sep ) ) , arg_0 ) . groups ( ) if arg_2 and zipfile . is_zipfile ( arg_2 ) : return arg_2 else : return arg_0

def Func(arg_0):
    """
    If the path contains a folder with a .zip suffix, then
    the folder is treated as a zip archive and path to zip is returned.
    """

    arg_1, arg_2, arg_3 = re.search(
        r'((.*\.zip){})?(.*)'.format(re.escape(os.sep)), arg_0).groups()
    if arg_2 and zipfile.is_zipfile(arg_2):
        return arg_2
    else:
        return arg_0

If the path contains a folder with a . zip suffix then the folder is treated as a zip archive and path to zip is returned .


def Func ( arg_0 ) : with open ( arg_0 , 'rb' ) as f : arg_1 = 0 arg_2 = False while not arg_2 : arg_3 = f . read ( 512 ) arg_1 += 1 if b'HEADER_END' in arg_3 : arg_4 = arg_3 . index ( b'HEADER_END' ) + len ( b'HEADER_END' ) arg_2 = True break arg_4 = ( arg_1 - 1 ) * 512 + arg_4 return arg_4

def Func(arg_0):
    """ Return the length of the blimpy header, in bytes

    Args:
        filename (str): name of file to open

    Returns:
        idx_end (int): length of header, in bytes
    """
    with  open(arg_0, 'rb') as f:
        arg_1 = 0
        arg_2 = False
        while not arg_2:
            arg_3 = f.read(512)
            arg_1 += 1
            if b'HEADER_END' in arg_3:
                arg_4 = arg_3.index(b'HEADER_END') + len(b'HEADER_END')
                arg_2 = True
                break

        arg_4 = (arg_1 -1) * 512 + arg_4
    return arg_4

Return the length of the blimpy header in bytes


def Func ( arg_0 ) : if not arg_0 : return None arg_1 = { } for arg_2 in arg_0 . __table__ . columns : arg_3 = getattr ( arg_0 , arg_2 . name ) if type ( arg_3 ) == datetime : arg_3 = arg_3 . isoformat ( ) arg_1 [ arg_2 . name ] = arg_3 return arg_1

def Func(arg_0):
    """
    Transforms a SQLAlchemy model instance into a dictionary
    """
    if not arg_0:
        return None
    arg_1 = {}
    for arg_2 in arg_0.__table__.columns:
        arg_3 = getattr(arg_0, arg_2.name)
        if type(arg_3) == datetime:
            arg_3 = arg_3.isoformat()
        arg_1[arg_2.name] = arg_3
    return arg_1


def Func(arg_0):
        """
        Process PONG sent by server.
        """
        if len(arg_0._pongs) > 0:
            arg_1 = arg_0._pongs.pop(0)
            arg_1.set_result(True)
            arg_0._pongs_received += 1
            arg_0._pings_outstanding -= 1


def Func(arg_0):
    """Convert IPA to features.

    This translates an IPA string of one or more phones to a list of ints
    representing the features of the string.

    Parameters
    ----------
    ipa : str
        The IPA representation of a phone or series of phones

    Returns
    -------
    list of ints
        A representation of the features of the input string

    Examples
    --------
    >>> Func('mut')
    [2709662981243185770, 1825831513894594986, 2783230754502126250]
    >>> Func('fon')
    [2781702983095331242, 1825831531074464170, 2711173160463936106]
    >>> Func('telz')
    [2783230754502126250, 1826957430176000426, 2693158761954453926,
    2783230754501863834]

    """
    arg_1 = []
    arg_2 = 0
    arg_0 = normalize('NFD', text_type(arg_0.lower()))

    arg_3 = max(len(_) for _ in _PHONETIC_FEATURES)

    while arg_2 < len(arg_0):
        arg_4 = False
        for arg_5 in range(arg_3, 0, -1):
            if (
                arg_2 + arg_5 - 1 <= len(arg_0)
                and arg_0[arg_2 : arg_2 + arg_5] in _PHONETIC_FEATURES
            ):
                arg_1.append(_PHONETIC_FEATURES[arg_0[arg_2 : arg_2 + arg_5]])
                arg_2 += arg_5
                arg_4 = True

        if not arg_4:
            arg_1.append(-1)
            arg_2 += 1

    return arg_1

Convert IPA to features.

    This translates an IPA string of one or more phones to a list of ints
    representing the features of the string.

    Parameters
    ----------
    ipa : str
        The IPA representation of a phone or series of phones

    Returns
    -------
    list of ints
        A representation of the features of the input string

    Examples
    --------
    >>> ipa_to_features('mut')
    [2709662981243185770, 1825831513894594986, 2783230754502126250]
    >>> ipa_to_features('fon')
    [2781702983095331242, 1825831531074464170, 2711173160463936106]
    >>> ipa_to_features('telz')
    [2783230754502126250, 1826957430176000426, 2693158761954453926,
    2783230754501863834]


def Func ( arg_0 ) : if arg_0 . active : return None arg_0 . mock_engine . Func ( ) arg_0 . active = True

def Func(arg_0):
        """
        Activates the registered interceptors in the mocking engine.

        This means any HTTP traffic captures by those interceptors will
        trigger the HTTP mock matching engine in order to determine if a given
        HTTP transaction should be mocked out or not.
        """
        if arg_0.active:
            return None

        # Activate mock engine
        arg_0.mock_engine.Func()
        # Enable engine state
        arg_0.active = True

Activates the registered interceptors in the mocking engine .


(marcxml, verbose=CFG_BIBRECORD_DEFAULT_VERBOSE_LEVEL,
                   correct=CFG_BIBRECORD_DEFAULT_CORRECT, parser='',
                   keep_singletons=CFG_BIBRECORD_KEEP_SINGLETONS)

return [create_record(record_xml, verbose=verbose, correct=correct,
            parser=parser, keep_singletons=keep_singletons)
            for record_xml in record_xmls]

def Func(arg_0, arg_1=arg_2,
                   arg_3=arg_4, arg_5='',
                   arg_6=arg_7):
    """
    Create a list of records from the marcxml description.

    :returns: a list of objects initiated by the function create_record().
              Please see that function's docstring.
    """
    # Use the DOTALL flag to include newlines.
    arg_8 = re.compile('<record.*?>.*?</record>', re.DOTALL)
    arg_9 = arg_8.findall(arg_0)

    return [create_record(arg_10, arg_1=arg_1, arg_3=arg_3,
            arg_5=arg_5, arg_6=arg_6)
            for arg_10 in arg_9]

Create a list of records from the marcxml description .


def Func(arg_0, arg_1, arg_2=True):
    '''Match one set of time intervals to another.

    This can be useful for tasks such as mapping beat timings
    to segments.

    Each element `[a, b]` of `intervals_from` is matched to the
    element `[c, d]` of `intervals_to` which maximizes the
    Jaccard similarity between the intervals:

        `max(0, |min(b, d) - max(a, c)|) / |max(d, b) - min(a, c)|`

    In `strict=True` mode, if there is no interval with positive
    intersection with `[a,b]`, an exception is thrown.

    In `strict=False` mode, any interval `[a, b]` that has no
    intersection with any element of `intervals_to` is instead
    matched to the interval `[c, d]` which minimizes

        `min(|b - c|, |a - d|)`

    that is, the disjoint interval `[c, d]` with a boundary closest
    to `[a, b]`.

    .. note:: An element of `intervals_to` may be matched to multiple
       entries of `intervals_from`.

    Parameters
    ----------
    intervals_from : np.ndarray [shape=(n, 2)]
        The time range for source intervals.
        The `i` th interval spans time `intervals_from[i, 0]`
        to `intervals_from[i, 1]`.
        `intervals_from[0, 0]` should be 0, `intervals_from[-1, 1]`
        should be the track duration.

    intervals_to : np.ndarray [shape=(m, 2)]
        Analogous to `intervals_from`.

    strict : bool
        If `True`, intervals can only match if they intersect.
        If `False`, disjoint intervals can match.

    Returns
    -------
    interval_mapping : np.ndarray [shape=(n,)]
        For each interval in `intervals_from`, the
        corresponding interval in `intervals_to`.

    See Also
    --------
    match_events

    Raises
    ------
    ParameterError
        If either array of input intervals is not the correct shape

        If `strict=True` and some element of `intervals_from` is disjoint from
        every element of `intervals_to`.

    Examples
    --------
    >>> ints_from = np.array([[3, 5], [1, 4], [4, 5]])
    >>> ints_to = np.array([[0, 2], [1, 3], [4, 5], [6, 7]])
    >>> librosa.util.Func(ints_from, ints_to)
    array([2, 1, 2], dtype=uint32)
    >>> # [3, 5] => [4, 5]  (ints_to[2])
    >>> # [1, 4] => [1, 3]  (ints_to[1])
    >>> # [4, 5] => [4, 5]  (ints_to[2])

    The reverse matching of the above is not possible in `strict` mode
    because `[6, 7]` is disjoint from all intervals in `ints_from`.
    With `strict=False`, we get the following:
    >>> librosa.util.Func(ints_to, ints_from, strict=False)
    array([1, 1, 2, 2], dtype=uint32)
    >>> # [0, 2] => [1, 4]  (ints_from[1])
    >>> # [1, 3] => [1, 4]  (ints_from[1])
    >>> # [4, 5] => [4, 5]  (ints_from[2])
    >>> # [6, 7] => [4, 5]  (ints_from[2])
    '''

    if len(arg_0) == 0 or len(arg_1) == 0:
        raise ParameterError('Attempting to match empty interval list')

    # Verify that the input intervals has correct shape and size
    valid_intervals(arg_0)
    valid_intervals(arg_1)

    try:
        return __Func(arg_0, arg_1, arg_2=arg_2)
    except ParameterError:
        six.reraise(ParameterError,
                    ParameterError('Unable to match intervals with strict={}'.format(arg_2)),
                    sys.exc_info()[2])

Match one set of time intervals to another.

    This can be useful for tasks such as mapping beat timings
    to segments.

    Each element `[a, b]` of `intervals_from` is matched to the
    element `[c, d]` of `intervals_to` which maximizes the
    Jaccard similarity between the intervals:

        `max(0, |min(b, d) - max(a, c)|) / |max(d, b) - min(a, c)|`

    In `strict=True` mode, if there is no interval with positive
    intersection with `[a,b]`, an exception is thrown.

    In `strict=False` mode, any interval `[a, b]` that has no
    intersection with any element of `intervals_to` is instead
    matched to the interval `[c, d]` which minimizes

        `min(|b - c|, |a - d|)`

    that is, the disjoint interval `[c, d]` with a boundary closest
    to `[a, b]`.

    .. note:: An element of `intervals_to` may be matched to multiple
       entries of `intervals_from`.

    Parameters
    ----------
    intervals_from : np.ndarray [shape=(n, 2)]
        The time range for source intervals.
        The `i` th interval spans time `intervals_from[i, 0]`
        to `intervals_from[i, 1]`.
        `intervals_from[0, 0]` should be 0, `intervals_from[-1, 1]`
        should be the track duration.

    intervals_to : np.ndarray [shape=(m, 2)]
        Analogous to `intervals_from`.

    strict : bool
        If `True`, intervals can only match if they intersect.
        If `False`, disjoint intervals can match.

    Returns
    -------
    interval_mapping : np.ndarray [shape=(n,)]
        For each interval in `intervals_from`, the
        corresponding interval in `intervals_to`.

    See Also
    --------
    match_events

    Raises
    ------
    ParameterError
        If either array of input intervals is not the correct shape

        If `strict=True` and some element of `intervals_from` is disjoint from
        every element of `intervals_to`.

    Examples
    --------
    >>> ints_from = np.array([[3, 5], [1, 4], [4, 5]])
    >>> ints_to = np.array([[0, 2], [1, 3], [4, 5], [6, 7]])
    >>> librosa.util.match_intervals(ints_from, ints_to)
    array([2, 1, 2], dtype=uint32)
    >>> # [3, 5] => [4, 5]  (ints_to[2])
    >>> # [1, 4] => [1, 3]  (ints_to[1])
    >>> # [4, 5] => [4, 5]  (ints_to[2])

    The reverse matching of the above is not possible in `strict` mode
    because `[6, 7]` is disjoint from all intervals in `ints_from`.
    With `strict=False`, we get the following:
    >>> librosa.util.match_intervals(ints_to, ints_from, strict=False)
    array([1, 1, 2, 2], dtype=uint32)
    >>> # [0, 2] => [1, 4]  (ints_from[1])
    >>> # [1, 3] => [1, 4]  (ints_from[1])
    >>> # [4, 5] => [4, 5]  (ints_from[2])
    >>> # [6, 7] => [4, 5]  (ints_from[2])

Match one set of time intervals to another .


def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : arg_1 = request . args if 'oauth_verifier' in arg_1 : arg_2 = arg_0 . handle_oauth1_response ( arg_1 ) elif 'code' in arg_1 : arg_2 = arg_0 . handle_oauth2_response ( arg_1 ) else : arg_2 = arg_0 . handle_unknown_response ( ) session . pop ( '%s_oauthtok' % arg_0 . name , None ) session . pop ( '%s_oauthredir' % arg_0 . name , None ) return arg_2

def Func(arg_0, arg_1=None):
        """Handles authorization response smartly."""
        if arg_1 is None:
            arg_1 = request.args
        if 'oauth_verifier' in arg_1:
            arg_2 = arg_0.handle_oauth1_response(arg_1)
        elif 'code' in arg_1:
            arg_2 = arg_0.handle_oauth2_response(arg_1)
        else:
            arg_2 = arg_0.handle_unknown_response()

        # free request token
        session.pop('%s_oauthtok' % arg_0.name, None)
        session.pop('%s_oauthredir' % arg_0.name, None)
        return arg_2

Handles authorization response smartly .


def Func ( arg_0 , arg_1 ) : arg_2 = { 'error' : arg_0 , 'result' : arg_1 } _log ( TYPE_CODES . ERROR , arg_2 )

def Func(arg_0, arg_1):
    """Logs an error
    """
    arg_2 = {'error': arg_0, 'result':arg_1}
    _log(TYPE_CODES.ERROR, arg_2)


def Func(arg_0, **arg_1):
        """
        Get the basic Funcrmation for an account.

        Call this method first, before calling other Account methods.

        Returns:
            A dict respresentation of the JSON returned from the API.
        """
        arg_2 = arg_0._get_path('Func')
        arg_1.update({'session_id': arg_0.session_id})

        arg_3 = arg_0._GET(arg_2, arg_1)
        arg_0.id = arg_3['id']
        arg_0._set_attrs_to_values(arg_3)
        return arg_3

Get the basic information for an account.

        Call this method first, before calling other Account methods.

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

Get the basic information for an account .


def Func(arg_0, arg_1, arg_2):
        """return a class diagram definition for the given klass and its
        related klasses
        """

        arg_0.classdiagram = ClassDiagram(arg_2, arg_0.config.mode)
        if len(arg_1.modules) > 1:
            arg_4, arg_2 = arg_2.rsplit(".", 1)
            arg_4 = arg_1.get_module(arg_4)
        else:
            arg_4 = arg_1.modules[0]
            arg_2 = arg_2.split(".")[-1]
        arg_2 = next(arg_4.ilookup(arg_2))

        arg_5, arg_6 = arg_0._get_levels()
        arg_0.extract_classes(arg_2, arg_5, arg_6)
        return arg_0.classdiagram


def Func ( arg_0 , arg_1 ) : if "." in arg_1 : try : arg_2 = arg_0 . attr_matches ( arg_1 ) if arg_1 . endswith ( '.' ) and arg_0 . omit__names : if arg_0 . omit__names == 1 : arg_3 = ( lambda txt : re . match ( r'.*\.__.*?__' , txt ) is None ) else : arg_3 = ( lambda txt : re . match ( r'.*\._.*?' , txt ) is None ) arg_2 = filter ( arg_3 , arg_2 ) except NameError : arg_2 = [ ] else : arg_2 = arg_0 . global_matches ( arg_1 ) return arg_2

def Func(arg_0,arg_1):
        """Match attributes or global python names"""

        #io.rprint('Completer->Func, txt=%r' % text) # dbg
        if "." in arg_1:
            try:
                arg_2 = arg_0.attr_matches(arg_1)
                if arg_1.endswith('.') and arg_0.omit__names:
                    if arg_0.omit__names == 1:
                        # true if txt is _not_ a __ name, false otherwise:
                        arg_3 = (lambda txt:
                                    re.match(r'.*\.__.*?__',txt) is None)
                    else:
                        # true if txt is _not_ a _ name, false otherwise:
                        arg_3 = (lambda txt:
                                    re.match(r'.*\._.*?',txt) is None)
                    arg_2 = filter(arg_3, arg_2)
            except NameError:
                # catches <undefined attributes>.<tab>
                arg_2 = []
        else:
            arg_2 = arg_0.global_matches(arg_1)

        return arg_2


def Func(arg_0, arg_1):
        """Get parameters for ``crop`` for a random crop.

        Args:
            img (PIL Image): Image to be cropped.
            output_size (tuple): Expected output size of the crop.

        Returns:
            tuple: params (i, j, h, w) to be passed to ``crop`` for random crop.
        """
        arg_2, arg_3 = arg_0.size
        arg_4, arg_5 = arg_1
        if arg_2 == arg_5 and arg_3 == arg_4:
            return 0, 0, arg_3, arg_2

        arg_6 = random.randint(0, arg_3 - arg_4)
        arg_7 = random.randint(0, arg_2 - arg_5)
        return arg_6, arg_7, arg_4, arg_5

Get parameters for crop for a random crop .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_0 . return_info = ReturnInfo ( None , arg_1 , True , arg_2 )

def Func(arg_0, arg_1, arg_2=None):
        """Use a custom function to print the return value.

        Args:
            printer (callable): A function that should take in the return
                value and convert it to a string.
            desc (str): An optional description of the return value.
        """
        arg_0.return_info = ReturnInfo(None, arg_1, True, arg_2)

Use a custom function to print the return value .


def Func(arg_0, arg_1):
        """ Handles the right mouse button being clicked when the tool is in
        the 'normal' state.

        If the event occurred on this tool's component (or any contained
        component of that component), the method opens a context menu with
        menu items from any tool of the parent component that implements
        MenuItemTool interface i.e. has a get_item() method.

        """

        arg_2 = arg_1.x
        arg_3 = arg_1.y

        # First determine what component or components we are going to hittest
        # on.  If our component is a container, then we add its non-container
        # components to the list of candidates.
#        candidates = []
        arg_4 = arg_0.component
#        if isinstance(component, Container):
#            candidates = get_nested_components(self.component)
#        else:
#            # We don't support clicking on unrecognized components
#            return
#
#        # Hittest against all the candidate and take the first one
#        item = None
#        for candidate, offset in candidates:
#            if candidate.is_in(x-offset[0], y-offset[1]):
#                item = candidate
#                break

        for arg_5 in arg_4.tools:
            arg_4.active_tool = arg_0
            # Do it
            arg_1.handled = True
            arg_4.active_tool = None
            arg_4.request_redraw()

        return

Handles the right mouse button being clicked when the tool is in the normal state .


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_1 in arg_0 : arg_3 = arg_0 [ arg_1 ] else : arg_4 , arg_5 , arg_6 = parseNamelist ( arg_1 ) arg_3 = { "fileName" : arg_1 , "ownCharset" : arg_4 , "header" : arg_5 , "ownNoCharcode" : arg_6 , "includes" : None , "charset" : None , "noCharcode" : None } arg_0 [ arg_1 ] = arg_3 if arg_2 or arg_3 [ "charset" ] is not None : return arg_3 _loadNamelistIncludes ( arg_3 , arg_2 , arg_0 ) return arg_3

def Func(arg_0, arg_1, arg_2):
  """Return a dict with the data of an encoding Namelist file.

  This is an implementation detail of readNamelist.
  """
  if arg_1 in arg_0:
    arg_3 = arg_0[arg_1]
  else:
    arg_4, arg_5, arg_6 = parseNamelist(arg_1)
    arg_3 = {
      "fileName": arg_1
    , "ownCharset": arg_4
    , "header": arg_5
    , "ownNoCharcode": arg_6
    , "includes": None # placeholder
    , "charset": None # placeholder
    , "noCharcode": None
    }
    arg_0[arg_1] = arg_3

  if arg_2 or arg_3["charset"] is not None:
    return arg_3

  # full-charset/includes are requested and not cached yet
  _loadNamelistIncludes(arg_3, arg_2, arg_0)
  return arg_3

Return a dict with the data of an encoding Namelist file .


return [cls.from_json(api_client, item) for item in data]

def Func(arg_0, arg_1, arg_2):
        """Convert a list of JSON values to a list of models
        """
        return [arg_0.from_json(arg_1, arg_3) for arg_3 in arg_2]


def Func(arg_0, arg_1, arg_2=None):
    """
    Injects a function into an object instance as a bound method

    The main use case of this function is for monkey patching. While monkey
    patching is sometimes necessary it should generally be avoided. Thus, we
    simply remind the developer that there might be a better way.

    Args:
        self (object): instance to inject a function into
        func (func): the function to inject (must contain an arg for self)
        name (str): name of the method. optional. If not specified the name
            of the function is used.

    Example:
        >>> class Foo(object):
        >>>     def bar(self):
        >>>         return 'bar'
        >>> def baz(self):
        >>>     return 'baz'
        >>> self = Foo()
        >>> assert self.bar() == 'bar'
        >>> assert not hasattr(self, 'baz')
        >>> Func(self, baz)
        >>> assert not hasattr(Foo, 'baz'), 'should only change one instance'
        >>> assert self.baz() == 'baz'
        >>> Func(self, baz, 'bar')
        >>> assert self.bar() == 'baz'
    """
    # TODO: if func is a bound method we should probably unbind it
    arg_3 = arg_1.__get__(arg_0, arg_0.__class__)
    if arg_2 is None:
        arg_2 = arg_1.__name__
    setattr(arg_0, arg_2, arg_3)

Injects a function into an object instance as a bound method

    The main use case of this function is for monkey patching. While monkey
    patching is sometimes necessary it should generally be avoided. Thus, we
    simply remind the developer that there might be a better way.

    Args:
        self (object): instance to inject a function into
        func (func): the function to inject (must contain an arg for self)
        name (str): name of the method. optional. If not specified the name
            of the function is used.

    Example:
        >>> class Foo(object):
        >>>     def bar(self):
        >>>         return 'bar'
        >>> def baz(self):
        >>>     return 'baz'
        >>> self = Foo()
        >>> assert self.bar() == 'bar'
        >>> assert not hasattr(self, 'baz')
        >>> inject_method(self, baz)
        >>> assert not hasattr(Foo, 'baz'), 'should only change one instance'
        >>> assert self.baz() == 'baz'
        >>> inject_method(self, baz, 'bar')
        >>> assert self.bar() == 'baz'


def
Func
(
arg_0
)
:
arg_1
=
GlobalConfigManager
.
Func_config_or_default
(
)
if
not
arg_0
:
return
arg_2
=
{
}
for
arg_3
in
arg_0
:
if
hasattr
(
arg_1
,
arg_3
)
:
arg_2
[
arg_3
]
=
Funcattr
(
arg_1
,
arg_3
)
else
:
click
.
echo
(
'Key `{}` is not recognised.'
.
format
(
arg_3
)
)
dict_tabulate
(
arg_2
,
)

def Func(arg_0):
    """Get the global config values by keys.

    Example:

    \b
    ```bash
    $ polyaxon config Func host http_port
    ```
    """
    arg_1 = GlobalConfigManager.Func_config_or_default()

    if not arg_0:
        return

    arg_2 = {}
    for arg_3 in arg_0:
        if hasattr(arg_1, arg_3):
            arg_2[arg_3] = Funcattr(arg_1, arg_3)
        else:
            click.echo('Key `{}` is not recognised.'.format(arg_3))

    dict_tabulate(arg_2, )

Get the global config values by keys.

    Example:

    \b
    ```bash
    $ polyaxon config get host http_port
    ```


(reference_corpus, translation_corpus, max_order=4,
                 smooth=False)

return (bleu, precisions, bp, ratio, translation_length, reference_length)

def Func(arg_0, arg_1, arg_2=4,
                 arg_3=False):
  """Computes BLEU score of translated segments against one or more references.

  Args:
    reference_corpus: list of lists of references for each translation. Each
        reference should be tokenized into a list of tokens.
    translation_corpus: list of translations to score. Each translation
        should be tokenized into a list of tokens.
    max_order: Maximum n-gram order to use when computing BLEU score.
    smooth: Whether or not to apply Lin et al. 2004 smoothing.

  Returns:
    3-Tuple with the BLEU score, n-gram precisions, geometric mean of n-gram
    precisions and brevity penalty.
  """
  arg_4 = [0] * arg_2
  arg_5 = [0] * arg_2
  arg_6 = 0
  arg_7 = 0
  for (arg_8, arg_9) in zip(arg_0,
                                       arg_1):
    arg_6 += min(len(arg_10) for arg_10 in arg_8)
    arg_7 += len(arg_9)

    arg_11 = collections.Counter()
    for arg_12 in arg_8:
      arg_11 |= _get_ngrams(arg_12, arg_2)
    arg_13 = _get_ngrams(arg_9, arg_2)
    arg_14 = arg_13 & arg_11
    for arg_15 in arg_14:
      arg_4[len(arg_15)-1] += arg_14[arg_15]
    for arg_16 in range(1, arg_2+1):
      arg_17 = len(arg_9) - arg_16 + 1
      if arg_17 > 0:
        arg_5[arg_16-1] += arg_17

  arg_18 = [0] * arg_2
  for arg_19 in range(0, arg_2):
    if arg_3:
      arg_18[arg_19] = ((arg_4[arg_19] + 1.) /
                       (arg_5[arg_19] + 1.))
    else:
      if arg_5[arg_19] > 0:
        arg_18[arg_19] = (float(arg_4[arg_19]) /
                         arg_5[arg_19])
      else:
        arg_18[arg_19] = 0.0

  if min(arg_18) > 0:
    arg_20 = sum((1. / arg_2) * math.log(p) for p in arg_18)
    arg_21 = math.exp(arg_20)
  else:
    arg_21 = 0

  arg_22 = float(arg_7) / arg_6

  if arg_22 > 1.0:
    arg_23 = 1.
  else:
    arg_23 = math.exp(1 - 1. / arg_22)

  arg_24 = arg_21 * arg_23

  return (arg_24, arg_18, arg_23, arg_22, arg_7, arg_6)

Computes BLEU score of translated segments against one or more references .


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

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

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

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


def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_1 . update ( arg_2 ) arg_0 . session . add ( arg_1 ) return arg_1

def Func(arg_0, arg_1, **arg_2):
    '''Updates a security group rule.

    NOTE(alexm) this is non-standard functionality.
    '''
    arg_1.update(arg_2)
    arg_0.session.add(arg_1)
    return arg_1


def
Func
(
arg_0
)
:
arg_1
=
[
]
arg_2
=
[
]
if
"source_search_terms"
in
arg_0
and
arg_0
.
source_search_terms
:
arg_3
=
".*"
.
join
(
re
.
escape
(
x
)
for
x
in
arg_0
.
source_search_terms
)
arg_1
.
append
(
arg_3
)
arg_0
.
source_search_terms
=
arg_3
if
"search_terms"
in
arg_0
and
arg_0
.
search_terms
:
arg_3
=
".*"
.
join
(
re
.
escape
(
x
)
for
x
in
arg_0
.
search_terms
)
arg_1
.
append
(
arg_3
)
arg_0
.
search_terms
=
arg_3
if
"target_contact"
in
arg_0
and
arg_0
.
target_contact
:
arg_3
=
re
.
escape
(
arg_0
.
target_contact
)
arg_2
.
append
(
arg_3
)
arg_0
.
target_contact
=
arg_3
if
"uid"
in
arg_0
and
arg_0
.
uid
:
arg_1
.
append
(
arg_0
.
uid
)
if
"target_uid"
in
arg_0
and
arg_0
.
target_uid
:
arg_2
.
append
(
arg_0
.
target_uid
)
arg_1
=
"^.*(%s).*$"
%
')|('
.
join
(
arg_1
)
if
arg_1
else
arg_2
=
"^.*(%s).*$"
%
')|('
.
join
(
arg_2
)
if
arg_2
else
logging
.
debug
(
'Created source query regex: %s'
,
arg_1
)
logging
.
debug
(
'Created target query regex: %s'
,
arg_2
)
arg_7
=
{
abook
.
name
:
[
]
for
abook
in
config
.
abook
.
_abooks
}
for
arg_8
in
arg_7
:
if
"addressbook"
in
arg_0
and
arg_8
in
arg_0
.
addressbook
:
arg_7
[
arg_8
]
.
append
(
arg_1
)
if
"target_addressbook"
in
arg_0
and
arg_8
in
arg_0
.
target_addressbook
:
arg_7
[
arg_8
]
.
append
(
arg_2
)
if
in
arg_7
[
arg_8
]
:
arg_7
[
arg_8
]
=
else
:
arg_7
[
arg_8
]
=
"({})"
.
format
(
')|('
.
join
(
arg_7
[
arg_8
]
)
)
logging
.
debug
(
'Created query regex: %s'
,
arg_7
)
return
arg_7

def Func(arg_0):
    """Prepare the search query string from the given command line args.

    Each address book can get a search query string to filter vcards befor
    loading them.  Depending on the question if the address book is used for
    source or target searches different regexes have to be combined into one
    search string.

    :param args: the parsed command line
    :type args: argparse.Namespace
    :returns: a dict mapping abook names to their loading queries, if the query
        is None it means that all cards should be loaded
    :rtype: dict(str:str or None)

    """
    # get all possible search queries for address book parsing
    arg_1 = []
    arg_2 = []
    if "source_search_terms" in arg_0 and arg_0.source_search_terms:
        arg_3 = ".*".join(re.escape(x)
                                 for x in arg_0.source_search_terms)
        arg_1.append(arg_3)
        arg_0.source_search_terms = arg_3
    if "search_terms" in arg_0 and arg_0.search_terms:
        arg_3 = ".*".join(re.escape(x) for x in arg_0.search_terms)
        arg_1.append(arg_3)
        arg_0.search_terms = arg_3
    if "target_contact" in arg_0 and arg_0.target_contact:
        arg_3 = re.escape(arg_0.target_contact)
        arg_2.append(arg_3)
        arg_0.target_contact = arg_3
    if "uid" in arg_0 and arg_0.uid:
        arg_1.append(arg_0.uid)
    if "target_uid" in arg_0 and arg_0.target_uid:
        arg_2.append(arg_0.target_uid)
    # create and return regexp, None means that no query is given and hence all
    # contacts should be searched.
    arg_1 = "^.*(%s).*$" % ')|('.join(arg_1) \
        if arg_1 else None
    arg_2 = "^.*(%s).*$" % ')|('.join(arg_2) \
        if arg_2 else None
    logging.debug('Created source query regex: %s', arg_1)
    logging.debug('Created target query regex: %s', arg_2)
    # Get all possible search queries for address book parsing, always
    # depending on the fact if the address book is used to find source or
    # target contacts or both.
    arg_7 = {abook.name: [] for abook in config.abook._abooks}
    for arg_8 in arg_7:
        if "addressbook" in arg_0 and arg_8 in arg_0.addressbook:
            arg_7[arg_8].append(arg_1)
        if "target_addressbook" in arg_0 and arg_8 in arg_0.target_addressbook:
            arg_7[arg_8].append(arg_2)
        # If None is included in the search queries of an address book it means
        # that either no source or target query was given and this address book
        # is affected by this.  All contacts should be loaded from that address
        # book.
        if None in arg_7[arg_8]:
            arg_7[arg_8] = None
        else:
            arg_7[arg_8] = "({})".format(')|('.join(arg_7[arg_8]))
    logging.debug('Created query regex: %s', arg_7)
    return arg_7

Prepare the search query string from the given command line args .


def Func(arg_0):
        """Clear any internally cached BLE device data.  Necessary in some cases
        to prevent issues with stale device data getting cached by the OS.
        """
        # Go through and remove any device that isn't currently connected.
        for arg_1 in arg_0.list_devices():
            # Skip any connected device.
            if arg_1.is_connected:
                continue
            # Remove this device.  First get the adapter associated with the device.
            arg_2 = dbus.Interface(arg_0._bus.get_object('org.bluez', arg_1._adapter),
                                     _ADAPTER_INTERFACE)
            # Now call RemoveDevice on the adapter to remove the device from
            # bluez's DBus hierarchy.
            arg_2.RemoveDevice(arg_1._device.object_path)

Clear any internally cached BLE device data . Necessary in some cases to prevent issues with stale device data getting cached by the OS .


def
Func
(
arg_0
)
:
arg_1
=
os
.
path
.
getsize
(
arg_0
.
trace_file
)
arg_0
.
trace_retry
=
0
if
arg_1
and
arg_1
==
arg_0
.
trace_sizestamp
:
return
else
:
logger
.
debug
(
"Updating trace size stamp to: {}"
.
format
(
arg_1
)
)
arg_0
.
trace_sizestamp
=
arg_1
with
open
(
arg_0
.
trace_file
)
as
fh
:
arg_4
=
next
(
fh
)
.
strip
(
)
while
not
arg_4
:
arg_4
=
next
(
fh
)
.
strip
(
)
arg_5
=
arg_0
.
_header_mapping
(
arg_4
)
for
arg_6
in
fh
:
if
arg_6
.
strip
(
)
==
""
:
continue
arg_7
=
arg_6
.
strip
(
)
.
split
(
"\t"
)
if
arg_7
[
arg_5
[
"task_id"
]
]
in
arg_0
.
stored_ids
:
continue
if
arg_7
[
arg_5
[
"process"
]
]
==
"report"
:
arg_0
.
report_queue
.
append
(
arg_0
.
_expand_path
(
arg_7
[
arg_5
[
"hash"
]
]
)
)
arg_0
.
send
=
True
arg_0
.
stored_ids
.
append
(
arg_7
[
arg_5
[
"task_id"
]
]
)

def Func(arg_0):
        """Parses the nextflow trace file and retrieves the path of report JSON
        files that have not been sent to the service yet.
        """

        # Check the size stamp of the tracefile. Only proceed with the parsing
        # if it changed from the previous size.
        arg_1 = os.path.getsize(arg_0.trace_file)
        arg_0.trace_retry = 0
        if arg_1 and arg_1 == arg_0.trace_sizestamp:
            return
        else:
            logger.debug("Updating trace size stamp to: {}".format(arg_1))
            arg_0.trace_sizestamp = arg_1

        with open(arg_0.trace_file) as fh:

            # Skip potential empty lines at the start of file
            arg_4 = next(fh).strip()
            while not arg_4:
                arg_4 = next(fh).strip()

            # Get header mappings before parsing the file
            arg_5 = arg_0._header_mapping(arg_4)

            for arg_6 in fh:
                # Skip empty lines
                if arg_6.strip() == "":
                    continue

                arg_7 = arg_6.strip().split("\t")

                # Skip if task ID was already processes
                if arg_7[arg_5["task_id"]] in arg_0.stored_ids:
                    continue

                if arg_7[arg_5["process"]] == "report":
                    arg_0.report_queue.append(
                        arg_0._expand_path(arg_7[arg_5["hash"]])
                    )
                    arg_0.send = True

                # Add the processed trace line to the stored ids. It will be
                # skipped in future parsers
                arg_0.stored_ids.append(arg_7[arg_5["task_id"]])

Parses the nextflow trace file and retrieves the path of report JSON files that have not been sent to the service yet .


def Func ( arg_0 , arg_1 , arg_2 ) : import scipy . signal return scipy . signal . Func ( arg_0 , arg_1 , arg_2 )

def Func(arg_0, arg_1, arg_2):
    """Zero-pole-gain representation to state-space representation

    :param sequence z,p: Zeros and poles.
    :param float k: System gain.

    :return:
        * A, B, C, D : ndarray State-space matrices.

    .. note:: wrapper of scipy function Func
    """
    import scipy.signal
    return scipy.signal.Func(arg_0,arg_1,arg_2)

Zero-pole-gain representation to state-space representation

    :param sequence z,p: Zeros and poles.
    :param float k: System gain.

    :return:
        * A, B, C, D : ndarray State-space matrices.

    .. note:: wrapper of scipy function zpk2ss

Zero - pole - gain representation to state - space representation


def Func(arg_0):
        """
        Add and return the root document node to graph.
        """
        arg_1 = URIRef('http://www.spdx.org/tools#SPDXRef-DOCUMENT')
        # Doc type
        arg_0.graph.add((arg_1, RDF.type, arg_0.spdx_namespace.SpdxDocument))
        # Version
        arg_2 = Literal(str(arg_0.document.version))
        arg_0.graph.add((arg_1, arg_0.spdx_namespace.specVersion, arg_2))
        # Data license
        arg_3 = URIRef(arg_0.document.data_license.url)
        arg_0.graph.add((arg_1, arg_0.spdx_namespace.dataLicense, arg_3))
        arg_4 = URIRef(arg_0.document.name)
        arg_0.graph.add((arg_1, arg_0.spdx_namespace.name, arg_4))
        return arg_1

Add and return the root document node to graph .


def
Func
(
arg_0
,
arg_1
=
)
:
arg_2
=
datetime
.
datetime
.
now
(
)
if
arg_0
:
if
arg_1
:
arg_2
=
datetime
.
datetime
.
strptime
(
arg_0
,
arg_1
)
else
:
if
match_date
(
arg_0
)
:
if
len
(
arg_0
.
split
(
'-'
)
)
==
3
:
arg_0
=
arg_0
.
split
(
'-'
)
elif
len
(
arg_0
.
split
(
' '
)
)
==
3
:
arg_0
=
arg_0
.
split
(
' '
)
elif
len
(
arg_0
.
split
(
'.'
)
)
==
3
:
arg_0
=
arg_0
.
split
(
'.'
)
else
:
arg_0
=
arg_0
.
split
(
'/'
)
arg_2
=
datetime
.
datetime
(
*
(
int
(
number
)
for
number
in
arg_0
)
)
else
:
raise
ValueError
(
"Date %s is invalid"
%
arg_0
)
return
arg_2

def Func(arg_0, arg_1 = None):
    """Return a datetime object if there is a valid date

        Raise exception if date is not valid
        Return todays date if no date where added

        Args:
            date(str)
            date_format(str)

        Returns:
            date_obj(datetime.datetime)
    """
    arg_2 = datetime.datetime.now()
    if arg_0:
        if arg_1:
            arg_2 = datetime.datetime.strptime(arg_0, arg_1)
        else:
            if match_date(arg_0):
                if len(arg_0.split('-')) == 3:
                    arg_0 = arg_0.split('-')
                elif len(arg_0.split(' ')) == 3:
                    arg_0 = arg_0.split(' ')
                elif len(arg_0.split('.')) == 3:
                    arg_0 = arg_0.split('.')
                else:
                    arg_0 = arg_0.split('/')
                arg_2 = datetime.datetime(*(int(number) for number in arg_0))
            else:
                raise ValueError("Date %s is invalid" % arg_0)

    return arg_2


def Func(arg_0, arg_1=None):
    """Compute an exit code for mutmut mutation testing

    The following exit codes are available for mutmut:
     * 0 if all mutants were killed (OK_KILLED)
     * 1 if a fatal error occurred
     * 2 if one or more mutants survived (BAD_SURVIVED)
     * 4 if one or more mutants timed out (BAD_TIMEOUT)
     * 8 if one or more mutants caused tests to take twice as long (OK_SUSPICIOUS)

     Exit codes 1 to 8 will be bit-ORed so that it is possible to know what
     different mutant statuses occurred during mutation testing.

    :param exception:
    :type exception: Exception
    :param config:
    :type config: Config

    :return: integer noting the exit code of the mutation tests.
    :rtype: int
    """
    arg_2 = 0
    if arg_1 is not None:
        arg_2 = arg_2 | 1
    if arg_0.surviving_mutants > 0:
        arg_2 = arg_2 | 2
    if arg_0.surviving_mutants_timeout > 0:
        arg_2 = arg_2 | 4
    if arg_0.suspicious_mutants > 0:
        arg_2 = arg_2 | 8
    return arg_2


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
if
any
(
[
len
(
arg_3
.
files
.
fastqs
)
>
1
for
arg_3
in
arg_1
]
)
:
arg_4
=
time
.
time
(
)
arg_5
=
" concatenating inputs  | {} | s2 |"
arg_6
=
0
arg_7
=
{
}
for
arg_8
in
arg_1
:
if
len
(
arg_8
.
files
.
fastqs
)
>
1
:
arg_7
[
arg_8
.
name
]
=
arg_2
[
0
]
.
apply
(
concat_multiple_inputs
,
*
(
arg_0
,
arg_8
)
)
else
:
arg_8
.
files
.
concat
=
arg_8
.
files
.
fastqs
while
1
:
arg_6
=
sum
(
[
arg_3
.
ready
(
)
for
arg_3
in
arg_7
.
values
(
)
]
)
arg_12
=
datetime
.
timedelta
(
seconds
=
int
(
time
.
time
(
)
arg_4
)
)
progressbar
(
len
(
arg_7
)
,
arg_6
,
arg_5
.
format
(
arg_12
)
,
spacer
=
arg_0
.
_spacer
)
time
.
sleep
(
0.1
)
if
arg_6
==
len
(
arg_7
)
:
print
(
""
)
break
for
arg_13
in
arg_7
:
if
arg_7
[
arg_13
]
.
successful
(
)
:
arg_0
.
samples
[
arg_13
]
.
files
.
concat
=
arg_7
[
arg_13
]
.
result
(
)
else
:
arg_15
=
arg_7
[
arg_13
]
.
result
(
)
LOGGER
.
error
(
"error in step2 concat %s"
,
arg_15
)
raise
IPyradWarningExit
(
"error in step2 concat: {}"
.
format
(
arg_15
)
)
else
:
for
arg_8
in
arg_1
:
arg_8
.
files
.
concat
=
arg_8
.
files
.
fastqs
return
arg_1

def Func(arg_0, arg_1, arg_2):
    """ concatenate if multiple input files for a single samples """

    ## concatenate reads if they come from merged assemblies.
    if any([len(arg_3.files.fastqs) > 1 for arg_3 in arg_1]):
        ## run on single engine for now
        arg_4 = time.time()
        arg_5 = " concatenating inputs  | {} | s2 |"
        arg_6 = 0
        arg_7 = {}
        for arg_8 in arg_1:
            if len(arg_8.files.fastqs) > 1:
                arg_7[arg_8.name] = arg_2[0].apply(\
                                       concat_multiple_inputs, *(arg_0, arg_8))
            else:
                arg_8.files.concat = arg_8.files.fastqs

        ## wait for all to finish
        while 1:
            arg_6 = sum([arg_3.ready() for arg_3 in arg_7.values()])
            arg_12 = datetime.timedelta(seconds=int(time.time()-arg_4))
            progressbar(len(arg_7), arg_6, arg_5.format(arg_12), spacer=arg_0._spacer)
            time.sleep(0.1)
            if arg_6 == len(arg_7):
                print("")
                break

        ## collect results, which are concat file handles.
        for arg_13 in arg_7:
            if arg_7[arg_13].successful():
                arg_0.samples[arg_13].files.concat = arg_7[arg_13].result()
            else:
                arg_15 = arg_7[arg_13].result()#exception()
                LOGGER.error("error in step2 concat %s", arg_15)
                raise IPyradWarningExit("error in step2 concat: {}".format(arg_15))
    else:
        for arg_8 in arg_1:
            ## just copy fastqs handles to concat attribute
            arg_8.files.concat = arg_8.files.fastqs

    return arg_1


return self.fetch_json(
            uri_path=self.base_uri,
            query_params=query_params or {}
        )

def Func ( arg_0 , arg_1 = None ) : return arg_0 . fetch_json ( uri_path = arg_0 . base_uri , arg_1 = arg_1 or { } )

def Func(arg_0, arg_1=None):
        '''
        Get information for this card. Returns a dictionary of values.
        '''
        return arg_0.fetch_json(
            uri_path=arg_0.base_uri,
            arg_1=arg_1 or {}
        )

Get information for this card . Returns a dictionary of values .


def Func(arg_0, arg_1, arg_2=None):
    """
    Returns true if array1 and array2 have the same shapes, false
    otherwise.

    Parameters
    ----------
    array1: numpy.ndarray

    array2: numpy.ndarray

    nd_to_check: int
        Number of the dimensions to check, i.e., if == 3 then will check only the 3 first numbers of array.shape.
    Returns
    -------
    bool
    """
    arg_3 = arg_0.shape
    arg_4 = arg_1.shape
    if arg_2 is not None:
        if len(arg_3) < arg_2:
            arg_5 = 'Number of dimensions to check {} is out of bounds for the shape of the first image: \n{}\n.'.format(arg_3)
            raise ValueError(arg_5)
        elif len(arg_4) < arg_2:
            arg_5 = 'Number of dimensions to check {} is out of bounds for the shape of the second image: \n{}\n.'.format(arg_4)
            raise ValueError(arg_5)

        arg_3 = arg_3[:arg_2]
        arg_4 = arg_4[:arg_2]

    return arg_3 == arg_4

Returns true if array1 and array2 have the same shapes false otherwise .


(self, shell=True, sub=True, stdin=True, hb=True)

def Func ( arg_0 , arg_1 = True , arg_2 = True , arg_3 = True , arg_4 = True ) : if arg_1 : arg_0 . shell_channel . start ( ) if arg_2 : arg_0 . sub_channel . start ( ) if arg_3 : arg_0 . stdin_channel . start ( ) arg_0 . shell_channel . allow_stdin = True else : arg_0 . shell_channel . allow_stdin = False if arg_4 : arg_0 . hb_channel . start ( )

def Func(arg_0, arg_1=True, arg_2=True, arg_3=True, arg_4=True):
        """Starts the channels for this kernel.

        This will create the channels if they do not exist and then start
        them. If port numbers of 0 are being used (random ports) then you
        must first call :method:`start_kernel`. If the channels have been
        stopped and you call this, :class:`RuntimeError` will be raised.
        """
        if arg_1:
            arg_0.shell_channel.start()
        if arg_2:
            arg_0.sub_channel.start()
        if arg_3:
            arg_0.stdin_channel.start()
            arg_0.shell_channel.allow_stdin = True
        else:
            arg_0.shell_channel.allow_stdin = False
        if arg_4:
            arg_0.hb_channel.start()


return [self.parse_argument(argv.pop(0)) for tmp in range(self.nargs)]

def Func ( arg_0 , arg_1 ) : if len ( arg_1 ) < arg_0 . nargs : raise BadNumberOfArguments ( arg_0 . nargs , len ( arg_1 ) ) if arg_0 . nargs == 1 : return arg_0 . Func_argument ( arg_1 . pop ( 0 ) ) return [ arg_0 . Func_argument ( arg_1 . pop ( 0 ) ) for arg_2 in range ( arg_0 . nargs ) ]

def Func(arg_0, arg_1):
        """Pop, Func and return the first self.nargs items from args.

        if self.nargs > 1 a list of Funcd values will be returned.

        Raise BadNumberOfArguments or BadArgument on errors.

        NOTE: argv may be modified in place by this method.
        """
        if len(arg_1) < arg_0.nargs:
            raise BadNumberOfArguments(arg_0.nargs, len(arg_1))
        if arg_0.nargs == 1:
            return arg_0.Func_argument(arg_1.pop(0))
        return [arg_0.Func_argument(arg_1.pop(0)) for arg_2 in range(arg_0.nargs)]

Pop, parse and return the first self.nargs items from args.

        if self.nargs > 1 a list of parsed values will be returned.

        Raise BadNumberOfArguments or BadArgument on errors.

        NOTE: argv may be modified in place by this method.

Pop parse and return the first self . nargs items from args .


def Func ( arg_0 , arg_1 = arg_2 . compat . v1 . layers . dense , arg_7 = None ) : with arg_2 . compat . v1 . name_scope ( arg_7 , 'Func' , [ arg_0 ] ) : arg_0 = arg_2 . convert_to_tensor ( value = arg_0 , arg_7 = 'x' ) arg_8 = arg_2 . squeeze ( arg_1 ( arg_0 , 1 ) , axis = - 1 ) return tfd . Bernoulli ( arg_8 = arg_8 )

def Func(arg_0, arg_1=arg_2.compat.v1.layers.dense, arg_7=None):
  """Constructs a trainable `tfd.Bernoulli` distribution.

  This function creates a Bernoulli distribution parameterized by logits.
  Using default args, this function is mathematically equivalent to:

  ```none
  Y = Bernoulli(logits=matmul(W, x) + b)

  where,
    W in R^[d, n]
    b in R^d
  ```

  #### Examples

  This function can be used as a [logistic regression](
  https://en.wikipedia.org/wiki/Logistic_regression) loss.

  ```python
  # This example fits a logistic regression loss.
  import tensorflow as tf
  import tensorflow_probability as tfp

  # Create fictitious training data.
  dtype = np.float32
  n = 3000    # number of samples
  x_size = 4  # size of single x
  def make_training_data():
    np.random.seed(142)
    x = np.random.randn(n, x_size).astype(dtype)
    w = np.random.randn(x_size).astype(dtype)
    b = np.random.randn(1).astype(dtype)
    true_logits = np.tensordot(x, w, axes=[[-1], [-1]]) + b
    noise = np.random.logistic(size=n).astype(dtype)
    y = dtype(true_logits + noise > 0.)
    return y, x
  y, x = make_training_data()

  # Build TF graph for fitting Bernoulli maximum likelihood estimator.
  Func = tfp.trainable_distributions.Func(x)
  loss = -tf.reduce_mean(Func.log_prob(y))
  train_op = tf.train.AdamOptimizer(learning_rate=2.**-5).minimize(loss)
  mse = tf.reduce_mean(tf.squared_difference(y, Func.mean()))
  init_op = tf.global_variables_initializer()

  # Run graph 1000 times.
  num_steps = 1000
  loss_ = np.zeros(num_steps)   # Style: `_` to indicate sess.run result.
  mse_ = np.zeros(num_steps)
  with tf.Session() as sess:
    sess.run(init_op)
    for it in xrange(loss_.size):
      _, loss_[it], mse_[it] = sess.run([train_op, loss, mse])
      if it % 200 == 0 or it == loss_.size - 1:
        print("iteration:{}  loss:{}  mse:{}".format(it, loss_[it], mse_[it]))

  # ==> iteration:0    loss:0.635675370693  mse:0.222526371479
  #     iteration:200  loss:0.440077394247  mse:0.143687799573
  #     iteration:400  loss:0.440077394247  mse:0.143687844276
  #     iteration:600  loss:0.440077394247  mse:0.143687844276
  #     iteration:800  loss:0.440077424049  mse:0.143687844276
  #     iteration:999  loss:0.440077424049  mse:0.143687844276
  ```

  Args:
    x: `Tensor` with floating type. Must have statically defined rank and
      statically known right-most dimension.
    layer_fn: Python `callable` which takes input `x` and `int` scalar `d` and
      returns a transformation of `x` with shape
      `tf.concat([tf.shape(x)[:-1], [1]], axis=0)`.
      Default value: `tf.layers.dense`.
    name: A `name_scope` name for operations created by this function.
      Default value: `None` (i.e., "Func").

  Returns:
    Func: An instance of `tfd.Bernoulli`.
  """
  with arg_2.compat.v1.name_scope(arg_7, 'Func', [arg_0]):
    arg_0 = arg_2.convert_to_tensor(value=arg_0, arg_7='x')
    arg_8 = arg_2.squeeze(arg_1(arg_0, 1), axis=-1)
    return tfd.Bernoulli(arg_8=arg_8)

Constructs a trainable `tfd.Bernoulli` distribution.

  This function creates a Bernoulli distribution parameterized by logits.
  Using default args, this function is mathematically equivalent to:

  ```none
  Y = Bernoulli(logits=matmul(W, x) + b)

  where,
    W in R^[d, n]
    b in R^d
  ```

  #### Examples

  This function can be used as a [logistic regression](
  https://en.wikipedia.org/wiki/Logistic_regression) loss.

  ```python
  # This example fits a logistic regression loss.
  import tensorflow as tf
  import tensorflow_probability as tfp

  # Create fictitious training data.
  dtype = np.float32
  n = 3000    # number of samples
  x_size = 4  # size of single x
  def make_training_data():
    np.random.seed(142)
    x = np.random.randn(n, x_size).astype(dtype)
    w = np.random.randn(x_size).astype(dtype)
    b = np.random.randn(1).astype(dtype)
    true_logits = np.tensordot(x, w, axes=[[-1], [-1]]) + b
    noise = np.random.logistic(size=n).astype(dtype)
    y = dtype(true_logits + noise > 0.)
    return y, x
  y, x = make_training_data()

  # Build TF graph for fitting Bernoulli maximum likelihood estimator.
  bernoulli = tfp.trainable_distributions.bernoulli(x)
  loss = -tf.reduce_mean(bernoulli.log_prob(y))
  train_op = tf.train.AdamOptimizer(learning_rate=2.**-5).minimize(loss)
  mse = tf.reduce_mean(tf.squared_difference(y, bernoulli.mean()))
  init_op = tf.global_variables_initializer()

  # Run graph 1000 times.
  num_steps = 1000
  loss_ = np.zeros(num_steps)   # Style: `_` to indicate sess.run result.
  mse_ = np.zeros(num_steps)
  with tf.Session() as sess:
    sess.run(init_op)
    for it in xrange(loss_.size):
      _, loss_[it], mse_[it] = sess.run([train_op, loss, mse])
      if it % 200 == 0 or it == loss_.size - 1:
        print("iteration:{}  loss:{}  mse:{}".format(it, loss_[it], mse_[it]))

  # ==> iteration:0    loss:0.635675370693  mse:0.222526371479
  #     iteration:200  loss:0.440077394247  mse:0.143687799573
  #     iteration:400  loss:0.440077394247  mse:0.143687844276
  #     iteration:600  loss:0.440077394247  mse:0.143687844276
  #     iteration:800  loss:0.440077424049  mse:0.143687844276
  #     iteration:999  loss:0.440077424049  mse:0.143687844276
  ```

  Args:
    x: `Tensor` with floating type. Must have statically defined rank and
      statically known right-most dimension.
    layer_fn: Python `callable` which takes input `x` and `int` scalar `d` and
      returns a transformation of `x` with shape
      `tf.concat([tf.shape(x)[:-1], [1]], axis=0)`.
      Default value: `tf.layers.dense`.
    name: A `name_scope` name for operations created by this function.
      Default value: `None` (i.e., "bernoulli").

  Returns:
    bernoulli: An instance of `tfd.Bernoulli`.

Constructs a trainable tfd . Bernoulli distribution .


def Func(arg_0):
    '''This reads a HAT data server or LCC-Server produced CSV light curve
    into an lcdict.

    This will automatically figure out the format of the file
    provided. Currently, it can read:

    - legacy HAT data server CSV LCs (e.g. from
      https://hatsouth.org/planets/lightcurves.html) with an extension of the
      form: `.hatlc.csv.gz`.
    - all LCC-Server produced LCC-CSV-V1 LCs (e.g. from
      https://data.hatsurveys.org) with an extension of the form: `-csvlc.gz`.

    Parameters
    ----------

    lcfile : str
        The light curve file to read.

    Returns
    -------

    dict
        Returns an lcdict that can be read and used by many astrobase processing
        functions.

    '''

    # read in the file and split by lines
    if '.gz' in os.path.basename(arg_0):
        LOGINFO('reading gzipped HATLC: %s' % arg_0)
        arg_1 = gzip.open(arg_0,'rb')
    else:
        LOGINFO('reading HATLC: %s' % arg_0)
        arg_1 = open(arg_0,'rb')

    # this transparently reads LCC CSVLCs
    arg_2 = arg_1.read(12).decode()
    if 'LCC-CSVLC' in arg_2:
        arg_1.close()
        return read_lcc_csvlc(arg_0)
    else:
        arg_1.seek(0)

    # below is reading the HATLC v2 CSV LCs

    arg_3 = arg_1.read().decode()  # argh Python 3
    arg_1.close()

    # figure out the header and get the LC columns
    arg_4 = arg_3.index('# LIGHTCURVE\n')
    arg_5 = arg_3[:arg_4+12]
    arg_6 = arg_3[arg_4+13:].split('\n')
    arg_6 = [x for x in arg_6 if len(x) > 0]

    # initialize the lcdict and parse the CSV header
    arg_7 = _parse_csv_header(arg_5)

    # tranpose the LC rows into columns
    arg_6 = [x.split(',') for x in arg_6]
    arg_6 = list(zip(*arg_6))  # argh more Python 3

    # write the columns to the dict
    for arg_8, arg_9 in enumerate(arg_7['columns']):

        if (arg_9.split('_')[0] in LC_MAG_COLUMNS or
            arg_9.split('_')[0] in LC_ERR_COLUMNS or
            arg_9.split('_')[0] in LC_FLAG_COLUMNS):
            arg_7[arg_9] = np.array([_smartcast(x,
                                               COLUMNDEFS[arg_9.split('_')[0]][2])
                                    for x in arg_6[arg_8]])

        elif arg_9 in COLUMNDEFS:
            arg_7[arg_9] = np.array([_smartcast(x,COLUMNDEFS[arg_9][2])
                                    for x in arg_6[arg_8]])

        else:
            LOGWARNING('lcdict col %s has no formatter available' % arg_9)
            continue

    return arg_7

This reads a HAT data server or LCC - Server produced CSV light curve into an lcdict .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
find_path
(
arg_1
)
if
not
os
.
path
.
isfile
(
arg_2
)
:
raise
web
.
HTTPError
(
404
,
u'Notebook does not exist: %s'
%
arg_1
)
os
.
unlink
(
arg_2
)
arg_0
.
Func_id
(
arg_1
)

def Func(arg_0, arg_1):
        """Delete notebook by notebook_id."""
        arg_2 = arg_0.find_path(arg_1)
        if not os.path.isfile(arg_2):
            raise web.HTTPError(404, u'Notebook does not exist: %s' % arg_1)
        os.unlink(arg_2)
        arg_0.Func_id(arg_1)


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : term_echo ( "${{PMISC_DIR}}{sep}pypkg{sep}{cmd}" . format ( sep = os . path . sep , cmd = arg_0 ) , arg_1 , { "PMISC_DIR" : arg_2 } , arg_3 , )

def Func(arg_0, arg_1, arg_2, arg_3):
    r"""
    Echo terminal output.

    Print STDOUT resulting from a given Bash shell command (relative to the
    package :code:`pypkg` directory) formatted in reStructuredText

    :param command: Bash shell command, relative to
                    :bash:`${PMISC_DIR}/pypkg`
    :type  command: string

    :param nindent: Indentation level
    :type  nindent: integer

    :param mdir: Module directory
    :type  mdir: string

    :param fpointer: Output function pointer. Normally is :code:`cog.out` but
                     :code:`print` or other functions can be used for
                     debugging
    :type  fpointer: function object

    For example::

        .. This is a reStructuredText file snippet
        .. [[[cog
        .. import os, sys
        .. from docs.support.term_echo import term_echo
        .. file_name = sys.modules['docs.support.term_echo'].__file__
        .. mdir = os.path.realpath(
        ..     os.path.dirname(
        ..         os.path.dirname(os.path.dirname(file_name))
        ..     )
        .. )
        .. [[[cog Func('build_docs.py -h', 0, mdir, cog.out) ]]]

        .. code-block:: bash

        $ ${PMISC_DIR}/pypkg/build_docs.py -h
        usage: build_docs.py [-h] [-d DIRECTORY] [-n NUM_CPUS]
        ...

        .. ]]]

    """
    term_echo(
        "${{PMISC_DIR}}{sep}pypkg{sep}{cmd}".format(sep=os.path.sep, cmd=arg_0),
        arg_1,
        {"PMISC_DIR": arg_2},
        arg_3,
    )

r"""
    Echo terminal output.

    Print STDOUT resulting from a given Bash shell command (relative to the
    package :code:`pypkg` directory) formatted in reStructuredText

    :param command: Bash shell command, relative to
                    :bash:`${PMISC_DIR}/pypkg`
    :type  command: string

    :param nindent: Indentation level
    :type  nindent: integer

    :param mdir: Module directory
    :type  mdir: string

    :param fpointer: Output function pointer. Normally is :code:`cog.out` but
                     :code:`print` or other functions can be used for
                     debugging
    :type  fpointer: function object

    For example::

        .. This is a reStructuredText file snippet
        .. [[[cog
        .. import os, sys
        .. from docs.support.term_echo import term_echo
        .. file_name = sys.modules['docs.support.term_echo'].__file__
        .. mdir = os.path.realpath(
        ..     os.path.dirname(
        ..         os.path.dirname(os.path.dirname(file_name))
        ..     )
        .. )
        .. [[[cog ste('build_docs.py -h', 0, mdir, cog.out) ]]]

        .. code-block:: bash

        $ ${PMISC_DIR}/pypkg/build_docs.py -h
        usage: build_docs.py [-h] [-d DIRECTORY] [-n NUM_CPUS]
        ...

        .. ]]]


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 [ 'event_type' ] arg_3 = glance_customer_process . get ( arg_2 ) if arg_3 is not None : arg_3 ( arg_0 , arg_1 ) else : arg_4 = False arg_5 = None for arg_6 in glance_customer_process_wildcard . keys ( ) : if arg_6 . match ( arg_2 ) : arg_5 = glance_customer_process_wildcard . get ( arg_6 ) arg_4 = True break if arg_4 : arg_5 ( arg_0 , arg_1 ) else : default_process ( arg_0 , arg_1 ) arg_1 . ack ( )

def Func(arg_0, arg_1):
    """
    This function deal with the glance notification.

    First, find process from customer_process that not include wildcard.
    if not find from customer_process, then find process from customer_process_wildcard.
    if not find from customer_process_wildcard, then use ternya default process.
    :param body: dict of openstack notification.
    :param message: kombu Message class
    :return:
    """
    arg_2 = arg_0['event_type']
    arg_3 = glance_customer_process.get(arg_2)
    if arg_3 is not None:
        arg_3(arg_0, arg_1)
    else:
        arg_4 = False
        arg_5 = None
        for arg_6 in glance_customer_process_wildcard.keys():
            if arg_6.match(arg_2):
                arg_5 = glance_customer_process_wildcard.get(arg_6)
                arg_4 = True
                break
        if arg_4:
            arg_5(arg_0, arg_1)
        else:
            default_process(arg_0, arg_1)
    arg_1.ack()

This function deal with the glance notification .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . htm_prediction_model . _getAnomalyClassifier ( ) arg_3 = arg_2 . getSelf ( ) . _knn arg_4 = arg_2 . getSelf ( ) . getParameter ( 'categoryRecencyList' ) arg_5 = [ r . ROWID for r in arg_1 if not r . setByUser and r . ROWID in arg_4 ] arg_6 = arg_3 . _numPatterns arg_3 . removeIds ( arg_5 ) assert arg_3 . _numPatterns == arg_6 - len ( arg_5 )

def Func(arg_0, arg_1):
    """
    This method will remove the given records from the classifier.

    parameters
    ------------
    recordsToDelete - list of records to delete from the classififier
    """
    arg_2 = arg_0.htm_prediction_model._getAnomalyClassifier()
    arg_3 = arg_2.getSelf()._knn

    arg_4 = arg_2.getSelf().getParameter('categoryRecencyList')

    arg_5 = [r.ROWID for r in arg_1 if \
      not r.setByUser and r.ROWID in arg_4]

    arg_6 = arg_3._numPatterns
    arg_3.removeIds(arg_5)
    assert arg_3._numPatterns == arg_6 - len(arg_5)

This method will remove the given records from the classifier .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
if
arg_1
!=
'POST'
and
arg_1
!=
'PUT'
:
arg_3
=
arg_4
=
Session
(
)
LOGGER
.
debug
(
'Method: {0}, Url: {1}, Body: {2}.'
.
format
(
arg_1
,
arg_2
,
arg_3
)
)
arg_5
=
Request
(
arg_1
,
arg_2
,
json
=
arg_3
)
arg_6
=
arg_4
.
prepareFunc
(
arg_5
)
arg_7
=
arg_4
.
send
(
arg_6
,
timeout
=
arg_0
.
_timeout
or
)
arg_7
.
raise_for_status
(
)
return
arg_7
.
json
(
)

def Func(arg_0, arg_1, arg_2, arg_3):
        """Internal method to send request to the remote server.

        Args:
            method(str): HTTP Method(GET/POST/PUT/DELET/HEAD).
            url(str): The request url.
            body(dict): The JSON object to be sent.

        Returns:
            A dict represent the json body from server response.

        Raises:
            ConnectionError: Meet network problem (e.g. DNS failure,
                refused connection, etc).
            Timeout: A request times out.
            HTTPError: HTTP request returned an unsuccessful status code.
        """
        if arg_1 != 'POST' and arg_1 != 'PUT':
            arg_3 = None

        arg_4 = Session()

        LOGGER.debug(
            'Method: {0}, Url: {1}, Body: {2}.'.format(arg_1, arg_2, arg_3))

        arg_5 = Request(arg_1, arg_2, json=arg_3)
        arg_6 = arg_4.prepareFunc(arg_5)

        arg_7 = arg_4.send(arg_6, timeout=arg_0._timeout or None)
        arg_7.raise_for_status()
        # TODO try catch
        return arg_7.json()

Internal method to send request to the remote server .


def Func ( arg_0 , arg_1 , arg_2 = None ) : if arg_2 : arg_0 . execution_state_watchers [ arg_1 ] . append ( arg_2 ) else : arg_3 = arg_0 . Func_path ( arg_1 ) with open ( arg_3 ) as f : arg_4 = f . read ( ) arg_5 = ExecutionState ( ) arg_5 . ParseFromString ( arg_4 ) return arg_5

def Func(arg_0, arg_1, arg_2=None):
    """
    Get execution state
    """
    if arg_2:
      arg_0.execution_state_watchers[arg_1].append(arg_2)
    else:
      arg_3 = arg_0.Func_path(arg_1)
      with open(arg_3) as f:
        arg_4 = f.read()
        arg_5 = ExecutionState()
        arg_5.ParseFromString(arg_4)
        return arg_5


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
)
:
arg_5
=
range
(
len
(
arg_0
)
)
if
not
none_and_length_check
(
[
arg_0
,
arg_2
,
arg_3
,
arg_4
]
)
:
raise
Exception
(
'Function inputs are incorrect format'
)
arg_6
=
sum
(
[
xi
*
Vci
for
xi
,
Vci
in
zip
(
arg_0
,
arg_3
)
]
)
arg_7
=
sum
(
[
xi
*
Vci
**
(
2
/
3.
)
for
xi
,
Vci
in
zip
(
arg_0
,
arg_3
)
]
)
arg_8
=
sum
(
[
xi
*
Vci
**
(
1
/
3.
)
for
xi
,
Vci
in
zip
(
arg_0
,
arg_3
)
]
)
arg_9
=
0.25
*
(
arg_6
+
3.
*
arg_7
*
arg_8
)
arg_10
=
[
[
(
arg_2
[
i
]
*
arg_2
[
j
]
*
arg_3
[
i
]
*
arg_3
[
j
]
)
**
0.5
for
j
in
arg_5
]
for
i
in
arg_5
]
arg_11
=
mixing_simple
(
arg_0
,
arg_4
)
arg_12
=
sum
(
[
arg_0
[
i
]
*
arg_0
[
j
]
*
arg_10
[
i
]
[
j
]
/
arg_9
for
j
in
arg_5
for
i
in
arg_5
]
)
return
COSTALD
(
arg_1
,
arg_12
,
arg_9
,
arg_11
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    r'''Calculate mixture liquid density using the COSTALD CSP method.

    A popular and accurate estimation method. If possible, fit parameters are
    used; alternatively critical properties work well.

    The mixing rules giving parameters for the pure component COSTALD
    equation are:

    .. math::
        T_{cm} = \frac{\sum_i\sum_j x_i x_j (V_{ij}T_{cij})}{V_m}

        V_m = 0.25\left[ \sum x_i V_i + 3(\sum x_i V_i^{2/3})(\sum_i x_i V_i^{1/3})\right]

        V_{ij}T_{cij} = (V_iT_{ci}V_{j}T_{cj})^{0.5}

        \omega = \sum_i z_i \omega_i

    Parameters
    ----------
    xs: list
        Mole fractions of each component
    T : float
        Temperature of fluid [K]
    Tcs : list
        Critical temperature of fluids [K]
    Vcs : list
        Critical volumes of fluids [m^3/mol].
        This parameter is alternatively a fit parameter
    omegas : list
        (ideally SRK) Acentric factor of all fluids, [-]
        This parameter is alternatively a fit parameter.

    Returns
    -------
    Vs : float
        Saturation liquid mixture volume

    Notes
    -----
    Range: 0.25 < Tr < 0.95, often said to be to 1.0
    No example has been found.
    Units are that of critical or fit constant volume.

    Examples
    --------
    >>> Func([0.4576, 0.5424], 298.,  [512.58, 647.29],[0.000117, 5.6e-05], [0.559,0.344] )
    2.706588773271354e-05

    References
    ----------
    .. [1] Hankinson, Risdon W., and George H. Thomson. "A New Correlation for
       Saturated Densities of Liquids and Their Mixtures." AIChE Journal
       25, no. 4 (1979): 653-663. doi:10.1002/aic.690250412
    '''
    arg_5 = range(len(arg_0))
    if not none_and_length_check([arg_0, arg_2, arg_3, arg_4]):
        raise Exception('Function inputs are incorrect format')
    arg_6 = sum([xi*Vci for xi, Vci in zip(arg_0, arg_3)])
    arg_7 = sum([xi*Vci**(2/3.) for xi, Vci in zip(arg_0, arg_3)])
    arg_8 = sum([xi*Vci**(1/3.) for xi, Vci in zip(arg_0, arg_3)])
    arg_9 = 0.25*(arg_6 + 3.*arg_7*arg_8)
    arg_10 = [[(arg_2[i]*arg_2[j]*arg_3[i]*arg_3[j])**0.5 for j in arg_5] for i in arg_5]
    arg_11 = mixing_simple(arg_0, arg_4)
    arg_12 = sum([arg_0[i]*arg_0[j]*arg_10[i][j]/arg_9 for j in arg_5 for i in arg_5])
    return COSTALD(arg_1, arg_12, arg_9, arg_11)

r'''Calculate mixture liquid density using the COSTALD CSP method.

    A popular and accurate estimation method. If possible, fit parameters are
    used; alternatively critical properties work well.

    The mixing rules giving parameters for the pure component COSTALD
    equation are:

    .. math::
        T_{cm} = \frac{\sum_i\sum_j x_i x_j (V_{ij}T_{cij})}{V_m}

        V_m = 0.25\left[ \sum x_i V_i + 3(\sum x_i V_i^{2/3})(\sum_i x_i V_i^{1/3})\right]

        V_{ij}T_{cij} = (V_iT_{ci}V_{j}T_{cj})^{0.5}

        \omega = \sum_i z_i \omega_i

    Parameters
    ----------
    xs: list
        Mole fractions of each component
    T : float
        Temperature of fluid [K]
    Tcs : list
        Critical temperature of fluids [K]
    Vcs : list
        Critical volumes of fluids [m^3/mol].
        This parameter is alternatively a fit parameter
    omegas : list
        (ideally SRK) Acentric factor of all fluids, [-]
        This parameter is alternatively a fit parameter.

    Returns
    -------
    Vs : float
        Saturation liquid mixture volume

    Notes
    -----
    Range: 0.25 < Tr < 0.95, often said to be to 1.0
    No example has been found.
    Units are that of critical or fit constant volume.

    Examples
    --------
    >>> COSTALD_mixture([0.4576, 0.5424], 298.,  [512.58, 647.29],[0.000117, 5.6e-05], [0.559,0.344] )
    2.706588773271354e-05

    References
    ----------
    .. [1] Hankinson, Risdon W., and George H. Thomson. "A New Correlation for
       Saturated Densities of Liquids and Their Mixtures." AIChE Journal
       25, no. 4 (1979): 653-663. doi:10.1002/aic.690250412

r Calculate mixture liquid density using the COSTALD CSP method .


def Func ( arg_0 , arg_1 , * arg_2 , ** arg_3 ) : arg_4 = arg_0 . get_queue ( arg_1 = arg_1 , * arg_2 , ** arg_3 ) try : for arg_5 in arg_4 . iter ( ) : with arg_5 as batch : arg_6 = batch . copy ( ) for arg_7 in arg_6 : yield arg_7 arg_8 = arg_0 . get_remainder ( arg_1 , arg_4 . block_size ) for arg_7 in arg_8 : yield arg_7 finally : arg_4 . close ( )

def Func(arg_0, arg_1, *arg_2, **arg_3):
        """
        Get a generator that allows convenient access to the streamed data.
        Elements from the dataset are returned from the generator one row at a time.
        Unlike the direct access queue, this generator also returns the remainder elements.
        Additional arguments are forwarded to get_queue.
        See the get_queue method for documentation of these parameters.

        :param path:
        :return: A generator that iterates over the rows in the dataset.
        """
        arg_4 = arg_0.get_queue(arg_1=arg_1, *arg_2, **arg_3)

        try:
            # This generator just implements a standard access pattern for the direct access queue.
            for arg_5 in arg_4.iter():
                with arg_5 as batch:
                    arg_6 = batch.copy()

                for arg_7 in arg_6:
                    yield arg_7

            arg_8 = arg_0.get_remainder(arg_1, arg_4.block_size)
            for arg_7 in arg_8:
                yield arg_7

        finally:
            arg_4.close()

Get a generator that allows convenient access to the streamed data . Elements from the dataset are returned from the generator one row at a time . Unlike the direct access queue this generator also returns the remainder elements . Additional arguments are forwarded to get_queue . See the get_queue method for documentation of these parameters .


def Func(arg_0):
    """
    Handle arguments for the 'lumi-upload' command.
    """
    arg_1 = argparse.ArgumentParser(
        description=DESCRIPTION,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    arg_1.add_argument(
        '-b',
        '--base-url',
        default=URL_BASE,
        help='API root url, default: %s' % URL_BASE,
    )
    arg_1.add_argument(
        '-a',
        '--account-id',
        default=None,
        help='Account ID that should own the project, if not the default',
    )
    arg_1.add_argument(
        '-l',
        '--language',
        default='en',
        help='The language code for the language the text is in. Default: en',
    )
    arg_1.add_argument('-t', '--token', help="API authentication token")
    arg_1.add_argument(
        '-s',
        '--save-token',
        action='store_true',
        help='save --token for --base-url to ~/.luminoso/tokens.json',
    )
    arg_1.add_argument(
        'input_filename',
        help='The JSON-lines (.jsons) file of documents to upload',
    )
    arg_1.add_argument(
        'project_name',
        nargs='?',
        default=None,
        help='What the project should be called',
    )
    arg_2 = arg_1.parse_args(arg_0)
    if arg_2.save_token:
        if not arg_2.token:
            raise ValueError("error: no token provided")
        LuminosoClient.save_token(arg_2.token,
                                  domain=urlparse(arg_2.base_url).netloc)

    arg_3 = LuminosoClient.connect(url=arg_2.base_url, token=arg_2.token)

    arg_4 = arg_2.project_name
    if arg_4 is None:
        arg_4 = input('Enter a name for the project: ')
        if not arg_4:
            print('Aborting because no name was provided.')
            return

    arg_5 = upload_docs(
        arg_3,
        arg_2.input_filename,
        arg_2.language,
        arg_4,
        account=arg_2.account_id,
        progress=True,
    )
    print(
        'Project {!r} created with {} documents'.format(
            arg_5['project_id'], arg_5['document_count']
        )
    )

Handle arguments for the lumi - upload command .


(
        graph: BELGraph,
        nbunch: Union[BaseEntity, Iterable[BaseEntity]],
)

return {
        (u, v)
        for u, v, k, d in graph.out_edges(nbunch, keys=True, data=True)
        if is_causal_relation(graph, u, v, k, d)
    }

def Func ( arg_0 : arg_1 , arg_2 : arg_3 [ arg_4 , arg_5 [ arg_4 ] ] , ) -> Set [ Tuple [ arg_4 , arg_4 ] ] : return { ( arg_6 , arg_7 ) for arg_6 , arg_7 , arg_8 , arg_9 in arg_0 . out_edges ( arg_2 , keys = True , data = True ) if is_causal_relation ( arg_0 , arg_6 , arg_7 , arg_8 , arg_9 ) }

def Func(
        arg_0: arg_1,
        arg_2: arg_3[arg_4, arg_5[arg_4]],
) -> Set[Tuple[arg_4, arg_4]]:
    """Get the out-edges to the given node that are causal.

    :return: A set of (source, target) pairs where the source is the given node
    """
    return {
        (arg_6, arg_7)
        for arg_6, arg_7, arg_8, arg_9 in arg_0.out_edges(arg_2, keys=True, data=True)
        if is_causal_relation(arg_0, arg_6, arg_7, arg_8, arg_9)
    }

Get the out - edges to the given node that are causal .