def Func ( arg_0 ) : with LOCALE_LOCK : arg_1 = locale . Func ( locale . LC_ALL ) try : yield locale . Func ( locale . LC_ALL , arg_0 ) finally : locale . Func ( locale . LC_ALL , arg_1 )

def Func(arg_0):
    """
    Context manager with threading lock for set locale on enter, and set it
    back to original state on exit.

    ::

        >>> with Func("C"):
        ...     ...
    """
    with LOCALE_LOCK:
        arg_1 = locale.Func(locale.LC_ALL)
        try:
            yield locale.Func(locale.LC_ALL, arg_0)
        finally:
            locale.Func(locale.LC_ALL, arg_1)

Context manager with threading lock for set locale on enter, and set it
    back to original state on exit.

    ::

        >>> with setlocale("C"):
        ...     ...

Context manager with threading lock for set locale on enter and set it back to original state on exit .


def
Func
(
arg_0
,
arg_1
)
:
IN_LOGGER
.
debug
(
"IN: %r"
,
arg_1
)
if
arg_1
:
arg_0
.
lock
.
release
(
)
try
:
arg_0
.
_reader
.
feed
(
arg_1
)
finally
:
arg_0
.
lock
.
acquire
(
)
else
:
arg_0
.
_eof
=
True
arg_0
.
lock
.
release
(
)
try
:
arg_0
.
_stream
.
stream_eof
(
)
finally
:
arg_0
.
lock
.
acquire
(
)
if
not
arg_0
.
_serializer
:
if
arg_0
.
_state
!=
"closed"
:
arg_0
.
event
(
DisconnectedEvent
(
arg_0
.
_dst_addr
)
)
arg_0
.
_set_state
(
"closed"
)

def Func(arg_0, arg_1):
        """Feed the stream reader with data received.

        [ called with `lock` acquired ]

        If `data` is None or empty, then stream end (peer disconnected) is
        assumed and the stream is closed.

        `lock` is acquired during the operation.

        :Parameters:
            - `data`: data received from the stream socket.
        :Types:
            - `data`: `unicode`
        """
        IN_LOGGER.debug("IN: %r", arg_1)
        if arg_1:
            arg_0.lock.release() # not to deadlock with the stream
            try:
                arg_0._reader.feed(arg_1)
            finally:
                arg_0.lock.acquire()
        else:
            arg_0._eof = True
            arg_0.lock.release() # not to deadlock with the stream
            try:
                arg_0._stream.stream_eof()
            finally:
                arg_0.lock.acquire()
            if not arg_0._serializer:
                if arg_0._state != "closed":
                    arg_0.event(DisconnectedEvent(arg_0._dst_addr))
                    arg_0._set_state("closed")

Feed the stream reader with data received .


def Func(arg_0):
    """Decorator factory for standalone functions.
    """
    validate_type(arg_0)

    # This is a closure to capture the magic_kind.  We could also use a class,
    # but it's overkill for just that one bit of state.
    def arg_12(arg_1):
        arg_2 = lambda f, *arg_9, **k: f(*arg_9, **k)

        # Find get_ipython() in the caller's namespace
        arg_3 = sys._getframe(1)
        for arg_4 in ['f_locals', 'f_globals', 'f_builtins']:
            get_ipython = getattr(arg_3, arg_4).get('get_ipython')
            if get_ipython is not None:
                break
        else:
            raise NameError('Decorator can only run in context where '
                            '`get_ipython` exists')

        arg_5 = get_ipython()

        if callable(arg_1):
            # "Naked" decorator call (just @foo, no args)
            arg_6 = arg_1
            arg_7 = arg_6.func_name
            arg_5.register_magic_function(arg_6, arg_0, arg_7)
            arg_8 = decorator(arg_2, arg_6)
        elif isinstance(arg_1, basestring):
            # Decorator called with arguments (@foo('bar'))
            arg_7 = arg_1
            def mark(arg_6, *arg_9, **arg_10):
                arg_5.register_magic_function(arg_6, arg_0, arg_7)
                return decorator(arg_2, arg_6)
            arg_8 = mark
        else:
            raise TypeError("Decorator can only be called with "
                             "string or function")
        return arg_8

    # Ensure the resulting decorator has a usable docstring
    arg_11 = _docstring_template.format('function', arg_0)

    arg_11 += dedent("""
    Note: this decorator can only be used in a context where IPython is already
    active, so that the `get_ipython()` call succeeds.  You can therefore use
    it in your startup files loaded after IPython initializes, but *not* in the
    IPython configuration file itself, which is executed before IPython is
    fully up and running.  Any file located in the `startup` subdirectory of
    your configuration profile will be OK in this sense.
    """)

    arg_12.__doc__ = arg_11
    return arg_12

Decorator factory for standalone functions .


return rep.replace('\n', '\n' + ' ' * indent)

def
Func
(
arg_0
,
arg_1
=
0
)
:
if
hasattr
(
arg_0
,
'__Func__'
)
:
arg_2
=
arg_0
.
__Func__
(
)
elif
isinstance
(
arg_0
,
SortedKeyList
)
:
arg_2
=
'<{:d} observations>'
.
format
(
len
(
arg_0
)
)
else
:
arg_2
=
repr
(
arg_0
)
return
arg_2
.
replace
(
'\n'
,
'\n'
+
' '
*
arg_1
)

def Func(arg_0, arg_1=0):
    '''Helper function to format repr strings for JObjects and friends.

    Parameters
    ----------
    obj
        The object to repr

    indent : int >= 0
        indent each new line by `indent` spaces

    Returns
    -------
    r : str
        If `obj` has a `__Func__` method, it is used.

        If `obj` is a `SortedKeyList`, then it returns a description
        of the length of the list.

        Otherwise, `repr(obj)`.
    '''
    if hasattr(arg_0, '__Func__'):
        arg_2 = arg_0.__Func__()
    elif isinstance(arg_0, SortedKeyList):
        arg_2 = '<{:d} observations>'.format(len(arg_0))
    else:
        arg_2 = repr(arg_0)

    return arg_2.replace('\n', '\n' + ' ' * arg_1)

Helper function to format repr strings for JObjects and friends.

    Parameters
    ----------
    obj
        The object to repr

    indent : int >= 0
        indent each new line by `indent` spaces

    Returns
    -------
    r : str
        If `obj` has a `__summary__` method, it is used.

        If `obj` is a `SortedKeyList`, then it returns a description
        of the length of the list.

        Otherwise, `repr(obj)`.

Helper function to format repr strings for JObjects and friends .


def Func ( arg_0 ) : from cryptography . hazmat . backends . openssl . x509 import _Certificate arg_1 = _get_backend ( ) return _Certificate ( arg_1 , arg_0 . _x509 )

def Func(arg_0):
        """
        Export as a ``cryptography`` certificate.

        :rtype: ``cryptography.x509.Certificate``

        .. versionadded:: 17.1.0
        """
        from cryptography.hazmat.backends.openssl.x509 import _Certificate
        arg_1 = _get_backend()
        return _Certificate(arg_1, arg_0._x509)


def Func ( arg_0 ) : if isinstance ( arg_0 , unicode ) : arg_1 = 0 for arg_2 in unicodedata . normalize ( 'NFC' , arg_0 ) : if unicodedata . east_asian_width ( arg_2 ) in ( 'W' , 'F' ) : arg_1 += 2 elif not unicodedata . combining ( arg_2 ) : arg_1 += 1 return arg_1 else : return len ( arg_0 )

def Func(arg_0):
  """Determines the width of the line in column positions.

  Args:
    line: A string, which may be a Unicode string.

  Returns:
    The width of the line in column positions, accounting for Unicode
    combining characters and wide characters.
  """
  if isinstance(arg_0, unicode):
    arg_1 = 0
    for arg_2 in unicodedata.normalize('NFC', arg_0):
      if unicodedata.east_asian_width(arg_2) in ('W', 'F'):
        arg_1 += 2
      elif not unicodedata.combining(arg_2):
        arg_1 += 1
    return arg_1
  else:
    return len(arg_0)

Determines the width of the line in column positions .


def
Func
(
arg_0
,
arg_1
=
)
:
logger
.
info
(
"Creating image table..."
)
if
arg_1
is
not
:
arg_0
.
r
=
arg_1
arg_0
.
image_table
=
ImageTable
(
arg_0
)

def Func(arg_0, arg_1=None):
        """ Create and store a new ImageTable instance based on the current
        Dataset. Will generally be called privately, but may be useful as a
        convenience method in cases where the user wants to re-generate the
        table with a new smoothing kernel of different radius.

        Args:
            r (int): An optional integer indicating the radius of the smoothing
                kernel. By default, this is None, which will keep whatever
                value is currently set in the Dataset instance.
        """
        logger.info("Creating image table...")
        if arg_1 is not None:
            arg_0.r = arg_1
        arg_0.image_table = ImageTable(arg_0)

Create and store a new ImageTable instance based on the current Dataset . Will generally be called privately but may be useful as a convenience method in cases where the user wants to re - generate the table with a new smoothing kernel of different radius .


def Func ( arg_0 : arg_1 ) -> List : assert check_argument_types ( ) arg_2 = [ ] arg_3 = [ ] arg_4 = { } def visit ( arg_5 : arg_6 ) : if arg_5 in arg_4 : return arg_7 = len ( arg_4 ) arg_4 [ arg_5 ] = arg_7 arg_8 = len ( arg_3 ) arg_3 . append ( arg_5 ) for arg_9 in arg_0 [ arg_5 ] : visit ( arg_9 ) arg_4 [ arg_5 ] = min ( arg_4 [ arg_5 ] , arg_4 [ arg_9 ] ) if arg_7 == arg_4 [ arg_5 ] : arg_10 = tuple ( arg_3 [ arg_8 : ] ) del arg_3 [ arg_8 : ] arg_2 . append ( arg_10 ) for arg_11 in arg_10 : arg_4 [ arg_11 ] = len ( arg_0 ) for arg_5 in arg_0 : visit ( arg_5 ) return arg_2

def Func(arg_0: arg_1) -> List:
	"""Find the strongly connected components in a graph using Tarjan's algorithm.

	The `graph` argument should be a dictionary mapping node names to sequences of successor nodes.
	"""

	assert check_argument_types()

	arg_2 = []
	arg_3 = []
	arg_4 = {}

	def visit(arg_5: arg_6):
		if arg_5 in arg_4: return

		arg_7 = len(arg_4)
		arg_4[arg_5] = arg_7
		arg_8 = len(arg_3)
		arg_3.append(arg_5)

		for arg_9 in arg_0[arg_5]:
			visit(arg_9)
			arg_4[arg_5] = min(arg_4[arg_5], arg_4[arg_9])

		if arg_7 == arg_4[arg_5]:
			arg_10 = tuple(arg_3[arg_8:])
			del arg_3[arg_8:]

			arg_2.append(arg_10)

			for arg_11 in arg_10:
				arg_4[arg_11] = len(arg_0)

	for arg_5 in arg_0:
		visit(arg_5)

	return arg_2

Find the strongly connected components in a graph using Tarjan s algorithm . The graph argument should be a dictionary mapping node names to sequences of successor nodes .


def Func ( arg_0 ) : arg_1 = Task . NOT_FINISHED_MASK arg_2 = Task . Iterator ( arg_0 . task_tree , arg_1 ) try : next ( arg_2 ) except StopIteration : return True return False

def Func(arg_0):
        """
        Returns True if the entire Workflow is completed, False otherwise.

        :rtype: bool
        :return: Whether the workflow is completed.
        """
        arg_1 = Task.NOT_FINISHED_MASK
        arg_2 = Task.Iterator(arg_0.task_tree, arg_1)
        try:
            next(arg_2)
        except StopIteration:
            # No waiting tasks found.
            return True
        return False

Returns True if the entire Workflow is completed False otherwise .


def Func ( arg_0 ) : with gzip . open ( '%s.gz' % arg_0 . path , 'rt' ) if arg_0 . gz else open ( arg_0 . path ) as file : return list ( map ( list , zip ( * json . load ( file ) ) ) ) [ : : - 1 ]

def Func(arg_0):
        '''
        Reads dataset from json.
        '''
        with gzip.open('%s.gz' % arg_0.path,
                       'rt') if arg_0.gz else open(arg_0.path) as file:
            return list(map(list, zip(*json.load(file))))[::-1]


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

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

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

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


return '%s %3d %10s %10s %10d %s' % (
      format_mode(sres),
      sres.st_nlink,
      user,
      group,
      sres.st_size,
      format_mtime(sres.st_mtime),
  )

def Func(arg_0, arg_1):
  """
  Prefix to a filename in the directory listing. This is to make the
  listing similar to an output of "ls -alh".
  """
  try:
    arg_2 = pwd.getpwuid(arg_1.st_uid)
    arg_3 = arg_2.pw_name
  except KeyError:
    arg_3 = arg_1.st_uid

  try:
    arg_4 = grp.getgrgid(arg_1.st_gid)
    arg_5 = arg_4.gr_name
  except KeyError:
    arg_5 = arg_1.st_gid

  return '%s %3d %10s %10s %10d %s' % (
      format_mode(arg_1),
      arg_1.st_nlink,
      arg_3,
      arg_5,
      arg_1.st_size,
      format_mtime(arg_1.st_mtime),
  )

Prefix to a filename in the directory listing . This is to make the listing similar to an output of ls - alh .


def Func(arg_0, **arg_1):
    """ Build a Func query.

    >>> Func('foo_table', a=5, b=2)
    "UPDATE `foo_table` SET `a`=%(_QB_a)s, `b`=%(_QB_b)s", { '_QB_a': 5, '_QB_b': 2 }
    """
    arg_2 = "UPDATE `%s` SET " % arg_0
    arg_3, arg_4 = simple_expression(', ', **arg_1)
    return arg_2 + arg_3, arg_4

Build a update query.

    >>> update('foo_table', a=5, b=2)
    "UPDATE `foo_table` SET `a`=%(_QB_a)s, `b`=%(_QB_b)s", { '_QB_a': 5, '_QB_b': 2 }


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , basestring ) : arg_1 = ( arg_1 , ) if isinstance ( arg_0 , dict ) : arg_0 = arg_0 . items ( ) for arg_2 , arg_3 in arg_0 : for arg_4 in arg_1 : if fnmatch . fnmatch ( arg_2 , arg_4 ) : yield arg_2 , arg_3 break

def Func(arg_0, arg_1):
    '''Get the outputs from a network that match a pattern.

    Parameters
    ----------
    outputs : dict or sequence of (str, theano expression)
        Output expressions to filter for matches. If this is a dictionary, its
        ``items()`` will be processed for matches.
    patterns : sequence of str
        A sequence of glob-style patterns to match against. Any parameter
        matching any pattern in this sequence will be included in the match.

    Yields
    ------
    matches : pair of str, theano expression
        Generates a sequence of (name, expression) pairs. The name is the name
        of the output that matched, and the expression is the symbolic output in
        the network graph.
    '''
    if isinstance(arg_1, basestring):
        arg_1 = (arg_1, )
    if isinstance(arg_0, dict):
        arg_0 = arg_0.items()
    for arg_2, arg_3 in arg_0:
        for arg_4 in arg_1:
            if fnmatch.fnmatch(arg_2, arg_4):
                yield arg_2, arg_3
                break

Get the outputs from a network that match a pattern .


def Func ( arg_0 ) -> bool : arg_0 . _contexts . append ( arg_0 . _cursor . position ) return True

def Func(arg_0) -> bool:
        """Save current position."""
        arg_0._contexts.append(arg_0._cursor.position)
        return True


def Func(arg_0):
		"""
		Finds .DS_Store files into path
		"""
		arg_1 = ".DS_Store"
		arg_2 = "find {path} -type f -name \"{filename}\" ".format(path = arg_0.path, arg_1 = arg_1)
		arg_3 = CommandHelper(arg_2)
		arg_3.execute()
		arg_4 = arg_3.output.split("\n")
		for arg_5 in arg_4:
			if not arg_5.endswith(arg_1):
				continue

			# Ignore paths excluded
			arg_6 = arg_5.replace(arg_0.path, "")
			if arg_6.startswith(tuple(arg_0.CONFIG['exclude_paths'])):
				continue

			arg_7 = Issue()
			arg_7.name = "File .DS_Store detected"
			arg_7.potential = False
			arg_7.severity = Issue.SEVERITY_LOW

			# Get only relative path
			arg_7.file = arg_6

			arg_0.saveIssue(arg_7)


return np.exp(np.square(np.log(a) - np.log(b)).mean())

def Func ( arg_0 , arg_1 ) : return np . exp ( np . square ( np . log ( arg_0 ) - np . log ( arg_1 ) ) . mean ( ) )

def Func(arg_0, arg_1):
    """Geometric mean variance
    """
    return np.exp(np.square(np.log(arg_0) - np.log(arg_1)).mean())


def Func(arg_0):
        """
        Creates scripts to start and stop the application

        """
        # create start script
        arg_1 = '# start script for {0}\n\n'.format(arg_0._project_name)
        # start uwsgi
        arg_1 += 'echo \'Starting uWSGI...\'\n'
        arg_1 += 'sh {0}.uwsgi\n'.format(os.path.join(arg_0._conf_dir, arg_0._project_name))
        arg_1 += 'sleep 1\n'
        # start nginx
        arg_1 += 'echo \'Starting Nginx...\'\n'
        arg_1 += 'nginx -c {0}_nginx.conf\n'.format(os.path.join(arg_0._conf_dir, arg_0._project_name))
        arg_1 += 'sleep 1\n'
        arg_1 += 'echo \'{0} started\'\n\n'.format(arg_0._project_name)

        # stop script
        arg_2 = '# stop script for {0}\n\n'.format(arg_0._project_name)
        # stop nginx
        arg_2 += 'if [ -e {0}_nginx.pid ]; then nginx -c {1}_nginx.conf -s stop ; fi\n'.format(os.path.join(arg_0._var_dir, arg_0._project_name), os.path.join(arg_0._conf_dir, arg_0._project_name))
        # stop uwsgi
        arg_2 += 'if [ -e {0}_uwsgi.pid ]; then kill -9 `cat {0}_uwsgi.pid` ; rm {0}_uwsgi.pid 2>&1 > /dev/null ; fi\n'.format(os.path.join(arg_0._var_dir, arg_0._project_name))
        arg_2 += 'echo \'{0} stopped\'\n'.format(arg_0._project_name)

        # write scripts
        arg_3 = '{0}_start.sh'.format(os.path.join(arg_0._script_dir, arg_0._project_name))
        arg_4 = '{0}_stop.sh'.format(os.path.join(arg_0._script_dir, arg_0._project_name))
        arg_5 = open(arg_3, 'w')
        arg_5.write(arg_1)
        arg_5.close()
        arg_5 = open(arg_4, 'w')
        arg_5.write(arg_2)
        arg_5.close()
        # make executable
        os.chmod(arg_3, 0754)
        os.chmod(arg_4, 0754)


def Func ( arg_0 , arg_1 , arg_2 ) : arg_1 . write ( Operators . SEXTEND ( arg_2 . read ( ) , arg_2 . size , arg_1 . size ) )

def Func(arg_0, arg_1, arg_2):
        """
        Moves with sign-extension.

        Copies the contents of the source operand (register or memory location) to the destination
        operand (register) and sign extends the value to 16::

                OP0  =  SignExtend(OP1);

        :param cpu: current CPU.
        :param op0: destination operand.
        :param op1: source operand.
        """
        arg_1.write(Operators.SEXTEND(arg_2.read(), arg_2.size, arg_1.size))


def Func ( arg_0 ) : while True : if not arg_0 . is_connected or arg_0 . is_connecting : break try : yield from arg_0 . _flush_queue . get ( ) if arg_0 . _pending_data_size > 0 : arg_0 . _io_writer . writelines ( arg_0 . _pending [ : ] ) arg_0 . _pending = [ ] arg_0 . _pending_data_size = 0 yield from arg_0 . _io_writer . drain ( ) except OSError as e : if arg_0 . _error_cb is not None : yield from arg_0 . _error_cb ( e ) yield from arg_0 . _process_op_err ( e ) break except asyncio . CancelledError : break

def Func(arg_0):
        """
        Coroutine which continuously tries to consume pending commands
        and then flushes them to the socket.
        """
        while True:
            if not arg_0.is_connected or arg_0.is_connecting:
                break

            try:
                yield from arg_0._flush_queue.get()

                if arg_0._pending_data_size > 0:
                    arg_0._io_writer.writelines(arg_0._pending[:])
                    arg_0._pending = []
                    arg_0._pending_data_size = 0
                    yield from arg_0._io_writer.drain()
            except OSError as e:
                if arg_0._error_cb is not None:
                    yield from arg_0._error_cb(e)
                yield from arg_0._process_op_err(e)
                break
            except asyncio.CancelledError:
                break

Coroutine which continuously tries to consume pending commands and then flushes them to the socket .


def Func(arg_0, arg_1,arg_2=''):
        """Transform alias to system command string."""
        arg_3, arg_4 = arg_0.alias_table[arg_1]

        if ' ' in arg_4 and os.path.isfile(arg_4):
            arg_4 = '"%s"' % arg_4

        # Expand the %l special to be the user's input line
        if arg_4.find('%l') >= 0:
            arg_4 = arg_4.replace('%l', arg_2)
            arg_2 = ''
        if arg_3==0:
            # Simple, argument-less aliases
            arg_4 = '%s %s' % (arg_4, arg_2)
        else:
            # Handle aliases with positional arguments
            arg_5 = arg_2.split(None, arg_3)
            if len(arg_5) < arg_3:
                raise AliasError('Alias <%s> requires %s arguments, %s given.' %
                      (arg_1, arg_3, len(arg_5)))
            arg_4 = '%s %s' % (arg_4 % tuple(arg_5[:arg_3]),' '.join(arg_5[arg_3:]))
        return arg_4

Transform alias to system command string .


def Func ( arg_0 , arg_1 , ** arg_2 ) : if arg_1 is not None : if arg_0 . _findFirstR ( ** arg_2 ) : return arg_1 . _match ( ** arg_2 ) return False

def Func(arg_0, arg_1, **arg_2):
        """Perform _match but on another object, not self."""
        if arg_1 is not None:
            # Need to check that the returned UI element wasn't destroyed first:
            if arg_0._findFirstR(**arg_2):
                return arg_1._match(**arg_2)
        return False

Perform _match but on another object not self .


def Func ( arg_0 , arg_1 = False ) : if not arg_1 : while op . exists ( arg_0 ) : arg_0 += '+' os . makedirs ( arg_0 , exist_ok = arg_1 ) return arg_0

def Func(arg_0, arg_1=False):
        """ Will create dirpath folder. If dirpath already exists and overwrite is False,
        will append a '+' suffix to dirpath until dirpath does not exist."""
        if not arg_1:
            while op.exists(arg_0):
                arg_0 += '+'

        os.makedirs(arg_0, exist_ok=arg_1)
        return arg_0

Will create dirpath folder . If dirpath already exists and overwrite is False will append a + suffix to dirpath until dirpath does not exist .


return [Allele(sequence=x) for x in
                [self.ref_allele] + self.alt_alleles]

def Func ( arg_0 ) : return [ Allele ( sequence = arg_1 ) for arg_1 in [ arg_0 . ref_allele ] + arg_0 . alt_alleles ]

def Func(arg_0):
        """Create list of Alleles from VCF line data"""
        return [Allele(sequence=arg_1) for arg_1 in
                [arg_0.ref_allele] + arg_0.alt_alleles]


return {
        "rp_name": rp_name,
        "is_arm": is_arm
    }

def Func ( arg_0 ) : arg_0 = arg_0 . lower ( ) arg_0 = arg_0 [ arg_0 . index ( "specification" ) : ] arg_1 = arg_0 . split ( "/" ) arg_2 = arg_1 [ 1 ] arg_3 = arg_1 [ 2 ] == "resource-manager" return { "rp_name" : arg_2 , "is_arm" : arg_3 }

def Func(arg_0):
    """Guess Python Autorest options based on the spec path.

    Expected path:
    specification/compute/resource-manager/readme.md
    """
    arg_0 = arg_0.lower()
    arg_0 = arg_0[arg_0.index("specification"):] # Might raise and it's ok
    arg_1 = arg_0.split("/")

    arg_2 = arg_1[1]
    arg_3 = arg_1[2] == "resource-manager"

    return {
        "rp_name": arg_2,
        "is_arm": arg_3
    }

Guess Python Autorest options based on the spec path .


def Func(arg_0):
        """ Constructs the Func line of the element"""
        arg_1 = arg_0.Func_format % arg_0.Func_connect.center(
            arg_0.width, arg_0.Func_pad)
        if arg_0.right_fill:
            arg_1 = arg_1.ljust(arg_0.right_fill, arg_0.Func_pad)
        if arg_0.left_fill:
            arg_1 = arg_1.rjust(arg_0.left_fill, arg_0.Func_pad)
        arg_1 = arg_1.center(arg_0.layer_width, arg_0.Func_bck)
        return arg_1


(
            self, application_definition_id, custom_headers=None, raw=False, polling=True, **operation_config)

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

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = False , arg_4 = True , ** arg_5 ) : arg_6 = arg_0 . _Func_initial ( arg_1 = arg_1 , arg_2 = arg_2 , arg_3 = True , ** arg_5 ) def get_long_running_output ( arg_7 ) : if arg_3 : arg_8 = ClientRawResponse ( None , arg_7 ) return arg_8 arg_9 = arg_5 . get ( 'long_running_operation_timeout' , arg_0 . config . long_running_operation_timeout ) if arg_4 is True : arg_10 = ARMPolling ( arg_9 , ** arg_5 ) elif arg_4 is False : arg_10 = NoPolling ( ) else : arg_10 = arg_4 return LROPoller ( arg_0 . _client , arg_6 , get_long_running_output , arg_10 )

def Func(
            arg_0, arg_1, arg_2=None, arg_3=False, arg_4=True, **arg_5):
        """Deletes the managed application definition.

        :param application_definition_id: The fully qualified ID of the
         managed application definition, including the managed application name
         and the managed application definition resource type. Use the format,
         /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
        :type application_definition_id: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: The poller return type is ClientRawResponse, the
         direct response alongside the deserialized response
        :param polling: True for ARMPolling, False for no polling, or a
         polling object for personal polling strategy
        :return: An instance of LROPoller that returns None or
         ClientRawResponse<None> if raw==True
        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
        :raises:
         :class:`ErrorResponseException<azure.mgmt.resource.managedapplications.models.ErrorResponseException>`
        """
        arg_6 = arg_0._Func_initial(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=True,
            **arg_5
        )

        def get_long_running_output(arg_7):
            if arg_3:
                arg_8 = ClientRawResponse(None, arg_7)
                return arg_8

        arg_9 = arg_5.get(
            'long_running_operation_timeout',
            arg_0.config.long_running_operation_timeout)
        if arg_4 is True: arg_10 = ARMPolling(arg_9, **arg_5)
        elif arg_4 is False: arg_10 = NoPolling()
        else: arg_10 = arg_4
        return LROPoller(arg_0._client, arg_6, get_long_running_output, arg_10)

Deletes the managed application definition .


(self, datacenter_id, volume_id, snapshot_id)

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Restores a snapshot to the specified volume.

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

        :param      volume_id: The unique ID of the volume.
        :type       volume_id: ``str``

        :param      snapshot_id: The unique ID of the snapshot.
        :type       snapshot_id: ``str``

        """
        arg_4 = {'snapshotId': arg_3}

        arg_5 = arg_0._perform_request(
            url='/datacenters/%s/volumes/%s/restore-snapshot' % (
                arg_1,
                arg_2),
            method='POST-ACTION',
            arg_4=urlencode(arg_4))

        return arg_5

Restores a snapshot to the specified volume .


def Func(arg_0):
        """
        Retrieve all current endpoints for the connected user.
        """
        arg_0.endpoints["all"] = []
        for arg_2 in arg_0("GET", "{0}/users/ME/presenceDocs/messagingService".format(arg_0.msgsHost),
                         params={"view": "expanded"}, auth=arg_0.Auth.RegToken).json().get("endpointPresenceDocs", []):
            arg_3 = arg_2.get("link", "").split("/")[7]
            arg_0.endpoints["all"].append(SkypeEndpoint(arg_0, arg_3))

Retrieve all current endpoints for the connected user .


(self,
        plugin_env, full_env=None, installer=None, fallback=True
    )

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = None , arg_4 = True ) : arg_5 = list ( arg_1 ) arg_5 . sort ( ) arg_6 = { } arg_7 = { } if arg_2 is None : arg_8 = Environment ( arg_0 . entries ) arg_8 += arg_1 else : arg_8 = arg_2 + arg_1 arg_9 = arg_0 . __class__ ( [ ] ) map ( arg_9 . add , arg_0 ) for arg_10 in arg_5 : for arg_11 in arg_1 [ arg_10 ] : arg_12 = [ arg_11 . as_requirement ( ) ] try : arg_13 = arg_9 . resolve ( arg_12 , arg_8 , arg_3 ) except ResolutionError , v : arg_6 [ arg_11 ] = v if arg_4 : continue else : break else : map ( arg_9 . add , arg_13 ) arg_7 . update ( dict . fromkeys ( arg_13 ) ) break arg_7 = list ( arg_7 ) arg_7 . sort ( ) return arg_7 , arg_6

def Func(arg_0,
        arg_1, arg_2=None, arg_3=None, arg_4=True
    ):
        """Find all activatable distributions in `plugin_env`

        Example usage::

            distributions, errors = working_set.Func(
                Environment(plugin_dirlist)
            )
            map(working_set.add, distributions)  # add plugins+libs to sys.path
            print 'Could not load', errors        # display errors

        The `plugin_env` should be an ``Environment`` instance that contains
        only distributions that are in the project's "plugin directory" or
        directories. The `full_env`, if supplied, should be an ``Environment``
        contains all currently-available distributions.  If `full_env` is not
        supplied, one is created automatically from the ``WorkingSet`` this
        method is called on, which will typically mean that every directory on
        ``sys.path`` will be scanned for distributions.

        `installer` is a standard installer callback as used by the
        ``resolve()`` method. The `fallback` flag indicates whether we should
        attempt to resolve older versions of a plugin if the newest version
        cannot be resolved.

        This method returns a 2-tuple: (`distributions`, `error_info`), where
        `distributions` is a list of the distributions found in `plugin_env`
        that were loadable, along with any other distributions that are needed
        to resolve their dependencies.  `error_info` is a dictionary mapping
        unloadable plugin distributions to an exception instance describing the
        error that occurred. Usually this will be a ``DistributionNotFound`` or
        ``VersionConflict`` instance.
        """

        arg_5 = list(arg_1)
        arg_5.sort()  # scan project names in alphabetic order

        arg_6 = {}
        arg_7 = {}

        if arg_2 is None:
            arg_8 = Environment(arg_0.entries)
            arg_8 += arg_1
        else:
            arg_8 = arg_2 + arg_1

        arg_9 = arg_0.__class__([])
        map(arg_9.add, arg_0)   # put all our entries in shadow_set

        for arg_10 in arg_5:

            for arg_11 in arg_1[arg_10]:

                arg_12 = [arg_11.as_requirement()]

                try:
                    arg_13 = arg_9.resolve(arg_12, arg_8, arg_3)

                except ResolutionError,v:
                    arg_6[arg_11] = v    # save error info
                    if arg_4:
                        continue    # try the next older version of project
                    else:
                        break       # give up on this project, keep going

                else:
                    map(arg_9.add, arg_13)
                    arg_7.update(dict.fromkeys(arg_13))

                    # success, no need to try any more versions of this project
                    break

        arg_7 = list(arg_7)
        arg_7.sort()

        return arg_7, arg_6

Find all activatable distributions in `plugin_env`

        Example usage::

            distributions, errors = working_set.find_plugins(
                Environment(plugin_dirlist)
            )
            map(working_set.add, distributions)  # add plugins+libs to sys.path
            print 'Could not load', errors        # display errors

        The `plugin_env` should be an ``Environment`` instance that contains
        only distributions that are in the project's "plugin directory" or
        directories. The `full_env`, if supplied, should be an ``Environment``
        contains all currently-available distributions.  If `full_env` is not
        supplied, one is created automatically from the ``WorkingSet`` this
        method is called on, which will typically mean that every directory on
        ``sys.path`` will be scanned for distributions.

        `installer` is a standard installer callback as used by the
        ``resolve()`` method. The `fallback` flag indicates whether we should
        attempt to resolve older versions of a plugin if the newest version
        cannot be resolved.

        This method returns a 2-tuple: (`distributions`, `error_info`), where
        `distributions` is a list of the distributions found in `plugin_env`
        that were loadable, along with any other distributions that are needed
        to resolve their dependencies.  `error_info` is a dictionary mapping
        unloadable plugin distributions to an exception instance describing the
        error that occurred. Usually this will be a ``DistributionNotFound`` or
        ``VersionConflict`` instance.

Find all activatable distributions in plugin_env


def Func(arg_0, arg_1, arg_2):
    """
    Add a pretty printer for a type specified by the module and name of a type
    rather than the type object itself.
    """
    arg_3 = (arg_0, arg_1)
    arg_4 = arg_5.get(arg_3, None)
    if arg_2 is not None:
        # To support easy restoration of old pprinters, we need to ignore Nones.
        arg_5[arg_3] = arg_2
    return arg_4

Add a pretty printer for a type specified by the module and name of a type rather than the type object itself .


return -2 * numpy.arctanh(-numpy.array(k))

def Func(arg_0):
    """Convert reflection coefficients to log area ratios.

    :param k: reflection coefficients
    :return: inverse sine parameters

    The log area ratio is defined by G = log((1+k)/(1-k)) , where the K
    parameter is the reflection coefficient.

    .. seealso:: :func:`lar2rc`, :func:`rc2poly`, :func:`rc2ac`, :func:`rc2ic`.

    :References:
       [1] J. Makhoul, "Linear Prediction: A Tutorial Review," Proc. IEEE, Vol.63, No.4, pp.561-580, Apr 1975.

    """
    assert numpy.isrealobj(arg_0), 'Log area ratios not defined for complex reflection coefficients.'
    if max(numpy.abs(arg_0)) >= 1:
        raise ValueError('All reflection coefficients should have magnitude less than unity.')

    # Use the relation, atanh(x) = (1/2)*log((1+k)/(1-k))
    return -2 * numpy.arctanh(-numpy.array(arg_0))

Convert reflection coefficients to log area ratios .


(repo, force=False,
                          options=None, noinput=False)

def Func(arg_0, arg_1=False,
                          arg_2=None, arg_3=False):
    """
    Create the datapackage file..
    """

    print("Bootstrapping datapackage")

    # get the directory
    arg_4 = datetime.now().date().isoformat()

    # Initial data package json
    arg_5 = OrderedDict([
        ('title', ''),
        ('description', ''),
        ('username', arg_0.username),
        ('reponame', arg_0.reponame),
        ('name', str(arg_0)),
        ('title', ""),
        ('description', ""),
        ('keywords', []),
        ('resources', []),
        ('creator', getpass.getuser()),
        ('createdat', datetime.now().isoformat()),
        ('remote-url', arg_0.remoteurl)
    ])

    if arg_2 is not None:
        arg_5['title'] = arg_2['title']
        arg_5['description'] = arg_2['description']
    else:
        if arg_3:
            raise IncompleteParameters("Option field with title and description")

        for arg_6 in ['title', 'description']:
            arg_7 = ''
            while arg_7 in ['',None]:
                arg_7 = input('Your Repo ' + arg_6.title() + ": ")
                if len(arg_7) == 0:
                    print("{} cannot be empty. Please re-enter.".format(arg_6.title()))

            arg_5[arg_6] = arg_7

    # Now store the package...
    (arg_8, arg_9) = tempfile.mkstemp()
    with open(arg_9, 'w') as fd:
        fd.write(json.dumps(arg_5, indent=4))

    arg_0.package = arg_5

    return arg_9


(units: tf.Tensor,
                        n_hidden_list: List,
                        filter_width=3,
                        use_batch_norm=False,
                        use_dilation=False,
                        training_ph=None)

def Func(arg_0: arg_1.Tensor,
                        arg_3: arg_4,
                        arg_5=3,
                        arg_6=False,
                        arg_7=False,
                        arg_8=None):
    """ Highway convolutional network. Skip connection with gating
        mechanism.

    Args:
        units: a tensorflow tensor with dimensionality [None, n_tokens, n_features]
        n_hidden_list: list with number of hidden units at the output of each layer
        filter_width: width of the kernel in tokens
        use_batch_norm: whether to use batch normalization between layers
        use_dilation: use power of 2 dilation scheme [1, 2, 4, 8 .. ] for layers 1, 2, 3, 4 ...
        training_ph: boolean placeholder determining whether is training phase now or not.
            It is used only for batch normalization to determine whether to use
            current batch average (std) or memory stored average (std)
    Returns:
        units: tensor at the output of the last convolutional layer
                with dimensionality [None, n_tokens, n_hidden_list[-1]]
    """

    for arg_9, arg_10 in enumerate(arg_3):
        arg_11 = arg_0
        # Projection if needed
        if arg_11.get_shape().as_list()[-1] != arg_10:
            arg_11 = arg_1.layers.dense(arg_11, arg_10)
        if arg_7:
            arg_12 = 2 ** arg_9
        else:
            arg_12 = 1
        arg_0 = arg_1.layers.conv1d(arg_0,
                                 arg_10,
                                 arg_5,
                                 padding='same',
                                 arg_12=arg_12,
                                 kernel_initializer=INITIALIZER())
        if arg_6:
            arg_0 = arg_1.layers.batch_normalization(arg_0, training=arg_8)
        arg_13 = arg_1.layers.dense(arg_11, 1, activation=arg_1.sigmoid, kernel_initializer=INITIALIZER())
        arg_11 = arg_13 * arg_11 + (1 - arg_13) * arg_0
        arg_11 = arg_1.nn.relu(arg_11)
    arg_0 = arg_11
    return arg_0

Highway convolutional network . Skip connection with gating mechanism .


def Func ( arg_0 ) : arg_1 , arg_2 , arg_3 = numpy . linalg . svd ( arg_0 ) return arg_1 , arg_2 , arg_3

def Func(arg_0):
    """SVD decomposition using numpy.linalg.svd

    :param A: a M by N matrix

    :return:
        * U, a M by M matrix
        * S the N eigen values
        * V a N by N matrix

    See :func:`numpy.linalg.svd` for a detailed documentation.

    Should return the same as in [Marple]_ , CSVD routine.

    ::

        U, S, V = numpy.linalg.svd(A)
        U, S, V = cvsd(A)

    """
    arg_1, arg_2, arg_3 = numpy.linalg.svd(arg_0)
    return arg_1, arg_2, arg_3

SVD decomposition using numpy . linalg . svd


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . size / arg_1 arg_0 = np . reshape ( arg_0 , ( arg_2 , arg_1 ) ) return np . mean ( arg_0 , axis = 1 )

def Func(arg_0,arg_1):
    '''
    Returns central frequency of each coarse channel

    Parameters
    ----------
    freqs : 1D Array (float)
        Frequency values for each bin of the spectrum
    chan_per_coarse: int
        Number of frequency bins per coarse channel
    '''

    arg_2 = arg_0.size/arg_1
    arg_0 = np.reshape(arg_0,(arg_2,arg_1))
    return np.mean(arg_0,axis=1)


def Func(arg_0, arg_1, arg_2=True):
        """Send success or error message to configured confirmation

        :param str message: Body message to send
        :param bool success: Device executed successfully to personalize message
        :return: None
        """
        arg_1 = arg_1.strip()
        if not arg_0.confirmation:
            return
        try:
            arg_0.confirmation.send(arg_1, arg_2)
        except Exception as e:
            logger.warning('Error sending confirmation on device {}: {}'.format(arg_0.name, e))


def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Save a notebook.

        Returns a validation message.
        """
        arg_4 = from_dict(arg_2['content'])
        arg_0.check_and_sign(arg_4, arg_3)
        save_file(
            arg_1,
            arg_0.user_id,
            arg_3,
            writes_base64(arg_4),
            arg_0.crypto.encrypt,
            arg_0.max_file_size_bytes,
        )
        # It's awkward that this writes to the model instead of returning.
        arg_0.validate_notebook_model(arg_2)
        return arg_2.get('message')


def Func ( arg_0 , * arg_1 ) : arg_0 . data = [ gate . Func ( arg_1 ) for gate in arg_0 . data ] return arg_0

def Func(arg_0, *arg_1):
        """Add controls to this gate."""
        arg_0.data = [gate.Func(arg_1) for gate in arg_0.data]
        return arg_0


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_2 is None : arg_2 = { } arg_0 . available_events [ arg_1 ] = { 'metadata' : arg_2 , 'subscribers' : set ( ) , }

def Func(arg_0, arg_1, arg_2):
        """
        Add an available event.

        name -- name of the event
        metadata -- event metadata, i.e. type, description, etc., as a dict
        """
        if arg_2 is None:
            arg_2 = {}

        arg_0.available_events[arg_1] = {
            'metadata': arg_2,
            'subscribers': set(),
        }


def Func ( arg_0 , arg_1 = False ) : arg_0 = expanduser ( arg_0 ) arg_0 = expandvars ( arg_0 ) if arg_1 : arg_0 = realpath ( arg_0 ) else : arg_0 = abspath ( arg_0 ) arg_0 = normpath ( arg_0 ) return arg_0

def Func(arg_0, arg_1=False):
    """
    Normalizes a string representation of a path and does shell-like expansion.

    Args:
        path (PathLike): string representation of a path
        real (bool): if True, all symbolic links are followed. (default: False)

    Returns:
        PathLike : normalized path

    Note:
        This function is similar to the composition of expanduser, expandvars,
        normpath, and (realpath if `real` else abspath). However, on windows
        backslashes are then replaced with forward slashes to offer a
        consistent unix-like experience across platforms.

        On windows expanduser will expand environment variables formatted as
        %name%, whereas on unix, this will not occur.

    CommandLine:
        python -m ubelt.util_path Func

    Example:
        >>> import ubelt as ub
        >>> assert ub.Func('~/foo') == join(ub.userhome(), 'foo')
        >>> assert ub.Func('~/foo') == ub.Func('~/foo/bar/..')
        >>> assert ub.Func('~/foo', real=True) == ub.Func('~/foo')
    """
    arg_0 = expanduser(arg_0)
    arg_0 = expandvars(arg_0)
    if arg_1:
        arg_0 = realpath(arg_0)
    else:
        arg_0 = abspath(arg_0)
    arg_0 = normpath(arg_0)
    return arg_0

Normalizes a string representation of a path and does shell-like expansion.

    Args:
        path (PathLike): string representation of a path
        real (bool): if True, all symbolic links are followed. (default: False)

    Returns:
        PathLike : normalized path

    Note:
        This function is similar to the composition of expanduser, expandvars,
        normpath, and (realpath if `real` else abspath). However, on windows
        backslashes are then replaced with forward slashes to offer a
        consistent unix-like experience across platforms.

        On windows expanduser will expand environment variables formatted as
        %name%, whereas on unix, this will not occur.

    CommandLine:
        python -m ubelt.util_path truepath

    Example:
        >>> import ubelt as ub
        >>> assert ub.truepath('~/foo') == join(ub.userhome(), 'foo')
        >>> assert ub.truepath('~/foo') == ub.truepath('~/foo/bar/..')
        >>> assert ub.truepath('~/foo', real=True) == ub.truepath('~/foo')

Normalizes a string representation of a path and does shell - like expansion .


return (
            len(term) > 1
            and term[-1] not in self._vowels
            and term[-2] == term[-1]
        )

def Func ( arg_0 , arg_1 ) : return ( len ( arg_1 ) > 1 and arg_1 [ - 1 ] not in arg_0 . _vowels and arg_1 [ - 2 ] == arg_1 [ - 1 ] )

def Func(arg_0, arg_1):
        """Return Porter helper function Func value.

        Parameters
        ----------
        term : str
            The word to check for a final doubled consonant

        Returns
        -------
        bool
            True iff the stem ends in a doubled consonant (as defined in the
            Porter stemmer definition)

        """
        return (
            len(arg_1) > 1
            and arg_1[-1] not in arg_0._vowels
            and arg_1[-2] == arg_1[-1]
        )

Return Porter helper function _ends_in_doubled_cons value.

        Parameters
        ----------
        term : str
            The word to check for a final doubled consonant

        Returns
        -------
        bool
            True iff the stem ends in a doubled consonant (as defined in the
            Porter stemmer definition)

Return Porter helper function _ends_in_doubled_cons value .


def Func(arg_0, **arg_1):
        """
        Generate a guest session id.

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

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


return {prop.get_name(): prop.get_value()
                for prop in self.properties.values()}

def Func ( arg_0 ) : return { arg_1 . get_name ( ) : arg_1 . get_value ( ) for arg_1 in arg_0 . properties . values ( ) }

def Func(arg_0):
        """
        Get a mapping of all properties and their values.

        Returns a dictionary of property_name -> value.
        """
        return {arg_1.get_name(): arg_1.get_value()
                for arg_1 in arg_0.properties.values()}

Get a mapping of all properties and their values .


def Func(arg_0, arg_1="", arg_2=False):
    """
    Given a model, return a representation of the model in a dict.

    This is mostly useful to have a quick visual represenation of the model.

    Args:

        model (PybindBase): Model to transform.
        mode (string): Whether to print config, state or all elements ("" for all)

    Returns:

        dict: A dictionary representing the model.

    Examples:

        >>> config = napalm_yang.base.Root()
        >>>
        >>> # Adding models to the object
        >>> config.add_model(napalm_yang.models.openconfig_interfaces())
        >>> config.add_model(napalm_yang.models.openconfig_vlan())
        >>> # Printing the model in a human readable format
        >>> pretty_print(napalm_yang.utils.Func(config))
        >>> {
        >>>     "openconfig-interfaces:interfaces [rw]": {
        >>>         "interface [rw]": {
        >>>             "config [rw]": {
        >>>                 "description [rw]": "string",
        >>>                 "enabled [rw]": "boolean",
        >>>                 "mtu [rw]": "uint16",
        >>>                 "name [rw]": "string",
        >>>                 "type [rw]": "identityref"
        >>>             },
        >>>             "hold_time [rw]": {
        >>>                 "config [rw]": {
        >>>                     "down [rw]": "uint32",
        >>>                     "up [rw]": "uint32"
            (trimmed for clarity)
    """

    def is_mode(arg_3, arg_1):
        if arg_1 == "":
            return True
        elif arg_1 == "config":
            return arg_3._yang_name == "config" or arg_3._is_config
        elif arg_1 == "state":
            return arg_3._yang_name == "state" or not arg_3._is_config
        else:
            raise ValueError(
                "mode can only be config, state or ''. Passed: {}".format(arg_1)
            )

    def arg_11(arg_4, arg_0, arg_5, arg_2):
        if not arg_2:
            # No need to display rw/ro when showing the defaults.
            arg_4 = "{} {}".format(arg_4, "[rw]" if arg_0._is_config else "[ro]")
        if arg_5 != arg_0._defining_module:
            arg_4 = "{}:{}".format(arg_0._defining_module, arg_4)
        return arg_4

    if arg_0._yang_type in ("container", "list"):
        arg_6 = arg_0 if arg_0._yang_type in ("container",) else arg_0._contained_class()
        arg_7 = {}
        for arg_8, arg_9 in arg_6:
            arg_10 = Func(arg_9, arg_1=arg_1, arg_2=arg_2)
            if arg_10:
                arg_7[arg_11(arg_8, arg_9, arg_0._defining_module, arg_2)] = arg_10
        return arg_7
    else:
        if arg_2:
            if arg_0._default is False:
                if arg_0._yang_type != "boolean":
                    # Unless the datatype is bool, when the _default attribute
                    # is False, it means there is not default value defined in
                    # the YANG model.
                    return None
            return arg_0._default
        return arg_0._yang_type if is_mode(arg_0, arg_1) else None

Given a model, return a representation of the model in a dict.

    This is mostly useful to have a quick visual represenation of the model.

    Args:

        model (PybindBase): Model to transform.
        mode (string): Whether to print config, state or all elements ("" for all)

    Returns:

        dict: A dictionary representing the model.

    Examples:

        >>> config = napalm_yang.base.Root()
        >>>
        >>> # Adding models to the object
        >>> config.add_model(napalm_yang.models.openconfig_interfaces())
        >>> config.add_model(napalm_yang.models.openconfig_vlan())
        >>> # Printing the model in a human readable format
        >>> pretty_print(napalm_yang.utils.model_to_dict(config))
        >>> {
        >>>     "openconfig-interfaces:interfaces [rw]": {
        >>>         "interface [rw]": {
        >>>             "config [rw]": {
        >>>                 "description [rw]": "string",
        >>>                 "enabled [rw]": "boolean",
        >>>                 "mtu [rw]": "uint16",
        >>>                 "name [rw]": "string",
        >>>                 "type [rw]": "identityref"
        >>>             },
        >>>             "hold_time [rw]": {
        >>>                 "config [rw]": {
        >>>                     "down [rw]": "uint32",
        >>>                     "up [rw]": "uint32"
            (trimmed for clarity)

Given a model return a representation of the model in a dict .


def Func(arg_0, arg_1=200):
        """230v power on"""
        if arg_0.__Func_port is None:
            cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_ON")
            return 1

        return arg_0.__press(arg_0.__Func_port, arg_1=arg_1)


def
Func
(
arg_0
:
arg_1
)
->
LispReaderForm
:
arg_2
=
arg_0
.
reader
arg_3
=
arg_2
.
peek
(
)
if
arg_3
==
"("
:
return
_read_list
(
arg_0
)
elif
arg_3
==
"["
:
return
_read_vector
(
arg_0
)
elif
arg_3
==
"{"
:
return
_read_map
(
arg_0
)
elif
begin_num_chars
.
match
(
arg_3
)
:
return
_read_num
(
arg_0
)
elif
whitespace_chars
.
match
(
arg_3
)
:
arg_2
.
next_token
(
)
return
Func
(
arg_0
)
elif
arg_3
==
":"
:
return
_read_kw
(
arg_0
)
elif
arg_3
==
'"'
:
return
_read_str
(
arg_0
)
elif
arg_3
==
"'"
:
return
_read_quoted
(
arg_0
)
elif
arg_3
==
"\\"
:
return
_read_character
(
arg_0
)
elif
ns_name_chars
.
match
(
arg_3
)
:
return
_read_sym
(
arg_0
)
elif
arg_3
==
"#"
:
return
_read_reader_macro
(
arg_0
)
elif
arg_3
==
"^"
:
return
_read_meta
(
arg_0
)
elif
arg_3
==
";"
:
return
_read_comment
(
arg_0
)
elif
arg_3
==
"`"
:
return
_read_syntax_quoted
(
arg_0
)
elif
arg_3
==
"~"
:
return
_read_unquote
(
arg_0
)
elif
arg_3
==
"@"
:
return
_read_deref
(
arg_0
)
elif
arg_3
==
""
:
return
arg_0
.
eof
else
:
raise
SyntaxError
(
"Unexpected token '{token}'"
.
format
(
arg_3
=
arg_3
)
)

def Func(arg_0: arg_1) -> LispReaderForm:  # noqa: C901
    """Read the next full form from the input stream."""
    arg_2 = arg_0.reader
    arg_3 = arg_2.peek()
    if arg_3 == "(":
        return _read_list(arg_0)
    elif arg_3 == "[":
        return _read_vector(arg_0)
    elif arg_3 == "{":
        return _read_map(arg_0)
    elif begin_num_chars.match(arg_3):
        return _read_num(arg_0)
    elif whitespace_chars.match(arg_3):
        arg_2.next_token()
        return Func(arg_0)
    elif arg_3 == ":":
        return _read_kw(arg_0)
    elif arg_3 == '"':
        return _read_str(arg_0)
    elif arg_3 == "'":
        return _read_quoted(arg_0)
    elif arg_3 == "\\":
        return _read_character(arg_0)
    elif ns_name_chars.match(arg_3):
        return _read_sym(arg_0)
    elif arg_3 == "#":
        return _read_reader_macro(arg_0)
    elif arg_3 == "^":
        return _read_meta(arg_0)  # type: ignore
    elif arg_3 == ";":
        return _read_comment(arg_0)
    elif arg_3 == "`":
        return _read_syntax_quoted(arg_0)
    elif arg_3 == "~":
        return _read_unquote(arg_0)
    elif arg_3 == "@":
        return _read_deref(arg_0)
    elif arg_3 == "":
        return arg_0.eof
    else:
        raise SyntaxError("Unexpected token '{token}'".format(arg_3=arg_3))

Read the next full form from the input stream .


def Func ( arg_0 , * arg_1 , ** arg_2 ) : arg_3 = string . Template ( * arg_1 , ** arg_2 ) for arg_4 in arg_0 : yield arg_3 . Func ( arg_4 )

def Func(arg_0, *arg_1, **arg_2):
    '''alias of string.Template.Func'''
    arg_3 = string.Template(*arg_1, **arg_2)
    for arg_4 in arg_0:
        yield arg_3.Func(arg_4)

alias of string . Template . safe_substitute


def Func ( arg_0 , arg_1 = False ) : arg_2 = os . path . join ( os . path . dirname ( os . path . abspath ( __file__ ) ) , 'project_templates' , ) for arg_3 in os . listdir ( arg_2 ) : if ( arg_1 and arg_3 == 'event.json' ) or arg_3 . endswith ( '.pyc' ) : continue arg_4 = os . path . join ( arg_2 , arg_3 ) if not os . path . isdir ( arg_4 ) : copy ( arg_4 , arg_0 )

def Func(arg_0, arg_1=False):
    """Copies template files to a given directory.

    :param str src:
        The path to output the template lambda project files.
    :param bool minimal:
        Minimal possible template files (excludes event.json).
    """

    arg_2 = os.path.join(
        os.path.dirname(os.path.abspath(__file__)), 'project_templates',
    )
    for arg_3 in os.listdir(arg_2):
        if (arg_1 and arg_3 == 'event.json') or arg_3.endswith('.pyc'):
            continue
        arg_4 = os.path.join(arg_2, arg_3)

        if not os.path.isdir(arg_4):
            copy(arg_4, arg_0)

Copies template files to a given directory .


def
Func
(
arg_0
)
:
if
arg_0
.
is_shutdown
(
)
:
return
while
len
(
arg_0
.
_states
)
==
0
:
if
arg_0
.
running
==
0
:
return
if
arg_0
.
is_shutdown
(
)
:
return
logger
.
debug
(
"Waiting for available states"
)
arg_0
.
_lock
.
wait
(
)
arg_1
=
arg_0
.
_policy
.
choice
(
list
(
arg_0
.
_states
)
)
if
arg_1
is
:
return
del
arg_0
.
_states
[
arg_0
.
_states
.
index
(
arg_1
)
]
return
arg_1

def Func(arg_0):
        """ Dequeue a state with the max priority """

        # A shutdown has been requested
        if arg_0.is_shutdown():
            return None

        # if not more states in the queue, let's wait for some forks
        while len(arg_0._states) == 0:
            # if no worker is running, bail out
            if arg_0.running == 0:
                return None
            # if a shutdown has been requested, bail out
            if arg_0.is_shutdown():
                return None
            # if there ares actually some workers running, wait for state forks
            logger.debug("Waiting for available states")
            arg_0._lock.wait()

        arg_1 = arg_0._policy.choice(list(arg_0._states))
        if arg_1 is None:
            return None
        del arg_0._states[arg_0._states.index(arg_1)]
        return arg_1


def Func(arg_0, arg_1):
        """Remove item from the roster.

        :Parameters:
            - `jid`: JID of the item to remove
        :Types:
            - `jid`: `JID`
        """
        if arg_1 not in arg_0._jids:
            raise KeyError(arg_1)
        arg_2 = arg_0._jids[arg_1]
        for arg_3 in range(arg_2, len(arg_0._jids)):
            arg_0._jids[arg_0._items[arg_3].jid] -= 1
        del arg_0._jids[arg_1]
        del arg_0._items[arg_2]


def Func ( arg_0 ) : if len ( arg_0 . _queue ) == 0 : time . sleep ( 0.1 ) return arg_1 = arg_0 . _queue . pop ( 0 ) if arg_1 . canSend ( ) : arg_0 . _sendMsg ( arg_1 ) arg_1 . refresh ( ) if not ( arg_1 . isFinished ( ) ) : arg_0 . _queue . append ( arg_1 ) else : arg_0 . _queue . append ( arg_1 ) time . sleep ( 0.01 )

def Func(arg_0):
        """Method sleeps, if nothing to do"""
        if len(arg_0._queue) == 0:
            time.sleep(0.1)
            return
        arg_1 = arg_0._queue.pop(0)
        if arg_1.canSend():
            arg_0._sendMsg(arg_1)
            arg_1.refresh()
            if not (arg_1.isFinished()):
                arg_0._queue.append(arg_1)
        else:
            arg_0._queue.append(arg_1)
            time.sleep(0.01)


def Func ( arg_0 ) : arg_1 = numpy . asarray ( ImageOps . grayscale ( arg_0 ) ) . astype ( numpy . float ) arg_2 = arg_0 . getbands ( ) arg_3 = None if 'A' in arg_2 : arg_3 = numpy . asarray ( arg_0 . split ( ) [ - 1 ] ) . astype ( numpy . float ) return arg_1 , arg_3

def Func(arg_0):
    """Convert PIL image to numpy grayscale array and numpy alpha array.

    Args:
      img (PIL.Image): PIL Image object.

    Returns:
      (gray, alpha): both numpy arrays.
    """
    arg_1 = numpy.asarray(ImageOps.grayscale(arg_0)).astype(numpy.float)

    arg_2 = arg_0.getbands()
    arg_3 = None
    if 'A' in arg_2:
        arg_3 = numpy.asarray(arg_0.split()[-1]).astype(numpy.float)

    return arg_1, arg_3

Convert PIL image to numpy grayscale array and numpy alpha array .


def Func(arg_0, arg_1):
    """
    This function gives us the option to emit errors or warnings
    after sake upgrades
    """
    arg_2 = arg_1["sprint"]
    arg_3 = arg_1["error"]

    arg_2("checking .shastore version for potential incompatibilities",
           level="verbose")
    if not arg_0 or 'sake version' not in arg_0:
        arg_4 = ["Since you've used this project last, a new version of ",
                  "sake was installed that introduced backwards incompatible",
                  " changes. Run 'sake clean', and rebuild before continuing\n"]
        arg_4 = " ".join(arg_4)
        arg_3(arg_4)
        sys.exit(1)


return round(h, 3), round(s, 3), round(v, 3)

def Func(arg_0):
    """
    Convert an RGB color representation to an HSV color representation.

    (r, g, b) :: r -> [0, 255]
                 g -> [0, 255]
                 b -> [0, 255]

    :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value.
    :return: HSV representation of the input RGB value.
    :rtype: tuple
    """
    arg_1, arg_2, arg_3 = arg_0[0] / 255, arg_0[1] / 255, arg_0[2] / 255
    arg_4 = min(arg_1, arg_2, arg_3)
    arg_5 = max(arg_1, arg_2, arg_3)
    arg_6 = arg_5
    arg_7 = arg_5 - arg_4

    if arg_5 == 0:
        return 0, 0, arg_6

    arg_8 = arg_7 / arg_5

    if arg_7 == 0:
        arg_7 = 1

    if arg_1 == arg_5:
        arg_9 = 60 * (((arg_2 - arg_3) / arg_7) % 6)

    elif arg_2 == arg_5:
        arg_9 = 60 * (((arg_3 - arg_1) / arg_7) + 2)

    else:
        arg_9 = 60 * (((arg_1 - arg_2) / arg_7) + 4)

    return round(arg_9, 3), round(arg_8, 3), round(arg_6, 3)

Convert an RGB color representation to an HSV color representation .


def Func(arg_0, arg_1, arg_2=None):
        """Returns a signed string serialized with the internal serializer.
        The return value can be either a byte or unicode string depending
        on the format of the internal serializer.
        """
        arg_3 = want_bytes(arg_0.dump_payload(arg_1))
        arg_4 = arg_0.make_signer(arg_2).sign(arg_3)
        if arg_0.is_text_serializer:
            arg_4 = arg_4.decode('utf-8')
        return arg_4

Returns a signed string serialized with the internal serializer . The return value can be either a byte or unicode string depending on the format of the internal serializer .


def
Func
(
arg_0
,
arg_1
)
:
from
logging
.
handlers
import
SysLogHandler
arg_2
=
logging
.
Formatter
(
os
.
path
.
basename
(
sys
.
argv
[
0
]
)
+
".%(name)s %(levelname)s - %(message)s"
)
arg_3
=
SysLogHandler
.
LOG_DAEMON
arg_4
=
SysLogHandler
(
address
=
'/dev/log'
,
arg_3
=
arg_3
)
arg_4
.
setFormatter
(
arg_2
)
log
.
addHandler
(
arg_4
)
if
not
arg_0
:
arg_5
=
logging
.
StreamHandler
(
)
arg_5
.
setFormatter
(
arg_2
)
log
.
addHandler
(
arg_5
)
log
.
setLevel
(
logging
.
INFO
)
if
arg_1
:
log
.
setLevel
(
logging
.
DEBUG
)

def Func( arg_0, arg_1 ):
   '''
   setup system logging to desired verbosity.
   '''
   from logging.handlers import SysLogHandler
   arg_2 = logging.Formatter( os.path.basename(sys.argv[0]) +
         ".%(name)s %(levelname)s - %(message)s")
   arg_3 = SysLogHandler.LOG_DAEMON
   arg_4 = SysLogHandler(address='/dev/log',arg_3=arg_3)
   arg_4.setFormatter( arg_2 )
   log.addHandler(arg_4)
   if not arg_0:
      arg_5 = logging.StreamHandler()
      arg_5.setFormatter( arg_2 )
      log.addHandler(arg_5)
      log.setLevel(logging.INFO)
      if arg_1:
         log.setLevel(logging.DEBUG)

setup system logging to desired verbosity .


def Func(arg_0, arg_1):
        """
        Get a property's value.

        property_name -- the property to get the value of

        Returns the properties value, if found, else None.
        """
        arg_2 = arg_0.find_property(arg_1)
        if arg_2:
            return arg_2.get_value()

        return None


A set of integers representing the weekdays the schedule recurs on,
        with Monday = 0 and Sunday = 6.

return set(int(d) - 1 for d in self.root.xpath('days/day/text()'))

def Func ( arg_0 ) : if not arg_0 . root . xpath ( 'days' ) : return set ( range ( 7 ) ) return set ( int ( arg_1 ) - 1 for arg_1 in arg_0 . root . xpath ( 'days/day/text()' ) )

def Func(arg_0):
        """A set of integers representing the Func the schedule recurs on,
        with Monday = 0 and Sunday = 6."""
        if not arg_0.root.xpath('days'):
            return set(range(7))
        return set(int(arg_1) - 1 for arg_1 in arg_0.root.xpath('days/day/text()'))

A set of integers representing the weekdays the schedule recurs on with Monday = 0 and Sunday = 6 .


def Func ( arg_0 , arg_1 = 8 ) : with open ( arg_0 , 'rb' ) as f : arg_2 = Image . open ( f ) . resize ( ( arg_1 , arg_1 ) , Image . ANTIALIAS ) . convert ( 'L' ) arg_3 = list ( arg_2 . getdata ( ) ) arg_4 = sum ( arg_3 ) / len ( arg_3 ) arg_5 = "" . join ( map ( lambda pixel : '1' if pixel > arg_4 else '0' , arg_3 ) ) arg_6 = "0{hashlength}x" . format ( hashlength = arg_1 ** 2 // 4 ) return int ( arg_5 , 2 ) . __format__ ( arg_6 )

def Func(arg_0, arg_1=8):
    """ Compute the average hash of the given image. """
    with open(arg_0, 'rb') as f:
        # Open the image, resize it and convert it to black & white.
        arg_2 = Image.open(f).resize((arg_1, arg_1), Image.ANTIALIAS).convert('L')
        arg_3 = list(arg_2.getdata())

    arg_4 = sum(arg_3) / len(arg_3)

    # Compute the hash based on each pixels value compared to the average.
    arg_5 = "".join(map(lambda pixel: '1' if pixel > arg_4 else '0', arg_3))
    arg_6 = "0{hashlength}x".format(hashlength=arg_1 ** 2 // 4)
    return int(arg_5, 2).__format__(arg_6)

Compute the average hash of the given image .


def
Func
(
arg_0
,
arg_1
)
:
if
not
isinstance
(
arg_0
,
dict
)
:
raise
TypeError
(
"config must be a dictionary"
)
for
arg_2
,
arg_3
in
arg_1
:
if
arg_2
not
in
arg_0
:
raise
ValueError
(
"%s not given"
%
arg_2
)
if
not
isinstance
(
arg_0
[
arg_2
]
,
arg_3
)
:
raise
TypeError
(
"%s must be %s"
%
(
arg_2
,
arg_3
)
)
return
True

def Func(arg_0, arg_1):
    """
    Validate whether value is found in config and has the right type.

    Parameters
    ----------
    config : dict
        configuration dictionary
    values : list
        list of (str, type) tuples of values and value types expected in config

    Returns
    -------
    True if config is valid.

    Raises
    ------
    Exception if value is not found or has the wrong type.
    """
    if not isinstance(arg_0, dict):
        raise TypeError("config must be a dictionary")
    for arg_2, arg_3 in arg_1:
        if arg_2 not in arg_0:
            raise ValueError("%s not given" % arg_2)
        if not isinstance(arg_0[arg_2], arg_3):
            raise TypeError("%s must be %s" % (arg_2, arg_3))
    return True

Validate whether value is found in config and has the right type .


def Func(arg_0, arg_1):
        """
        Select the best remaining hardware qubit for the next program qubit.
        """
        arg_2 = {}
        for arg_3 in arg_0.available_hw_qubits:
            arg_4 = 1
            for arg_5 in arg_0.prog_graph.neighbors(arg_1):
                if arg_5 in arg_0.prog2hw:
                    arg_4 *= arg_0.swap_costs[arg_0.prog2hw[arg_5]][arg_3]
            arg_4 *= arg_0.readout_errors[arg_3]
            arg_2[arg_3] = arg_4
        arg_6 = 0
        arg_7 = None
        for arg_3 in arg_2:
            if arg_2[arg_3] > arg_6:
                arg_6 = arg_2[arg_3]
                arg_7 = arg_3
        return arg_7

Select the best remaining hardware qubit for the next program qubit .


def Func ( arg_0 , arg_1 , * arg_2 ) : if isinstance ( arg_1 , basestring ) : return arg_0 . exe . Func ( arg_1 , * arg_2 ) elif isinstance ( arg_1 , list ) : arg_0 . _Func_statement_list ( arg_1 ) else : return getattr ( arg_0 , arg_1 [ 'type' ] ) ( ** arg_1 )

def Func(arg_0, arg_1, *arg_2):
        ''' what can be either name of the op, or node, or a list of statements.'''
        if isinstance(arg_1, basestring):
            return arg_0.exe.Func(arg_1, *arg_2)
        elif isinstance(arg_1, list):
            arg_0._Func_statement_list(arg_1)
        else:
            return getattr(arg_0, arg_1['type'])(**arg_1)

what can be either name of the op or node or a list of statements .


def Func(arg_0):
    """Error handler function. Translates an error code into an exception."""
    if type(arg_0) is c_int:
        arg_0 = arg_0.value
    if arg_0 == 0:
        pass  # no error
    elif arg_0 == -1:
        raise TimeoutError("the operation failed due to a timeout.")
    elif arg_0 == -2:
        raise LostError("the stream has been lost.")
    elif arg_0 == -3:
        raise InvalidArgumentError("an argument was incorrectly specified.")
    elif arg_0 == -4:
        raise InternalError("an internal error has occurred.")
    elif arg_0 < 0:
        raise RuntimeError("an unknown error has occurred.")

Error handler function . Translates an error code into an exception .


def Func ( arg_0 , arg_1 ) : arg_0 . _genes . discard ( arg_1 ) arg_1 . _reaction . discard ( arg_0 )

def Func(arg_0, arg_1):
        """Dissociates a cobra.Gene object with a cobra.Reaction.

        Parameters
        ----------
        cobra_gene : cobra.core.Gene.Gene

        """
        arg_0._genes.discard(arg_1)
        arg_1._reaction.discard(arg_0)

Dissociates a cobra . Gene object with a cobra . Reaction .


def Func ( arg_0 , arg_1 , arg_2 ) : with arg_0 . engine . begin ( ) as db : try : if arg_0 . file_exists ( arg_1 ) : Func ( db , arg_0 . user_id , arg_1 , arg_2 ) elif arg_0 . dir_exists ( arg_1 ) : rename_directory ( db , arg_0 . user_id , arg_1 , arg_2 ) else : arg_0 . no_such_entity ( arg_2 ) except ( FileExists , DirectoryExists ) : arg_0 . already_exists ( arg_2 ) except RenameRoot as e : arg_0 . do_409 ( str ( e ) )

def Func(arg_0, arg_1, arg_2):
        """
        Rename object from old_path to path.

        NOTE: This method is unfortunately named on the base class.  It
        actually moves a file or a directory.
        """
        with arg_0.engine.begin() as db:
            try:
                if arg_0.file_exists(arg_1):
                    Func(db, arg_0.user_id, arg_1, arg_2)
                elif arg_0.dir_exists(arg_1):
                    rename_directory(db, arg_0.user_id, arg_1, arg_2)
                else:
                    arg_0.no_such_entity(arg_2)
            except (FileExists, DirectoryExists):
                arg_0.already_exists(arg_2)
            except RenameRoot as e:
                arg_0.do_409(str(e))


def Func ( arg_0 , arg_1 , arg_2 = False ) : arg_1 = _normalize_cached ( arg_1 ) if os . path . isdir ( arg_1 ) and os . access ( arg_1 , os . R_OK ) : if arg_1 . lower ( ) . endswith ( '.egg' ) : yield Distribution . from_filename ( arg_1 , arg_6 = PathMetadata ( arg_1 , os . path . join ( arg_1 , 'EGG-INFO' ) ) ) else : for arg_3 in os . listdir ( arg_1 ) : arg_4 = arg_3 . lower ( ) if arg_4 . endswith ( '.egg-info' ) or arg_4 . endswith ( '.dist-info' ) : arg_5 = os . path . join ( arg_1 , arg_3 ) if os . path . isdir ( arg_5 ) : arg_6 = PathMetadata ( arg_1 , arg_5 ) else : arg_6 = FileMetadata ( arg_5 ) yield Distribution . from_location ( arg_1 , arg_3 , arg_6 , precedence = DEVELOP_DIST ) elif not arg_2 and arg_4 . endswith ( '.egg' ) : arg_7 = find_distributions ( os . path . join ( arg_1 , arg_3 ) ) for arg_8 in arg_7 : yield arg_8 elif not arg_2 and arg_4 . endswith ( '.egg-link' ) : with open ( os . path . join ( arg_1 , arg_3 ) ) as entry_file : arg_9 = entry_file . readlines ( ) for arg_10 in arg_9 : if not arg_10 . strip ( ) : continue arg_11 = os . path . join ( arg_1 , arg_10 . rstrip ( ) ) arg_7 = find_distributions ( arg_11 ) for arg_12 in arg_7 : yield arg_12 break

def Func(arg_0, arg_1, arg_2=False):
    """Yield distributions accessible on a sys.path directory"""
    arg_1 = _normalize_cached(arg_1)

    if os.path.isdir(arg_1) and os.access(arg_1, os.R_OK):
        if arg_1.lower().endswith('.egg'):
            # unpacked egg
            yield Distribution.from_filename(
                arg_1, arg_6=PathMetadata(
                    arg_1, os.path.join(arg_1,'EGG-INFO')
                )
            )
        else:
            # scan for .egg and .egg-info in directory
            for arg_3 in os.listdir(arg_1):
                arg_4 = arg_3.lower()
                if arg_4.endswith('.egg-info') or arg_4.endswith('.dist-info'):
                    arg_5 = os.path.join(arg_1, arg_3)
                    if os.path.isdir(arg_5):
                        # egg-info directory, allow getting metadata
                        arg_6 = PathMetadata(arg_1, arg_5)
                    else:
                        arg_6 = FileMetadata(arg_5)
                    yield Distribution.from_location(
                        arg_1, arg_3, arg_6, precedence=DEVELOP_DIST
                    )
                elif not arg_2 and arg_4.endswith('.egg'):
                    arg_7 = find_distributions(os.path.join(arg_1, arg_3))
                    for arg_8 in arg_7:
                        yield arg_8
                elif not arg_2 and arg_4.endswith('.egg-link'):
                    with open(os.path.join(arg_1, arg_3)) as entry_file:
                        arg_9 = entry_file.readlines()
                    for arg_10 in arg_9:
                        if not arg_10.strip():
                            continue
                        arg_11 = os.path.join(arg_1, arg_10.rstrip())
                        arg_7 = find_distributions(arg_11)
                        for arg_12 in arg_7:
                            yield arg_12
                        break

Yield distributions accessible on a sys . path directory


return hasattr(l, '__iter__') \
           or (type(l) in (types.ListType, types.TupleType))

def Func ( arg_0 ) : return hasattr ( arg_0 , '__iter__' ) or ( type ( arg_0 ) in ( types . ListType , types . TupleType ) )

def Func(arg_0):
    """Convenience method that works with all 2.x versions of Python
    to determine whether or not something is listlike."""
    return hasattr(arg_0, '__iter__') \
           or (type(arg_0) in (types.ListType, types.TupleType))

Convenience method that works with all 2 . x versions of Python to determine whether or not something is listlike .


def Func():
    """Command line entrypoint to reduce technote metadata.
    """
    arg_0 = argparse.ArgumentParser(
        description='Discover and ingest metadata from document sources, '
                    'including lsstdoc-based LaTeX documents and '
                    'reStructuredText-based technotes. Metadata can be '
                    'upserted into the LSST Projectmeta MongoDB.')
    arg_0.add_argument(
        '--ltd-product',
        dest='ltd_product_url',
        help='URL of an LSST the Docs product '
             '(https://keeper.lsst.codes/products/<slug>). If provided, '
             'only this document will be ingested.')
    arg_0.add_argument(
        '--github-token',
        help='GitHub personal access token.')
    arg_0.add_argument(
        '--mongodb-uri',
        help='MongoDB connection URI. If provided, metadata will be loaded '
             'into the Projectmeta database. Omit this argument to just '
             'test the ingest pipeline.')
    arg_0.add_argument(
        '--mongodb-db',
        default='lsstprojectmeta',
        help='Name of MongoDB database')
    arg_0.add_argument(
        '--mongodb-collection',
        default='resources',
        help='Name of the MongoDB collection for projectmeta resources')
    arg_1 = arg_0.parse_args()

    # Configure the root logger
    arg_2 = logging.StreamHandler()
    arg_3 = logging.Formatter(
        '%(asctime)s %(levelname)8s %(name)s | %(message)s')
    arg_2.setFormatter(arg_3)
    arg_4 = logging.getLogger()
    arg_4.addHandler(arg_2)
    arg_4.setLevel(logging.WARNING)
    # Configure app logger
    arg_5 = logging.getLogger('lsstprojectmeta')
    arg_5.setLevel(logging.DEBUG)

    if arg_1.mongodb_uri is not None:
        arg_6 = AsyncIOMotorClient(arg_1.mongodb_uri, ssl=True)
        arg_7 = arg_6[arg_1.mongodb_db][arg_1.mongodb_collection]
    else:
        arg_7 = None

    arg_8 = asyncio.get_event_loop()

    if arg_1.ltd_product_url is not None:
        # Run single technote
        arg_8.run_until_complete(run_single_ltd_doc(arg_1.ltd_product_url,
                                                   arg_1.github_token,
                                                   arg_7))
    else:
        # Run bulk technote processing
        arg_8.run_until_complete(run_bulk_etl(arg_1.github_token,
                                             arg_7))

Command line entrypoint to reduce technote metadata .


``True`` if credentials are valid, ``False`` if expired.

def Func ( arg_0 ) : if arg_0 . expiration_time : return arg_0 . expiration_time > int ( time . time ( ) ) else : return True

def Func(arg_0):
        """
        ``True`` if credentials are Func, ``False`` if expired.
        """

        if arg_0.expiration_time:
            return arg_0.expiration_time > int(time.time())
        else:
            return True

True if credentials are valid False if expired .


def Func(arg_0, arg_1=None, arg_2=None):
        """Receive a batch of messages at once.

        This approach it optimal if you wish to process multiple messages simultaneously. Note that the
        number of messages retrieved in a single batch will be dependent on
        whether `prefetch` was set for the receiver. This call will prioritize returning
        quickly over meeting a specified batch size, and so will return as soon as at least
        one message is received and there is a gap in incoming messages regardless
        of the specified batch size.

        :param max_batch_size: Maximum number of messages in the batch. Actual number
         returned will depend on prefetch size and incoming stream rate.
        :type max_batch_size: int
        :param timeout: The time to wait in seconds for the first message to arrive.
         If no messages arrive, and no timeout is specified, this call will not return
         until the connection is closed. If specified, an no messages arrive within the
         timeout period, an empty list will be returned.
        :rtype: list[~azure.servicebus.common.message.Message]

        Example:
            .. literalinclude:: ../examples/test_examples.py
                :start-after: [START Func_messages]
                :end-before: [END Func_messages]
                :language: python
                :dedent: 4
                :caption: Get the messages in batch from the receiver

        """
        arg_0._can_run()
        arg_3 = []
        arg_1 = arg_1 or arg_0._handler._prefetch  # pylint: disable=protected-access
        try:
            arg_4 = 1000 * arg_2 if arg_2 else 0
            arg_5 = arg_0._handler.receive_message_batch(
                arg_1=arg_1,
                arg_2=arg_4)
            for arg_6 in arg_5:
                arg_7 = arg_0._build_message(arg_6)
                arg_3.append(arg_7)
        except Exception as e:  # pylint: disable=broad-except
            arg_0._handle_exception(e)
        return arg_3

Receive a batch of messages at once.

        This approach it optimal if you wish to process multiple messages simultaneously. Note that the
        number of messages retrieved in a single batch will be dependent on
        whether `prefetch` was set for the receiver. This call will prioritize returning
        quickly over meeting a specified batch size, and so will return as soon as at least
        one message is received and there is a gap in incoming messages regardless
        of the specified batch size.

        :param max_batch_size: Maximum number of messages in the batch. Actual number
         returned will depend on prefetch size and incoming stream rate.
        :type max_batch_size: int
        :param timeout: The time to wait in seconds for the first message to arrive.
         If no messages arrive, and no timeout is specified, this call will not return
         until the connection is closed. If specified, an no messages arrive within the
         timeout period, an empty list will be returned.
        :rtype: list[~azure.servicebus.common.message.Message]

        Example:
            .. literalinclude:: ../examples/test_examples.py
                :start-after: [START fetch_next_messages]
                :end-before: [END fetch_next_messages]
                :language: python
                :dedent: 4
                :caption: Get the messages in batch from the receiver


(im, radius=2.5, noise_size=1., bkg_size=None,
        minmass=1., trim_edge=False)

def
Func
(
arg_0
,
arg_1
=
2.5
,
arg_2
=
1.
,
arg_3
=
,
arg_4
=
1.
,
arg_5
=
False
)
:
if
arg_1
<=
0
:
raise
ValueError
(
'`radius` must be > 0'
)
arg_6
=
nd
.
gaussian_filter
(
arg_0
,
arg_2
,
mode
=
'mirror'
)
if
arg_3
is
:
arg_3
=
2
*
arg_1
arg_6
-=
nd
.
gaussian_filter
(
arg_6
,
arg_3
,
mode
=
'mirror'
)
arg_7
=
generate_sphere
(
arg_1
)
arg_8
=
nd
.
maximum_filter
(
arg_6
,
arg_7
=
arg_7
)
arg_9
=
nd
.
convolve
(
arg_6
,
arg_7
,
mode
=
'mirror'
)
arg_10
=
(
arg_8
==
arg_6
)
*
(
arg_9
>
arg_4
)
arg_11
=
np
.
transpose
(
np
.
nonzero
(
arg_10
)
)
if
arg_5
:
arg_12
=
np
.
all
(
arg_11
>
0
,
axis
=
1
)
&
np
.
all
(
arg_11
+
1
<
arg_0
.
shape
,
axis
=
1
)
arg_11
=
arg_11
[
arg_12
,
:
]
.
copy
(
)
arg_13
=
arg_9
[
arg_11
[
:
,
0
]
,
arg_11
[
:
,
1
]
,
arg_11
[
:
,
2
]
]
.
copy
(
)
return
arg_11
,
arg_13

def Func(arg_0, arg_1=2.5, arg_2=1., arg_3=None,
        arg_4=1., arg_5=False):
    """Local max featuring to identify bright spherical particles on a
    dark background.

    Parameters
    ----------
        im : numpy.ndarray
            The image to identify particles in.
        radius : Float > 0, optional
            Featuring radius of the particles. Default is 2.5
        noise_size : Float, optional
            Size of Gaussian kernel for smoothing out noise. Default is 1.
        bkg_size : Float or None, optional
            Size of the Gaussian kernel for removing long-wavelength
            background. Default is None, which gives `2 * radius`
        minmass : Float, optional
            Return only particles with a ``mass > minmass``. Default is 1.
        trim_edge : Bool, optional
            Set to True to omit particles identified exactly at the edge
            of the image. False-positive features frequently occur here
            because of the reflected bandpass featuring. Default is
            False, i.e. find particles at the edge of the image.

    Returns
    -------
        pos, mass : numpy.ndarray
            Particle positions and masses
    """
    if arg_1 <= 0:
        raise ValueError('`radius` must be > 0')
    #1. Remove noise
    arg_6 = nd.gaussian_filter(arg_0, arg_2, mode='mirror')
    #2. Remove long-wavelength background:
    if arg_3 is None:
        arg_3 = 2*arg_1
    arg_6 -= nd.gaussian_filter(arg_6, arg_3, mode='mirror')
    #3. Local max feature
    arg_7 = generate_sphere(arg_1)
    arg_8 = nd.maximum_filter(arg_6, arg_7=arg_7)
    arg_9 = nd.convolve(arg_6, arg_7, mode='mirror')
    arg_10 = (arg_8==arg_6) * (arg_9 > arg_4)
    arg_11 = np.transpose(np.nonzero(arg_10))
    if arg_5:
        arg_12 = np.all(arg_11 > 0, axis=1) & np.all(arg_11+1 < arg_0.shape, axis=1)
        arg_11 = arg_11[arg_12, :].copy()
    arg_13 = arg_9[arg_11[:,0], arg_11[:,1], arg_11[:,2]].copy()
    return arg_11, arg_13

Local max featuring to identify bright spherical particles on a dark background .


return tornado.httpclient.HTTPRequest(url,
            method=self.request.method,
            headers=self.request.headers,
            body=self.request.body if self.request.body else None)

def Func ( arg_0 ) : arg_1 = arg_0 . upstream_url ( arg_0 . request . uri ) return tornado . httpclient . HTTPRequest ( arg_1 , method = arg_0 . request . method , headers = arg_0 . request . headers , body = arg_0 . request . body if arg_0 . request . body else None )

def Func(arg_0):
        "Return request object for calling the upstream"
        arg_1 = arg_0.upstream_url(arg_0.request.uri)
        return tornado.httpclient.HTTPRequest(arg_1,
            method=arg_0.request.method,
            headers=arg_0.request.headers,
            body=arg_0.request.body if arg_0.request.body else None)


def Func(arg_0, arg_1, arg_2='utf-8'):
        """ Save the content of the .txt file in a text file.

        Parameters
        ----------
        file_path: str
            Path to the output file.
        """
        if arg_0.file_content_ is None:
            arg_3 = 'Template content has not been updated. \
                   Please fill the template before rendering it.'
            log.exception(arg_3)
            raise ValueError(arg_3)

        try:
            write_to_file(arg_1, content=arg_0.file_content_,
                          arg_2=arg_2)
        except Exception as exc:
            arg_3 = 'Document of type {} got an error when \
                   writing content.'.format(arg_0.__class__)
            log.exception(arg_3)
            raise Exception(arg_3) from exc

Save the content of the . txt file in a text file .


(self, aggregate_reports,
                                        aggregate_topic)

def Func(arg_0, arg_1,
                                        arg_2):
        """
        Saves aggregate DMARC reports to Kafka

        Args:
            aggregate_reports (list):  A list of aggregate report dictionaries
            to save to Kafka
            aggregate_topic (str): The name of the Kafka topic

        """
        if (type(arg_1) == dict or
           type(arg_1) == OrderedDict):
            arg_1 = [arg_1]

        if len(arg_1) < 1:
            return

        for arg_3 in arg_1:
            arg_3['date_range'] = arg_0.generate_daterange(arg_3)
            arg_3 = arg_0.strip_metadata(arg_3)

            for arg_4 in arg_3['records']:
                arg_4['date_range'] = arg_3['date_range']
                arg_4['org_name'] = arg_3['org_name']
                arg_4['org_email'] = arg_3['org_email']
                arg_4['policy_published'] = arg_3['policy_published']
                arg_4['report_id'] = arg_3['report_id']
                logger.debug("Sending slice.")
                try:
                    logger.debug("Saving aggregate report to Kafka")
                    arg_0.producer.send(arg_2, arg_4)
                except UnknownTopicOrPartitionError:
                    raise KafkaError(
                        "Kafka error: Unknown topic or partition on broker")
                except Exception as e:
                    raise KafkaError(
                        "Kafka error: {0}".format(e.__str__()))
                try:
                    arg_0.producer.flush()
                except Exception as e:
                    raise KafkaError(
                        "Kafka error: {0}".format(e.__str__()))


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : if _ws_download is True : return HttpResponseForbidden ( ) arg_4 = Upload . objects . uploaded ( ) . Func ( arg_2 = arg_2 , name = arg_3 ) return FileResponse ( arg_4 . file , content_type = arg_4 . type )

def Func(arg_0, arg_1, arg_2, arg_3):
        """Download a file."""
        if _ws_download is True:
            return HttpResponseForbidden()
        arg_4 = Upload.objects.uploaded().Func(arg_2=arg_2, name=arg_3)

        return FileResponse(arg_4.file, content_type=arg_4.type)


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = tf . keras . Sequential ( ) for arg_4 in arg_2 : arg_3 . add ( tf . keras . layers . Dense ( arg_4 , arg_0 = arg_0 , kernel_initializer = tf . compat . v1 . glorot_normal_initializer ( ) ) ) arg_3 . add ( tf . keras . layers . Dense ( arg_1 , arg_0 = tf . nn . softplus , kernel_initializer = tf . compat . v1 . glorot_normal_initializer ( ) ) ) def encoder ( arg_5 ) : arg_6 = _clip_dirichlet_parameters ( arg_3 ( arg_5 ) ) return tfd . Dirichlet ( concentration = arg_6 , name = "topics_posterior" ) return encoder

def Func(arg_0, arg_1, arg_2):
  """Create the encoder function.

  Args:
    activation: Activation function to use.
    num_topics: The number of topics.
    layer_sizes: The number of hidden units per layer in the encoder.

  Returns:
    encoder: A `callable` mapping a bag-of-words `Tensor` to a
      `tfd.Distribution` instance over topics.
  """
  arg_3 = tf.keras.Sequential()
  for arg_4 in arg_2:
    arg_3.add(
        tf.keras.layers.Dense(
            arg_4,
            arg_0=arg_0,
            kernel_initializer=tf.compat.v1.glorot_normal_initializer()))
  arg_3.add(
      tf.keras.layers.Dense(
          arg_1,
          arg_0=tf.nn.softplus,
          kernel_initializer=tf.compat.v1.glorot_normal_initializer()))

  def encoder(arg_5):
    arg_6 = _clip_dirichlet_parameters(arg_3(arg_5))
    return tfd.Dirichlet(concentration=arg_6,
                         name="topics_posterior")

  return encoder


return Master(server, manager, workers, loop=loop)

async def Func ( arg_0 = "" , arg_1 = 48484 , * , arg_2 = None ) : arg_2 = arg_2 if arg_2 is not None else asyncio . get_event_loop ( ) arg_3 = jobs . JobManager ( arg_2 = arg_2 ) arg_4 = set ( ) arg_5 = await arg_2 . create_server ( lambda : WorkerProtocol ( arg_3 , arg_4 ) , arg_0 , arg_1 ) return Master ( arg_5 , arg_3 , arg_4 , arg_2 = arg_2 )

async def Func(arg_0="", arg_1=48484, *, arg_2=None):
    """
    Starts a new HighFive master at the given host and port, and returns it.
    """

    arg_2 = arg_2 if arg_2 is not None else asyncio.get_event_loop()

    arg_3 = jobs.JobManager(arg_2=arg_2)
    arg_4 = set()
    arg_5 = await arg_2.create_server(
            lambda: WorkerProtocol(arg_3, arg_4), arg_0, arg_1)
    return Master(arg_5, arg_3, arg_4, arg_2=arg_2)

Starts a new HighFive master at the given host and port and returns it .


return self.get_data(
            "load_balancers/%s/droplets/" % self.id,
            type=DELETE,
            params={"droplet_ids": droplet_ids}
        )

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

def Func(arg_0, arg_1):
        """
        Unassign a LoadBalancer.

        Args:
            droplet_ids (obj:`list` of `int`): A list of Droplet IDs
        """
        return arg_0.get_data(
            "load_balancers/%s/droplets/" % arg_0.id,
            type=DELETE,
            params={"droplet_ids": arg_1}
        )


def
Func
(
arg_0
,
arg_1
=
)
:
if
not
arg_1
:
arg_2
=
(
arg_0
.
valid_modes
.
index
(
arg_0
.
mode
)
+
1
)
%
len
(
arg_0
.
valid_modes
)
arg_0
.
mode
=
arg_0
.
valid_modes
[
arg_2
]
elif
arg_1
not
in
arg_0
.
valid_modes
:
raise
ValueError
,
'Unrecognized mode in FormattedTB: <'
+
arg_1
+
'>\n'
'Valid modes: '
+
str
(
arg_0
.
valid_modes
)
else
:
arg_0
.
mode
=
arg_1
arg_0
.
include_vars
=
(
arg_0
.
mode
==
arg_0
.
valid_modes
[
2
]
)
arg_0
.
tb_join_char
=
arg_0
.
_join_chars
[
arg_0
.
mode
]

def Func(arg_0,arg_1=None):
        """Switch to the desired mode.

        If mode is not specified, cycles through the available modes."""

        if not arg_1:
            arg_2 = ( arg_0.valid_modes.index(arg_0.mode) + 1 ) % \
                      len(arg_0.valid_modes)
            arg_0.mode = arg_0.valid_modes[arg_2]
        elif arg_1 not in arg_0.valid_modes:
            raise ValueError, 'Unrecognized mode in FormattedTB: <'+arg_1+'>\n'\
                  'Valid modes: '+str(arg_0.valid_modes)
        else:
            arg_0.mode = arg_1
        # include variable details only in 'Verbose' mode
        arg_0.include_vars = (arg_0.mode == arg_0.valid_modes[2])
        # Set the join character for generating text tracebacks
        arg_0.tb_join_char = arg_0._join_chars[arg_0.mode]


def Func ( arg_0 ) : arg_1 = arg_0 . file . tell ( ) arg_2 = 0 while True : arg_3 , arg_4 = arg_0 . read ( arg_0 . read_size ) arg_5 = 0 if not arg_3 : break if b'\r\n' in arg_0 . LINE_TERMINATORS and arg_4 [ - 1 ] == b'\r' [ 0 ] : arg_6 = arg_0 . file . tell ( ) arg_7 , arg_8 = arg_0 . read ( 1 ) if arg_7 and arg_8 [ 0 ] == b'\n' [ 0 ] : arg_3 += 1 arg_4 += b'\n' else : arg_0 . file . seek ( arg_6 ) while arg_5 < arg_3 : arg_9 = arg_0 . prefix_line_terminator ( arg_4 [ arg_5 : ] ) if arg_9 : arg_0 . file . seek ( arg_1 + arg_2 + arg_5 + len ( arg_9 ) ) return arg_0 . file . tell ( ) else : arg_5 += 1 arg_2 += arg_3 arg_0 . file . seek ( arg_1 + arg_2 ) return - 1

def Func(arg_0):
        """
        Seek next line relative to the current file position.

        :return: Position of the line or -1 if next line was not found.
        """
        arg_1 = arg_0.file.tell()
        arg_2 = 0

        while True:
            arg_3, arg_4 = arg_0.read(arg_0.read_size)
            arg_5 = 0

            if not arg_3:
                break

            # Consider the following example: Foo\r | \nBar where " | " denotes current position,
            # 'Foo\r' is the read part and '\nBar' is the remaining part.
            # We should completely consume terminator "\r\n" by reading one extra byte.
            if b'\r\n' in arg_0.LINE_TERMINATORS and arg_4[-1] == b'\r'[0]:
                arg_6 = arg_0.file.tell()
                arg_7, arg_8 = arg_0.read(1)

                if arg_7 and arg_8[0] == b'\n'[0]:
                    arg_3 += 1
                    arg_4 += b'\n'
                else:
                    arg_0.file.seek(arg_6)

            while arg_5 < arg_3:
                arg_9 = arg_0.prefix_line_terminator(arg_4[arg_5:])
                if arg_9:
                    arg_0.file.seek(arg_1 + arg_2 + arg_5 + len(arg_9))
                    return arg_0.file.tell()
                else:
                    arg_5 += 1

            arg_2 += arg_3
            arg_0.file.seek(arg_1 + arg_2)

        return -1

Seek next line relative to the current file position .


def Func ( arg_0 ) : arg_1 = arg_0 . default_value if isinstance ( arg_1 , DefaultValueGenerator ) : return arg_1 . generate ( arg_0 . klass ) else : return arg_1

def Func(arg_0):
        """Instantiate a default value instance.

        This is called when the containing HasTraits classes'
        :meth:`__new__` method is called to ensure that a unique instance
        is created for each HasTraits instance.
        """
        arg_1  = arg_0.default_value
        if isinstance(arg_1, DefaultValueGenerator):
            return arg_1.generate(arg_0.klass)
        else:
            return arg_1


(adapter, case_id, hgnc_id=None, chrom=None, start=None, end=None)

def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=None):
    """Load all variants in a region defined by a HGNC id

    Args:
        adapter (MongoAdapter)
        case_id (str): Case id
        hgnc_id (int): If all variants from a gene should be uploaded
        chrom (str): If variants from coordinates should be uploaded
        start (int): Start position for region
        end (int): Stop position for region
    """
    if arg_2:
        arg_6 = arg_0.hgnc_gene(arg_2)
        if not arg_6:
            ValueError("Gene {} does not exist in database".format(arg_2))
        arg_3 = arg_6['chromosome']
        arg_4 = arg_6['start']
        arg_5 = arg_6['end']

    arg_7 = arg_0.case(arg_1=arg_1)
    if not arg_7:
        raise ValueError("Case {} does not exist in database".format(arg_1))

    log.info("Load clinical SNV variants for case: {0} region: chr {1}, start"
             " {2}, end {3}".format(arg_7['_id'], arg_3, arg_4, arg_5))

    arg_0.load_variants(arg_7=arg_7, variant_type='clinical',
                          category='snv', arg_3=arg_3, arg_4=arg_4, arg_5=arg_5)

    arg_8 = arg_7['vcf_files'].get('vcf_sv')
    if arg_8:
        log.info("Load clinical SV variants for case: {0} region: chr {1}, "
                 "start {2}, end {3}".format(arg_7['_id'], arg_3, arg_4, arg_5))
        arg_0.load_variants(arg_7=arg_7, variant_type='clinical',
                              category='sv', arg_3=arg_3, arg_4=arg_4, arg_5=arg_5)

    arg_9 = arg_7['vcf_files'].get('vcf_str')
    if arg_9:
        log.info("Load clinical STR variants for case: {0} region: chr {1}, "
                 "start {2}, end {3}".format(arg_7['_id'], arg_3, arg_4, arg_5))
        arg_0.load_variants(arg_7=arg_7, variant_type='clinical',
                              category='str', arg_3=arg_3, arg_4=arg_4, arg_5=arg_5)

    if arg_7['is_research']:
        log.info("Load research SNV variants for case: {0} region: chr {1}, "
                 "start {2}, end {3}".format(arg_7['_id'], arg_3, arg_4, arg_5))
        arg_0.load_variants(arg_7=arg_7, variant_type='research',
                              category='snv', arg_3=arg_3, arg_4=arg_4, arg_5=arg_5)

        arg_10 = arg_7['vcf_files'].get('vcf_sv_research')
        if arg_10:
            log.info("Load research SV variants for case: {0} region: chr {1},"
                     " start {2}, end {3}".format(arg_7['_id'], arg_3, arg_4, arg_5))
            arg_0.load_variants(arg_7=arg_7, variant_type='research',
                                  category='sv', arg_3=arg_3, arg_4=arg_4, arg_5=arg_5)


def Func(arg_0, arg_1, arg_2):
    """A function that returns the arrival time of the next arrival for
    a Poisson random measure.

    Parameters
    ----------
    t : float
        The start time from which to simulate the next arrival time.
    rate : function
        The *intensity function* for the measure, where ``rate(t)`` is
        the expected arrival rate at time ``t``.
    rate_max : float
        The maximum value of the ``rate`` function.

    Returns
    -------
    out : float
        The time of the next arrival.

    Notes
    -----
    This function returns the time of the next arrival, where the
    distribution of the number of arrivals between times :math:`t` and
    :math:`t+s` is Poisson with mean

    .. math::

       \int_{t}^{t+s} dx \, r(x)

    where :math:`r(t)` is the supplied ``rate`` function. This function
    can only simulate processes that have bounded intensity functions.
    See chapter 6 of [3]_ for more on the mathematics behind Poisson
    random measures; the book's publisher, Springer, has that chapter
    available online for free at (`pdf`_\).

    A Poisson random measure is sometimes called a non-homogeneous
    Poisson process. A Poisson process is a special type of Poisson
    random measure.

    .. _pdf: http://www.springer.com/cda/content/document/\
                cda_downloaddocument/9780387878584-c1.pdf

    Examples
    --------
    Suppose you wanted to model the arrival process as a Poisson
    random measure with rate function :math:`r(t) = 2 + \sin( 2\pi t)`.
    Then you could do so as follows:

    >>> import queueing_tool as qt
    >>> import numpy as np
    >>> np.random.seed(10)
    >>> rate  = lambda t: 2 + np.sin(2 * np.pi * t)
    >>> arr_f = lambda t: qt.Func(t, rate, 3)
    >>> arr_f(1)  # doctest: +ELLIPSIS
    1.491...

    References
    ----------
    .. [3] Cinlar, Erhan. *Probability and stochastics*. Graduate Texts in\
           Mathematics. Vol. 261. Springer, New York, 2011.\
           :doi:`10.1007/978-0-387-87859-1`
    """
    arg_3 = 1.0 / arg_2
    arg_0 = arg_0 + exponential(arg_3)
    while arg_2 * uniform() > arg_1(arg_0):
        arg_0 = arg_0 + exponential(arg_3)
    return arg_0

A function that returns the arrival time of the next arrival for
    a Poisson random measure.

    Parameters
    ----------
    t : float
        The start time from which to simulate the next arrival time.
    rate : function
        The *intensity function* for the measure, where ``rate(t)`` is
        the expected arrival rate at time ``t``.
    rate_max : float
        The maximum value of the ``rate`` function.

    Returns
    -------
    out : float
        The time of the next arrival.

    Notes
    -----
    This function returns the time of the next arrival, where the
    distribution of the number of arrivals between times :math:`t` and
    :math:`t+s` is Poisson with mean

    .. math::

       \int_{t}^{t+s} dx \, r(x)

    where :math:`r(t)` is the supplied ``rate`` function. This function
    can only simulate processes that have bounded intensity functions.
    See chapter 6 of [3]_ for more on the mathematics behind Poisson
    random measures; the book's publisher, Springer, has that chapter
    available online for free at (`pdf`_\).

    A Poisson random measure is sometimes called a non-homogeneous
    Poisson process. A Poisson process is a special type of Poisson
    random measure.

    .. _pdf: http://www.springer.com/cda/content/document/\
                cda_downloaddocument/9780387878584-c1.pdf

    Examples
    --------
    Suppose you wanted to model the arrival process as a Poisson
    random measure with rate function :math:`r(t) = 2 + \sin( 2\pi t)`.
    Then you could do so as follows:

    >>> import queueing_tool as qt
    >>> import numpy as np
    >>> np.random.seed(10)
    >>> rate  = lambda t: 2 + np.sin(2 * np.pi * t)
    >>> arr_f = lambda t: qt.poisson_random_measure(t, rate, 3)
    >>> arr_f(1)  # doctest: +ELLIPSIS
    1.491...

    References
    ----------
    .. [3] Cinlar, Erhan. *Probability and stochastics*. Graduate Texts in\
           Mathematics. Vol. 261. Springer, New York, 2011.\
           :doi:`10.1007/978-0-387-87859-1`

A function that returns the arrival time of the next arrival for a Poisson random measure .


def Func(arg_0, arg_1):
    """Fast version of a heappush followed by a heappop."""
    if arg_0 and arg_0[0] > arg_1:
        # if item >= heap[0], it will be popped immediately after pushed
        arg_1, arg_0[0] = arg_0[0], arg_1
        _siftup_max(arg_0, 0)
    return arg_1

Fast version of a heappush followed by a heappop .