def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
try
:
arg_3
=
_connection_refs
.
get
(
arg_0
)
if
not
arg_3
:
arg_4
=
_socket_refs
.
get
(
arg_0
)
else
:
arg_4
=
arg_3
.
_socket
if
not
arg_3
and
not
arg_4
:
return
0
arg_5
=
deref
(
arg_2
)
arg_6
=
arg_4
.
gettimeout
(
)
arg_7
=
arg_8
=
b''
try
:
while
len
(
arg_8
)
<
arg_5
:
if
arg_6
is
not
and
arg_6
>
0.0
:
arg_9
,
arg_10
,
arg_10
=
select
.
select
(
[
arg_4
]
,
[
]
,
[
]
,
arg_6
)
if
len
(
arg_9
)
==
0
:
raise
socket_
.
error
(
errno
.
EAGAIN
,
'timed out'
)
arg_11
=
arg_4
.
recv
(
arg_5
len
(
arg_8
)
)
arg_8
+=
arg_11
if
arg_11
==
b''
:
if
len
(
arg_8
)
==
0
:
if
arg_6
is
:
return
SecurityConst
.
errSSLClosedNoNotify
return
SecurityConst
.
errSSLClosedAbort
break
except
(
socket_
.
error
)
as
e
:
arg_7
=
e
.
errno
if
arg_7
is
not
and
arg_7
!=
errno
.
EAGAIN
:
if
arg_7
==
errno
.
ECONNRESET
or
arg_7
==
errno
.
EPIPE
:
return
SecurityConst
.
errSSLClosedNoNotify
return
SecurityConst
.
errSSLClosedAbort
if
arg_3
and
not
arg_3
.
_done_handshake
:
if
len
(
arg_8
)
>=
3
and
len
(
arg_3
.
_server_hello
)
==
0
:
arg_12
=
arg_8
[
0
:
1
]
in
set
(
[
b'\x15'
,
b'\x16'
]
)
arg_13
=
arg_8
[
1
:
3
]
in
set
(
[
b'\x03\x00'
,
b'\x03\x01'
,
b'\x03\x02'
,
b'\x03\x03'
,
b'\x03\x04'
]
)
if
not
arg_12
or
not
arg_13
:
arg_3
.
_server_hello
+=
arg_8
+
_read_remaining
(
arg_4
)
return
SecurityConst
.
errSSLProtocol
arg_3
.
_server_hello
+=
arg_8
write_to_buffer
(
arg_1
,
arg_8
)
pointer_set
(
arg_2
,
len
(
arg_8
)
)
if
len
(
arg_8
)
!=
arg_5
:
return
SecurityConst
.
errSSLWouldBlock
return
0
except
(
KeyboardInterrupt
)
as
e
:
if
arg_3
:
arg_3
.
_exception
=
e
return
SecurityConst
.
errSSLClosedAbort

def Func(arg_0, arg_1, arg_2):
    """
    Callback called by Secure Transport to actually read the socket

    :param connection_id:
        An integer identifing the connection

    :param data_buffer:
        A char pointer FFI type to write the data to

    :param data_length_pointer:
        A size_t pointer FFI type of the amount of data to read. Will be
        overwritten with the amount of data read on return.

    :return:
        An integer status code of the result - 0 for success
    """

    arg_3 = None
    try:
        arg_3 = _connection_refs.get(arg_0)
        if not arg_3:
            arg_4 = _socket_refs.get(arg_0)
        else:
            arg_4 = arg_3._socket

        if not arg_3 and not arg_4:
            return 0

        arg_5 = deref(arg_2)

        arg_6 = arg_4.gettimeout()
        arg_7 = None
        arg_8 = b''
        try:
            while len(arg_8) < arg_5:
                # Python 2 on Travis CI seems to have issues with blocking on
                # recv() for longer than the socket timeout value, so we select
                if arg_6 is not None and arg_6 > 0.0:
                    arg_9, arg_10, arg_10 = select.select([arg_4], [], [], arg_6)
                    if len(arg_9) == 0:
                        raise socket_.error(errno.EAGAIN, 'timed out')
                arg_11 = arg_4.recv(arg_5 - len(arg_8))
                arg_8 += arg_11
                if arg_11 == b'':
                    if len(arg_8) == 0:
                        if arg_6 is None:
                            return SecurityConst.errSSLClosedNoNotify
                        return SecurityConst.errSSLClosedAbort
                    break
        except (socket_.error) as e:
            arg_7 = e.errno

        if arg_7 is not None and arg_7 != errno.EAGAIN:
            if arg_7 == errno.ECONNRESET or arg_7 == errno.EPIPE:
                return SecurityConst.errSSLClosedNoNotify
            return SecurityConst.errSSLClosedAbort

        if arg_3 and not arg_3._done_handshake:
            # SecureTransport doesn't bother to check if the TLS record header
            # is valid before asking to read more data, which can result in
            # connection hangs. Here we do basic checks to get around the issue.
            if len(arg_8) >= 3 and len(arg_3._server_hello) == 0:
                # Check to ensure it is an alert or handshake first
                arg_12 = arg_8[0:1] in set([b'\x15', b'\x16'])
                # Check if the protocol version is SSL 3.0 or TLS 1.0-1.3
                arg_13 = arg_8[1:3] in set([
                    b'\x03\x00',
                    b'\x03\x01',
                    b'\x03\x02',
                    b'\x03\x03',
                    b'\x03\x04'
                ])
                if not arg_12 or not arg_13:
                    arg_3._server_hello += arg_8 + _read_remaining(arg_4)
                    return SecurityConst.errSSLProtocol
            arg_3._server_hello += arg_8

        write_to_buffer(arg_1, arg_8)
        pointer_set(arg_2, len(arg_8))

        if len(arg_8) != arg_5:
            return SecurityConst.errSSLWouldBlock

        return 0
    except (KeyboardInterrupt) as e:
        if arg_3:
            arg_3._exception = e
        return SecurityConst.errSSLClosedAbort


(users, label, extra_context=None, sender=None)

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = None ) : arg_4 = False if arg_2 is None : arg_2 = { } arg_5 = NoticeType . objects . get ( arg_1 = arg_1 ) arg_6 = get_language ( ) for arg_7 in arg_0 : try : arg_8 = get_notification_language ( arg_7 ) except LanguageStoreNotAvailable : arg_8 = None if arg_8 is not None : activate ( arg_8 ) for arg_9 in NOTIFICATION_BACKENDS . values ( ) : if arg_9 . can_send ( arg_7 , arg_5 ) : arg_9 . deliver ( arg_7 , arg_3 , arg_5 , arg_2 ) arg_4 = True activate ( arg_6 ) return arg_4

def Func(arg_0, arg_1, arg_2=None, arg_3=None):
    """
    Creates a new notice.

    This is intended to be how other apps create new notices.

    notification.send(user, "friends_invite_sent", {
        "spam": "eggs",
        "foo": "bar",
    )
    """
    arg_4 = False
    if arg_2 is None:
        arg_2 = {}

    arg_5 = NoticeType.objects.get(arg_1=arg_1)

    arg_6 = get_language()

    for arg_7 in arg_0:
        # get user language for user from language store defined in
        # NOTIFICATION_LANGUAGE_MODULE setting
        try:
            arg_8 = get_notification_language(arg_7)
        except LanguageStoreNotAvailable:
            arg_8 = None

        if arg_8 is not None:
            # activate the user's language
            activate(arg_8)

        for arg_9 in NOTIFICATION_BACKENDS.values():
            if arg_9.can_send(arg_7, arg_5):
                arg_9.deliver(arg_7, arg_3, arg_5, arg_2)
                arg_4 = True

    # reset environment to original language
    activate(arg_6)
    return arg_4


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = hashlib . md5 ( ) arg_4 = ',' . join ( ( arg_0 , arg_1 , arg_2 ) ) . encode ( 'utf-8' ) arg_3 . update ( arg_4 ) return arg_3 . hexdigest ( )

def Func(arg_0, arg_1, arg_2):
    """Return an auth token based on the client+service+seed tuple."""
    arg_3 = hashlib.md5()
    arg_4 = ','.join((arg_0, arg_1, arg_2)).encode('utf-8')
    arg_3.update(arg_4)
    return arg_3.hexdigest()

Return an auth token based on the client + service + seed tuple .


def Func(arg_0, arg_1=None, arg_2={}, **arg_3):
        """Returns the closest parent of this Tag that matches the given
        criteria."""
        # NOTE: We can't use _findOne because Funcs takes a different
        # set of arguments.
        arg_4 = None
        arg_5 = arg_0.Funcs(arg_1, arg_2, 1)
        if arg_5:
            arg_4 = arg_5[0]
        return arg_4

Returns the closest parent of this Tag that matches the given criteria .


def
Func
(
arg_0
)
:
arg_1
,
arg_2
,
arg_3
=
get_build_or_local
(
arg_0
.
obj
.
get
(
'project'
)
,
arg_0
.
obj
.
get
(
'build'
)
)
try
:
PolyaxonClient
(
)
.
build_job
.
Func
(
arg_1
,
arg_2
,
arg_3
)
except
(
PolyaxonHTTPError
,
PolyaxonShouldExitError
,
PolyaxonClientException
)
as
e
:
Printer
.
print_error
(
'Could not Func build job `{}`.'
.
format
(
arg_3
)
)
Printer
.
print_error
(
'Error message `{}`.'
.
format
(
e
)
)
sys
.
exit
(
1
)
Printer
.
print_success
(
"Build job Funced."
)

def Func(arg_0):
    """Bookmark build job.

    Uses [Caching](/references/polyaxon-cli/#caching)

    Examples:

    \b
    ```bash
    $ polyaxon build Func
    ```

    \b
    ```bash
    $ polyaxon build -b 2 Func
    ```
    """
    arg_1, arg_2, arg_3 = get_build_or_local(arg_0.obj.get('project'), arg_0.obj.get('build'))
    try:
        PolyaxonClient().build_job.Func(arg_1, arg_2, arg_3)
    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
        Printer.print_error('Could not Func build job `{}`.'.format(arg_3))
        Printer.print_error('Error message `{}`.'.format(e))
        sys.exit(1)

    Printer.print_success("Build job Funced.")

Bookmark build job.

    Uses [Caching](/references/polyaxon-cli/#caching)

    Examples:

    \b
    ```bash
    $ polyaxon build bookmark
    ```

    \b
    ```bash
    $ polyaxon build -b 2 bookmark
    ```


def Func(arg_0):
    '''This is a parallel worker for makelclist.

    Parameters
    ----------

    task : tuple
        This is a tuple containing the following items:

        task[0] = lcf
        task[1] = columns
        task[2] = lcformat
        task[3] = lcformatdir
        task[4] = lcndetkey

    Returns
    -------

    dict or None
        This contains all of the info for the object processed in this LC read
        operation. If this fails, returns None

    '''

    arg_1, arg_2, arg_3, arg_4, arg_5 = arg_0

    # get the bits needed for lcformat handling
    # NOTE: we re-import things in this worker function because sometimes
    # functions can't be pickled correctly for passing them to worker functions
    # in a processing pool
    try:
        arg_6 = get_lcformat(arg_3,
                                  use_lcformat_dir=arg_4)
        if arg_6:
            (arg_7, arg_8,
             arg_9, arg_10, arg_11,
             arg_12, arg_13) = arg_6
        else:
            LOGERROR("can't figure out the light curve format")
            return None
    except Exception as e:
        LOGEXCEPTION("can't figure out the light curve format")
        return None

    # we store the full path of the light curve
    arg_14 = {'lcfname':os.path.abspath(arg_1)}

    try:

        # read the light curve in
        arg_15 = arg_8(arg_1)

        # this should handle lists/tuples being returned by readerfunc
        # we assume that the first element is the actual lcdict
        # FIXME: figure out how to not need this assumption
        if ( (isinstance(arg_15, (list, tuple))) and
             (isinstance(arg_15[0], dict)) ):
            arg_15 = arg_15[0]

        # insert all of the columns
        for arg_16 in arg_2:

            if '.' in arg_16:
                arg_17 = arg_16.split('.')
            else:
                arg_17 = [arg_16]

            try:
                arg_18 = _dict_get(arg_15, arg_17)
            except Exception as e:
                LOGWARNING('column %s does not exist for %s' %
                           (arg_16, arg_1))
                arg_18 = np.nan

            # update the lcobjdict with this value
            arg_14[arg_17[-1]] = arg_18

    except Exception as e:

        LOGEXCEPTION('could not figure out columns for %s' % arg_1)

        # insert all of the columns as nans
        for arg_16 in arg_2:

            if '.' in arg_16:
                arg_17 = arg_16.split('.')
            else:
                arg_17 = [arg_16]

            arg_18 = np.nan

            # update the lclistdict with this value
            arg_14[arg_17[-1]] = arg_18

    # now get the actual ndets; this excludes nans and infs
    for arg_19 in arg_5:

        try:

            if '.' in arg_19:
                arg_20 = arg_19.split('.')
            else:
                arg_20 = [arg_19]

            arg_21 = _dict_get(arg_15, arg_20)
            arg_22 = arg_21[np.isfinite(arg_21)].size
            arg_14['%s.ndet' % arg_20[-1]] = arg_22

        except Exception as e:
            arg_14['%s.ndet' % arg_20[-1]] = np.nan

    return arg_14

This is a parallel worker for makelclist .


return [outputs.getByIndex(i)[0] for i in xrange(outputs.getCount())]

def Func ( arg_0 ) : arg_1 = arg_0 . getSpec ( ) . outputs return [ arg_1 . getByIndex ( arg_2 ) [ 0 ] for arg_2 in xrange ( arg_1 . getCount ( ) ) ]

def Func(arg_0):
    """
    Returns list of output names in spec.
    """
    arg_1 = arg_0.getSpec().outputs
    return [arg_1.getByIndex(arg_2)[0] for arg_2 in xrange(arg_1.getCount())]


def
Func
(
arg_0
,
arg_1
)
:
arg_0
=
os
.
path
.
expanduser
(
arg_0
)
try
:
arg_2
=
h5py
.
File
(
arg_0
,
"w"
)
arg_2
.
create_dataset
(
'CUTOUT'
,
data
=
arg_1
)
arg_2
.
close
(
)
except
Exception
as
e
:
raise
ValueError
(
"Could not Func HDF5 file {0}."
.
format
(
arg_0
)
)
return
arg_0

def Func(arg_0, arg_1):
    """
    Export a numpy array to a HDF5 file.

    Arguments:
        hdf5_filename (str): A filename to which to Func the HDF5 data
        array (numpy.ndarray): The numpy array to Func to HDF5

    Returns:
        String. The expanded filename that now holds the HDF5 data
    """
    # Expand filename to be absolute
    arg_0 = os.path.expanduser(arg_0)

    try:
        arg_2 = h5py.File(arg_0, "w")
        arg_2.create_dataset('CUTOUT', data=arg_1)
        arg_2.close()
    except Exception as e:
        raise ValueError("Could not Func HDF5 file {0}.".format(arg_0))

    return arg_0

Export a numpy array to a HDF5 file.

    Arguments:
        hdf5_filename (str): A filename to which to save the HDF5 data
        array (numpy.ndarray): The numpy array to save to HDF5

    Returns:
        String. The expanded filename that now holds the HDF5 data


def Func ( ) : import pyspark if ( hasattr ( pyspark , "version" ) ) : arg_0 = pyspark . version . __version__ arg_1 = arg_0 . split ( "." ) arg_2 = arg_1 [ 0 ] + "." + arg_1 [ 1 ] if ( compare_version ( arg_2 , "2.2" ) >= 0 ) : return False return True

def Func():
    """
    Check if spark version is below 2.2
    """
    import pyspark
    if(hasattr(pyspark,"version")):
        arg_0 = pyspark.version.__version__
        # We only need the general spark version (eg, 1.6, 2.2).
        arg_1 = arg_0.split(".")
        arg_2 = arg_1[0] + "." + arg_1[1]
        if(compare_version(arg_2, "2.2")>=0):
            return False
    return True


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . serializers . get ( arg_1 , None ) if arg_3 is None : return arg_0 . instances [ arg_1 ] = arg_3 . fetch ( arg_2 )

def Func(arg_0, arg_1, arg_2):
        """Fetch all queued instances of type `embed_type`, save results
        to `self.instances`"""

        arg_3 = arg_0.serializers.get(arg_1, None)

        if arg_3 is None:
            return

        arg_0.instances[arg_1] = arg_3.fetch(arg_2)

Fetch all queued instances of type embed_type save results to self . instances


return {DAY: field_date.day, MONTH: field_date.month, YEAR: field_date.year}

def Func ( arg_0 ) : return { DAY : arg_0 . day , MONTH : arg_0 . month , YEAR : arg_0 . year }

def Func(arg_0):
        """
        Convert native python ``datetime.date`` object  to a format supported by the API
        """
        return {DAY: arg_0.day, MONTH: arg_0.month, YEAR: arg_0.year}

Convert native python datetime . date object to a format supported by the API


return self.DATA_DOWNLOAD % ':download:`%s`' % files[0]

def
Func
(
arg_0
,
arg_1
)
:
if
len
(
arg_1
)
>
1
:
return
arg_0
.
DATA_DOWNLOAD
%
(
(
'\n\n'
+
' '
*
8
)
+
(
'\n'
+
' '
*
8
)
.
join
(
'* :download:`%s`'
%
arg_2
for
arg_2
in
arg_1
)
)
return
arg_0
.
DATA_DOWNLOAD
%
':download:`%s`'
%
arg_1
[
0
]

def Func(arg_0, arg_1):
        """Create the rst string to download supplementary data"""
        if len(arg_1) > 1:
            return arg_0.DATA_DOWNLOAD % (
                ('\n\n' + ' '*8) + ('\n' + ' '*8).join(
                    '* :download:`%s`' % arg_2 for arg_2 in arg_1))
        return arg_0.DATA_DOWNLOAD % ':download:`%s`' % arg_1[0]


(self, datacenter_id, lan_id, name=None,
                   public=None, ip_failover=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = None , arg_4 = None , arg_5 = None ) : arg_6 = { } if arg_3 : arg_6 [ 'name' ] = arg_3 if arg_4 is not None : arg_6 [ 'public' ] = arg_4 if arg_5 : arg_6 [ 'ipFailover' ] = arg_5 arg_7 = arg_0 . _perform_request ( url = '/datacenters/%s/lans/%s' % ( arg_1 , arg_2 ) , method = 'PATCH' , arg_6 = json . dumps ( arg_6 ) ) return arg_7

def Func(arg_0, arg_1, arg_2, arg_3=None,
                   arg_4=None, arg_5=None):
        """
        Updates a LAN

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

        :param      lan_id: The unique ID of the LAN.
        :type       lan_id: ``str``

        :param      name: The new name of the LAN.
        :type       name: ``str``

        :param      public: Indicates if the LAN is public.
        :type       public: ``bool``

        :param      ip_failover: A list of IP fail-over dicts.
        :type       ip_failover: ``list``

        """
        arg_6 = {}

        if arg_3:
            arg_6['name'] = arg_3

        if arg_4 is not None:
            arg_6['public'] = arg_4

        if arg_5:
            arg_6['ipFailover'] = arg_5

        arg_7 = arg_0._perform_request(
            url='/datacenters/%s/lans/%s' % (arg_1, arg_2),
            method='PATCH',
            arg_6=json.dumps(arg_6))

        return arg_7


(
            self, app_id, query, timezone_offset=None, verbose=None, staging=None, spell_check=None, bing_spell_check_subscription_key=None, log=None, custom_headers=None, raw=False, **operation_config)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
,
arg_4
=
,
arg_5
=
,
arg_6
=
,
arg_7
=
,
arg_8
=
,
arg_9
=
,
arg_10
=
False
,
**
arg_11
)
:
arg_12
=
arg_0
.
Func
.
metadata
[
'url'
]
arg_13
=
{
'Endpoint'
:
arg_0
.
_serialize
.
url
(
"self.config.endpoint"
,
arg_0
.
config
.
endpoint
,
'str'
,
skip_quote
=
True
)
,
'appId'
:
arg_0
.
_serialize
.
url
(
"app_id"
,
arg_1
,
'str'
)
}
arg_12
=
arg_0
.
_client
.
format_url
(
arg_12
,
**
arg_13
)
arg_14
=
{
}
if
arg_3
is
not
:
arg_14
[
'timezoneOffset'
]
=
arg_0
.
_serialize
.
query
(
"timezone_offset"
,
arg_3
,
'float'
)
if
arg_4
is
not
:
arg_14
[
'verbose'
]
=
arg_0
.
_serialize
.
query
(
"verbose"
,
arg_4
,
'bool'
)
if
arg_5
is
not
:
arg_14
[
'staging'
]
=
arg_0
.
_serialize
.
query
(
"staging"
,
arg_5
,
'bool'
)
if
arg_6
is
not
:
arg_14
[
'spellCheck'
]
=
arg_0
.
_serialize
.
query
(
"spell_check"
,
arg_6
,
'bool'
)
if
arg_7
is
not
:
arg_14
[
'bing-spell-check-subscription-key'
]
=
arg_0
.
_serialize
.
query
(
"bing_spell_check_subscription_key"
,
arg_7
,
'str'
)
if
arg_8
is
not
:
arg_14
[
'log'
]
=
arg_0
.
_serialize
.
query
(
"log"
,
arg_8
,
'bool'
)
arg_15
=
{
}
arg_15
[
'Accept'
]
=
'application/json'
arg_15
[
'Content-Type'
]
=
'application/json; charset=utf-8'
if
arg_9
:
arg_15
.
update
(
arg_9
)
arg_16
=
arg_0
.
_serialize
.
body
(
arg_2
,
'str'
)
arg_17
=
arg_0
.
_client
.
post
(
arg_12
,
arg_14
,
arg_15
,
arg_16
)
arg_18
=
arg_0
.
_client
.
send
(
arg_17
,
stream
=
False
,
**
arg_11
)
if
arg_18
.
status_code
not
in
[
200
]
:
raise
models
.
APIErrorException
(
arg_0
.
_deserialize
,
arg_18
)
arg_19
=
if
arg_18
.
status_code
==
200
:
arg_19
=
arg_0
.
_deserialize
(
'LuisResult'
,
arg_18
)
if
arg_10
:
arg_20
=
ClientRawResponse
(
arg_19
,
arg_18
)
return
arg_20
return
arg_19

def Func(
            arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=None, arg_7=None, arg_8=None, arg_9=None, arg_10=False, **arg_11):
        """Gets predictions for a given utterance, in the form of intents and
        entities. The current maximum query size is 500 characters.

        :param app_id: The LUIS application ID (Guid).
        :type app_id: str
        :param query: The utterance to predict.
        :type query: str
        :param timezone_offset: The timezone offset for the location of the
         request.
        :type timezone_offset: float
        :param verbose: If true, return all intents instead of just the top
         scoring intent.
        :type verbose: bool
        :param staging: Use the staging endpoint slot.
        :type staging: bool
        :param spell_check: Enable spell checking.
        :type spell_check: bool
        :param bing_spell_check_subscription_key: The subscription key to use
         when enabling Bing spell check
        :type bing_spell_check_subscription_key: str
        :param log: Log query (default is true)
        :type log: bool
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: LuisResult or ClientRawResponse if raw=true
        :rtype:
         ~azure.cognitiveservices.language.luis.runtime.models.LuisResult or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.language.luis.runtime.models.APIErrorException>`
        """
        # Construct URL
        arg_12 = arg_0.Func.metadata['url']
        arg_13 = {
            'Endpoint': arg_0._serialize.url("self.config.endpoint", arg_0.config.endpoint, 'str', skip_quote=True),
            'appId': arg_0._serialize.url("app_id", arg_1, 'str')
        }
        arg_12 = arg_0._client.format_url(arg_12, **arg_13)

        # Construct parameters
        arg_14 = {}
        if arg_3 is not None:
            arg_14['timezoneOffset'] = arg_0._serialize.query("timezone_offset", arg_3, 'float')
        if arg_4 is not None:
            arg_14['verbose'] = arg_0._serialize.query("verbose", arg_4, 'bool')
        if arg_5 is not None:
            arg_14['staging'] = arg_0._serialize.query("staging", arg_5, 'bool')
        if arg_6 is not None:
            arg_14['spellCheck'] = arg_0._serialize.query("spell_check", arg_6, 'bool')
        if arg_7 is not None:
            arg_14['bing-spell-check-subscription-key'] = arg_0._serialize.query("bing_spell_check_subscription_key", arg_7, 'str')
        if arg_8 is not None:
            arg_14['log'] = arg_0._serialize.query("log", arg_8, 'bool')

        # Construct headers
        arg_15 = {}
        arg_15['Accept'] = 'application/json'
        arg_15['Content-Type'] = 'application/json; charset=utf-8'
        if arg_9:
            arg_15.update(arg_9)

        # Construct body
        arg_16 = arg_0._serialize.body(arg_2, 'str')

        # Construct and send request
        arg_17 = arg_0._client.post(arg_12, arg_14, arg_15, arg_16)
        arg_18 = arg_0._client.send(arg_17, stream=False, **arg_11)

        if arg_18.status_code not in [200]:
            raise models.APIErrorException(arg_0._deserialize, arg_18)

        arg_19 = None

        if arg_18.status_code == 200:
            arg_19 = arg_0._deserialize('LuisResult', arg_18)

        if arg_10:
            arg_20 = ClientRawResponse(arg_19, arg_18)
            return arg_20

        return arg_19

Gets predictions for a given utterance in the form of intents and entities . The current maximum query size is 500 characters .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
OrderedDict
(
)
arg_3
=
arg_0
[
'total_returns'
]
arg_4
=
arg_0
[
'specific_returns'
]
arg_5
=
arg_0
[
'common_returns'
]
arg_2
[
'Annualized Specific Return'
]
=
ep
.
annual_return
(
arg_4
)
arg_2
[
'Annualized Common Return'
]
=
ep
.
annual_return
(
arg_5
)
arg_2
[
'Annualized Total Return'
]
=
ep
.
annual_return
(
arg_3
)
arg_2
[
'Specific Sharpe Ratio'
]
=
ep
.
sharpe_ratio
(
arg_4
)
arg_2
[
'Cumulative Specific Return'
]
=
ep
.
cum_returns_final
(
arg_4
)
arg_2
[
'Cumulative Common Return'
]
=
ep
.
cum_returns_final
(
arg_5
)
arg_2
[
'Total Returns'
]
=
ep
.
cum_returns_final
(
arg_3
)
arg_2
=
pd
.
Series
(
arg_2
,
name
=
''
)
arg_6
=
[
ep
.
annual_return
(
arg_0
[
c
]
)
for
c
in
arg_1
.
columns
]
arg_7
=
[
ep
.
cum_returns_final
(
arg_0
[
c
]
)
for
c
in
arg_1
.
columns
]
arg_8
=
pd
.
DataFrame
(
data
=
OrderedDict
(
[
(
'Average Risk Factor Exposure'
,
arg_1
.
mean
(
axis
=
'rows'
)
)
,
(
'Annualized Return'
,
arg_6
)
,
(
'Cumulative Return'
,
arg_7
)
,
]
)
,
index
=
arg_1
.
columns
,
)
return
arg_2
,
arg_8

def Func(arg_0, arg_1):
    """
    Takes perf attribution data over a period of time and computes annualized
    multifactor alpha, multifactor sharpe, risk exposures.
    """
    arg_2 = OrderedDict()
    arg_3 = arg_0['total_returns']
    arg_4 = arg_0['specific_returns']
    arg_5 = arg_0['common_returns']

    arg_2['Annualized Specific Return'] =\
        ep.annual_return(arg_4)
    arg_2['Annualized Common Return'] =\
        ep.annual_return(arg_5)
    arg_2['Annualized Total Return'] =\
        ep.annual_return(arg_3)

    arg_2['Specific Sharpe Ratio'] =\
        ep.sharpe_ratio(arg_4)

    arg_2['Cumulative Specific Return'] =\
        ep.cum_returns_final(arg_4)
    arg_2['Cumulative Common Return'] =\
        ep.cum_returns_final(arg_5)
    arg_2['Total Returns'] =\
        ep.cum_returns_final(arg_3)

    arg_2 = pd.Series(arg_2, name='')

    arg_6 = [ep.annual_return(arg_0[c])
                                    for c in arg_1.columns]
    arg_7 = [ep.cum_returns_final(arg_0[c])
                                    for c in arg_1.columns]

    arg_8 = pd.DataFrame(
        data=OrderedDict([
            (
                'Average Risk Factor Exposure',
                arg_1.mean(axis='rows')
            ),
            ('Annualized Return', arg_6),
            ('Cumulative Return', arg_7),
        ]),
        index=arg_1.columns,
    )

    return arg_2, arg_8

Takes perf attribution data over a period of time and computes annualized multifactor alpha multifactor sharpe risk exposures .


(cls, name=None, inputs=None, par=1, config=None, optional_outputs=None)

return HeronComponentSpec(name, python_class_path, is_spout=False, par=par,
                              inputs=inputs, outputs=_outputs, config=config)

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = 1 , arg_4 = None , arg_5 = None ) : arg_6 = "%s.%s" % ( arg_0 . __module__ , arg_0 . __name__ ) if hasattr ( arg_0 , 'outputs' ) : arg_7 = copy . copy ( arg_0 . outputs ) else : arg_7 = [ ] if arg_5 is not None : assert isinstance ( arg_5 , ( list , tuple ) ) for arg_8 in arg_5 : assert isinstance ( arg_8 , ( str , Stream ) ) arg_7 . append ( arg_8 ) return HeronComponentSpec ( arg_1 , arg_6 , is_spout = False , arg_3 = arg_3 , arg_2 = arg_2 , outputs = arg_7 , arg_4 = arg_4 )

def Func(arg_0, arg_1=None, arg_2=None, arg_3=1, arg_4=None, arg_5=None):
    """Register this bolt to the topology and create ``HeronComponentSpec``

    This method takes an optional ``outputs`` argument for supporting dynamic output fields
    declaration. However, it is recommended that ``outputs`` should be declared as
    an attribute of your ``Bolt`` subclass. Also, some ways of declaring inputs is not supported
    in this implementation; please read the documentation below.

    :type name: str
    :param name: Name of this bolt.
    :type inputs: dict or list
    :param inputs: Streams that feed into this Bolt.

                   Two forms of this are acceptable:

                   1. A `dict` mapping from ``HeronComponentSpec`` to ``Grouping``.
                      In this case, default stream is used.
                   2. A `dict` mapping from ``GlobalStreamId`` to ``Grouping``.
                      This ``GlobalStreamId`` object itself is different from StreamParse, because
                      Heron does not use thrift, although its constructor method is compatible.
                   3. A `list` of ``HeronComponentSpec``. In this case, default stream with
                      SHUFFLE grouping is used.
                   4. A `list` of ``GlobalStreamId``. In this case, SHUFFLE grouping is used.
    :type par: int
    :param par: Parallelism hint for this spout.
    :type config: dict
    :param config: Component-Funcific config settings.
    :type optional_outputs: list of (str or Stream) or tuple of (str or Stream)
    :param optional_outputs: Additional output fields for this bolt. These fields are added to
                             existing ``outputs`` class attributes of your bolt. This is an optional
                             argument, and exists only for supporting dynamic output field
                             declaration.
    """
    arg_6 = "%s.%s" % (arg_0.__module__, arg_0.__name__)

    if hasattr(arg_0, 'outputs'):
      # avoid modification to cls.outputs
      arg_7 = copy.copy(arg_0.outputs)
    else:
      arg_7 = []

    if arg_5 is not None:
      assert isinstance(arg_5, (list, tuple))
      for arg_8 in arg_5:
        assert isinstance(arg_8, (str, Stream))
        arg_7.append(arg_8)

    return HeronComponentSpec(arg_1, arg_6, is_spout=False, arg_3=arg_3,
                              arg_2=arg_2, outputs=arg_7, arg_4=arg_4)

Register this bolt to the topology and create ``HeronComponentSpec``

    This method takes an optional ``outputs`` argument for supporting dynamic output fields
    declaration. However, it is recommended that ``outputs`` should be declared as
    an attribute of your ``Bolt`` subclass. Also, some ways of declaring inputs is not supported
    in this implementation; please read the documentation below.

    :type name: str
    :param name: Name of this bolt.
    :type inputs: dict or list
    :param inputs: Streams that feed into this Bolt.

                   Two forms of this are acceptable:

                   1. A `dict` mapping from ``HeronComponentSpec`` to ``Grouping``.
                      In this case, default stream is used.
                   2. A `dict` mapping from ``GlobalStreamId`` to ``Grouping``.
                      This ``GlobalStreamId`` object itself is different from StreamParse, because
                      Heron does not use thrift, although its constructor method is compatible.
                   3. A `list` of ``HeronComponentSpec``. In this case, default stream with
                      SHUFFLE grouping is used.
                   4. A `list` of ``GlobalStreamId``. In this case, SHUFFLE grouping is used.
    :type par: int
    :param par: Parallelism hint for this spout.
    :type config: dict
    :param config: Component-specific config settings.
    :type optional_outputs: list of (str or Stream) or tuple of (str or Stream)
    :param optional_outputs: Additional output fields for this bolt. These fields are added to
                             existing ``outputs`` class attributes of your bolt. This is an optional
                             argument, and exists only for supporting dynamic output field
                             declaration.

Register this bolt to the topology and create HeronComponentSpec


(self, start=1, stop=None, raw=True, output=False)

def Func(arg_0, arg_1=1, arg_2=None, arg_3=True, arg_4=False):
        """Get input and output history from the current session. Called by
        get_range, and takes similar parameters."""
        arg_5 = arg_0.input_hist_raw if arg_3 else arg_0.input_hist_parsed

        arg_6 = len(arg_5)
        if arg_1 < 0:
            arg_1 += arg_6
        if not arg_2 or (arg_2 > arg_6):
            arg_2 = arg_6
        elif arg_2 < 0:
            arg_2 += arg_6

        for arg_7 in range(arg_1, arg_2):
            if arg_4:
                arg_8 = (arg_5[arg_7], arg_0.output_hist_reprs.get(arg_7))
            else:
                arg_8 = arg_5[arg_7]
            yield (0, arg_7, arg_8)

Get input and output history from the current session . Called by get_range and takes similar parameters .


(
            self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, custom_headers=None, raw=False, **operation_config)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
=
,
arg_5
=
,
arg_6
=
,
arg_7
=
,
arg_8
=
False
,
**
arg_9
)
:
arg_10
=
models
.
CertificateIssuerSetParameters
(
arg_3
=
arg_3
,
arg_4
=
arg_4
,
arg_5
=
arg_5
,
arg_6
=
arg_6
)
arg_11
=
arg_0
.
Func
.
metadata
[
'url'
]
arg_12
=
{
'vaultBaseUrl'
:
arg_0
.
_serialize
.
url
(
"vault_base_url"
,
arg_1
,
'str'
,
skip_quote
=
True
)
,
'issuer-name'
:
arg_0
.
_serialize
.
url
(
"issuer_name"
,
arg_2
,
'str'
)
}
arg_11
=
arg_0
.
_client
.
format_url
(
arg_11
,
**
arg_12
)
arg_13
=
{
}
arg_13
[
'api-version'
]
=
arg_0
.
_serialize
.
query
(
"self.api_version"
,
arg_0
.
api_version
,
'str'
)
arg_14
=
{
}
arg_14
[
'Content-Type'
]
=
'application/json; charset=utf-8'
if
arg_0
.
config
.
generate_client_request_id
:
arg_14
[
'x-ms-client-request-id'
]
=
str
(
uuid
.
uuid1
(
)
)
if
arg_7
:
arg_14
.
update
(
arg_7
)
if
arg_0
.
config
.
accept_language
is
not
:
arg_14
[
'accept-language'
]
=
arg_0
.
_serialize
.
header
(
"self.config.accept_language"
,
arg_0
.
config
.
accept_language
,
'str'
)
arg_15
=
arg_0
.
_serialize
.
body
(
arg_10
,
'CertificateIssuerSetParameters'
)
arg_16
=
arg_0
.
_client
.
put
(
arg_11
,
arg_13
)
arg_17
=
arg_0
.
_client
.
send
(
arg_16
,
arg_14
,
arg_15
,
stream
=
False
,
**
arg_9
)
if
arg_17
.
status_code
not
in
[
200
]
:
raise
models
.
KeyVaultErrorException
(
arg_0
.
_deserialize
,
arg_17
)
arg_18
=
if
arg_17
.
status_code
==
200
:
arg_18
=
arg_0
.
_deserialize
(
'IssuerBundle'
,
arg_17
)
if
arg_8
:
arg_19
=
ClientRawResponse
(
arg_18
,
arg_17
)
return
arg_19
return
arg_18

def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=None, arg_7=None, arg_8=False, **arg_9):
        """Sets the specified certificate issuer.

        The SetCertificateIssuer operation adds or updates the specified
        certificate issuer. This operation requires the certificates/setissuers
        permission.

        :param vault_base_url: The vault name, for example
         https://myvault.vault.azure.net.
        :type vault_base_url: str
        :param issuer_name: The name of the issuer.
        :type issuer_name: str
        :param provider: The issuer provider.
        :type provider: str
        :param credentials: The credentials to be used for the issuer.
        :type credentials:
         ~azure.keyvault.v2016_10_01.models.IssuerCredentials
        :param organization_details: Details of the organization as provided
         to the issuer.
        :type organization_details:
         ~azure.keyvault.v2016_10_01.models.OrganizationDetails
        :param attributes: Attributes of the issuer object.
        :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: IssuerBundle or ClientRawResponse if raw=true
        :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`KeyVaultErrorException<azure.keyvault.v2016_10_01.models.KeyVaultErrorException>`
        """
        arg_10 = models.CertificateIssuerSetParameters(arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, arg_6=arg_6)

        # Construct URL
        arg_11 = arg_0.Func.metadata['url']
        arg_12 = {
            'vaultBaseUrl': arg_0._serialize.url("vault_base_url", arg_1, 'str', skip_quote=True),
            'issuer-name': arg_0._serialize.url("issuer_name", arg_2, 'str')
        }
        arg_11 = arg_0._client.format_url(arg_11, **arg_12)

        # Construct parameters
        arg_13 = {}
        arg_13['api-version'] = arg_0._serialize.query("self.api_version", arg_0.api_version, 'str')

        # Construct headers
        arg_14 = {}
        arg_14['Content-Type'] = 'application/json; charset=utf-8'
        if arg_0.config.generate_client_request_id:
            arg_14['x-ms-client-request-id'] = str(uuid.uuid1())
        if arg_7:
            arg_14.update(arg_7)
        if arg_0.config.accept_language is not None:
            arg_14['accept-language'] = arg_0._serialize.header("self.config.accept_language", arg_0.config.accept_language, 'str')

        # Construct body
        arg_15 = arg_0._serialize.body(arg_10, 'CertificateIssuerSetParameters')

        # Construct and send request
        arg_16 = arg_0._client.put(arg_11, arg_13)
        arg_17 = arg_0._client.send(
            arg_16, arg_14, arg_15, stream=False, **arg_9)

        if arg_17.status_code not in [200]:
            raise models.KeyVaultErrorException(arg_0._deserialize, arg_17)

        arg_18 = None

        if arg_17.status_code == 200:
            arg_18 = arg_0._deserialize('IssuerBundle', arg_17)

        if arg_8:
            arg_19 = ClientRawResponse(arg_18, arg_17)
            return arg_19

        return arg_18


def Func ( arg_0 , arg_1 ) : arg_2 = tempfile . TemporaryFile ( ) for arg_3 in io . open ( arg_0 , arg_1 = arg_1 ) : arg_2 . write ( arg_3 . strip ( '\uFEFF' ) . encode ( 'utf-8' ) ) arg_2 . seek ( 0 ) return arg_2

def Func(arg_0, arg_1):
    """
    Convert a file in some other encoding into a temporary file that's in
    UTF-8.
    """
    arg_2 = tempfile.TemporaryFile()
    for arg_3 in io.open(arg_0, arg_1=arg_1):
        arg_2.write(arg_3.strip('\uFEFF').encode('utf-8'))

    arg_2.seek(0)
    return arg_2

Convert a file in some other encoding into a temporary file that s in UTF - 8 .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 = False ) : arg_4 = [ ] for arg_5 in range ( arg_2 ) : arg_4 . append ( Operators . CHR ( arg_0 . read_int ( arg_1 + arg_5 , 8 , arg_3 ) ) ) return arg_4

def Func(arg_0, arg_1, arg_2, arg_3=False):
        """
        Read from memory.

        :param int where: address to read data from
        :param int size: number of bytes
        :param force: whether to ignore memory permissions
        :return: data
        :rtype: list[int or Expression]
        """
        arg_4 = []
        for arg_5 in range(arg_2):
            arg_4.append(Operators.CHR(arg_0.read_int(arg_1 + arg_5, 8, arg_3)))
        return arg_4


(source_dir, target_dir, create_target_dir=False, md5_check=False)

def Func ( arg_0 , arg_1 , arg_2 = False , arg_3 = False ) : import fnmatch if IsDir ( arg_0 ) : arg_4 = '*' else : arg_0 , arg_4 = os . path . split ( arg_0 ) if not IsDir ( arg_1 ) : if arg_2 : CreateDirectory ( arg_1 ) else : from . _exceptions import DirectoryNotFoundError raise DirectoryNotFoundError ( arg_1 ) arg_5 = ListFiles ( arg_0 ) if arg_5 is None : return for arg_6 in arg_5 : if arg_3 and arg_6 . endswith ( '.md5' ) : continue if fnmatch . fnmatch ( arg_6 , arg_4 ) : arg_7 = arg_0 + '/' + arg_6 arg_8 = arg_1 + '/' + arg_6 if IsDir ( arg_7 ) : Func ( arg_7 , arg_8 , arg_2 = True , arg_3 = arg_3 ) else : CopyFile ( arg_7 , arg_8 , arg_3 = arg_3 )

def Func(arg_0, arg_1, arg_2=False, arg_3=False):
    '''
    Copy files from the given source to the target.

    :param unicode source_dir:
        A filename, URL or a file mask.
        Ex.
            x:\coilib50
            x:\coilib50\*
            http://server/directory/file
            ftp://server/directory/file

    :param unicode target_dir:
        A directory or an URL
        Ex.
            d:\Temp
            ftp://server/directory

    :param bool create_target_dir:
        If True, creates the target path if it doesn't exists.

    :param bool md5_check:
        .. seealso:: CopyFile

    :raises DirectoryNotFoundError:
        If target_dir does not exist, and create_target_dir is False

    .. seealso:: CopyFile for documentation on accepted protocols

    .. seealso:: FTP LIMITATIONS at this module's doc for performance issues information
    '''
    import fnmatch

    # Check if we were given a directory or a directory with mask
    if IsDir(arg_0):
        # Yes, it's a directory, copy everything from it
        arg_4 = '*'
    else:
        # Split directory and mask
        arg_0, arg_4 = os.path.split(arg_0)

    # Create directory if necessary
    if not IsDir(arg_1):
        if arg_2:
            CreateDirectory(arg_1)
        else:
            from ._exceptions import DirectoryNotFoundError
            raise DirectoryNotFoundError(arg_1)

    # List and match files
    arg_5 = ListFiles(arg_0)

    # Check if we have a source directory
    if arg_5 is None:
        return

    # Copy files
    for arg_6 in arg_5:
        if arg_3 and arg_6.endswith('.md5'):
            continue  # md5 files will be copied by CopyFile when copying their associated files

        if fnmatch.fnmatch(arg_6, arg_4):
            arg_7 = arg_0 + '/' + arg_6
            arg_8 = arg_1 + '/' + arg_6

            if IsDir(arg_7):
                # If we found a directory, copy it recursively
                Func(arg_7, arg_8, arg_2=True, arg_3=arg_3)
            else:
                CopyFile(arg_7, arg_8, arg_3=arg_3)

Copy files from the given source to the target .


Layout the graph incrementally.

        The graph is drawn at the center of the canvas.
        The weighted and directed parameters visualize edge weight and direction.
        The highlight specifies list of connected nodes.
        The path will be colored according to the "highlight" style.
        Clicking and dragging events are monitored.

(self, dx=0, dy=0, weighted=False, directed=False, highlight=[], traffic=None)

def Func ( arg_0 , arg_1 = 0 , arg_2 = 0 , arg_3 = False , arg_4 = False , arg_5 = [ ] , arg_6 = None ) : arg_0 . update ( ) arg_7 = arg_0 . styles . default arg_7 . graph_background ( arg_7 ) _ctx . push ( ) _ctx . translate ( arg_0 . x + arg_1 , arg_0 . y + arg_2 ) if arg_6 : if isinstance ( arg_6 , bool ) : arg_6 = 5 for arg_8 in arg_0 . nodes_by_betweenness ( ) [ : arg_6 ] : try : arg_7 = arg_0 . styles [ arg_8 . style ] except : arg_7 = arg_0 . styles . default if arg_7 . graph_traffic : arg_7 . graph_traffic ( arg_7 , arg_8 , arg_0 . alpha ) arg_7 = arg_0 . styles . default if arg_7 . edges : arg_7 . edges ( arg_7 , arg_0 . edges , arg_0 . alpha , arg_3 , arg_4 ) for arg_8 in arg_0 . nodes : try : arg_7 = arg_0 . styles [ arg_8 . style ] except : arg_7 = arg_0 . styles . default if arg_7 . node : arg_7 . node ( arg_7 , arg_8 , arg_0 . alpha ) try : arg_7 = arg_0 . styles . highlight except : arg_7 = arg_0 . styles . default if arg_7 . path : arg_7 . path ( arg_7 , arg_0 , arg_5 ) for arg_8 in arg_0 . nodes : try : arg_7 = arg_0 . styles [ arg_8 . style ] except : arg_7 = arg_0 . styles . default if arg_7 . node_label : arg_7 . node_label ( arg_7 , arg_8 , arg_0 . alpha ) _ctx . pop ( )

def Func(arg_0, arg_1=0, arg_2=0, arg_3=False, arg_4=False, arg_5=[], arg_6=None):

        """ Layout the graph incrementally.

        The graph is Funcn at the center of the canvas.
        The weighted and directed parameters visualize edge weight and direction.
        The highlight specifies list of connected nodes.
        The path will be colored according to the "highlight" style.
        Clicking and dragging events are monitored.

        """

        arg_0.update()

        # Draw the graph background.
        arg_7 = arg_0.styles.default
        arg_7.graph_background(arg_7)

        # Center the graph on the canvas.
        _ctx.push()
        _ctx.translate(arg_0.x+arg_1, arg_0.y+arg_2)

        # Indicate betweenness centrality.
        if arg_6:
            if isinstance(arg_6, bool):
                arg_6 = 5
            for arg_8 in arg_0.nodes_by_betweenness()[:arg_6]:
                try: arg_7 = arg_0.styles[arg_8.style]
                except: arg_7 = arg_0.styles.default
                if arg_7.graph_traffic:
                    arg_7.graph_traffic(arg_7, arg_8, arg_0.alpha)

        # Draw the edges and their labels.
        arg_7 = arg_0.styles.default
        if arg_7.edges:
            arg_7.edges(arg_7, arg_0.edges, arg_0.alpha, arg_3, arg_4)

        # Draw each node in the graph.
        # Apply individual style to each node (or default).
        for arg_8 in arg_0.nodes:
            try:  arg_7 = arg_0.styles[arg_8.style]
            except: arg_7 = arg_0.styles.default
            if arg_7.node:
                arg_7.node(arg_7, arg_8, arg_0.alpha)

        # Highlight the given shortest path.
        try: arg_7 = arg_0.styles.highlight
        except: arg_7 = arg_0.styles.default
        if arg_7.path:
            arg_7.path(arg_7, arg_0, arg_5)

        # Draw node id's as labels on each node.
        for arg_8 in arg_0.nodes:
            try:  arg_7 = arg_0.styles[arg_8.style]
            except: arg_7 = arg_0.styles.default
            if arg_7.node_label:
                arg_7.node_label(arg_7, arg_8, arg_0.alpha)

        # Events for clicked and dragged nodes.
        # Nodes will resist being dragged by attraction and repulsion,
        # put the event listener on top to get more direct feedback.
        #self.events.update()

        _ctx.pop()

Layout the graph incrementally . The graph is drawn at the center of the canvas . The weighted and directed parameters visualize edge weight and direction . The highlight specifies list of connected nodes . The path will be colored according to the highlight style . Clicking and dragging events are monitored .


def Func ( arg_0 , arg_1 , arg_2 = False ) : if arg_2 and os . path . exists ( arg_1 ) : os . remove ( arg_1 ) arg_3 = fits . Header ( ) arg_4 = fits . PrimaryHDU ( np . flipud ( arg_0 ) , arg_3 ) arg_4 . writeto ( arg_1 )

def Func(arg_0, arg_1, arg_2=False):
    """Write a 2D NumPy array to a .fits file.

    Before outputting a NumPy array, the array is flipped upside-down using np.flipud. This is so that the arrays \
    appear the same orientation as .fits files loaded in DS9.

    Parameters
    ----------
    array_2d : ndarray
        The 2D array that is written to fits.
    file_path : str
        The full path of the file that is output, including the file name and '.fits' extension.
    overwrite : bool
        If True and a file already exists with the input file_path the .fits file is overwritten. If False, an error \
        will be raised.

    Returns
    -------
    None

    Examples
    --------
    array_2d = np.ones((5,5))
    numpy_array_to_fits(array=array_2d, file_path='/path/to/file/filename.fits', overwrite=True)
    """
    if arg_2 and os.path.exists(arg_1):
        os.remove(arg_1)

    arg_3 = fits.Header()
    arg_4 = fits.PrimaryHDU(np.flipud(arg_0), arg_3)
    arg_4.writeto(arg_1)

Write a 2D NumPy array to a . fits file .


def Func(arg_0, **arg_1):
        """
        Search for TV shows by title.

        Args:
            query: CGI escpaed string.
            page: (optional) Minimum value of 1. Expected value is an integer.
            language: (optional) ISO 639-1 code.
            first_air_date_year: (optional) Filter the results to only match
                                 shows that have a air date with with value.
            search_type: (optional) By default, the search type is 'phrase'.
                         This is almost guaranteed the option you will want.
                         It's a great all purpose search type and by far the
                         most tuned for every day querying. For those wanting
                         more of an "autocomplete" type search, set this
                         option to 'ngram'.

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

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


def Func(arg_0, arg_1, arg_2):
        """
        Mark the name as consumed and delete it from
        the to_consume dictionary
        """
        arg_0.consumed[arg_1] = arg_2
        del arg_0.to_consume[arg_1]


def Func(arg_0):
        """
        1) Get command line arguments
        2) Read the JSON file
        3) Parse into a dictionary
        4) Create or update definitions using API call
        """

        arg_0.v2Metrics = arg_0.metricDefinitionV2(arg_0.metrics)
        if arg_0.v2Metrics:
            arg_2 = arg_0.metrics

        else:
            arg_2 = arg_0.metrics['result']

        # Loop through the metrics and call the API
        # to create/update
        for arg_3 in arg_2:
            if arg_0.v2Metrics:
                arg_4 = arg_2[arg_3]
                arg_4['name'] = arg_3
            else:
                arg_4 = arg_3
            arg_0.create_update(arg_4)

1 ) Get command line arguments 2 ) Read the JSON file 3 ) Parse into a dictionary 4 ) Create or update definitions using API call


Start a pdb set_trace inside of the template with the context available as
    'context'. Uses ipdb if available.

def Func(arg_0):
    """
    Start a pdb Func inside of the template with the context available as
    'context'. Uses ipdb if available.
    """
    try:
        import ipdb as pdb
    except ImportError:
        import pdb
        print("For best results, pip install ipdb.")
    print("Variables that are available in the current context:")
    arg_1 = lambda s: template.Template(s).render(arg_0)
    arg_2 = get_variables(arg_0)
    pprint(arg_2)
    print('Type `availables` to show this list.')
    print('Type <variable_name> to access one.')
    print('Use render("template string") to test template rendering')
    # Cram context variables into the local scope
    for arg_3 in arg_2:
        arg_4()[arg_3] = arg_0[arg_3]
    pdb.Func()
    return ''

Start a pdb set_trace inside of the template with the context available as context . Uses ipdb if available .


def Func ( ** arg_0 ) : try : arg_1 = _pybossa_req ( 'get' , 'category' , params = arg_0 ) if type ( arg_1 ) . __name__ == 'list' : return [ Category ( arg_2 ) for arg_2 in arg_1 ] else : return arg_1 except : raise

def Func(**arg_0):
    """Return a list with matching Category arguments.

    :param kwargs: PYBOSSA Category members
    :rtype: list
    :returns: A list of project that match the kwargs

    """
    try:
        arg_1 = _pybossa_req('get', 'category', params=arg_0)
        if type(arg_1).__name__ == 'list':
            return [Category(arg_2) for arg_2 in arg_1]
        else:
            return arg_1
    except:  # pragma: no cover
        raise

Return a list with matching Category arguments .


def Func ( arg_0 ) : for arg_1 in dir ( arg_0 ) : arg_2 = getattr ( arg_0 , arg_1 ) arg_3 = getattr ( arg_2 , 'api_path' , None ) if arg_3 : yield ( '%s%s' % ( arg_0 . api_path_prefix , arg_3 ) , arg_2 , ) for arg_4 in arg_0 . api_providers : for arg_3 , arg_2 in Func ( arg_4 ) : yield ( arg_3 , arg_2 )

def Func(arg_0):
    """Iterator over all API endpoint names and callbacks."""
    for arg_1 in dir(arg_0):
        arg_2 = getattr(arg_0, arg_1)
        arg_3 = getattr(arg_2, 'api_path', None)
        if arg_3:
            yield (
                '%s%s' % (arg_0.api_path_prefix, arg_3),
                arg_2,
            )
    for arg_4 in arg_0.api_providers:
        for arg_3, arg_2 in Func(arg_4):
            yield (arg_3, arg_2)

Iterator over all API endpoint names and callbacks .


def
Func
(
arg_0
,
arg_1
)
:
from
azure
.
servicefabric
.
service_fabric_client_ap_is
import
(
ServiceFabricClientAPIs
)
from
sfctl
.
auth
import
ClientCertAuthentication
from
sfctl
.
config
import
set_aad_metadata
arg_2
=
ClientCertAuthentication
(
,
,
arg_1
)
arg_3
=
ServiceFabricClientAPIs
(
arg_2
,
base_url
=
arg_0
)
arg_4
=
arg_3
.
get_aad_metadata
(
)
if
arg_4
.
type
!=
"aad"
:
raise
CLIError
(
"Not AAD cluster"
)
arg_5
=
arg_4
.
metadata
arg_6
=
arg_5
.
tenant
arg_7
=
arg_5
.
login
+
'/'
+
arg_6
arg_8
=
adal
.
AuthenticationContext
(
arg_7
,
api_version
=
)
arg_9
=
arg_5
.
cluster
arg_10
=
arg_5
.
client
set_aad_metadata
(
arg_7
,
arg_9
,
arg_10
)
arg_11
=
arg_8
.
acquire_user_code
(
arg_9
,
arg_10
)
print
(
arg_11
[
'message'
]
)
arg_12
=
arg_8
.
acquire_token_with_device_code
(
arg_9
,
arg_11
,
arg_10
)
print
(
"Succeed!"
)
return
arg_12
,
arg_8
.
cache

def Func(arg_0, arg_1):
    #pylint: disable-msg=too-many-locals
    """Get AAD token"""
    from azure.servicefabric.service_fabric_client_ap_is import (
        ServiceFabricClientAPIs
    )
    from sfctl.auth import ClientCertAuthentication
    from sfctl.config import set_aad_metadata

    arg_2 = ClientCertAuthentication(None, None, arg_1)

    arg_3 = ServiceFabricClientAPIs(arg_2, base_url=arg_0)
    arg_4 = arg_3.get_aad_metadata()

    if arg_4.type != "aad":
        raise CLIError("Not AAD cluster")

    arg_5 = arg_4.metadata

    arg_6 = arg_5.tenant
    arg_7 = arg_5.login + '/' + arg_6
    arg_8 = adal.AuthenticationContext(arg_7,
                                         api_version=None)
    arg_9 = arg_5.cluster
    arg_10 = arg_5.client

    set_aad_metadata(arg_7, arg_9, arg_10)

    arg_11 = arg_8.acquire_user_code(arg_9, arg_10)
    print(arg_11['message'])
    arg_12 = arg_8.acquire_token_with_device_code(
        arg_9, arg_11, arg_10)
    print("Succeed!")
    return arg_12, arg_8.cache


(self, callback=None, state=None, **kwargs)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
,
**
arg_3
)
:
arg_4
=
dict
(
arg_0
.
request_token_params
)
or
{
}
arg_4
.
update
(
**
arg_3
)
if
arg_0
.
request_token_url
:
arg_5
=
arg_0
.
generate_request_token
(
arg_1
)
[
0
]
arg_6
=
'%s?oauth_token=%s'
%
(
arg_0
.
expand_url
(
arg_0
.
Func_url
)
,
url_quote
(
arg_5
)
)
if
arg_4
:
arg_6
+=
'&'
+
url_encode
(
arg_4
)
else
:
assert
arg_1
is
not
,
'Callback is required for OAuth2'
arg_7
=
arg_0
.
make_client
(
)
if
'scope'
in
arg_4
:
arg_8
=
arg_4
.
pop
(
'scope'
)
else
:
arg_8
=
if
isinstance
(
arg_8
,
str
)
:
arg_8
=
_encode
(
arg_8
,
arg_0
.
encoding
)
if
'state'
in
arg_4
:
if
not
arg_2
:
arg_2
=
arg_4
.
pop
(
'state'
)
else
:
arg_4
.
pop
(
'state'
)
if
callable
(
arg_2
)
:
arg_2
=
arg_2
(
)
arg_9
[
'%s_oauthredir'
%
arg_0
.
name
]
=
arg_1
arg_6
=
arg_7
.
prepare_request_uri
(
arg_0
.
expand_url
(
arg_0
.
Func_url
)
,
redirect_uri
=
arg_1
,
arg_8
=
arg_8
,
arg_2
=
arg_2
,
**
arg_4
)
return
redirect
(
arg_6
)

def Func(arg_0, arg_1=None, arg_2=None, **arg_3):
        """
        Returns a redirect response to the remote authorization URL with
        the signed callback given.

        :param callback: a redirect url for the callback
        :param state: an optional value to embed in the OAuth request.
                      Use this if you want to pass around application
                      state (e.g. CSRF tokens).
        :param kwargs: add optional key/value pairs to the query string
        """
        arg_4 = dict(arg_0.request_token_params) or {}
        arg_4.update(**arg_3)

        if arg_0.request_token_url:
            arg_5 = arg_0.generate_request_token(arg_1)[0]
            arg_6 = '%s?oauth_token=%s' % (
                arg_0.expand_url(arg_0.Func_url), url_quote(arg_5)
            )
            if arg_4:
                arg_6 += '&' + url_encode(arg_4)
        else:
            assert arg_1 is not None, 'Callback is required for OAuth2'

            arg_7 = arg_0.make_client()

            if 'scope' in arg_4:
                arg_8 = arg_4.pop('scope')
            else:
                arg_8 = None

            if isinstance(arg_8, str):
                # oauthlib need unicode
                arg_8 = _encode(arg_8, arg_0.encoding)

            if 'state' in arg_4:
                if not arg_2:
                    arg_2 = arg_4.pop('state')
                else:
                    # remove state in params
                    arg_4.pop('state')

            if callable(arg_2):
                # state can be function for generate a random string
                arg_2 = arg_2()

            arg_9['%s_oauthredir' % arg_0.name] = arg_1
            arg_6 = arg_7.prepare_request_uri(
                arg_0.expand_url(arg_0.Func_url),
                redirect_uri=arg_1,
                arg_8=arg_8,
                arg_2=arg_2,
                **arg_4
            )
        return redirect(arg_6)

Returns a redirect response to the remote authorization URL with the signed callback given .


def Func ( arg_0 ) : def decorator ( arg_1 ) : @ wraps ( arg_1 ) def wrapper ( arg_2 , arg_3 , Func = True ) : if Func : arg_0 ( arg_2 , arg_3 ) return arg_1 ( arg_2 , arg_3 ) return wrapper return decorator

def Func(arg_0):
    """
    Return a decorator that validates arguments with provided `validator`
    function.

    This will also store the validator function as `func.validate`.
    The decorator returned by this function, can bypass the validator
    if `validate=False` is passed as argument otherwise the fucntion is
    called directly.

    The validator must raise an exception, if the function can not
    be called.
    """

    def decorator(arg_1):
        """Bound decorator to a particular validator function"""

        @wraps(arg_1)
        def wrapper(arg_2, arg_3, Func=True):
            if Func:
                arg_0(arg_2, arg_3)
            return arg_1(arg_2, arg_3)
        return wrapper

    return decorator

Return a decorator that validates arguments with provided validator function .


Delete auth token when `delete` request was issued.

def Func(arg_0, arg_1, *arg_2, **arg_3):
        """Delete auth token when `Func` request was issued."""
        # Logic repeated from DRF because one cannot easily reuse it
        arg_4 = get_authorization_header(arg_1).split()

        if not arg_4 or arg_4[0].lower() != b'token':
            return response.Response(status=status.HTTP_400_BAD_REQUEST)

        if len(arg_4) == 1:
            arg_5 = 'Invalid token header. No credentials provided.'
            return response.Response(arg_5, status=status.HTTP_400_BAD_REQUEST)
        elif len(arg_4) > 2:
            arg_5 = 'Invalid token header. Token string should not contain spaces.'
            return response.Response(arg_5, status=status.HTTP_400_BAD_REQUEST)

        try:
            arg_6 = arg_0.model.objects.get(key=arg_4[1])
        except arg_0.model.DoesNotExist:
            pass
        else:
            arg_6.Func()
            signals.user_logged_out.send(
                type(arg_0),
                user=arg_6.user,
                arg_1=arg_1,
            )
        return response.Response(status=status.HTTP_204_NO_CONTENT)

Delete auth token when delete request was issued .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
int
(
arg_1
)
arg_4
=
int
(
arg_2
)
if
arg_3
>
arg_4
:
raise
Exception
(
"starttime is greater than endtime."
)

def Func(arg_0, arg_1, arg_2):
    """
    Helper function to validate interval.
    An interval is valid if starttime and endtime are integrals,
    and starttime is less than the endtime.
    Raises exception if interval is not valid.
    """
    arg_3 = int(arg_1)
    arg_4 = int(arg_2)
    if arg_3 > arg_4:
      raise Exception("starttime is greater than endtime.")

Helper function to validate interval . An interval is valid if starttime and endtime are integrals and starttime is less than the endtime . Raises exception if interval is not valid .


def Func(arg_0, arg_1):
    """get Func of an element in the tree"""
    arg_2 = 0
    arg_3 = arg_1[arg_0]
    while arg_3 is not None:
        arg_2 += 1
        arg_3 = arg_1[arg_3]
    return arg_2


def Func ( arg_0 ) : arg_1 = [ bb . Func ( ) for bb in arg_0 . bounding_boxes ] return BoundingBoxesOnImage ( arg_1 , tuple ( arg_0 . shape ) )

def Func(arg_0):
        """
        Create a deep copy of the BoundingBoxesOnImage object.

        Returns
        -------
        imgaug.BoundingBoxesOnImage
            Deep copy.

        """
        # Manual copy is far faster than Func for BoundingBoxesOnImage,
        # so use manual copy here too
        arg_1 = [bb.Func() for bb in arg_0.bounding_boxes]
        return BoundingBoxesOnImage(arg_1, tuple(arg_0.shape))

Create a deep copy of the BoundingBoxesOnImage object .


async def Func ( arg_0 , arg_1 ) : arg_2 = hangouts_pb2 . SearchEntitiesResponse ( ) await arg_0 . _pb_request ( 'contacts/searchentities' , arg_1 , arg_2 ) return arg_2

async def Func(arg_0, arg_1):
        """Return user entities based on a query."""
        arg_2 = hangouts_pb2.SearchEntitiesResponse()
        await arg_0._pb_request('contacts/searchentities',
                               arg_1, arg_2)
        return arg_2


Helper to try to get a setting from the environment, or pyconfig, or
    finally use a provided default.

def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
os
.
Funciron
.
get
(
arg_0
,
)
if
arg_2
is
not
:
log
.
info
(
'    %s = %r'
,
arg_0
.
lower
(
)
.
replace
(
'_'
,
'.'
)
,
arg_2
)
return
arg_2
arg_0
=
arg_0
.
lower
(
)
.
replace
(
'_'
,
'.'
)
arg_2
=
get
(
arg_0
)
if
arg_2
is
not
:
return
arg_2
return
arg_1

def Func(arg_0, arg_1):
    """
    Helper to try to get a setting from the Funcironment, or pyconfig, or
    finally use a provided default.

    """
    arg_2 = os.Funciron.get(arg_0, None)
    if arg_2 is not None:
        log.info('    %s = %r', arg_0.lower().replace('_', '.'), arg_2)
        return arg_2

    arg_0 = arg_0.lower().replace('_', '.')
    arg_2 = get(arg_0)
    if arg_2 is not None:
        return arg_2

    return arg_1

Helper to try to get a setting from the environment or pyconfig or finally use a provided default .


(reader, writer, column, start, stop, value)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):
  """Adds a value over a range of rows.

  Args:
    reader: A FileRecordStream object with input data.
    writer: A FileRecordStream object to write output data to.
    column: The column of data to modify.
    start: The first row in the range to modify.
    end: The last row in the range to modify.
    value: The value to Func.
  """
  for arg_6, arg_7 in enumerate(arg_0):
    if arg_6 >= arg_3 and arg_6 <= arg_4:
      arg_7[arg_2] = type(arg_5)(arg_7[arg_2]) + arg_5
    arg_1.appendRecord(arg_7)

Adds a value over a range of rows.

  Args:
    reader: A FileRecordStream object with input data.
    writer: A FileRecordStream object to write output data to.
    column: The column of data to modify.
    start: The first row in the range to modify.
    end: The last row in the range to modify.
    value: The value to add.


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
arg_1
=
_make_np_bool
(
arg_1
)
if
arg_2
is
:
if
len
(
arg_0
.
_z
)
!=
len
(
arg_1
)
:
raise
QiskitError
(
"During updating whole z, you can not "
"change the number of qubits."
)
arg_0
.
_z
=
arg_1
else
:
if
not
isinstance
(
arg_2
,
list
)
and
not
isinstance
(
arg_2
,
np
.
ndarray
)
:
arg_2
=
[
arg_2
]
for
arg_4
,
arg_5
in
enumerate
(
arg_2
)
:
arg_0
.
_z
[
arg_5
]
=
arg_1
[
arg_4
]
return
arg_0

def Func(arg_0, arg_1, arg_2=None):
        """
        Update partial or entire z.

        Args:
            z (numpy.ndarray or list): to-be-updated z
            indices (numpy.ndarray or list or optional): to-be-updated qubit indices

        Returns:
            Pauli: self

        Raises:
            QiskitError: when updating whole z, the number of qubits must be the same.
        """
        arg_1 = _make_np_bool(arg_1)
        if arg_2 is None:
            if len(arg_0._z) != len(arg_1):
                raise QiskitError("During updating whole z, you can not "
                                  "change the number of qubits.")
            arg_0._z = arg_1
        else:
            if not isinstance(arg_2, list) and not isinstance(arg_2, np.ndarray):
                arg_2 = [arg_2]
            for arg_4, arg_5 in enumerate(arg_2):
                arg_0._z[arg_5] = arg_1[arg_4]

        return arg_0


def Func(arg_0, arg_1=True):
        """Returns a python iterable containing the exploration range.

        :param copy:

            If the range should be copied before handed over to avoid tempering with data

        Example usage:

        >>> param = Parameter('groupA.groupB.myparam',data=22, comment='I am a neat example')
        >>> param._explore([42,43,43])
        >>> param.Func()
        (42,43,44)

        :raises: TypeError: If parameter is not explored.

        """
        if not arg_0.f_has_range():
            raise TypeError('Your parameter `%s` is not array, so cannot return array.' %
                            arg_0.v_full_name)
        elif arg_1:
            return arg_0._explored_range[:]
        else:
            return arg_0._explored_range

Returns a python iterable containing the exploration range.

        :param copy:

            If the range should be copied before handed over to avoid tempering with data

        Example usage:

        >>> param = Parameter('groupA.groupB.myparam',data=22, comment='I am a neat example')
        >>> param._explore([42,43,43])
        >>> param.f_get_range()
        (42,43,44)

        :raises: TypeError: If parameter is not explored.

Returns a python iterable containing the exploration range .


def Func ( arg_0 , arg_1 = True ) : arg_2 = os . path . join ( arg_0 , 'pyproject.toml' ) if os . path . exists ( arg_2 ) : with open ( arg_2 , 'r' ) as config_file : arg_3 = pytoml . load ( config_file ) arg_3 = arg_3 . get ( 'tool' , { } ) . get ( 'tidypy' , { } ) arg_3 = merge_dict ( get_default_config ( ) , arg_3 ) arg_3 = process_extensions ( arg_3 , arg_0 , arg_1 = arg_1 ) return arg_3 return None

def Func(arg_0, arg_1=True):
    """
    Produces a TidyPy configuration using the ``pyproject.toml`` in the
    project's directory.

    :param project_path: the path to the project that is going to be analyzed
    :type project_path: str
    :param use_cache:
        whether or not to use cached versions of any remote/referenced TidyPy
        configurations. If not specified, defaults to ``True``.
    :type use_cache: bool
    :rtype: dict
    """

    arg_2 = os.path.join(arg_0, 'pyproject.toml')

    if os.path.exists(arg_2):
        with open(arg_2, 'r') as config_file:
            arg_3 = pytoml.load(config_file)

        arg_3 = arg_3.get('tool', {}).get('tidypy', {})
        arg_3 = merge_dict(get_default_config(), arg_3)
        arg_3 = process_extensions(arg_3, arg_0, arg_1=arg_1)
        return arg_3

    return None

Produces a TidyPy configuration using the pyproject . toml in the project s directory .


(self, query, query_context, result_configuration, client_request_token=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = None ) : arg_5 = arg_0 . conn . start_query_execution ( QueryString = arg_1 , ClientRequestToken = arg_4 , QueryExecutionContext = arg_2 , ResultConfiguration = arg_3 ) arg_6 = arg_5 [ 'QueryExecutionId' ] return arg_6

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):
        """
        Run Presto query on athena with provided config and return submitted query_execution_id

        :param query: Presto query to run
        :type query: str
        :param query_context: Context in which query need to be run
        :type query_context: dict
        :param result_configuration: Dict with path to store results in and config related to encryption
        :type result_configuration: dict
        :param client_request_token: Unique token created by user to avoid multiple executions of same query
        :type client_request_token: str
        :return: str
        """
        arg_5 = arg_0.conn.start_query_execution(QueryString=arg_1,
                                                   ClientRequestToken=arg_4,
                                                   QueryExecutionContext=arg_2,
                                                   ResultConfiguration=arg_3)
        arg_6 = arg_5['QueryExecutionId']
        return arg_6


def Func(arg_0, arg_1=True):
    """Returns a string that is valid JSON or YAML and contains all the
    variables in every extra_vars_opt inside of extra_vars_list.

    Args:
       parse_kv (bool): whether to allow key=value syntax.
       force_json (bool): if True, always output json.
    """
    # Read from all the different sources and put into dictionary
    arg_2 = {}
    arg_3 = ""
    for arg_4 in arg_0:
        # Load file content if necessary
        if arg_4.startswith("@"):
            with open(arg_4[1:], 'r') as f:
                arg_4 = f.read()
            # Convert text markup to a dictionary conservatively
            arg_5 = string_to_dict(arg_4, allow_kv=False)
        else:
            # Convert text markup to a dictionary liberally
            arg_5 = string_to_dict(arg_4, allow_kv=True)
        # Rolling YAML-based string combination
        if any(arg_6.startswith("#") for arg_6 in arg_4.split('\n')):
            arg_3 += arg_4 + "\n"
        elif arg_4 != "":
            arg_3 += yaml.dump(
                arg_5, default_flow_style=False) + "\n"
        # Combine dictionary with cumulative dictionary
        arg_2.update(arg_5)

    # Return contents in form of a string
    if not arg_1:
        try:
            # Conditions to verify it is safe to return rolling YAML string
            arg_7 = yaml.load(arg_3, Loader=yaml.SafeLoader)
            assert type(arg_7) is dict
            debug.log('Using unprocessed YAML', header='decision', nl=2)
            return arg_3.rstrip()
        except Exception:
            debug.log('Failed YAML parsing, defaulting to JSON',
                      header='decison', nl=2)
    if arg_2 == {}:
        return ""
    return json.dumps(arg_2, ensure_ascii=False)

Returns a string that is valid JSON or YAML and contains all the variables in every extra_vars_opt inside of extra_vars_list .


def Func(arg_0, arg_1=False):
        """
        Pretty print the variable importances, or return them in a list.

        :param use_pandas: If True, then the variable importances will be returned as a pandas data frame.

        :returns: A list or Pandas DataFrame.
        """
        arg_2 = arg_0._model_json["output"]
        if arg_0.algo=='glm' or "variable_importances" in list(arg_2.keys()) and arg_2["variable_importances"]:
            if arg_0.algo=='glm':
                arg_3 = arg_2["standardized_coefficient_magnitudes"].cell_values
                arg_4 = 0
                arg_5=0
                for arg_6 in arg_3:
                    arg_5=arg_5+arg_6[1]
                    if arg_6[1]>arg_4:
                        arg_4 = arg_6[1]
                arg_7 = []
                for arg_6 in arg_3:
                    arg_8 = (arg_6[0], arg_6[1], arg_6[1]/arg_4, arg_6[1]/arg_5)
                    arg_7.append(arg_8)
                arg_9 = ["variable", "relative_importance", "scaled_importance", "percentage"]
            else:
                arg_7 = arg_2["variable_importances"].cell_values
                arg_9 = arg_2["variable_importances"].col_header

            if arg_1 and can_use_pandas():
                import pandas
                return pandas.DataFrame(arg_7, columns=arg_9)
            else:
                return arg_7
        else:
            print("Warning: This model doesn't have variable importances")

Pretty print the variable importances or return them in a list .


def Func ( arg_0 , arg_1 ) : arg_2 = Group . objects . get ( name = 'Admin' ) if arg_1 == 'admin' : arg_0 . groups . add ( arg_2 ) else : arg_0 . groups . remove ( arg_2 )

def Func(arg_0, arg_1):
        """Modify the user's permissions."""

        arg_2 = Group.objects.get(name='Admin')

        if arg_1 == 'admin':
            arg_0.groups.add(arg_2)
        else:
            arg_0.groups.remove(arg_2)


def Func ( arg_0 ) : arg_0 . add_notfound_view ( default_exceptionresponse_view , append_slash = True ) arg_1 = arg_0 . add_route arg_1 ( 'admin-index' , '/a/' ) arg_1 ( 'admin-moderation' , '/a/moderation/' ) arg_1 ( 'admin-api-keys' , '/a/api-keys/' ) arg_1 ( 'admin-add-site-messages' , '/a/site-messages/' , request_method = 'GET' ) arg_1 ( 'admin-add-site-messages-POST' , '/a/site-messages/' , request_method = 'POST' ) arg_1 ( 'admin-delete-site-messages' , '/a/site-messages/' , request_method = 'DELETE' ) arg_1 ( 'admin-edit-site-message' , '/a/site-messages/{id}/' , request_method = 'GET' ) arg_1 ( 'admin-edit-site-message-POST' , '/a/site-messages/{id}/' , request_method = 'POST' ) arg_1 ( 'admin-content-status' , '/a/content-status/' ) arg_1 ( 'admin-content-status-single' , '/a/content-status/{uuid}' ) arg_1 ( 'admin-print-style' , '/a/print-style/' ) arg_1 ( 'admin-print-style-single' , '/a/print-style/{style}' )

def Func(arg_0):
    """Declaration of routes that can be browsed by users."""
    # This makes our routes slashed, which is good browser behavior.
    arg_0.add_notfound_view(default_exceptionresponse_view,
                             append_slash=True)

    arg_1 = arg_0.add_route
    arg_1('admin-index', '/a/')
    arg_1('admin-moderation', '/a/moderation/')
    arg_1('admin-api-keys', '/a/api-keys/')
    arg_1('admin-add-site-messages', '/a/site-messages/',
              request_method='GET')
    arg_1('admin-add-site-messages-POST', '/a/site-messages/',
              request_method='POST')
    arg_1('admin-delete-site-messages', '/a/site-messages/',
              request_method='DELETE')
    arg_1('admin-edit-site-message', '/a/site-messages/{id}/',
              request_method='GET')
    arg_1('admin-edit-site-message-POST', '/a/site-messages/{id}/',
              request_method='POST')

    arg_1('admin-content-status', '/a/content-status/')
    arg_1('admin-content-status-single', '/a/content-status/{uuid}')

    arg_1('admin-print-style', '/a/print-style/')
    arg_1('admin-print-style-single', '/a/print-style/{style}')

Declaration of routes that can be browsed by users .


def
Func
(
arg_0
:
arg_1
,
*
arg_2
,
**
arg_3
)
->
HedgehogCommandError
:
if
arg_0
==
FAILED_COMMAND
and
len
(
arg_2
)
>=
1
and
arg_2
[
0
]
==
"Emergency Shutdown activated"
:
return
EmergencyShutdown
(
*
arg_2
,
**
arg_3
)
return
_Funcs
[
arg_0
]
(
*
arg_2
,
**
arg_3
)

def Func(arg_0: arg_1, *arg_2, **arg_3) -> HedgehogCommandError:
    """
    Creates an Func from the given code, and args and kwargs.

    :param code: The acknowledgement code
    :param args: Exception args
    :param kwargs: Exception kwargs
    :return: the Func for the given acknowledgement code
    """
    # TODO add proper Func code
    if arg_0 == FAILED_COMMAND and len(arg_2) >= 1 and arg_2[0] == "Emergency Shutdown activated":
        return EmergencyShutdown(*arg_2, **arg_3)
    return _Funcs[arg_0](*arg_2, **arg_3)

Creates an error from the given code, and args and kwargs.

    :param code: The acknowledgement code
    :param args: Exception args
    :param kwargs: Exception kwargs
    :return: the error for the given acknowledgement code

Creates an error from the given code and args and kwargs .


(param, param_event_ndims, slices, dist_batch_shape)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_4
=
tf
.
shape
(
input
=
arg_0
)
arg_5
=
tf
.
ones
(
[
tf
.
size
(
input
=
arg_3
)
+
arg_1
tf
.
rank
(
arg_0
)
]
,
dtype
=
arg_4
.
dtype
)
arg_6
=
tf
.
concat
(
[
arg_5
,
arg_4
]
,
axis
=
0
)
arg_7
=
tf
.
reshape
(
arg_0
,
arg_6
)
arg_8
=
[
]
arg_9
=
0
arg_10
=
0
for
arg_11
in
arg_2
:
if
arg_11
is
tf
.
newaxis
:
arg_8
.
append
(
arg_11
)
continue
if
arg_11
is
Ellipsis
:
if
arg_10
<
0
:
raise
ValueError
(
'Found multiple `...` in slices {}'
.
format
(
arg_2
)
)
arg_8
.
append
(
arg_11
)
arg_12
=
sum
(
[
s
is
not
tf
.
newaxis
for
s
in
arg_2
[
arg_2
.
index
(
Ellipsis
)
+
1
:
]
]
)
arg_10
=
arg_12
arg_9
=
arg_10
arg_1
continue
arg_13
=
arg_6
[
arg_9
]
arg_14
=
arg_3
[
arg_10
]
arg_15
=
arg_14
>
arg_13
if
isinstance
(
arg_11
,
slice
)
:
arg_16
,
arg_17
,
arg_18
=
arg_11
.
start
,
arg_11
.
stop
,
arg_11
.
step
if
arg_16
is
not
:
arg_16
=
tf
.
where
(
arg_15
,
0
,
arg_16
)
if
arg_17
is
not
:
arg_17
=
tf
.
where
(
arg_15
,
1
,
arg_17
)
if
arg_18
is
not
:
arg_18
=
tf
.
where
(
arg_15
,
1
,
arg_18
)
arg_8
.
append
(
slice
(
arg_16
,
arg_17
,
arg_18
)
)
else
:
arg_8
.
append
(
tf
.
where
(
arg_15
,
0
,
arg_11
)
)
arg_9
+=
1
arg_10
+=
1
arg_8
.
extend
(
[
ALL_SLICE
]
*
arg_1
)
return
arg_7
.
__getitem__
(
arg_8
)

def Func(arg_0, arg_1, arg_2, arg_3):
  """Slices a single parameter of a distribution.

  Args:
    param: A `Tensor`, the original parameter to slice.
    param_event_ndims: `int` event parameterization rank for this parameter.
    slices: A `tuple` of normalized slices.
    dist_batch_shape: The distribution's batch shape `Tensor`.

  Returns:
    new_param: A `Tensor`, batch-sliced according to slices.
  """
  # Extend param shape with ones on the left to match dist_batch_shape.
  arg_4 = tf.shape(input=arg_0)
  arg_5 = tf.ones(
      [tf.size(input=arg_3) + arg_1 - tf.rank(arg_0)],
      dtype=arg_4.dtype)
  arg_6 = tf.concat([arg_5, arg_4], axis=0)
  arg_7 = tf.reshape(arg_0, arg_6)
  arg_8 = []
  # We separately track the batch axis from the parameter axis because we want
  # them to align for positive indexing, and be offset by param_event_ndims for
  # negative indexing.
  arg_9 = 0
  arg_10 = 0
  for arg_11 in arg_2:
    if arg_11 is tf.newaxis:
      arg_8.append(arg_11)
      continue
    if arg_11 is Ellipsis:
      if arg_10 < 0:
        raise ValueError('Found multiple `...` in slices {}'.format(arg_2))
      arg_8.append(arg_11)
      # Switch over to negative indexing for the broadcast check.
      arg_12 = sum(
          [s is not tf.newaxis for s in arg_2[arg_2.index(Ellipsis) + 1:]])
      arg_10 = -arg_12
      arg_9 = arg_10 - arg_1
      continue
    # Find the batch dimension sizes for both parameter and distribution.
    arg_13 = arg_6[arg_9]
    arg_14 = arg_3[arg_10]
    arg_15 = arg_14 > arg_13
    # Slices are denoted by start:stop:step.
    if isinstance(arg_11, slice):
      arg_16, arg_17, arg_18 = arg_11.start, arg_11.stop, arg_11.step
      if arg_16 is not None:
        arg_16 = tf.where(arg_15, 0, arg_16)
      if arg_17 is not None:
        arg_17 = tf.where(arg_15, 1, arg_17)
      if arg_18 is not None:
        arg_18 = tf.where(arg_15, 1, arg_18)
      arg_8.append(slice(arg_16, arg_17, arg_18))
    else:  # int, or int Tensor, e.g. d[d.batch_shape_tensor()[0] // 2]
      arg_8.append(tf.where(arg_15, 0, arg_11))
    arg_9 += 1
    arg_10 += 1
  arg_8.extend([ALL_SLICE] * arg_1)
  return arg_7.__getitem__(arg_8)

Slices a single parameter of a distribution .


def Func(arg_0):
        """Decorator that prevents callbacks from calling into methods that are
        not reentrant
        """
        def wrap(arg_1, *arg_2, **arg_3):
            if arg_1._callback_lock and arg_1._callback_lock.in_callback:
                arg_4 = "Connection %s cannot be invoked from a callback!" % arg_0
                raise RuntimeError(arg_4)
            return arg_0(arg_1, *arg_2, **arg_3)
        return wrap


def
Func
(
arg_0
)
:
arg_0
.
document
.
_get_orientation_changes
(
)
arg_0
.
document
.
_output_pages
(
)
arg_0
.
session
.
_add_object
(
1
)
arg_0
.
session
.
_out
(
'<</Type /Pages'
)
arg_1
=
'/Kids ['
for
arg_2
in
xrange
(
0
,
len
(
arg_0
.
document
.
pages
)
)
:
arg_1
+=
str
(
3
+
2
*
arg_2
)
+
' 0 R '
arg_0
.
session
.
_out
(
arg_1
+
']'
)
arg_0
.
session
.
_out
(
'/Count %s'
%
len
(
arg_0
.
document
.
pages
)
)
arg_0
.
session
.
_out
(
'/MediaBox [0 0 %.2f %.2f]'
%
(
arg_0
.
document
.
page
.
width
,
arg_0
.
document
.
page
.
height
)
)
arg_0
.
session
.
_out
(
'>>'
)
arg_0
.
session
.
_out
(
'endobj'
)

def Func(arg_0):
        """ First, the Document object does the heavy-lifting for the
            individual page objects and content.

            Then, the overall "Pages" object is generated.

        """
        arg_0.document._get_orientation_changes()
        arg_0.document._output_pages()

        # Pages Object, provides reference to page objects (Kids list).
        arg_0.session._add_object(1)
        arg_0.session._out('<</Type /Pages')
        arg_1 = '/Kids ['
        for arg_2 in xrange(0, len(arg_0.document.pages)):
            arg_1 += str(3 + 2 * arg_2) + ' 0 R '
        arg_0.session._out(arg_1 + ']')
        arg_0.session._out('/Count %s' % len(arg_0.document.pages))

        # Overall size of the default PDF page
        arg_0.session._out('/MediaBox [0 0 %.2f %.2f]' %
                          (arg_0.document.page.width,
                           arg_0.document.page.height))
        arg_0.session._out('>>')
        arg_0.session._out('endobj')

First the Document object does the heavy - lifting for the individual page objects and content . Then the overall Pages object is generated .


def Func(arg_0):
        """True if the credential is expired or invalid.

        If the token_expiry isn't set, we assume the token doesn't expire.
        """
        if arg_0.invalid:
            return True

        if not arg_0.token_expiry:
            return False

        arg_1 = _UTCNOW()
        if arg_1 >= arg_0.token_expiry:
            logger.info('access_token is expired. Now: %s, token_expiry: %s',
                        arg_1, arg_0.token_expiry)
            return True
        return False

True if the credential is expired or invalid .


def Func(arg_0, arg_1, arg_2, arg_3=None):
    '''
    Replaces all occurrences of "old" by "new" in the given file.

    :param unicode filename:
        The name of the file.

    :param unicode old:
        The string to search for.

    :param unicode new:
        Replacement string.

    :return unicode:
        The new contents of the file.
    '''
    arg_4 = GetFileContents(arg_0, arg_3=arg_3)
    arg_4 = arg_4.replace(arg_1, arg_2)
    CreateFile(arg_0, arg_4, arg_3=arg_3)
    return arg_4

Replaces all occurrences of old by new in the given file .


def Func ( arg_0 ) : with open ( CONFIG_PATH , 'w' ) as f : json . dump ( arg_0 , f , indent = 2 , sort_keys = True )

def Func(arg_0):
    """Helper to write the JSON configuration to a file"""
    with open(CONFIG_PATH, 'w') as f:
        json.dump(arg_0, f, indent=2, sort_keys=True)


def Func(arg_0):
        """Sum of all width of interfaces in this interface"""
        try:
            arg_1 = arg_0._interfaces
        except AttributeError:
            arg_1 = None

        if arg_1 is None:
            # not loaded interface
            arg_2 = arg_0._clone()
            arg_2._loadDeclarations()
            arg_1 = arg_2._interfaces

        if arg_1:
            arg_3 = 0
            for arg_4 in arg_1:
                arg_3 += arg_4.Func()
            return arg_3
        else:
            return arg_0._dtype.bit_length()


def Func(arg_0, arg_1):
        """ Set a smoothing Gaussian kernel given its FWHM in mm.  """
        if arg_1 != arg_0._Func:
            arg_0._is_data_smooth = False
        arg_0._Func = arg_1

Set a smoothing Gaussian kernel given its FWHM in mm .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_4
=
get_api_url
(
arg_0
,
arg_1
,
github_status_url
)
.
format
(
arg_2
=
arg_2
,
arg_3
=
arg_3
)
logging
.
debug
(
"Getting status for %s %s"
,
arg_2
,
arg_3
)
arg_5
=
get_session_for_repo
(
arg_0
,
arg_1
)
arg_6
=
arg_5
.
get
(
arg_4
)
if
not
arg_6
.
ok
:
raise
Exception
(
"Unable to get status: {}"
.
format
(
arg_6
.
status_code
)
)
return
arg_6

def Func(arg_0, arg_1, arg_2, arg_3):
    """Gets the status of a commit.

    .. note::
        ``repo_name`` might not ever be anything other than
        ``repo_config['github_repo']``.

    :param app: Flask app for leeroy
    :param repo_config: configuration for the repo
    :param repo_name: The name of the owner/repo
    :param sha: SHA for the status we are looking for
    :return: returns json response of status
    """
    arg_4 = get_api_url(arg_0, arg_1, github_status_url).format(
        arg_2=arg_2, arg_3=arg_3)
    logging.debug("Getting status for %s %s", arg_2, arg_3)
    arg_5 = get_session_for_repo(arg_0, arg_1)
    arg_6 = arg_5.get(arg_4)
    if not arg_6.ok:
        raise Exception("Unable to get status: {}".format(arg_6.status_code))
    return arg_6


def Func(arg_0, arg_1):
        """
        Check peptide sequences to make sure they are valid for this predictor.
        """
        require_iterable_of(arg_1, string_types)
        arg_2 = not arg_0.allow_X_in_peptides
        arg_3 = not arg_0.allow_lowercase_in_peptides
        arg_4 = arg_0.min_peptide_length is not None
        arg_5 = arg_0.min_peptide_length
        arg_6 = arg_0.max_peptide_length is not None
        arg_7 = arg_0.max_peptide_length
        for arg_8 in arg_1:
            if not arg_8.isalpha():
                raise ValueError("Invalid characters in peptide '%s'" % arg_8)
            elif arg_2 and "X" in arg_8:
                raise ValueError("Invalid character 'X' in peptide '%s'" % arg_8)
            elif arg_3 and not arg_8.isupper():
                raise ValueError("Invalid lowercase letters in peptide '%s'" % arg_8)
            elif arg_4 and len(arg_8) < arg_5:
                raise ValueError(
                    "Peptide '%s' too short (%d chars), must be at least %d" % (
                        arg_8, len(arg_8), arg_5))
            elif arg_6 and len(arg_8) > arg_7:
                raise ValueError(
                    "Peptide '%s' too long (%d chars), must be at least %d" % (
                        arg_8, len(arg_8), arg_7))

Check peptide sequences to make sure they are valid for this predictor .


def Func ( arg_0 , arg_1 ) : if arg_1 is None : yield return arg_2 = arg_0 . training if arg_2 != arg_1 : arg_0 . train ( arg_1 ) try : yield finally : if arg_2 != arg_1 : arg_0 . train ( arg_2 )

def Func(arg_0, arg_1):
    """
    A context manager to temporarily set the training mode of 'model'
    to 'mode', resetting it when we exit the with-block.  A no-op if
    mode is None.
    """
    if arg_1 is None:
        yield
        return
    arg_2 = arg_0.training
    if arg_2 != arg_1:
        arg_0.train(arg_1)
    try:
        yield
    finally:
        if arg_2 != arg_1:
            arg_0.train(arg_2)

A context manager to temporarily set the training mode of model to mode resetting it when we exit the with - block . A no - op if mode is None .


return [rev[l] if l in rev else l for l in lst]

def Func(arg_0):
    """ Reverse guard expression. not
        (@a > 5) ->  (@a =< 5)
    Args:
        lst (list): Expression
    returns:
        list
    """
    arg_1 = {'<': '>=', '>': '=<', '>=': '<', '=<': '>'}
    return [arg_1[arg_2] if arg_2 in arg_1 else arg_2 for arg_2 in arg_0]


def Func ( arg_0 , arg_1 , arg_2 ) : arg_1 . value = arg_0 . value ( arg_2 ) return True

def Func(arg_0, arg_1, arg_2):
    """
        Set a node to a value captured from another node

        example::

            R = [
                In : node #setcapture(_, node)
            ]
    """
    arg_1.value = arg_0.value(arg_2)
    return True


def Func(arg_0, arg_1):
        """Callback from a parent future to update the AppFuture.

        Used internally by AppFuture, and should not be called by code using AppFuture.

        Args:
            - executor_fu (Future): Future returned by the executor along with callback.
              This may not be the current parent future, as the parent future may have
              already been updated to point to a retrying execution, and in that case,
              this is logged.

              In the case that a new parent has been attached, we must immediately discard
              this result no matter what it contains (although it might be interesting
              to log if it was successful...)

        Returns:
            - None

        Updates the super() with the result() or exception()
        """
        with arg_0._update_lock:

            if not arg_1.done():
                raise ValueError("done callback called, despite future not reporting itself as done")

            # this is for consistency checking
            if arg_1 != arg_0.parent:
                if arg_1.exception() is None and not isinstance(arg_1.result(), RemoteExceptionWrapper):
                    # ... then we completed with a value, not an exception or wrapped exception,
                    # but we've got an updated executor future.
                    # This is bad - for example, we've started a retry even though we have a result

                    raise ValueError("internal consistency error: AppFuture done callback called without an exception, but parent has been changed since then")

            try:
                arg_2 = arg_1.result()
                if isinstance(arg_2, RemoteExceptionWrapper):
                    arg_2.reraise()
                super().set_result(arg_1.result())

            except Exception as e:
                if arg_1.retries_left > 0:
                    # ignore this exception, because assume some later
                    # parent executor, started external to this class,
                    # will provide the answer
                    pass
                else:
                    super().set_exception(e)

Callback from a parent future to update the AppFuture .


def Func ( arg_0 , arg_1 ) : arg_2 = set ( [ ] ) for arg_3 in _list ( arg_1 ) : if not arg_0 . has_section ( arg_3 ) : continue arg_4 = arg_0 . options ( arg_3 ) arg_5 = [ arg_0 . get ( arg_3 , arg_6 , raw = True ) for arg_6 in arg_4 ] for arg_6 in arg_4 : arg_7 = "%(" + arg_6 + ")s" for arg_8 in arg_5 : if arg_7 in arg_8 : break else : arg_2 . add ( arg_6 ) return list ( arg_2 )

def Func(arg_0, arg_1):
        """Lists options that have not been used to format other values in
        their sections.

        Good for finding out if the user has misspelled any of the options.
        """
        arg_2 = set([])
        for arg_3 in _list(arg_1):
            if not arg_0.has_section(arg_3):
                continue
            arg_4 = arg_0.options(arg_3)
            arg_5 = [arg_0.get(arg_3, arg_6, raw=True) for arg_6 in arg_4]
            for arg_6 in arg_4:
                arg_7 = "%(" + arg_6 + ")s"
                for arg_8 in arg_5:
                    if arg_7 in arg_8:
                        break
                else:
                    arg_2.add(arg_6)
            return list(arg_2)

Lists options that have not been used to format other values in their sections . Good for finding out if the user has misspelled any of the options .


def Func(arg_0, arg_1=3):
        """ Isolate change clusters by eliminating ranges with no changes.

        Return a generator of groups with up to n lines of context.
        Each group is in the same format as returned by get_opcodes().

        >>> from pprint import pprint
        >>> a = map(str, range(1,40))
        >>> b = a[:]
        >>> b[8:8] = ['i']     # Make an insertion
        >>> b[20] += 'x'       # Make a replacement
        >>> b[23:28] = []      # Make a deletion
        >>> b[30] += 'y'       # Make another replacement
        >>> pprint(list(SequenceMatcher(None,a,b).Func()))
        [[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)],
         [('equal', 16, 19, 17, 20),
          ('replace', 19, 20, 20, 21),
          ('equal', 20, 22, 21, 23),
          ('delete', 22, 27, 23, 23),
          ('equal', 27, 30, 23, 26)],
         [('equal', 31, 34, 27, 30),
          ('replace', 34, 35, 30, 31),
          ('equal', 35, 38, 31, 34)]]
        """

        arg_2 = arg_0.get_opcodes()
        if not arg_2:
            arg_2 = [("equal", 0, 1, 0, 1)]
        # Fixup leading and trailing groups if they show no changes.
        if arg_2[0][0] == 'equal':
            arg_3, arg_4, arg_5, arg_6, arg_7 = arg_2[0]
            arg_2[0] = arg_3, max(arg_4, arg_5-arg_1), arg_5, max(arg_6, arg_7-arg_1), arg_7
        if arg_2[-1][0] == 'equal':
            arg_3, arg_4, arg_5, arg_6, arg_7 = arg_2[-1]
            arg_2[-1] = arg_3, arg_4, min(arg_5, arg_4+arg_1), arg_6, min(arg_7, arg_6+arg_1)

        arg_8 = arg_1 + arg_1
        arg_9 = []
        for arg_3, arg_4, arg_5, arg_6, arg_7 in arg_2:
            # End the current group and start a new one whenever
            # there is a large range with no changes.
            if arg_3 == 'equal' and arg_5-arg_4 > arg_8:
                arg_9.append((arg_3, arg_4, min(arg_5, arg_4+arg_1), arg_6, min(arg_7, arg_6+arg_1)))
                yield arg_9
                arg_9 = []
                arg_4, arg_6 = max(arg_4, arg_5-arg_1), max(arg_6, arg_7-arg_1)
            arg_9.append((arg_3, arg_4, arg_5, arg_6 ,arg_7))
        if arg_9 and not (len(arg_9)==1 and arg_9[0][0] == 'equal'):
            yield arg_9

Isolate change clusters by eliminating ranges with no changes.

        Return a generator of groups with up to n lines of context.
        Each group is in the same format as returned by get_opcodes().

        >>> from pprint import pprint
        >>> a = map(str, range(1,40))
        >>> b = a[:]
        >>> b[8:8] = ['i']     # Make an insertion
        >>> b[20] += 'x'       # Make a replacement
        >>> b[23:28] = []      # Make a deletion
        >>> b[30] += 'y'       # Make another replacement
        >>> pprint(list(SequenceMatcher(None,a,b).get_grouped_opcodes()))
        [[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)],
         [('equal', 16, 19, 17, 20),
          ('replace', 19, 20, 20, 21),
          ('equal', 20, 22, 21, 23),
          ('delete', 22, 27, 23, 23),
          ('equal', 27, 30, 23, 26)],
         [('equal', 31, 34, 27, 30),
          ('replace', 34, 35, 30, 31),
          ('equal', 35, 38, 31, 34)]]

Isolate change clusters by eliminating ranges with no changes .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = defer . Deferred ( ) arg_5 = ProcessProtocol ( arg_4 ) arg_6 = arg_3 . spawnProcess ( arg_5 , arg_0 [ 0 ] , arg_0 , env = os . environ ) def _logEnded ( arg_7 ) : arg_7 . trap ( tierror . ProcessDone , tierror . ProcessTerminated ) print ( arg_7 . value ) arg_4 . addErrback ( _logEnded ) def _cancelTermination ( arg_8 ) : for arg_9 in arg_10 : if arg_9 . active ( ) : arg_9 . cancel ( ) arg_4 . addCallback ( _cancelTermination ) arg_10 = [ ] arg_10 . append ( arg_3 . callLater ( arg_1 , arg_6 . signalProcess , "TERM" ) ) arg_10 . append ( arg_3 . callLater ( arg_1 + arg_2 , arg_6 . signalProcess , "KILL" ) ) return arg_4

def Func(arg_0, arg_1, arg_2, arg_3):
    """Run a process, return a deferred that fires when it is done

    :params args: Process arguments
    :params timeout: Time before terminating process
    :params grace: Time before killing process after terminating it
    :params reactor: IReactorProcess and IReactorTime
    :returns: deferred that fires with success when the process ends,
              or fails if there was a problem spawning/terminating
              the process
    """
    arg_4 = defer.Deferred()
    arg_5 = ProcessProtocol(arg_4)
    arg_6 = arg_3.spawnProcess(arg_5, arg_0[0], arg_0, env=os.environ)

    def _logEnded(arg_7):
        arg_7.trap(tierror.ProcessDone, tierror.ProcessTerminated)
        print(arg_7.value)
    arg_4.addErrback(_logEnded)

    def _cancelTermination(arg_8):
        for arg_9 in arg_10:
            if arg_9.active():
                arg_9.cancel()
    arg_4.addCallback(_cancelTermination)
    arg_10 = []
    arg_10.append(arg_3.callLater(arg_1, arg_6.signalProcess,
                                          "TERM"))
    arg_10.append(arg_3.callLater(arg_1+arg_2,
                                          arg_6.signalProcess, "KILL"))
    return arg_4

Run a process return a deferred that fires when it is done


return {
            "template": "main::collection.html",
            "collections": {
                "current": {
                    "label": str(collection.get_label(lang)),
                    "id": collection.id,
                    "model": str(collection.model),
                    "type": str(collection.type),
                },
                "members": self.make_members(collection, lang=lang),
                "parents": self.make_parents(collection, lang=lang)
            },
        }

def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = arg_0 . resolver . getMetadata ( arg_1 ) return { "template" : "main::collection.html" , "collections" : { "current" : { "label" : str ( arg_3 . get_label ( arg_2 ) ) , "id" : arg_3 . id , "model" : str ( arg_3 . model ) , "type" : str ( arg_3 . type ) , } , "members" : arg_0 . make_members ( arg_3 , arg_2 = arg_2 ) , "parents" : arg_0 . make_parents ( arg_3 , arg_2 = arg_2 ) } , }

def Func(arg_0, arg_1, arg_2=None):
        """ Collection content browsing route function

        :param objectId: Collection identifier
        :type objectId: str
        :param lang: Lang in which to express main data
        :type lang: str
        :return: Template and collections contained in given collection
        :rtype: {str: Any}
        """
        arg_3 = arg_0.resolver.getMetadata(arg_1)
        return {
            "template": "main::collection.html",
            "collections": {
                "current": {
                    "label": str(arg_3.get_label(arg_2)),
                    "id": arg_3.id,
                    "model": str(arg_3.model),
                    "type": str(arg_3.type),
                },
                "members": arg_0.make_members(arg_3, arg_2=arg_2),
                "parents": arg_0.make_parents(arg_3, arg_2=arg_2)
            },
        }


def Func ( ) : arg_0 = '' arg_1 = psutil . net_if_addrs ( ) for arg_2 , arg_3 in arg_1 . items ( ) : for arg_4 in arg_3 : if arg_4 . family == socket . AF_INET : arg_5 = ipaddress . ip_address ( arg_4 . address ) if not ( arg_5 . is_link_local or arg_5 . is_loopback ) : arg_0 = arg_2 break return arg_0

def Func():
    """
        Returns the interface name of the first not link_local and not loopback interface.
    """
    arg_0 = ''
    arg_1 = psutil.net_if_addrs()
    for arg_2, arg_3 in arg_1.items():
        for arg_4 in arg_3:
            if arg_4.family == socket.AF_INET:
                arg_5 = ipaddress.ip_address(arg_4.address)
                if not (arg_5.is_link_local or arg_5.is_loopback):
                    arg_0 = arg_2
                    break
    return arg_0

Returns the interface name of the first not link_local and not loopback interface .