def Func(arg_0):
    """Adds all necessary parameters to the `traj` container.

    You can choose between two parameter sets. One for the Lorenz attractor and
    one for the Roessler attractor.
    The former is chosen for `traj.diff_name=='diff_lorenz'`, the latter for
    `traj.diff_name=='diff_roessler'`.
    You can use parameter presetting to switch between the two cases.

    :raises: A ValueError if `traj.diff_name` is none of the above

    """
    arg_0.f_add_parameter('steps', 10000, comment='Number of time steps to simulate')
    arg_0.f_add_parameter('dt', 0.01, comment='Step size')

    # Here we want to add the initial conditions as an array parameter, since we will simulate
    # a 3-D differential equation, that is the Roessler attractor
    # (https://en.wikipedia.org/wiki/R%C3%B6ssler_attractor)
    arg_0.f_add_parameter(ArrayParameter,'initial_conditions', np.array([0.0,0.0,0.0]),
                         comment = 'Our initial conditions, as default we will start from'
                                   ' origin!')

    # Per default we choose the name `'diff_lorenz'` as in the last example
    arg_0.f_add_parameter('diff_name','diff_lorenz', comment= 'Name of our differential equation')

    # We want some control flow depending on which name we really choose
    if arg_0.diff_name == 'diff_lorenz':
        # These parameters are for the Lorenz differential equation
        arg_0.f_add_parameter('func_params.sigma', 10.0)
        arg_0.f_add_parameter('func_params.beta', 8.0/3.0)
        arg_0.f_add_parameter('func_params.rho', 28.0)
    elif arg_0.diff_name == 'diff_roessler':
        # If we use the Roessler system we need different parameters
        arg_0.f_add_parameter('func_params.a', 0.1)
        arg_0.f_add_parameter('func_params.c', 14.0)
    else:
        raise ValueError('I don\'t know what %s is.' % arg_0.diff_name)

Adds all necessary parameters to the traj container .


def Func ( arg_0 ) : def func_wrapper ( arg_1 , arg_2 , arg_3 ) : if arg_3 : arg_4 = "\\x%02x" else : arg_4 = "\\u%04x" arg_5 = re . compile ( r"(\\\\x[a-fA-F0-9]{2})" ) arg_6 = re . compile ( r"(\\u[a-fA-F0-9]{4})" ) def encode_decode_all ( arg_7 , arg_8 = True ) : if type ( arg_7 ) == dict : for arg_9 in arg_7 : if type ( arg_7 [ arg_9 ] ) in [ dict , list ] : if arg_8 : arg_7 [ arg_9 ] = encode_decode_all ( arg_7 [ arg_9 ] ) else : arg_7 [ arg_9 ] = encode_decode_all ( arg_7 [ arg_9 ] , arg_8 = False ) elif type ( arg_7 [ arg_9 ] ) == str : if arg_8 : arg_7 [ arg_9 ] = decode ( arg_7 [ arg_9 ] ) else : arg_7 [ arg_9 ] = encode ( arg_7 [ arg_9 ] ) elif type ( arg_7 ) == list : arg_10 = [ ] for arg_11 in arg_7 : if type ( arg_11 ) == str : if arg_8 : arg_10 . append ( decode ( arg_11 ) ) else : arg_10 . append ( encode ( arg_11 ) ) elif type ( arg_11 ) in [ dict , list ] : if arg_8 : arg_10 . append ( encode_decode_all ( arg_11 ) ) else : arg_10 . append ( encode_decode_all ( arg_11 , arg_8 = False ) ) else : arg_10 . append ( arg_11 ) return arg_10 else : if arg_8 : return decode ( arg_7 ) else : return encode ( arg_7 ) return arg_7 def decode ( arg_12 ) : arg_13 = "" . join ( arg_4 % ord ( c ) if c not in p else c for c in arg_12 ) if sys . version_info >= ( 3 , 0 ) : return str ( arg_13 ) else : for arg_14 in arg_6 . findall ( arg_13 ) : arg_13 = arg_13 . replace ( arg_14 , arg_14 . decode ( "unicode_escape" ) ) return unicode ( arg_13 ) def encode ( arg_12 ) : for arg_14 in arg_5 . findall ( arg_12 ) : if sys . version_info >= ( 3 , 0 ) : arg_12 = arg_12 . replace ( arg_14 , bytes ( str ( arg_14 ) . replace ( "\\\\x" , "\\x" ) , "utf-8" ) . decode ( "unicode_escape" ) ) else : arg_12 = arg_12 . replace ( arg_14 , str ( arg_14 ) . replace ( "\\\\x" , "\\x" ) . decode ( "string_escape" ) ) return arg_12 if arg_2 : return encode_decode_all ( "{0}" . format ( json . dumps ( encode_decode_all ( arg_0 ( arg_1 ) ) , arg_2 = 5 ) ) , arg_8 = False ) else : return encode_decode_all ( "{0}" . format ( json . dumps ( encode_decode_all ( arg_0 ( arg_1 ) ) ) ) , arg_8 = False ) return func_wrapper

def Func(arg_0):
        """
        Decorator used to change the return value from PJFFactory.fuzzed, it makes the structure printable
        """
        def func_wrapper(arg_1, arg_2, arg_3):
            if arg_3:
                arg_4 = "\\x%02x"
            else:
                arg_4 = "\\u%04x"
            arg_5 = re.compile(r"(\\\\x[a-fA-F0-9]{2})")
            arg_6 = re.compile(r"(\\u[a-fA-F0-9]{4})")

            def encode_decode_all(arg_7, arg_8=True):
                if type(arg_7) == dict:
                    for arg_9 in arg_7:
                        if type(arg_7[arg_9]) in [dict, list]:
                            if arg_8:
                                arg_7[arg_9] = encode_decode_all(arg_7[arg_9])
                            else:
                                arg_7[arg_9] = encode_decode_all(arg_7[arg_9], arg_8=False)
                        elif type(arg_7[arg_9]) == str:
                            if arg_8:
                                arg_7[arg_9] = decode(arg_7[arg_9])
                            else:
                                arg_7[arg_9] = encode(arg_7[arg_9])
                elif type(arg_7) == list:
                    arg_10 = []
                    for arg_11 in arg_7:
                        if type(arg_11) == str:
                            if arg_8:
                                arg_10.append(decode(arg_11))
                            else:
                                arg_10.append(encode(arg_11))
                        elif type(arg_11) in [dict, list]:
                            if arg_8:
                                arg_10.append(encode_decode_all(arg_11))
                            else:
                                arg_10.append(encode_decode_all(arg_11, arg_8=False))
                        else:
                            arg_10.append(arg_11)
                    return arg_10
                else:
                    if arg_8:
                        return decode(arg_7)
                    else:
                        return encode(arg_7)
                return arg_7

            def decode(arg_12):
                arg_13 = "".join(arg_4 % ord(c) if c not in p else c for c in arg_12)
                if sys.version_info >= (3, 0):
                    return str(arg_13)
                else:
                    for arg_14 in arg_6.findall(arg_13):
                        arg_13 = arg_13.replace(arg_14, arg_14.decode("unicode_escape"))
                    return unicode(arg_13)

            def encode(arg_12):
                for arg_14 in arg_5.findall(arg_12):
                    if sys.version_info >= (3, 0):
                        arg_12 = arg_12.replace(arg_14, bytes(str(arg_14).replace("\\\\x", "\\x"),"utf-8").decode("unicode_escape"))
                    else:
                        arg_12 = arg_12.replace(arg_14, str(arg_14).replace("\\\\x", "\\x").decode("string_escape"))
                return arg_12

            if arg_2:
                return encode_decode_all("{0}".format(json.dumps(encode_decode_all(arg_0(arg_1)), arg_2=5)),
                                         arg_8=False)
            else:
                return encode_decode_all("{0}".format(json.dumps(encode_decode_all(arg_0(arg_1)))), arg_8=False)

        return func_wrapper

Decorator used to change the return value from PJFFactory . fuzzed it makes the structure printable


return (
            all(elem in content_type_tokens for elem in accept_tokens) and
            (content_type_tokens[0] == 'application/vnd.oasis.taxii+json' or
             content_type_tokens[0] == 'application/vnd.oasis.stix+json')
        )

def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
arg_2
.
replace
(
' '
,
''
)
.
split
(
';'
)
arg_4
=
arg_1
.
replace
(
' '
,
''
)
.
split
(
';'
)
return
(
all
(
arg_5
in
arg_4
for
arg_5
in
arg_3
)
and
(
arg_4
[
0
]
==
'application/vnd.oasis.taxii+json'
or
arg_4
[
0
]
==
'application/vnd.oasis.stix+json'
)
)

def Func(arg_0, arg_1, arg_2):
        """Check that the server is returning a valid Content-Type

        Args:
            content_type (str): ``Content-Type:`` header value
            accept (str): media type to include in the ``Accept:`` header.

        """
        arg_3 = arg_2.replace(' ', '').split(';')
        arg_4 = arg_1.replace(' ', '').split(';')

        return (
            all(arg_5 in arg_4 for arg_5 in arg_3) and
            (arg_4[0] == 'application/vnd.oasis.taxii+json' or
             arg_4[0] == 'application/vnd.oasis.stix+json')
        )

Check that the server is returning a valid Content - Type


def Func(arg_0, arg_1=None):
    """ returns a fully qualified app domain name """
    from .generic import get_site_proto
    arg_1 = arg_1 or get_site_proto()
    arg_2 = '{proto}://{domain}'.format(arg_1=arg_1, arg_0=arg_0)
    return arg_2


def Func ( arg_0 ) : arg_1 = DATE_ISO_REGEX . match ( arg_0 ) if arg_1 : arg_2 = datetime . datetime ( year = int ( arg_1 . group ( DATE_ISO_YEAR_GRP ) ) , month = int ( arg_1 . group ( DATE_ISO_MONTH_GRP ) ) , day = int ( arg_1 . group ( DATE_ISO_DAY_GRP ) ) , hour = int ( arg_1 . group ( DATE_ISO_HOUR_GRP ) ) , second = int ( arg_1 . group ( DATE_ISO_SEC_GRP ) ) , minute = int ( arg_1 . group ( DATE_ISO_MIN_GRP ) ) ) return arg_2 else : return None

def Func(arg_0):
    """
    Return a datetime object from an iso 8601 representation.
    Return None if string is non conforming.
    """
    arg_1 = DATE_ISO_REGEX.match(arg_0)
    if arg_1:
        arg_2 = datetime.datetime(year=int(arg_1.group(DATE_ISO_YEAR_GRP)),
                                 month=int(arg_1.group(DATE_ISO_MONTH_GRP)),
                                 day=int(arg_1.group(DATE_ISO_DAY_GRP)),
                                 hour=int(arg_1.group(DATE_ISO_HOUR_GRP)),
                                 second=int(arg_1.group(DATE_ISO_SEC_GRP)),
                                 minute=int(arg_1.group(DATE_ISO_MIN_GRP)))
        return arg_2
    else:
        return None

Return a datetime object from an iso 8601 representation . Return None if string is non conforming .


return self._setNotification(timeout, notification, callback,
                                     callbackArgs,
                                     callbackKwargs)

def Func(arg_0, arg_1, arg_2, **arg_3):
        """Wait for a particular UI event to occur; this can be built
        upon in NativeUIElement for specific convenience methods.
        """
        arg_4 = arg_0._matchOther
        arg_5 = None
        arg_6 = None
        arg_7 = None

        # Allow customization of the callback, though by default use the basic
        # _match() method
        if 'callback' in arg_3:
            arg_4 = arg_3['callback']
            del arg_3['callback']

            # Deal with these only if callback is provided:
            if 'args' in arg_3:
                if not isinstance(arg_3['args'], tuple):
                    arg_8 = 'Notification callback args not given as a tuple'
                    raise TypeError(arg_8)

                # If args are given, notification will pass back the returned
                # element in the first positional arg
                arg_6 = arg_3['args']
                del arg_3['args']

            if 'kwargs' in arg_3:
                if not isinstance(arg_3['kwargs'], dict):
                    arg_8 = 'Notification callback kwargs not given as a dict'
                    raise TypeError(arg_8)

                arg_7 = arg_3['kwargs']
                del arg_3['kwargs']
            # If kwargs are not given as a dictionary but individually listed
            # need to update the callbackKwargs dict with the remaining items in
            # kwargs
            if arg_3:
                if arg_7:
                    arg_7.update(arg_3)
                else:
                    arg_7 = arg_3
        else:
            arg_6 = (arg_5,)
            # Pass the kwargs to the default callback
            arg_7 = arg_3

        return arg_0._setNotification(arg_1, arg_2, arg_4,
                                     arg_6,
                                     arg_7)

Wait for a particular UI event to occur ; this can be built upon in NativeUIElement for specific convenience methods .


def Func ( arg_0 = False , arg_1 = None ) : if "config_loaded" not in INTERN : Load ( CURRENT_DIRECTORY ) if not arg_0 : DirectoryStructure ( ) INTERN . update ( { "config_loaded" : True } ) if arg_1 and isinstance ( arg_1 , dict ) : CONFIGURATION . update ( arg_1 )

def Func(arg_0=False, arg_1=None):  # pragma: no cover
    """
    Load the configuration.

    :param under_test:
        Tell us if we only have to load the configuration file (True)
        or load the configuration file and initate the output directory
        if it does not exist (False).
    :type under_test: bool

    :param custom:
        A dict with the configuration index (from .PyFunceble.yaml) to update.
    :type custom: dict

    .. warning::
        If :code:`custom` is given, the given :code:`dict` overwrite
        the last value of the given configuration indexes.
    """

    if "config_loaded" not in INTERN:
        # The configuration was not already loaded.

        # We load and download the different configuration file if they are non
        # existant.
        Load(CURRENT_DIRECTORY)

        if not arg_0:
            # If we are not under test which means that we want to save informations,
            # we initiate the directory structure.
            DirectoryStructure()

        # We save that the configuration was loaded.
        INTERN.update({"config_loaded": True})

        if arg_1 and isinstance(arg_1, dict):
            # The given configuration is not None or empty.
            # and
            # It is a dict.

            # We update the configuration index.
            CONFIGURATION.update(arg_1)


def
Func
(
arg_0
)
:
if
isinstance
(
arg_0
.
body
,
text_type
)
:
arg_1
=
arg_0
.
headers
.
get
(
'content-type'
,
'text/plain'
)
.
split
(
';'
)
if
len
(
arg_1
)
==
2
:
arg_2
,
arg_3
=
arg_1
arg_3
=
arg_3
.
split
(
'='
)
[
1
]
arg_0
.
body
=
arg_0
.
body
.
encode
(
arg_3
)
else
:
arg_2
=
arg_1
[
0
]
if
(
arg_2
==
'application/x-www-form-urlencoded'
or
'x-amz-'
in
arg_2
)
:
arg_0
.
body
=
arg_0
.
body
.
encode
(
)
else
:
arg_0
.
body
=
arg_0
.
body
.
encode
(
'utf-8'
)
arg_0
.
headers
[
'content-type'
]
=
arg_2
+
'; charset=utf-8'

def Func(arg_0):
        """
        Encode body of request to bytes and update content-type if required.

        If the body of req is Unicode then encode to the charset found in
        content-type header if present, otherwise UTF-8, or ASCII if
        content-type is application/x-www-form-urlencoded. If encoding to UTF-8
        then add charset to content-type. Modifies req directly, does not
        return a modified copy.

        req -- Requests PreparedRequest object

        """
        if isinstance(arg_0.body, text_type):
            arg_1 = arg_0.headers.get('content-type', 'text/plain').split(';')
            if len(arg_1) == 2:
                arg_2, arg_3 = arg_1
                arg_3 = arg_3.split('=')[1]
                arg_0.body = arg_0.body.encode(arg_3)
            else:
                arg_2 = arg_1[0]
                if (arg_2 == 'application/x-www-form-urlencoded' or
                        'x-amz-' in arg_2):
                    arg_0.body = arg_0.body.encode()
                else:
                    arg_0.body = arg_0.body.encode('utf-8')
                    arg_0.headers['content-type'] = arg_2 + '; charset=utf-8'

Encode body of request to bytes and update content - type if required .


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """
        Assumes that start and stop are already in 'buffer' coordinates. value is a byte iterable.
        value_len is fractional.
        """
        assert arg_2 >= arg_1 and arg_4 >= 0
        arg_5 = arg_2 - arg_1
        if arg_5 < arg_4:
            arg_0._insert_zeros(arg_2, arg_2 + arg_4 - arg_5)
            arg_0._copy_to_range(arg_1, arg_3, arg_4)
        elif arg_5 > arg_4:
            arg_0._del_range(arg_2 - (arg_5 - arg_4), arg_2)
            arg_0._copy_to_range(arg_1, arg_3, arg_4)
        else:
            arg_0._copy_to_range(arg_1, arg_3, arg_4)

Assumes that start and stop are already in buffer coordinates . value is a byte iterable . value_len is fractional .


return self._execute_search_query(
            dataset_returning_query,
            DatasetSearchResult
        )

def Func(arg_0, arg_1):
        """
        Run a dataset query against Citrination.

        :param dataset_returning_query: :class:`DatasetReturningQuery` to execute.
        :type dataset_returning_query: :class:`DatasetReturningQuery`
        :return: Dataset search result object with the results of the query.
        :rtype: :class:`DatasetSearchResult`
        """

        arg_0._validate_search_query(arg_1)
        return arg_0._execute_search_query(
            arg_1,
            DatasetSearchResult
        )

Run a dataset query against Citrination .


def Func(arg_0, arg_1=None):
    """A decorator for a function implementing dispatch_fn for dispatch_key.

    If no dispatch_key is specified, the function is used as the
    default dispacth function.
    """

    def apply_decorator(arg_2):
        if arg_1 is None:
            # Default case
            arg_0.__multi_default__ = arg_2
        else:
            arg_0.__multi__[arg_1] = arg_2
        return arg_2

    return apply_decorator

A decorator for a function implementing dispatch_fn for dispatch_key .


def Func ( arg_0 , arg_1 ) : if not os . path . exists ( arg_1 ) : raise ResolveError if os . path . isfile ( arg_1 ) : arg_1 = os . path . dirname ( arg_1 ) for arg_2 , arg_3 , arg_3 in walk_up ( arg_1 ) : if is_redirecting ( arg_2 ) : arg_4 = redirect_to_env_paths ( unipath ( arg_2 , '.cpenv' ) ) arg_5 = Resolver ( * arg_4 ) return arg_5 . resolve ( ) raise ResolveError

def Func(arg_0, arg_1):
    '''Resolves environment from .cpenv file...recursively walks up the tree
    in attempt to find a .cpenv file'''

    if not os.path.exists(arg_1):
        raise ResolveError

    if os.path.isfile(arg_1):
        arg_1 = os.path.dirname(arg_1)

    for arg_2, arg_3, arg_3 in walk_up(arg_1):
        if is_redirecting(arg_2):
            arg_4 = redirect_to_env_paths(unipath(arg_2, '.cpenv'))
            arg_5 = Resolver(*arg_4)
            return arg_5.resolve()

    raise ResolveError

Resolves environment from . cpenv file ... recursively walks up the tree in attempt to find a . cpenv file


def Func ( arg_0 ) : arg_1 = Site . objects . get_current ( ) arg_0 . password_reset_notification ( user = arg_0 , arg_1 = arg_1 ) . notify ( )

def Func(arg_0):
        """Send a password reset to the user's email address."""
        arg_1 = Site.objects.get_current()
        arg_0.password_reset_notification(user=arg_0, arg_1=arg_1).notify()

Send a password reset to the user s email address .


def
Func
(
arg_0
,
arg_1
)
:
for
arg_2
in
sorted
(
arg_1
)
:
arg_3
=
arg_1
[
arg_2
]
arg_4
=
arg_0
if
arg_2
.
startswith
(
'response_'
)
or
arg_2
.
startswith
(
'reply_'
)
:
arg_2
=
arg_2
.
replace
(
'response_'
,
''
)
.
replace
(
'reply_'
,
''
)
if
hasattr
(
arg_0
,
'_response'
)
:
arg_4
=
arg_0
.
_response
arg_5
=
getattr
(
arg_4
,
arg_2
,
)
arg_6
=
arg_2
in
dir
(
arg_4
)
arg_7
=
ismethod
(
arg_5
)
and
not
isfunction
(
arg_5
)
if
not
arg_7
and
not
arg_6
:
raise
PookInvalidArgument
(
'Unsupported argument: {}'
.
format
(
arg_2
)
)
if
arg_7
:
arg_5
(
arg_3
)
else
:
setattr
(
arg_4
,
arg_2
,
arg_3
)

def Func(arg_0, arg_1):
    """"
    Triggers specific class methods using a simple reflection
    mechanism based on the given input dictionary params.

    Arguments:
        instance (object): target instance to dynamically trigger methods.
        args (iterable): input arguments to trigger objects to

    Returns:
        None
    """
    # Start the magic
    for arg_2 in sorted(arg_1):
        arg_3 = arg_1[arg_2]
        arg_4 = arg_0

        # If response attibutes
        if arg_2.startswith('response_') or arg_2.startswith('reply_'):
            arg_2 = arg_2.replace('response_', '').replace('reply_', '')
            # If instance has response attribute, use it
            if hasattr(arg_0, '_response'):
                arg_4 = arg_0._response

        # Retrieve class member for inspection and future use
        arg_5 = getattr(arg_4, arg_2, None)

        # Is attribute
        arg_6 = arg_2 in dir(arg_4)
        arg_7 = ismethod(arg_5) and not isfunction(arg_5)

        if not arg_7 and not arg_6:
            raise PookInvalidArgument('Unsupported argument: {}'.format(arg_2))

        # Set attribute or trigger method
        if arg_7:
            arg_5(arg_3)
        else:
            setattr(arg_4, arg_2, arg_3)

Triggers specific class methods using a simple reflection mechanism based on the given input dictionary params .


return _Response(status, status_text, length, headers, body)

def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
_httprequest
.
status
(
)
arg_2
=
arg_0
.
_httprequest
.
status_text
(
)
arg_3
=
arg_0
.
_httprequest
.
get_all_response_headers
(
)
arg_4
=
[
]
for
arg_5
in
arg_3
.
split
(
'\n'
)
:
if
(
arg_5
.
startswith
(
'\t'
)
or
arg_5
.
startswith
(
' '
)
)
and
arg_4
:
arg_4
[
1
]
+=
arg_5
else
:
arg_4
.
append
(
arg_5
)
arg_6
=
[
]
for
arg_5
in
arg_4
:
if
':'
in
arg_5
:
arg_7
=
arg_5
.
find
(
':'
)
arg_6
.
append
(
(
arg_5
[
:
arg_7
]
.
lower
(
)
,
arg_5
[
arg_7
+
1
:
]
.
strip
(
)
)
)
arg_8
=
arg_0
.
_httprequest
.
response_body
(
)
arg_9
=
len
(
arg_8
)
return
_Response
(
arg_1
,
arg_2
,
arg_9
,
arg_6
,
arg_8
)

def Func(arg_0):
        ''' Gets the response and generates the _Response object'''
        arg_1 = arg_0._httprequest.status()
        arg_2 = arg_0._httprequest.status_text()

        arg_3 = arg_0._httprequest.get_all_response_headers()
        arg_4 = []
        for arg_5 in arg_3.split('\n'):
            if (arg_5.startswith('\t') or\
                arg_5.startswith(' ')) and arg_4:
                # append to previous header
                arg_4[-1] += arg_5
            else:
                arg_4.append(arg_5)

        arg_6 = []
        for arg_5 in arg_4:
            if ':' in arg_5:
                arg_7 = arg_5.find(':')
                arg_6.append(
                    (arg_5[:arg_7].lower(), arg_5[arg_7 + 1:].strip()))

        arg_8 = arg_0._httprequest.response_body()
        arg_9 = len(arg_8)

        return _Response(arg_1, arg_2, arg_9, arg_6, arg_8)


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . sourceModel ( ) if not arg_2 : return None return arg_2 . Func ( arg_0 . mapToSource ( arg_1 ) )

def Func(arg_0, arg_1):
        '''Return Func for index.'''
        arg_2 = arg_0.sourceModel()
        if not arg_2:
            return None

        return arg_2.Func(arg_0.mapToSource(arg_1))


(self,
        request_id, wait_for_status='Succeeded', timeout=30, sleep_interval=5,
        progress_callback=wait_for_operation_status_progress_default_callback,
        success_callback=wait_for_operation_status_success_default_callback,
        failure_callback=wait_for_operation_status_failure_default_callback)

def Func(arg_0,
        arg_1, arg_2='Succeeded', arg_3=30, arg_4=5,
        arg_5=arg_6,
        arg_7=arg_8,
        arg_9=arg_10):
        '''
        Waits for an asynchronous operation to complete.

        This calls get_operation_status in a loop and returns when the expected
        status is reached. The result of get_operation_status is returned. By
        default, an exception is raised on timeout or error status.

        request_id:
            The request ID for the request you wish to track.
        wait_for_status:
            Status to wait for. Default is 'Succeeded'.
        timeout:
            Total timeout in seconds. Default is 30s.
        sleep_interval:
            Sleep time in seconds for each iteration. Default is 5s.
        progress_callback:
            Callback for each iteration.
            Default prints '.'.
            Set it to None for no progress notification.
        success_callback:
            Callback on success. Default prints newline.
            Set it to None for no success notification.
        failure_callback:
            Callback on failure. Default prints newline+error details then
            raises exception.
            Set it to None for no failure notification.
        '''
        arg_11 = arg_3 // arg_4 + 1
        arg_12 = time.time()
        for arg_13 in range(int(arg_11)):
            arg_14 = arg_0.get_operation_status(arg_1)
            arg_15 = time.time() - arg_12
            if arg_14.status == arg_2:
                if arg_7 is not None:
                    arg_7(arg_15)
                return arg_14
            elif arg_14.error:
                if arg_9 is not None:
                    arg_16 = AzureAsyncOperationHttpError(_ERROR_ASYNC_OP_FAILURE, arg_14.status, arg_14)
                    arg_9(arg_15, arg_16)
                return arg_14
            else:
                if arg_5 is not None:
                    arg_5(arg_15)
                time.sleep(arg_4)

        if arg_9 is not None:
            arg_16 = AzureAsyncOperationHttpError(_ERROR_ASYNC_OP_TIMEOUT, arg_14.status, arg_14)
            arg_9(arg_15, arg_16)
        return arg_14

Waits for an asynchronous operation to complete .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_2 [ arg_1 ] . sum ( axis = 0 ) arg_3 = arg_3 - numpy . max ( arg_3 ) arg_4 = numpy . exp ( arg_3 ) arg_5 = arg_4 / numpy . sum ( arg_4 ) return arg_5

def Func(arg_0, arg_1, arg_2):
    """
    Perform inference for a single step. Given an SDR input and a weight
    matrix, return a predicted distribution.

    :param patternNZ: list of the active indices from the output below
    :param weightMatrix: numpy array of the weight matrix
    :return: numpy array of the predicted class label distribution
    """
    arg_3 = arg_2[arg_1].sum(axis=0)

    # softmax normalization
    arg_3 = arg_3 - numpy.max(arg_3)
    arg_4 = numpy.exp(arg_3)
    arg_5 = arg_4 / numpy.sum(arg_4)
    return arg_5

Perform inference for a single step . Given an SDR input and a weight matrix return a predicted distribution .


def Func ( arg_0 , arg_1 = True ) : if arg_1 : return arg_0 . _links . copy ( ) else : return arg_0 . _links

def Func(arg_0, arg_1=True):
        """Returns a link dictionary.

        :param copy:

            Whether the group's original dictionary or a shallow copy is returned.
            If you want the real dictionary please do not modify it at all!

        :returns: Dictionary of nodes

        """
        if arg_1:
            return arg_0._links.copy()
        else:
            return arg_0._links


def Func ( arg_0 ) : arg_1 = json . loads ( arg_0 ) arg_2 = arg_1 [ 'results' ] for arg_3 in arg_2 : yield arg_3

def Func(arg_0):
        """Parse a Confluence summary JSON list.

        The method parses a JSON stream and returns an iterator
        of diccionaries. Each dictionary is a content summary.

        :param raw_json: JSON string to parse

        :returns: a generator of parsed content summaries.
        """
        arg_1 = json.loads(arg_0)

        arg_2 = arg_1['results']
        for arg_3 in arg_2:
            yield arg_3


def Func ( arg_0 , arg_1 , arg_2 ) : arg_0 . _coroutine_queue . put ( arg_0 . _client . set_active ( ) ) arg_0 . _coroutine_queue . put ( arg_0 . _conversation . update_read_timestamp ( ) ) return super ( ) . Func ( arg_1 , arg_2 )

def Func(arg_0, arg_1, arg_2):
        """Handle marking messages as read and keeping client active."""
        # Set the client as active.
        arg_0._coroutine_queue.put(arg_0._client.set_active())

        # Mark the newest event as read.
        arg_0._coroutine_queue.put(arg_0._conversation.update_read_timestamp())

        return super().Func(arg_1, arg_2)

Handle marking messages as read and keeping client active .


def Func ( arg_0 ) : def wrapper ( arg_1 , * arg_2 , ** arg_3 ) : if arg_1 . ndim == 1 : return arg_0 ( arg_1 , * arg_2 , ** arg_3 ) elif arg_1 . ndim == 2 : return arg_1 . apply ( arg_0 , * arg_2 , ** arg_3 ) return wrapper

def Func(arg_0):
    """
    Decorator so that functions can be written to work on Series but
    may still be called with DataFrames.
    """

    def wrapper(arg_1, *arg_2, **arg_3):
        if arg_1.ndim == 1:
            return arg_0(arg_1, *arg_2, **arg_3)
        elif arg_1.ndim == 2:
            return arg_1.apply(arg_0, *arg_2, **arg_3)

    return wrapper

Decorator so that functions can be written to work on Series but may still be called with DataFrames .


(response_index, response_header, data_set, col_vals, headers, standardizers, feats_to_ignore, columns_to_expand, outcome_trans_dict)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8):
  """
  Standardizes continuous features and expands categorical features.
  """
  # expand and standardize
  arg_9 = []
  for arg_10, arg_11 in enumerate(arg_2):
    arg_12 = []
    for arg_13, arg_14 in enumerate(arg_11):
      arg_15 = arg_4[arg_13]

      # Outcome feature -> index outcome
      if arg_13 == arg_0:
        arg_16 = arg_8[arg_14]
        arg_12.append(arg_16)

      # Ignored feature -> pass
      elif arg_15 in arg_6:
        pass

      # Categorical feature -> create new binary column for each possible value of the column
      elif arg_15 in arg_7:
        for arg_17 in arg_3[arg_15]:
          if arg_14 == arg_17:
            arg_18 = 1.0
          else:
            arg_18 = -1.0
          arg_12.append(arg_18)

      # Continuous feature -> standardize value with respect to its column
      else:
        arg_19 = float((arg_14 - arg_5[arg_15]['mean']) / arg_5[arg_15]['std_dev'])
        arg_12.append(arg_19)

    arg_9.append(arg_12)

  # update headers to reflect column expansion
  arg_20 = []
  for arg_15 in arg_4:
    if arg_15 in arg_6:
      pass
    elif (arg_15 in arg_7) and (arg_15 is not arg_1):
      for arg_17 in arg_3[arg_15]:
        arg_21 = '{}_{}'.format(arg_15,arg_17)
        arg_20.append(arg_21)
    else:
      arg_20.append(arg_15)

  return arg_9, arg_20

Standardizes continuous features and expands categorical features .


def Func(arg_0):
  """Attempt to sum MultivariateNormal distributions.

  The sum of (multivariate) normal random variables is itself (multivariate)
  normal, with mean given by the sum of means and (co)variance given by the
  sum of (co)variances. This method exploits this fact to compute the
  sum of a list of `tfd.MultivariateNormalDiag` objects.

  It may in the future be extended to support summation of other forms of
  (Multivariate)Normal distributions.

  Args:
    distributions: Python `iterable` of `tfd.MultivariateNormalDiag`
      distribution instances. These must all have the same event
      shape, and broadcast to a consistent batch shape.

  Returns:
    sum_distribution: A `tfd.MultivariateNormalDiag` instance with mean
      equal to the sum of input means and covariance equal to the sum of
      input covariances.
  """

  arg_1 = [tensor for distribution in arg_0
                   for tensor in distribution._graph_parents]  # pylint: disable=protected-access
  with tf.compat.v1.name_scope('Func', values=arg_1):
    if all([isinstance(arg_2, tfd.MultivariateNormalDiag)
            for arg_2 in arg_0]):
      return tfd.MultivariateNormalDiag(
          loc=sum([arg_2.mean() for arg_2 in arg_0]),
          scale_diag=tf.sqrt(sum([
              arg_2.scale.diag**2 for arg_2 in arg_0])))
    else:
      raise NotImplementedError(
          'Sums of distributions other than MultivariateNormalDiag are not '
          'currently implemented. (given: {})'.format(arg_0))

Attempt to sum MultivariateNormal distributions .


def
Func
(
arg_0
,
arg_1
)
:
while
True
:
arg_0
.
reset
(
)
for
arg_2
in
arg_0
.
_should_be_mapped
:
arg_3
,
arg_4
=
arg_0
.
_should_be_mapped
[
arg_2
]
arg_0
.
_emu
.
mem_map
(
arg_2
,
arg_3
,
arg_4
)
for
arg_5
,
arg_6
in
arg_0
.
_should_be_written
.
items
(
)
:
for
arg_7
,
arg_8
in
enumerate
(
arg_6
,
start
=
arg_5
)
:
if
issymbolic
(
arg_8
)
:
from
.
.
native
.
cpu
.
abstractcpu
import
ConcretizeMemory
raise
ConcretizeMemory
(
arg_0
.
_cpu
.
memory
,
arg_7
,
8
,
"Concretizing for emulation"
)
arg_0
.
_emu
.
mem_write
(
arg_5
,
b''
.
join
(
arg_6
)
)
arg_0
.
_should_try_again
=
False
arg_0
.
_step
(
arg_1
)
if
not
arg_0
.
_should_try_again
:
break

def Func(arg_0, arg_1):
        """
        Emulate a single instruction.
        """

        # The emulation might restart if Unicorn needs to bring in a memory map
        # or bring a value from Manticore state.
        while True:

            arg_0.reset()

            # Establish Manticore state, potentially from past emulation
            # attempts
            for arg_2 in arg_0._should_be_mapped:
                arg_3, arg_4 = arg_0._should_be_mapped[arg_2]
                arg_0._emu.mem_map(arg_2, arg_3, arg_4)

            for arg_5, arg_6 in arg_0._should_be_written.items():
                for arg_7, arg_8 in enumerate(arg_6, start=arg_5):
                    if issymbolic(arg_8):
                        from ..native.cpu.abstractcpu import ConcretizeMemory
                        raise ConcretizeMemory(arg_0._cpu.memory, arg_7, 8,
                                               "Concretizing for emulation")

                arg_0._emu.mem_write(arg_5, b''.join(arg_6))

            # Try emulation
            arg_0._should_try_again = False

            arg_0._step(arg_1)

            if not arg_0._should_try_again:
                break


def Func ( arg_0 ) : for arg_1 , arg_2 , arg_3 in os . walk ( arg_0 ) : for arg_4 in arg_3 : arg_5 = os . path . join ( arg_1 , arg_4 ) yield arg_5

def Func(arg_0):
    'yield all file Func under input_dir'
    for arg_1, arg_2, arg_3 in os.walk(arg_0):
        for arg_4 in arg_3:
            arg_5 = os.path.join(arg_1, arg_4)
            yield arg_5


def Func ( arg_0 ) : arg_1 = { } for arg_2 in arg_0 : arg_3 = arg_2 [ 'name' ] arg_4 = arg_2 [ 'summary' ] arg_5 = arg_2 [ 'version' ] arg_6 = arg_2 [ '_pypi_ordering' ] if arg_6 is None : arg_6 = 0 if arg_3 not in arg_1 . keys ( ) : arg_1 [ arg_3 ] = { 'name' : arg_3 , 'summary' : arg_4 , 'versions' : [ arg_5 ] , 'score' : arg_6 , } else : arg_1 [ arg_3 ] [ 'versions' ] . append ( arg_5 ) if arg_5 == highest_version ( arg_1 [ arg_3 ] [ 'versions' ] ) : arg_1 [ arg_3 ] [ 'summary' ] = arg_4 arg_1 [ arg_3 ] [ 'score' ] = arg_6 arg_7 = sorted ( arg_1 . values ( ) , key = lambda x : x [ 'score' ] , reverse = True , ) return arg_7

def Func(arg_0):
    """
    The list from pypi is really a list of versions. We want a list of
    packages with the list of versions stored inline. This converts the
    list from pypi into one we can use.
    """
    arg_1 = {}
    for arg_2 in arg_0:
        arg_3 = arg_2['name']
        arg_4 = arg_2['summary']
        arg_5 = arg_2['version']
        arg_6 = arg_2['_pypi_ordering']
        if arg_6 is None:
            arg_6 = 0

        if arg_3 not in arg_1.keys():
            arg_1[arg_3] = {
                'name': arg_3,
                'summary': arg_4,
                'versions': [arg_5],
                'score': arg_6,
            }
        else:
            arg_1[arg_3]['versions'].append(arg_5)

            # if this is the highest version, replace summary and score
            if arg_5 == highest_version(arg_1[arg_3]['versions']):
                arg_1[arg_3]['summary'] = arg_4
                arg_1[arg_3]['score'] = arg_6

    # each record has a unique name now, so we will convert the dict into a
    # list sorted by score
    arg_7 = sorted(
        arg_1.values(),
        key=lambda x: x['score'],
        reverse=True,
    )
    return arg_7

The list from pypi is really a list of versions . We want a list of packages with the list of versions stored inline . This converts the list from pypi into one we can use .


def Func(arg_0):
    """ Format an experiment result memory object for measurement level 0.

    Args:
        memory (list): Memory from experiment with `meas_level==1`. `avg` or
            `single` will be inferred from shape of result memory.

    Returns:
        np.ndarray: Measurement level 0 complex numpy array

    Raises:
        QiskitError: If the returned numpy array does not have 2 (avg) or 3 (single)
            indicies.
    """
    arg_1 = _list_to_complex_array(arg_0)
    # infer meas_return from shape of returned data.
    if not 2 <= len(arg_1.shape) <= 3:
        raise QiskitError('Level zero memory is not of correct shape.')
    return arg_1

Format an experiment result memory object for measurement level 0 .


def Func ( arg_0 , arg_1 , arg_2 ) : with contextlib . suppress ( ValueError ) : arg_0 . _listeners [ arg_1 ] . remove ( arg_2 ) return True with contextlib . suppress ( ValueError ) : arg_0 . _once [ arg_1 ] . remove ( arg_2 ) return True return False

def Func(arg_0, arg_1, arg_2):
        """Remove a listener from the emitter.

        Args:
            event (str): The event name on which the listener is bound.
            listener: A reference to the same object given to add_listener.

        Returns:
            bool: True if a listener was removed else False.

        This method only removes one listener at a time. If a listener is
        attached multiple times then this method must be called repeatedly.
        Additionally, this method removes listeners first from the those
        registered with 'on' or 'add_listener'. If none are found it continue
        to remove afterwards from those added with 'once'.
        """
        with contextlib.suppress(ValueError):

            arg_0._listeners[arg_1].remove(arg_2)
            return True

        with contextlib.suppress(ValueError):

            arg_0._once[arg_1].remove(arg_2)
            return True

        return False


def
Func
(
arg_0
)
:
arg_1
=
(
arg_2
for
arg_2
in
list
(
arg_0
.
keys
(
)
)
if
arg_2
.
startswith
(
'META_'
)
)
for
arg_2
in
arg_1
:
arg_3
=
arg_2
[
5
:
]
.
capitalize
(
)
pprint
(
'{0}: {1}'
.
format
(
arg_3
,
arg_0
.
pop
(
arg_2
)
)
)
pprint
(
arg_0
)

def Func(arg_0):
    """
    Given a dictionary of variable attribute data from get_details display the
    data in the terminal.
    """
    arg_1 = (arg_2 for arg_2 in list(arg_0.keys())
                 if arg_2.startswith('META_'))
    for arg_2 in arg_1:
        arg_3 = arg_2[5:].capitalize()
        pprint('{0}: {1}'.format(arg_3, arg_0.pop(arg_2)))
    pprint(arg_0)

Given a dictionary of variable attribute data from get_details display the data in the terminal .


def Func ( ) : arg_0 = check_output_demoted ( [ 'VBoxManage' , 'list' , 'vms' ] ) for arg_1 in arg_0 . splitlines ( ) : if '"{}"' . format ( constants . VM_MACHINE_NAME ) in arg_1 : return True return False

def Func():
    """We use VBox directly instead of Docker Machine because it
    shaves about 0.5 seconds off the runtime of this check."""
    arg_0 = check_output_demoted(['VBoxManage', 'list', 'vms'])
    for arg_1 in arg_0.splitlines():
        if '"{}"'.format(constants.VM_MACHINE_NAME) in arg_1:
            return True
    return False

We use VBox directly instead of Docker Machine because it shaves about 0 . 5 seconds off the runtime of this check .


def Func(arg_0):
        """Asserts that val is iterable and contains duplicate items."""
        try:
            if len(arg_0.val) != len(set(arg_0.val)):
                return arg_0
        except TypeError:
            raise TypeError('val is not iterable')
        arg_0._err('Expected <%s> to contain duplicates, but did not.' % arg_0.val)

Asserts that val is iterable and contains duplicate items .


def Func ( arg_0 ) : def getter ( arg_1 ) : return arg_1 . __dict__ [ arg_0 ] def setter ( arg_1 , arg_2 ) : validate_input ( arg_1 . __class__ . __name__ , arg_0 , arg_2 ) arg_1 . __dict__ [ arg_0 ] = arg_2 return property ( fget = getter , fset = setter )

def Func(arg_0):
    """
    A property factory that will dispatch the to a specific validator function
    that will validate the user's input to ensure critical parameters are of a
    specific type.
    """

    def getter(arg_1):
        return arg_1.__dict__[arg_0]

    def setter(arg_1, arg_2):
        validate_input(arg_1.__class__.__name__, arg_0, arg_2)
        arg_1.__dict__[arg_0] = arg_2

    return property(fget=getter, fset=setter)

A property factory that will dispatch the to a specific validator function that will validate the user s input to ensure critical parameters are of a specific type .


(self, image,
                      color=(0, 255, 0), color_lines=None, color_points=None,
                      alpha=1.0, alpha_lines=None, alpha_points=None,
                      size=1, size_lines=None, size_points=None,
                      antialiased=True,
                      raise_if_out_of_image=False)

def Func(arg_0, arg_1,
                      arg_2=(0, 255, 0), arg_3=None, arg_4=None,
                      arg_5=1.0, arg_6=None, arg_7=None,
                      arg_8=1, arg_9=None, arg_10=None,
                      arg_11=True,
                      arg_12=False):
        """
        Draw all line strings onto a given image.

        Parameters
        ----------
        image : ndarray
            The `(H,W,C)` `uint8` image onto which to draw the line strings.

        color : iterable of int, optional
            Color to use as RGB, i.e. three values.
            The color of the lines and points are derived from this value,
            unless they are set.

        color_lines : None or iterable of int
            Color to use for the line segments as RGB, i.e. three values.
            If ``None``, this value is derived from `color`.

        color_points : None or iterable of int
            Color to use for the points as RGB, i.e. three values.
            If ``None``, this value is derived from ``0.5 * color``.

        alpha : float, optional
            Opacity of the line strings. Higher values denote more visible
            points.
            The alphas of the line and points are derived from this value,
            unless they are set.

        alpha_lines : None or float, optional
            Opacity of the line strings. Higher values denote more visible
            line string.
            If ``None``, this value is derived from `alpha`.

        alpha_points : None or float, optional
            Opacity of the line string points. Higher values denote more
            visible points.
            If ``None``, this value is derived from `alpha`.

        size : int, optional
            Size of the line strings.
            The sizes of the line and points are derived from this value,
            unless they are set.

        size_lines : None or int, optional
            Thickness of the line segments.
            If ``None``, this value is derived from `size`.

        size_points : None or int, optional
            Size of the points in pixels.
            If ``None``, this value is derived from ``3 * size``.

        antialiased : bool, optional
            Whether to draw the lines with anti-aliasing activated.
            This does currently not affect the point drawing.

        raise_if_out_of_image : bool, optional
            Whether to raise an error if a line string is fully
            outside of the image. If set to False, no error will be raised and
            only the parts inside the image will be drawn.

        Returns
        -------
        ndarray
            Image with line strings drawn on it.

        """
        # TODO improve efficiency here by copying only once
        for arg_13 in arg_0.line_strings:
            arg_1 = arg_13.Func(
                arg_1,
                arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,
                arg_5=arg_5, arg_6=arg_6, arg_7=arg_7,
                arg_8=arg_8, arg_9=arg_9, arg_10=arg_10,
                arg_11=arg_11,
                arg_12=arg_12
            )

        return arg_1

Draw all line strings onto a given image .


(self, nick, message, channel, cmd_channel)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : arg_0 . channel = arg_4 arg_0 . conn . join ( arg_0 . channel ) arg_0 . registered . set ( )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """\
        Received registration acknowledgement from the BotnetBot, as well as the
        name of the command channel, so join up and indicate that registration
        succeeded
        """
        # the boss will tell what channel to join
        arg_0.channel = arg_4
        arg_0.conn.join(arg_0.channel)

        # indicate that registered so we'll stop trying
        arg_0.registered.set()

\ Received registration acknowledgement from the BotnetBot as well as the name of the command channel so join up and indicate that registration succeeded


def Func(arg_0):
    '''given a config dict with streamcorpus_pipeline as a key, find all
    keys under streamcorpus_pipeline that end with "_path" and if the
    value of that key is a relative path, convert it to an absolute
    path using the value provided by root_path
    '''
    if not 'streamcorpus_pipeline' in arg_0:
        logger.critical('bad config: %r', arg_0)
        raise ConfigurationError('missing "streamcorpus_pipeline" from config')
    ## remove the root_path, so it does not get extended itself
    arg_1 = arg_0['streamcorpus_pipeline'].pop('root_path', None)
    if not arg_1:
        arg_1 = os.getcwd()

    if not arg_1.startswith('/'):
        arg_1 = os.path.join( os.getcwd(), arg_1 )

    def recursive_abs_path( arg_2, arg_1 ):
        for arg_3, arg_4 in arg_2.items():
            if isinstance(arg_4, basestring):
                if arg_3.endswith('path'):
                    ## ignore URLs in *_path parameters
                    if re.match('^http.?://', arg_4): continue
                    ## we have a path... is it already absolute?
                    if not arg_4.startswith('/'):
                        ## make the path absolute
                        arg_2[arg_3] = os.path.join(arg_1, arg_4)

            elif isinstance(arg_4, dict):
                recursive_abs_path( arg_4, arg_1 )

    recursive_abs_path( arg_0, arg_1 )

    ## put the root_path back
    arg_0['root_path'] = arg_1

given a config dict with streamcorpus_pipeline as a key find all keys under streamcorpus_pipeline that end with _path and if the value of that key is a relative path convert it to an absolute path using the value provided by root_path


(tagger_id, tmp_cleansed_path, tmp_ner_path, pipeline_root)

def Func(arg_0, arg_1, arg_2, arg_3):
    '''run child process to get OWPL output'''
    arg_4 = dict(INPUT_FILE=arg_1,
                  #RAW_OUTPUT_FILE=tmp_ner_raw_path,
                  OUTPUT_FILE=arg_2,
                  PIPELINE_ROOT=arg_3)

    arg_5 = pipeline_cmd_templates[arg_0] % arg_4

    print arg_5

    ## replace this with log.info()
    print 'creating %s' % arg_2
    arg_6 = time.time()
    arg_7 = subprocess.Popen(
        arg_5,
        stderr=subprocess.PIPE, shell=True)
    arg_8, arg_9 = arg_7.communicate()
    assert arg_7.returncode == 0 and 'Exception' not in arg_9, arg_9
    arg_10 = time.time() - arg_6
    ## replace this with log.info()
    print 'created %s in %.1f sec' % (arg_2, arg_10)

    '''
    postproc_cmd = postproc_cmd_templates[tagger_id] % params

    print postproc_cmd

    ## replace this with log.info()
    print 'creating %s' % tmp_ner_raw_path
    start_time = time.time()
    gpg_child = subprocess.Popen(
        postproc_cmd,
        stderr=subprocess.PIPE, shell=True)
    s_out, errors = gpg_child.communicate()
    assert gpg_child.returncode == 0 and 'Exception' not in errors, errors
    elapsed = time.time() - start_time

    ## replace this with log.info()
    print 'created %s in %.1f sec' % (tmp_ner_path, elapsed)
    '''


def Func ( arg_0 ) : arg_1 = arg_0 . parent if isinstance ( arg_1 , astroid . For ) : return True if isinstance ( arg_1 , astroid . Comprehension ) : if arg_1 . iter == arg_0 : return True elif isinstance ( arg_1 , astroid . Call ) : if isinstance ( arg_1 . func , astroid . Name ) : arg_2 = arg_1 . func . lookup ( arg_1 . func . name ) [ 0 ] if _is_builtin ( arg_2 ) and arg_1 . func . name in _ACCEPTS_ITERATOR : return True elif isinstance ( arg_1 . func , astroid . Attribute ) : if arg_1 . func . attrname in ATTRIBUTES_ACCEPTS_ITERATOR : return True arg_3 = utils . safe_infer ( arg_1 . func ) if arg_3 : if arg_3 . qname ( ) in _BUILTIN_METHOD_ACCEPTS_ITERATOR : return True arg_4 = arg_3 . root ( ) if arg_4 and arg_4 . name == "itertools" : return True elif isinstance ( arg_1 , astroid . Assign ) and isinstance ( arg_1 . targets [ 0 ] , ( astroid . List , astroid . Tuple ) ) : if len ( arg_1 . targets [ 0 ] . elts ) > 1 : return True elif ( isinstance ( arg_1 , astroid . Compare ) and len ( arg_1 . ops ) == 1 and arg_1 . ops [ 0 ] [ 0 ] == "in" ) : return True elif isinstance ( arg_1 , astroid . YieldFrom ) : return True if isinstance ( arg_1 , astroid . Starred ) : return True return False

def Func(arg_0):
    """Check if the node is being used as an iterator.

    Definition is taken from lib2to3.fixer_util.in_special_context().
    """
    arg_1 = arg_0.parent
    # Since a call can't be the loop variant we only need to know if the node's
    # parent is a 'for' loop to know it's being used as the iterator for the
    # loop.
    if isinstance(arg_1, astroid.For):
        return True
    # Need to make sure the use of the node is in the iterator part of the
    # comprehension.
    if isinstance(arg_1, astroid.Comprehension):
        if arg_1.iter == arg_0:
            return True
    # Various built-ins can take in an iterable or list and lead to the same
    # value.
    elif isinstance(arg_1, astroid.Call):
        if isinstance(arg_1.func, astroid.Name):
            arg_2 = arg_1.func.lookup(arg_1.func.name)[0]
            if _is_builtin(arg_2) and arg_1.func.name in _ACCEPTS_ITERATOR:
                return True
        elif isinstance(arg_1.func, astroid.Attribute):
            if arg_1.func.attrname in ATTRIBUTES_ACCEPTS_ITERATOR:
                return True

        arg_3 = utils.safe_infer(arg_1.func)
        if arg_3:
            if arg_3.qname() in _BUILTIN_METHOD_ACCEPTS_ITERATOR:
                return True
            arg_4 = arg_3.root()
            if arg_4 and arg_4.name == "itertools":
                return True
    # If the call is in an unpacking, there's no need to warn,
    # since it can be considered iterating.
    elif isinstance(arg_1, astroid.Assign) and isinstance(
        arg_1.targets[0], (astroid.List, astroid.Tuple)
    ):
        if len(arg_1.targets[0].elts) > 1:
            return True
    # If the call is in a containment check, we consider that to
    # be an iterating context
    elif (
        isinstance(arg_1, astroid.Compare)
        and len(arg_1.ops) == 1
        and arg_1.ops[0][0] == "in"
    ):
        return True
    # Also if it's an `yield from`, that's fair
    elif isinstance(arg_1, astroid.YieldFrom):
        return True
    if isinstance(arg_1, astroid.Starred):
        return True
    return False

Check if the node is being used as an iterator .


return self._clause(self.visit(node.pt)) + [
            ast.While(ast.Name('True', ast.Load()), clause, [])]

def Func ( arg_0 , arg_1 : arg_2 . Rep0N ) -> [ ast . stmt ] : arg_4 = arg_0 . visit ( arg_1 . pt ) if isinstance ( arg_4 , ast . expr ) : return ( arg_0 . _clause ( arg_4 ) + arg_0 . visit_Rep0N ( arg_1 ) ) arg_0 . in_loop += 1 arg_4 = arg_0 . _clause ( arg_0 . visit ( arg_1 . pt ) ) arg_0 . in_loop -= 1 return arg_0 . _clause ( arg_0 . visit ( arg_1 . pt ) ) + [ ast . While ( ast . Name ( 'True' , ast . Load ( ) ) , arg_4 , [ ] ) ]

def Func(arg_0, arg_1: arg_2.Rep0N) -> [ast.stmt]:
        """Generates python code for a clause repeated 1 or more times.

        <code for the clause>
        while True:
            <code for the clause>
        """
        arg_4 = arg_0.visit(arg_1.pt)
        if isinstance(arg_4, ast.expr):
            return (arg_0._clause(arg_4) + arg_0.visit_Rep0N(arg_1))
        arg_0.in_loop += 1
        arg_4 = arg_0._clause(arg_0.visit(arg_1.pt))
        arg_0.in_loop -= 1
        return arg_0._clause(arg_0.visit(arg_1.pt)) + [
            ast.While(ast.Name('True', ast.Load()), arg_4, [])]

Generates python code for a clause repeated 1 or more times .


def Func ( arg_0 , arg_1 ) : if DEBUG : print "move!" if arg_0 . current and not arg_0 . overlay : arg_2 = arg_0 . current arg_3 , arg_4 = arg_0 . start arg_5 , arg_6 = wx . GetMousePosition ( ) arg_5 , arg_6 = ( arg_5 + arg_3 , arg_6 + arg_4 ) if arg_1 . ShiftDown ( ) : arg_5 = arg_5 / GRID_SIZE [ 0 ] * GRID_SIZE [ 0 ] arg_6 = arg_6 / GRID_SIZE [ 1 ] * GRID_SIZE [ 1 ] arg_7 , arg_8 = arg_2 . obj . pos arg_9 , arg_10 = ( arg_5 - arg_7 ) , ( arg_6 - arg_8 ) for arg_11 in arg_0 . selection : arg_5 , arg_6 = arg_11 . pos arg_5 = arg_5 + arg_9 arg_6 = arg_6 + arg_10 arg_11 . pos = ( wx . Point ( arg_5 , arg_6 ) ) elif arg_0 . overlay : arg_2 = arg_0 . current arg_12 = arg_1 . GetPosition ( ) if arg_1 . GetEventObject ( ) != arg_2 : arg_12 = arg_1 . GetEventObject ( ) . ClientToScreen ( arg_12 ) arg_12 = arg_2 . ScreenToClient ( arg_12 ) arg_13 = wx . RectPP ( arg_0 . pos , arg_12 ) arg_14 = wx . ClientDC ( arg_2 ) arg_15 = wx . DCOverlay ( arg_0 . overlay , arg_14 ) arg_15 . Clear ( ) arg_14 . SetPen ( wx . Pen ( "blue" , 2 ) ) if 'wxMac' in wx . PlatformInfo : arg_14 . SetBrush ( wx . Brush ( wx . Colour ( 0xC0 , 0xC0 , 0xC0 , 0x80 ) ) ) else : arg_14 . SetBrush ( wx . TRANSPARENT_BRUSH ) arg_14 . DrawRectangleRect ( arg_13 ) del arg_15

def Func(arg_0, arg_1):
        "Move the selected object"
        if DEBUG: print "move!"
        if arg_0.current and not arg_0.overlay:
            arg_2 = arg_0.current
            arg_3, arg_4 = arg_0.start
            arg_5, arg_6 = wx.GetMousePosition()
            # calculate the new position (this will overwrite relative dimensions):
            arg_5, arg_6 = (arg_5 + arg_3, arg_6 + arg_4)
            if arg_1.ShiftDown():     # snap to grid:
                arg_5 = arg_5 / GRID_SIZE[0] * GRID_SIZE[0]
                arg_6 = arg_6 / GRID_SIZE[1] * GRID_SIZE[1]
            # calculate the diff to use in the rest of the selected objects:
            arg_7, arg_8 = arg_2.obj.pos
            arg_9, arg_10 = (arg_5 - arg_7), (arg_6 - arg_8)
            # move all selected objects:
            for arg_11 in arg_0.selection:
                arg_5, arg_6 = arg_11.pos
                arg_5 = arg_5 + arg_9
                arg_6 = arg_6 + arg_10
                arg_11.pos = (wx.Point(arg_5, arg_6))
        elif arg_0.overlay:
            arg_2 = arg_0.current
            arg_12 = arg_1.GetPosition()
            # convert to relative client coordinates of the containter:
            if arg_1.GetEventObject() != arg_2:
                arg_12 = arg_1.GetEventObject().ClientToScreen(arg_12)  # frame
                arg_12 = arg_2.ScreenToClient(arg_12)                # panel
            arg_13 = wx.RectPP(arg_0.pos, arg_12)
            # Draw the rubber-band rectangle using an overlay so it
            # will manage keeping the rectangle and the former window
            # contents separate.
            arg_14 = wx.ClientDC(arg_2)
            arg_15 = wx.DCOverlay(arg_0.overlay, arg_14)
            arg_15.Clear()
            arg_14.SetPen(wx.Pen("blue", 2))
            if 'wxMac' in wx.PlatformInfo:
                arg_14.SetBrush(wx.Brush(wx.Colour(0xC0, 0xC0, 0xC0, 0x80)))
            else:
                arg_14.SetBrush(wx.TRANSPARENT_BRUSH)
            arg_14.DrawRectangleRect(arg_13)
            del arg_15


def Func ( arg_0 ) : @ wraps ( arg_0 ) def wrapped_ast_generator ( arg_1 : arg_2 , arg_3 : arg_4 ) -> GeneratedPyAST : return GeneratedPyAST ( node = arg_0 ( arg_1 , arg_3 ) ) return wrapped_ast_generator

def Func(arg_0):
    """Wrap simpler AST generators to return a GeneratedPyAST."""

    @wraps(arg_0)
    def wrapped_ast_generator(arg_1: arg_2, arg_3: arg_4) -> GeneratedPyAST:
        return GeneratedPyAST(node=arg_0(arg_1, arg_3))

    return wrapped_ast_generator

Wrap simpler AST generators to return a GeneratedPyAST .


def Func(arg_0, arg_1, arg_2=0.0, arg_3=0.0) -> VAO:
    """
    Creates a 2D quad VAO using 2 triangles with normals and texture coordinates.

    Args:
        width (float): Width of the quad
        height (float): Height of the quad

    Keyword Args:
        xpos (float): Center position x
        ypos (float): Center position y

    Returns:
        A :py:class:`demosys.opengl.vao.VAO` instance.
    """
    arg_4 = numpy.array([
        arg_2 - arg_0 / 2.0, arg_3 + arg_1 / 2.0, 0.0,
        arg_2 - arg_0 / 2.0, arg_3 - arg_1 / 2.0, 0.0,
        arg_2 + arg_0 / 2.0, arg_3 - arg_1 / 2.0, 0.0,
        arg_2 - arg_0 / 2.0, arg_3 + arg_1 / 2.0, 0.0,
        arg_2 + arg_0 / 2.0, arg_3 - arg_1 / 2.0, 0.0,
        arg_2 + arg_0 / 2.0, arg_3 + arg_1 / 2.0, 0.0,
    ], dtype=numpy.float32)

    arg_5 = numpy.array([
        0.0, 0.0, 1.0,
        0.0, 0.0, 1.0,
        0.0, 0.0, 1.0,
        0.0, 0.0, 1.0,
        0.0, 0.0, 1.0,
        0.0, 0.0, 1.0,
    ], dtype=numpy.float32)

    arg_6 = numpy.array([
        0.0, 1.0,
        0.0, 0.0,
        1.0, 0.0,
        0.0, 1.0,
        1.0, 0.0,
        1.0, 1.0,
    ], dtype=numpy.float32)

    arg_7 = VAO("geometry:quad", mode=moderngl.TRIANGLES)
    arg_7.buffer(arg_4, '3f', ["in_position"])
    arg_7.buffer(arg_5, '3f', ["in_normal"])
    arg_7.buffer(arg_6, '2f', ["in_uv"])

    return arg_7

Creates a 2D quad VAO using 2 triangles with normals and texture coordinates .


return clean(html, tags=allowed_tags, attributes=allowed_attrs, strip=True)

def Func ( arg_0 , arg_1 = arg_2 , arg_3 = arg_4 ) : return clean ( arg_0 , tags = arg_1 , attributes = arg_3 , strip = True )

def Func(arg_0, arg_1=arg_2, arg_3=arg_4):
    """Sanitizes HTML, removing not allowed tags and attributes.

    :param str|unicode html:

    :param list allowed_tags: List of allowed tags.
    :param dict allowed_attrs: Dictionary with attributes allowed for tags.

    :rtype: unicode
    """
    return clean(arg_0, tags=arg_1, attributes=arg_3, strip=True)

Sanitizes HTML removing not allowed tags and attributes .


return (first + these_results, term_result)

def Func(arg_0, arg_1):
    """Like many_until but must consume at least one of these.
    """
    arg_2 = [arg_0()]
    arg_3, arg_4 = many_until(arg_0, arg_1)
    return (arg_2 + arg_3, arg_4)

Like many_until but must consume at least one of these .


def Func ( arg_0 , arg_1 = True ) : if arg_1 : yield arg_0 for arg_2 in arg_0 . child_list : yield arg_2 yield from arg_2 . Func ( )

def Func(arg_0, arg_1=True):
        """Descend depth first into all child nodes"""
        if arg_1:
            yield arg_0

        for arg_2 in arg_0.child_list:
            yield arg_2
            yield from arg_2.Func()


def Func ( arg_0 ) : @ wraps ( arg_0 ) def wrapper ( * arg_1 , ** arg_2 ) : arg_1 = ( arg_1 [ 0 ] if len ( arg_1 ) == 1 and isinstance ( arg_1 [ 0 ] , ( list , tuple ) ) else arg_1 ) for arg_3 in arg_1 : if isinstance ( arg_3 , Node ) and arg_3 . parent . name is "root" : arg_3 . parent . remove_child ( arg_3 ) arg_3 . update_child_calls ( ) return arg_0 ( * arg_1 , ** arg_2 ) return wrapper

def Func(arg_0):
    """Decorator for multi to remove nodes for original test functions from root node"""

    @wraps(arg_0)
    def wrapper(*arg_1, **arg_2):
        arg_1 = (
            arg_1[0] if len(arg_1) == 1 and isinstance(arg_1[0], (list, tuple)) else arg_1
        )
        for arg_3 in arg_1:
            if isinstance(arg_3, Node) and arg_3.parent.name is "root":
                arg_3.parent.remove_child(arg_3)
                arg_3.update_child_calls()
        return arg_0(*arg_1, **arg_2)

    return wrapper


def Func ( arg_0 , arg_1 ) : with TemporaryDirectory ( ) as tempdir : arg_2 = join ( tempdir , 'temp_alembic.ini' ) with open ( arg_2 , 'w' ) as f : f . write ( ALEMBIC_INI_TEMPLATE . format ( arg_0 = arg_0 , arg_1 = arg_1 , ) ) yield arg_2

def Func(arg_0, arg_1):
    """
    Temporarily write an alembic.ini file for use with alembic migration
    scripts.
    """
    with TemporaryDirectory() as tempdir:
        arg_2 = join(tempdir, 'temp_alembic.ini')
        with open(arg_2, 'w') as f:
            f.write(
                ALEMBIC_INI_TEMPLATE.format(
                    arg_0=arg_0,
                    arg_1=arg_1,
                )
            )
        yield arg_2

Temporarily write an alembic . ini file for use with alembic migration scripts .


def Func ( arg_0 , arg_1 = "%d:%H:%M:%S" ) : arg_2 = { "%d" : str ( arg_0 . days ) , "%H" : "{0:02d}" . format ( arg_0 . dhours ) , "%h" : str ( 24 * arg_0 . days + arg_0 . dhours ) , "%M" : "{0:02d}" . format ( arg_0 . dminutes ) , "%S" : "{0:02d}" . format ( arg_0 . dseconds ) , } arg_3 = arg_1 for arg_4 , arg_5 in arg_2 . items ( ) : arg_3 = arg_3 . replace ( arg_4 , arg_5 ) return arg_3

def Func(arg_0, arg_1="%d:%H:%M:%S"):
        """Primitive string formatter.

        The only directives understood are the following:
          ============   ==========================
          Directive      meaning
          ============   ==========================
          %d             day as integer
          %H             hour  [00-23]
          %h             hours including days
          %M             minute as integer [00-59]
          %S             second as integer [00-59]
          ============   ==========================
        """
        arg_2 = {
            "%d": str(arg_0.days),
            "%H": "{0:02d}".format(arg_0.dhours),
            "%h": str(24*arg_0.days + arg_0.dhours),
            "%M": "{0:02d}".format(arg_0.dminutes),
            "%S": "{0:02d}".format(arg_0.dseconds),
            }
        arg_3 = arg_1
        for arg_4, arg_5 in arg_2.items():
            arg_3 = arg_3.replace(arg_4, arg_5)
        return arg_3


(self, expression=None, healpix_expression=None, healpix_max_level=12, healpix_level=8, binby=None, limits=None, shape=default_shape, delay=False, progress=None, selection=None)

return self.count(expression, binby=binby, limits=limits, shape=shape, delay=delay, progress=progress, selection=selection)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=12, arg_4=8, arg_5=None, arg_6=None, arg_7=arg_8, arg_9=False, arg_10=None, arg_11=None):
        """Count non missing value for expression on an array which represents healpix data.

        :param expression: Expression or column for which to count non-missing values, or None or '*' for counting the rows
        :param healpix_expression: {healpix_max_level}
        :param healpix_max_level: {healpix_max_level}
        :param healpix_level: {healpix_level}
        :param binby: {binby}, these dimension follow the first healpix dimension.
        :param limits: {limits}
        :param shape: {shape}
        :param selection: {selection}
        :param delay: {delay}
        :param progress: {progress}
        :return:
        """
        # if binby is None:
        import healpy as hp
        if arg_2 is None:
            if arg_0.ucds.get("source_id", None) == 'meta.id;meta.main':  # we now assume we have gaia data
                arg_2 = "source_id/34359738368"

        if arg_2 is None:
            raise ValueError("no healpix_expression given, and was unable to guess")

        arg_12 = arg_3 - arg_4
        arg_13 = 2**arg_4
        arg_14 = hp.nside2npix(arg_13)
        arg_15 = 4**arg_12
        arg_16 = "%s/%s" % (arg_2, arg_15)
        arg_5 = [arg_16] + ([] if arg_5 is None else _ensure_list(arg_5))
        arg_7 = (arg_14,) + _expand_shape(arg_7, len(arg_5) - 1)
        arg_17 = 1. / arg_15 / 2
        arg_6 = [[-arg_17, arg_14 - arg_17]] + ([] if arg_6 is None else arg_6)
        return arg_0.count(arg_1, arg_5=arg_5, arg_6=arg_6, arg_7=arg_7, arg_9=arg_9, arg_10=arg_10, arg_11=arg_11)

Count non missing value for expression on an array which represents healpix data .


(dist, params_event_ndims, params_overrides, slices)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : if not isinstance ( arg_3 , collections . Sequence ) : arg_3 = ( arg_3 , ) arg_4 , arg_5 = getattr ( arg_0 , PROVENANCE_ATTR , ( arg_0 , [ ] ) ) arg_5 += [ ( arg_3 , arg_2 ) ] arg_0 = _apply_slice_sequence ( arg_4 , arg_1 , arg_5 ) setattr ( arg_0 , PROVENANCE_ATTR , ( arg_4 , arg_5 ) ) return arg_0

def Func(arg_0, arg_1, arg_2, arg_3):
  """Slices `dist` along its batch dimensions. Helper for tfd.Distribution.

  Args:
    dist: A `tfd.Distribution` instance.
    params_event_ndims: A `dict` of `str->int` indicating the number of
      dimensions of a given parameter required to parameterize a single event.
    params_overrides: A `dict` of parameter overrides. (e.g. from
      `Distribution.copy`).
    slices: A `slice` or `int` or `int` `Tensor` or `tf.newaxis` or `tuple`
      thereof. (e.g. the argument of a `__getitem__` method).

  Returns:
    new_dist: A batch-sliced `tfd.Distribution`.
  """
  if not isinstance(arg_3, collections.Sequence):
    arg_3 = (arg_3,)
  # We track the history of slice and copy(**param_overrides) in order to trace
  # back to the original distribution's source variables.
  arg_4, arg_5 = getattr(arg_0, PROVENANCE_ATTR, (arg_0, []))
  arg_5 += [(arg_3, arg_2)]
  # Re-doing the full sequence of slice+copy override work here enables
  # gradients all the way back to the original distribution's arguments.
  arg_0 = _apply_slice_sequence(arg_4, arg_1,
                               arg_5)
  setattr(arg_0, PROVENANCE_ATTR, (arg_4, arg_5))
  return arg_0

Slices dist along its batch dimensions . Helper for tfd . Distribution .


def Func ( arg_0 , arg_1 ) : if not arg_0 . available ( ) : return try : arg_0 . prof . close ( ) except AttributeError : pass if arg_0 . clean_stats_file : if arg_0 . fileno : try : os . close ( arg_0 . fileno ) except OSError : pass try : os . unlink ( arg_0 . pfile ) except OSError : pass return None

def Func(arg_0, arg_1):
        """Clean up stats file, if configured to do so.
        """
        if not arg_0.available():
            return
        try:
            arg_0.prof.close()
        except AttributeError:
            # TODO: is this trying to catch just the case where not
            # hasattr(self.prof, "close")?  If so, the function call should be
            # moved out of the try: suite.
            pass
        if arg_0.clean_stats_file:
            if arg_0.fileno:
                try:
                    os.close(arg_0.fileno)
                except OSError:
                    pass
            try:
                os.unlink(arg_0.pfile)
            except OSError:
                pass
        return None

Clean up stats file if configured to do so .


def
Func
(
arg_0
)
:
def
get_total_seconds
(
arg_1
)
:
return
(
arg_1
.
microseconds
+
(
arg_1
.
seconds
+
arg_1
.
days
*
24
*
3600
)
*
1e6
)
/
1e6
arg_2
=
int
(
get_total_seconds
(
arg_0
)
)
arg_3
=
[
(
'year'
,
60
*
60
*
24
*
365
)
,
(
'month'
,
60
*
60
*
24
*
30
)
,
(
'day'
,
60
*
60
*
24
)
,
(
'hour'
,
60
*
60
)
,
(
'minute'
,
60
)
,
(
'second'
,
1
)
]
arg_4
=
[
]
for
arg_5
,
arg_6
in
arg_3
:
if
arg_2
>
arg_6
:
arg_7
,
arg_2
=
divmod
(
arg_2
,
arg_6
)
if
arg_7
==
1
:
arg_4
.
append
(
"%s %s"
%
(
arg_7
,
arg_5
)
)
else
:
arg_4
.
append
(
"%s %ss"
%
(
arg_7
,
arg_5
)
)
return
", "
.
join
(
arg_4
)

def Func(arg_0):
    """Format a timedelta object for display to users

    Returns
    -------
    str
    """
    def get_total_seconds(arg_1):
        # timedelta.total_seconds not in py2.6
        return (arg_1.microseconds +
                (arg_1.seconds + arg_1.days * 24 * 3600) * 1e6) / 1e6

    arg_2 = int(get_total_seconds(arg_0))
    arg_3 = [('year',    60*60*24*365),
               ('month',   60*60*24*30),
               ('day',     60*60*24),
               ('hour',    60*60),
               ('minute',  60),
               ('second',  1)]

    arg_4 = []
    for arg_5, arg_6 in arg_3:
        if arg_2 > arg_6:
            arg_7, arg_2 = divmod(arg_2, arg_6)
            if arg_7 == 1:
                arg_4.append("%s %s" % (arg_7, arg_5))
            else:
                arg_4.append("%s %ss" % (arg_7, arg_5))

    return ", ".join(arg_4)


def Func(arg_0, arg_1):
        """
        Get file information dict from the repository given its relative path.

        :Parameters:
            #. relativePath (string): The relative to the repository path of
               the file.

        :Returns:
            #. info (None, dictionary): The file information dictionary.
               If None, it means an error has occurred.
            #. errorMessage (string): The error message if any error occurred.
        """
        arg_1 = arg_0.to_repo_relative_path(path=arg_1, split=False)
        arg_2     = os.path.basename(arg_1)
        arg_3,arg_4, arg_5, arg_6 = arg_0.is_repository_file(arg_1)
        if not arg_3:
            return None, "file is not a registered repository file."
        if not arg_5:
            return None, "file is a registered repository file but info file missing"
        arg_7 = os.path.join(arg_0.__path,os.path.dirname(arg_1),arg_0.__fileInfo%arg_2)
        try:
            with open(arg_7, 'rb') as fd:
                arg_8 = pickle.load(fd)
        except Exception as err:
            return None, "Unable to read file info from disk (%s)"%str(err)
        return arg_8, ''

Get file information dict from the repository given its relative path .


def Func():
    """
    Get a list of identity providers choices for enterprise customer.

    Return:
        A list of choices of all identity providers, None if it can not get any available identity provider.
    """
    try:
        from third_party_auth.provider import arg_0   # pylint: disable=redefined-outer-name
    except ImportError as exception:
        LOGGER.warning("Could not import Registry from third_party_auth.provider")
        LOGGER.warning(exception)
        arg_0 = None  # pylint: disable=redefined-outer-name

    arg_1 = [("", "-" * 7)]
    if arg_0:
        return arg_1 + [(arg_2.provider_id, arg_2.name) for arg_2 in arg_0.enabled()]
    return None

Get a list of identity providers choices for enterprise customer .


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_0 , Discrete ) : return tf . to_float ( tf . one_hot ( arg_1 , arg_0 . n ) ) elif isinstance ( arg_0 , Box ) : return tf . to_float ( arg_1 ) elif isinstance ( arg_0 , MultiDiscrete ) : arg_1 = tf . cast ( arg_1 , tf . int32 ) arg_2 = [ tf . to_float ( tf . one_hot ( arg_1 [ ... , i ] , arg_0 . nvec [ i ] ) ) for i in range ( arg_1 . shape [ - 1 ] ) ] return tf . concat ( arg_2 , axis = - 1 ) else : raise NotImplementedError

def Func(arg_0, arg_1):
    '''
    Encode input in the way that is appropriate to the observation space

    Parameters:
    ----------

    ob_space: gym.Space             observation space

    placeholder: tf.placeholder     observation input placeholder
    '''
    if isinstance(arg_0, Discrete):
        return tf.to_float(tf.one_hot(arg_1, arg_0.n))
    elif isinstance(arg_0, Box):
        return tf.to_float(arg_1)
    elif isinstance(arg_0, MultiDiscrete):
        arg_1 = tf.cast(arg_1, tf.int32)
        arg_2 = [tf.to_float(tf.one_hot(arg_1[..., i], arg_0.nvec[i])) for i in range(arg_1.shape[-1])]
        return tf.concat(arg_2, axis=-1)
    else:
        raise NotImplementedError


def Func ( arg_0 , arg_1 ) : arg_0 . graph = arg_0 . editor_input . load ( ) arg_3 = View ( Item ( name = "graph" , editor = graph_tree_editor , show_label = False ) , id = "godot.graph_editor" , kind = "live" , resizable = True ) arg_4 = arg_0 . edit_traits ( arg_3 = arg_3 , arg_1 = arg_1 , kind = "subpanel" ) return arg_4

def Func(arg_0, arg_1):
        """ Creates the toolkit-specific control that represents the
            editor. 'parent' is the toolkit-specific control that is
            the editor's parent.
        """
        arg_0.graph = arg_0.editor_input.load()

        arg_3 = View(Item(name="graph", editor=graph_tree_editor,
                show_label=False),
            id="godot.graph_editor", kind="live", resizable=True)

        arg_4 = arg_0.edit_traits(arg_3=arg_3, arg_1=arg_1, kind="subpanel")

        return arg_4

Creates the toolkit - specific control that represents the editor . parent is the toolkit - specific control that is the editor s parent .


def Func ( arg_0 ) : arg_1 = tf . broadcast_to ( arg_0 . _log_init , tf . concat ( [ arg_0 . batch_shape_tensor ( ) , [ arg_0 . _num_states ] ] , axis = 0 ) ) if arg_0 . _num_steps > 1 : arg_2 = arg_0 . _log_trans def forward_step ( arg_3 , arg_4 ) : return _log_vector_matrix ( arg_3 , arg_2 ) arg_5 = tf . zeros ( arg_0 . _num_steps - 1 , dtype = tf . float32 ) arg_6 = tf . scan ( forward_step , arg_5 , initializer = arg_1 , name = "forward_log_probs" ) arg_6 = tf . concat ( [ [ arg_1 ] , arg_6 ] , axis = 0 ) else : arg_6 = arg_1 [ tf . newaxis , ... ] return tf . exp ( arg_6 )

def Func(arg_0):
    """Compute marginal pdf for each individual observable."""

    arg_1 = tf.broadcast_to(arg_0._log_init,
                                        tf.concat([arg_0.batch_shape_tensor(),
                                                   [arg_0._num_states]],
                                                  axis=0))
    # initial_log_probs :: batch_shape num_states

    if arg_0._num_steps > 1:
      arg_2 = arg_0._log_trans

      def forward_step(arg_3, arg_4):
        return _log_vector_matrix(arg_3, arg_2)

      arg_5 = tf.zeros(arg_0._num_steps - 1, dtype=tf.float32)

      arg_6 = tf.scan(forward_step, arg_5,
                                  initializer=arg_1,
                                  name="forward_log_probs")

      arg_6 = tf.concat([[arg_1], arg_6],
                                    axis=0)
    else:
      arg_6 = arg_1[tf.newaxis, ...]

    # returns :: num_steps batch_shape num_states

    return tf.exp(arg_6)

Compute marginal pdf for each individual observable .


(
        x, rescale=None, samplewise_center=False, samplewise_std_normalization=False, channel_index=2, epsilon=1e-7
)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
False
,
arg_3
=
False
,
arg_4
=
2
,
arg_5
=
1e-7
)
:
if
arg_1
:
arg_0
*=
arg_1
if
arg_0
.
shape
[
arg_4
]
==
1
:
if
arg_2
:
arg_0
=
arg_0
np
.
mean
(
arg_0
)
if
arg_3
:
arg_0
=
arg_0
/
np
.
std
(
arg_0
)
return
arg_0
elif
arg_0
.
shape
[
arg_4
]
==
3
:
if
arg_2
:
arg_0
=
arg_0
np
.
mean
(
arg_0
,
axis
=
arg_4
,
keepdims
=
True
)
if
arg_3
:
arg_0
=
arg_0
/
(
np
.
std
(
arg_0
,
axis
=
arg_4
,
keepdims
=
True
)
+
arg_5
)
return
arg_0
else
:
raise
Exception
(
"Unsupported channels %d"
%
arg_0
.
shape
[
arg_4
]
)

def Func(
        arg_0, arg_1=None, arg_2=False, arg_3=False, arg_4=2, arg_5=1e-7
):
    """Normalize an image by rescale, samplewise centering and samplewise centering in order.

    Parameters
    -----------
    x : numpy.array
        An image with dimension of [row, col, channel] (default).
    rescale : float
        Rescaling factor. If None or 0, no rescaling is applied, otherwise we multiply the data by the value provided (before applying any other transformation)
    samplewise_center : boolean
        If True, set each sample mean to 0.
    samplewise_std_normalization : boolean
        If True, divide each input by its std.
    epsilon : float
        A small position value for dividing standard deviation.

    Returns
    -------
    numpy.array
        A processed image.

    Examples
    --------
    >>> x = Func(x, samplewise_center=True, samplewise_std_normalization=True)
    >>> print(x.shape, np.mean(x), np.std(x))
    (160, 176, 1), 0.0, 1.0

    Notes
    ------
    When samplewise_center and samplewise_std_normalization are True.
    - For greyscale image, every pixels are subtracted and divided by the mean and std of whole image.
    - For RGB image, every pixels are subtracted and divided by the mean and std of this pixel i.e. the mean and std of a pixel is 0 and 1.

    """
    if arg_1:
        arg_0 *= arg_1

    if arg_0.shape[arg_4] == 1:
        # greyscale
        if arg_2:
            arg_0 = arg_0 - np.mean(arg_0)
        if arg_3:
            arg_0 = arg_0 / np.std(arg_0)
        return arg_0
    elif arg_0.shape[arg_4] == 3:
        # rgb
        if arg_2:
            arg_0 = arg_0 - np.mean(arg_0, axis=arg_4, keepdims=True)
        if arg_3:
            arg_0 = arg_0 / (np.std(arg_0, axis=arg_4, keepdims=True) + arg_5)
        return arg_0
    else:
        raise Exception("Unsupported channels %d" % arg_0.shape[arg_4])

Normalize an image by rescale, samplewise centering and samplewise centering in order.

    Parameters
    -----------
    x : numpy.array
        An image with dimension of [row, col, channel] (default).
    rescale : float
        Rescaling factor. If None or 0, no rescaling is applied, otherwise we multiply the data by the value provided (before applying any other transformation)
    samplewise_center : boolean
        If True, set each sample mean to 0.
    samplewise_std_normalization : boolean
        If True, divide each input by its std.
    epsilon : float
        A small position value for dividing standard deviation.

    Returns
    -------
    numpy.array
        A processed image.

    Examples
    --------
    >>> x = samplewise_norm(x, samplewise_center=True, samplewise_std_normalization=True)
    >>> print(x.shape, np.mean(x), np.std(x))
    (160, 176, 1), 0.0, 1.0

    Notes
    ------
    When samplewise_center and samplewise_std_normalization are True.
    - For greyscale image, every pixels are subtracted and divided by the mean and std of whole image.
    - For RGB image, every pixels are subtracted and divided by the mean and std of this pixel i.e. the mean and std of a pixel is 0 and 1.

Normalize an image by rescale samplewise centering and samplewise centering in order .


def Func(arg_0, arg_1, arg_2, arg_3):  # pylint: disable=invalid-name,unused-argument
        """
        Return the metadata for the specified course run.

        The course run needs to be included in the specified EnterpriseCustomerCatalog
        in order for metadata to be returned from this endpoint.
        """
        arg_4 = arg_0.get_object()
        arg_5 = arg_4.get_course_run(arg_3)
        if not arg_5:
            raise Http404

        arg_6 = arg_0.get_serializer_context()
        arg_6['enterprise_customer_catalog'] = arg_4
        arg_7 = serializers.CourseRunDetailSerializer(arg_5, arg_6=arg_6)
        return Response(arg_7.data)

Return the metadata for the specified course run .


def Func ( arg_0 , ** arg_1 ) : Func = arg_0 . _query ( 'edges' , ** arg_1 ) for arg_3 in Func : arg_4 = arg_3 [ 'source_type' ] + '[' + arg_3 [ 'source_title' ] + ']' arg_5 = arg_3 [ 'target_type' ] + '[' + arg_3 [ 'target_title' ] + ']' yield Edge ( source = arg_0 . resources [ arg_4 ] , target = arg_0 . resources [ arg_5 ] , relationship = arg_3 [ 'relationship' ] , node = arg_3 [ 'certname' ] )

def Func(arg_0, **arg_1):
        """Get the known catalog edges, formed between two resources.

        :param \*\*kwargs: The rest of the keyword arguments are passed
                           to the _query function.

        :returns: A generating yielding Edges.
        :rtype: :class:`pypuppetdb.types.Edge`
        """
        Func = arg_0._query('edges', **arg_1)

        for arg_3 in Func:
            arg_4 = arg_3['source_type'] + \
                '[' + arg_3['source_title'] + ']'
            arg_5 = arg_3['target_type'] + \
                '[' + arg_3['target_title'] + ']'
            yield Edge(source=arg_0.resources[arg_4],
                       target=arg_0.resources[arg_5],
                       relationship=arg_3['relationship'],
                       node=arg_3['certname'])

Get the known catalog edges formed between two resources .


def Func(arg_0, arg_1, arg_2=None):
        """Inverse of dict_to_list"""
        arg_2 = arg_0._keys if arg_2 is None else arg_2
        arg_3 = arg_0._defaults(arg_2)
        for arg_4,arg_5 in zip(arg_2, arg_1):
            arg_3[arg_4] = arg_5

        return arg_3


def Func ( arg_0 ) : arg_0 = arg_0 . split ( '.' ) arg_1 = '.' . join ( arg_0 [ : - 1 ] ) arg_0 = arg_0 [ - 1 ] try : if not arg_1 : arg_0 = __import__ ( arg_0 ) else : arg_1 = __import__ ( arg_1 , fromlist = [ arg_0 ] ) arg_0 = getattr ( arg_1 , arg_0 , None ) arg_2 = getattr ( arg_0 , '__file__' , None ) if not arg_2 : return Unparseable ( ) if arg_2 . endswith ( '.pyc' ) : arg_2 = arg_2 [ : - 1 ] if not os . path . exists ( arg_2 ) and os . path . isfile ( arg_2 ) : return Unparseable ( ) if arg_2 . endswith ( '__init__.py' ) : arg_2 = arg_2 [ : - 11 ] return arg_2 except ImportError : return

def Func(arg_0):
    """
    Return the filename of `module` if it can be imported.

    If `module` is a package, its directory will be returned.

    If it cannot be imported ``None`` is returned.

    If the ``__file__`` attribute is missing, or the module or package is a
    compiled egg, then an :class:`Unparseable` instance is returned, since the
    source can't be retrieved.

    :param module: A module name, such as ``'test.test_config'``
    :type module: str

    """
    # Split up the module and its containing package, if it has one
    arg_0 = arg_0.split('.')
    arg_1 = '.'.join(arg_0[:-1])
    arg_0 = arg_0[-1]

    try:
        if not arg_1:
            # We aren't accessing a module within a package, but rather a top
            # level package, so it's a straight up import
            arg_0 = __import__(arg_0)
        else:
            # Import the package containing our desired module
            arg_1 = __import__(arg_1, fromlist=[arg_0])
            # Get the module from that package
            arg_0 = getattr(arg_1, arg_0, None)

        arg_2 = getattr(arg_0, '__file__', None)
        if not arg_2:
            # No filename? Nothing to do here
            return Unparseable()

        # If we get a .pyc, strip the c to get .py so we can parse the source
        if arg_2.endswith('.pyc'):
            arg_2 = arg_2[:-1]
            if not os.path.exists(arg_2) and os.path.isfile(arg_2):
                # If there's only a .pyc and no .py it's a compile package or
                # egg and we can't get at the source for parsing
                return Unparseable()
        # If we have a package, we want the directory not the init file
        if arg_2.endswith('__init__.py'):
            arg_2 = arg_2[:-11]

        # Yey, we found it
        return arg_2
    except ImportError:
        # Definitely not a valid module or package
        return

Return the filename of module if it can be imported .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = [ ] for arg_4 in arg_0 : if arg_4 is None : arg_3 . append ( None ) else : arg_5 = arg_4 . shape [ 0 ] // arg_2 arg_6 = np . eye ( arg_2 ) arg_7 = [ ] for arg_8 in range ( arg_5 ) : arg_9 = np . zeros ( arg_5 ) arg_9 [ arg_8 ] = 1 arg_7 . append ( np . kron ( arg_6 , arg_9 [ None , : ] ) . dot ( arg_4 ) ) arg_3 . append ( arg_7 ) return tuple ( arg_3 )

def Func(arg_0, arg_1, arg_2):
    """Transform Stinespring representation to Kraus representation."""
    arg_3 = []
    for arg_4 in arg_0:
        if arg_4 is None:
            arg_3.append(None)
        else:
            arg_5 = arg_4.shape[0] // arg_2
            arg_6 = np.eye(arg_2)
            arg_7 = []
            for arg_8 in range(arg_5):
                arg_9 = np.zeros(arg_5)
                arg_9[arg_8] = 1
                arg_7.append(np.kron(arg_6, arg_9[None, :]).dot(arg_4))
            arg_3.append(arg_7)
    return tuple(arg_3)

Transform Stinespring representation to Kraus representation .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 [ 'status' ] arg_3 = arg_1 [ 'msg' ] if arg_2 == 400 : raise BadRequestException ( arg_3 ) elif arg_2 == 403 : raise PermissionDeniedException ( arg_3 ) elif arg_2 == 404 : raise FileNotFoundException ( arg_3 ) elif arg_2 == 451 : raise UnavailableForLegalReasonsException ( arg_3 ) elif arg_2 == 509 : raise BandwidthUsageExceeded ( arg_3 ) elif arg_2 >= 500 : raise ServerErrorException ( arg_3 )

def Func(arg_0, arg_1):
        """Check the status of the incoming response, raise exception if status is not 200.

        Args:
            response_json (dict): results of the response of the GET request.

        Returns:
           None

        """
        arg_2 = arg_1['status']
        arg_3 = arg_1['msg']

        if arg_2 == 400:
            raise BadRequestException(arg_3)
        elif arg_2 == 403:
            raise PermissionDeniedException(arg_3)
        elif arg_2 == 404:
            raise FileNotFoundException(arg_3)
        elif arg_2 == 451:
            raise UnavailableForLegalReasonsException(arg_3)
        elif arg_2 == 509:
            raise BandwidthUsageExceeded(arg_3)
        elif arg_2 >= 500:
            raise ServerErrorException(arg_3)

Check the status of the incoming response raise exception if status is not 200 .


def Func(arg_0):
    """
    memoization decorator that respects args and kwargs

    References:
        https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize

    Args:
        func (Callable): live python function

    Returns:
        func: Funcd wrapper

    CommandLine:
        xdoctest -m ubelt.util_Func Func

    Example:
        >>> import ubelt as ub
        >>> closure = {'a': 'b', 'c': 'd'}
        >>> incr = [0]
        >>> def foo(key):
        >>>     value = closure[key]
        >>>     incr[0] += 1
        >>>     return value
        >>> foo_memo = ub.Func(foo)
        >>> assert foo('a') == 'b' and foo('c') == 'd'
        >>> assert incr[0] == 2
        >>> print('Call Funcd version')
        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'
        >>> assert incr[0] == 4
        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'
        >>> print('Counter should no longer increase')
        >>> assert incr[0] == 4
        >>> print('Closure changes result without memoization')
        >>> closure = {'a': 0, 'c': 1}
        >>> assert foo('a') == 0 and foo('c') == 1
        >>> assert incr[0] == 6
        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'
    """
    arg_1 = {}
    @functools.wraps(arg_0)
    def arg_5(*arg_2, **arg_3):
        arg_4 = _make_signature_key(arg_2, arg_3)
        if arg_4 not in arg_1:
            arg_1[arg_4] = arg_0(*arg_2, **arg_3)
        return arg_1[arg_4]
    arg_5.cache = arg_1
    return arg_5

memoization decorator that respects args and kwargs

    References:
        https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize

    Args:
        func (Callable): live python function

    Returns:
        func: memoized wrapper

    CommandLine:
        xdoctest -m ubelt.util_memoize memoize

    Example:
        >>> import ubelt as ub
        >>> closure = {'a': 'b', 'c': 'd'}
        >>> incr = [0]
        >>> def foo(key):
        >>>     value = closure[key]
        >>>     incr[0] += 1
        >>>     return value
        >>> foo_memo = ub.memoize(foo)
        >>> assert foo('a') == 'b' and foo('c') == 'd'
        >>> assert incr[0] == 2
        >>> print('Call memoized version')
        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'
        >>> assert incr[0] == 4
        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'
        >>> print('Counter should no longer increase')
        >>> assert incr[0] == 4
        >>> print('Closure changes result without memoization')
        >>> closure = {'a': 0, 'c': 1}
        >>> assert foo('a') == 0 and foo('c') == 1
        >>> assert incr[0] == 6
        >>> assert foo_memo('a') == 'b' and foo_memo('c') == 'd'


def Func ( arg_0 , arg_1 , arg_2 = True ) : if arg_2 : if hasattr ( arg_0 . condition , "remainder" ) : return arg_0 . condition . remainder arg_3 = type ( arg_0 . condition ) . objects . filter ( pk = arg_0 . condition . id ) arg_3 = arg_0 . pre_filter ( arg_3 , arg_1 ) if len ( arg_3 ) > 0 : return arg_3 [ 0 ] . remainder else : return 0

def Func(arg_0, arg_1, arg_2=True):
        ''' returns 0 if the date range is violated, otherwise, it will return
        the quantity remaining under the stock limit.

        The filter for this condition must add an annotation called "remainder"
        in order for this to work.
        '''

        if arg_2:
            if hasattr(arg_0.condition, "remainder"):
                return arg_0.condition.remainder

        # Mark self.condition with a remainder
        arg_3 = type(arg_0.condition).objects.filter(pk=arg_0.condition.id)
        arg_3 = arg_0.pre_filter(arg_3, arg_1)

        if len(arg_3) > 0:
            return arg_3[0].remainder
        else:
            return 0

returns 0 if the date range is violated otherwise it will return the quantity remaining under the stock limit .


def
Func
(
arg_0
,
arg_1
)
:
if
not
isinstance
(
arg_1
,
PKey
)
:
raise
TypeError
(
"pkey must be a PKey instance"
)
arg_2
=
_lib
.
X509_REQ_Func
(
arg_0
.
_req
,
arg_1
.
_pkey
)
if
arg_2
<=
0
:
_raise_current_error
(
)
return
arg_2

def Func(arg_0, arg_1):
        """
        Verifies the signature on this certificate signing request.

        :param PKey key: A public key.

        :return: ``True`` if the signature is correct.
        :rtype: bool

        :raises OpenSSL.crypto.Error: If the signature is invalid or there is a
            problem Funcing the signature.
        """
        if not isinstance(arg_1, PKey):
            raise TypeError("pkey must be a PKey instance")

        arg_2 = _lib.X509_REQ_Func(arg_0._req, arg_1._pkey)
        if arg_2 <= 0:
            _raise_current_error()

        return arg_2

Verifies the signature on this certificate signing request.

        :param PKey key: A public key.

        :return: ``True`` if the signature is correct.
        :rtype: bool

        :raises OpenSSL.crypto.Error: If the signature is invalid or there is a
            problem verifying the signature.

Verifies the signature on this certificate signing request .


def Func(arg_0):
  """ Return the class corresponding to the given temporalImp string
  """

  if arg_0 == 'py':
    return backtracking_tm.BacktrackingTM
  elif arg_0 == 'cpp':
    return backtracking_tm_cpp.BacktrackingTMCPP
  elif arg_0 == 'tm_py':
    return backtracking_tm_shim.TMShim
  elif arg_0 == 'tm_cpp':
    return backtracking_tm_shim.TMCPPShim
  elif arg_0 == 'monitored_tm_py':
    return backtracking_tm_shim.MonitoredTMShim
  else:
    raise RuntimeError("Invalid temporalImp '%s'. Legal values are: 'py', "
              "'cpp', 'tm_py', 'monitored_tm_py'" % (arg_0))


(harmonic_out, x, freqs, h_range, kind='linear', fill_value=0,
                 axis=0)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = 'linear' , arg_5 = 0 , arg_6 = 0 ) : arg_7 = [ slice ( None ) ] * arg_1 . ndim arg_8 = [ slice ( None ) ] * arg_1 . ndim arg_9 = [ slice ( None ) ] * arg_0 . ndim arg_10 = ( 1 + arg_6 ) % arg_1 . ndim for arg_11 in range ( arg_1 . shape [ arg_10 ] ) : arg_7 [ arg_10 ] = slice ( arg_11 , arg_11 + 1 ) arg_8 [ arg_10 ] = arg_11 arg_9 [ 1 + arg_10 ] = arg_7 [ arg_10 ] harmonics_1d ( arg_0 [ tuple ( arg_9 ) ] , arg_1 [ tuple ( arg_7 ) ] , arg_2 [ tuple ( arg_8 ) ] , arg_3 , arg_4 = arg_4 , arg_5 = arg_5 , arg_6 = arg_6 )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4='linear', arg_5=0,
                 arg_6=0):
    '''Populate a harmonic tensor from a time-frequency representation with
    time-varying frequencies.

    Parameters
    ----------
    harmonic_out : np.ndarray
        The output array to store harmonics

    x : np.ndarray
        The input energy

    freqs : np.ndarray, shape=x.shape
        The frequency values corresponding to each element of `x`

    h_range : list-like, non-negative
        Harmonics to compute.  The first harmonic (1) corresponds to `x`
        itself.  Values less than one (e.g., 1/2) correspond to
        sub-harmonics.

    kind : str
        Interpolation type.  See `scipy.interpolate.interp1d`.

    fill_value : float
        The value to fill when extrapolating beyond the observed
        frequency range.

    axis : int
        The axis along which to compute harmonics

    See Also
    --------
    harmonics
    harmonics_1d
    '''
    arg_7 = [slice(None)] * arg_1.ndim
    arg_8 = [slice(None)] * arg_1.ndim
    arg_9 = [slice(None)] * arg_0.ndim

    # This is the non-interpolation axis
    arg_10 = (1 + arg_6) % arg_1.ndim

    # For each value in the non-interpolated axis, compute its harmonics
    for arg_11 in range(arg_1.shape[arg_10]):
        arg_7[arg_10] = slice(arg_11, arg_11 + 1)
        arg_8[arg_10] = arg_11
        arg_9[1 + arg_10] = arg_7[arg_10]

        harmonics_1d(arg_0[tuple(arg_9)], arg_1[tuple(arg_7)], arg_2[tuple(arg_8)],
                     arg_3, arg_4=arg_4, arg_5=arg_5,
                     arg_6=arg_6)

Populate a harmonic tensor from a time - frequency representation with time - varying frequencies .


return '\n\n'.join([
            self.INSTRUCTIONS.strip(),
            '*Supported methods:*',
            'If you send "@{}: help" to me I reply with these '
            'instructions.'.format(self.user),
            'If you send "@{}: version" to me I reply with my current '
            'version.'.format(self.user),
        ] + [filter.description() for filter in filters])

def Func(arg_0, arg_1):
        """Generates the instructions for a bot and its filters.

        Note:
          The guidance for each filter is generated by combining the
          docstrings of the predicate filter and resulting dispatch
          function with a single space between. The class's
          :py:attr:`INSTRUCTIONS` and the default help command are
          added.

        Arguments:
          filters (:py:class:`list`): The filters to apply to incoming
            messages.

        Returns:
          :py:class:`str`: The bot's instructions.

        """
        return '\n\n'.join([
            arg_0.INSTRUCTIONS.strip(),
            '*Supported methods:*',
            'If you send "@{}: help" to me I reply with these '
            'instructions.'.format(arg_0.user),
            'If you send "@{}: version" to me I reply with my current '
            'version.'.format(arg_0.user),
        ] + [arg_2.description() for arg_2 in arg_1])

Generates the instructions for a bot and its filters .


def Func(arg_0, arg_1, arg_2, arg_3):
        """ Handles mapping elements to diagram components """

        arg_4 = arg_0.diagram.diagram_canvas
        arg_5 = XDotParser()

        for arg_6 in arg_3.added:
            logger.debug("Mapping new element [%s] to diagram node" % arg_6)
            for arg_7 in arg_0.nodes:
                arg_8 = arg_2[:-6] #strip '_items'
                if arg_7.containment_trait == arg_8:
                    arg_9 = arg_7.dot_node
                    arg_10 = Dot()
                    arg_11 = Node(str(id(arg_6)))
                    arg_0._style_node(arg_11, arg_9)
                    arg_10.add_node(arg_11)
                    arg_12 = graph_from_dot_data(arg_10.create(arg_0.program,"xdot"))
                    arg_13 = arg_5.parse_nodes(arg_12)#.get_node_list())
                    for arg_14 in arg_13:
                        if arg_14 is not None:
                            arg_14.element = arg_6
                            # Tools
                            for arg_15 in arg_7.tools:
                                arg_14.tools.append(arg_15(arg_14))

                            arg_4.add(arg_14)
                            arg_4.request_redraw()

        for arg_6 in arg_3.removed:
            logger.debug("Unmapping element [%s] from diagram" % arg_6)
            for arg_16 in arg_4.components:
                if arg_6 == arg_16.element:
                    arg_4.remove(arg_16)
                    arg_4.request_redraw()
                    break


def Func ( arg_0 ) : arg_1 = lambda x , p : ( x . ljust ( 3 + arg_4 , "0" ) [ : p ] , x [ p : ] . rstrip ( "0" ) ) arg_2 , arg_3 = to_scientific_tuple ( arg_0 ) arg_2 , arg_4 = arg_2 . replace ( "." , "" ) , arg_2 . startswith ( "-" ) arg_5 = "." . join ( filter ( None , arg_1 ( arg_2 , 1 + ( arg_3 % 3 ) + arg_4 ) ) ) arg_6 = int ( 3 * math . floor ( arg_3 / 3 ) ) return NumComp ( arg_5 , arg_6 )

def Func(arg_0):
    """
    Return tuple with mantissa and exponent of number formatted in engineering notation.

    :param number: Number
    :type  number: integer or float

    :rtype: tuple
    """
    # pylint: disable=W0141
    # Helper function: split integer and fractional part of mantissa
    #  + ljust ensures that integer part in engineering notation has
    #    at most 3 digits (say if number given is 1E4)
    #  + rstrip ensures that there is no empty fractional part
    arg_1 = lambda x, p: (x.ljust(3 + arg_4, "0")[:p], x[p:].rstrip("0"))
    # Convert number to scientific notation, a "constant" format
    arg_2, arg_3 = to_scientific_tuple(arg_0)
    arg_2, arg_4 = arg_2.replace(".", ""), arg_2.startswith("-")
    # New values
    arg_5 = ".".join(filter(None, arg_1(arg_2, 1 + (arg_3 % 3) + arg_4)))
    arg_6 = int(3 * math.floor(arg_3 / 3))
    return NumComp(arg_5, arg_6)

Return tuple with mantissa and exponent of number formatted in engineering notation .


(self, features, classes, scoring_function=None, **scoring_function_kwargs)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = None , ** arg_4 ) : arg_5 = arg_0 . ensemble . predict ( arg_1 ) if arg_3 is None : return accuracy_Func ( arg_2 , arg_5 ) else : return arg_3 ( arg_2 , arg_5 , ** arg_4 )

def Func(arg_0, arg_1, arg_2, arg_3=None, **arg_4):
        """Estimates the accuracy of the predictions from the MDR ensemble

        Parameters
        ----------
        features: array-like {n_samples, n_features}
            Feature matrix to predict from
        classes: array-like {n_samples}
            List of true class labels

        Returns
        -------
        accuracy_Func: float
            The estimated accuracy based on the constructed feature

        """
        arg_5 = arg_0.ensemble.predict(arg_1)

        if arg_3 is None:
            return accuracy_Func(arg_2, arg_5)
        else:
            return arg_3(arg_2, arg_5, **arg_4)

Estimates the accuracy of the predictions from the MDR ensemble

        Parameters
        ----------
        features: array-like {n_samples, n_features}
            Feature matrix to predict from
        classes: array-like {n_samples}
            List of true class labels

        Returns
        -------
        accuracy_score: float
            The estimated accuracy based on the constructed feature


return dict(institute=institute_obj, case=case_obj, **data)

def Func ( arg_0 , arg_1 ) : arg_2 , arg_3 = institute_and_Func ( store , arg_0 , arg_1 ) arg_4 = controllers . Func ( store , arg_2 , arg_3 ) return dict ( institute = arg_2 , Func = arg_3 , ** arg_4 )

def Func(arg_0, arg_1):
    """Display one Func."""
    arg_2, arg_3 = institute_and_Func(store, arg_0, arg_1)
    arg_4 = controllers.Func(store, arg_2, arg_3)
    return dict(institute=arg_2, Func=arg_3, **arg_4)