def Func(arg_0):
        # type: () -> ArgumentParser
        """
        Returns the argument parser that will be used to interpret
        arguments and options from argv.
        """
        arg_1 = ArgumentParser(
            description=arg_0.__doc__,
            epilog='PyOTA v{version}'.format(version=__version__),
        )

        arg_1.add_argument(
            '--uri',
            type=text_type,
            default='http://localhost:14265/',

            help=(
                'URI of the node to connect to '
                '(defaults to http://localhost:14265/).'
            ),
        )

        if arg_0.requires_seed:
            arg_1.add_argument(
                '--seed-file',
                type=text_type,
                dest='seed_file',

                help=(
                    'Path to a file containing your seed in cleartext. '
                    'If not provided, you will be prompted to enter '
                    'your seed via stdin.'
                ),
            )

        arg_1.add_argument(
            '--testnet',
            action='store_true',
            default=False,
            help='If set, use testnet settings (e.g., for PoW).',
        )

        return arg_1

Returns the argument parser that will be used to interpret arguments and options from argv .


def Func ( arg_0 , arg_1 = None ) : arg_2 = [ ] for arg_3 , arg_4 in arg_0 . items ( ) : arg_5 = "/" . join ( [ arg_1 , arg_3 ] ) if arg_1 else arg_3 if isinstance ( arg_4 , dict ) and "format" not in arg_4 : arg_2 . extend ( Func ( arg_4 , arg_1 = arg_5 ) ) else : arg_2 . append ( ( arg_5 , arg_4 ) ) return arg_2

def Func(arg_0, arg_1=None):
    """Flatten dict tree into dictionary where keys are paths of old dict."""
    arg_2 = []
    for arg_3, arg_4 in arg_0.items():
        arg_5 = "/".join([arg_1, arg_3]) if arg_1 else arg_3
        if isinstance(arg_4, dict) and "format" not in arg_4:
            arg_2.extend(Func(arg_4, arg_1=arg_5))
        else:
            arg_2.append((arg_5, arg_4))
    return arg_2

Flatten dict tree into dictionary where keys are paths of old dict .


def Func(arg_0):
        """
        When dynamic, not all argument values may be available.
        """
        arg_1 = arg_0.copy()
        arg_2 = [el for el in enumerate(arg_1)]
        for (arg_3, arg_4) in arg_2:
            if len(arg_2) > 1: print("Group %d" % arg_3)
            arg_5 = arg_0.constant_keys + arg_0.varying_keys
            # Ordered nicely by varying_keys definition.
            arg_6 = [', '.join(['%s=%s' % (k, s[k]) for k in arg_5]) for s in arg_4]
            print('\n'.join(['%d: %s' % (arg_7,arg_8) for (arg_7,arg_8) in enumerate(arg_6)]))

        print('Remaining arguments not available for %s' % arg_0.__class__.__name__)

When dynamic not all argument values may be available .


def Func ( arg_0 , arg_1 ) : for arg_2 in arg_0 . client . issue_collection ( arg_1 , "activity" ) : arg_3 = json . loads ( arg_2 ) for arg_4 in arg_3 [ 'entries' ] : arg_4 [ 'person_data' ] = arg_0 . __fetch_user_data ( '{PERSON}' , arg_4 [ 'person_link' ] ) yield arg_4

def Func(arg_0, arg_1):
        """Get activities on an issue"""

        for arg_2 in arg_0.client.issue_collection(arg_1, "activity"):
            arg_3 = json.loads(arg_2)

            for arg_4 in arg_3['entries']:
                arg_4['person_data'] = arg_0.__fetch_user_data('{PERSON}', arg_4['person_link'])
                yield arg_4


def
Func
(
arg_0
)
:
print
(
"Framenumber: {}"
.
format
(
arg_0
.
framenumber
)
)
arg_1
,
arg_2
=
arg_0
.
get_3d_markers
(
)
print
(
"Component info: {}"
.
format
(
arg_1
)
)
for
arg_3
in
arg_2
:
print
(
"\t"
,
arg_3
)

def Func(arg_0):
    """ Callback function that is called everytime a data packet arrives from QTM """
    print("Framenumber: {}".format(arg_0.framenumber))
    arg_1, arg_2 = arg_0.get_3d_markers()
    print("Component info: {}".format(arg_1))
    for arg_3 in arg_2:
        print("\t", arg_3)


def Func(arg_0):
        """
        Get the plot Func for a specific movie id.

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

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

Get the plot keywords for a specific movie id.

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

Get the plot keywords for a specific movie id .


def Func(arg_0: arg_1) -> Callable[..., Any]:
    """Decorator for metric registration."""
    def decorate(arg_2):
        arg_3 = arg_2.__module__ + ':' + arg_2.__name__
        if arg_0 in arg_4 and arg_4[arg_0] != arg_3:
            log.warning('"{}" is already registered as a metric name, the old function will be ignored'
                        .format(arg_0))
        arg_4[arg_0] = arg_3
        return arg_2
    return decorate


return {Chem.MolToSmiles(m, isomericSmiles=True) for m in tautomers}

def Func ( arg_0 ) : arg_1 = Chem . MolFromSmiles ( arg_0 , sanitize = False ) arg_1 = Standardizer ( ) . standardize ( arg_1 ) arg_2 = TautomerEnumerator ( ) . enumerate ( arg_1 ) return { Chem . MolToSmiles ( arg_3 , isomericSmiles = True ) for arg_3 in arg_2 }

def Func(arg_0):
    """Return a set of tautomers as SMILES strings, given a SMILES string.

    :param smiles: A SMILES string.
    :returns: A set containing SMILES strings for every possible tautomer.
    :rtype: set of strings.
    """
    # Skip sanitize as standardize does this anyway
    arg_1 = Chem.MolFromSmiles(arg_0, sanitize=False)
    arg_1 = Standardizer().standardize(arg_1)
    arg_2 = TautomerEnumerator().enumerate(arg_1)
    return {Chem.MolToSmiles(arg_3, isomericSmiles=True) for arg_3 in arg_2}

Return a set of tautomers as SMILES strings given a SMILES string .


return [Device(item) for item in data['devices']]

async def Func ( arg_0 ) -> List [ Device ] : arg_1 = await arg_0 . http . available_devices ( ) return [ Device ( arg_2 ) for arg_2 in arg_1 [ 'devices' ] ]

async def Func(arg_0) -> List[Device]:
        """Get information about the users avaliable devices.

        Returns
        -------
        devices : List[Device]
            The devices the user has available.
        """
        arg_1 = await arg_0.http.available_devices()
        return [Device(arg_2) for arg_2 in arg_1['devices']]

Get information about the users avaliable devices .


def Func ( arg_0 , arg_1 = None , ** arg_2 ) : arg_3 = arg_0 . render_to_message ( arg_1 = arg_1 , ** arg_2 ) return arg_3 . Func ( )

def Func(arg_0, arg_1=None, **arg_2):
        """
        Renders and Funcs an email message.

        All keyword arguments other than ``extra_context`` are passed through
        as keyword arguments when constructing a new :attr:`message_class`
        instance for this message.

        This method exists primarily for convenience, and the proper
        rendering of your message should not depend on the behavior of this
        method. To alter how a message is created, override
        :meth:``render_to_message`` instead, since that should always be
        called, even if a message is not sent.

        :param extra_context: Any additional context data that will be used
            when rendering this message.
        :type extra_context: :class:`dict`
        """
        arg_3 = arg_0.render_to_message(arg_1=arg_1, **arg_2)
        return arg_3.Func()

Renders and sends an email message.

        All keyword arguments other than ``extra_context`` are passed through
        as keyword arguments when constructing a new :attr:`message_class`
        instance for this message.

        This method exists primarily for convenience, and the proper
        rendering of your message should not depend on the behavior of this
        method. To alter how a message is created, override
        :meth:``render_to_message`` instead, since that should always be
        called, even if a message is not sent.

        :param extra_context: Any additional context data that will be used
            when rendering this message.
        :type extra_context: :class:`dict`


def Func(arg_0):
    '''Create a plot of conv filters, visualized as pixel arrays.'''
    arg_1 = arg_0.get_value()

    arg_2, arg_3, arg_4, arg_5 = arg_1.shape
    arg_6 = int(np.sqrt(arg_2))
    assert arg_6 * arg_6 == arg_2, 'filters must contain a square number of rows!'
    assert arg_3 == 1 or arg_3 == 3, 'can only plot grayscale or rgb filters!'

    arg_7 = np.zeros(((arg_5+1) * arg_6 - 1, (arg_4+1) * arg_6 - 1, arg_3), dtype=arg_1[0].dtype)
    for arg_8, arg_9 in enumerate(arg_1):
        arg_10, arg_11 = divmod(arg_8, arg_6)
        arg_7[arg_10 * (arg_5+1):(arg_10+1) * (arg_5+1) - 1,
            arg_11 * (arg_4+1):(arg_11+1) * (arg_4+1) - 1] = arg_9.transpose((1, 2, 0))

    arg_7 -= arg_7.min()
    arg_7 /= arg_7.max()

    arg_12 = plt.gcf().add_subplot(111)
    arg_12.xaxis.set_visible(False)
    arg_12.yaxis.set_visible(False)
    arg_12.set_frame_on(False)
    arg_12.imshow(arg_7.squeeze(), cmap=plt.cm.gray)

Create a plot of conv filters visualized as pixel arrays .


def Func ( arg_0 ) : arg_1 = os . path . abspath ( arg_0 ) arg_2 = sorted ( glob . glob ( os . path . dirname ( arg_1 ) + "/*.*" ) ) arg_3 = arg_0 for arg_4 in arg_2 : if arg_4 . endswith ( ".abf" ) and arg_4 . replace ( ".abf" , ".TIF" ) in arg_2 : arg_3 = os . path . basename ( arg_4 ) . replace ( ".abf" , "" ) if os . path . basename ( arg_1 ) in arg_4 : break return arg_3

def Func(arg_0):
    """given an ABF file name, return the ABF of its parent."""
    arg_1=os.path.abspath(arg_0)
    arg_2=sorted(glob.glob(os.path.dirname(arg_1)+"/*.*"))
    arg_3=arg_0 #its own parent
    for arg_4 in arg_2:
        if arg_4.endswith(".abf") and arg_4.replace(".abf",".TIF") in arg_2:
            arg_3=os.path.basename(arg_4).replace(".abf","")
        if os.path.basename(arg_1) in arg_4:
            break
    return arg_3

given an ABF file name return the ABF of its parent .


def Func(arg_0, arg_1, arg_2):
        """Convert and validate a positional argument.

        Args:
            index (int): The positional index of the argument
            arg_value (object): The value to convert and validate

        Returns:
            object: The converted value.
        """

        # For bound methods, skip self
        if arg_0._has_self:
            if arg_1 == 0:
                return arg_2

            arg_1 -= 1

        arg_3 = arg_0.arg_names[arg_1]
        return arg_0.convert_argument(arg_3, arg_2)

Convert and validate a positional argument .


def Func ( arg_0 , arg_1 , arg_2 ) : if validations . validate_doc_namespace ( arg_2 ) : arg_1 . ext_document_references [ - 1 ] . spdx_document_uri = arg_2 else : raise SPDXValueError ( 'Document::ExternalDocumentRef' )

def Func(arg_0, arg_1, arg_2):
        """
        Sets the `spdx_document_uri` attribute of the `ExternalDocumentRef`
        object.
        """
        if validations.validate_doc_namespace(arg_2):
            arg_1.ext_document_references[-1].spdx_document_uri = arg_2
        else:
            raise SPDXValueError('Document::ExternalDocumentRef')

Sets the spdx_document_uri attribute of the ExternalDocumentRef object .


def
Func
(
arg_0
)
:
LOG
.
info
(
"Running scout Func"
)
arg_1
=
arg_0
.
obj
[
'mongodb'
]
LOG
.
info
(
"Dropping database %s"
,
arg_1
)
try
:
arg_0
.
obj
[
'client'
]
.
drop_database
(
arg_1
)
except
Exception
as
err
:
LOG
.
warning
(
err
)
arg_0
.
abort
(
)
LOG
.
info
(
"Dropped whole database"
)

def Func(arg_0):
    """Drop the mongo database given."""
    LOG.info("Running scout Func")
    arg_1 = arg_0.obj['mongodb']
    LOG.info("Dropping database %s", arg_1)
    try:
        arg_0.obj['client'].drop_database(arg_1)
    except Exception as err:
        LOG.warning(err)
        arg_0.abort()
    LOG.info("Dropped whole database")


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
,
arg_4
=
)
:
if
arg_3
:
return
(
arg_0
*
arg_3
arg_1
)
/
arg_2
elif
arg_4
:
return
arg_1
/
arg_2
*
(
arg_4
*
arg_0
1.
)
else
:
raise
Exception
(
'Either dV_dT or beta is needed'
)

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):
    r'''Calculate a real fluid's Joule Thomson coefficient. The required
    derivative should be calculated with an equation of state, and `Cp` is the
    real fluid versions. This can either be calculated with `dV_dT` directly,
    or with `beta` if it is already known.

    .. math::
        \mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
        \left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]
        = \frac{V}{C_p}\left(\beta T-1\right)

    Parameters
    ----------
    T : float
        Temperature of fluid, [K]
    V : float
        Molar volume of fluid, [m^3/mol]
    Cp : float
        Real fluid heat capacity at constant pressure, [J/mol/K]
    dV_dT : float, optional
        Derivative of `V` with respect to `T`, [m^3/mol/K]
    beta : float, optional
        Isobaric coefficient of a thermal expansion, [1/K]

    Returns
    -------
    mu_JT : float
        Joule-Thomson coefficient [K/Pa]

    Examples
    --------
    Example from [2]_:

    >>> Func(T=390, V=0.00229754, Cp=153.235, dV_dT=1.226396e-05)
    1.621956080529905e-05

    References
    ----------
    .. [1] Walas, Stanley M. Phase Equilibria in Chemical Engineering.
       Butterworth-Heinemann, 1985.
    .. [2] Pratt, R. M. "Thermodynamic Properties Involving Derivatives: Using
       the Peng-Robinson Equation of State." Chemical Engineering Education 35,
       no. 2 (March 1, 2001): 112-115.
    '''
    if arg_3:
        return (arg_0*arg_3 - arg_1)/arg_2
    elif arg_4:
        return arg_1/arg_2*(arg_4*arg_0 - 1.)
    else:
        raise Exception('Either dV_dT or beta is needed')

r'''Calculate a real fluid's Joule Thomson coefficient. The required
    derivative should be calculated with an equation of state, and `Cp` is the
    real fluid versions. This can either be calculated with `dV_dT` directly,
    or with `beta` if it is already known.

    .. math::
        \mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
        \left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]
        = \frac{V}{C_p}\left(\beta T-1\right)

    Parameters
    ----------
    T : float
        Temperature of fluid, [K]
    V : float
        Molar volume of fluid, [m^3/mol]
    Cp : float
        Real fluid heat capacity at constant pressure, [J/mol/K]
    dV_dT : float, optional
        Derivative of `V` with respect to `T`, [m^3/mol/K]
    beta : float, optional
        Isobaric coefficient of a thermal expansion, [1/K]

    Returns
    -------
    mu_JT : float
        Joule-Thomson coefficient [K/Pa]

    Examples
    --------
    Example from [2]_:

    >>> Joule_Thomson(T=390, V=0.00229754, Cp=153.235, dV_dT=1.226396e-05)
    1.621956080529905e-05

    References
    ----------
    .. [1] Walas, Stanley M. Phase Equilibria in Chemical Engineering.
       Butterworth-Heinemann, 1985.
    .. [2] Pratt, R. M. "Thermodynamic Properties Involving Derivatives: Using
       the Peng-Robinson Equation of State." Chemical Engineering Education 35,
       no. 2 (March 1, 2001): 112-115.

r Calculate a real fluid s Joule Thomson coefficient . The required derivative should be calculated with an equation of state and Cp is the real fluid versions . This can either be calculated with dV_dT directly or with beta if it is already known .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = [ i for i in arg_0 if arg_1 ( i ) == arg_2 ] if not arg_3 : arg_4 = re . compile ( re . escape ( arg_2 ) + '$' , re . IGNORECASE ) arg_3 = [ i for i in arg_0 if arg_4 . match ( arg_1 ( i ) ) ] if not arg_3 : arg_4 = re . compile ( re . escape ( arg_2 ) ) arg_3 = [ i for i in arg_0 if arg_4 . match ( arg_1 ( i ) ) ] if not arg_3 : arg_4 = re . compile ( re . escape ( arg_2 ) , re . IGNORECASE ) arg_3 = [ i for i in arg_0 if arg_4 . match ( arg_1 ( i ) ) ] if not arg_3 : arg_4 = re . compile ( re . escape ( arg_2 ) ) arg_3 = [ i for i in arg_0 if arg_4 . search ( arg_1 ( i ) ) ] if not arg_3 : arg_4 = re . compile ( re . escape ( arg_2 ) , re . IGNORECASE ) arg_3 = [ i for i in arg_0 if arg_4 . search ( arg_1 ( i ) ) ] return arg_3

def Func(arg_0, arg_1, arg_2):
    """
    Find a item a given list by a matching name.

    The search for the name is done in this relaxing way:

    - exact name match
    - case-insentive name match
    - attribute starts with the name
    - attribute starts with the name (case insensitive)
    - name appears in the attribute
    - name appears in the attribute (case insensitive)

    :param    list_: A list of elements
    :type     list_: ``list``

    :param    namegetter: Function that returns the name for a given
                          element in the list
    :type     namegetter: ``function``

    :param    name: Name to search for
    :type     name: ``str``

    """
    arg_3 = [i for i in arg_0 if arg_1(i) == arg_2]
    if not arg_3:
        arg_4 = re.compile(re.escape(arg_2) + '$', re.IGNORECASE)
        arg_3 = [i for i in arg_0 if arg_4.match(arg_1(i))]
    if not arg_3:
        arg_4 = re.compile(re.escape(arg_2))
        arg_3 = [i for i in arg_0 if arg_4.match(arg_1(i))]
    if not arg_3:
        arg_4 = re.compile(re.escape(arg_2), re.IGNORECASE)
        arg_3 = [i for i in arg_0 if arg_4.match(arg_1(i))]
    if not arg_3:
        arg_4 = re.compile(re.escape(arg_2))
        arg_3 = [i for i in arg_0 if arg_4.search(arg_1(i))]
    if not arg_3:
        arg_4 = re.compile(re.escape(arg_2), re.IGNORECASE)
        arg_3 = [i for i in arg_0 if arg_4.search(arg_1(i))]
    return arg_3

Find a item a given list by a matching name .


def Func ( arg_0 = arg_1 ) : arg_2 = [ ] for arg_3 , arg_4 , arg_5 in os . walk ( arg_0 , followlinks = True ) : if os . path . exists ( pjoin ( arg_3 , '__init__.py' ) ) : arg_2 . append ( os . path . relpath ( arg_3 , arg_0 ) . replace ( os . path . sep , '.' ) ) elif arg_3 != arg_0 : arg_4 [ : ] = [ ] return arg_2

def Func(arg_0=arg_1):
    """
    Find all of the packages.
    """
    arg_2 = []
    for arg_3, arg_4, arg_5 in os.walk(arg_0, followlinks=True):
        if os.path.exists(pjoin(arg_3, '__init__.py')):
            arg_2.append(os.path.relpath(arg_3, arg_0).replace(os.path.sep, '.'))
        elif arg_3 != arg_0:
            # Do not look for packages in subfolders if current is not a package
            arg_4[:] = []
    return arg_2


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = '%s.%s' % ( arg_0 , PREFS_MODULE_NAME ) arg_4 = { '_prefs_app' : arg_0 , '_get_prefs' : staticmethod ( arg_2 ) , '__module__' : arg_3 , 'Meta' : type ( 'Meta' , ( models . options . Options , ) , { 'verbose_name' : _ ( 'Preference' ) , 'verbose_name_plural' : _ ( 'Preferences' ) , 'app_label' : arg_0 , 'managed' : False , } ) } for arg_5 , arg_6 in arg_1 . items ( ) : arg_4 [ arg_5 ] = arg_6 . field arg_7 = type ( 'Preferences' , ( models . Model , ) , arg_4 ) def fake_save_base ( arg_8 , * arg_9 , ** arg_10 ) : arg_11 = { f . name : getattr ( arg_8 , f . name ) for f in arg_8 . _meta . fields if not isinstance ( f , models . fields . AutoField ) } arg_12 = arg_8 . _get_prefs ( arg_8 . _prefs_app ) for arg_13 in arg_12 . keys ( ) : if arg_13 in arg_11 : arg_12 [ arg_13 ] . db_value = arg_11 [ arg_13 ] arg_8 . pk = arg_8 . _prefs_app prefs_save . send ( sender = arg_8 , arg_0 = arg_8 . _prefs_app , arg_11 = arg_11 ) return True arg_7 . save_base = fake_save_base return arg_7

def Func(arg_0, arg_1, arg_2):
    """Returns preferences model class dynamically crated for a given app or None on conflict."""

    arg_3 = '%s.%s' % (arg_0, PREFS_MODULE_NAME)

    arg_4 = {
            '_prefs_app': arg_0,
            '_get_prefs': staticmethod(arg_2),
            '__module__': arg_3,
            'Meta': type('Meta', (models.options.Options,), {
                'verbose_name': _('Preference'),
                'verbose_name_plural': _('Preferences'),
                'app_label': arg_0,
                'managed': False,
            })
    }

    for arg_5, arg_6 in arg_1.items():
        arg_4[arg_5] = arg_6.field

    arg_7 = type('Preferences', (models.Model,), arg_4)

    def fake_save_base(arg_8, *arg_9, **arg_10):

        arg_11 = {
            f.name: getattr(arg_8, f.name) for f in arg_8._meta.fields if not isinstance(f, models.fields.AutoField)
        }

        arg_12 = arg_8._get_prefs(arg_8._prefs_app)

        for arg_13 in arg_12.keys():
            if arg_13 in arg_11:
                arg_12[arg_13].db_value = arg_11[arg_13]

        arg_8.pk = arg_8._prefs_app  # Make Django 1.7 happy.
        prefs_save.send(sender=arg_8, arg_0=arg_8._prefs_app, arg_11=arg_11)

        return True

    arg_7.save_base = fake_save_base

    return arg_7

Returns preferences model class dynamically crated for a given app or None on conflict .


def Func ( arg_0 ) : arg_1 = len ( arg_0 ) arg_2 = 2 ** np . arange ( arg_1 - 1 , - 1 , - 1 ) return int ( np . dot ( arg_0 , arg_2 ) )

def Func(arg_0):
    """
    Convert binary array back a nonnegative integer. The array length is
    the bit width. The first input index holds the MSB and the last holds the LSB.
    """
    arg_1 = len(arg_0)
    arg_2 = 2**np.arange(arg_1-1,-1,-1)
    return int(np.dot(arg_0,arg_2))

Convert binary array back a nonnegative integer . The array length is the bit width . The first input index holds the MSB and the last holds the LSB .


return (self.redirect is not None and
                hasattr(self.redirect, 'isatty') and self.redirect.isatty())

def Func ( arg_0 ) : return ( arg_0 . redirect is not None and hasattr ( arg_0 . redirect , 'Func' ) and arg_0 . redirect . Func ( ) )

def Func(arg_0):  # nocover
        """
        Returns true of the redirect is a terminal.

        Notes:
            Needed for IPython.embed to work properly when this class is used
            to override stdout / stderr.
        """
        return (arg_0.redirect is not None and
                hasattr(arg_0.redirect, 'Func') and arg_0.redirect.Func())

Returns true of the redirect is a terminal .


def Func ( arg_0 , arg_1 ) : arg_0 . bot . canvas . sink . trigger_fullscreen_action ( True ) print ( arg_0 . response_prompt , file = arg_0 . stdout )

def Func(arg_0, arg_1):
        """
        Make the current window fullscreen
        """
        arg_0.bot.canvas.sink.trigger_fullscreen_action(True)
        print(arg_0.response_prompt, file=arg_0.stdout)


(config_files,
                                    bindings,
                                    finalize_config=True,
                                    skip_unknown=False)

def Func ( arg_0 , arg_1 , arg_2 = True , arg_3 = False ) : if arg_0 is None : arg_0 = [ ] if arg_1 is None : arg_1 = '' for arg_4 in arg_0 : parse_config_file ( arg_4 , arg_3 ) parse_config ( arg_1 , arg_3 ) if arg_2 : finalize ( )

def Func(arg_0,
                                    arg_1,
                                    arg_2=True,
                                    arg_3=False):
  """Parse a list of config files followed by extra Gin bindings.

  This function is equivalent to:

      for config_file in config_files:
        gin.parse_config_file(config_file, skip_configurables)
      gin.parse_config(bindings, skip_configurables)
      if finalize_config:
        gin.finalize()

  Args:
    config_files: A list of paths to the Gin config files.
    bindings: A list of individual parameter binding strings.
    finalize_config: Whether to finalize the config after parsing and binding
      (defaults to True).
    skip_unknown: A boolean indicating whether unknown configurables and imports
      should be skipped instead of causing errors (alternatively a list of
      configurable names to skip if unknown). See `parse_config` for additional
      details.
  """
  if arg_0 is None:
    arg_0 = []
  if arg_1 is None:
    arg_1 = ''
  for arg_4 in arg_0:
    parse_config_file(arg_4, arg_3)
  parse_config(arg_1, arg_3)
  if arg_2:
    finalize()

Parse a list of config files followed by extra Gin bindings .


def Func ( arg_0 ) : arg_1 = [ x . serialize ( ) for x in arg_0 . self_signer . keyjar . get_signing_key ( ) ] if not arg_1 : arg_1 = [ x . serialize ( ) for x in arg_0 . self_signer . keyjar . get_signing_key ( owner = arg_0 . iss ) ] return { 'keys' : arg_1 }

def Func(arg_0):
        """
        Build a JWKS from the signing keys belonging to the self signer

        :return: Dictionary
        """
        arg_1 = [x.serialize() for x in arg_0.self_signer.keyjar.get_signing_key()]
        if not arg_1:
            arg_1 = [x.serialize() for x in
                  arg_0.self_signer.keyjar.get_signing_key(owner=arg_0.iss)]
        return {'keys': arg_1}


def
Func
(
)
:
arg_0
=
inspect
.
stack
(
)
[
:
0
:
1
]
return
"\n"
.
join
(
[
"%30s : %s @%d"
%
(
arg_1
[
3
]
,
arg_1
[
1
]
,
arg_1
[
2
]
)
for
arg_1
in
arg_0
]
)

def Func():
    """Return a string summarizing the call stack."""
    arg_0 = inspect.stack()[:0:-1]
    return "\n".join(["%30s : %s @%d" % (arg_1[3],arg_1[1],arg_1[2]) for arg_1 in arg_0])

Return a string summarizing the call stack .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = os . path . normpath ( arg_1 ) arg_4 = arg_0 . path arg_5 = arg_0 if arg_3 in ( "" , "." ) : return arg_5 arg_6 = False for arg_7 in arg_3 . split ( os . sep ) : arg_8 = os . path . join ( arg_4 , arg_7 ) if not os . path . exists ( arg_8 ) : os . mkdir ( arg_8 ) arg_5 = dict . __getitem__ ( arg_5 , "directories" ) if arg_5 . get ( arg_7 , None ) is None : arg_6 = True arg_5 [ arg_7 ] = { "directories" : { } , "files" : { } , "timestamp" : datetime . utcnow ( ) , "id" : str ( uuid . uuid1 ( ) ) , "info" : arg_2 } arg_5 = arg_5 [ arg_7 ] arg_4 = arg_8 if arg_6 : arg_0 . save ( ) return arg_5

def Func(arg_0, arg_1, arg_2=None):
        """
        Adds a directory in the repository and creates its
        attribute in the Repository with utc timestamp.
        It insures adding all the missing directories in the path.

        :Parameters:
            #. relativePath (string): The relative to the repository path of the directory to add in the repository.
            #. info (None, string, pickable object): Any random info about the folder.

        :Returns:
            #. info (dict): The directory info dict.
        """
        arg_3 = os.path.normpath(arg_1)
        # create directories
        arg_4  = arg_0.path
        arg_5 = arg_0
        if arg_3 in ("","."):
            return arg_5
        arg_6 = False
        for arg_7 in arg_3.split(os.sep):
            arg_8 = os.path.join(arg_4, arg_7)
            # create directory
            if not os.path.exists(arg_8):
                 os.mkdir(arg_8)
            # create dictionary key
            arg_5 = dict.__getitem__(arg_5, "directories")
            if arg_5.get(arg_7, None) is None:
                arg_6 = True
                arg_5[arg_7] = {"directories":{}, "files":{},
                                    "timestamp":datetime.utcnow(),
                                    "id":str(uuid.uuid1()),
                                    "info": arg_2} # INFO MUST BE SET ONLY FOR THE LAST DIRECTORY

            arg_5 = arg_5[arg_7]
            arg_4  = arg_8
        # save repository
        if arg_6:
            arg_0.save()
        # return currentDict
        return arg_5

Adds a directory in the repository and creates its attribute in the Repository with utc timestamp . It insures adding all the missing directories in the path .


def Func(arg_0, arg_1):
        """Load word from storage"""
        arg_2 = arg_0.address
        arg_0._publish('will_evm_read_storage', arg_2, arg_1)
        arg_3 = arg_0.world.get_storage_data(arg_2, arg_1)
        arg_0._publish('did_evm_read_storage', arg_2, arg_1, arg_3)
        return arg_3


def Func ( arg_0 ) : if arg_0 . Tcapture > 0 : arg_0 . DSP_toc . append ( time . time ( ) - arg_0 . start_time )

def Func(arg_0):
        """
        Add new toc time to the DSP_toc list. Will not be called if
        Tcapture = 0.

        """
        if arg_0.Tcapture > 0:
            arg_0.DSP_toc.append(time.time()-arg_0.start_time)

Add new toc time to the DSP_toc list . Will not be called if Tcapture = 0 .


(self, corpus, n_val=1, bos='_START_', eos='_END_')

def Func(arg_0, arg_1, arg_2=1, arg_3='_START_', arg_4='_END_'):
        r"""Fill in self.ngcorpus from a Corpus argument.

        Parameters
        ----------
        corpus :Corpus
            The Corpus from which to initialize the n-gram corpus
        n_val : int
            Maximum n value for n-grams
        bos : str
            String to insert as an indicator of beginning of sentence
        eos : str
            String to insert as an indicator of end of sentence

        Raises
        ------
        TypeError
            Corpus argument of the Corpus class required.

        Example
        -------
        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\n'
        >>> tqbf += 'And then it slept.\n And the dog ran off.'
        >>> ngcorp = NGramCorpus()
        >>> ngcorp.Func(Corpus(tqbf))

        """
        if not arg_1 or not isinstance(arg_1, Corpus):
            raise TypeError('Corpus argument of the Corpus class required.')

        arg_5 = arg_1.sents()

        for arg_6 in arg_5:
            arg_7 = Counter(arg_6)
            for arg_8 in arg_7.keys():
                arg_0._add_to_ngcorpus(arg_0.ngcorpus, [arg_8], arg_7[arg_8])

            if arg_2 > 1:
                if arg_3 and arg_3 != '':
                    arg_6 = [arg_3] + arg_6
                if arg_4 and arg_4 != '':
                    arg_6 += [arg_4]
                for arg_9 in range(2, arg_2 + 1):
                    for arg_10 in range(len(arg_6) - arg_9 + 1):
                        arg_0._add_to_ngcorpus(
                            arg_0.ngcorpus, arg_6[arg_10 : arg_10 + arg_9], 1
                        )

r"""Fill in self.ngcorpus from a Corpus argument.

        Parameters
        ----------
        corpus :Corpus
            The Corpus from which to initialize the n-gram corpus
        n_val : int
            Maximum n value for n-grams
        bos : str
            String to insert as an indicator of beginning of sentence
        eos : str
            String to insert as an indicator of end of sentence

        Raises
        ------
        TypeError
            Corpus argument of the Corpus class required.

        Example
        -------
        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\n'
        >>> tqbf += 'And then it slept.\n And the dog ran off.'
        >>> ngcorp = NGramCorpus()
        >>> ngcorp.corpus_importer(Corpus(tqbf))

r Fill in self . ngcorpus from a Corpus argument .


(provider, job_id, poll_interval, retries, job_descriptor)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
)
:
while
True
:
arg_5
=
arg_0
.
lookup_job_tasks
(
{
'*'
}
,
job_ids
=
[
arg_1
]
)
arg_6
=
set
(
)
arg_7
=
set
(
)
arg_8
=
set
(
)
arg_9
=
set
(
)
arg_10
=
dict
(
)
arg_11
=
arg_12
=
dict
(
)
for
arg_13
in
arg_5
:
arg_14
=
job_model
.
numeric_task_id
(
arg_13
.
get_field
(
'task-id'
)
)
arg_12
[
arg_14
]
=
arg_13
arg_15
=
arg_13
.
get_field
(
'task-status'
)
if
arg_15
==
'FAILURE'
:
arg_10
[
arg_14
]
=
arg_10
.
get
(
arg_14
,
0
)
+
1
if
arg_10
[
arg_14
]
>
arg_3
:
arg_9
.
add
(
arg_14
)
arg_11
=
arg_13
elif
arg_15
==
'CANCELED'
:
arg_8
.
add
(
arg_14
)
if
not
arg_11
:
arg_11
=
arg_13
elif
arg_15
==
'SUCCESS'
:
arg_7
.
add
(
arg_14
)
elif
arg_15
==
'RUNNING'
:
arg_6
.
add
(
arg_14
)
arg_16
=
(
set
(
arg_10
)
.
difference
(
arg_9
)
.
difference
(
arg_6
)
.
difference
(
arg_7
)
.
difference
(
arg_8
)
)
if
not
arg_16
and
not
arg_6
:
if
arg_11
:
return
[
arg_0
.
get_tasks_completion_messages
(
[
arg_11
]
)
]
return
[
]
for
arg_14
in
arg_16
:
arg_17
=
'{}.{}'
.
format
(
arg_1
,
arg_14
)
if
arg_14
else
arg_1
print
(
'  {} (attempt {}) failed. Retrying.'
.
format
(
arg_17
,
arg_10
[
arg_14
]
)
)
arg_18
=
arg_12
[
arg_14
]
.
get_field
(
'status-message'
)
print
(
'  Failure message: {}'
.
format
(
arg_18
)
)
_retry_task
(
arg_0
,
arg_4
,
arg_14
,
arg_10
[
arg_14
]
+
1
)
SLEEP_FUNCTION
(
arg_2
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
  """Wait for job and retry any tasks that fail.

  Stops retrying an individual task when: it succeeds, is canceled, or has been
  retried "retries" times.

  This function exits when there are no tasks running and there are no tasks
  eligible to be retried.

  Args:
    provider: job service provider
    job_id: a single job ID (string) to wait for
    poll_interval: integer seconds to wait between iterations
    retries: number of retries
    job_descriptor: job descriptor used to originally submit job

  Returns:
    Empty list if there was no error,
    a list containing an error message from a failed task otherwise.
  """

  while True:
    arg_5 = arg_0.lookup_job_tasks({'*'}, job_ids=[arg_1])

    arg_6 = set()
    arg_7 = set()
    arg_8 = set()
    arg_9 = set()
    arg_10 = dict()

    # This is an arbitrary task that is either fully failed or canceled (with
    # preference for the former).
    arg_11 = None

    arg_12 = dict()
    for arg_13 in arg_5:
      arg_14 = job_model.numeric_task_id(arg_13.get_field('task-id'))
      arg_12[arg_14] = arg_13

      arg_15 = arg_13.get_field('task-status')
      if arg_15 == 'FAILURE':
        # Could compute this from task-attempt as well.
        arg_10[arg_14] = arg_10.get(arg_14, 0) + 1
        if arg_10[arg_14] > arg_3:
          arg_9.add(arg_14)
          arg_11 = arg_13
      elif arg_15 == 'CANCELED':
        arg_8.add(arg_14)
        if not arg_11:
          arg_11 = arg_13
      elif arg_15 == 'SUCCESS':
        arg_7.add(arg_14)
      elif arg_15 == 'RUNNING':
        arg_6.add(arg_14)

    arg_16 = (
        set(arg_10).difference(arg_9)
        .difference(arg_6).difference(arg_7)
        .difference(arg_8))

    # job completed.
    if not arg_16 and not arg_6:
      # If there are any fully failed tasks, return the completion message of an
      # arbitrary one.
      # If not, but there are canceled tasks, return the completion message of
      # an arbitrary one.
      if arg_11:
        return [arg_0.get_tasks_completion_messages([arg_11])]

      # Otherwise successful completion.
      return []

    for arg_14 in arg_16:
      arg_17 = '{}.{}'.format(arg_1, arg_14) if arg_14 else arg_1
      print('  {} (attempt {}) failed. Retrying.'.format(
          arg_17, arg_10[arg_14]))
      arg_18 = arg_12[arg_14].get_field('status-message')
      print('  Failure message: {}'.format(arg_18))

      _retry_task(arg_0, arg_4, arg_14,
                  arg_10[arg_14] + 1)

    SLEEP_FUNCTION(arg_2)

Wait for job and retry any tasks that fail .


def Func(arg_0, arg_1, arg_2, arg_3):
        """ Reimplemented to highlight selectively.
        """
        arg_1 += arg_0._current_offset
        super(FrontendHighlighter, arg_0).Func(arg_1, arg_2, arg_3)

Reimplemented to highlight selectively .


Ensure all logging output has been flushed

def Func ( arg_0 ) : if len ( arg_0 . _buffer ) > 0 : arg_0 . logger . log ( arg_0 . level , arg_0 . _buffer ) arg_0 . _buffer = str ( )

def Func(arg_0):
        """
        Ensure all logging output has been Funced
        """
        if len(arg_0._buffer) > 0:
            arg_0.logger.log(arg_0.level, arg_0._buffer)
            arg_0._buffer = str()


def Func ( arg_0 , arg_1 , arg_2 ) : if sys . version_info < ( 3 , ) : arg_1 = str ( arg_1 ) . decode ( 'utf-8' ) arg_2 = str ( arg_2 ) . decode ( 'utf-8' ) arg_0 . _httprequest . set_request_header ( arg_1 , arg_2 )

def Func(arg_0, arg_1, arg_2):
        ''' Sends the headers of request. '''
        if sys.version_info < (3,):
            arg_1 = str(arg_1).decode('utf-8')
            arg_2 = str(arg_2).decode('utf-8')
        arg_0._httprequest.set_request_header(arg_1, arg_2)


def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : arg_1 = { } arg_1 . update ( arg_0 . default_data ) return json . dumps ( arg_1 )

def Func(arg_0, arg_1=None):
        """Adds the default_data to data and dumps it to a json."""
        if arg_1 is None:
            arg_1 = {}
        arg_1.update(arg_0.default_data)
        return json.dumps(arg_1)

Adds the default_data to data and dumps it to a json .


def Func ( arg_0 ) : @ functools . wraps ( arg_0 ) def new_func ( arg_1 , * arg_2 , ** arg_3 ) : arg_4 = ConfigInterpreter ( arg_3 ) arg_5 = arg_4 . interpret ( ) arg_0 ( arg_1 , * arg_2 , ** arg_5 ) arg_4 . add_parameters ( arg_1 . traj ) return new_func

def Func(arg_0):
    """Decorator wrapping the environment to use a config file"""
    @functools.wraps(arg_0)
    def new_func(arg_1, *arg_2, **arg_3):
        arg_4 = ConfigInterpreter(arg_3)
        # Pass the config data to the kwargs
        arg_5 = arg_4.interpret()
        arg_0(arg_1, *arg_2, **arg_5)
        # Add parameters and config data from the `.ini` file
        arg_4.add_parameters(arg_1.traj)
    return new_func


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . remove_exit ( ) arg_1 . menu = arg_0 arg_0 . items . append ( arg_1 ) if arg_2 : arg_0 . add_exit ( ) if arg_0 . screen : arg_4 , arg_5 = arg_0 . screen . getmaxyx ( ) if arg_4 < 6 + len ( arg_0 . items ) : arg_0 . screen . resize ( 6 + len ( arg_0 . items ) , arg_5 ) arg_0 . draw ( )

def Func(arg_0, arg_1):
        """
        Add an item to the end of the menu before the exit item

        :param MenuItem item: The item to be added
        """
        arg_2 = arg_0.remove_exit()
        arg_1.menu = arg_0
        arg_0.items.append(arg_1)
        if arg_2:
            arg_0.add_exit()
        if arg_0.screen:
            arg_4, arg_5 = arg_0.screen.getmaxyx()
            if arg_4 < 6 + len(arg_0.items):
                arg_0.screen.resize(6 + len(arg_0.items), arg_5)
            arg_0.draw()


def Func ( arg_0 , arg_1 = None ) : if arg_1 is not None : arg_1 = arg_0 . prepare ( arg_1 ) arg_0 . response . write ( arg_1 , serialize = True )

def Func(arg_0, arg_1=None):
        """Fills the response object from the passed data."""
        if arg_1 is not None:
            # Prepare the data for transmission.
            arg_1 = arg_0.prepare(arg_1)

            # Encode the data using a desired encoder.
            arg_0.response.write(arg_1, serialize=True)

Fills the response object from the passed data .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = Pauli . from_label ( arg_3 ) arg_5 = np . zeros ( arg_1 , dtype = np . bool ) arg_6 = np . zeros ( arg_1 , dtype = np . bool ) arg_5 [ arg_2 ] = arg_4 . z [ 0 ] arg_6 [ arg_2 ] = arg_4 . x [ 0 ] return arg_0 ( arg_5 , arg_6 )

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Generate single qubit pauli at index with pauli_label with length num_qubits.

        Args:
            num_qubits (int): the length of pauli
            index (int): the qubit index to insert the single qubii
            pauli_label (str): pauli

        Returns:
            Pauli: single qubit pauli
        """
        arg_4 = Pauli.from_label(arg_3)
        arg_5 = np.zeros(arg_1, dtype=np.bool)
        arg_6 = np.zeros(arg_1, dtype=np.bool)

        arg_5[arg_2] = arg_4.z[0]
        arg_6[arg_2] = arg_4.x[0]

        return arg_0(arg_5, arg_6)

Generate single qubit pauli at index with pauli_label with length num_qubits .


return self._mc_client._patch(url=self._build_path(list_id, 'segments', segment_id), data=data)

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Funcs an existing list segment.
        """
        return arg_0._mc_client._patch(url=arg_0._build_path(arg_1, 'segments', arg_2), arg_3=arg_3)


(self, filename, frames, fps, loop=0, palette=256)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = 0 , arg_5 = 256 ) : from PIL import Image arg_6 = [ ] for arg_7 in arg_2 : arg_8 = open ( arg_7 , 'rb' ) . read ( ) arg_6 . append ( Image . open ( io . BytesIO ( arg_8 ) ) ) arg_9 = round ( 1 / arg_3 , 2 ) arg_10 = arg_6 . pop ( 0 ) arg_10 . save ( arg_1 , save_all = True , append_images = arg_6 , arg_9 = arg_9 , arg_4 = arg_4 , arg_5 = arg_5 )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0, arg_5=256):
        """
        Write a series of frames as a single animated GIF.

        :param str filename: the name of the GIF file to write

        :param list frames: a list of filenames, each of which represents a single
            frame of the animation.  Each frame must have exactly the same
            dimensions, and the code has only been tested with .gif files.

        :param float fps:
            The number of frames per second.

        :param int loop:
            The number of iterations. Default 0 (meaning loop indefinitely).

        :param int palette:
            The number of colors to quantize the image to. Is rounded to
            the nearest power of two. Default 256.
        """

        from PIL import Image
        arg_6 = []
        for arg_7 in arg_2:
            arg_8 = open(arg_7, 'rb').read()
            arg_6.append(Image.open(io.BytesIO(arg_8)))

        # GIF duration is only measured to a hundredth of a second
        arg_9 = round(1 / arg_3, 2)
        arg_10 = arg_6.pop(0)
        arg_10.save(arg_1,
                save_all=True,
                append_images=arg_6,
                arg_9=arg_9,
                arg_4=arg_4,
                arg_5=arg_5)

Write a series of frames as a single animated GIF .


def Func(arg_0, arg_1, arg_2=None):
        """
        Fail given zombie tasks, which are tasks that haven't
        had a heartbeat for too long, in the current DagBag.

        :param zombies: zombie task instances to kill.
        :type zombies: airflow.utils.dag_processing.SimpleTaskInstance
        :param session: DB session.
        :type session: sqlalchemy.orm.session.Session
        """
        from airflow.models.taskinstance import TaskInstance  # Avoid circular import

        for arg_3 in arg_1:
            if arg_3.dag_id in arg_0.dags:
                arg_4 = arg_0.dags[arg_3.dag_id]
                if arg_3.task_id in arg_4.task_ids:
                    arg_5 = arg_4.get_task(arg_3.task_id)
                    arg_6 = TaskInstance(arg_5, arg_3.execution_date)
                    # Get properties needed for failure handling from SimpleTaskInstance.
                    arg_6.start_date = arg_3.start_date
                    arg_6.end_date = arg_3.end_date
                    arg_6.try_number = arg_3.try_number
                    arg_6.state = arg_3.state
                    arg_6.test_mode = configuration.getboolean('core', 'unit_test_mode')
                    arg_6.handle_failure("{} detected as zombie".format(arg_6),
                                      arg_6.test_mode, arg_6.get_template_context())
                    arg_0.log.info(
                        'Marked zombie job %s as %s', arg_6, arg_6.state)
                    Stats.incr('zombies_killed')
        arg_2.commit()

Fail given zombie tasks which are tasks that haven t had a heartbeat for too long in the current DagBag .


def Func(arg_0, arg_1, arg_2=True):
        """
        Writes the supplied specifications to the log path. The data
        may be supplied as either as a an Args or as a list of
        dictionaries.

        By default, specifications will be appropriately appended to
        an existing log file. This can be disabled by setting
        allow_append to False.
        """
        arg_3 = os.path.isfile(arg_0)
        arg_4 = isinstance(arg_1, list)

        if arg_3 and not arg_2:
            raise Exception('Appending has been disabled'
                            ' and file %s exists' % arg_0)

        if not (arg_4 or isinstance(arg_1, Args)):
            raise Exception('Can only write Args objects or dictionary'
                            ' lists to log file.')

        arg_5 = arg_1 if arg_4 else arg_1.specs
        if not all(isinstance(arg_6,dict) for arg_6 in arg_5):
            raise Exception('List elements must be dictionaries.')

        arg_7 = open(arg_0, 'r+') if arg_3 else open(arg_0, 'w')
        arg_8 = int(arg_7.readlines()[-1].split()[0])+1 if arg_3 else 0
        arg_9 = range(arg_8, arg_8+len(arg_1))

        arg_10 = '\n'.join(['%d %s' % (tid, json.dumps(arg_6))
                             for (tid, arg_6) in zip(arg_9,arg_5)])
        arg_7.write("\n"+arg_10 if arg_3 else arg_10)
        arg_7.close()

Writes the supplied specifications to the log path . The data may be supplied as either as a an Args or as a list of dictionaries .


return Polygon(
            exterior=np.copy(self.exterior) if exterior is None else exterior,
            label=self.label if label is None else label
        )

def Func ( arg_0 , arg_1 = None , arg_2 = None ) : return Polygon ( arg_1 = np . copy ( arg_0 . exterior ) if arg_1 is None else arg_1 , arg_2 = arg_0 . label if arg_2 is None else arg_2 )

def Func(arg_0, arg_1=None, arg_2=None):
        """
        Create a deep copy of the Polygon object.

        Parameters
        ----------
        exterior : list of Keypoint or list of tuple or (N,2) ndarray, optional
            List of points defining the polygon. See `imgaug.Polygon.__init__` for details.

        label : None or str
            If not None, then the label of the copied object will be set to this value.

        Returns
        -------
        imgaug.Polygon
            Deep copy.

        """
        return Polygon(
            arg_1=np.copy(arg_0.exterior) if arg_1 is None else arg_1,
            arg_2=arg_0.label if arg_2 is None else arg_2
        )

Create a deep copy of the Polygon object .


def Func(arg_0, arg_1, arg_2=None):
        '''
        Make a list of Labels for 'author' and the filtered hrefs &
        anchors
        '''
        if   arg_0.offset_type == OffsetType.BYTES:
            arg_3 = arg_0.byte_href_anchors

        elif arg_0.offset_type == OffsetType.CHARS:
            arg_3 = arg_0.char_href_anchors

        elif arg_0.offset_type == OffsetType.LINES:
            arg_3 = arg_0.line_href_anchors

        arg_4 = []
        ## make clean_html accessible as a class property so we can
        arg_0.clean_html = arg_1
        for arg_5, arg_6, arg_7, arg_8 in arg_3():
            if arg_0.href_filter(arg_5):
                '''
                if clean_visible:
                    _check_html = self.clean_html.splitlines()[first-10:10+first+length]
                    _check_visi =   clean_visible.splitlines()[first:first+length]
                    if not make_clean_visible(_check_html) == _check_visi:
                        print len(self.clean_html.splitlines())
                        print len(clean_visible.splitlines())

                        print href
                        print '\t html: %r' % _check_html
                        print '\t visi: %r' % _check_visi
                '''
                ## add a label for every href
                arg_9 = Label(
                    annotator = Annotator(annotator_id = 'author'),
                    target = Target(target_id = arg_5),
                    )
                ## the offset type is specified by the config
                arg_9.offsets[arg_0.offset_type] = Offset(
                    arg_6=arg_6, arg_7=arg_7,
                    arg_8=arg_8,
                    ## the string name of the content field, not the
                    ## content itself :-)
                    content_form='clean_html')
                arg_4.append(arg_9)

        return arg_4

Make a list of Labels for author and the filtered hrefs & anchors


def Func(arg_0: arg_1) -> Optional[crypto.X509]:
    """Conducts series of Alexa SSL certificate verifications against Amazon Alexa requirements.

    Args:
        signature_chain_url: Signature certificate URL from SignatureCertChainUrl HTTP header.
    Returns:
        result: Amazon certificate if verification was successful, None if not.
    """
    try:
        arg_2 = requests.get(arg_0)
    except requests.exceptions.ConnectionError as e:
        log.error(f'Amazon signature chain get error: {e}')
        return None

    arg_3 = arg_2.text
    arg_4 = extract_certs(arg_3)

    arg_5: crypto.X509 = arg_4.pop(0)

    # verify signature chain url
    arg_6 = verify_sc_url(arg_0)
    if not arg_6:
        log.error(f'Amazon signature url {signature_chain_url} was not verified')

    # verify not expired
    arg_7 = not arg_5.has_expired()
    if not arg_7:
        log.error(f'Amazon certificate ({signature_chain_url}) expired')

    # verify subject alternative names
    arg_8 = verify_sans(arg_5)
    if not arg_8:
        log.error(f'Subject alternative names verification for ({signature_chain_url}) certificate failed')

    # verify certs chain
    arg_9 = Funcs_chain(arg_4, arg_5)
    if not arg_9:
        log.error(f'Certificates chain verification for ({signature_chain_url}) certificate failed')

    arg_10 = (arg_6 and arg_7 and arg_8 and arg_9)

    return arg_5 if arg_10 else None

Conducts series of Alexa SSL certificate verifications against Amazon Alexa requirements .


def
Func
(
arg_0
)
:
logger
.
info
(
'Start recording'
)
arg_1
=
get_session
(
)
arg_2
=
arg_1
.
query
(
RecordedEvent
)
.
filter
(
RecordedEvent
.
uid
==
arg_0
.
uid
)
.
filter
(
RecordedEvent
.
start
==
arg_0
.
start
)
.
first
(
)
if
not
arg_2
:
arg_2
=
RecordedEvent
(
arg_0
)
arg_1
.
add
(
arg_2
)
arg_1
.
commit
(
)
try_mkdir
(
config
(
)
[
'capture'
]
[
'directory'
]
)
os
.
mkdir
(
arg_2
.
directory
(
)
)
update_event_status
(
arg_2
,
Status
.
RECORDING
)
recording_state
(
arg_2
.
uid
,
'capturing'
)
set_service_status_immediate
(
Service
.
CAPTURE
,
ServiceStatus
.
BUSY
)
arg_3
=
recording_command
(
arg_2
)
arg_2
.
set_tracks
(
arg_3
)
arg_1
.
commit
(
)
update_event_status
(
arg_2
,
Status
.
FINISHED_RECORDING
)
recording_state
(
arg_2
.
uid
,
'capture_finished'
)
set_service_status_immediate
(
Service
.
CAPTURE
,
ServiceStatus
.
IDLE
)
logger
.
info
(
'Finished recording'
)

def Func(arg_0):
    '''Start the capture process, creating all necessary files and directories
    as well as ingesting the captured files if no backup mode is configured.
    '''
    logger.info('Start recording')

    # First move event to recording_event table
    arg_1 = get_session()
    arg_2 = arg_1.query(RecordedEvent)\
              .filter(RecordedEvent.uid == arg_0.uid)\
              .filter(RecordedEvent.start == arg_0.start)\
              .first()
    if not arg_2:
        arg_2 = RecordedEvent(arg_0)
        arg_1.add(arg_2)
        arg_1.commit()

    try_mkdir(config()['capture']['directory'])
    os.mkdir(arg_2.directory())

    # Set state
    update_event_status(arg_2, Status.RECORDING)
    recording_state(arg_2.uid, 'capturing')
    set_service_status_immediate(Service.CAPTURE, ServiceStatus.BUSY)

    # Recording
    arg_3 = recording_command(arg_2)
    arg_2.set_tracks(arg_3)
    arg_1.commit()

    # Set status
    update_event_status(arg_2, Status.FINISHED_RECORDING)
    recording_state(arg_2.uid, 'capture_finished')
    set_service_status_immediate(Service.CAPTURE, ServiceStatus.IDLE)

    logger.info('Finished recording')

Start the capture process creating all necessary files and directories as well as ingesting the captured files if no backup mode is configured .


(filename: str, ctx: compiler.CompilerContext, module: types.ModuleType)

def Func(arg_0: arg_1, arg_2: arg_3.CompilerContext, arg_5: arg_6.ModuleType):
    """Evaluate a file with the given name into a Python module AST node."""
    arg_8 = None
    for arg_9 in reader.read_file(arg_0, resolver=runtime.resolve_alias):
        arg_8 = arg_3.compile_and_exec_form(arg_9, arg_2, arg_5)
    return arg_8

Evaluate a file with the given name into a Python module AST node .


def Func ( arg_0 ) : for arg_1 in [ 'utf-8' , 'latin1' ] : try : arg_2 = unicode ( arg_0 , arg_1 ) return arg_2 except UnicodeDecodeError : pass arg_2 = unicode ( arg_0 , 'utf-8' , 'replace' ) return arg_2

def Func(arg_0):
    """Try to convert a string to unicode using different encodings"""
    for arg_1 in ['utf-8', 'latin1']:
        try:
            arg_2 = unicode(arg_0, arg_1)
            return arg_2
        except UnicodeDecodeError:
            pass
    arg_2 = unicode(arg_0, 'utf-8', 'replace')
    return arg_2


return re.sub(r'\(tests/golden-images/.*?\.svg\)',
                  replace_relative_with_absolute,
                  read_me)

def Func():
    """Transform README.md into a usable long description.

    Replaces relative references to svg images to absolute https references.
    """

    with open('README.md') as f:
        arg_0 = f.read()

    def replace_relative_with_absolute(arg_1):
        arg_2 = arg_1.group(0)[1:-1]
        return ('(https://github.com/google/pybadges/raw/master/'
                '%s?sanitize=true)' % arg_2)

    return re.sub(r'\(tests/golden-images/.*?\.svg\)',
                  replace_relative_with_absolute,
                  arg_0)

Transform README . md into a usable long description .


def Func ( arg_0 , arg_1 : arg_2 ) -> arg_2 : arg_3 = { 'response' : { 'shouldEndSession' : False , 'outputSpeech' : { 'type' : 'PlainText' , 'text' : arg_0 . config [ 'start_message' ] } , 'card' : { 'type' : 'Simple' , 'content' : arg_0 . config [ 'start_message' ] } } } arg_3 = arg_0 . _generate_response ( arg_3 , arg_1 ) return arg_3

def Func(arg_0, arg_1: arg_2) -> arg_2:
        """Handles LaunchRequest Alexa request.

        Args:
            request: Alexa request.
        Returns:
            response: "response" part of response dict conforming Alexa specification.
        """
        arg_3 = {
            'response': {
                'shouldEndSession': False,
                'outputSpeech': {
                    'type': 'PlainText',
                    'text': arg_0.config['start_message']
                },
                'card': {
                    'type': 'Simple',
                    'content': arg_0.config['start_message']
                }
            }
        }

        arg_3 = arg_0._generate_response(arg_3, arg_1)

        return arg_3


def Func ( arg_0 ) : if can_use_pandas ( ) : import arg_1 arg_1 . options . display . max_colwidth = 70 return arg_1 . DataFrame ( arg_0 . _cell_values , columns = arg_0 . _col_header ) return arg_0

def Func(arg_0):
        """Convert to a python 'data frame'."""
        if can_use_pandas():
            import arg_1
            arg_1.options.display.max_colwidth = 70
            return arg_1.DataFrame(arg_0._cell_values, columns=arg_0._col_header)
        return arg_0


def Func ( arg_0 , arg_1 = None , arg_2 = 'gradientn' ) : if arg_1 is None : arg_3 = mcolors . LinearSegmentedColormap . from_list ( arg_2 , arg_0 ) else : arg_3 = mcolors . LinearSegmentedColormap . from_list ( arg_2 , list ( zip ( arg_1 , arg_0 ) ) ) def _Func ( arg_4 ) : return ratios_to_colors ( arg_4 , arg_3 ) return _Func

def Func(arg_0, arg_1=None, arg_2='gradientn'):
    """
    Create a n color gradient palette

    Parameters
    ----------
    colors : list
        list of colors
    values : list, optional
        list of points in the range [0, 1] at which to
        place each color. Must be the same size as
        `colors`. Default to evenly space the colors
    name : str
        Name to call the resultant MPL colormap

    Returns
    -------
    out : function
        Continuous color palette that takes a single
        parameter either a :class:`float` or a sequence
        of floats maps those value(s) onto the palette
        and returns color(s). The float(s) must be
        in the range [0, 1].

    Examples
    --------
    >>> palette = Func(['red', 'blue'])
    >>> palette([0, .25, .5, .75, 1])
    ['#ff0000', '#bf0040', '#7f0080', '#3f00c0', '#0000ff']
    """
    # Note: For better results across devices and media types,
    # it would be better to do the interpolation in
    # Lab color space.
    if arg_1 is None:
        arg_3 = mcolors.LinearSegmentedColormap.from_list(
            arg_2, arg_0)
    else:
        arg_3 = mcolors.LinearSegmentedColormap.from_list(
            arg_2, list(zip(arg_1, arg_0)))

    def _Func(arg_4):
        return ratios_to_colors(arg_4, arg_3)

    return _Func

Create a n color gradient palette

    Parameters
    ----------
    colors : list
        list of colors
    values : list, optional
        list of points in the range [0, 1] at which to
        place each color. Must be the same size as
        `colors`. Default to evenly space the colors
    name : str
        Name to call the resultant MPL colormap

    Returns
    -------
    out : function
        Continuous color palette that takes a single
        parameter either a :class:`float` or a sequence
        of floats maps those value(s) onto the palette
        and returns color(s). The float(s) must be
        in the range [0, 1].

    Examples
    --------
    >>> palette = gradient_n_pal(['red', 'blue'])
    >>> palette([0, .25, .5, .75, 1])
    ['#ff0000', '#bf0040', '#7f0080', '#3f00c0', '#0000ff']


return Instruction('kraus', n_qubits, 0, kraus)

def Func(arg_0):
        """Convert to a Kraus or UnitaryGate circuit instruction.

        If the channel is unitary it will be added as a unitary gate,
        otherwise it will be added as a kraus simulator instruction.

        Returns:
            Instruction: A kraus instruction for the channel.

        Raises:
            QiskitError: if input data is not an N-qubit CPTP quantum channel.
        """
        from qiskit.circuit.instruction import Instruction
        # Check if input is an N-qubit CPTP channel.
        arg_1 = int(np.log2(arg_0._input_dim))
        if arg_0._input_dim != arg_0._output_dim or 2**arg_1 != arg_0._input_dim:
            raise QiskitError(
                'Cannot convert QuantumChannel to Instruction: channel is not an N-qubit channel.'
            )
        if not arg_0.is_cptp():
            raise QiskitError(
                'Cannot convert QuantumChannel to Instruction: channel is not CPTP.'
            )
        # Next we convert to the Kraus representation. Since channel is CPTP we know
        # that there is only a single set of Kraus operators
        arg_2, arg_3 = _to_kraus(arg_0.rep, arg_0._data, *arg_0.dim)
        # If we only have a single Kraus operator then the channel is
        # a unitary channel so can be converted to a UnitaryGate. We do this by
        # converting to an Operator and using its Func method
        if len(arg_2) == 1:
            return Operator(arg_2[0]).Func()
        return Instruction('kraus', arg_1, 0, arg_2)

Convert to a Kraus or UnitaryGate circuit instruction .


def Func ( arg_0 ) : for arg_1 in arg_0 . _meta . concrete_fields : if arg_1 . related_model : if issubclass ( arg_0 , arg_1 . related_model ) : return arg_1 . attname return None

def Func(arg_0):
    """
    Return whether this model has a self ref FK, and the name for the field
    """
    for arg_1 in arg_0._meta.concrete_fields:
        if arg_1.related_model:
            if issubclass(arg_0, arg_1.related_model):
                return arg_1.attname
    return None

Return whether this model has a self ref FK and the name for the field


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = { 'name' : arg_2 . command . name , 't0' : arg_1 + arg_2 . start_time , 'ch' : arg_2 . channels [ 0 ] . name } return arg_0 . _qobj_model ( ** arg_3 )

def Func(arg_0, arg_1, arg_2):
        """Return converted `PulseInstruction`.

        Args:
            shift(int): Offset time.
            instruction (PulseInstruction): drive instruction.
        Returns:
            dict: Dictionary of required parameters.
        """
        arg_3 = {
            'name': arg_2.command.name,
            't0': arg_1+arg_2.start_time,
            'ch': arg_2.channels[0].name
        }
        return arg_0._qobj_model(**arg_3)


def Func(arg_0):
        """Return ``request_header`` for use when constructing requests.

        Returns:
            Populated request header.
        """
        # resource is allowed to be null if it's not available yet (the Chrome
        # client does this for the first getentitybyid call)
        if arg_0._client_id is not None:
            arg_0._request_header.client_identifier.resource = arg_0._client_id
        return arg_0._request_header

Return request_header for use when constructing requests .


(self, indent=0, maxindent=25, width=79)

def Func(arg_0, arg_1=0, arg_2=25, arg_3=79):
        """Return user friendly help on positional arguments in the program."""
        arg_4 = []
        arg_5 = lambda arg_7: ' ' * arg_1 + arg_7.displayname + ': '
        arg_6 = _autoindent([arg_5(p) for p in arg_0.positional_args], arg_1, arg_2)
        for arg_7 in arg_0.positional_args:
            arg_8 = arg_5(arg_7)
            arg_9 = arg_7.formatname + '. ' + arg_7.docs
            arg_10 = arg_0._wrap_labelled(arg_8, arg_9, arg_6, arg_3)
            arg_4.extend(arg_10)
        return '\n'.join(arg_4)

Return user friendly help on positional arguments in the program .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . df . index & arg_1 . df . index return Table ( df = arg_0 . df [ arg_2 ] , name = arg_0 . name )

def Func(arg_0, arg_1):
        """
        Select nuclei which also belong to ``table``

        Parameters
        ----------
        table: Table, Table object

        Example:
        ----------
        Table('AME2003').Func(Table('AME1995'))
        """
        arg_2 = arg_0.df.index & arg_1.df.index
        return Table(df=arg_0.df[arg_2], name=arg_0.name)

Select nuclei which also belong to ``table``

        Parameters
        ----------
        table: Table, Table object

        Example:
        ----------
        Table('AME2003').intersection(Table('AME1995'))

Select nuclei which also belong to table


def Func ( arg_0 , arg_1 = ( 'homepage' , 'download' ) ) : arg_1 = set ( arg_1 ) for arg_2 in arg_0 . parsed . findall ( ".//a" ) : if arg_2 . get ( "rel" ) and arg_2 . get ( "href" ) : arg_3 = set ( arg_2 . get ( "rel" ) . split ( ) ) if arg_3 & arg_1 : arg_4 = arg_2 . get ( "href" ) arg_5 = arg_0 . clean_link ( urllib_parse . urljoin ( arg_0 . base_url , arg_4 ) ) yield Link ( arg_5 , arg_0 , trusted = False )

def Func(arg_0, arg_1=('homepage', 'download')):
        """Yields all links with the given relations"""
        arg_1 = set(arg_1)

        for arg_2 in arg_0.parsed.findall(".//a"):
            if arg_2.get("rel") and arg_2.get("href"):
                arg_3 = set(arg_2.get("rel").split())
                # Determine the intersection between what rels were found and
                #   what rels were being looked for
                if arg_3 & arg_1:
                    arg_4 = arg_2.get("href")
                    arg_5 = arg_0.clean_link(
                        urllib_parse.urljoin(arg_0.base_url, arg_4)
                    )
                    yield Link(arg_5, arg_0, trusted=False)


def Func(arg_0):
        """Returns a storage dictionary understood by the storage service.

        Sparse matrices are extracted similar to the :class:`~pypet.parameter.SparseParameter` and
        marked with the identifier `__spsp__`.

        """
        arg_1 = {}
        for arg_2 in arg_0._data:
            arg_3 = arg_0._data[arg_2]
            if SparseParameter._is_supported_matrix(arg_3):

                arg_4, arg_5, arg_6 = SparseParameter._serialize_matrix(arg_3)
                arg_7 = ['%s%s%s' % (arg_2, SparseParameter.IDENTIFIER, arg_12)
                               for arg_12 in arg_5]

                arg_8 = int(len(arg_7) == 4)
                arg_1[arg_2 + arg_9.IDENTIFIER + 'is_dia'] = arg_8

                for arg_11, arg_12 in enumerate(arg_7):
                    arg_1[arg_12] = arg_4[arg_11]

            else:
                arg_1[arg_2] = arg_3

        return arg_1

Returns a storage dictionary understood by the storage service .


def Func(arg_0, arg_1):
    """
    Run bedtools to get all overlapping regions. Pass this list into the func
    'get_overlapping_reads' which will write fastq chunks to the clust.gz file.

    1) Run bedtools merge to get a list of all contiguous blocks of bases
    in the reference seqeunce where one or more of our reads overlap.
    The output will look like this:
            1       45230754        45230783
            1       74956568        74956596
            ...
            1       116202035       116202060
    """
    LOGGER.info('entering Func')

    ## Get regions, which will be a giant list of 5-tuples, of which we're
    ## only really interested in the first three: (chrom, start, end) position.
    arg_2 = bedtools_merge(arg_0, arg_1)

    if len(arg_2) > 0:
        ## this calls bam_region_to_fasta a billion times
        get_overlapping_reads(arg_0, arg_1, arg_2)
    else:
        arg_3 = "No reads mapped to reference sequence - {}".format(arg_1.name)
        LOGGER.warn(arg_3)

Run bedtools to get all overlapping regions . Pass this list into the func get_overlapping_reads which will write fastq chunks to the clust . gz file .


(
        self,
        port=0,
        service_name='unknown',
        host='127.0.0.1',
    )

def
Func
(
arg_0
,
arg_1
=
0
,
arg_2
=
'unknown'
,
arg_3
=
'127.0.0.1'
,
)
:
if
arg_0
.
kind
!=
Kind
.
CLIENT
:
return
arg_4
=
create_endpoint
(
arg_1
=
arg_1
,
arg_2
=
arg_2
,
arg_3
=
arg_3
,
)
if
not
arg_0
.
logging_context
:
if
arg_0
.
remote_endpoint
is
not
:
raise
ValueError
(
'SA annotation already set.'
)
arg_0
.
remote_endpoint
=
arg_4
else
:
if
arg_0
.
logging_context
.
remote_endpoint
is
not
:
raise
ValueError
(
'SA annotation already set.'
)
arg_0
.
logging_context
.
remote_endpoint
=
arg_4

def Func(
        arg_0,
        arg_1=0,
        arg_2='unknown',
        arg_3='127.0.0.1',
    ):
        """Adds a 'sa' binary annotation to the current span.

        'sa' binary annotations are useful for situations where you need to log
        where a request is going but the destination doesn't support zipkin.

        Note that the span must have 'cs'/'cr' annotations.

        :param port: The port number of the destination
        :type port: int
        :param service_name: The name of the destination service
        :type service_name: str
        :param host: Host address of the destination
        :type host: str
        """
        if arg_0.kind != Kind.CLIENT:
            # TODO: trying to set a sa binary annotation for a non-client span
            # should result in a logged error
            return

        arg_4 = create_endpoint(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
        )
        if not arg_0.logging_context:
            if arg_0.remote_endpoint is not None:
                raise ValueError('SA annotation already set.')
            arg_0.remote_endpoint = arg_4
        else:
            if arg_0.logging_context.remote_endpoint is not None:
                raise ValueError('SA annotation already set.')
            arg_0.logging_context.remote_endpoint = arg_4

Adds a sa binary annotation to the current span .


def Func ( arg_0 , arg_1 ) : arg_2 = "/{t}/{u}/tags/{ta}/items" . format ( u = arg_0 . library_id , t = arg_0 . library_type , ta = arg_1 ) return arg_0 . _totals ( arg_2 )

def Func(arg_0, arg_1):
        """ Return the total number of items for the specified tag
        """
        arg_2 = "/{t}/{u}/tags/{ta}/items".format(
            u=arg_0.library_id, t=arg_0.library_type, ta=arg_1
        )
        return arg_0._totals(arg_2)


def
Func
(
arg_0
,
arg_1
)
:
with
ConnectionFactory
.
get
(
)
as
conn
:
arg_2
=
'SELECT count(job_id) '
'FROM %s '
'WHERE client_key = %%s '
' AND status != %%s'
%
arg_0
.
jobsTableName
conn
.
cursor
.
execute
(
arg_2
,
[
arg_1
,
arg_0
.
STATUS_COMPLETED
]
)
arg_3
=
conn
.
cursor
.
fetchone
(
)
[
0
]
return
arg_3

def Func(arg_0, arg_1):
    """ Return the number of jobs for the given clientKey and a status that is
    not completed.
    """
    with ConnectionFactory.get() as conn:
      arg_2 = 'SELECT count(job_id) ' \
              'FROM %s ' \
              'WHERE client_key = %%s ' \
              ' AND status != %%s' %  arg_0.jobsTableName
      conn.cursor.execute(arg_2, [arg_1, arg_0.STATUS_COMPLETED])
      arg_3 = conn.cursor.fetchone()[0]

    return arg_3

Return the number of jobs for the given clientKey and a status that is not completed .


def Func(arg_0=None):
    """Initialize the strings we'll run the regexes against.

    The strings used in the benchmark are prefixed and suffixed by
    strings that are repeated n times.

    The sequence n_values contains the values for n.
    If n_values is None the values of n from the original benchmark
    are used.

    The generated list of strings is cached in the string_tables
    variable, which is indexed by n.

    Returns:
    A list of string prefix/suffix lengths.
    """

    if arg_0 is None:
        arg_0 = (0, 5, 50, 250, 1000, 5000, 10000)

    arg_1 = {arg_4: gen_string_table(arg_4) for arg_4 in arg_0}
    arg_2 = gen_regex_table()

    arg_3 = []
    for arg_4 in arg_0:
        for arg_5 in xrange(len(arg_2)):
            arg_6 = arg_2[arg_5]
            arg_7 = arg_1[arg_4][arg_5]
            arg_3.append((arg_6, arg_7))
    return arg_3

Initialize the strings we ll run the regexes against .


def Func ( arg_0 ) : arg_1 = TCPClient ( arg_0 . host , arg_0 . port , arg_0 . prefix ) arg_0 . _configure_client ( arg_1 ) return arg_1

def Func(arg_0):
        # type: () -> TCPClient
        """Return a TCPClient with same settings of the batch TCP client"""

        arg_1 = TCPClient(arg_0.host, arg_0.port, arg_0.prefix)
        arg_0._configure_client(arg_1)
        return arg_1


def Func ( arg_0 , arg_1 ) : while not arg_1 or arg_1 . running : try : yield arg_0 . open ( timeout = 2.5 ) except OSError : continue

def Func(arg_0, arg_1):
    """Repeatedly accept HTTP connections on a server.

    Forever if the serving externally, or while a player is running if it is not
    empty.
    """

    while not arg_1 or arg_1.running:
        try:
            yield arg_0.open(timeout=2.5)
        except OSError:
            continue

Repeatedly accept HTTP connections on a server .


def Func ( arg_0 , arg_1 ) : from heronpy . streamlet . impl . Funcbolt import UnionStreamlet arg_2 = UnionStreamlet ( arg_0 , arg_1 ) arg_0 . _add_child ( arg_2 ) arg_1 . _add_child ( arg_2 ) return arg_2

def Func(arg_0, arg_1):
    """Returns a new Streamlet that consists of elements of both this and other_streamlet
    """
    from heronpy.streamlet.impl.Funcbolt import UnionStreamlet
    arg_2 = UnionStreamlet(arg_0, arg_1)
    arg_0._add_child(arg_2)
    arg_1._add_child(arg_2)
    return arg_2


def Func(arg_0, arg_1, arg_2=arg_3):
    """
    Given an API key, a site url and a credentials file path, runs through a prioritized list of credential sources to find credentials.

    Specifically, this method ranks credential priority as follows:
        1. Those passed in as the first two parameters to this method
        2. Those found in the environment as variables
        3. Those found in the credentials file at the profile specified
           by the profile environment variable
        4. Those found in the default stanza in the credentials file

    :param api_key: A Citrination API Key or None
    :param site: A Citrination site URL or None
    :param cred_file: The path to a credentials file
    """
    arg_4, arg_5 = get_credentials_from_file(arg_2)
    if arg_0 is None:
        arg_0 =  os.environ.get(citr_env_vars.CITRINATION_API_KEY)
    if arg_0 is None or len(arg_0) == 0:
        arg_0 = arg_4

    if arg_1 is None:
        arg_1 = os.environ.get(citr_env_vars.CITRINATION_SITE)
    if arg_1 is None or len(arg_1) == 0:
        arg_1 = arg_5
    if arg_1 is None:
        arg_1 = "https://citrination.com"

    return arg_0, arg_1

Given an API key a site url and a credentials file path runs through a prioritized list of credential sources to find credentials .


def
Func
(
arg_0
,
arg_1
=
True
)
:
if
isinstance
(
arg_0
,
type
)
:
arg_2
=
arg_0
else
:
arg_2
=
arg_0
.
__class__
if
arg_1
:
arg_3
=
getattr
(
arg_2
,
"name"
,
)
if
arg_3
is
not
:
return
arg_3
arg_3
=
arg_2
.
__name__
for
arg_4
in
(
"ViewSet"
,
"View"
,
"API"
,
"Admin"
)
:
arg_3
=
formatting
.
remove_trailing_string
(
arg_3
,
arg_4
)
arg_3
=
formatting
.
camelcase_to_spaces
(
arg_3
)
arg_4
=
getattr
(
arg_2
,
"suffix"
,
)
if
arg_4
:
arg_3
+=
" "
+
arg_4
return
arg_3

def Func(arg_0, arg_1=True):
        """
        Get or generate human readable view name.
        Extended version from DRF to support usage from both class and instance.
        """
        if isinstance(arg_0, type):
            arg_2 = arg_0
        else:
            arg_2 = arg_0.__class__

        # Name may be set by some Views, such as a ViewSet.
        if arg_1:
            arg_3 = getattr(arg_2, "name", None)
            if arg_3 is not None:
                return arg_3

        arg_3 = arg_2.__name__
        for arg_4 in ("ViewSet", "View", "API", "Admin"):
            arg_3 = formatting.remove_trailing_string(arg_3, arg_4)
        arg_3 = formatting.camelcase_to_spaces(arg_3)

        # Suffix may be set by some Views, such as a ViewSet.
        arg_4 = getattr(arg_2, "suffix", None)
        if arg_4:
            arg_3 += " " + arg_4

        return arg_3

Get or generate human readable view name . Extended version from DRF to support usage from both class and instance .


def Func(arg_0, arg_1):
        """Helper method that returns the index of the string based on node's
        starting index"""
        arg_2 = 0
        for arg_3 in arg_0.word_starts[1:]:
            if arg_1 < arg_3:
                return arg_2
            else:
                arg_2+=1
        return arg_2

Helper method that returns the index of the string based on node s starting index


def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = None ) : return DiscoIdentity ( arg_0 , arg_1 , arg_2 , arg_3 )

def Func(arg_0,arg_1,arg_2=None,arg_3=None):
        """Add an identity to the `DiscoInfo` object.

        :Parameters:
            - `item_name`: name of the item.
            - `item_category`: category of the item.
            - `item_type`: type of the item.
        :Types:
            - `item_name`: `unicode`
            - `item_category`: `unicode`
            - `item_type`: `unicode`

        :returns: the identity created.
        :returntype: `DiscoIdentity`"""
        return DiscoIdentity(arg_0,arg_1,arg_2,arg_3)

Add an identity to the DiscoInfo object .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
True
arg_3
=
[
]
arg_4
=
arg_5
=
arg_6
=
while
arg_2
==
True
:
arg_2
=
False
arg_7
=
'/%s/hostedzone/%s/rrset'
%
(
R53_API_VERSION
,
arg_0
)
if
arg_4
is
not
:
arg_7
+=
'?name=%s&type=%s'
%
(
arg_4
,
arg_5
)
if
arg_6
is
not
:
arg_7
+=
'&identifier=%s'
%
arg_6
log
.
debug
(
'requesting %s'
%
arg_7
)
arg_8
=
arg_1
.
make_request
(
'GET'
,
arg_7
)
arg_9
=
lxml
.
etree
.
parse
(
arg_8
)
arg_3
.
append
(
arg_9
)
arg_10
=
arg_9
.
getroot
(
)
arg_11
=
arg_10
.
find
(
'{%s}IsTruncated'
%
R53_XMLNS
)
if
arg_11
is
not
and
arg_11
.
text
==
'true'
:
arg_2
=
True
arg_4
=
arg_10
.
find
(
'{%s}NextRecordName'
%
R53_XMLNS
)
.
text
arg_5
=
arg_10
.
find
(
'{%s}NextRecordType'
%
R53_XMLNS
)
.
text
try
:
arg_6
=
arg_10
.
find
(
'{%s}NextRecordIdentifier'
%
R53_XMLNS
)
.
text
except
AttributeError
:
arg_6
=
return
arg_3

def Func(arg_0, arg_1):
  """Fetch all pieces of a Route 53 config from Amazon.

  Args: zone: string, hosted zone id.
        conn: boto.route53.Route53Connection
  Returns: list of ElementTrees, one for each piece of config."""
  arg_2 = True
  arg_3 = []
  arg_4 = None
  arg_5 = None
  arg_6 = None
  while arg_2 == True:
    arg_2 = False
    arg_7 = '/%s/hostedzone/%s/rrset' % (R53_API_VERSION, arg_0)
    if arg_4 is not None:
      arg_7 += '?name=%s&type=%s' % (arg_4, arg_5)
      if arg_6 is not None:
        arg_7 += '&identifier=%s' % arg_6
    log.debug('requesting %s' % arg_7)
    arg_8 = arg_1.make_request('GET', arg_7)
    arg_9 = lxml.etree.parse(arg_8)
    arg_3.append(arg_9)
    arg_10 = arg_9.getroot()
    arg_11 = arg_10.find('{%s}IsTruncated' % R53_XMLNS)
    if arg_11 is not None and arg_11.text == 'true':
      arg_2 = True
      arg_4 = arg_10.find('{%s}NextRecordName' % R53_XMLNS).text
      arg_5 = arg_10.find('{%s}NextRecordType' % R53_XMLNS).text
      try:
        arg_6 = arg_10.find('{%s}NextRecordIdentifier' % R53_XMLNS).text
      except AttributeError:  # may not have next_identifier
        arg_6 = None
  return arg_3

Fetch all pieces of a Route 53 config from Amazon .


def Func(arg_0, arg_1):
        """Compute t0, x0, v0, ve."""
        arg_2 = arg_0._estimate_progress_completion_time(arg_1) - arg_1
        assert arg_2 >= 0, "Estimated progress completion cannot be in the past."
        arg_3 = arg_0._get_real_progress()
        if arg_3 == 1:
            arg_4, arg_5, arg_6, arg_7 = arg_1, 1, 0, 0
        else:
            arg_5, arg_6 = arg_0._compute_progress_at_time(arg_1)
            arg_4 = arg_1
            if arg_5 >= 1:
                # On rare occasion, the model's progress may have reached 100% by ``now``. This can happen if
                # (1) the progress is close to 100% initially and has high speed, (2) on the previous call we
                # estimated that the process completion time will be right after the next poll time, and (3)
                # the polling itself took so much time that the process effectively "overshoot".
                # If this happens, then we adjust x0, v0 to the previous valid data checkpoint.
                arg_4, arg_5, arg_6 = arg_0._t0, arg_0._x0, arg_0._v0
                arg_2 += arg_1 - arg_4
            arg_8 = arg_0.BETA * arg_2
            arg_9 = (1 - arg_3**2) / arg_0.FINISH_DELAY
            arg_7 = arg_6 + (arg_0.BETA * (1 - arg_5) - arg_6 * arg_8) / (arg_8 - 1 + math.exp(-arg_8))
            if arg_7 < 0:
                # Current speed is too high -- reduce v0 (violate non-smoothness of speed)
                arg_6 = arg_0.BETA * (1 - arg_5) / (1 - math.exp(-arg_8))
                arg_7 = 0
            if arg_7 > arg_9:
                # Current speed is too low: finish later, but do not allow ``ve`` to be higher than ``max_speed``
                arg_7 = arg_9
        arg_0._t0, arg_0._x0, arg_0._v0, arg_0._ve = arg_4, arg_5, arg_6, arg_7


def Func(arg_0, arg_1):
        """
        Processes the log files and extracts useful information out of it.

        If the deploy-mode is 'client', log the output of the submit command as those
        are the output logs of the Spark worker directly.

        Remark: If the driver needs to be tracked for its status, the log-level of the
        spark deploy needs to be at least INFO (log4j.logger.org.apache.spark.deploy=INFO)

        :param itr: An iterator which iterates over the input of the subprocess
        """
        # Consume the iterator
        for arg_2 in arg_1:
            arg_2 = arg_2.strip()
            # If we run yarn cluster mode, we want to extract the application id from
            # the logs so we can kill the application when we stop it unexpectedly
            if arg_0._is_yarn and arg_0._connection['deploy_mode'] == 'cluster':
                arg_3 = re.search('(application[0-9_]+)', arg_2)
                if arg_3:
                    arg_0._yarn_application_id = arg_3.groups()[0]
                    arg_0.log.info("Identified spark driver id: %s",
                                  arg_0._yarn_application_id)

            # If we run Kubernetes cluster mode, we want to extract the driver pod id
            # from the logs so we can kill the application when we stop it unexpectedly
            elif arg_0._is_kubernetes:
                arg_3 = re.search(r'\s*pod name: ((.+?)-([a-z0-9]+)-driver)', arg_2)
                if arg_3:
                    arg_0._kubernetes_driver_pod = arg_3.groups()[0]
                    arg_0.log.info("Identified spark driver pod: %s",
                                  arg_0._kubernetes_driver_pod)

                # Store the Spark Exit code
                arg_6 = re.search(r'\s*Exit code: (\d+)', arg_2)
                if arg_6:
                    arg_0._spark_exit_code = int(arg_6.groups()[0])

            # if we run in standalone cluster mode and we want to track the driver status
            # we need to extract the driver id from the logs. This allows us to poll for
            # the status using the driver id. Also, we can kill the driver when needed.
            elif arg_0._should_track_driver_status and not arg_0._driver_id:
                arg_8 = re.search(r'(driver-[0-9\-]+)', arg_2)
                if arg_8:
                    arg_0._driver_id = arg_8.groups()[0]
                    arg_0.log.info("identified spark driver id: {}"
                                  .format(arg_0._driver_id))

            else:
                arg_0.log.info(arg_2)

            arg_0.log.debug("spark submit log: {}".format(arg_2))

Processes the log files and extracts useful information out of it .


Before assigning the value validate that is in one of the
        HTTP methods we implement

def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
_Funcs
.
keys
(
)
if
arg_1
not
in
arg_2
:
raise
AttributeError
(
"Method value not in "
+
str
(
arg_2
)
)
else
:
arg_0
.
_Func
=
arg_1

def Func(arg_0, arg_1):
        """
        Before assigning the value validate that is in one of the
        HTTP Funcs we implement
        """
        arg_2 = arg_0._Funcs.keys()
        if arg_1 not in arg_2:
            raise AttributeError("Method value not in " + str(arg_2))
        else:
            arg_0._Func = arg_1


def Func(arg_0, arg_1, arg_2, arg_3=None):
        u"""Render CodeMirrorTextarea"""
        if arg_0.js_var_format is not None:
            arg_4 = 'var %s = ' % (arg_0.js_var_format % arg_1)
        else:
            arg_4 = ''
        arg_5 = [super(CodeMirrorTextarea, arg_0).Func(arg_1, arg_2, arg_3),
            '<script type="text/javascript">%sCodeMirror.fromTextArea(document.getElementById(%s), %s);</script>' %
                (arg_4, '"id_%s"' % arg_1, arg_0.option_json)]
        return mark_safe('\n'.join(arg_5))


(N, R, scale=11, pos=None, zscale=1.0, returnpix=None)

def Func(arg_0, arg_1, arg_2=11, arg_3=None, arg_4=1.0, arg_5=None):
    """
    Create a perfect platonic sphere of a given radius R by supersampling by a
    factor scale on a grid of size N.  Scale must be odd.

    We are able to perfectly position these particles up to 1/scale. Therefore,
    let's only allow those types of shifts for now, but return the actual position
    used for the placement.
    """
    # enforce odd scale size
    if arg_2 % 2 != 1:
        arg_2 += 1

    if arg_3 is None:
        # place the default position in the center of the grid
        arg_3 = np.array([(arg_0-1)/2.0]*3)

    # limit positions to those that are exact on the size 1./scale
    # positions have the form (d = divisions):
    #   p = N + m/d
    arg_6 = 1.0/arg_2
    arg_7 = arg_4**2

    arg_8 = arg_3.astype('int')
    arg_9 = arg_8 + arg_6*((arg_3 - arg_8)/arg_6).astype('int')
    arg_3 = arg_9 + 1e-10 # unfortunately needed to break ties

    # make the output arrays
    arg_10 = np.zeros((arg_0,)*3)
    arg_11,arg_12,arg_13 = np.meshgrid(*(xrange(arg_0),)*3, indexing='ij')

    # for each real pixel in the image, integrate a bunch of superres pixels
    for arg_14,arg_15,arg_16 in zip(arg_11.flatten(),arg_12.flatten(),arg_13.flatten()):

        # short-circuit things that are just too far away!
        arg_17 = np.sqrt(arg_7*(arg_14-arg_3[0])**2 + (arg_15-arg_3[1])**2 + (arg_16-arg_3[2])**2)
        if arg_17 > arg_1 + 4:
            arg_10[arg_14,arg_15,arg_16] = 0.0
            continue

        # otherwise, build the local mesh and count the volume
        arg_18,arg_19,arg_20 = np.meshgrid(
            *(np.linspace(arg_8-0.5+arg_6/2, arg_8+0.5-arg_6/2, arg_2, endpoint=True) for arg_8 in (arg_14,arg_15,arg_16)),
            indexing='ij'
        )
        arg_17 = np.sqrt(arg_7*(arg_18-arg_3[0])**2 + (arg_19-arg_3[1])**2 + (arg_20-arg_3[2])**2)

        if arg_5 is not None and arg_5 == [arg_14,arg_15,arg_16]:
            arg_21 = 1.0 * (arg_17 < arg_1)

        arg_22 = (1.0*(arg_17 < arg_1) + 0.0*(arg_17 == arg_1)).sum()
        arg_10[arg_14,arg_15,arg_16] = arg_22 / float(arg_2**3)

    #vol_true = 4./3*np.pi*R**3
    #vol_real = image.sum()
    #print vol_true, vol_real, (vol_true - vol_real)/vol_true

    if arg_5:
        return arg_10, arg_3, arg_21
    return arg_10, arg_3

Create a perfect platonic sphere of a given radius R by supersampling by a factor scale on a grid of size N . Scale must be odd .


def Func(arg_0, arg_1):
        """
        Init openstack heat mq

        1. Check if enable listening heat notification
        2. Create consumer

        :param mq: class ternya.mq.MQ
        """
        if not arg_0.enable_component_notification(Openstack.Heat):
            log.debug("disable listening heat notification")
            return

        for arg_2 in range(arg_0.config.heat_mq_consumer_count):
            arg_1.create_consumer(arg_0.config.heat_mq_exchange,
                               arg_0.config.heat_mq_queue,
                               ProcessFactory.process(Openstack.Heat))

        log.debug("enable listening openstack heat notification.")


def Func(arg_0, arg_1):
        """Make a RosterItem from an XML element.

        :Parameters:
            - `element`: the XML element
        :Types:
            - `element`: :etree:`ElementTree.Element`

        :return: a freshly created roster item
        :returntype: `cls`
        """
        if arg_1.tag != ITEM_TAG:
            raise ValueError("{0!r} is not a roster item".format(arg_1))
        try:
            arg_2 = JID(arg_1.get("jid"))
        except ValueError:
            raise BadRequestProtocolError(u"Bad item JID")
        arg_3 = arg_1.get("subscription")
        arg_4 = arg_1.get("ask")
        arg_5 = arg_1.get("name")
        arg_6 = False
        arg_7 = set()
        for arg_8 in arg_1:
            if arg_8.tag != GROUP_TAG:
                continue
            arg_9 = arg_8.text
            if arg_9 is None:
                arg_9 = u""
            if arg_9 in arg_7:
                arg_6 = True
            else:
                arg_7.add(arg_9)
        arg_10 = arg_1.get("approved")
        if arg_10 == "true":
            arg_10 = True
        elif arg_10 in ("false", None):
            arg_10 = False
        else:
            logger.debug("RosterItem.Func: got unknown 'approved':"
                            " {0!r}, changing to False".format(arg_10))
            arg_10 = False
        arg_11 = arg_0(arg_2, arg_5, arg_7, arg_3, arg_4, arg_10)
        arg_11._duplicate_group = arg_6
        return arg_11


return super(Deposit, self).commit(*args, **kwargs)

def Func ( arg_0 , * arg_1 , ** arg_2 ) : return super ( Deposit , arg_0 ) . Func ( * arg_1 , ** arg_2 )

def Func(arg_0, *arg_1, **arg_2):
        """Store changes on current instance in database and index it."""
        return super(Deposit, arg_0).Func(*arg_1, **arg_2)

Store changes on current instance in database and index it .


def Func(arg_0):
        """
        List all scheduled_queries

        :return: A list of all scheduled query dicts
        :rtype: list of dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_1 = 'https://logentries.com/rest/{account_id}/api/scheduled_queries/'.format(
            account_id=arg_0.account_id)
        return arg_0._api_get(arg_1=arg_1).get('scheduled_searches')


def Func(arg_0, arg_1):
    '''
    Execute the user-specified transform for the solid. Wrap in an error boundary and do
    all relevant logging and metrics tracking
    '''
    check.inst_param(arg_0, 'transform_context', SystemTransformExecutionContext)
    check.dict_param(arg_1, 'inputs', key_type=str)

    arg_2 = arg_0.step
    arg_3 = arg_2.solid

    arg_0.log.debug(
        'Executing core transform for solid {solid}.'.format(arg_3=arg_3.name)
    )

    arg_4 = []
    for arg_5 in _yield_transform_results(arg_0, arg_1):
        yield arg_5
        if isinstance(arg_5, StepOutputValue):
            arg_4.append(arg_5)

    if len(arg_4) != len(arg_3.definition.output_defs):
        arg_6 = {r.output_name for r in arg_4}
        arg_7 = {output_def.name for output_def in arg_3.definition.output_defs}
        arg_8 = arg_7.difference(arg_6)
        arg_0.log.info(
            'Solid {solid} did not fire outputs {outputs}'.format(
                arg_3=arg_3.name, outputs=repr(arg_8)
            )
        )

Execute the user - specified transform for the solid . Wrap in an error boundary and do all relevant logging and metrics tracking


return dict((code['language'], code['name']) for code in raw_data)

def
Func
(
arg_0
,
arg_1
=
'supported_translations.json'
)
:
arg_2
=
abspath
(
join
(
dirname
(
__file__
)
,
'etc'
,
arg_1
)
)
if
not
isfile
(
arg_2
)
:
raise
IOError
(
'File does not exist at {0}'
.
format
(
arg_2
)
)
with
open
(
arg_2
,
'rt'
)
as
fp
:
arg_3
=
json
.
load
(
fp
)
.
get
(
arg_0
,
)
assert
(
arg_3
is
not
)
return
dict
(
(
arg_4
[
'language'
]
,
arg_4
[
'name'
]
)
for
arg_4
in
arg_3
)

def Func(arg_0, arg_1='supported_translations.json'):
    '''
    Opens up file located under the etc directory containing language
    codes and prints them out.

    :param file: Path to location of json file
    :type file: str

    :return: language codes
    :rtype: dict
    '''
    arg_2 = abspath(join(dirname(__file__), 'etc', arg_1))

    if not isfile(arg_2):
        raise IOError('File does not exist at {0}'.format(arg_2))

    with open(arg_2, 'rt') as fp:
        arg_3 = json.load(fp).get(arg_0, None)
        assert(arg_3 is not None)

    return dict((arg_4['language'], arg_4['name']) for arg_4 in arg_3)

Opens up file located under the etc directory containing language codes and prints them out .


def Func ( arg_0 ) : if hasattr ( arg_0 , 'Func' ) : return arg_0 . Func ( ) elif hasattr ( arg_0 , 'seek' ) and hasattr ( arg_0 , 'tell' ) : try : arg_0 . seek ( 0 , 1 ) return True except ( OSError , IOError ) : return False return False

def Func(arg_0):
    """Backwards compat function to determine if a fileobj is Func

    :param fileobj: The file-like object to determine if Func

    :returns: True, if Func. False, otherwise.
    """
    # If the fileobj has a Func attr, try calling the Func()
    # method on it.
    if hasattr(arg_0, 'Func'):
        return arg_0.Func()
    # If there is no Func attr, check if the object can be seeked
    # or telled. If it can, try to seek to the current position.
    elif hasattr(arg_0, 'seek') and hasattr(arg_0, 'tell'):
        try:
            arg_0.seek(0, 1)
            return True
        except (OSError, IOError):
            # If an io related error was thrown then it is not Func.
            return False
    # Else, the fileobj is not Func
    return False

Backwards compat function to determine if a fileobj is seekable

    :param fileobj: The file-like object to determine if seekable

    :returns: True, if seekable. False, otherwise.


def Func ( arg_0 , arg_1 ) : if not arg_1 : return False if len ( arg_1 ) == 2 : if arg_1 [ - 2 ] in arg_0 . _vowels and arg_1 [ - 1 ] not in arg_0 . _vowels : return True elif len ( arg_1 ) >= 3 : if ( arg_1 [ - 3 ] not in arg_0 . _vowels and arg_1 [ - 2 ] in arg_0 . _vowels and arg_1 [ - 1 ] in arg_0 . _codanonvowels ) : return True return False

def Func(arg_0, arg_1):
        """Return True iff term ends in a short syllable.

        (...according to the Porter2 specification.)

        NB: This is akin to the CVC test from the Porter stemmer. The
        description is unfortunately poor/ambiguous.

        Parameters
        ----------
        term : str
            The term to examine

        Returns
        -------
        bool
            True iff term ends in a short syllable

        """
        if not arg_1:
            return False
        if len(arg_1) == 2:
            if arg_1[-2] in arg_0._vowels and arg_1[-1] not in arg_0._vowels:
                return True
        elif len(arg_1) >= 3:
            if (
                arg_1[-3] not in arg_0._vowels
                and arg_1[-2] in arg_0._vowels
                and arg_1[-1] in arg_0._codanonvowels
            ):
                return True
        return False

Return True iff term ends in a short syllable .


def Func ( arg_0 , arg_1 ) : arg_1 . provider = arg_0 . name arg_0 . gateway . onStatus ( arg_1 ) return arg_1

def Func(arg_0, arg_1):
        """ Incoming status callback

            Calls Gateway.onStatus event hook

            Providers are required to:
            * Cast phone numbers to digits-only
            * Use proper MessageStatus subclasses
            * Populate `status.msgid` and `status.meta` fields
            * If this method fails with an exception, the provider is required to respond with an error to the service

            :type status: MessageStatus
            :param status: The received status
            :rtype: MessageStatus
        """
        # Populate fields
        arg_1.provider = arg_0.name

        # Fire the event hook
        arg_0.gateway.onStatus(arg_1)

        # Finish
        return arg_1


(cls, tensor, mat, indices, shift=0, right_mul=False)

return np.einsum(tensor, indices_tensor, mat, indices_mat)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0, arg_5=False):
        """Perform a contraction using Numpy.einsum

        Args:
            tensor (np.array): a vector or matrix reshaped to a rank-N tensor.
            mat (np.array): a matrix reshaped to a rank-2M tensor.
            indices (list): tensor indices to contract with mat.
            shift (int): shift for indicies of tensor to contract [Default: 0].
            right_mul (bool): if True right multiply tensor by mat
                              (else left multiply) [Default: False].

        Returns:
            Numpy.ndarray: the matrix multiplied rank-N tensor.

        Raises:
            QiskitError: if mat is not an even rank tensor.
        """
        arg_6 = arg_1.ndim
        arg_7 = arg_2.ndim
        if arg_7 % 2 != 0:
            raise QiskitError(
                "Contracted matrix must have an even number of indices.")
        # Get einsum indices for tensor
        arg_8 = list(range(arg_6))
        for arg_9, arg_10 in enumerate(arg_3):
            arg_8[arg_10 + arg_4] = arg_6 + arg_9
        # Get einsum indces for mat
        arg_11 = list(reversed(range(arg_6, arg_6 + len(arg_3))))
        arg_12 = [arg_10 + arg_4 for arg_10 in reversed(arg_3)]
        if arg_5:
            arg_13 = arg_11 + arg_12
        else:
            arg_13 = arg_12 + arg_11
        return np.einsum(arg_1, arg_8, arg_2, arg_13)

Perform a contraction using Numpy . einsum


def Func ( arg_0 ) : if arg_0 . endswith ( '.gz' ) : arg_1 = getreader ( 'utf-8' ) ( gzip . open ( arg_0 , 'r' ) , errors = 'replace' ) else : arg_1 = open ( arg_0 , 'r' , encoding = 'utf-8' ) return arg_1

def Func(arg_0):
    """Return a opened file"""

    if arg_0.endswith('.gz'):
        arg_1 = getreader('utf-8')(gzip.open(arg_0, 'r'), errors='replace')
    else:
        arg_1 = open(arg_0, 'r', encoding='utf-8')

    return arg_1


def Func(arg_0,arg_1,arg_2=False,arg_3=False):
        """create ID_plot.html of just intrinsic properties."""
        if type(arg_1) is str:
            arg_1=[arg_1]
        for arg_4 in cm.abfSort(arg_1):
            arg_5=cm.parent(arg_0.groups,arg_4)
            arg_6=os.path.abspath("%s/%s_plot.html"%(arg_0.folder2,arg_5))
            if arg_3 is False and os.path.basename(arg_6) in arg_0.files2:
                continue
            arg_7=cm.filesByType(arg_0.groupFiles[arg_5])
            arg_8=""
            arg_8+='
'
            arg_8+='intrinsic properties for: %s
'%arg_5
            arg_8+='%s'%os.path.abspath(arg_0.folder1+"/"+arg_5+".abf")
            arg_8+='
'
            for arg_9 in arg_7['plot']:
                arg_8+=arg_0.htmlFor(arg_9)
            print("creating",arg_6,'...')
            style.save(arg_8,arg_6,arg_2=arg_2)

create ID_plot . html of just intrinsic properties .


def Func(arg_0, arg_1, *arg_2, **arg_3):
        """
        Validate the syntax of the template tag.
        """
        if arg_0.min_args is not None and len(arg_2) < arg_0.min_args:
            if arg_0.min_args == 1:
                raise TemplateSyntaxError("'{0}' tag requires at least {1} argument".format(arg_1, arg_0.min_args))
            else:
                raise TemplateSyntaxError("'{0}' tag requires at least {1} arguments".format(arg_1, arg_0.min_args))

        if arg_0.max_args is not None and len(arg_2) > arg_0.max_args:
            if arg_0.max_args == 0:
                if arg_0.allowed_kwargs:
                    raise TemplateSyntaxError("'{0}' tag only allows keywords arguments, for example {1}=\"...\".".format(arg_1, arg_0.allowed_kwargs[0]))
                else:
                    raise TemplateSyntaxError("'{0}' tag doesn't support any arguments".format(arg_1))
            elif arg_0.max_args == 1:
                raise TemplateSyntaxError("'{0}' tag only allows {1} argument.".format(arg_1, arg_0.max_args))
            else:
                raise TemplateSyntaxError("'{0}' tag only allows {1} arguments.".format(arg_1, arg_0.max_args))

Validate the syntax of the template tag .


def Func ( arg_0 , arg_1 ) : arg_1 = arg_1 . lower ( ) + ':' arg_2 = len ( arg_1 ) arg_3 = [ ] arg_4 = 0 for arg_5 in arg_0 . headers : if arg_4 : if not arg_5 [ : 1 ] . isspace ( ) : break elif arg_5 [ : arg_2 ] . lower ( ) == arg_1 : arg_4 = 1 if arg_4 : arg_3 . append ( arg_5 ) return arg_3

def Func(arg_0, arg_1):
        """Get the first header line matching name.

        This is similar to getallmatchingheaders, but it returns only the
        first matching header (and its continuation lines).
        """
        arg_1 = arg_1.lower() + ':'
        arg_2 = len(arg_1)
        arg_3 = []
        arg_4 = 0
        for arg_5 in arg_0.headers:
            if arg_4:
                if not arg_5[:1].isspace():
                    break
            elif arg_5[:arg_2].lower() == arg_1:
                arg_4 = 1
            if arg_4:
                arg_3.append(arg_5)
        return arg_3

Get the first header line matching name .


def Func ( arg_0 , * arg_1 ) : from ubelt import util_path arg_2 = get_app_cache_dir ( arg_0 , * arg_1 ) util_path . ensuredir ( arg_2 ) return arg_2

def Func(arg_0, *arg_1):
    """
    Calls `get_app_cache_dir` but ensures the directory exists.

    Args:
        appname (str): the name of the application
        *args: any other subdirectories may be specified

    SeeAlso:
        get_app_cache_dir

    Example:
        >>> import ubelt as ub
        >>> dpath = ub.Func('ubelt')
        >>> assert exists(dpath)
    """
    from ubelt import util_path
    arg_2 = get_app_cache_dir(arg_0, *arg_1)
    util_path.ensuredir(arg_2)
    return arg_2

Calls `get_app_cache_dir` but ensures the directory exists.

    Args:
        appname (str): the name of the application
        *args: any other subdirectories may be specified

    SeeAlso:
        get_app_cache_dir

    Example:
        >>> import ubelt as ub
        >>> dpath = ub.ensure_app_cache_dir('ubelt')
        >>> assert exists(dpath)

Calls get_app_cache_dir but ensures the directory exists .