def Func ( arg_0 , arg_1 , arg_2 = False ) : if arg_0 == arg_1 : return True arg_3 = False if isinstance ( arg_0 , str ) : arg_3 = arg_0 . startswith ( NEGATE ) arg_0 = strip_negate ( arg_0 ) if arg_3 else arg_0 try : test ( arg_0 , arg_1 , arg_2 = arg_2 ) except Exception as err : if arg_3 : return True else : raise err return True

def Func(arg_0, arg_1, arg_2=False):
    """
    Compares an string or regular expression againast a given value.

    Arguments:
        expr (str|regex): string or regular expression value to Func.
        value (str): value to Func against to.
        regex_expr (bool, optional): enables string based regex matching.

    Raises:
        AssertionError: in case of assertion error.

    Returns:
        bool
    """
    # Strict equality comparison
    if arg_0 == arg_1:
        return True

    # Infer negate expression to match, if needed
    arg_3 = False
    if isinstance(arg_0, str):
        arg_3 = arg_0.startswith(NEGATE)
        arg_0 = strip_negate(arg_0) if arg_3 else arg_0

    try:
        # RegExp or strict equality comparison
        test(arg_0, arg_1, arg_2=arg_2)
    except Exception as err:
        if arg_3:
            return True
        else:
            raise err

    return True

Compares an string or regular expression againast a given value.

    Arguments:
        expr (str|regex): string or regular expression value to compare.
        value (str): value to compare against to.
        regex_expr (bool, optional): enables string based regex matching.

    Raises:
        AssertionError: in case of assertion error.

    Returns:
        bool

Compares an string or regular expression againast a given value .


def Func ( arg_0 , arg_1 , arg_2 = 1 ) : assert arg_1 < len ( arg_0 . bytecode ) arg_3 = arg_0 . bytecode [ arg_1 : arg_1 + arg_2 ] if len ( arg_3 ) < arg_2 : arg_3 += '\x00' * ( arg_2 - len ( arg_3 ) ) return arg_3

def Func(arg_0, arg_1, arg_2=1):
        """
        Read size byte from bytecode.
        If less than size bytes are available result will be pad with \x00
        """
        assert arg_1 < len(arg_0.bytecode)
        arg_3 = arg_0.bytecode[arg_1:arg_1 + arg_2]
        if len(arg_3) < arg_2:
            arg_3 += '\x00' * (arg_2 - len(arg_3))  # pad with null (spec)
        return arg_3

Read size byte from bytecode . If less than size bytes are available result will be pad with \ x00


def Func ( arg_0 ) : if not arg_0 : return [ ] arg_1 = [ ] for arg_2 in arg_0 : if arg_2 . endswith ( '*' ) : arg_3 = arg_2 [ : - 1 ] arg_1 . extend ( [ arg_4 for arg_4 in _ZONES if arg_4 . startswith ( arg_3 ) ] ) else : arg_1 . append ( arg_2 ) return arg_1

def Func(arg_0):
  """Returns a list of zones based on any wildcard input.

  This function is intended to provide an easy method for producing a list
  of desired zones for a pipeline to run in.

  The Pipelines API default zone list is "any zone". The problem with
  "any zone" is that it can lead to incurring Cloud Storage egress charges
  if the GCE zone selected is in a different region than the GCS bucket.
  See https://cloud.google.com/storage/pricing#network-egress.

  A user with a multi-region US bucket would want to pipelines to run in
  a "us-*" zone.
  A user with a regional bucket in US would want to restrict pipelines to
  run in a zone in that region.

  Rarely does the specific zone matter for a pipeline.

  This function allows for a simple short-hand such as:
     [ "us-*" ]
     [ "us-central1-*" ]
  These examples will expand out to the full list of US and us-central1 zones
  respectively.

  Args:
    input_list: list of zone names/patterns

  Returns:
    A list of zones, with any wildcard zone specifications expanded.
  """
  if not arg_0:
    return []

  arg_1 = []

  for arg_2 in arg_0:
    if arg_2.endswith('*'):
      arg_3 = arg_2[:-1]
      arg_1.extend([arg_4 for arg_4 in _ZONES if arg_4.startswith(arg_3)])
    else:
      arg_1.append(arg_2)

  return arg_1

Returns a list of zones based on any wildcard input .


def Func ( arg_0 = True , arg_1 = None ) : if not arg_0 : return lambda fpath : fpath if arg_1 is None : arg_2 = lambda fpath : DicomFile ( fpath ) else : arg_3 = namedtuple ( 'DicomHeader' , arg_1 ) arg_2 = lambda fpath : arg_3 . _make ( DicomFile ( fpath ) . get_attributes ( arg_1 ) ) return arg_2

def Func(arg_0=True, arg_1=None):
        """
        Creates a lambda function to read DICOM files.
        If store_store_metadata is False, will only return the file path.
        Else if you give header_fields, will return only the set of of
        header_fields within a DicomFile object or the whole DICOM file if
        None.

        :return: function
        This function has only one parameter: file_path
        """
        if not arg_0:
            return lambda fpath: fpath

        if arg_1 is None:
            arg_2 = lambda fpath: DicomFile(fpath)
        else:
            arg_3 = namedtuple('DicomHeader', arg_1)
            arg_2 = lambda fpath: arg_3._make(DicomFile(fpath).get_attributes(arg_1))

        return arg_2

Creates a lambda function to read DICOM files . If store_store_metadata is False will only return the file path . Else if you give header_fields will return only the set of of header_fields within a DicomFile object or the whole DICOM file if None .


return (mean + std * rng.randn(size)).astype(FLOAT)

def Func ( arg_0 , arg_1 = 0 , arg_2 = 1 , arg_3 = None ) : if arg_3 is None or isinstance ( arg_3 , int ) : arg_3 = np . random . RandomState ( arg_3 ) return ( arg_1 + arg_2 * arg_3 . randn ( arg_0 ) ) . astype ( FLOAT )

def Func(arg_0, arg_1=0, arg_2=1, arg_3=None):
    '''Create a vector of randomly-initialized values.

    Parameters
    ----------
    size : int
        Length of vecctor to create.
    mean : float, optional
        Mean value for initial vector values. Defaults to 0.
    std : float, optional
        Standard deviation for initial vector values. Defaults to 1.
    rng : :class:`numpy.random.RandomState` or int, optional
        A random number generator, or an integer seed for a random number
        generator. If not provided, the random number generator will be created
        with an automatically chosen seed.

    Returns
    -------
    vector : numpy array
        An array containing random values. This often represents the bias for a
        layer of computation units.
    '''
    if arg_3 is None or isinstance(arg_3, int):
        arg_3 = np.random.RandomState(arg_3)
    return (arg_1 + arg_2 * arg_3.randn(arg_0)).astype(FLOAT)

Create a vector of randomly - initialized values .


def Func(arg_0):
    """
    Creates a generator returning tuples of information about each extension
    from a byte string of extension data contained in a ServerHello ores
    ClientHello message

    :param data:
        A byte string of a extension data from a TLS ServerHello or ClientHello
        message

    :return:
        A generator that yields 2-element tuples:
        [0] Byte string of extension type
        [1] Byte string of extension data
    """

    if arg_0 == b'':
        return

    arg_1 = int_from_bytes(arg_0[0:2])
    arg_2 = 2
    arg_3 = 2 + arg_1

    arg_4 = arg_2
    while arg_4 < arg_3:
        arg_5 = int_from_bytes(arg_0[arg_4:arg_4 + 2])
        arg_6 = int_from_bytes(arg_0[arg_4 + 2:arg_4 + 4])
        yield (
            arg_5,
            arg_0[arg_4 + 4:arg_4 + 4 + arg_6]
        )
        arg_4 += 4 + arg_6


def Func(arg_0, arg_1=None, arg_2=False):
        """
        Returns a debug-output-suitable file-like object based on the
        optional os_path and optionally skipping any configured
        sub-command.
        """
        arg_3 = None if arg_2 else arg_0.debug_sub_command
        arg_4, arg_5 = arg_0._get_out_and_path(
            arg_0.debug, arg_0.debug_root, arg_3, arg_1)
        if hasattr(arg_4, 'stdin'):
            return arg_4.stdin
        return arg_4

Returns a debug - output - suitable file - like object based on the optional os_path and optionally skipping any configured sub - command .


def Func ( arg_0 , arg_1 = None ) : arg_2 = dict ( ) if arg_1 : arg_2 [ "tag_name" ] = arg_1 arg_3 = arg_0 . get_data ( "droplets/" , arg_2 = arg_2 ) arg_4 = list ( ) for arg_5 in arg_3 [ 'droplets' ] : arg_6 = Droplet ( ** arg_5 ) arg_6 . token = arg_0 . token for arg_8 in arg_6 . networks [ 'v4' ] : if arg_8 [ 'type' ] == 'private' : arg_6 . private_ip_address = arg_8 [ 'ip_address' ] if arg_8 [ 'type' ] == 'public' : arg_6 . ip_address = arg_8 [ 'ip_address' ] if arg_6 . networks [ 'v6' ] : arg_6 . ip_v6_address = arg_6 . networks [ 'v6' ] [ 0 ] [ 'ip_address' ] if "backups" in arg_6 . features : arg_6 . backups = True else : arg_6 . backups = False if "ipv6" in arg_6 . features : arg_6 . ipv6 = True else : arg_6 . ipv6 = False if "private_networking" in arg_6 . features : arg_6 . private_networking = True else : arg_6 . private_networking = False arg_4 . append ( arg_6 ) return arg_4

def Func(arg_0, arg_1=None):
        """
            This function returns a list of Droplet object.
        """
        arg_2 = dict()
        if arg_1:
            arg_2["tag_name"] = arg_1

        arg_3 = arg_0.get_data("droplets/", arg_2=arg_2)

        arg_4 = list()
        for arg_5 in arg_3['droplets']:
            arg_6 = Droplet(**arg_5)
            arg_6.token = arg_0.token

            for arg_8 in arg_6.networks['v4']:
                if arg_8['type'] == 'private':
                    arg_6.private_ip_address = arg_8['ip_address']
                if arg_8['type'] == 'public':
                    arg_6.ip_address = arg_8['ip_address']
            if arg_6.networks['v6']:
                arg_6.ip_v6_address = arg_6.networks['v6'][0]['ip_address']

            if "backups" in arg_6.features:
                arg_6.backups = True
            else:
                arg_6.backups = False
            if "ipv6" in arg_6.features:
                arg_6.ipv6 = True
            else:
                arg_6.ipv6 = False
            if "private_networking" in arg_6.features:
                arg_6.private_networking = True
            else:
                arg_6.private_networking = False

            arg_4.append(arg_6)

        return arg_4

This function returns a list of Droplet object .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
LOG
.
info
(
"Running scout view Func"
)
arg_3
=
arg_0
.
obj
[
'adapter'
]
if
arg_2
:
arg_4
=
{
}
arg_5
=
arg_3
.
gene_by_alias
(
arg_2
,
arg_1
=
arg_1
)
for
arg_6
in
arg_5
:
arg_7
=
arg_6
[
'hgnc_id'
]
arg_8
=
arg_6
[
'hgnc_symbol'
]
for
arg_9
in
arg_6
[
'Func'
]
:
arg_10
=
if
arg_9
==
arg_8
:
arg_10
=
arg_7
if
arg_9
in
arg_4
:
arg_4
[
arg_9
]
[
'ids'
]
.
add
(
arg_7
)
if
arg_10
:
arg_4
[
arg_9
]
[
'true'
]
=
arg_7
else
:
arg_4
[
arg_9
]
=
{
'true'
:
arg_7
,
'ids'
:
set
(
[
arg_7
]
)
}
else
:
arg_4
=
arg_3
.
genes_by_alias
(
arg_1
=
arg_1
)
if
len
(
arg_4
)
==
0
:
LOG
.
info
(
"No gene found for build %s"
,
arg_1
)
return
click
.
echo
(
"#hgnc_symbol\ttrue_id\thgnc_ids"
)
for
arg_11
in
arg_4
:
arg_12
=
arg_4
[
arg_11
]
click
.
echo
(
"{0}\t{1}\t{2}\t"
.
format
(
arg_11
,
(
arg_4
[
arg_11
]
[
'true'
]
or
'None'
)
,
', '
.
join
(
[
str
(
arg_13
)
for
arg_13
in
arg_4
[
arg_11
]
[
'ids'
]
]
)
)
)

def Func(arg_0, arg_1, arg_2):
    """Show all alias symbols and how they map to ids"""
    LOG.info("Running scout view Func")
    arg_3 = arg_0.obj['adapter']

    if arg_2:
        arg_4 = {}
        arg_5 = arg_3.gene_by_alias(arg_2, arg_1=arg_1)
        for arg_6 in arg_5:
            arg_7 = arg_6['hgnc_id']
            # Collect the true symbol given by hgnc
            arg_8 = arg_6['hgnc_symbol']
            # Loop aver all Func
            for arg_9 in arg_6['Func']:
                arg_10 = None
                # If the alias is the same as hgnc symbol we know the true id
                if arg_9 == arg_8:
                    arg_10 = arg_7
                # If the alias is already in the list we add the id
                if arg_9 in arg_4:
                    arg_4[arg_9]['ids'].add(arg_7)
                    if arg_10:
                        arg_4[arg_9]['true'] = arg_7
                else:
                    arg_4[arg_9] = {
                        'true': arg_7,
                        'ids': set([arg_7])
                    }

    else:
        arg_4 = arg_3.genes_by_alias(arg_1=arg_1)

    if len(arg_4) == 0:
        LOG.info("No gene found for build %s", arg_1)
        return

    click.echo("#hgnc_symbol\ttrue_id\thgnc_ids")
    for arg_11 in arg_4:
        arg_12 = arg_4[arg_11]
        # pp(info)
        click.echo("{0}\t{1}\t{2}\t".format(
            arg_11,
            (arg_4[arg_11]['true'] or 'None'),
            ', '.join([str(arg_13) for arg_13 in arg_4[arg_11]['ids']])
        )
        )


def Func(arg_0, arg_1):
        """
        Set history parameters.

        Types:
            - `parameters`: `HistoryParameters`
        """
        for arg_2 in xml_element_iter(arg_0.xmlnode.children):
            if get_node_ns_uri(arg_2) == MUC_NS and arg_2.name == "history":
                arg_2.unlinkNode()
                arg_2.freeNode()
                break

        if arg_1.maxchars and arg_1.maxchars < 0:
            raise ValueError("History parameter maxchars must be positive")
        if arg_1.maxstanzas and arg_1.maxstanzas < 0:
            raise ValueError("History parameter maxstanzas must be positive")
        if arg_1.maxseconds and arg_1.maxseconds < 0:
            raise ValueError("History parameter maxseconds must be positive")

        arg_3=arg_0.xmlnode.newChild(arg_0.xmlnode.ns(), "history", None)

        if arg_1.maxchars is not None:
            arg_3.setProp("maxchars", str(arg_1.maxchars))
        if arg_1.maxstanzas is not None:
            arg_3.setProp("maxstanzas", str(arg_1.maxstanzas))
        if arg_1.maxseconds is not None:
            arg_3.setProp("maxseconds", str(arg_1.maxseconds))
        if arg_1.since is not None:
            arg_3.setProp("since", arg_1.since.strftime("%Y-%m-%dT%H:%M:%SZ"))


def Func ( arg_0 , arg_1 = None ) : arg_2 = next ( arg_0 ) if isinstance ( arg_2 , str ) : if arg_1 is None : yield arg_2 for arg_3 in arg_0 : yield arg_3 else : yield arg_2 . encode ( arg_1 ) for arg_3 in arg_0 : yield arg_3 . encode ( arg_1 ) else : if arg_1 is None : arg_1 = sys . stdout . encoding or 'utf-8' yield arg_2 . decode ( arg_1 ) for arg_3 in arg_0 : yield arg_3 . decode ( arg_1 )

def Func(arg_0, arg_1=None):
    """Convert data from previous pipe with specified encoding."""
    arg_2 = next(arg_0)
    if isinstance(arg_2, str):
        if arg_1 is None:
            yield arg_2
            for arg_3 in arg_0:
                yield arg_3
        else:
            yield arg_2.encode(arg_1)
            for arg_3 in arg_0:
                yield arg_3.encode(arg_1)
    else:
        if arg_1 is None:
            arg_1 = sys.stdout.encoding or 'utf-8'
        yield arg_2.decode(arg_1)
        for arg_3 in arg_0:
            yield arg_3.decode(arg_1)

Convert data from previous pipe with specified encoding .


def Func ( arg_0 , arg_1 ) : for arg_2 in arg_0 . nodes : if arg_2 . ID == str ( arg_1 ) : return arg_2 return None

def Func(arg_0, arg_1):
        """ Returns the node with the given ID or None.
        """
        for arg_2 in arg_0.nodes:
            if arg_2.ID == str(arg_1):
                return arg_2
        return None

Returns the node with the given ID or None .


Takes a set of unicode string OIDs and converts vendor-specific OIDs into
    generics OIDs from RFCs.

Takes a set of unicode string OIDs and converts vendor - specific OIDs into generics OIDs from RFCs .


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , list ) or isinstance ( arg_1 , dict ) or isinstance ( arg_1 , SortableDict ) or isinstance ( arg_1 , Grid ) : arg_0 . _assert_version ( VER_3_0 )

def Func(arg_0, arg_1):
        '''
        Detect the version used from the row content, or validate against
        the version if given.
        '''
        if isinstance(arg_1, list) \
                or isinstance(arg_1, dict) \
                or isinstance(arg_1, SortableDict) \
                or isinstance(arg_1, Grid):
            # Project Haystack 3.0 type.
            arg_0._assert_version(VER_3_0)

Detect the version used from the row content or validate against the version if given .


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

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Update the settings for an existing webhook.

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

Update the settings for an existing webhook .


def Func ( arg_0 ) : if not isinstance ( arg_0 . key , Unparseable ) : return arg_0 . key arg_1 = arg_0 . source [ arg_0 . col_offset : ] arg_2 = re . compile ( '''pyconfig\.[eginst]+\(([^,]+).*?\)''' ) arg_3 = arg_2 . match ( arg_1 ) if not arg_3 : return Unparseable ( ) return "<%s>" % arg_3 . group ( 1 )

def Func(arg_0):
        """
        Return the call key, even if it has to be parsed from the source.

        """
        if not isinstance(arg_0.key, Unparseable):
            return arg_0.key

        arg_1 = arg_0.source[arg_0.col_offset:]
        arg_2 = re.compile('''pyconfig\.[eginst]+\(([^,]+).*?\)''')
        arg_3 = arg_2.match(arg_1)
        if not arg_3:
            return Unparseable()

        return "<%s>" % arg_3.group(1)

Return the call key even if it has to be parsed from the source .


return ed.MultivariateNormalDiag(
        loc=net[..., :self.latent_size],
        scale_diag=tf.nn.softplus(net[..., self.latent_size:]),
        name="latent_code_posterior")

def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . encoder_net ( tf . cast ( arg_1 , tf . float32 ) ) return ed . MultivariateNormalDiag ( loc = arg_2 [ ... , : arg_0 . latent_size ] , scale_diag = tf . nn . softplus ( arg_2 [ ... , arg_0 . latent_size : ] ) , name = "latent_code_posterior" )

def Func(arg_0, arg_1):
    """Runs the model forward to return a stochastic encoding.

    Args:
      inputs: Tensor of shape [1, num_productions, num_production_rules]. It is
        a sequence of productions of length `num_productions`. Each production
        is a one-hot vector of length `num_production_rules`: it determines
        which production rule the production corresponds to.

    Returns:
      latent_code_posterior: A random variable capturing a sample from the
        variational distribution, of shape [1, self.latent_size].
    """
    arg_2 = arg_0.encoder_net(tf.cast(arg_1, tf.float32))
    return ed.MultivariateNormalDiag(
        loc=arg_2[..., :arg_0.latent_size],
        scale_diag=tf.nn.softplus(arg_2[..., arg_0.latent_size:]),
        name="latent_code_posterior")

Runs the model forward to return a stochastic encoding .


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

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

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

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

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

Decorator function for making python apps.

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

Decorator function for making python apps .


def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : arg_1 = arg_0 . _config_filename arg_2 = os . path . dirname ( arg_1 ) if not os . path . isdir ( arg_2 ) : os . makedirs ( arg_2 ) with open ( arg_1 , "w" ) as configfile : arg_0 . _config . write ( configfile )

def Func(arg_0, arg_1=None):
        """
        Save the given user configuration.
        """
        if arg_1 is None:
            arg_1 = arg_0._config_filename
        arg_2 = os.path.dirname(arg_1)
        if not os.path.isdir(arg_2):
            os.makedirs(arg_2)
        with open(arg_1, "w") as configfile:
            arg_0._config.write(configfile)


def Func ( arg_0 , arg_1 = None ) : arg_2 = KitsuneClient . FIRST_PAGE if arg_1 : arg_2 += int ( arg_1 / KitsuneClient . ITEMS_PER_PAGE ) while True : arg_3 = urijoin ( arg_0 . base_url , '/question' ) + '/' arg_4 = { "page" : arg_2 , "ordering" : "updated" } arg_5 = arg_0 . fetch ( arg_3 , arg_4 ) yield arg_5 arg_6 = json . loads ( arg_5 ) arg_7 = arg_6 [ 'next' ] if not arg_7 : break arg_2 += 1

def Func(arg_0, arg_1=None):
        """Retrieve questions from older to newer updated starting offset"""

        arg_2 = KitsuneClient.FIRST_PAGE

        if arg_1:
            arg_2 += int(arg_1 / KitsuneClient.ITEMS_PER_PAGE)

        while True:
            arg_3 = urijoin(arg_0.base_url, '/question') + '/'

            arg_4 = {
                "page": arg_2,
                "ordering": "updated"
            }

            arg_5 = arg_0.fetch(arg_3, arg_4)
            yield arg_5

            arg_6 = json.loads(arg_5)
            arg_7 = arg_6['next']
            if not arg_7:
                break
            arg_2 += 1


def Func ( arg_0 , arg_1 , arg_2 ) : if len ( arg_1 . annotations ) != 0 : if not arg_0 . annotation_type_set : if arg_2 . endswith ( 'annotationType_other' ) : arg_0 . annotation_type_set = True arg_1 . annotations [ - 1 ] . annotation_type = 'OTHER' return True elif arg_2 . endswith ( 'annotationType_review' ) : arg_0 . annotation_type_set = True arg_1 . annotations [ - 1 ] . annotation_type = 'REVIEW' return True else : raise SPDXValueError ( 'Annotation::AnnotationType' ) else : raise CardinalityError ( 'Annotation::AnnotationType' ) else : raise OrderError ( 'Annotation::AnnotationType' )

def Func(arg_0, arg_1, arg_2):
        """Sets the annotation type. Raises CardinalityError if
        already set. OrderError if no annotator defined before.
        """
        if len(arg_1.annotations) != 0:
            if not arg_0.annotation_type_set:
                if arg_2.endswith('annotationType_other'):
                    arg_0.annotation_type_set = True
                    arg_1.annotations[-1].annotation_type = 'OTHER'
                    return True
                elif arg_2.endswith('annotationType_review'):
                    arg_0.annotation_type_set = True
                    arg_1.annotations[-1].annotation_type = 'REVIEW'
                    return True
                else:
                    raise SPDXValueError('Annotation::AnnotationType')
            else:
                raise CardinalityError('Annotation::AnnotationType')
        else:
            raise OrderError('Annotation::AnnotationType')

Sets the annotation type . Raises CardinalityError if already set . OrderError if no annotator defined before .


def Func ( arg_0 , arg_1 = 2 , arg_2 = False ) : arg_3 = unicode ( abs ( arg_0 ) ) if len ( arg_3 ) < arg_1 : arg_3 = '0' * ( arg_1 - len ( arg_3 ) ) + arg_3 if not arg_2 : return arg_3 if arg_0 >= 0 : return '+' + arg_3 else : return '-' + arg_3

def Func(arg_0, arg_1=2, arg_2=False):
    '''returns n digit string representation of the num'''
    arg_3 = unicode(abs(arg_0))
    if len(arg_3) < arg_1:
        arg_3 = '0' * (arg_1 - len(arg_3)) + arg_3
    if not arg_2:
        return arg_3
    if arg_0 >= 0:
        return '+' + arg_3
    else:
        return '-' + arg_3


(self, filename, key, auto_create_bucket=True)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
True
)
:
try
:
arg_4
=
arg_0
.
s3
.
get_bucket
(
arg_0
.
aws
.
bucket
)
if
(
(
arg_0
.
aws
.
region
!=
'us-east-1'
and
arg_0
.
aws
.
region
!=
'eu-west-1'
)
and
arg_4
.
get_location
(
)
!=
arg_0
.
aws
.
region
)
or
(
arg_0
.
aws
.
region
==
'us-east-1'
and
arg_4
.
get_location
(
)
!=
''
)
or
(
arg_0
.
aws
.
region
==
'eu-west-1'
and
arg_4
.
get_location
(
)
!=
'eu-west-1'
)
:
raise
Exception
(
"Existing bucket doesn't match region"
)
except
S3ResponseError
:
arg_4
=
arg_0
.
s3
.
create_bucket
(
arg_0
.
aws
.
bucket
,
location
=
arg_0
.
aws
.
region
)
def
__report_upload_progress
(
arg_5
,
arg_6
)
:
if
not
arg_5
:
arg_5
=
0
if
not
arg_6
:
arg_6
=
0
out
(
"Uploaded "
+
str
(
arg_5
)
+
" bytes of "
+
str
(
arg_6
)
+
" ("
+
str
(
int
(
float
(
max
(
1
,
arg_5
)
)
/
float
(
arg_6
)
*
100
)
)
+
"%)"
)
arg_7
=
Key
(
arg_4
)
arg_7
.
key
=
arg_0
.
aws
.
bucket_path
+
arg_2
arg_7
.
set_metadata
(
'time'
,
str
(
time
(
)
)
)
arg_7
.
set_contents_from_filename
(
arg_1
,
cb
=
__report_upload_progress
,
num_cb
=
10
)

def Func(arg_0, arg_1, arg_2, arg_3=True):
        """
        Uploads an application archive version to s3
        """
        try:
            arg_4 = arg_0.s3.get_bucket(arg_0.aws.bucket)
            if ((
                  arg_0.aws.region != 'us-east-1' and arg_0.aws.region != 'eu-west-1') and arg_4.get_location() != arg_0.aws.region) or (
                  arg_0.aws.region == 'us-east-1' and arg_4.get_location() != '') or (
                  arg_0.aws.region == 'eu-west-1' and arg_4.get_location() != 'eu-west-1'):
                raise Exception("Existing bucket doesn't match region")
        except S3ResponseError:
            arg_4 = arg_0.s3.create_bucket(arg_0.aws.bucket, location=arg_0.aws.region)

        def __report_upload_progress(arg_5, arg_6):
            if not arg_5:
                arg_5 = 0
            if not arg_6:
                arg_6 = 0
            out("Uploaded " + str(arg_5) + " bytes of " + str(arg_6) \
                + " (" + str(int(float(max(1, arg_5)) / float(arg_6) * 100)) + "%)")

        # upload the new version
        arg_7 = Key(arg_4)
        arg_7.key = arg_0.aws.bucket_path + arg_2
        arg_7.set_metadata('time', str(time()))
        arg_7.set_contents_from_filename(arg_1, cb=__report_upload_progress, num_cb=10)


converts string to type requested by `cast_as`

def Func ( arg_0 , arg_1 : arg_2 ) : try : return getattr ( arg_0 , 'Func_as_{}' . format ( arg_0 . Func_as . __name__ . lower ( ) ) ) ( arg_1 ) except AttributeError : return arg_0 . Func_as ( arg_1 )

def Func(arg_0, arg_1: arg_2):
        """converts string to type requested by `Func_as`"""
        try:
            return getattr(arg_0, 'Func_as_{}'.format(
                arg_0.Func_as.__name__.lower()))(arg_1)
        except AttributeError:
            return arg_0.Func_as(arg_1)

converts string to type requested by cast_as


def Func(arg_0, arg_1):
        """
        Execute the entity at the current clock cycle.

        :param clock: The clock containing the current execution time and
          period information.
        """

        if arg_1.timestep_ix >= arg_0.period_count:
            return

        for arg_2 in arg_0.components:
            arg_2.Func(arg_1, arg_0.gl)

        arg_0._perform_year_end_procedure(arg_1)

Execute the entity at the current clock cycle .


def Func ( arg_0 , arg_1 = True ) : if arg_1 : if isinstance ( arg_0 , OrderedDict ) : arg_2 = OrderedDict ( ( val , arg_3 ) for arg_3 , val in arg_0 . items ( ) ) else : arg_2 = { val : arg_3 for arg_3 , val in arg_0 . items ( ) } else : arg_2 = defaultdict ( set ) for arg_3 , arg_4 in arg_0 . items ( ) : arg_2 [ arg_4 ] . add ( arg_3 ) arg_2 = dict ( arg_2 ) return arg_2

def Func(arg_0, arg_1=True):
    r"""
    Swaps the keys and values in a dictionary.

    Args:
        dict_ (dict): dictionary to invert
        unique_vals (bool): if False, inverted keys are returned in a set.
            The default is True.

    Returns:
        dict: inverted

    Notes:
        The must values be hashable.

        If the original dictionary contains duplicate values, then only one of
        the corresponding keys will be returned and the others will be
        discarded.  This can be prevented by setting `unique_vals=True`,
        causing the inverted keys to be returned in a set.

    CommandLine:
        python -m ubelt.util_dict Func

    Example:
        >>> import ubelt as ub
        >>> dict_ = {'a': 1, 'b': 2}
        >>> inverted = ub.Func(dict_)
        >>> assert inverted == {1: 'a', 2: 'b'}

    Example:
        >>> import ubelt as ub
        >>> dict_ = ub.odict([(2, 'a'), (1, 'b'), (0, 'c'), (None, 'd')])
        >>> inverted = ub.Func(dict_)
        >>> assert list(inverted.keys())[0] == 'a'

    Example:
        >>> import ubelt as ub
        >>> dict_ = {'a': 1, 'b': 0, 'c': 0, 'd': 0, 'f': 2}
        >>> inverted = ub.Func(dict_, unique_vals=False)
        >>> assert inverted == {0: {'b', 'c', 'd'}, 1: {'a'}, 2: {'f'}}
    """
    if arg_1:
        if isinstance(arg_0, OrderedDict):
            arg_2 = OrderedDict((val, arg_3) for arg_3, val in arg_0.items())
        else:
            arg_2 = {val: arg_3 for arg_3, val in arg_0.items()}
    else:
        # Handle non-unique keys using groups
        arg_2 = defaultdict(set)
        for arg_3, arg_4 in arg_0.items():
            arg_2[arg_4].add(arg_3)
        arg_2 = dict(arg_2)
    return arg_2

r"""
    Swaps the keys and values in a dictionary.

    Args:
        dict_ (dict): dictionary to invert
        unique_vals (bool): if False, inverted keys are returned in a set.
            The default is True.

    Returns:
        dict: inverted

    Notes:
        The must values be hashable.

        If the original dictionary contains duplicate values, then only one of
        the corresponding keys will be returned and the others will be
        discarded.  This can be prevented by setting `unique_vals=True`,
        causing the inverted keys to be returned in a set.

    CommandLine:
        python -m ubelt.util_dict invert_dict

    Example:
        >>> import ubelt as ub
        >>> dict_ = {'a': 1, 'b': 2}
        >>> inverted = ub.invert_dict(dict_)
        >>> assert inverted == {1: 'a', 2: 'b'}

    Example:
        >>> import ubelt as ub
        >>> dict_ = ub.odict([(2, 'a'), (1, 'b'), (0, 'c'), (None, 'd')])
        >>> inverted = ub.invert_dict(dict_)
        >>> assert list(inverted.keys())[0] == 'a'

    Example:
        >>> import ubelt as ub
        >>> dict_ = {'a': 1, 'b': 0, 'c': 0, 'd': 0, 'f': 2}
        >>> inverted = ub.invert_dict(dict_, unique_vals=False)
        >>> assert inverted == {0: {'b', 'c', 'd'}, 1: {'a'}, 2: {'f'}}

r Swaps the keys and values in a dictionary .


def Func(arg_0, arg_1=None):
    """ Change the current layer by specifying the new layer number.

    Args:
        script: the mlx.FilterScript object or script filename to write
            the filter to.
        layer_num (int): the number of the layer to Func to. Default is the
            last layer if script is a mlx.FilterScript object; if script is a
            filename the default is the first layer.

    Layer stack:
        Modifies current layer

    MeshLab versions:
        2016.12
        1.3.4BETA
    """
    if arg_1 is None:
        if isinstance(arg_0, mlx.FilterScript):
            arg_1 = arg_0.last_layer()
        else:
            arg_1 = 0
    arg_2 = ''.join([
        '  <filter name="Change the current layer">\n',
        '    <Param name="mesh" ',
        'value="{:d}" '.format(arg_1),
        'description="Mesh" ',
        'type="RichMesh" ',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(arg_0, arg_2)
    if isinstance(arg_0, mlx.FilterScript):
        arg_0.set_current_layer(arg_1)
        #script.layer_stack[len(self.layer_stack) - 1] = layer_num
    return None

Change the current layer by specifying the new layer number.

    Args:
        script: the mlx.FilterScript object or script filename to write
            the filter to.
        layer_num (int): the number of the layer to change to. Default is the
            last layer if script is a mlx.FilterScript object; if script is a
            filename the default is the first layer.

    Layer stack:
        Modifies current layer

    MeshLab versions:
        2016.12
        1.3.4BETA

Change the current layer by specifying the new layer number .


def Func ( arg_0 ) : if arg_0 . options . get ( 'user_options' , None ) : arg_0 . core . apply_shorthand_options ( arg_0 . options [ 'user_options' ] )

def Func(arg_0):
        """ override config options with user specified options"""
        if arg_0.options.get('user_options', None):
            arg_0.core.apply_shorthand_options(arg_0.options['user_options'])


def Func ( arg_0 , arg_1 ) : if not isinstance ( arg_1 , dict ) : return arg_1 arg_2 = deepcopy ( arg_0 ) for arg_3 , arg_4 in arg_1 . iteritems ( ) : if arg_3 in arg_2 and isinstance ( arg_2 [ arg_3 ] , dict ) : arg_2 [ arg_3 ] = Func ( arg_2 [ arg_3 ] , arg_4 ) else : arg_2 [ arg_3 ] = deepcopy ( arg_4 ) return arg_2

def Func(arg_0, arg_1):
    """
    Recursive dict merge.

    Recursively merges dict's. not just simple lft['key'] = rgt['key'], if
    both lft and rgt have a key who's value is a dict then Func is
    called on both values and the result stored in the returned dictionary.
    """
    if not isinstance(arg_1, dict):
        return arg_1
    arg_2 = deepcopy(arg_0)
    for arg_3, arg_4 in arg_1.iteritems():
        if arg_3 in arg_2 and isinstance(arg_2[arg_3], dict):
            arg_2[arg_3] = Func(arg_2[arg_3], arg_4)
        else:
            arg_2[arg_3] = deepcopy(arg_4)
    return arg_2

Recursive dict merge.

    Recursively merges dict's. not just simple lft['key'] = rgt['key'], if
    both lft and rgt have a key who's value is a dict then dict_merge is
    called on both values and the result stored in the returned dictionary.


def Func ( arg_0 , arg_1 ) : assert all ( arg_2 . numRecords > arg_1 for arg_2 in arg_0 . fields ) arg_3 = np . concatenate ( [ arg_2 . encoder . encode ( SENTINEL_VALUE_FOR_MISSING_DATA ) if arg_2 . isPredictedField else arg_2 . encodings [ arg_1 ] for arg_2 in arg_0 . fields ] ) return arg_3

def Func(arg_0, arg_1):
    """Returns the nth encoding with the predictedField zeroed out"""

    assert all(arg_2.numRecords>arg_1 for arg_2 in arg_0.fields)

    arg_3 = np.concatenate([arg_2.encoder.encode(SENTINEL_VALUE_FOR_MISSING_DATA)\
        if arg_2.isPredictedField else arg_2.encodings[arg_1] for arg_2 in arg_0.fields])

    return arg_3


def Func ( arg_0 ) : arg_1 = [ ] def append_parent_if_dataset ( arg_2 , arg_3 ) : if isinstance ( arg_3 , h5py . Dataset ) : if arg_2 . split ( '/' ) [ - 1 ] == 'data' : arg_1 . append ( arg_3 . parent ) arg_4 = [ ] arg_0 . visititems ( append_parent_if_dataset ) for arg_5 in arg_1 : arg_4 . append ( hdfgroup_to_nifti1image ( arg_5 ) ) return arg_4

def Func(arg_0):
    """Returns in a list all images found under h5group.

    Parameters
    ----------
    h5group: h5py.Group
        HDF group

    Returns
    -------
    list of nifti1Image
    """
    arg_1 = []
    def append_parent_if_dataset(arg_2, arg_3):
        if isinstance(arg_3, h5py.Dataset):
            if arg_2.split('/')[-1] == 'data':
                arg_1.append(arg_3.parent)

    arg_4 = []
    arg_0.visititems(append_parent_if_dataset)
    for arg_5 in arg_1:
        arg_4.append(hdfgroup_to_nifti1image(arg_5))

    return arg_4

Returns in a list all images found under h5group .


def Func ( arg_0 , arg_1 , arg_2 = 0.9 ) : if arg_1 . marginal_inverse_cdf == "delta" : return np . array ( [ arg_1 . numdate , arg_1 . numdate ] ) arg_3 = ( arg_1 . marginal_pos_LH . xmin , arg_1 . marginal_pos_LH . xmax ) arg_4 , arg_5 = [ arg_0 . date2dist . to_numdate ( arg_11 ) for arg_11 in arg_3 ] [ : : - 1 ] if arg_1 . marginal_pos_LH . peak_pos == arg_3 [ 0 ] : return arg_0 . get_confidence_interval ( arg_1 , ( 0 , arg_2 ) ) elif arg_1 . marginal_pos_LH . peak_pos == arg_3 [ 1 ] : return arg_0 . get_confidence_interval ( arg_1 , ( 1.0 - arg_2 , 1.0 ) ) else : arg_6 = arg_0 . date_uncertainty_due_to_rate ( arg_1 , ( ( 1 - arg_2 ) * 0.5 , 1.0 - ( 1.0 - arg_2 ) * 0.5 ) ) from scipy . interpolate import interp1d from scipy . optimize import minimize_scalar as minimize arg_7 = np . argmin ( arg_1 . marginal_pos_LH . y ) arg_8 = np . min ( arg_1 . marginal_pos_LH . y ) arg_9 = interp1d ( arg_1 . marginal_pos_LH . y [ : ( arg_7 + 1 ) ] - arg_8 , arg_1 . marginal_pos_LH . x [ : ( arg_7 + 1 ) ] , kind = 'linear' , fill_value = arg_3 [ 0 ] , bounds_error = False ) arg_10 = interp1d ( arg_1 . marginal_pos_LH . y [ arg_7 : ] - arg_8 , arg_1 . marginal_pos_LH . x [ arg_7 : ] , kind = 'linear' , fill_value = arg_3 [ 1 ] , bounds_error = False ) def func ( arg_11 , arg_12 ) : arg_13 = np . array ( [ arg_9 ( arg_11 ) , arg_10 ( arg_11 ) ] ) . squeeze ( ) return ( arg_12 - np . diff ( arg_1 . marginal_cdf ( np . array ( arg_13 ) ) ) ) ** 2 arg_14 = minimize ( func , bracket = [ 0 , 10 ] , args = ( arg_2 , ) ) if arg_14 [ 'success' ] : arg_15 = arg_0 . date2dist . to_numdate ( np . array ( [ arg_10 ( arg_14 [ 'x' ] ) , arg_9 ( arg_14 [ 'x' ] ) ] ) . squeeze ( ) ) else : arg_15 = None return arg_0 . combine_confidence ( arg_1 . numdate , ( arg_4 , arg_5 ) , c1 = arg_6 , c2 = arg_15 )

def Func(arg_0, arg_1, arg_2 = 0.9):
        '''
        If temporal reconstruction was done using the marginal ML mode, the entire distribution of
        times is available. This function determines the interval around the highest
        posterior probability region that contains the specified fraction of the probability mass.
        In absense of marginal reconstruction, it will return uncertainty based on rate
        variation. If both are present, the wider interval will be returned.

        Parameters
        ----------

         node : PhyloTree.Clade
            The node for which the posterior region is to be calculated

         interval : float
            Float specifying who much of the posterior probability is
            to be contained in the region

        Returns
        -------
         max_posterior_region : numpy array
            Array with two numerical dates delineating the high posterior region

        '''
        if arg_1.marginal_inverse_cdf=="delta":
            return np.array([arg_1.numdate, arg_1.numdate])

        arg_3 = (arg_1.marginal_pos_LH.xmin, arg_1.marginal_pos_LH.xmax)
        arg_4, arg_5 = [arg_0.date2dist.to_numdate(arg_11) for arg_11 in arg_3][::-1]
        if arg_1.marginal_pos_LH.peak_pos == arg_3[0]: #peak on the left
            return arg_0.get_confidence_interval(arg_1, (0, arg_2))
        elif arg_1.marginal_pos_LH.peak_pos == arg_3[1]: #peak on the right
            return arg_0.get_confidence_interval(arg_1, (1.0-arg_2 ,1.0))
        else: # peak in the center of the distribution
            arg_6 = arg_0.date_uncertainty_due_to_rate(arg_1, ((1-arg_2)*0.5, 1.0-(1.0-arg_2)*0.5))

            # construct height to position interpolators left and right of the peak
            # this assumes there is only one peak --- might fail in odd cases
            from scipy.interpolate import interp1d
            from scipy.optimize import minimize_scalar as minimize
            arg_7 = np.argmin(arg_1.marginal_pos_LH.y)
            arg_8 = np.min(arg_1.marginal_pos_LH.y)
            arg_9 =  interp1d(arg_1.marginal_pos_LH.y[:(arg_7+1)]-arg_8, arg_1.marginal_pos_LH.x[:(arg_7+1)],
                            kind='linear', fill_value=arg_3[0], bounds_error=False)
            arg_10 = interp1d(arg_1.marginal_pos_LH.y[arg_7:]-arg_8, arg_1.marginal_pos_LH.x[arg_7:],
                            kind='linear', fill_value=arg_3[1], bounds_error=False)

            # function to minimize -- squared difference between prob mass and desired fracion
            def func(arg_11, arg_12):
                arg_13 = np.array([arg_9(arg_11), arg_10(arg_11)]).squeeze()
                return (arg_12 - np.diff(arg_1.marginal_cdf(np.array(arg_13))))**2

            # minimza and determine success
            arg_14 = minimize(func, bracket=[0,10], args=(arg_2,))
            if arg_14['success']:
                arg_15 = arg_0.date2dist.to_numdate(np.array([arg_10(arg_14['x']), arg_9(arg_14['x'])]).squeeze())
            else: # on failure, return standard confidence interval
                arg_15 = None

            return arg_0.combine_confidence(arg_1.numdate, (arg_4, arg_5),
                                      c1=arg_6, c2=arg_15)

If temporal reconstruction was done using the marginal ML mode the entire distribution of times is available . This function determines the interval around the highest posterior probability region that contains the specified fraction of the probability mass . In absense of marginal reconstruction it will return uncertainty based on rate variation . If both are present the wider interval will be returned .


def Func ( arg_0 , arg_1 ) : arg_2 = Template ( arg_0 ) . render ( Context ( arg_1 ) ) return arg_2

def Func(arg_0, arg_1):
    """ renders context aware template """
    arg_2 = Template(arg_0).render(Context(arg_1))
    return arg_2


def Func ( arg_0 , arg_1 , arg_2 = 0 ) : def arg_6 ( arg_3 ) : if isinstance ( arg_3 , torch . Tensor ) : return OrigScatter . apply ( arg_1 , None , arg_2 , arg_3 ) if isinstance ( arg_3 , DataContainer ) : if arg_3 . cpu_only : return arg_3 . data else : return Scatter . forward ( arg_1 , arg_3 . data ) if isinstance ( arg_3 , tuple ) and len ( arg_3 ) > 0 : return list ( zip ( * map ( arg_6 , arg_3 ) ) ) if isinstance ( arg_3 , list ) and len ( arg_3 ) > 0 : arg_4 = list ( map ( list , zip ( * map ( arg_6 , arg_3 ) ) ) ) return arg_4 if isinstance ( arg_3 , dict ) and len ( arg_3 ) > 0 : arg_4 = list ( map ( type ( arg_3 ) , zip ( * map ( arg_6 , arg_3 . items ( ) ) ) ) ) return arg_4 return [ arg_3 for arg_5 in arg_1 ] try : return arg_6 ( arg_0 ) finally : arg_6 = None

def Func(arg_0, arg_1, arg_2=0):
    """Scatter inputs to target gpus.

    The only difference from original :func:`Func` is to add support for
    :type:`~mmcv.parallel.DataContainer`.
    """

    def arg_6(arg_3):
        if isinstance(arg_3, torch.Tensor):
            return OrigScatter.apply(arg_1, None, arg_2, arg_3)
        if isinstance(arg_3, DataContainer):
            if arg_3.cpu_only:
                return arg_3.data
            else:
                return Scatter.forward(arg_1, arg_3.data)
        if isinstance(arg_3, tuple) and len(arg_3) > 0:
            return list(zip(*map(arg_6, arg_3)))
        if isinstance(arg_3, list) and len(arg_3) > 0:
            arg_4 = list(map(list, zip(*map(arg_6, arg_3))))
            return arg_4
        if isinstance(arg_3, dict) and len(arg_3) > 0:
            arg_4 = list(map(type(arg_3), zip(*map(arg_6, arg_3.items()))))
            return arg_4
        return [arg_3 for arg_5 in arg_1]

    # After Func_map is called, a Func_map cell will exist. This cell
    # has a reference to the actual function Func_map, which has references
    # to a closure that has a reference to the Func_map cell (because the
    # fn is recursive). To avoid this reference cycle, we set the function to
    # None, clearing the cell
    try:
        return arg_6(arg_0)
    finally:
        arg_6 = None

Scatter inputs to target gpus.

    The only difference from original :func:`scatter` is to add support for
    :type:`~mmcv.parallel.DataContainer`.


def Func ( arg_0 , arg_1 = False ) : if arg_0 == np . random and not arg_1 : return arg_0 else : arg_2 = dummy_random_state ( ) arg_3 = arg_0 . get_state ( ) arg_2 . set_state ( arg_3 ) return arg_2

def Func(arg_0, arg_1=False):
    """
    Creates a copy of a random state.

    Parameters
    ----------
    random_state : numpy.random.RandomState
        The random state to copy.

    force_copy : bool, optional
        If True, this function will always create a copy of every random
        state. If False, it will not copy numpy's default random state,
        but all other random states.

    Returns
    -------
    rs_copy : numpy.random.RandomState
        The copied random state.

    """
    if arg_0 == np.random and not arg_1:
        return arg_0
    else:
        arg_2 = dummy_random_state()
        arg_3 = arg_0.get_state()
        arg_2.set_state(arg_3)
        return arg_2


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . remote_utils . get_url ( arg_0 . url ( ) + "{}/info/" . format ( arg_1 ) ) return arg_2 . json ( )

def Func(arg_0, arg_1):
        """
        Return the project info for a given token.

        Arguments:
            token (str): Token to return information for

        Returns:
            JSON: representation of proj_info
        """
        arg_2 = arg_0.remote_utils.get_url(arg_0.url() + "{}/info/".format(arg_1))
        return arg_2.json()

Return the project info for a given token .


def Func(arg_0):
    """Validates the input to state visualization functions.

    Args:
        quantum_state (ndarray): Input state / density matrix.
    Returns:
        rho: A 2d numpy array for the density matrix.
    Raises:
        VisualizationError: Invalid input.
    """
    arg_1 = np.asarray(arg_0)
    if arg_1.ndim == 1:
        arg_1 = np.outer(arg_1, np.conj(arg_1))
    # Check the shape of the input is a square matrix
    arg_2 = np.shape(arg_1)
    if len(arg_2) != 2 or arg_2[0] != arg_2[1]:
        raise VisualizationError("Input is not a valid quantum state.")
    # Check state is an n-qubit state
    arg_3 = int(np.log2(arg_1.shape[0]))
    if 2 ** arg_3 != arg_1.shape[0]:
        raise VisualizationError("Input is not a multi-qubit quantum state.")
    return arg_1

Validates the input to state visualization functions .


(self, service_name, deployment_name, role_name,
                     post_capture_action, target_image_name,
                     target_image_label, provisioning_configuration=None)

return self._perform_post(
            self._get_role_instance_operations_path(
                service_name, deployment_name, role_name),
            _XmlSerializer.capture_role_to_xml(
                post_capture_action,
                target_image_name,
                target_image_label,
                provisioning_configuration),
            as_async=True)

def Func(arg_0, arg_1, arg_2, arg_3,
                     arg_4, arg_5,
                     arg_6, arg_7=None):
        '''
        The Capture Role operation captures a virtual machine image to your
        image gallery. From the captured image, you can create additional
        customized virtual machines.

        service_name:
            The name of the service.
        deployment_name:
            The name of the deployment.
        role_name:
            The name of the role.
        post_capture_action:
            Specifies the action after capture operation completes. Possible
            values are: Delete, Reprovision.
        target_image_name:
            Specifies the image name of the captured virtual machine.
        target_image_label:
            Specifies the friendly name of the captured virtual machine.
        provisioning_configuration:
            Use an instance of WindowsConfigurationSet or LinuxConfigurationSet.
        '''
        _validate_not_none('service_name', arg_1)
        _validate_not_none('deployment_name', arg_2)
        _validate_not_none('role_name', arg_3)
        _validate_not_none('post_capture_action', arg_4)
        _validate_not_none('target_image_name', arg_5)
        _validate_not_none('target_image_label', arg_6)
        return arg_0._perform_post(
            arg_0._get_role_instance_operations_path(
                arg_1, arg_2, arg_3),
            _XmlSerializer.Func_to_xml(
                arg_4,
                arg_5,
                arg_6,
                arg_7),
            as_async=True)

The Capture Role operation captures a virtual machine image to your image gallery . From the captured image you can create additional customized virtual machines .


def Func(arg_0, arg_1, arg_2):
  """Helper utility to make a field of images."""
  arg_3 = tf.shape(input=arg_0)
  arg_4 = arg_3[-3]
  arg_5 = arg_3[-2]
  arg_6 = arg_3[-1]
  arg_0 = tf.reshape(arg_0, (-1, arg_4, arg_5, arg_6))
  arg_7 = tf.shape(input=arg_0)[0]
  arg_1 = tf.minimum(arg_1, arg_7)
  arg_2 = tf.minimum(arg_7 // arg_1, arg_2)
  arg_0 = arg_0[:arg_1 * arg_2]
  arg_0 = tf.reshape(arg_0, (arg_1, arg_2, arg_4, arg_5, arg_6))
  arg_0 = tf.transpose(a=arg_0, perm=[0, 2, 1, 3, 4])
  arg_0 = tf.reshape(arg_0, [1, arg_1 * arg_4, arg_2 * arg_5, arg_6])
  return arg_0

Helper utility to make a field of images .


def
Func
(
arg_0
,
arg_1
)
:
if
arg_0
.
v_locked
:
raise
pex
.
ParameterLockedException
(
'Parameter `%s` is locked!'
%
arg_0
.
v_full_name
)
try
:
arg_2
=
arg_1
[
'data%sis_dia'
%
SparseParameter
.
IDENTIFIER
]
arg_3
=
arg_0
.
_get_name_list
(
arg_2
)
arg_4
=
[
'data%s%s'
%
(
SparseParameter
.
IDENTIFIER
,
name
)
for
name
in
arg_3
]
arg_5
=
[
arg_1
[
name
]
for
name
in
arg_4
]
arg_0
.
_data
=
arg_0
.
_reconstruct_matrix
(
arg_5
)
if
'explored_data'
+
SparseParameter
.
IDENTIFIER
in
arg_1
:
arg_7
=
arg_1
[
'explored_data'
+
SparseParameter
.
IDENTIFIER
]
arg_8
=
arg_7
[
'idx'
]
arg_9
=
arg_7
[
'is_dia'
]
arg_10
=
[
]
for
arg_11
,
arg_12
in
enumerate
(
arg_8
)
:
arg_2
=
arg_9
[
arg_11
]
try
:
arg_3
=
arg_0
.
_build_names
(
arg_12
,
arg_2
)
arg_5
=
[
arg_1
[
name
]
for
name
in
arg_3
]
except
KeyError
:
arg_3
=
arg_0
.
_build_names_old
(
arg_12
,
arg_2
)
arg_5
=
[
arg_1
[
name
]
for
name
in
arg_3
]
arg_13
=
arg_0
.
_reconstruct_matrix
(
arg_5
)
arg_10
.
append
(
arg_13
)
arg_0
.
_explored_range
=
arg_10
arg_0
.
_explored
=
True
except
KeyError
:
super
(
SparseParameter
,
arg_0
)
.
Func
(
arg_1
)
arg_0
.
_default
=
arg_0
.
_data
arg_0
.
_locked
=
True

def Func(arg_0, arg_1):
        """Reconstructs the data and exploration array

        Checks if it can find the array identifier in the `load_dict`, i.e. '__spsp__'.
        If not, calls :class:`~pypet.parameter.ArrayParameter.Func` of the parent class.

        If the parameter is explored, the exploration range of matrices is reconstructed
        as it was stored in :func:`~pypet.parameter.SparseParameter._store`.

        """
        if arg_0.v_locked:
            raise pex.ParameterLockedException('Parameter `%s` is locked!' % arg_0.v_full_name)

        try:
            arg_2 = arg_1['data%sis_dia' % SparseParameter.IDENTIFIER]

            arg_3 = arg_0._get_name_list(arg_2)
            arg_4 = ['data%s%s' % (SparseParameter.IDENTIFIER, name)
                           for name in arg_3]

            arg_5 = [arg_1[name] for name in arg_4]
            arg_0._data = arg_0._reconstruct_matrix(arg_5)

            if 'explored_data' + SparseParameter.IDENTIFIER in arg_1:
                arg_7 = arg_1['explored_data' + SparseParameter.IDENTIFIER]

                arg_8 = arg_7['idx']
                arg_9 = arg_7['is_dia']

                arg_10 = []
                for arg_11, arg_12 in enumerate(arg_8):
                    arg_2 = arg_9[arg_11]

                    # To make everything work with the old format we have the try catch block
                    try:
                        arg_3 = arg_0._build_names(arg_12, arg_2)
                        arg_5 = [arg_1[name] for name in arg_3]
                    except KeyError:
                        arg_3 = arg_0._build_names_old(arg_12, arg_2)
                        arg_5 = [arg_1[name] for name in arg_3]

                    arg_13 = arg_0._reconstruct_matrix(arg_5)
                    arg_10.append(arg_13)

                arg_0._explored_range = arg_10
                arg_0._explored = True

        except KeyError:
            super(SparseParameter, arg_0).Func(arg_1)

        arg_0._default = arg_0._data
        arg_0._locked = True

Reconstructs the data and exploration array

        Checks if it can find the array identifier in the `load_dict`, i.e. '__spsp__'.
        If not, calls :class:`~pypet.parameter.ArrayParameter._load` of the parent class.

        If the parameter is explored, the exploration range of matrices is reconstructed
        as it was stored in :func:`~pypet.parameter.SparseParameter._store`.


return cls, "_".join(part.upper() for part in parts)

def Func ( arg_0 ) : arg_1 = groupByUpperCase ( arg_0 . __name__ ) return arg_0 , "_" . join ( arg_2 . upper ( ) for arg_2 in arg_1 )

def Func(arg_0):
        """
        Returns the exception's name in an AMP Command friendly format.

        For example, given a class named ``ExampleExceptionClass``, returns
        ``"EXAMPLE_EXCEPTION_CLASS"``.
        """
        arg_1 = groupByUpperCase(arg_0.__name__)
        return arg_0, "_".join(arg_2.upper() for arg_2 in arg_1)

Returns the exception s name in an AMP Command friendly format .


return tf.while_loop(
      cond=_loop_cond, body=_loop_body, loop_vars=[initial_args])[0]

def Func ( arg_0 , arg_1 , arg_2 ) : def _loop_cond ( arg_3 ) : return ~ tf . reduce_all ( input_tensor = arg_3 . stopped ) def _loop_body ( arg_3 ) : arg_4 = arg_0 ( ( arg_3 . left . x + arg_3 . right . x ) / 2 ) arg_5 = ( arg_3 . failed | ~ is_finite ( arg_4 ) | tf . equal ( arg_4 . x , arg_3 . left . x ) | tf . equal ( arg_4 . x , arg_3 . right . x ) ) arg_6 = ~ ( arg_3 . stopped | arg_5 ) arg_7 = ( arg_4 . df < 0 ) & ( arg_4 . f <= arg_2 ) arg_8 = val_where ( arg_6 & arg_7 , arg_4 , arg_3 . left ) arg_9 = val_where ( arg_6 & ~ arg_7 , arg_4 , arg_3 . right ) arg_10 = arg_3 . stopped | arg_5 | ( arg_9 . df >= 0 ) return [ _IntermediateResult ( iteration = arg_3 . iteration , arg_10 = arg_10 , arg_5 = arg_5 , num_evals = arg_3 . num_evals + 1 , arg_8 = arg_8 , arg_9 = arg_9 ) ] return tf . while_loop ( cond = _loop_cond , body = _loop_body , loop_vars = [ arg_1 ] ) [ 0 ]

def Func(arg_0, arg_1, arg_2):
  """Actual implementation of bisect given initial_args in a _BracketResult."""
  def _loop_cond(arg_3):
    # TODO(b/112524024): Also take into account max_iterations.
    return ~tf.reduce_all(input_tensor=arg_3.stopped)

  def _loop_body(arg_3):
    """Narrow down interval to satisfy opposite slope conditions."""
    arg_4 = arg_0((arg_3.left.x + arg_3.right.x) / 2)

    # Fail if function values at mid point are no longer finite; or left/right
    # points are so close to it that we can't distinguish them any more.
    arg_5 = (arg_3.failed | ~is_finite(arg_4) |
              tf.equal(arg_4.x, arg_3.left.x) | tf.equal(arg_4.x, arg_3.right.x))

    # If mid point has a negative slope and the function value at that point is
    # small enough, we can use it as a new left end point to narrow down the
    # interval. If mid point has a positive slope, then we have found a suitable
    # right end point to bracket a minima within opposite slopes. Otherwise, the
    # mid point has a negative slope but the function value at that point is too
    # high to work as left end point, we are in the same situation in which we
    # started the loop so we just update the right end point and continue.
    arg_6 = ~(arg_3.stopped | arg_5)
    arg_7 = (arg_4.df < 0) & (arg_4.f <= arg_2)
    arg_8 = val_where(arg_6 & arg_7, arg_4, arg_3.left)
    arg_9 = val_where(arg_6 & ~arg_7, arg_4, arg_3.right)

    # We're done when the right end point has a positive slope.
    arg_10 = arg_3.stopped | arg_5 | (arg_9.df >= 0)

    return [_IntermediateResult(
        iteration=arg_3.iteration,
        arg_10=arg_10,
        arg_5=arg_5,
        num_evals=arg_3.num_evals + 1,
        arg_8=arg_8,
        arg_9=arg_9)]

  # The interval needs updating if the right end point has a negative slope and
  # the value of the function at that point is too high. It is not a valid left
  # end point but along with the current left end point, it encloses another
  # minima. The loop above tries to narrow the interval so that it satisfies the
  # opposite slope conditions.
  return tf.while_loop(
      cond=_loop_cond, body=_loop_body, loop_vars=[arg_1])[0]

Actual implementation of bisect given initial_args in a _BracketResult .


(x, pre_max, post_max, pre_avg, post_avg, delta, wait)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_6
)
:
if
arg_1
<
0
:
raise
ParameterError
(
'pre_max must be non-negative'
)
if
arg_3
<
0
:
raise
ParameterError
(
'pre_avg must be non-negative'
)
if
arg_5
<
0
:
raise
ParameterError
(
'delta must be non-negative'
)
if
arg_6
<
0
:
raise
ParameterError
(
'wait must be non-negative'
)
if
arg_2
<=
0
:
raise
ParameterError
(
'post_max must be positive'
)
if
arg_4
<=
0
:
raise
ParameterError
(
'post_avg must be positive'
)
if
arg_0
.
ndim
!=
1
:
raise
ParameterError
(
'input array must be one-dimensional'
)
arg_1
=
valid_int
(
arg_1
,
cast
=
np
.
ceil
)
arg_2
=
valid_int
(
arg_2
,
cast
=
np
.
ceil
)
arg_3
=
valid_int
(
arg_3
,
cast
=
np
.
ceil
)
arg_4
=
valid_int
(
arg_4
,
cast
=
np
.
ceil
)
arg_6
=
valid_int
(
arg_6
,
cast
=
np
.
ceil
)
arg_7
=
arg_1
+
arg_2
arg_8
=
np
.
ceil
(
0.5
*
(
arg_1
arg_2
)
)
arg_9
=
scipy
.
ndimage
.
filters
.
maximum_filter1d
(
arg_0
,
int
(
arg_7
)
,
mode
=
'constant'
,
origin
=
int
(
arg_8
)
,
cval
=
arg_0
.
min
(
)
)
arg_10
=
arg_3
+
arg_4
arg_11
=
np
.
ceil
(
0.5
*
(
arg_3
arg_4
)
)
arg_12
=
scipy
.
ndimage
.
filters
.
uniform_filter1d
(
arg_0
,
int
(
arg_10
)
,
mode
=
'nearest'
,
origin
=
int
(
arg_11
)
)
arg_13
=
0
while
arg_13
arg_3
<
0
and
arg_13
<
arg_0
.
shape
[
0
]
:
arg_14
=
arg_13
arg_3
arg_14
=
arg_14
if
arg_14
>
0
else
0
arg_12
[
arg_13
]
=
np
.
mean
(
arg_0
[
arg_14
:
arg_13
+
arg_4
]
)
arg_13
+=
1
arg_13
=
arg_0
.
shape
[
0
]
arg_4
arg_13
=
arg_13
if
arg_13
>
0
else
0
while
arg_13
<
arg_0
.
shape
[
0
]
:
arg_14
=
arg_13
arg_3
arg_14
=
arg_14
if
arg_14
>
0
else
0
arg_12
[
arg_13
]
=
np
.
mean
(
arg_0
[
arg_14
:
arg_13
+
arg_4
]
)
arg_13
+=
1
arg_15
=
arg_0
*
(
arg_0
==
arg_9
)
arg_15
=
arg_15
*
(
arg_15
>=
(
arg_12
+
arg_5
)
)
arg_16
=
[
]
arg_17
=
np
.
inf
for
arg_18
in
np
.
nonzero
(
arg_15
)
[
0
]
:
if
arg_18
>
arg_17
+
arg_6
:
arg_16
.
append
(
arg_18
)
arg_17
=
arg_18
return
np
.
array
(
arg_16
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):
    '''Uses a flexible heuristic to pick peaks in a signal.

    A sample n is selected as an peak if the corresponding x[n]
    fulfills the following three conditions:

    1. `x[n] == max(x[n - pre_max:n + post_max])`
    2. `x[n] >= mean(x[n - pre_avg:n + post_avg]) + delta`
    3. `n - previous_n > wait`

    where `previous_n` is the last sample picked as a peak (greedily).

    This implementation is based on [1]_ and [2]_.

    .. [1] Boeck, Sebastian, Florian Krebs, and Markus Schedl.
        "Evaluating the Online Capabilities of Onset Detection Methods." ISMIR.
        2012.

    .. [2] https://github.com/CPJKU/onset_detection/blob/master/onset_program.py

    Parameters
    ----------
    x         : np.ndarray [shape=(n,)]
        input signal to peak picks from

    pre_max   : int >= 0 [scalar]
        number of samples before `n` over which max is computed

    post_max  : int >= 1 [scalar]
        number of samples after `n` over which max is computed

    pre_avg   : int >= 0 [scalar]
        number of samples before `n` over which mean is computed

    post_avg  : int >= 1 [scalar]
        number of samples after `n` over which mean is computed

    delta     : float >= 0 [scalar]
        threshold offset for mean

    wait      : int >= 0 [scalar]
        number of samples to wait after picking a peak

    Returns
    -------
    peaks     : np.ndarray [shape=(n_peaks,), dtype=int]
        indices of peaks in `x`

    Raises
    ------
    ParameterError
        If any input lies outside its defined range

    Examples
    --------
    >>> y, sr = librosa.load(librosa.util.example_audio_file(), duration=15)
    >>> onset_env = librosa.onset.onset_strength(y=y, sr=sr,
    ...                                          hop_length=512,
    ...                                          aggregate=np.median)
    >>> peaks = librosa.util.Func(onset_env, 3, 3, 3, 5, 0.5, 10)
    >>> peaks
    array([  4,  23,  73, 102, 142, 162, 182, 211, 261, 301, 320,
           331, 348, 368, 382, 396, 411, 431, 446, 461, 476, 491,
           510, 525, 536, 555, 570, 590, 609, 625, 639])

    >>> import matplotlib.pyplot as plt
    >>> times = librosa.frames_to_time(np.arange(len(onset_env)),
    ...                                sr=sr, hop_length=512)
    >>> plt.figure()
    >>> ax = plt.subplot(2, 1, 2)
    >>> D = librosa.stft(y)
    >>> librosa.display.specshow(librosa.amplitude_to_db(D, ref=np.max),
    ...                          y_axis='log', x_axis='time')
    >>> plt.subplot(2, 1, 1, sharex=ax)
    >>> plt.plot(times, onset_env, alpha=0.8, label='Onset strength')
    >>> plt.vlines(times[peaks], 0,
    ...            onset_env.max(), color='r', alpha=0.8,
    ...            label='Selected peaks')
    >>> plt.legend(frameon=True, framealpha=0.8)
    >>> plt.axis('tight')
    >>> plt.tight_layout()
    '''

    if arg_1 < 0:
        raise ParameterError('pre_max must be non-negative')
    if arg_3 < 0:
        raise ParameterError('pre_avg must be non-negative')
    if arg_5 < 0:
        raise ParameterError('delta must be non-negative')
    if arg_6 < 0:
        raise ParameterError('wait must be non-negative')

    if arg_2 <= 0:
        raise ParameterError('post_max must be positive')

    if arg_4 <= 0:
        raise ParameterError('post_avg must be positive')

    if arg_0.ndim != 1:
        raise ParameterError('input array must be one-dimensional')

    # Ensure valid index types
    arg_1 = valid_int(arg_1, cast=np.ceil)
    arg_2 = valid_int(arg_2, cast=np.ceil)
    arg_3 = valid_int(arg_3, cast=np.ceil)
    arg_4 = valid_int(arg_4, cast=np.ceil)
    arg_6 = valid_int(arg_6, cast=np.ceil)

    # Get the maximum of the signal over a sliding window
    arg_7 = arg_1 + arg_2
    arg_8 = np.ceil(0.5 * (arg_1 - arg_2))
    # Using mode='constant' and cval=x.min() effectively truncates
    # the sliding window at the boundaries
    arg_9 = scipy.ndimage.filters.maximum_filter1d(arg_0, int(arg_7),
                                                     mode='constant',
                                                     origin=int(arg_8),
                                                     cval=arg_0.min())

    # Get the mean of the signal over a sliding window
    arg_10 = arg_3 + arg_4
    arg_11 = np.ceil(0.5 * (arg_3 - arg_4))
    # Here, there is no mode which results in the behavior we want,
    # so we'll correct below.
    arg_12 = scipy.ndimage.filters.uniform_filter1d(arg_0, int(arg_10),
                                                     mode='nearest',
                                                     origin=int(arg_11))

    # Correct sliding average at the beginning
    arg_13 = 0
    # Only need to correct in the range where the window needs to be truncated
    while arg_13 - arg_3 < 0 and arg_13 < arg_0.shape[0]:
        # This just explicitly does mean(x[n - pre_avg:n + post_avg])
        # with truncation
        arg_14 = arg_13 - arg_3
        arg_14 = arg_14 if arg_14 > 0 else 0
        arg_12[arg_13] = np.mean(arg_0[arg_14:arg_13 + arg_4])
        arg_13 += 1
    # Correct sliding average at the end
    arg_13 = arg_0.shape[0] - arg_4
    # When post_avg > x.shape[0] (weird case), reset to 0
    arg_13 = arg_13 if arg_13 > 0 else 0
    while arg_13 < arg_0.shape[0]:
        arg_14 = arg_13 - arg_3
        arg_14 = arg_14 if arg_14 > 0 else 0
        arg_12[arg_13] = np.mean(arg_0[arg_14:arg_13 + arg_4])
        arg_13 += 1

    # First mask out all entries not equal to the local max
    arg_15 = arg_0 * (arg_0 == arg_9)

    # Then mask out all entries less than the thresholded average
    arg_15 = arg_15 * (arg_15 >= (arg_12 + arg_5))

    # Initialize peaks array, to be filled greedily
    arg_16 = []

    # Remove onsets which are close together in time
    arg_17 = -np.inf

    for arg_18 in np.nonzero(arg_15)[0]:
        # Only report an onset if the "wait" samples was reported
        if arg_18 > arg_17 + arg_6:
            arg_16.append(arg_18)
            # Save last reported onset
            arg_17 = arg_18

    return np.array(arg_16)

Uses a flexible heuristic to pick peaks in a signal.

    A sample n is selected as an peak if the corresponding x[n]
    fulfills the following three conditions:

    1. `x[n] == max(x[n - pre_max:n + post_max])`
    2. `x[n] >= mean(x[n - pre_avg:n + post_avg]) + delta`
    3. `n - previous_n > wait`

    where `previous_n` is the last sample picked as a peak (greedily).

    This implementation is based on [1]_ and [2]_.

    .. [1] Boeck, Sebastian, Florian Krebs, and Markus Schedl.
        "Evaluating the Online Capabilities of Onset Detection Methods." ISMIR.
        2012.

    .. [2] https://github.com/CPJKU/onset_detection/blob/master/onset_program.py

    Parameters
    ----------
    x         : np.ndarray [shape=(n,)]
        input signal to peak picks from

    pre_max   : int >= 0 [scalar]
        number of samples before `n` over which max is computed

    post_max  : int >= 1 [scalar]
        number of samples after `n` over which max is computed

    pre_avg   : int >= 0 [scalar]
        number of samples before `n` over which mean is computed

    post_avg  : int >= 1 [scalar]
        number of samples after `n` over which mean is computed

    delta     : float >= 0 [scalar]
        threshold offset for mean

    wait      : int >= 0 [scalar]
        number of samples to wait after picking a peak

    Returns
    -------
    peaks     : np.ndarray [shape=(n_peaks,), dtype=int]
        indices of peaks in `x`

    Raises
    ------
    ParameterError
        If any input lies outside its defined range

    Examples
    --------
    >>> y, sr = librosa.load(librosa.util.example_audio_file(), duration=15)
    >>> onset_env = librosa.onset.onset_strength(y=y, sr=sr,
    ...                                          hop_length=512,
    ...                                          aggregate=np.median)
    >>> peaks = librosa.util.peak_pick(onset_env, 3, 3, 3, 5, 0.5, 10)
    >>> peaks
    array([  4,  23,  73, 102, 142, 162, 182, 211, 261, 301, 320,
           331, 348, 368, 382, 396, 411, 431, 446, 461, 476, 491,
           510, 525, 536, 555, 570, 590, 609, 625, 639])

    >>> import matplotlib.pyplot as plt
    >>> times = librosa.frames_to_time(np.arange(len(onset_env)),
    ...                                sr=sr, hop_length=512)
    >>> plt.figure()
    >>> ax = plt.subplot(2, 1, 2)
    >>> D = librosa.stft(y)
    >>> librosa.display.specshow(librosa.amplitude_to_db(D, ref=np.max),
    ...                          y_axis='log', x_axis='time')
    >>> plt.subplot(2, 1, 1, sharex=ax)
    >>> plt.plot(times, onset_env, alpha=0.8, label='Onset strength')
    >>> plt.vlines(times[peaks], 0,
    ...            onset_env.max(), color='r', alpha=0.8,
    ...            label='Selected peaks')
    >>> plt.legend(frameon=True, framealpha=0.8)
    >>> plt.axis('tight')
    >>> plt.tight_layout()

Uses a flexible heuristic to pick peaks in a signal .


def Func ( ) : arg_0 = f'{PACKAGE_ROOT}/README.md' if path . exists ( arg_0 ) : with open ( arg_0 , 'r' , encoding = 'utf-8' ) as f : arg_1 = f . read ( ) return arg_1

def Func():
    """
    Parse markdown as description
    """
    arg_0 = f'{PACKAGE_ROOT}/README.md'
    if path.exists(arg_0):
        with open(arg_0, 'r', encoding='utf-8') as f:
            arg_1 = f.read()
        return arg_1


def
Func
(
arg_0
,
arg_1
=
'37'
,
arg_2
=
)
:
LOG
.
info
(
"Fetching all genes by alias"
)
arg_3
=
{
}
if
not
arg_2
:
arg_2
=
arg_0
.
hgnc_collection
.
find
(
{
'build'
:
arg_1
}
)
for
arg_4
in
arg_2
:
arg_5
=
arg_4
[
'hgnc_id'
]
arg_6
=
arg_4
[
'hgnc_symbol'
]
for
arg_7
in
arg_4
[
'aliases'
]
:
arg_8
=
if
arg_7
==
arg_6
:
arg_8
=
arg_5
if
arg_7
in
arg_3
:
arg_3
[
arg_7
]
[
'ids'
]
.
add
(
arg_5
)
if
arg_8
:
arg_3
[
arg_7
]
[
'true'
]
=
arg_5
else
:
arg_3
[
arg_7
]
=
{
'true'
:
arg_5
,
'ids'
:
set
(
[
arg_5
]
)
}
return
arg_3

def Func(arg_0, arg_1='37', arg_2=None):
        """Return a dictionary with hgnc symbols as keys and a list of hgnc ids
             as value.

        If a gene symbol is listed as primary the list of ids will only consist
        of that entry if not the gene can not be determined so the result is a list
        of hgnc_ids

        Args:
            build(str)
            genes(iterable(scout.models.HgncGene)):

        Returns:
            alias_genes(dict): {<hgnc_alias>: {'true': <hgnc_id>, 'ids': {<hgnc_id_1>, <hgnc_id_2>, ...}}}
        """
        LOG.info("Fetching all genes by alias")
        # Collect one entry for each alias symbol that exists
        arg_3 = {}
        # Loop over all genes
        if not arg_2:
            arg_2 = arg_0.hgnc_collection.find({'build':arg_1})

        for arg_4 in arg_2:
            # Collect the hgnc_id
            arg_5 = arg_4['hgnc_id']
            # Collect the true symbol given by hgnc
            arg_6 = arg_4['hgnc_symbol']
            # Loop aver all aliases
            for arg_7 in arg_4['aliases']:
                arg_8 = None
                # If the alias is the same as hgnc symbol we know the true id
                if arg_7 == arg_6:
                    arg_8 = arg_5
                # If the alias is already in the list we add the id
                if arg_7 in arg_3:
                    arg_3[arg_7]['ids'].add(arg_5)
                    if arg_8:
                        arg_3[arg_7]['true'] = arg_5
                else:
                    arg_3[arg_7] = {
                        'true': arg_5,
                        'ids': set([arg_5])
                    }

        return arg_3

Return a dictionary with hgnc symbols as keys and a list of hgnc ids as value .


def Func ( ) : if hasattr ( sys , 'real_prefix' ) : return True elif sys . prefix != getattr ( sys , "base_prefix" , sys . prefix ) : return True return False

def Func():
    """
    Return True if we're running inside a virtualenv, False otherwise.

    """
    if hasattr(sys, 'real_prefix'):
        return True
    elif sys.prefix != getattr(sys, "base_prefix", sys.prefix):
        return True

    return False

Return True if we re running inside a virtualenv False otherwise .


def Func ( arg_0 , arg_1 , arg_2 = arg_3 . KMIPVersion . KMIP_1_0 ) : arg_6 = utils . BytearrayStream ( ) if arg_0 . _unique_identifier : arg_0 . _unique_identifier . Func ( arg_6 , arg_2 = arg_2 ) arg_0 . length = arg_6 . length ( ) super ( ArchiveResponsePayload , arg_0 ) . Func ( arg_1 , arg_2 = arg_2 ) arg_1 . Func ( arg_6 . buffer )

def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):
        """
        Write the data encoding the Archive response payload to a stream.

        Args:
            output_stream (stream): A data stream in which to encode object
                data, supporting a Func method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

        Raises:
            ValueError: Raised if the data attribute is not defined.
        """
        arg_6 = utils.BytearrayStream()

        if arg_0._unique_identifier:
            arg_0._unique_identifier.Func(
                arg_6,
                arg_2=arg_2
            )

        arg_0.length = arg_6.length()
        super(ArchiveResponsePayload, arg_0).Func(
            arg_1,
            arg_2=arg_2
        )
        arg_1.Func(arg_6.buffer)

Write the data encoding the Archive response payload to a stream.

        Args:
            output_stream (stream): A data stream in which to encode object
                data, supporting a write method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

        Raises:
            ValueError: Raised if the data attribute is not defined.

Write the data encoding the Archive response payload to a stream .


return isinstance(node, Name) and node.id in self.current_except_names

def Func ( arg_0 , arg_1 ) : return isinstance ( arg_1 , Name ) and arg_1 . id in arg_0 . current_except_names

def Func(arg_0, arg_1):
        """
        Checks if the node is a bare exception name from an except block.

        """
        return isinstance(arg_1, Name) and arg_1.id in arg_0.current_except_names

Checks if the node is a bare exception name from an except block .


def Func(arg_0):
    '''
    Edit to get the dict even when the object is a GenericRelatedObjectManager.
    Added the try except.
    '''
    arg_1 = arg_0.__dict__
    arg_2 = arg_1.copy()
    for arg_3, arg_4 in arg_1.items():
        if arg_3.endswith('_id'):
            arg_5 = arg_3.replace('_id', '')
            try:
                arg_6, arg_7, arg_8, arg_9 = arg_0._meta.get_field_by_name(arg_5)
                if isinstance(arg_6, ForeignKey):
                    arg_2[arg_5] = arg_2[arg_3]
                    del arg_2[arg_3]
            except FieldDoesNotExist:
                pass
    arg_10 = arg_0._meta.many_to_many
    for arg_11 in arg_10:
        arg_12 = [obj_rel.pk for obj_rel in arg_11.value_from_object(arg_0).select_related()]
        if arg_12:
            arg_2[arg_11.name] = arg_12
    return arg_2

Edit to get the dict even when the object is a GenericRelatedObjectManager . Added the try except .


(df, *, column: str, format: str, new_column: str = None)

def Func(arg_0, *, arg_1: arg_2, arg_3: arg_2, arg_4: arg_2 = None):
    """
    Convert datetime column into string column

    ---

    ### Parameters

    *mandatory :*
    - column (*str*): name of the column to format
    - format (*str*): format of the result values (see [available formats](
    https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior))

    *optional :*
    - new_column (*str*): name of the output column. By default `column` is overwritten.
    """
    arg_4 = arg_4 or arg_1
    arg_0[arg_4] = arg_0[arg_1].dt.strftime(arg_3)
    return arg_0


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
try
:
arg_3
=
arg_0
.
transfer_client
.
operation_mkdir
(
arg_1
,
arg_2
)
bot
.
info
(
"%s --> %s"
%
(
arg_3
[
'message'
]
,
arg_2
)
)
except
TransferAPIError
:
bot
.
info
(
'%s already exists at endpoint'
%
arg_2
)

def Func(arg_0, arg_1, arg_2):
    '''create an endpoint folder, catching the error if it exists.

       Parameters
       ==========
       endpoint_id: the endpoint id parameters
       folder: the relative path of the folder to create

    '''
    try:
        arg_3 = arg_0.transfer_client.operation_mkdir(arg_1, arg_2)
        bot.info("%s --> %s" %(arg_3['message'], arg_2))
    except TransferAPIError:
        bot.info('%s already exists at endpoint' %arg_2)

create an endpoint folder catching the error if it exists .


(self, features, threshold=0.0, func=np.sum, get_weights=False)

return above_thresh if get_weights else list(above_thresh.index)

def Func ( arg_0 , arg_1 , arg_2 = 0.0 , arg_3 = arg_4 . sum , arg_6 = False ) : if isinstance ( arg_1 , str ) : arg_1 = [ arg_1 ] arg_1 = arg_0 . search_features ( arg_1 ) arg_7 = arg_0 . data . ix [ : , arg_1 ] arg_8 = arg_7 . apply ( arg_3 , 1 ) arg_9 = arg_8 [ arg_8 >= arg_2 ] return arg_9 if arg_6 else list ( arg_9 . index )

def Func(arg_0, arg_1, arg_2=0.0, arg_3=arg_4.sum, arg_6=False):
        """ Returns a list of all studies in the table that meet the desired
        feature-based criteria.

        Will most commonly be used to retrieve studies that use one or more
        features with some minimum frequency; e.g.,:

            Func(['fear', 'anxiety'], threshold=0.001)

        Args:
            features (lists): a list of feature names to search on.
            threshold (float): optional float indicating threshold features
                must pass to be included.
            func (Callable): any numpy function to use for thresholding
                (default: sum). The function will be applied to the list of
                features and the result compared to the threshold. This can be
                used to change the meaning of the query in powerful ways. E.g,:
                    max: any of the features have to pass threshold
                        (i.e., max > thresh)
                    min: all features must each individually pass threshold
                        (i.e., min > thresh)
                    sum: the summed weight of all features must pass threshold
                        (i.e., sum > thresh)
            get_weights (bool): if True, returns a dict with ids => weights.

        Returns:
            When get_weights is false (default), returns a list of study
                names. When true, returns a dict, with study names as keys
                and feature weights as values.
        """
        if isinstance(arg_1, str):
            arg_1 = [arg_1]
        arg_1 = arg_0.search_features(arg_1)  # Expand wild cards
        arg_7 = arg_0.data.ix[:, arg_1]
        arg_8 = arg_7.apply(arg_3, 1)
        arg_9 = arg_8[arg_8 >= arg_2]
        # ids_to_keep = self.ids[above_thresh]
        return arg_9 if arg_6 else list(arg_9.index)

Returns a list of all studies in the table that meet the desired
        feature-based criteria.

        Will most commonly be used to retrieve studies that use one or more
        features with some minimum frequency; e.g.,:

            get_ids(['fear', 'anxiety'], threshold=0.001)

        Args:
            features (lists): a list of feature names to search on.
            threshold (float): optional float indicating threshold features
                must pass to be included.
            func (Callable): any numpy function to use for thresholding
                (default: sum). The function will be applied to the list of
                features and the result compared to the threshold. This can be
                used to change the meaning of the query in powerful ways. E.g,:
                    max: any of the features have to pass threshold
                        (i.e., max > thresh)
                    min: all features must each individually pass threshold
                        (i.e., min > thresh)
                    sum: the summed weight of all features must pass threshold
                        (i.e., sum > thresh)
            get_weights (bool): if True, returns a dict with ids => weights.

        Returns:
            When get_weights is false (default), returns a list of study
                names. When true, returns a dict, with study names as keys
                and feature weights as values.

Returns a list of all studies in the table that meet the desired feature - based criteria .


def Func(arg_0):
        """
        Disconnect the client from IBM Watson IoT Platform
        """
        # self.logger.info("Closing connection to the IBM Watson IoT Platform")
        arg_0.client.Func()
        # If we don't call loop_stop() it appears we end up with a zombie thread which continues to process
        # network traffic, preventing any subsequent attempt to reconnect using connect()
        arg_0.client.loop_stop()
        arg_0.logger.info("Closed connection to the IBM Watson IoT Platform")


def Func ( arg_0 , arg_1 = 0o777 ) : if not os . path . exists ( arg_0 ) : os . makedirs ( arg_0 , arg_1 = arg_1 )

def Func(arg_0, arg_1=0o777):
    """Safely make a full directory path if it doesn't exist.

    Parameters
    ----------
    dpath : str
        Path of directory/directories to create

    mode : int [default=0777]
        Permissions for the new directories

    See also
    --------
    os.makedirs
    """
    if not os.path.exists(arg_0):
        os.makedirs(arg_0, arg_1=arg_1)

Safely make a full directory path if it doesn t exist .


def Func(arg_0, arg_1):
        """ Reimplemented to temporarily enable highlighting if disabled.
        """
        arg_2 = arg_0.highlighting_on
        arg_0.highlighting_on = True
        super(FrontendHighlighter, arg_0).Func(arg_1)
        arg_0.highlighting_on = arg_2

Reimplemented to temporarily enable highlighting if disabled .


return {"$" + class_name: [self._json_convert(item) for item in obj]}

def Func ( arg_0 , arg_1 , arg_2 = "collections.deque" ) : return { "$" + arg_2 : [ arg_0 . _json_convert ( arg_3 ) for arg_3 in arg_1 ] }

def Func(arg_0, arg_1, arg_2="collections.deque"):
        """
        ``collections.deque`` dumper.
        """
        return {"$" + arg_2: [arg_0._json_convert(arg_3) for arg_3 in arg_1]}


return render_template(
        'invenio_groups/pending.html',
        memberships=memberships,
        page=page,
        per_page=per_page,
    )

def Func ( ) : arg_0 = request . args . get ( 'page' , 1 , type = int ) arg_1 = request . args . get ( 'per_page' , 5 , type = int ) arg_2 = Membership . query_Func ( current_user , eager = True ) . all ( ) return render_template ( 'invenio_groups/pending.html' , arg_2 = arg_2 , arg_0 = arg_0 , arg_1 = arg_1 , )

def Func():
    """List all user pending memberships."""
    arg_0 = request.args.get('page', 1, type=int)
    arg_1 = request.args.get('per_page', 5, type=int)
    arg_2 = Membership.query_Func(current_user, eager=True).all()

    return render_template(
        'invenio_groups/pending.html',
        arg_2=arg_2,
        arg_0=arg_0,
        arg_1=arg_1,
    )


def Func ( arg_0 ) : arg_1 = { } for arg_2 in arg_0 . data [ 'files' ] : arg_3 = arg_2 [ 'full_name' ] if arg_3 not in arg_1 : arg_1 [ arg_3 ] = [ ] arg_1 [ arg_3 ] . append ( arg_2 ) for arg_3 in arg_1 . keys ( ) : arg_1 [ arg_3 ] . sort ( key = lambda x : x [ 'version' ] ) arg_0 . files = arg_1

def Func(arg_0):
        """Get files from data dump."""
        # Prepare files
        arg_1 = {}
        for arg_2 in arg_0.data['files']:
            arg_3 = arg_2['full_name']
            if arg_3 not in arg_1:
                arg_1[arg_3] = []
            arg_1[arg_3].append(arg_2)

        # Sort versions
        for arg_3 in arg_1.keys():
            arg_1[arg_3].sort(key=lambda x: x['version'])

        arg_0.files = arg_1


def Func ( arg_0 ) : if isinstance ( arg_0 , string_types ) : with io . open ( arg_0 , "r" ) as file_handle : return model_from_dict ( yaml . load ( file_handle ) ) else : return model_from_dict ( yaml . load ( arg_0 ) )

def Func(arg_0):
    """
    Load a cobra model from a file in YAML format.

    Parameters
    ----------
    filename : str or file-like
        File path or descriptor that contains the YAML document describing the
        cobra model.

    Returns
    -------
    cobra.Model
        The cobra model as represented in the YAML document.

    See Also
    --------
    from_yaml : Load from a string.
    """
    if isinstance(arg_0, string_types):
        with io.open(arg_0, "r") as file_handle:
            return model_from_dict(yaml.load(file_handle))
    else:
        return model_from_dict(yaml.load(arg_0))

Load a cobra model from a file in YAML format .


return self.get_data(
            "firewalls/%s/tags" % self.id,
            type=DELETE,
            params={"tags": tags}
        )

def Func ( arg_0 , arg_1 ) : return arg_0 . get_data ( "firewalls/%s/tags" % arg_0 . id , type = DELETE , params = { "tags" : arg_1 } )

def Func(arg_0, arg_1):
        """
            Remove tags from this Firewall.
        """
        return arg_0.get_data(
            "firewalls/%s/tags" % arg_0.id,
            type=DELETE,
            params={"tags": arg_1}
        )


def Func ( arg_0 , arg_1 = '' , arg_2 = False ) : if not arg_1 . startswith ( '/' ) : arg_1 = '/' + arg_1 arg_3 = arg_0 . prefix + arg_1 arg_4 = arg_0 . client . Func_objects ( Bucket = arg_0 . bucket , Prefix = arg_3 ) if arg_2 : return arg_4 [ 'Contents' ] else : return [ arg_5 [ 'Key' ] for arg_5 in arg_4 [ 'Contents' ] ]

def Func(arg_0, arg_1='', arg_2=False):
        """Get a Func of keys for the accounts"""
        if not arg_1.startswith('/'):
            arg_1 = '/' + arg_1

        arg_3 = arg_0.prefix + arg_1

        arg_4 = arg_0.client.Func_objects(Bucket=arg_0.bucket, Prefix=arg_3)

        if arg_2:
            return arg_4['Contents']
        else:
            return [arg_5['Key'] for arg_5 in arg_4['Contents']]


def Func(arg_0):
        """
        Cancels all pending IO blocks.
        Waits until all non-cancellable IO blocks finish.
        De-initialises AIO context.
        """
        if arg_0._ctx is not None:
            # Note: same as io_destroy
            arg_0._io_queue_release(arg_0._ctx)
            del arg_0._ctx

Cancels all pending IO blocks . Waits until all non - cancellable IO blocks finish . De - initialises AIO context .


(simUnit, subSimUnit, srcName, dstName, direction)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : if arg_4 == DIRECTION . OUT : arg_5 = getattr ( arg_1 , arg_2 ) arg_6 = getattr ( arg_0 , arg_3 ) setattr ( arg_1 , arg_2 , arg_6 ) else : arg_5 = getattr ( arg_1 , arg_3 ) arg_6 = getattr ( arg_0 , arg_2 ) setattr ( arg_1 , arg_3 , arg_6 ) arg_1 . _ctx . signals . remove ( arg_5 )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """
    Connect ports of simulation models by name
    """
    if arg_4 == DIRECTION.OUT:
        arg_5 = getattr(arg_1, arg_2)
        arg_6 = getattr(arg_0, arg_3)
        setattr(arg_1, arg_2, arg_6)
    else:
        arg_5 = getattr(arg_1, arg_3)
        arg_6 = getattr(arg_0, arg_2)
        setattr(arg_1, arg_3, arg_6)

    arg_1._ctx.signals.remove(arg_5)


(self, panel_file, data_sources=None, strict=True)

def Func(arg_0, arg_1, arg_2=None, arg_3=True):
        """Upload a panel to Elasticsearch if it does not exist yet.

        If a list of data sources is specified, upload only those
        elements (visualizations, searches) that match that data source.

        :param panel_file: file name of panel (dashobard) to upload
        :param data_sources: list of data sources
        :param strict: only upload a dashboard if it is newer than the one already existing
        """
        arg_4 = arg_0.conf['es_enrichment']['url']
        arg_5 = arg_0.conf['panels']['kibiter_url']

        arg_6 = set(['pipermail', 'hyperkitty', 'groupsio', 'nntp'])
        if arg_2 and any(arg_7 in arg_2 for arg_7 in arg_6):
            arg_2 = list(arg_2)
            arg_2.append('mbox')
        if arg_2 and ('supybot' in arg_2):
            arg_2 = list(arg_2)
            arg_2.append('irc')
        if arg_2 and 'google_hits' in arg_2:
            arg_2 = list(arg_2)
            arg_2.append('googlehits')
        if arg_2 and 'stackexchange' in arg_2:
            # stackexchange is called stackoverflow in panels
            arg_2 = list(arg_2)
            arg_2.append('stackoverflow')
        if arg_2 and 'phabricator' in arg_2:
            arg_2 = list(arg_2)
            arg_2.append('maniphest')

        try:
            import_dashboard(arg_4, arg_5, arg_1, arg_2=arg_2, arg_3=arg_3)
        except ValueError:
            logger.error("%s does not include release field. Not loading the panel.", arg_1)
        except RuntimeError:
            logger.error("Can not load the panel %s", arg_1)

Upload a panel to Elasticsearch if it does not exist yet .


def Func ( arg_0 ) : if WebobBaseRequest and isinstance ( arg_0 , WebobBaseRequest ) : return _build_webob_request_data ( arg_0 ) if DjangoHttpRequest and isinstance ( arg_0 , DjangoHttpRequest ) : return _build_django_request_data ( arg_0 ) if RestFrameworkRequest and isinstance ( arg_0 , RestFrameworkRequest ) : return _build_django_request_data ( arg_0 ) if WerkzeugRequest and isinstance ( arg_0 , WerkzeugRequest ) : return _build_werkzeug_request_data ( arg_0 ) if TornadoRequest and isinstance ( arg_0 , TornadoRequest ) : return _build_tornado_request_data ( arg_0 ) if BottleRequest and isinstance ( arg_0 , BottleRequest ) : return _build_bottle_request_data ( arg_0 ) if SanicRequest and isinstance ( arg_0 , SanicRequest ) : return _build_sanic_request_data ( arg_0 ) if FalconRequest and isinstance ( arg_0 , FalconRequest ) : return _build_falcon_request_data ( arg_0 ) if isinstance ( arg_0 , dict ) and 'wsgi.version' in arg_0 : return _build_wsgi_request_data ( arg_0 ) return None

def Func(arg_0):
    """
    Returns a dictionary containing data from the request.
    Can handle webob or werkzeug-based request objects.
    """

    # webob (pyramid)
    if WebobBaseRequest and isinstance(arg_0, WebobBaseRequest):
        return _build_webob_request_data(arg_0)

    # django
    if DjangoHttpRequest and isinstance(arg_0, DjangoHttpRequest):
        return _build_django_request_data(arg_0)

    # django rest framework
    if RestFrameworkRequest and isinstance(arg_0, RestFrameworkRequest):
        return _build_django_request_data(arg_0)

    # werkzeug (flask)
    if WerkzeugRequest and isinstance(arg_0, WerkzeugRequest):
        return _build_werkzeug_request_data(arg_0)

    # tornado
    if TornadoRequest and isinstance(arg_0, TornadoRequest):
        return _build_tornado_request_data(arg_0)

    # bottle
    if BottleRequest and isinstance(arg_0, BottleRequest):
        return _build_bottle_request_data(arg_0)

    # Sanic
    if SanicRequest and isinstance(arg_0, SanicRequest):
        return _build_sanic_request_data(arg_0)

    # falcon
    if FalconRequest and isinstance(arg_0, FalconRequest):
        return _build_falcon_request_data(arg_0)

    # Plain wsgi (should be last)
    if isinstance(arg_0, dict) and 'wsgi.version' in arg_0:
        return _build_wsgi_request_data(arg_0)

    return None

Returns a dictionary containing data from the request . Can handle webob or werkzeug - based request objects .


(self, instance, database, project_id=None)

return self.get_conn().databases().get(
            project=project_id,
            instance=instance,
            database=database
        ).execute(num_retries=self.num_retries)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = None ) : return arg_0 . get_conn ( ) . databases ( ) . get ( project = arg_3 , arg_1 = arg_1 , arg_2 = arg_2 ) . execute ( num_retries = arg_0 . num_retries )

def Func(arg_0, arg_1, arg_2, arg_3=None):
        """
        Retrieves a database resource from a Cloud SQL instance.

        :param instance: Database instance ID. This does not include the project ID.
        :type instance: str
        :param database: Name of the database in the instance.
        :type database: str
        :param project_id: Project ID of the project that contains the instance. If set
            to None or missing, the default project_id from the GCP connection is used.
        :type project_id: str
        :return: A Cloud SQL database resource, as described in
            https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/databases#resource.
        :rtype: dict
        """
        return arg_0.get_conn().databases().get(
            project=arg_3,
            arg_1=arg_1,
            arg_2=arg_2
        ).execute(num_retries=arg_0.num_retries)

Retrieves a database resource from a Cloud SQL instance .


def Func(arg_0, arg_1, arg_2, arg_3):
        '''Map a buffer region using this attribute as an accessor.

        The returned region can be modified as if the buffer was a contiguous
        array of this attribute (though it may actually be interleaved or
        otherwise non-contiguous).

        The returned region consists of a contiguous array of component
        data elements.  For example, if this attribute uses 3 floats per
        vertex, and the `count` parameter is 4, the number of floats mapped
        will be ``3 * 4 = 12``.

        :Parameters:
            `buffer` : `AbstractMappable`
                The buffer to map.
            `start` : int
                Offset of the first vertex to map.
            `count` : int
                Number of vertices to map

        :rtype: `AbstractBufferRegion`
        '''
        arg_4 = arg_0.stride * arg_2
        arg_5 = arg_0.stride * arg_3
        arg_6 = arg_0.count * arg_3
        if arg_0.stride == arg_0.size or not arg_6:
            # non-interleaved
            arg_7 = ctypes.POINTER(arg_0.c_type * arg_6)
            return arg_1.get_region(arg_4, arg_5, arg_7)
        else:
            # interleaved
            arg_4 += arg_0.offset
            arg_5 -= arg_0.offset
            arg_8 = arg_0.stride // ctypes.sizeof(arg_0.c_type)
            arg_9 = arg_0.offset // ctypes.sizeof(arg_0.c_type)
            arg_7 = ctypes.POINTER(
                arg_0.c_type * int((arg_3 * arg_8 - arg_9)))
            arg_10 = arg_1.get_region(arg_4, arg_5, arg_7)
            return vertexbuffer.IndirectArrayRegion(
                arg_10, arg_6, arg_0.count, arg_8)

Map a buffer region using this attribute as an accessor .


(adapter, internal_id, display_name, sanger_recipients=None)

def Func(arg_0, arg_1, arg_2, arg_3=None):
    """Load a institute into the database

        Args:
            adapter(MongoAdapter)
            internal_id(str)
            display_name(str)
            sanger_recipients(list(email))
    """

    arg_4 = build_institute(
        arg_1=arg_1,
        arg_2=arg_2,
        arg_3=arg_3
    )
    log.info("Loading institute {0} with display name {1}" \
             " into database".format(arg_1, arg_2))

    arg_0.add_institute(arg_4)


(self, run_dates, ti_status, executor, pickle_id,
                               start_date, session=None)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                               arg_5, arg_6=None):
        """
        Computes the dag runs and their respective task instances for
        the given run dates and executes the task instances.
        Returns a list of execution dates of the dag runs that were executed.

        :param run_dates: Execution dates for dag runs
        :type run_dates: list
        :param ti_status: internal BackfillJob status structure to tis track progress
        :type ti_status: BackfillJob._DagRunTaskStatus
        :param executor: the executor to use, it must be previously started
        :type executor: BaseExecutor
        :param pickle_id: numeric id of the pickled dag, None if not pickled
        :type pickle_id: int
        :param start_date: backfill start date
        :type start_date: datetime.datetime
        :param session: the current session object
        :type session: sqlalchemy.orm.session.Session
        """
        for arg_7 in arg_1:
            arg_8 = arg_0._get_dag_run(arg_7, arg_6=arg_6)
            arg_9 = arg_0._task_instances_for_dag_run(arg_8,
                                                       arg_6=arg_6)
            if arg_8 is None:
                continue

            arg_2.active_runs.append(arg_8)
            arg_2.to_run.update(arg_9 or {})

        arg_10 = arg_0._process_backfill_task_instances(
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=arg_6)

        arg_2.executed_dag_run_dates.update(arg_10)

Computes the dag runs and their respective task instances for the given run dates and executes the task instances . Returns a list of execution dates of the dag runs that were executed .


def Func ( arg_0 ) : try : return arg_2 . _normalized_headers [ arg_0 ] except KeyError : if arg_2 . _NORMALIZED_HEADER_RE . match ( arg_0 ) : arg_1 = arg_0 else : arg_1 = "-" . join ( [ w . capitalize ( ) for w in arg_0 . split ( "-" ) ] ) arg_2 . _normalized_headers [ arg_0 ] = arg_1 return arg_1

def Func(arg_0):
        """Converts a name to Http-Header-Case.

        >>> HTTPHeaders.Func("coNtent-TYPE")
        'Content-Type'
        """
        try:
            return arg_2._normalized_headers[arg_0]
        except KeyError:
            if arg_2._NORMALIZED_HEADER_RE.match(arg_0):
                arg_1 = arg_0
            else:
                arg_1 = "-".join([w.capitalize() for w in arg_0.split("-")])
            arg_2._normalized_headers[arg_0] = arg_1
            return arg_1

Converts a name to Http-Header-Case.

        >>> HTTPHeaders._normalize_name("coNtent-TYPE")
        'Content-Type'

Converts a name to Http - Header - Case .