return ' '.join('%s:%s' % (t, c) for t, c in cur)

def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
arg_0
.
conn
.
cursor
(
)
arg_3
.
execute
(
'SELECT {column}, count(*) '
'FROM {table} GROUP BY {column} '
'ORDER BY {column}'
.
format
(
arg_2
=
arg_2
,
arg_1
=
arg_1
)
)
return
' '
.
join
(
'%s:%s'
%
(
arg_4
,
arg_5
)
for
arg_4
,
arg_5
in
arg_3
)

def Func(arg_0, arg_1, arg_2):
    """Count occurrences of values AND return it as a string.

    Example return value:   '1:5 2:15'"""
    arg_3 = arg_0.conn.cursor()
    arg_3.execute('SELECT {column}, count(*) '
                'FROM {table} GROUP BY {column} '
                'ORDER BY {column}'.format(arg_2=arg_2, arg_1=arg_1))
    return ' '.join('%s:%s' % (arg_4, arg_5) for arg_4, arg_5 in arg_3)

Count occurrences of values AND return it as a string .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
if
not
arg_2
:
arg_2
=
arg_0
.
lower
(
)
if
hasattr
(
logging
,
arg_0
)
:
raise
AttributeError
(
'{} already defined in logging module'
.
format
(
arg_0
)
)
if
hasattr
(
logging
,
arg_2
)
:
raise
AttributeError
(
'{} already defined in logging module'
.
format
(
arg_2
)
)
if
hasattr
(
logging
.
getLoggerClass
(
)
,
arg_2
)
:
raise
AttributeError
(
'{} already defined in logger class'
.
format
(
arg_2
)
)
def
logForLevel
(
arg_3
,
arg_4
,
*
arg_5
,
**
arg_6
)
:
if
arg_3
.
isEnabledFor
(
arg_1
)
:
arg_3
.
_log
(
arg_1
,
arg_4
,
arg_5
,
**
arg_6
)
def
logToRoot
(
arg_4
,
*
arg_5
,
**
arg_6
)
:
logging
.
log
(
arg_1
,
arg_4
,
*
arg_5
,
**
arg_6
)
logging
.
addLevelName
(
arg_1
,
arg_0
)
setattr
(
logging
,
arg_0
,
arg_1
)
setattr
(
logging
.
getLoggerClass
(
)
,
arg_2
,
logForLevel
)
setattr
(
logging
,
arg_2
,
logToRoot
)

def Func(arg_0, arg_1, arg_2=None):
    """
    Comprehensively adds a new logging level to the `logging` module and the
    currently configured logging class.

    `levelName` becomes an attribute of the `logging` module with the value
    `levelNum`. `methodName` becomes a convenience method for both `logging`
    itself and the class returned by `logging.getLoggerClass()` (usually just
    `logging.Logger`). If `methodName` is not specified, `levelName.lower()` is
    used.

    To avoid accidental clobberings of existing attributes, this method will
    raise an `AttributeError` if the level name is already an attribute of the
    `logging` module or if the method name is already present

    Example
    -------
    >>> addLoggingLevel('TRACE', logging.DEBUG - 5)
    >>> logging.getLogger(__name__).setLevel("TRACE")
    >>> logging.getLogger(__name__).trace('that worked')
    >>> logging.trace('so did this')
    >>> logging.TRACE
    5

    """
    if not arg_2:
        arg_2 = arg_0.lower()

    if hasattr(logging, arg_0):
        raise AttributeError(
            '{} already defined in logging module'.format(arg_0))
    if hasattr(logging, arg_2):
        raise AttributeError(
            '{} already defined in logging module'.format(arg_2))
    if hasattr(logging.getLoggerClass(), arg_2):
        raise AttributeError(
            '{} already defined in logger class'.format(arg_2))

    # This method was inspired by the answers to Stack Overflow post
    # http://stackoverflow.com/q/2183233/2988730, especially
    # http://stackoverflow.com/a/13638084/2988730
    def logForLevel(arg_3, arg_4, *arg_5, **arg_6):
        if arg_3.isEnabledFor(arg_1):
            arg_3._log(arg_1, arg_4, arg_5, **arg_6)

    def logToRoot(arg_4, *arg_5, **arg_6):
        logging.log(arg_1, arg_4, *arg_5, **arg_6)

    logging.addLevelName(arg_1, arg_0)
    setattr(logging, arg_0, arg_1)
    setattr(logging.getLoggerClass(), arg_2, logForLevel)
    setattr(logging, arg_2, logToRoot)

Comprehensively adds a new logging level to the logging module and the currently configured logging class .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
__class__
.
__name__
.
lower
(
)
arg_3
=
arg_0
.
profile
+
"_"
+
arg_2
if
isinstance
(
arg_0
.
_auth
,
(
MutableSequence
,
tuple
)
)
:
arg_1
.
pwd
[
arg_3
]
=
" :: "
.
join
(
arg_0
.
_auth
)
else
:
arg_1
.
pwd
[
arg_3
]
=
arg_0
.
_auth

def Func(arg_0, arg_1):
    """
    Updates the profile's auth entry with values set by the user.
    This will overwrite existing values.

    Args:
        :msg: (Message class) an instance of a message class.
        :cfg: (jsonconfig.Config) config instance.
    """
    arg_2 = arg_0.__class__.__name__.lower()
    arg_3 = arg_0.profile + "_" + arg_2
    if isinstance(arg_0._auth, (MutableSequence, tuple)):
        arg_1.pwd[arg_3] = " :: ".join(arg_0._auth)
    else:
        arg_1.pwd[arg_3] = arg_0._auth

Updates the profile s auth entry with values set by the user . This will overwrite existing values .


def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_3 = OP_ALTERNATE arg_4 = arg_0 . _hoist_operands ( arg_1 . operands , lambda t : isinstance ( t , OptreeNode ) and t . opnode . operator is arg_3 ) arg_5 = [ "alternation([" ] for arg_6 in arg_4 : arg_5 . extend ( arg_0 . _indent ( arg_0 . _ast_to_code ( arg_6 ) ) ) arg_5 [ - 1 ] += "," arg_5 . append ( "])" ) return arg_5

def Func(arg_0, arg_1, **arg_2):
    """Convert an AST alternate op to python source code."""
    arg_3 = OP_ALTERNATE
    arg_4 = arg_0._hoist_operands(arg_1.operands, lambda t: isinstance(t, OptreeNode) and t.opnode.operator is arg_3)

    arg_5 = ["alternation(["]
    for arg_6 in arg_4:
      arg_5.extend(arg_0._indent(arg_0._ast_to_code(arg_6)))
      arg_5[-1] += ","
    arg_5.append("])")
    return arg_5

Convert an AST alternate op to python source code .


def Func ( arg_0 , arg_1 ) : from pip . _vendor import _markerlib arg_2 = _markerlib . default_environment ( ) for arg_3 in arg_2 . keys ( ) : arg_4 = arg_3 . replace ( '.' , '_' ) arg_2 [ arg_4 ] = arg_2 . pop ( arg_3 ) try : arg_5 = _markerlib . interpret ( arg_1 , arg_2 ) except NameError as e : raise SyntaxError ( e . args [ 0 ] ) return arg_5

def Func(arg_0, arg_1):
        """
        Evaluate a PEP 426 environment marker using markerlib.
        Return a boolean indicating the marker result in this environment.
        Raise SyntaxError if marker is invalid.
        """
        from pip._vendor import _markerlib
        # markerlib implements Metadata 1.2 (PEP 345) environment markers.
        # Translate the variables to Metadata 2.0 (PEP 426).
        arg_2 = _markerlib.default_environment()
        for arg_3 in arg_2.keys():
            arg_4 = arg_3.replace('.', '_')
            arg_2[arg_4] = arg_2.pop(arg_3)
        try:
            arg_5 = _markerlib.interpret(arg_1, arg_2)
        except NameError as e:
            raise SyntaxError(e.args[0])
        return arg_5

Evaluate a PEP 426 environment marker using markerlib . Return a boolean indicating the marker result in this environment . Raise SyntaxError if marker is invalid .


def Func ( * arg_0 , arg_1 = None ) : arg_2 . ROOT_FILE = arg_1 arg_4 = merge . merge ( merge . DEFAULT_PROJECT , * arg_0 ) arg_5 = arg_4 . get ( 'path' , '' ) if arg_1 : arg_6 = os . path . dirname ( arg_1 ) if arg_5 : arg_5 += ':' + arg_6 else : arg_5 = arg_6 with arg_2 . extender ( arg_5 ) : arg_4 = recurse . recurse ( arg_4 ) Func = construct . construct ( ** arg_4 ) Func . desc = arg_4 return Func

def Func(*arg_0, arg_1=None):
    """
    Make a new project, using recursion and alias resolution.

    Use this function in preference to calling Project() directly.
    """
    arg_2.ROOT_FILE = arg_1

    arg_4 = merge.merge(merge.DEFAULT_PROJECT, *arg_0)
    arg_5 = arg_4.get('path', '')

    if arg_1:
        arg_6 = os.path.dirname(arg_1)
        if arg_5:
            arg_5 += ':' + arg_6
        else:
            arg_5 = arg_6

    with arg_2.extender(arg_5):
        arg_4 = recurse.recurse(arg_4)

    Func = construct.construct(**arg_4)
    Func.desc = arg_4
    return Func

Make a new project using recursion and alias resolution .


(src, tar, weights='exponential', max_length=8)

return Eudex().sim(src, tar, weights, max_length)

def Func ( arg_0 , arg_1 , arg_2 = 'exponential' , arg_3 = 8 ) : return Eudex ( ) . sim ( arg_0 , arg_1 , arg_2 , arg_3 )

def Func(arg_0, arg_1, arg_2='exponential', arg_3=8):
    """Return normalized Hamming similarity between Eudex hashes of two terms.

    This is a wrapper for :py:meth:`Eudex.sim`.

    Parameters
    ----------
    src : str
        Source string for comparison
    tar : str
        Target string for comparison
    weights : str, iterable, or generator function
        The weights or weights generator function
    max_length : int
        The number of characters to encode as a eudex hash

    Returns
    -------
    int
        The normalized Eudex Hamming similarity

    Examples
    --------
    >>> round(Func('cat', 'hat'), 12)
    0.937254901961
    >>> round(Func('Niall', 'Neil'), 12)
    0.999019607843
    >>> round(Func('Colin', 'Cuilen'), 12)
    0.995098039216
    >>> round(Func('ATCG', 'TAGC'), 12)
    0.802450980392

    """
    return Eudex().sim(arg_0, arg_1, arg_2, arg_3)

Return normalized Hamming similarity between Eudex hashes of two terms.

    This is a wrapper for :py:meth:`Eudex.sim`.

    Parameters
    ----------
    src : str
        Source string for comparison
    tar : str
        Target string for comparison
    weights : str, iterable, or generator function
        The weights or weights generator function
    max_length : int
        The number of characters to encode as a eudex hash

    Returns
    -------
    int
        The normalized Eudex Hamming similarity

    Examples
    --------
    >>> round(sim_eudex('cat', 'hat'), 12)
    0.937254901961
    >>> round(sim_eudex('Niall', 'Neil'), 12)
    0.999019607843
    >>> round(sim_eudex('Colin', 'Cuilen'), 12)
    0.995098039216
    >>> round(sim_eudex('ATCG', 'TAGC'), 12)
    0.802450980392

Return normalized Hamming similarity between Eudex hashes of two terms .


def Func ( arg_0 , arg_1 = 0.001 ) : arg_2 = np . sum ( arg_0 . get_feature_data ( ) >= arg_1 , 0 ) return dict ( zip ( arg_0 . get_feature_names ( ) , list ( arg_2 ) ) )

def Func(arg_0, arg_1=0.001):
        """ Returns a dictionary, where the keys are the feature names
        and the values are the number of studies tagged with the feature. """
        arg_2 = np.sum(arg_0.get_feature_data() >= arg_1, 0)
        return dict(zip(arg_0.get_feature_names(), list(arg_2)))

Returns a dictionary where the keys are the feature names and the values are the number of studies tagged with the feature .


def Func ( arg_0 , arg_1 = True ) : ( arg_2 , arg_3 ) = arg_0 . connections . computeActivity ( arg_0 . activeCells , arg_0 . connectedPermanence ) arg_4 = ( arg_0 . connections . segmentForFlatIdx ( i ) for i in xrange ( len ( arg_2 ) ) if arg_2 [ i ] >= arg_0 . activationThreshold ) arg_5 = ( arg_0 . connections . segmentForFlatIdx ( i ) for i in xrange ( len ( arg_3 ) ) if arg_3 [ i ] >= arg_0 . minThreshold ) arg_0 . activeSegments = sorted ( arg_4 , key = arg_0 . connections . segmentPositionSortKey ) arg_0 . matchingSegments = sorted ( arg_5 , key = arg_0 . connections . segmentPositionSortKey ) arg_0 . numActiveConnectedSynapsesForSegment = arg_2 arg_0 . numActivePotentialSynapsesForSegment = arg_3 if arg_1 : for arg_8 in arg_0 . activeSegments : arg_0 . lastUsedIterationForSegment [ arg_8 . flatIdx ] = arg_0 . iteration arg_0 . iteration += 1

def Func(arg_0, arg_1=True):
    """
    Calculate dendrite segment activity, using the current active cells.

    :param learn: (bool) If true, segment activations will be recorded. This
           information is used during segment cleanup.

    **Pseudocode:**

    ::

      for each distal dendrite segment with activity >= activationThreshold
        mark the segment as active
      for each distal dendrite segment with unconnected activity >= minThreshold
        mark the segment as matching
    """
    (arg_2,
     arg_3) = arg_0.connections.computeActivity(
       arg_0.activeCells,
       arg_0.connectedPermanence)

    arg_4 = (
      arg_0.connections.segmentForFlatIdx(i)
      for i in xrange(len(arg_2))
      if arg_2[i] >= arg_0.activationThreshold
    )

    arg_5 = (
      arg_0.connections.segmentForFlatIdx(i)
      for i in xrange(len(arg_3))
      if arg_3[i] >= arg_0.minThreshold
    )

    arg_0.activeSegments = sorted(arg_4,
                                 key=arg_0.connections.segmentPositionSortKey)
    arg_0.matchingSegments = sorted(arg_5,
                                   key=arg_0.connections.segmentPositionSortKey)
    arg_0.numActiveConnectedSynapsesForSegment = arg_2
    arg_0.numActivePotentialSynapsesForSegment = arg_3

    if arg_1:
      for arg_8 in arg_0.activeSegments:
        arg_0.lastUsedIterationForSegment[arg_8.flatIdx] = arg_0.iteration
      arg_0.iteration += 1

Calculate dendrite segment activity using the current active cells .


def Func ( arg_0 ) : arg_1 = makeService ( ) if arg_1 is None : return arg_1 . setName ( 'heart' ) arg_1 . setServiceParent ( arg_0 )

def Func(arg_0):
    """Add a heart to a service collection

    Add a heart to a service.IServiceCollector if
    the heart is not None.

    :params master: a service.IServiceCollector
    """
    arg_1 = makeService()
    if arg_1 is None:
        return
    arg_1.setName('heart')
    arg_1.setServiceParent(arg_0)


def Func(arg_0, arg_1):
        """Lazily load a callable.

        Perform a lazy import of a context so that we don't have a huge initial startup time
        loading all of the modules that someone might want even though they probably only
        will use a few of them.
        """

        arg_2, arg_3, arg_4 = arg_1.partition(',')

        arg_5 = importlib.import_module(arg_2)
        if arg_4 == "":
            arg_3, arg_6 = annotate.context_from_module(arg_5)
            return arg_6

        if hasattr(arg_5, arg_4):
            return getattr(arg_5, arg_4)

        raise ArgumentError("Attempted to import nonexistent object from module", arg_2=arg_2, object=arg_4)


def Func ( arg_0 , arg_1 = None ) : if isinstance ( arg_0 , dict ) : arg_0 = [ arg_0 ] arg_2 = PreprocessorStack ( ) for arg_3 in arg_0 : arg_4 = copy . deepcopy ( arg_1 ) arg_5 = util . get_object ( obj = arg_3 , predefined_objects = tensorforce . core . preprocessors . preprocessors , arg_1 = arg_4 ) assert isinstance ( arg_5 , Preprocessor ) arg_2 . preprocessors . append ( arg_5 ) return arg_2

def Func(arg_0, arg_1=None):
        """
        Creates a preprocessing stack from a specification dict.
        """
        if isinstance(arg_0, dict):
            arg_0 = [arg_0]

        arg_2 = PreprocessorStack()
        for arg_3 in arg_0:
            # need to deep copy, otherwise will add first processors spec_ to kwargs to second processor
            arg_4 = copy.deepcopy(arg_1)
            arg_5 = util.get_object(
                obj=arg_3,
                predefined_objects=tensorforce.core.preprocessors.preprocessors,
                arg_1=arg_4
            )
            assert isinstance(arg_5, Preprocessor)
            arg_2.preprocessors.append(arg_5)

        return arg_2

Creates a preprocessing stack from a specification dict .


def Func ( arg_0 , arg_1 ) : arg_0 . PC = Operators . ITEBV ( arg_0 . address_bit_size , False == arg_0 . OF , arg_1 . read ( ) , arg_0 . PC )

def Func(arg_0, arg_1):
        """
        Jumps short if not overflow.

        :param cpu: current CPU.
        :param target: destination operand.
        """
        arg_0.PC = Operators.ITEBV(arg_0.address_bit_size, False == arg_0.OF, arg_1.read(), arg_0.PC)


return self.__class__(self.genes[:c] + other.genes[c:])

def Func ( arg_0 , arg_1 ) : arg_2 = random . randrange ( len ( arg_0 . genes ) ) return arg_0 . __class__ ( arg_0 . genes [ : arg_2 ] + arg_1 . genes [ arg_2 : ] )

def Func(arg_0, arg_1):
        "Return a new individual crossing self and other."
        arg_2 = random.randrange(len(arg_0.genes))
        return arg_0.__class__(arg_0.genes[:arg_2] + arg_1.genes[arg_2:])

Return a new individual crossing self and other .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . _fitch_intersect ( [ k . state [ arg_2 ] for k in arg_1 . clades ] ) if len ( arg_3 ) == 0 : arg_3 = np . concatenate ( [ k . state [ arg_2 ] for k in arg_1 . clades ] ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """
        Determine the Fitch profile for a single character of the node's sequence.
        The profile is essentially the intersection between the children's
        profiles or, if the former is empty, the union of the profiles.

        Parameters
        ----------

         node : PhyloTree.Clade:
            Internal node which the profiles are to be determined

         pos : int
            Position in the node's sequence which the profiles should
            be determinedf for.

        Returns
        -------
         state : numpy.array
            Fitch profile for the character at position pos of the given node.
        """
        arg_3 = arg_0._fitch_intersect([k.state[arg_2] for k in arg_1.clades])
        if len(arg_3) == 0:
            arg_3 = np.concatenate([k.state[arg_2] for k in arg_1.clades])
        return arg_3

Determine the Fitch profile for a single character of the node s sequence . The profile is essentially the intersection between the children s profiles or if the former is empty the union of the profiles .


(ctx, apiurl, signature, username, password)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """Command line interface for YOURLS.

    Configuration parameters can be passed as switches or stored in .yourls or
    ~/.yourls.

    If your YOURLS server requires authentication, please provide one of the
    following:

    \b
    • apiurl and signature
    • apiurl, username, and password

    Configuration file format:

    \b
    [yourls]
    apiurl = http://example.com/yourls-api.php
    signature = abcdefghij
    """
    if arg_1 is None:
        raise Funcck.UsageError("apiurl missing. See 'yourls --help'")

    arg_5 = dict(arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)

    try:
        arg_0.obj = YOURLSClient(arg_1=arg_1, **arg_5)
    except TypeError:
        raise Funcck.UsageError("authentication paremeters overspecified. "
                               "See 'yourls --help'")


(command, parser, cl_args, unknown_args)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
Log
.
debug
(
"Update Args: %s"
,
arg_2
)
arg_4
=
jars
.
packing_jars
(
)
arg_5
=
"update topology%s"
%
(
' in dry-Func mode'
if
arg_2
[
"dry_Func"
]
else
''
)
arg_6
=
{
}
try
:
arg_6
=
build_extra_args_dict
(
arg_2
)
except
Exception
as
err
:
return
SimpleResult
(
Status
.
InvocationError
,
err
.
message
)
if
arg_2
[
'deploy_mode'
]
==
config
.
SERVER_MODE
:
return
cli_helper
.
Func_server
(
arg_0
,
arg_2
,
arg_5
,
arg_6
)
else
:
arg_7
=
convert_args_dict_to_list
(
arg_6
)
return
cli_helper
.
Func_direct
(
arg_0
,
arg_2
,
arg_5
,
arg_7
,
arg_4
)

def Func(arg_0, arg_1, arg_2, arg_3):
  """ Func the update command """

  Log.debug("Update Args: %s", arg_2)

  # Build jar list
  arg_4 = jars.packing_jars()
  arg_5 = "update topology%s" % (' in dry-Func mode' if arg_2["dry_Func"] else '')

  # Build extra args
  arg_6 = {}
  try:
    arg_6 = build_extra_args_dict(arg_2)
  except Exception as err:
    return SimpleResult(Status.InvocationError, err.message)

  # Execute
  if arg_2['deploy_mode'] == config.SERVER_MODE:
    return cli_helper.Func_server(arg_0, arg_2, arg_5, arg_6)
  else:
    # Convert extra argument to commandline format and then execute
    arg_7 = convert_args_dict_to_list(arg_6)
    return cli_helper.Func_direct(arg_0, arg_2, arg_5, arg_7, arg_4)


(args, specs, defaults,passed_conditions,value_conditions,
                  allow_unknowns,unknowns_spec)

def Func(arg_0, arg_1, arg_2,arg_3,arg_4,
                  arg_5,arg_6):
    '''
    Similar to validate but validates multiple objects at once, each with their own specification.

    Fill objects that were specified but not provided with NotPassed or default values
    Apply `value_condition` to object dictionary as a whole
    '''
    arg_7 = builtins.dict()
    arg_8 = set(arg_0.keys()) - set(arg_1.keys())
    if arg_8:
        if not arg_5:
            raise ValueError(('Arguments {} were passed but not specified (use ' +
                 '`allow_unknowns=True` to avoid this error)'.format(arg_8)))
        else:
            for arg_9 in arg_8:
                if arg_6 is not None:
                    arg_1[arg_9] = arg_6
    if arg_3:
        validate(arg_0, Dict(arg_3=arg_3))
    for arg_9 in arg_1:
        if (not arg_9 in arg_0) or NotPassed(arg_0[arg_9]):
            if arg_9 in arg_2:
                if isinstance(arg_2[arg_9],DefaultGenerator):
                    arg_7[arg_9] = arg_2[arg_9]()
                else:
                    arg_7[arg_9] = arg_2[arg_9]
            else:
                arg_7[arg_9] = NotPassed
        else:#Default values and NotPassed values are not validated. Former has advantage that default values need to be `correct` without validation and thus encourage the user to pass stuff that doesn't need validation, and is therefore faster
            arg_7[arg_9] = validate(arg_0[arg_9], arg_1[arg_9])
    if arg_4:
        arg_7 = validate(arg_7, arg_4)
    return arg_7

Similar to validate but validates multiple objects at once each with their own specification . Fill objects that were specified but not provided with NotPassed or default values Apply value_condition to object dictionary as a whole


def Func ( arg_0 ) : if arg_0 . shell_channel . is_alive ( ) : arg_0 . shell_channel . stop ( ) if arg_0 . sub_channel . is_alive ( ) : arg_0 . sub_channel . stop ( ) if arg_0 . stdin_channel . is_alive ( ) : arg_0 . stdin_channel . stop ( ) if arg_0 . hb_channel . is_alive ( ) : arg_0 . hb_channel . stop ( )

def Func(arg_0):
        """Stops all the running channels for this kernel.
        """
        if arg_0.shell_channel.is_alive():
            arg_0.shell_channel.stop()
        if arg_0.sub_channel.is_alive():
            arg_0.sub_channel.stop()
        if arg_0.stdin_channel.is_alive():
            arg_0.stdin_channel.stop()
        if arg_0.hb_channel.is_alive():
            arg_0.hb_channel.stop()

Stops all the running channels for this kernel .


(self, outgoing_task, outgoing_task_node,
                         sequence_flow_node, is_default)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : arg_0 . task . Func ( arg_1 , arg_3 . get ( 'id' ) , arg_3 . get ( 'name' , None ) , arg_0 . parser . _parse_documentation ( arg_3 , task_parser = arg_0 ) )

def Func(arg_0, arg_1, arg_2,
                         arg_3, arg_4):
        """
        Connects this task to the indicating outgoing task, with the details in
        the sequence flow. A subclass can override this method to get extra
        information from the node.
        """
        arg_0.task.Func(
            arg_1, arg_3.get('id'),
            arg_3.get(
                'name', None),
            arg_0.parser._parse_documentation(arg_3,
                                             task_parser=arg_0))

Connects this task to the indicating outgoing task with the details in the sequence flow . A subclass can override this method to get extra information from the node .


def Func(arg_0):
        """Perform the App's actions as configured"""
        super(JupyterTensorboardApp, arg_0).Func()

        # The above should have called a subcommand and raised NoStart; if we
        # get here, it didn't, so we should self.log.info a message.
        arg_1 = ", ".join(sorted(arg_0.subcommands))
        sys.exit("Please supply at least one subcommand: %s" % arg_1)


def Func ( arg_0 , arg_1 , arg_2 = False ) : arg_3 = os . path . basename ( arg_0 ) arg_4 = None if arg_2 : arg_5 = session . communicator . folder_children ( session . token , arg_1 ) arg_6 = arg_5 [ 'items' ] for arg_7 in arg_6 : if arg_7 [ 'name' ] == arg_3 : arg_4 = arg_7 [ 'item_id' ] break if arg_4 is None : arg_8 = session . communicator . create_item ( session . token , arg_3 , arg_1 ) arg_4 = arg_8 [ 'item_id' ] return arg_4

def Func(arg_0, arg_1, arg_2=False):
    """
    Create an item from the local file in the Midas Server folder corresponding
    to the parent folder id.

    :param local_file: full path to a file on the local file system
    :type local_file: string
    :param parent_folder_id: id of parent folder on the Midas Server instance,
        where the item will be added
    :type parent_folder_id: int | long
    :param reuse_existing: (optional) whether to accept an existing item of the
        same name in the same location, or create a new one instead
    :type reuse_existing: bool
    """
    arg_3 = os.path.basename(arg_0)
    arg_4 = None
    if arg_2:
        # check by name to see if the item already exists in the folder
        arg_5 = session.communicator.folder_children(
            session.token, arg_1)
        arg_6 = arg_5['items']

        for arg_7 in arg_6:
            if arg_7['name'] == arg_3:
                arg_4 = arg_7['item_id']
                break

    if arg_4 is None:
        # create the item for the subdir
        arg_8 = session.communicator.create_item(
            session.token, arg_3, arg_1)
        arg_4 = arg_8['item_id']

    return arg_4

Create an item from the local file in the Midas Server folder corresponding to the parent folder id .


def Func(arg_0, arg_1):
        """
        Return an instance of a backend from its class.

        Args:
            backend_cls (class): Backend class.
        Returns:
            BaseBackend: a backend instance.
        Raises:
            QiskitError: if the backend could not be instantiated.
        """
        # Verify that the backend can be instantiated.
        try:
            arg_2 = arg_1(provider=arg_0)
        except Exception as err:
            raise QiskitError('Backend %s could not be instantiated: %s' %
                              (arg_1, err))

        return arg_2

Return an instance of a backend from its class .


def
Func
(
arg_0
)
:
while
len
(
arg_0
)
>
1
:
arg_0
=
_reduce
(
arg_0
)
if
len
(
arg_0
)
==
0
:
raise
OperatorError
(
"Empty node list"
)
arg_1
=
arg_0
[
0
]
if
isinstance
(
arg_1
,
OperatorNode
)
:
raise
OperatorError
(
"Operator without operands"
)
if
isinstance
(
arg_1
,
OptreeNode
)
:
return
arg_1
return
OptreeNode
(
,
(
arg_1
,
)
)

def Func(arg_0):
  """Convert a list of nodes in postfix order to an Optree."""
  while len(arg_0) > 1:
    arg_0 = _reduce(arg_0)

  if len(arg_0) == 0:
    raise OperatorError("Empty node list")

  arg_1 = arg_0[0]

  if isinstance(arg_1, OperatorNode):
    raise OperatorError("Operator without operands")

  if isinstance(arg_1, OptreeNode):
    return arg_1

  return OptreeNode(None, (arg_1, ))

Convert a list of nodes in postfix order to an Optree .


def
Func
(
arg_0
)
:
arg_1
=
parse_str
(
arg_0
)
.
capitalize
(
)
if
arg_1
in
(
"True"
,
"Yes"
,
"On"
,
"1"
)
:
return
True
elif
arg_1
in
(
"False"
,
"No"
,
"Off"
,
"0"
)
:
return
False
else
:
raise
ValueError
(
'Unable to parse boolean value "{}"'
.
format
(
arg_0
)
)

def Func(arg_0):
    """
    Parse string to bool.

    :param str value: String value to parse as bool
    :return bool:
    """
    arg_1 = parse_str(arg_0).capitalize()

    if arg_1 in ("True", "Yes", "On", "1"):
        return True
    elif arg_1 in ("False", "No", "Off", "0"):
        return False
    else:
        raise ValueError('Unable to parse boolean value "{}"'.format(arg_0))


def Func(arg_0, arg_1):
        """display a table as text"""
        arg_2 = arg_0.get_table_content(arg_1)
        # get columns width
        arg_3 = [0] * len(arg_2[0])
        for arg_4 in arg_2:
            for arg_5, arg_6 in enumerate(arg_4):
                arg_3[arg_5] = max(arg_3[arg_5], len(arg_6))
        arg_0.default_table(arg_1, arg_2, arg_3)
        arg_0.writeln()


def Func(arg_0, arg_1):
        """
        Returns the ProcessParser for the given process ID or name. It matches
        by name first.
        """
        if arg_1 in arg_0.process_parsers_by_name:
            return arg_0.process_parsers_by_name[arg_1]
        else:
            return arg_0.process_parsers[arg_1]

Returns the ProcessParser for the given process ID or name . It matches by name first .


def Func ( arg_0 , arg_1 ) : arg_2 = urlparse ( arg_1 . history [ - 1 ] . request . url ) arg_3 = dict ( parse_qsl ( arg_2 . query ) ) arg_4 = urlparse ( arg_3 [ 'goto' ] ) arg_5 = dict ( parse_qsl ( arg_4 . query ) ) arg_6 = parse_json ( arg_5 [ 'state' ] ) return arg_6 [ 'nonce' ]

def Func(arg_0, arg_1):
        """
        Given an HTTP response from the sessino endpoint, extract the nonce, so we can "sign" requests with it.
        We don't really sign the requests in the traditional sense of a nonce, we just incude them in the auth requests.

        :param http_result: HTTP response from the bbc session endpoint.
        :type http_result: requests.Response
        :return: nonce to "sign" url requests with
        :rtype: string
        """

        # Extract the redirect URL from the last call
        arg_2 = urlparse(arg_1.history[-1].request.url)
        arg_3 = dict(parse_qsl(arg_2.query))
        # Extract the nonce from the query string in the redirect URL
        arg_4 = urlparse(arg_3['goto'])
        arg_5 = dict(parse_qsl(arg_4.query))
        arg_6 = parse_json(arg_5['state'])

        # Return the nonce we can use for future queries
        return arg_6['nonce']

Given an HTTP response from the sessino endpoint extract the nonce so we can sign requests with it . We don t really sign the requests in the traditional sense of a nonce we just incude them in the auth requests .


def Func ( arg_0 , arg_1 ) : arg_0 . __validate_storage_path ( arg_1 , projects_allowed = False ) arg_2 = [ step for step in arg_1 . split ( '/' ) if step ] del arg_2 [ - 1 ] arg_3 = '/{0}' . format ( '/' . join ( arg_2 ) ) return arg_0 . api_client . get_entity_by_query ( arg_1 = arg_3 )

def Func(arg_0, arg_1):
        '''Get the parent entity of the entity pointed by the given path.

        Args:
            path (str): The path of the entity whose parent is needed

        Returns:
            A JSON object of the parent entity if found.

        Raises:
            StorageArgumentException: Invalid arguments
            StorageForbiddenException: Server response code 403
            StorageNotFoundException: Server response code 404
            StorageException: other 400-600 error codes
        '''

        arg_0.__validate_storage_path(arg_1, projects_allowed=False)
        arg_2 = [step for step in arg_1.split('/') if step]
        del arg_2[-1]
        arg_3 = '/{0}'.format('/'.join(arg_2))
        return arg_0.api_client.get_entity_by_query(arg_1=arg_3)

Get the parent entity of the entity pointed by the given path .


return _MinidomXmlToObject.parse_service_resources_response(
            response, ServiceObjective)

def Func(arg_0, arg_1):
        '''
        Gets the service level objectives for an Azure SQL Database server.

        server_name:
            Name of the server.
        '''
        _validate_not_none('server_name', arg_1)
        arg_2 = arg_0._perform_get(
            arg_0._get_service_objectives_path(arg_1), None)
        return _MinidomXmlToObject.parse_service_resources_response(
            arg_2, ServiceObjective)

Gets the service level objectives for an Azure SQL Database server .


def Func ( arg_0 ) : Func = get_all_styles ( ) arg_2 = arg_0 . app . config . get ( 'CSL_STYLES_WHITELIST' ) if arg_2 : return { arg_3 : arg_4 for arg_3 , arg_4 in Func . items ( ) if arg_3 in arg_2 } return Func

def Func(arg_0):
        """Get a dictionary of CSL styles."""
        Func = get_all_styles()
        arg_2 = arg_0.app.config.get('CSL_STYLES_WHITELIST')
        if arg_2:
            return {arg_3: arg_4 for arg_3, arg_4 in Func.items() if arg_3 in arg_2}
        return Func


return BackendStatus(backend_name=self.name(),
                             backend_version=__version__,
                             operational=True,
                             pending_jobs=0,
                             status_msg='')

def Func ( arg_0 ) : return BackendStatus ( backend_name = arg_0 . name ( ) , backend_version = __version__ , operational = True , pending_jobs = 0 , Func_msg = '' )

def Func(arg_0):
        """Return backend Func.

        Returns:
            BackendStatus: the Func of the backend.
        """
        return BackendStatus(backend_name=arg_0.name(),
                             backend_version=__version__,
                             operational=True,
                             pending_jobs=0,
                             Func_msg='')

Return backend status.

        Returns:
            BackendStatus: the status of the backend.


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] with arg_0 . db . connect ( ) as session : arg_3 = session . query ( Profile ) . filter ( Profile . name == arg_1 ) arg_4 = arg_3 . all ( ) if arg_4 : for arg_5 in arg_4 : arg_2 . append ( arg_5 . uuid ) return arg_2

def Func(arg_0, arg_1):
        """ Get the uuid for a profile name """
        arg_2 = []

        with arg_0.db.connect() as session:
            arg_3 = session.query(Profile).\
                filter(Profile.name == arg_1)
            arg_4 = arg_3.all()
            if arg_4:
                for arg_5 in arg_4:
                    arg_2.append(arg_5.uuid)
        return arg_2


def
Func
(
arg_0
)
:
arg_1
=
[
]
arg_2
=
[
[
block
.
code
,
block
.
write
(
)
]
for
block
in
arg_0
]
arg_2
[
1
]
[
0
]
|=
128
for
arg_3
,
arg_4
in
arg_2
:
arg_5
=
chr_
(
arg_3
)
if
len
(
arg_4
)
>
2
**
24
:
raise
error
(
"block is too long to write"
)
arg_6
=
struct
.
pack
(
">I"
,
len
(
arg_4
)
)
[
3
:
]
arg_1
.
append
(
arg_5
+
arg_6
+
arg_4
)
return
b""
.
join
(
arg_1
)

def Func(arg_0):
        """Render metadata block as a byte string."""
        arg_1 = []
        arg_2 = [[block.code, block.write()] for block in arg_0]
        arg_2[-1][0] |= 128
        for arg_3, arg_4 in arg_2:
            arg_5 = chr_(arg_3)
            if len(arg_4) > 2**24:
                raise error("block is too long to write")
            arg_6 = struct.pack(">I", len(arg_4))[-3:]
            arg_1.append(arg_5 + arg_6 + arg_4)
        return b"".join(arg_1)

Render metadata block as a byte string .


def Func ( arg_0 , arg_1 , arg_2 ) : for arg_3 in arg_0 : if len ( arg_3 ) == 0 : continue arg_3 = [ arg_2 ( cell ) for cell in arg_3 ] arg_4 = zip ( arg_1 , arg_3 ) arg_5 = dict ( arg_4 ) if len ( arg_5 [ 'text' ] ) == 0 : continue arg_5 [ 'text' ] = unicodedata . normalize ( 'NFKC' , arg_5 [ 'text' ] . strip ( ) ) if arg_5 . get ( 'title' ) == '' : del arg_5 [ 'title' ] if 'date' in arg_5 : if arg_5 [ 'date' ] == '' : del arg_5 [ 'date' ] if 'subset' in arg_5 : arg_6 = [ cell [ 1 ] for cell in arg_4 if cell [ 1 ] != '' and cell [ 0 ] == 'subset' ] if arg_6 : arg_5 [ 'subsets' ] = arg_6 if 'subset' in arg_5 : del arg_5 [ 'subset' ] yield arg_5

def Func(arg_0, arg_1, arg_2):
    """
    Given a constructed CSV reader object, a header row that we've read, and
    a detected encoding, yield its rows as dictionaries.
    """
    for arg_3 in arg_0:
        if len(arg_3) == 0:
            continue
        arg_3 = [arg_2(cell) for cell in arg_3]
        arg_4 = zip(arg_1, arg_3)
        arg_5 = dict(arg_4)
        if len(arg_5['text']) == 0:
            continue
        arg_5['text'] = unicodedata.normalize(
            'NFKC', arg_5['text'].strip()
        )
        if arg_5.get('title') == '':
            del arg_5['title']
        if 'date' in arg_5:
            # We handle dates further in open_json_or_csv_somehow
            if arg_5['date'] == '':
                del arg_5['date']
        if 'subset' in arg_5:
            arg_6 = [cell[1] for cell in arg_4
                       if cell[1] != '' and cell[0] == 'subset']
            if arg_6:
                arg_5['subsets'] = arg_6
            if 'subset' in arg_5:
                del arg_5['subset']
        yield arg_5

Given a constructed CSV reader object a header row that we ve read and a detected encoding yield its rows as dictionaries .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . find ( arg_1 ) if arg_2 is not None : return arg_2 . text return None

def Func(arg_0, arg_1):
    """
    Returns the value of the subnode "name" of element e.

    Returns None if the subnode doesn't exist
    """
    arg_2 = arg_0.find(arg_1)
    if arg_2 is not None:
        return arg_2.text
    return None

Returns the value of the subnode name of element e .


def Func ( arg_0 = None ) : arg_1 = [ ] arg_0 = arg_0 or [ 'en' ] for arg_2 in arg_0 : arg_3 = _get_lastnames ( arg_2 ) arg_1 . extend ( arg_3 ) return random . choice ( arg_1 ) . title ( )

def Func(arg_0=None):
    """
        return a random last name

    >>> from mock import patch
    >>> with patch('%s._get_lastnames' % __name__, lambda *args: ['aaa']):
    ...     Func()
    'Aaa'
    >>> with patch('%s.get_lastnames' % __name__, lambda lang: ['%s_lastname'% lang]):
    ...     Func(['it'])
    'It_Lastname'
    """
    arg_1 = []
    arg_0 = arg_0 or ['en']
    for arg_2 in arg_0:
        arg_3 = _get_lastnames(arg_2)
        arg_1.extend(arg_3)
    return random.choice(arg_1).title()

return a random last name

    >>> from mock import patch
    >>> with patch('%s._get_lastnames' % __name__, lambda *args: ['aaa']):
    ...     last_name()
    'Aaa'
    >>> with patch('%s.get_lastnames' % __name__, lambda lang: ['%s_lastname'% lang]):
    ...     last_name(['it'])
    'It_Lastname'


(
        self, domain=None, subdomain_check=False
    )

def Func(
        arg_0, arg_1=None, arg_2=False
    ):  # pylint:disable=too-many-return-statements, too-many-branches
        """
        Check if the given domain is a valid.

        :param domain: The domain to validate.
        :type domain: str

        :param subdomain_check:
            Activate the subdomain checking.
        :type subdomain_check: bool

        :return: The validity of the sub-domain.
        :rtype: bool
        """

        # We initate our regex which will match for valid domains.
        arg_3 = r"^(?=.{0,253}$)(([a-z0-9][a-z0-9-]{0,61}[a-z0-9]|[a-z0-9])\.)+((?=.*[^0-9])([a-z0-9][a-z0-9-]{0,61}[a-z0-9](?:\.)?|[a-z0-9](?:\.)?))$"  # pylint: disable=line-too-long

        # We initiate our regex which will match for valid subdomains.
        arg_4 = r"^(?=.{0,253}$)(([a-z0-9_][a-z0-9-_]{0,61}[a-z0-9_-]|[a-z0-9])\.)+((?=.*[^0-9])([a-z0-9][a-z0-9-]{0,61}[a-z0-9]|[a-z0-9]))$"  # pylint: disable=line-too-long

        if arg_1:
            # A domain is given.

            # We set the element to test as the parsed domain.
            arg_5 = arg_1
        elif arg_0.element:
            # A domain is globally given.

            # We set the globally parsed domain.
            arg_5 = arg_0.element
        else:
            # A domain is not given.

            # We set the element to test as the currently tested element.
            arg_5 = PyFunceble.INTERN["to_test"]

        try:
            # We get the position of the last point.
            arg_6 = arg_5.rindex(".")
            # And with the help of the position of the last point, we get the domain extension.
            arg_7 = arg_5[arg_6 + 1 :]

            if not arg_7 and arg_5.endswith("."):
                try:
                    arg_7 = [x for x in arg_5.split(".") if x][-1]
                except IndexError:
                    pass

            if not arg_7 or arg_7 not in PyFunceble.INTERN["iana_db"]:
                # * The extension is not found.
                # or
                # * The extension is not into the IANA database.

                # We return false.
                return False

            if (
                Regex(arg_5, arg_3, return_data=False).match()
                and not arg_2
            ):
                # * The element pass the domain validation.
                # and
                # * We are not checking if it is a subdomain.

                # We return True. The domain is valid.
                return True

            # The element did not pass the domain validation. That means that
            # it has invalid character or the position of - or _ are not right.

            if arg_7 in PyFunceble.INTERN["psl_db"]:
                # The extension is into the psl database.

                for arg_8 in PyFunceble.INTERN["psl_db"][arg_7]:
                    # We loop through the element of the extension into the psl database.

                    try:
                        # We try to get the position of the currently read suffix
                        # in the element ot test.
                        arg_9 = arg_5.rindex("." + arg_8)

                        # We get the element to check.
                        # The idea here is to delete the suffix, then retest with our
                        # subdomains regex.
                        arg_10 = arg_5[:arg_9]

                        if "." not in arg_10 and arg_2:
                            # * There is no point into the new element to check.
                            # and
                            # * We are checking if it is a subdomain.

                            # We return False, it is not a subdomain.
                            return False

                        if "." in arg_10 and arg_2:
                            # * There is a point into the new element to check.
                            # and
                            # * We are checking if it is a subdomain.

                            # We return True, it is a subdomain.
                            return True

                        # We are not checking if it is a subdomain.

                        if "." in arg_10:
                            # There is a point into the new element to check.

                            # We check if it passes our subdomain regex.
                            # * True: It's a valid domain.
                            # * False: It's an invalid domain.
                            return Regex(
                                arg_10, arg_4, return_data=False
                            ).match()

                    except ValueError:
                        # In case of a value error because the position is not found,
                        # we continue to the next element.
                        pass

            # * The extension is not into the psl database.
            # or
            # * there was no point into the suffix checking.

            # We get the element before the last point.
            arg_10 = arg_5[:arg_6]

            if "." in arg_10 and arg_2:
                # * There is a point in to_check.
                # and
                # * We are checking if it is a subdomain.

                # We return True, it is a subdomain.
                return True

            # We are not checking if it is a subdomain.

            if "." in arg_10:
                # There is a point in to_check.

                # We check if it passes our subdomain regex.
                # * True: It's a valid domain.
                # * False: It's an invalid domain.
                return Regex(
                    arg_10, arg_4, return_data=False
                ).match()

        except (ValueError, AttributeError):
            # In case of a value or attribute error we ignore them.
            pass

        # And we return False, the domain is not valid.
        return False


return 'postgresql://{user}@{host}:{port}/{dbname}'.format(**{k: v for k, v in self._connect_options(name)})

def Func(arg_0, arg_1=None):
        """
        Provides a connection string for database as a sqlalchemy compatible URL.

        NB - this doesn't include special arguments related to SSL connectivity (which are outside the scope
        of the connection URL format).

        Parameters
        ----------
        name: str, optional
            an override database name for the connection string.

        Returns
        -------
        str: the connection URL (e.g. postgresql://user1@localhost:5432/db1)
            """
        return 'postgresql://{user}@{host}:{port}/{dbname}'.format(**{arg_2: arg_3 for arg_2, arg_3 in arg_0._connect_options(arg_1)})

Provides a connection string for database as a sqlalchemy compatible URL .


def Func ( arg_0 ) -> int : arg_1 = 0 for arg_2 in arg_0 . _hsig . values ( ) : if hasattr ( arg_2 , 'is_var' ) and arg_2 . is_var : arg_1 += 1 return arg_1

def Func(arg_0) -> int:
        """ Count var define by this scope """
        arg_1 = 0
        for arg_2 in arg_0._hsig.values():
            if hasattr(arg_2, 'is_var') and arg_2.is_var:
                arg_1 += 1
        return arg_1


def Func ( arg_0 ) : arg_1 = os . environ [ 'EXTERNAL_URL' ] arg_2 = urllib . parse . urlparse ( arg_1 ) . netloc if arg_0 is None : return arg_2 arg_3 = os . environ [ 'JUPYTERHUB_SERVICE_PREFIX' ] arg_4 = 'proxy/%d' % arg_0 arg_5 = urllib . parse . urljoin ( arg_1 , arg_3 ) arg_6 = urllib . parse . urljoin ( arg_5 , arg_4 ) return arg_6

def Func(arg_0):
    """
    Callable to configure Bokeh's show method when a proxy must be
    configured.

    If port is None we're asking about the URL
    for the origin header.
    """
    arg_1 = os.environ['EXTERNAL_URL']
    arg_2 = urllib.parse.urlparse(arg_1).netloc

    # If port is None we're asking for the URL origin
    # so return the public hostname.
    if arg_0 is None:
        return arg_2

    arg_3 = os.environ['JUPYTERHUB_SERVICE_PREFIX']
    arg_4 = 'proxy/%d' % arg_0

    arg_5 = urllib.parse.urljoin(arg_1, arg_3)
    arg_6 = urllib.parse.urljoin(arg_5, arg_4)
    return arg_6

Callable to configure Bokeh s show method when a proxy must be configured .


(self, trip_I, from_stop_seq, to_stop_seq)

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Get the distance along a shape between stops

        Parameters
        ----------
        trip_I : int
            trip_ID along which we travel
        from_stop_seq : int
            the sequence number of the 'origin' stop
        to_stop_seq : int
            the sequence number of the 'destination' stop

        Returns
        -------
        distance : float, None
            If the shape calculation succeeded, return a float, otherwise return None
            (i.e. in the case where the shapes table is empty)
        """

        arg_4 = "SELECT shape_break FROM stop_times WHERE trip_I={trip_I} AND seq={seq} "
        arg_5 = [arg_2, arg_3]
        arg_6 = []
        for arg_7 in arg_5:
            arg_8 = arg_4.format(arg_7=arg_7, arg_1=arg_1)
            arg_6.append(arg_0.conn.execute(arg_8).fetchone())
        arg_4 = "SELECT max(d) - min(d) " \
                         "FROM shapes JOIN trips ON(trips.shape_id=shapes.shape_id) " \
                         "WHERE trip_I={trip_I} AND shapes.seq>={from_stop_seq} AND shapes.seq<={to_stop_seq};"
        arg_9 = arg_4.format(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)
        return arg_0.conn.execute(arg_9).fetchone()[0]


def Func(arg_0):  # pylint:disable=redefined-builtin
    """List projects.

    Uses [Caching](/references/polyaxon-cli/#caching)
    """
    arg_1 = AuthConfigManager.get_value('username')
    if not arg_1:
        Printer.print_error('Please login first. `polyaxon login --help`')

    arg_0 = arg_0 or 1
    try:
        arg_2 = PolyaxonClient().project.Func_projects(arg_1, arg_0=arg_0)
    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
        Printer.print_error('Could not get Func of projects.')
        Printer.print_error('Error message `{}`.'.format(e))
        sys.exit(1)

    arg_3 = get_meta_response(arg_2)
    if arg_3:
        Printer.print_header('Projects for current user')
        Printer.print_header('Navigation:')
        dict_tabulate(arg_3)
    else:
        Printer.print_header('No projects found for current user')

    arg_4 = Func_dicts_to_tabulate(
        [o.to_light_dict(
            humanize_values=True,
            exclude_attrs=['uuid', 'experiment_groups', 'experiments', 'description',
                           'num_experiments', 'num_independent_experiments',
                           'num_experiment_groups', 'num_jobs', 'num_builds', 'unique_name'])
            for o in arg_2['results']])
    if arg_4:
        Printer.print_header("Projects:")
        dict_tabulate(arg_4, is_Func_dict=True)


def Func ( arg_0 , arg_1 , ** arg_2 ) : if arg_1 . starting_point : arg_3 = ( arg_1 . ordering or '' ) . lstrip ( '-' ) if arg_3 in ( '' , 'datetime_uploaded' , 'datetime_created' ) : arg_1 . starting_point = parser . parse ( arg_1 . starting_point ) arg_5 = arg_0 ( arg_4 = arg_1 . starting_point , ordering = arg_1 . ordering , limit = arg_1 . limit , request_limit = arg_1 . request_limit , ** arg_2 ) arg_5 . constructor = lambda x : x try : pprint ( list ( arg_5 ) ) except ValueError as e : print ( e )

def Func(arg_0, arg_1, **arg_2):
    """ A common function for building methods of the "list showing".
    """
    if arg_1.starting_point:
        arg_3 = (arg_1.ordering or '').lstrip('-')
        if arg_3 in ('', 'datetime_uploaded', 'datetime_created'):
            arg_1.starting_point = parser.parse(
                arg_1.starting_point)

    arg_5 = arg_0(
        arg_4=arg_1.starting_point,
        ordering=arg_1.ordering,
        limit=arg_1.limit,
        request_limit=arg_1.request_limit,
        **arg_2
    )
    arg_5.constructor = lambda x: x

    try:
        pprint(list(arg_5))
    except ValueError as e:
        print(e)

A common function for building methods of the list showing .


async def Func(arg_0, arg_1):
        """Coroutine for uploading a single file
        """
        arg_2 = os.path.relpath(arg_1, arg_0.folder)
        arg_3 = s3_key(os.path.join(arg_0.key, arg_2))
        arg_4 = arg_0.content_types.get(arg_3.split('.')[-1])
        with open(arg_1, 'rb') as fp:
            arg_5 = fp.read()
        try:
            await arg_0.botocore.upload_file(arg_0.bucket, arg_5, arg_3=arg_3,
                                            ContentType=arg_4)
        except Exception as exc:
            LOGGER.error('Could not upload "%s": %s', arg_3, exc)
            arg_0.failures[arg_3] = arg_0.all.pop(arg_1)
            return
        arg_7 = arg_0.all.pop(arg_1)
        arg_0.success[arg_3] = arg_7
        arg_0.total_size += arg_7
        arg_9 = 100*(1 - len(arg_0.all)/arg_0.total_files)
        arg_10 = '{0:.0f}% completed - uploaded "{1}" - {2}'.format(
            arg_9, arg_3, convert_bytes(arg_7))
        LOGGER.info(arg_10)


(token, key_store, key_purpose, leeway=120)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
120
)
:
arg_4
=
arg_0
.
split
(
'.'
)
if
len
(
arg_4
)
!=
5
:
raise
InvalidTokenException
(
"Incorrect number of tokens"
)
arg_5
=
JWEHelper
.
Func
(
arg_0
,
arg_1
,
arg_2
)
arg_6
=
JWTHelper
.
decode
(
arg_5
,
arg_1
,
arg_2
,
arg_3
)
return
arg_6

def Func(arg_0, arg_1, arg_2, arg_3=120):
    """This Funcs the provided jwe token, then decodes resulting jwt token and returns
    the payload.

    :param str token: The jwe token.
    :param key_store: The key store.
    :param str key_purpose: Context for the key.
    :param int leeway: Extra allowed time in seconds after expiration to account for clock skew.
    :return: The Funced payload.

    """
    arg_4 = arg_0.split('.')
    if len(arg_4) != 5:
        raise InvalidTokenException("Incorrect number of tokens")

    arg_5 = JWEHelper.Func(arg_0, arg_1, arg_2)

    arg_6 = JWTHelper.decode(arg_5, arg_1, arg_2, arg_3)

    return arg_6

This decrypts the provided jwe token, then decodes resulting jwt token and returns
    the payload.

    :param str token: The jwe token.
    :param key_store: The key store.
    :param str key_purpose: Context for the key.
    :param int leeway: Extra allowed time in seconds after expiration to account for clock skew.
    :return: The decrypted payload.

This decrypts the provided jwe token then decodes resulting jwt token and returns the payload .


def Func(arg_0):
    """
    For the parallel topo sort to work, the targets have
    to be executed in layers such that there is no
    dependency relationship between any nodes in a layer.
    What is returned is a list of lists representing all
    the layers, or levels
    """
    arg_1 = []
    arg_2 = get_sinks(arg_0)
    arg_1.append(arg_2)
    while get_direct_ancestors(arg_0, arg_2):
        arg_2 = get_direct_ancestors(arg_0, arg_2)
        arg_1.append(arg_2)
    arg_1.reverse()
    return arg_1

For the parallel topo sort to work the targets have to be executed in layers such that there is no dependency relationship between any nodes in a layer . What is returned is a list of lists representing all the layers or levels


(self, chain, src=None, dest=None, target=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
,
arg_4
=
)
:
if
not
arg_1
:
raise
ValueError
(
"Invalid chain"
)
if
not
arg_4
:
raise
ValueError
(
"Invalid target"
)
if
not
(
arg_2
or
arg_3
)
:
raise
ValueError
(
"Need src, dest, or both"
)
arg_5
=
[
"-I"
,
arg_1
]
if
arg_2
:
arg_5
+=
[
"-s"
,
arg_2
]
if
arg_3
:
arg_5
+=
[
"-d"
,
arg_3
]
arg_5
+=
[
"-j"
,
arg_4
]
arg_0
.
call
(
*
arg_5
)

def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):
        """Insert a new rule in the chain
        """
        if not arg_1:
            raise ValueError("Invalid chain")
        if not arg_4:
            raise ValueError("Invalid target")
        if not (arg_2 or arg_3):
            raise ValueError("Need src, dest, or both")

        arg_5 = ["-I", arg_1]
        if arg_2:
            arg_5 += ["-s", arg_2]
        if arg_3:
            arg_5 += ["-d", arg_3]
        arg_5 += ["-j", arg_4]
        arg_0.call(*arg_5)


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = arg_0 . bind ( * arg_2 , ** arg_3 ) if not all ( arg_6 ( arg_4 . arguments [ arg_5 ] ) for arg_5 , arg_6 in arg_1 ) : raise TypeError return arg_4

def Func(arg_0, arg_1, arg_2, arg_3):
        '''
        Attempt to bind the args to the type signature. First try to just bind
        to the signature, then ensure that all arguments match the parameter
        types.
        '''
        #Bind to signature. May throw its own TypeError
        arg_4 = arg_0.bind(*arg_2, **arg_3)

        if not all(arg_6(arg_4.arguments[arg_5])
                for arg_5, arg_6 in arg_1):
            raise TypeError

        return arg_4

Attempt to bind the args to the type signature . First try to just bind to the signature then ensure that all arguments match the parameter types .


def Func(arg_0, arg_1, arg_2, arg_3):
        """Validates a value against the correct type of the field.

        It calls ``_expected_types`` to get a list of valid types.

        Subclasses can do one of the following:

            1. They can override the ``valid_types`` property with a tuple with
            the expected types for this field.

            2. They can override the ``_expected_types`` method to return a
            tuple of expected types for the field.

            3. They can change ``Func`` completely to customize
            validation.

        This method or the overrides must return the ``value`` parameter
        untouched.
        """
        arg_4 = arg_0._expected_types()
        if not isinstance(arg_1, arg_4):
            raise arg_0._not_expected_type(
                arg_1, arg_4, fields=[arg_0], field_names=arg_2, arg_3=arg_3)
        return arg_1

Validates a value against the correct type of the field.

        It calls ``_expected_types`` to get a list of valid types.

        Subclasses can do one of the following:

            1. They can override the ``valid_types`` property with a tuple with
            the expected types for this field.

            2. They can override the ``_expected_types`` method to return a
            tuple of expected types for the field.

            3. They can change ``check_type`` completely to customize
            validation.

        This method or the overrides must return the ``value`` parameter
        untouched.

Validates a value against the correct type of the field .


return ''.join(random.choice(alphabet) for i in range(num_letters))

def Func ( arg_0 , arg_1 = 128 ) : arg_2 = string . ascii_letters + string . digits + '-_' arg_3 = int ( math . ceil ( arg_1 / 6.0 ) ) return '' . join ( random . choice ( arg_2 ) for arg_4 in range ( arg_3 ) )

def Func(arg_0, arg_1=128):
        """
        Generates a random token, using the url-safe base64 alphabet.
        The "bits" argument specifies the bits of randomness to use.
        """
        arg_2 = string.ascii_letters + string.digits + '-_'
        # alphabet length is 64, so each letter provides lg(64) = 6 bits
        arg_3 = int(math.ceil(arg_1 / 6.0))
        return ''.join(random.choice(arg_2) for arg_4 in range(arg_3))

Generates a random token using the url - safe base64 alphabet . The bits argument specifies the bits of randomness to use .


def Func(arg_0):
        """The Func of this bidict.

        *See also* :attr:`inv`
        """
        # Resolve and return a strong reference to the Func bidict.
        # One may be stored in self._inv already.
        if arg_0._inv is not None:
            return arg_0._inv
        # Otherwise a weakref is stored in self._invweak. Try to get a strong ref from it.
        arg_1 = arg_0._invweak()
        if arg_1 is not None:
            return arg_1
        # Refcount of referent must have dropped to zero, as in `bidict().inv.inv`. Init a new one.
        arg_0._init_inv()  # Now this bidict will retain a strong ref to its Func.
        return arg_0._inv

The inverse of this bidict.

        *See also* :attr:`inv`


def Func(arg_0, arg_1=False):
        """Execute this device

        :param bool root_allowed: Only used for ExecuteCmd
        :return: None
        """
        logger.debug('%s device Funcd (mac %s)', arg_0.name, arg_0.src)
        if not arg_0.Func_instance:
            arg_2 = '%s: There is not execution method in device conf.'
            logger.warning(arg_2, arg_0.name)
            arg_0.send_confirmation(arg_2 % arg_0.name, False)
            return
        try:
            arg_3 = arg_0.Func_instance.Func(arg_1)
        except Exception as e:
            arg_0.send_confirmation('Error executing the device {}: {}'.format(arg_0.name, e), False)
            raise
        else:
            arg_3 = 'The {} device has been started and is running right now'.format(arg_0.name) \
                if arg_3 is None else arg_3
            arg_3 = arg_3 or 'The {} device has been Funcd successfully'.format(arg_0.name)
            arg_0.send_confirmation(arg_3)
        return arg_3


def Func ( arg_0 , arg_1 , ** arg_2 ) : def decorator ( arg_3 ) : arg_0 . filters [ arg_1 ] = ExpressionFilter ( arg_1 , arg_3 , ** arg_2 ) return decorator

def Func(arg_0, arg_1, **arg_2):
        """
        Returns a decorator function for adding an expression filter.

        Args:
            name (str): The name of the filter.
            **kwargs: Variable keyword arguments for the filter.

        Returns:
            Callable[[Callable[[AbstractExpression, Any], AbstractExpression]]]: A decorator
                function for adding an expression filter.
        """

        def decorator(arg_3):
            arg_0.filters[arg_1] = ExpressionFilter(arg_1, arg_3, **arg_2)

        return decorator

Returns a decorator function for adding an expression filter .


def
Func
(
arg_0
,
arg_1
=
)
:
if
arg_1
is
:
arg_2
=
pthread
.
sem_open
(
ctypes
.
c_char_p
(
arg_0
)
,
0
)
else
:
arg_2
=
pthread
.
sem_open
(
ctypes
.
c_char_p
(
arg_0
)
,
SEM_OFLAG
,
SEM_PERM
,
ctypes
.
c_int
(
arg_1
)
)
if
arg_2
==
SEM_FAILURE
:
arg_3
=
ctypes
.
get_errno
(
)
if
arg_3
==
errno
.
EEXIST
:
raise
FileExistsError
(
"a semaphore named %s already exists"
%
arg_0
)
elif
arg_3
==
errno
.
ENOENT
:
raise
FileNotFoundError
(
'cannot find semaphore named %s'
%
arg_0
)
elif
arg_3
==
errno
.
ENOSYS
:
raise
NotImplementedError
(
'No semaphore implementation on this '
'system'
)
else
:
raiseFromErrno
(
)
return
arg_2

def Func(arg_0, arg_1=None):
    """ Construct or retrieve a semaphore with the given name

    If value is None, try to retrieve an existing named semaphore.
    Else create a new semaphore with the given value
    """
    if arg_1 is None:
        arg_2 = pthread.sem_open(ctypes.c_char_p(arg_0), 0)
    else:
        arg_2 = pthread.sem_open(ctypes.c_char_p(arg_0), SEM_OFLAG, SEM_PERM,
                                  ctypes.c_int(arg_1))

    if arg_2 == SEM_FAILURE:
        arg_3 = ctypes.get_errno()
        if arg_3 == errno.EEXIST:
            raise FileExistsError("a semaphore named %s already exists" % arg_0)
        elif arg_3 == errno.ENOENT:
            raise FileNotFoundError('cannot find semaphore named %s' % arg_0)
        elif arg_3 == errno.ENOSYS:
            raise NotImplementedError('No semaphore implementation on this '
                                      'system')
        else:
            raiseFromErrno()

    return arg_2


def Func ( arg_0 , arg_1 = 0 ) : while True : arg_2 = arg_0 . __buffer . read ( arg_1 ) if not arg_2 : arg_0 . __recv ( ) continue yield arg_2

def Func(arg_0, arg_1=0):
        """Generator that reads a block of data from the server.

        It first attempts to read from the internal buffer. If there is not
        enough data in the internal buffer it then requests more data from the
        server and adds it to the buffer.

        Args:
            length: An optional amount of data to retrieve. A length of 0 (the
                default) will retrieve a least one buffer of data.

        Yields:
            A block of data when enough data becomes available.

        Note:
            If a length of 0 is supplied then the size of the yielded buffer can
            vary. If there is data in the internal buffer it will yield all of
            that data otherwise it will yield the the data returned by a recv
            on the socket.
        """
        while True:
            arg_2 = arg_0.__buffer.read(arg_1)
            if not arg_2:
                arg_0.__recv()
                continue
            yield arg_2

Generator that reads a block of data from the server .


def Func ( arg_0 , arg_1 ) : arg_2 = len ( list ( arg_0 . keys ( ) ) [ 0 ] ) arg_3 = sorted ( arg_1 , reverse = True ) arg_4 = count_keys ( len ( arg_3 ) ) arg_5 = [ reduce ( lambda x , y : ( arg_9 [ arg_3 . index ( y ) ] if y in arg_3 else '\\d' ) + x , range ( arg_2 ) , '' ) for arg_9 in arg_4 ] arg_6 = [ ] for arg_7 in arg_5 : arg_8 = 0 for arg_9 , arg_10 in arg_0 . items ( ) : if match ( arg_7 , arg_9 ) : arg_8 += arg_10 arg_6 . append ( arg_8 ) return dict ( zip ( arg_4 , arg_6 ) )

def Func(arg_0, arg_1):
    """
    Compute the marginal counts for a subset of measured qubits.

    Args:
        counts (dict): the counts returned from a backend ({str: int}).
        meas_qubits (list[int]): the qubits to return the marginal
                                 counts distribution for.

    Returns:
        dict: A counts dict for the meas_qubits.abs
        Example: if `counts = {'00': 10, '01': 5}`
            `Func(counts, [0])` returns `{'0': 15, '1': 0}`.
            `Func(counts, [0])` returns `{'0': 10, '1': 5}`.
    """
    # pylint: disable=cell-var-from-loop
    # Extract total number of qubits from count keys
    arg_2 = len(list(arg_0.keys())[0])

    # keys for measured qubits only
    arg_3 = sorted(arg_1, reverse=True)

    arg_4 = count_keys(len(arg_3))

    # get regex match strings for summing outcomes of other qubits
    arg_5 = [
        reduce(lambda x, y: (arg_9[arg_3.index(y)] if y in arg_3 else '\\d') + x,
               range(arg_2), '') for arg_9 in arg_4
    ]

    # build the return list
    arg_6 = []
    for arg_7 in arg_5:
        arg_8 = 0
        for arg_9, arg_10 in arg_0.items():
            if match(arg_7, arg_9):
                arg_8 += arg_10
        arg_6.append(arg_8)

    # return as counts dict on measured qubits only
    return dict(zip(arg_4, arg_6))

Compute the marginal counts for a subset of measured qubits.

    Args:
        counts (dict): the counts returned from a backend ({str: int}).
        meas_qubits (list[int]): the qubits to return the marginal
                                 counts distribution for.

    Returns:
        dict: A counts dict for the meas_qubits.abs
        Example: if `counts = {'00': 10, '01': 5}`
            `marginal_counts(counts, [0])` returns `{'0': 15, '1': 0}`.
            `marginal_counts(counts, [0])` returns `{'0': 10, '1': 5}`.

Compute the marginal counts for a subset of measured qubits .


def Func ( arg_0 , arg_1 ) : if arg_0 . outdir is not None : return os . path . join ( arg_0 . outdir , os . path . basename ( arg_1 ) ) else : return arg_1

def Func(arg_0, arg_1):
        """Path for an output file.

        If :attr:`outdir` is set then the path is
        ``outdir/basename(p)`` else just ``p``
        """
        if arg_0.outdir is not None:
            return os.path.join(arg_0.outdir, os.path.basename(arg_1))
        else:
            return arg_1


return _choi_to_kraus(data, input_dim, output_dim)

def Func(arg_0, arg_1, arg_2, arg_3):
    """Transform a QuantumChannel to the Kraus representation."""
    if arg_0 == 'Kraus':
        return arg_1
    if arg_0 == 'Stinespring':
        return _stinespringFunc(arg_1, arg_2, arg_3)
    if arg_0 == 'Operator':
        return _from_operator('Kraus', arg_1, arg_2, arg_3)
    # Convert via Choi and Kraus
    if arg_0 != 'Choi':
        arg_1 = _to_choi(arg_0, arg_1, arg_2, arg_3)
    return _choiFunc(arg_1, arg_2, arg_3)

Transform a QuantumChannel to the Kraus representation .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
,
arg_3
,
arg_4
=
sys
.
exc_info
(
)
arg_5
=
traceback
.
format_exception
(
arg_2
,
arg_3
,
arg_4
)
arg_6
=
arg_1
.
splitlines
(
)
arg_7
=
arg_5
[
2
]
for
arg_8
,
arg_9
in
enumerate
(
arg_5
)
:
if
'exec source in ns'
in
arg_9
:
arg_7
=
arg_5
[
arg_8
+
1
]
break
arg_10
=
arg_7
.
split
(
','
)
[
0
]
[
8
:
1
]
arg_11
=
int
(
arg_7
.
split
(
','
)
[
1
]
.
replace
(
'line'
,
''
)
.
strip
(
)
)
arg_12
=
[
]
arg_13
=
' '
.
join
(
arg_5
[
arg_8
1
]
.
split
(
','
)
[
1
:
]
)
.
strip
(
)
arg_12
.
append
(
'Error in the Shoebot script at %s:'
%
arg_13
)
for
arg_8
in
xrange
(
max
(
0
,
arg_11
5
)
,
arg_11
)
:
if
arg_10
==
"<string>"
:
arg_14
=
arg_6
[
arg_8
]
else
:
arg_14
=
linecache
.
getline
(
arg_10
,
arg_8
+
1
)
arg_12
.
append
(
'%s: %s'
%
(
arg_8
+
1
,
arg_14
.
rstrip
(
)
)
)
arg_12
.
append
(
'  %s^ %s'
%
(
len
(
str
(
arg_8
)
)
*
' '
,
arg_5
[
1
]
.
rstrip
(
)
)
)
arg_12
.
append
(
''
)
arg_12
.
append
(
arg_5
[
0
]
.
rstrip
(
)
)
for
arg_9
in
arg_5
[
3
:
]
:
arg_12
.
append
(
arg_9
.
rstrip
(
)
)
return
'\n'
.
join
(
arg_12
)

def Func(arg_0, arg_1):
    """
    Format traceback, showing line number and surrounding source.
    """
    arg_2, arg_3, arg_4 = sys.exc_info()
    arg_5 = traceback.format_exception(arg_2, arg_3, arg_4)

    arg_6 = arg_1.splitlines()

    # Defaults...
    arg_7 = arg_5[-2]
    for arg_8, arg_9 in enumerate(arg_5):
        if 'exec source in ns' in arg_9:
            arg_7 = arg_5[arg_8 + 1]
            break

    # extract line number from traceback
    arg_10 = arg_7.split(',')[0][8:-1]
    arg_11 = int(arg_7.split(',')[1].replace('line', '').strip())

    # Build error messages

    arg_12 = []

    # code around the error
    arg_13 = ' '.join(arg_5[arg_8 - 1].split(',')[1:]).strip()  # 'line 37 in blah"
    arg_12.append('Error in the Shoebot script at %s:' % arg_13)
    for arg_8 in xrange(max(0, arg_11 - 5), arg_11):
        if arg_10 == "<string>":
            arg_14 = arg_6[arg_8]
        else:
            arg_14 = linecache.getline(arg_10, arg_8 + 1)
        arg_12.append('%s: %s' % (arg_8 + 1, arg_14.rstrip()))
    arg_12.append('  %s^ %s' % (len(str(arg_8)) * ' ', arg_5[-1].rstrip()))

    arg_12.append('')
    # traceback
    arg_12.append(arg_5[0].rstrip())
    for arg_9 in arg_5[3:]:
        arg_12.append(arg_9.rstrip())

    return '\n'.join(arg_12)

Format traceback showing line number and surrounding source .


def
Func
(
arg_0
)
:
from
IPython
.
external
.
qt_for_kernel
import
QtCore
from
IPython
.
lib
.
guisupport
import
get_app_qt4
,
start_event_Func
arg_0
.
app
=
get_app_qt4
(
[
" "
]
)
arg_0
.
app
.
setQuitOnLastWindowClosed
(
False
)
arg_0
.
timer
=
QtCore
.
QTimer
(
)
arg_0
.
timer
.
timeout
.
connect
(
arg_0
.
do_one_iteration
)
arg_0
.
timer
.
start
(
1000
*
arg_0
.
_poll_interval
)
start_event_Func
(
arg_0
.
app
)

def Func(arg_0):
    """Start a kernel with PyQt4 event loop integration."""

    from IPython.external.qt_for_kernel import QtCore
    from IPython.lib.guisupport import get_app_qt4, start_event_Func

    arg_0.app = get_app_qt4([" "])
    arg_0.app.setQuitOnLastWindowClosed(False)
    arg_0.timer = QtCore.QTimer()
    arg_0.timer.timeout.connect(arg_0.do_one_iteration)
    # Units for the timer are in milliseconds
    arg_0.timer.start(1000*arg_0._poll_interval)
    start_event_Func(arg_0.app)

Start a kernel with PyQt4 event loop integration .


Opens a Django focussed Python shell.
        Essentially the equivalent of running `manage.py shell`.

def Func(arg_0):
        """
        Opens a Django focussed Python Func.
        Essentially the equivalent of running `manage.py Func`.
        """
        arg_1 = arg_0.local_renderer
        if '@' in arg_0.genv.host_string:
            arg_1.env.Func_host_string = arg_0.genv.host_string
        else:
            arg_1.env.Func_host_string = '{user}@{host_string}'
        arg_1.env.Func_default_dir = arg_0.genv.Func_default_dir_template
        arg_1.env.Func_interactive_djFunc_str = arg_0.genv.interactive_Func_template
        arg_1.run_or_local('ssh -t -i {key_filename} {Func_host_string} "{Func_interactive_djFunc_str}"')

Opens a Django focussed Python shell . Essentially the equivalent of running manage . py shell .


def Func(arg_0, arg_1=None):
        """
        Return the number of global loop iterations that are performed.

        If dimension is not None, it is the loop dimension that is returned
        (-1 is the inner most loop and 0 the outermost)
        """
        arg_2 = 1

        if arg_1 is not None:
            arg_3 = [arg_0._loop_stack[arg_1]]
        else:
            arg_3 = reversed(arg_0._loop_stack)

        for arg_4, arg_5, arg_6, arg_7 in arg_3:
            # This unspools the iterations:
            arg_8 = arg_6-arg_5
            arg_2 = arg_2*arg_8
        return arg_0.subs_consts(arg_2)

Return the number of global loop iterations that are performed .


return self.request(path, method, call_params)

def Func ( arg_0 , arg_1 ) : arg_2 = '/' + arg_0 . api_version + '/PlayStop/' arg_3 = 'POST' return arg_0 . request ( arg_2 , arg_3 , arg_1 )

def Func(arg_0, arg_1):
        """REST PlayStop on a Call Helper
        """
        arg_2 = '/' + arg_0.api_version + '/PlayStop/'
        arg_3 = 'POST'
        return arg_0.request(arg_2, arg_3, arg_1)


def
Func
(
arg_0
,
arg_1
=
)
:
try
:
arg_2
=
__import__
(
arg_0
,
fromlist
=
[
'whatever'
]
)
except
ImportError
,
error
:
raise
errors
.
DynamicImportFailed
(
arg_2
=
'.'
.
join
(
[
arg_0
,
arg_1
]
)
,
reason
=
error
)
reload
(
arg_2
)
if
arg_1
is
:
arg_3
=
arg_2
elif
hasattr
(
arg_2
,
arg_1
)
:
arg_3
=
getattr
(
arg_2
,
arg_1
)
else
:
raise
errors
.
DynamicImportFailed
(
arg_2
=
'.'
.
join
(
[
arg_0
,
arg_1
]
)
,
reason
=
'module {} has no attribute {}'
.
format
(
arg_2
.
__name__
,
arg_1
)
)
return
return
arg_3

def Func(arg_0, arg_1=None):
    ''' Take a string and return the corresponding module '''
    try:
        arg_2 = __import__(arg_0, fromlist=['whatever'])
    except ImportError, error:
        raise errors.DynamicImportFailed(
            arg_2='.'.join([arg_0, arg_1]), reason=error)
    # Make sure we're up-to-date
    reload(arg_2)

    if arg_1 is None:
        arg_3 = arg_2
    elif hasattr(arg_2, arg_1):
        arg_3 = getattr(arg_2, arg_1)
    else:
        raise errors.DynamicImportFailed(
            arg_2='.'.join([arg_0, arg_1]),
            reason='module {} has no attribute {}'.
                   format(arg_2.__name__, arg_1))
        return None

    return arg_3


def Func(arg_0):
    """Parse individual information

        Args:
            sample (dict)

        Returns:
            {
                'individual_id': str,
                'father': str,
                'mother': str,
                'display_name': str,
                'sex': str,
                'phenotype': str,
                'bam_file': str,
                'vcf2cytosure': str,
                'analysis_type': str,
                'capture_kits': list(str),
            }

    """
    arg_1 = {}
    if 'sample_id' not in arg_0:
        raise PedigreeError("One sample is missing 'sample_id'")
    arg_2 = arg_0['sample_id']
    # Check the sex
    if 'sex' not in arg_0:
        raise PedigreeError("Sample %s is missing 'sex'" % arg_2)
    arg_3 = arg_0['sex']
    if arg_3 not in REV_SEX_MAP:
        log.warning("'sex' is only allowed to have values from {}"
                    .format(', '.join(list(REV_SEX_MAP.keys()))))
        raise PedigreeError("Individual %s has wrong formated sex" % arg_2)

    # Check the phenotype
    if 'phenotype' not in arg_0:
        raise PedigreeError("Sample %s is missing 'phenotype'"
                            % arg_2)
    arg_4 = arg_0['phenotype']
    if arg_4 not in REV_PHENOTYPE_MAP:
        log.warning("'phenotype' is only allowed to have values from {}"
                    .format(', '.join(list(REV_PHENOTYPE_MAP.keys()))))
        raise PedigreeError("Individual %s has wrong formated phenotype" % arg_2)

    arg_1['individual_id'] = arg_2
    arg_1['display_name'] = arg_0.get('sample_name', arg_0['sample_id'])

    arg_1['sex'] = arg_3
    arg_1['phenotype'] = arg_4

    arg_1['father'] = arg_0.get('father')
    arg_1['mother'] = arg_0.get('mother')

    arg_1['confirmed_parent'] = arg_0.get('confirmed_parent')
    arg_1['confirmed_sex'] = arg_0.get('confirmed_sex')
    arg_1['predicted_ancestry'] = arg_0.get('predicted_ancestry')

    arg_5 = arg_0.get('bam_path')
    if arg_5:
        arg_1['bam_file'] = arg_5

    arg_6 = arg_0.get('mt_bam')
    if arg_6:
        arg_1['mt_bam'] = arg_6

    arg_7 = arg_0.get('analysis_type')
    if arg_7:
        arg_1['analysis_type'] = arg_7

    arg_1['capture_kits'] = ([arg_0.get('capture_kit')]
                                if 'capture_kit' in arg_0 else [])

    # Path to downloadable vcf2cytosure file
    arg_8 = arg_0.get('vcf2cytosure')
    if arg_8:
        arg_1['vcf2cytosure'] = arg_8

    # Cancer specific values
    arg_9 = arg_0.get('tumor_type')
    if arg_9:
        arg_1['tumor_type'] = arg_9

    arg_10 = arg_0.get('tmb')
    if arg_10:
        arg_1['tmb'] = arg_10

    arg_11 = arg_0.get('msi')
    if arg_11:
        arg_1['msi'] = arg_11

    arg_12 = arg_0.get('tumor_purity')
    if arg_12:
        arg_1['tumor_purity'] = arg_12

    return arg_1


def Func ( arg_0 ) : arg_1 = arg_0 . remote_utils . get_url ( arg_0 . url ( ) + "public_tokens/" ) return arg_1 . json ( )

def Func(arg_0):
        """
        Get a list of public tokens available on this server.

        Arguments:
            None

        Returns:
            str[]: list of public tokens
        """
        arg_1 = arg_0.remote_utils.get_url(arg_0.url() + "public_tokens/")
        return arg_1.json()

Get a list of public tokens available on this server .


def Func ( arg_0 , arg_1 ) : arg_2 = { 'Content-Type' : 'application/x-www-form-urlencoded' } arg_3 = { 'action' : 'revoke' } arg_4 = 'bids/{}' . format ( arg_1 ) arg_5 = make_put_request ( arg_0 , arg_4 , arg_2 = arg_2 , params_data = arg_3 ) arg_6 = arg_5 . json ( ) if arg_5 . status_code == 200 : return arg_6 [ 'status' ] else : arg_6 = arg_5 . json ( ) raise BidNotRevokedException ( message = arg_6 [ 'message' ] , error_code = arg_6 [ 'error_code' ] , request_id = arg_6 [ 'request_id' ] )

def Func(arg_0, arg_1):
    """
    Revoke a bid on a project
    """
    arg_2 = {
        'Content-Type': 'application/x-www-form-urlencoded'
    }
    arg_3 = {
        'action': 'revoke'
    }
    # POST /api/projects/0.1/bids/{bid_id}/?action=revoke
    arg_4 = 'bids/{}'.format(arg_1)
    arg_5 = make_put_request(arg_0, arg_4, arg_2=arg_2,
                                params_data=arg_3)
    arg_6 = arg_5.json()
    if arg_5.status_code == 200:
        return arg_6['status']
    else:
        arg_6 = arg_5.json()
        raise BidNotRevokedException(message=arg_6['message'],
                                     error_code=arg_6['error_code'],
                                     request_id=arg_6['request_id'])


def Func ( arg_0 , arg_1 = 0.0 ) : arg_2 = [ ( arg_4 . eigenvalue , arg_4 ) for arg_4 in arg_0 . nodes if arg_4 . eigenvalue > arg_1 ] arg_2 . sort ( ) arg_2 . reverse ( ) return [ arg_4 for arg_3 , arg_4 in arg_2 ]

def Func(arg_0, arg_1=0.0):
        """ Returns nodes sorted by eigenvector centrality.
        Nodes with a lot of incoming traffic will be at the front of the list
        """
        arg_2 = [(arg_4.eigenvalue, arg_4) for arg_4 in arg_0.nodes if arg_4.eigenvalue > arg_1]
        arg_2.sort(); arg_2.reverse()
        return [arg_4 for arg_3, arg_4 in arg_2]

Returns nodes sorted by eigenvector centrality . Nodes with a lot of incoming traffic will be at the front of the list


(self, environment_name, description=None, option_settings=[], tier_type=None, tier_name=None,
                           tier_version='1.0')

def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
[
]
,
arg_4
=
,
arg_5
=
,
arg_6
=
'1.0'
)
:
out
(
"Updating environment: "
+
str
(
arg_1
)
)
arg_7
=
arg_0
.
ebs
.
validate_configuration_settings
(
arg_0
.
app_name
,
arg_3
,
arg_1
=
arg_1
)
arg_7
=
arg_7
[
'ValidateConfigurationSettingsResponse'
]
[
'ValidateConfigurationSettingsResult'
]
[
'Messages'
]
arg_8
=
True
for
arg_9
in
arg_7
:
if
arg_9
[
'Severity'
]
==
'error'
:
arg_8
=
False
out
(
"["
+
arg_9
[
'Severity'
]
+
"] "
+
str
(
arg_1
)
+
" - '"
+
arg_9
[
'Namespace'
]
+
":"
+
arg_9
[
'OptionName'
]
+
"': "
+
arg_9
[
'Message'
]
)
arg_0
.
ebs
.
Func
(
arg_1
=
arg_1
,
arg_2
=
arg_2
,
arg_3
=
arg_3
,
arg_4
=
arg_4
,
arg_5
=
arg_5
,
arg_6
=
arg_6
)

def Func(arg_0, arg_1, arg_2=None, arg_3=[], arg_4=None, arg_5=None,
                           arg_6='1.0'):
        """
        Updates an application version
        """
        out("Updating environment: " + str(arg_1))
        arg_7 = arg_0.ebs.validate_configuration_settings(arg_0.app_name, arg_3,
                                                            arg_1=arg_1)
        arg_7 = arg_7['ValidateConfigurationSettingsResponse']['ValidateConfigurationSettingsResult']['Messages']
        arg_8 = True
        for arg_9 in arg_7:
            if arg_9['Severity'] == 'error':
                arg_8 = False
            out("[" + arg_9['Severity'] + "] " + str(arg_1) + " - '" \
                + arg_9['Namespace'] + ":" + arg_9['OptionName'] + "': " + arg_9['Message'])
        arg_0.ebs.Func(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=arg_6)


def Func ( arg_0 : arg_1 ) -> bytes : if PY36 : return arg_0 . to_bytes ( 2 , byteorder = "little" ) else : return arg_0 . to_bytes ( 1 , byteorder = "little" )

def Func(arg_0: arg_1) -> bytes:
    """
    Wraps an instruction to be Python 3.6+ compatible. This does nothing on Python 3.5 and below.

    This is most useful for operating on bare, single-width instructions such as
    ``RETURN_FUNCTION`` in a version portable way.

    :param instruction: The instruction integer to use.
    :return: A safe bytes object, if applicable.
    """
    if PY36:
        return arg_0.to_bytes(2, byteorder="little")
    else:
        return arg_0.to_bytes(1, byteorder="little")

Wraps an instruction to be Python 3 . 6 + compatible . This does nothing on Python 3 . 5 and below .


def Func ( arg_0 , arg_1 = None , ** arg_2 ) : arg_3 = arg_0 . get ( arg_1 = arg_1 , ** arg_2 ) arg_4 = arg_0 . endpoint + '%d/%s/' % ( arg_3 [ 'id' ] , 'ansible_facts' ) return client . get ( arg_4 , params = { } ) . json ( )

def Func(arg_0, arg_1=None, **arg_2):
        """Return a JSON object of all available facts of the given host.

        Note global option --format is not available here, as the output would always be JSON-formatted.

        =====API DOCS=====
        List all available facts of the given host.

        :param pk: Primary key of the target host.
        :type pk: int
        :param `**kwargs`: Keyword arguments list of available fields used for searching resource objects.
        :returns: A JSON object of all available facts of the given host.
        :rtype: dict
        =====API DOCS=====
        """
        arg_3 = arg_0.get(arg_1=arg_1, **arg_2)
        arg_4 = arg_0.endpoint + '%d/%s/' % (arg_3['id'], 'ansible_facts')
        return client.get(arg_4, params={}).json()

Return a JSON object of all available facts of the given host .


return len(mylist) - mylist[::-1].index(x) - 1

def Func ( arg_0 : arg_1 [ arg_2 ] , arg_3 : arg_2 ) -> int : return len ( arg_0 ) - arg_0 [ : : - 1 ] . index ( arg_3 ) - 1

def Func(arg_0: arg_1[arg_2], arg_3: arg_2) -> int:
    """Index of the last occurrence of x in the sequence."""
    return len(arg_0) - arg_0[::-1].index(arg_3) - 1

Index of the last occurrence of x in the sequence .


def
Func
(
)
:
arg_0
=
CredentialSearch
(
)
arg_1
=
argparse
.
ArgumentParser
(
parents
=
[
arg_0
.
argparser
]
,
conflict_handler
=
'resolve'
)
arg_1
.
add_argument
(
'-c'
,
'--count'
,
help
=
"Only show the number of results"
,
action
=
"store_true"
)
arg_2
=
arg_1
.
parse_args
(
)
if
arg_2
.
count
:
print_line
(
"Number of credentials: {}"
.
format
(
arg_0
.
argument_count
(
)
)
)
else
:
arg_3
=
arg_0
.
get_credentials
(
)
for
arg_4
in
arg_3
:
print_json
(
arg_4
.
to_dict
(
include_meta
=
True
)
)

def Func():
    """
        Main credentials tool
    """
    arg_0 = CredentialSearch()
    arg_1 = argparse.ArgumentParser(parents=[arg_0.argparser], conflict_handler='resolve')
    arg_1.add_argument('-c', '--count', help="Only show the number of results", action="store_true")
    arg_2 = arg_1.parse_args()

    if arg_2.count:
        print_line("Number of credentials: {}".format(arg_0.argument_count()))
    else:
        arg_3 = arg_0.get_credentials()
        for arg_4 in arg_3:
            print_json(arg_4.to_dict(include_meta=True))


def Func ( arg_0 , arg_1 , arg_2 = None ) -> np . ndarray : arg_2 = arg_2 or len ( arg_1 ) arg_3 = np . zeros ( shape = ( arg_2 , ) , dtype = np . int32 ) for arg_4 , arg_5 in enumerate ( arg_1 ) : arg_3 [ arg_4 ] = arg_0 . tags . tok2idx ( arg_5 ) return arg_3

def Func(arg_0, arg_1, arg_2=None) -> np.ndarray:
        """Transforms a sentence of tags to Numpy array, which will be the network target.

        Args:
            tags: input sentence of tags
            bucket_length: the width of the bucket

        Returns:
            A 2d array, answer[i][j] contains the index of j-th tag in i-th input sentence.
        """
        arg_2 = arg_2 or len(arg_1)
        arg_3 = np.zeros(shape=(arg_2,), dtype=np.int32)
        for arg_4, arg_5 in enumerate(arg_1):
            arg_3[arg_4] = arg_0.tags.tok2idx(arg_5)
        return arg_3

Transforms a sentence of tags to Numpy array which will be the network target .


def Func ( arg_0 , ** arg_1 ) : arg_2 = '' if 'with_root' in arg_1 and arg_1 . pop ( 'with_root' ) : arg_2 = arg_0 . root . rstrip ( os . sep ) + os . sep for arg_3 , arg_4 , arg_5 in os . Func ( arg_0 . root , ** arg_1 ) : arg_6 = arg_3 [ len ( arg_0 . root ) : ] . lstrip ( os . sep ) arg_7 = arg_6 . split ( os . sep ) if arg_6 else [ ] for arg_8 in arg_4 [ : ] : arg_9 = '/' . join ( arg_7 + [ arg_8 ] ) arg_10 = arg_0 . included ( arg_9 , is_dir = True ) if arg_10 : yield arg_2 + arg_9 + '/' elif arg_10 is False : arg_4 . remove ( arg_8 ) for arg_11 in arg_5 : arg_9 = '/' . join ( arg_7 + [ arg_11 ] ) if arg_0 . included ( arg_9 ) : yield arg_2 + arg_9

def Func(arg_0, **arg_1):
        """ Like `os.Func` and taking the same keyword arguments,
            but generating paths relative to the root.

            Starts in the fileset's root and filters based on its patterns.
            If ``with_root=True`` is passed in, the generated paths include
            the root path.
        """
        arg_2 = ''
        if 'with_root' in arg_1 and arg_1.pop('with_root'):
            arg_2 = arg_0.root.rstrip(os.sep) + os.sep

        for arg_3, arg_4, arg_5 in os.Func(arg_0.root, **arg_1):
            arg_6 = arg_3[len(arg_0.root):].lstrip(os.sep)
            arg_7 = arg_6.split(os.sep) if arg_6 else []

            for arg_8 in arg_4[:]:
                arg_9 = '/'.join(arg_7 + [arg_8])
                arg_10 = arg_0.included(arg_9, is_dir=True)
                if arg_10:
                    yield arg_2 + arg_9 + '/'
                elif arg_10 is False:
                    arg_4.remove(arg_8)

            for arg_11 in arg_5:
                arg_9 = '/'.join(arg_7 + [arg_11])
                if arg_0.included(arg_9):
                    yield arg_2 + arg_9

Like `os.walk` and taking the same keyword arguments,
            but generating paths relative to the root.

            Starts in the fileset's root and filters based on its patterns.
            If ``with_root=True`` is passed in, the generated paths include
            the root path.

Like os . walk and taking the same keyword arguments but generating paths relative to the root .


return QuerysetReport(
        "Credit Notes",
        ["id",
         "invoice__user__attendee__attendeeprofilebase__invoice_recipient",
         "status", "value"],
        notes,
        headings=["id", "Owner", "Status", "Value"],
        link_view=views.credit_note,
    )

def Func(arg_0, arg_1):
    ''' Shows all of the credit notes in the system. '''

    arg_2 = commerce.CreditNote.objects.all().select_related(
        "creditnoterefund",
        "creditnoteapplication",
        "invoice",
        "invoice__user__attendee__attendeeprofilebase",
    )

    return QuerysetReport(
        "Credit Notes",
        ["id",
         "invoice__user__attendee__attendeeprofilebase__invoice_recipient",
         "status", "value"],
        arg_2,
        headings=["id", "Owner", "Status", "Value"],
        link_view=views.credit_note,
    )

Shows all of the credit notes in the system .


(self, i, r,
                            summarize=False,
                            report_unexpected_exceptions=True,
                            context=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
False
,
arg_4
=
True
,
arg_5
=
)
:
for
arg_6
,
arg_7
,
arg_8
,
arg_9
,
arg_10
in
arg_0
.
_value_checks
:
if
arg_1
%
arg_10
==
0
:
arg_11
=
arg_0
.
_field_names
.
index
(
arg_6
)
if
arg_11
<
len
(
arg_2
)
:
arg_12
=
arg_2
[
arg_11
]
try
:
arg_7
(
arg_12
)
except
ValueError
:
arg_13
=
{
'code'
:
arg_8
}
if
not
arg_3
:
arg_13
[
'message'
]
=
arg_9
arg_13
[
'row'
]
=
arg_1
+
1
arg_13
[
'column'
]
=
arg_11
+
1
arg_13
[
'field'
]
=
arg_6
arg_13
[
'value'
]
=
arg_12
arg_13
[
'record'
]
=
arg_2
if
arg_5
is
not
:
arg_13
[
'context'
]
=
arg_5
yield
arg_13
except
Exception
as
e
:
if
arg_4
:
arg_13
=
{
'code'
:
UNEXPECTED_EXCEPTION
}
if
not
arg_3
:
arg_13
[
'message'
]
=
MESSAGES
[
UNEXPECTED_EXCEPTION
]
%
(
e
.
__class__
.
__name__
,
e
)
arg_13
[
'row'
]
=
arg_1
+
1
arg_13
[
'column'
]
=
arg_11
+
1
arg_13
[
'field'
]
=
arg_6
arg_13
[
'value'
]
=
arg_12
arg_13
[
'record'
]
=
arg_2
arg_13
[
'exception'
]
=
e
arg_13
[
'function'
]
=
'%s: %s'
%
(
arg_7
.
__name__
,
arg_7
.
__doc__
)
if
arg_5
is
not
:
arg_13
[
'context'
]
=
arg_5
yield
arg_13

def Func(arg_0, arg_1, arg_2,
                            arg_3=False,
                            arg_4=True,
                            arg_5=None):
        """Apply value check functions on the given record `r`."""

        for arg_6, arg_7, arg_8, arg_9, arg_10 in arg_0._value_checks:
            if arg_1 % arg_10 == 0: # support sampling
                arg_11 = arg_0._field_names.index(arg_6)
                if arg_11 < len(arg_2): # only apply checks if there is a value
                    arg_12 = arg_2[arg_11]
                    try:
                        arg_7(arg_12)
                    except ValueError:
                        arg_13 = {'code': arg_8}
                        if not arg_3:
                            arg_13['message'] = arg_9
                            arg_13['row'] = arg_1 + 1
                            arg_13['column'] = arg_11 + 1
                            arg_13['field'] = arg_6
                            arg_13['value'] = arg_12
                            arg_13['record'] = arg_2
                            if arg_5 is not None: arg_13['context'] = arg_5
                        yield arg_13
                    except Exception as e:
                        if arg_4:
                            arg_13 = {'code': UNEXPECTED_EXCEPTION}
                            if not arg_3:
                                arg_13['message'] = MESSAGES[UNEXPECTED_EXCEPTION] % (e.__class__.__name__, e)
                                arg_13['row'] = arg_1 + 1
                                arg_13['column'] = arg_11 + 1
                                arg_13['field'] = arg_6
                                arg_13['value'] = arg_12
                                arg_13['record'] = arg_2
                                arg_13['exception'] = e
                                arg_13['function'] = '%s: %s' % (arg_7.__name__,
                                                            arg_7.__doc__)
                                if arg_5 is not None: arg_13['context'] = arg_5
                            yield arg_13

Apply value check functions on the given record r .


def Func ( arg_0 , arg_1 = None , ** arg_2 ) : arg_0 . fields = [ ] if arg_1 != None : for arg_3 in arg_1 : arg_0 . fields . append ( arg_3 )

def Func(arg_0, arg_1 = None, **arg_2):
    """
    Sets the fields.
    """
    arg_0.fields = []
    if arg_1 != None:
      for arg_3 in arg_1:
        arg_0.fields.append(arg_3)


def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_3 = arg_0 . request ( 'GET' , '/v1/' + arg_1 , arg_2 = arg_2 ) return arg_3 . addCallback ( arg_0 . _handle_response )

def Func(arg_0, arg_1, **arg_2):
        """
        Read data from Vault. Returns the JSON-decoded response.
        """
        arg_3 = arg_0.request('GET', '/v1/' + arg_1, arg_2=arg_2)
        return arg_3.addCallback(arg_0._handle_response)

Read data from Vault . Returns the JSON - decoded response .


def Func ( arg_0 , arg_1 ) : try : arg_2 = arg_0 . disco_class ( arg_1 . get_query ( ) ) arg_0 . got_it ( arg_2 ) except ValueError , e : arg_0 . error ( e )

def Func(arg_0,arg_1):
        """Handle successful disco response.

        :Parameters:
            - `stanza`: the stanza received.
        :Types:
            - `stanza`: `pyxmpp.stanza.Stanza`"""
        try:
            arg_2=arg_0.disco_class(arg_1.get_query())
            arg_0.got_it(arg_2)
        except ValueError,e:
            arg_0.error(e)


def Func(arg_0):
        """Level-2 parser for arrays.

        pattern:
        object 3 class array type double rank 0 items 12 data follows
        0 2 0
        0 0 3.6
        0 -2.0 1e-12
        +4.534e+01 .34534 0.43654
        attribute "dep" string "positions"
        """
        try:
            arg_1 = arg_0.__consume()
        except DXParserNoTokens:
            return

        if arg_1.equals('type'):
            arg_1 = arg_0.__consume()
            if not arg_1.iscode('STRING'):
                raise DXParseError('array: type was "%s", not a string.'%\
                                   arg_1.text)
            arg_0.currentobject['type'] = arg_1.value()
        elif arg_1.equals('rank'):
            arg_1 = arg_0.__consume()
            try:
                arg_0.currentobject['rank'] = arg_1.value('INTEGER')
            except ValueError:
                raise DXParseError('array: rank was "%s", not an integer.'%\
                                   arg_1.text)
        elif arg_1.equals('items'):
            arg_1 = arg_0.__consume()
            try:
                arg_0.currentobject['size'] = arg_1.value('INTEGER')
            except ValueError:
                raise DXParseError('array: items was "%s", not an integer.'%\
                                   arg_1.text)
        elif arg_1.equals('data'):
            arg_1 = arg_0.__consume()
            if not arg_1.iscode('STRING'):
                raise DXParseError('array: data was "%s", not a string.'%\
                                   arg_1.text)
            if arg_1.text != 'follows':
                raise NotImplementedError(\
                            'array: Only the "data follows header" format is supported.')
            if not arg_0.currentobject['size']:
                raise DXParseError("array: missing number of items")
            # This is the slow part.  Once we get here, we are just
            # reading in a long list of numbers.  Conversion to floats
            # will be done later when the numpy array is created.

            # Don't assume anything about whitespace or the number of elements per row
            arg_0.currentobject['array'] = []
            while len(arg_0.currentobject['array']) <arg_0.currentobject['size']:
                 arg_0.currentobject['array'].extend(arg_0.dxfile.readline().strip().split())

            # If you assume that there are three elements per row
            # (except the last) the following version works and is a little faster.
            # for i in range(int(numpy.ceil(self.currentobject['size']/3))):
            #     self.currentobject['array'].append(self.dxfile.readline())
            # self.currentobject['array'] = ' '.join(self.currentobject['array']).split()
        elif arg_1.equals('attribute'):
            # not used at the moment
            arg_3 = arg_0.__consume().value()
            if not arg_0.__consume().equals('string'):
                raise DXParseError('array: "string" expected.')
            arg_4 = arg_0.__consume().value()
        else:
            raise DXParseError('array: '+str(arg_1)+' not recognized.')


(val, displaywidth, msg_nocr, msg, lineprefix='')

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = '' ) : if type ( arg_0 ) != list : return False arg_5 = True for arg_6 in range ( len ( arg_0 ) ) : if not ( type ( arg_0 [ arg_6 ] ) in [ bool , float , int ] ) : arg_5 = False if not ( type ( arg_0 [ arg_6 ] ) in [ bool , float , int , bytes ] ) : return False pass pass arg_7 = columnize ( [ repr ( v ) for v in arg_0 ] , opts = { "arrange_array" : True , "lineprefix" : arg_4 , "displaywidth" : int ( arg_1 ) - 3 , 'ljust' : not arg_5 } ) arg_2 ( arg_7 ) return True

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=''):
    '''Try to pretty print a simple case where a list is not nested.
    Return True if we can do it and False if not. '''

    if type(arg_0) != list:
        return False

    arg_5 = True
    for arg_6 in range(len(arg_0)):
        if not (type(arg_0[arg_6]) in [bool, float, int]):
            arg_5 = False
            if not (type(arg_0[arg_6]) in [bool, float, int, bytes]):
                return False
            pass
        pass
    arg_7 = columnize([repr(v) for v in arg_0],
                     opts={"arrange_array": True,
                           "lineprefix": arg_4,
                           "displaywidth": int(arg_1)-3,
                           'ljust': not arg_5})
    arg_2(arg_7)
    return True

Try to pretty print a simple case where a list is not nested . Return True if we can do it and False if not .


def Func(arg_0):
    """Wrapper for _log_counter_per_token.

    Args:
    token: The token for which to look up the count.

    Returns:
    The number of times this function has been called with
    *token* as an argument (starting at 0)
    """
    global arg_1  # pylint: disable=global-variable-not-assigned
    arg_1[arg_0] = 1 + arg_1.get(arg_0, -1)
    return arg_1[arg_0]


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

        Args:
            country: (optional) ISO 3166-1 code.
            append_to_response: (optional) Comma separated, any movie method.

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

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

Get the alternative titles for a specific movie id .


def
Func
(
arg_0
)
:
with
arg_0
.
_lock
:
if
arg_0
.
_aggregator
:
try
:
return
arg_0
.
_poolFunc
(
arg_0
.
_aggregator
)
except
PoolConnectionException
:
arg_0
.
_aggregator
=
if
not
len
(
arg_0
.
_aggregators
)
:
with
arg_0
.
_poolFunc
(
arg_0
.
_primary_aggregator
)
as
conn
:
arg_0
.
_update_aggregator_list
(
conn
)
conn
.
expire
(
)
random
.
shuffle
(
arg_0
.
_aggregators
)
arg_2
=
for
arg_3
in
arg_0
.
_aggregators
:
arg_0
.
logger
.
debug
(
'Attempting connection with %s:%s'
%
(
arg_3
[
0
]
,
arg_3
[
1
]
)
)
try
:
conn
=
arg_0
.
_poolFunc
(
arg_3
)
arg_0
.
_aggregator
=
arg_3
return
conn
except
PoolConnectionException
as
e
:
arg_2
=
e
else
:
arg_0
.
_aggregator
=
arg_0
.
_aggregators
=
[
]
raise
arg_2

def Func(arg_0):
        """ Returns an aggregator connection. """
        with arg_0._lock:
            if arg_0._aggregator:
                try:
                    return arg_0._poolFunc(arg_0._aggregator)
                except PoolConnectionException:
                    arg_0._aggregator = None

            if not len(arg_0._aggregators):
                with arg_0._poolFunc(arg_0._primary_aggregator) as conn:
                    arg_0._update_aggregator_list(conn)
                    conn.expire()

            random.shuffle(arg_0._aggregators)

            arg_2 = None
            for arg_3 in arg_0._aggregators:
                arg_0.logger.debug('Attempting connection with %s:%s' % (arg_3[0], arg_3[1]))

                try:
                    conn = arg_0._poolFunc(arg_3)
                    # connection successful!
                    arg_0._aggregator = arg_3
                    return conn
                except PoolConnectionException as e:
                    # connection error
                    arg_2 = e
            else:
                # bad news bears...  try again later
                arg_0._aggregator = None
                arg_0._aggregators = []

                raise arg_2