(name: str,
                      version: Optional[str] = None,
                      description: Optional[str] = None,
                      authors: Optional[str] = None,
                      contact: Optional[str] = None,
                      copyright: Optional[str] = None,
                      licenses: Optional[str] = None,
                      disclaimer: Optional[str] = None,
                      namespace_url: Optional[Mapping[str, str]] = None,
                      namespace_patterns: Optional[Mapping[str, str]] = None,
                      annotation_url: Optional[Mapping[str, str]] = None,
                      annotation_patterns: Optional[Mapping[str, str]] = None,
                      annotation_list: Optional[Mapping[str, Set[str]]] = None,
                      pmids: Optional[Iterable[Union[str, int]]] = None,
                      entrez_ids: Optional[Iterable[Union[str, int]]] = None,
                      file: Optional[TextIO] = None,
                      )

def Func(arg_0: arg_1,
                      arg_2: arg_3[arg_1] = None,
                      arg_4: arg_3[arg_1] = None,
                      arg_5: arg_3[arg_1] = None,
                      arg_6: arg_3[arg_1] = None,
                      arg_7: arg_3[arg_1] = None,
                      arg_8: arg_3[arg_1] = None,
                      arg_9: arg_3[arg_1] = None,
                      arg_10: arg_3[arg_11[arg_1, arg_1]] = None,
                      arg_12: arg_3[arg_11[arg_1, arg_1]] = None,
                      arg_13: arg_3[arg_11[arg_1, arg_1]] = None,
                      arg_14: arg_3[arg_11[arg_1, arg_1]] = None,
                      arg_15: arg_3[arg_11[arg_1, arg_16[arg_1]]] = None,
                      arg_17: arg_3[arg_18[arg_19[arg_1, arg_20]]] = None,
                      arg_21: arg_3[arg_18[arg_19[arg_1, arg_20]]] = None,
                      arg_22: arg_3[arg_23] = None,
                      ) -> None:
    """Write a boilerplate BEL document, with standard document metadata, definitions.

    :param name: The unique name for this BEL document
    :param contact: The email address of the maintainer
    :param description: A description of the contents of this document
    :param authors: The authors of this document
    :param version: The version. Defaults to current date in format ``YYYYMMDD``.
    :param copyright: Copyright information about this document
    :param licenses: The license applied to this document
    :param disclaimer: The disclaimer for this document
    :param namespace_url: an optional dictionary of {str name: str URL} of namespaces
    :param namespace_patterns: An optional dictionary of {str name: str regex} namespaces
    :param annotation_url: An optional dictionary of {str name: str URL} of annotations
    :param annotation_patterns: An optional dictionary of {str name: str regex} of regex annotations
    :param annotation_list: An optional dictionary of {str name: set of names} of list annotations
    :param pmids: A list of PubMed identifiers to auto-populate with citation and abstract
    :param entrez_ids: A list of Entrez identifiers to autopopulate the gene summary as evidence
    :param file: A writable file or file-like. If None, defaults to :data:`sys.stdout`
    """
    arg_24 = make_knowledge_header(
        arg_0=arg_0,
        arg_2=arg_2 or '1.0.0',
        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_12=arg_12,
        arg_13=arg_13,
        arg_14=arg_14,
        arg_15=arg_15,
    )

    for arg_25 in arg_24:
        print(arg_25, arg_22=arg_22)

    if arg_17 is not None:
        for arg_25 in make_pubmed_abstract_group(arg_17):
            print(arg_25, arg_22=arg_22)

    if arg_21 is not None:
        for arg_25 in make_pubmed_gene_group(arg_21):
            print(arg_25, arg_22=arg_22)

Write a boilerplate BEL document with standard document metadata definitions .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
**
arg_3
)
:
arg_4
=
{
'allow_redirects'
:
True
,
'auth'
:
arg_0
.
_auth
,
'data'
:
{
}
,
'files'
:
,
'headers'
:
dict
(
arg_0
.
_headers
)
,
'params'
:
{
}
,
'timeout'
:
80
,
'verify'
:
True
}
arg_5
=
arg_3
.
pop
(
'raw'
,
False
)
arg_6
=
arg_3
.
pop
(
'debug'
,
False
)
arg_4
.
update
(
arg_3
)
arg_1
=
arg_1
.
upper
(
)
if
arg_4
[
'files'
]
:
arg_4
[
'headers'
]
.
pop
(
'Content-Type'
,
)
else
:
arg_4
[
'data'
]
=
json
.
dumps
(
arg_4
[
'data'
]
)
if
not
arg_2
.
startswith
(
arg_0
.
_host
)
:
arg_2
=
urljoin
(
arg_0
.
_host
,
arg_2
)
logger
.
debug
(
'API %s Request: %s'
%
(
arg_1
,
arg_2
)
)
if
arg_6
:
arg_0
.
_log_raw_Func
(
arg_1
,
arg_2
,
**
arg_4
)
try
:
arg_7
=
arg_0
.
_session
.
Func
(
arg_1
,
arg_2
,
**
arg_4
)
except
Exception
as
e
:
_handle_Func_error
(
e
)
if
429
==
arg_7
.
status_code
:
arg_8
=
int
(
arg_7
.
headers
[
'retry-after'
]
)
+
1
logger
.
warn
(
'Too many Funcs. Retrying in {0}s.'
.
format
(
arg_8
)
)
time
.
sleep
(
arg_8
)
return
arg_0
.
Func
(
arg_1
,
arg_2
,
**
arg_3
)
if
not
(
200
<=
arg_7
.
status_code
<
400
)
:
_handle_api_error
(
arg_7
)
if
arg_5
or
arg_7
.
status_code
in
[
204
,
301
,
302
]
:
return
arg_7
return
arg_7
.
json
(
)

def Func(arg_0, arg_1, arg_2, **arg_3):
        """
        Issues an HTTP Request across the wire via the Python Funcs
        library.

        Parameters
        ----------

        method : str
           an HTTP method: GET, PUT, POST, DELETE, ...

        url : str
           the place to connect to. If the url doesn't start
           with a protocol (https:// or http://), we'll slap
                solvebio.api_host in the front.

        allow_redirects: bool, optional
           set *False* we won't follow any redirects

        headers: dict, optional

          Custom headers can be provided here; generally though this
          will be set correctly by default dependent on the
          method type. If the content type is JSON, we'll
          JSON-encode params.

        param : dict, optional
           passed as *params* in the Funcs.Func

        timeout : int, optional
          timeout value in seconds for the Func

        raw: bool, optional
          unless *True* the response encoded to json

        files: file
          File content in the form of a file handle which is to be
          uploaded. Files are passed in POST Funcs

        Returns
        -------
        response object. If *raw* is not *True* and
        repsonse if valid the object will be JSON encoded. Otherwise
        it will be the Func.reposne object.
        """

        arg_4 = {
            'allow_redirects': True,
            'auth': arg_0._auth,
            'data': {},
            'files': None,
            'headers': dict(arg_0._headers),
            'params': {},
            'timeout': 80,
            'verify': True
        }

        arg_5 = arg_3.pop('raw', False)
        arg_6 = arg_3.pop('debug', False)
        arg_4.update(arg_3)
        arg_1 = arg_1.upper()

        if arg_4['files']:
            # Don't use application/json for file uploads or GET Funcs
            arg_4['headers'].pop('Content-Type', None)
        else:
            arg_4['data'] = json.dumps(arg_4['data'])

        if not arg_2.startswith(arg_0._host):
            arg_2 = urljoin(arg_0._host, arg_2)

        logger.debug('API %s Request: %s' % (arg_1, arg_2))

        if arg_6:
            arg_0._log_raw_Func(arg_1, arg_2, **arg_4)

        try:
            arg_7 = arg_0._session.Func(arg_1, arg_2, **arg_4)
        except Exception as e:
            _handle_Func_error(e)

        if 429 == arg_7.status_code:
            arg_8 = int(arg_7.headers['retry-after']) + 1
            logger.warn('Too many Funcs. Retrying in {0}s.'.format(arg_8))
            time.sleep(arg_8)
            return arg_0.Func(arg_1, arg_2, **arg_3)

        if not (200 <= arg_7.status_code < 400):
            _handle_api_error(arg_7)

        # 204 is used on deletion. There is no JSON here.
        if arg_5 or arg_7.status_code in [204, 301, 302]:
            return arg_7

        return arg_7.json()

Issues an HTTP Request across the wire via the Python requests
        library.

        Parameters
        ----------

        method : str
           an HTTP method: GET, PUT, POST, DELETE, ...

        url : str
           the place to connect to. If the url doesn't start
           with a protocol (https:// or http://), we'll slap
                solvebio.api_host in the front.

        allow_redirects: bool, optional
           set *False* we won't follow any redirects

        headers: dict, optional

          Custom headers can be provided here; generally though this
          will be set correctly by default dependent on the
          method type. If the content type is JSON, we'll
          JSON-encode params.

        param : dict, optional
           passed as *params* in the requests.request

        timeout : int, optional
          timeout value in seconds for the request

        raw: bool, optional
          unless *True* the response encoded to json

        files: file
          File content in the form of a file handle which is to be
          uploaded. Files are passed in POST requests

        Returns
        -------
        response object. If *raw* is not *True* and
        repsonse if valid the object will be JSON encoded. Otherwise
        it will be the request.reposne object.

Issues an HTTP Request across the wire via the Python requests library .


def Func ( arg_0 , arg_1 = None , arg_2 = False ) : arg_0 = list ( arg_0 ) try : gevent . joinall ( arg_0 , arg_1 = arg_1 , arg_2 = arg_2 ) except gevent . GreenletExit : [ arg_3 . kill ( ) for arg_3 in arg_0 if not arg_3 . ready ( ) ] raise return arg_0

def Func(arg_0, arg_1=None, arg_2=False):
    """
    Wrapper for gevent.joinall if the greenlet that waits for the joins is killed, it kills all the greenlets it
    joins for.
    """
    arg_0 = list(arg_0)
    try:
        gevent.joinall(arg_0, arg_1=arg_1, arg_2=arg_2)
    except gevent.GreenletExit:
        [arg_3.kill() for arg_3 in arg_0 if not arg_3.ready()]
        raise
    return arg_0

Wrapper for gevent . joinall if the greenlet that waits for the joins is killed it kills all the greenlets it joins for .


def
Func
(
arg_0
,
arg_1
)
:
if
arg_0
.
values
:
for
arg_2
in
arg_0
.
attrs
:
if
arg_1
[
arg_2
]
not
in
arg_0
.
values
[
arg_2
]
:
raise
ValueError
(
'Bad value %s for attribute %s in %s'
%
(
arg_1
[
arg_2
]
,
arg_0
.
attrnames
[
arg_2
]
,
arg_1
)
)

def Func(arg_0, arg_1):
        "Raise ValueError if example has any invalid values."
        if arg_0.values:
            for arg_2 in arg_0.attrs:
                if arg_1[arg_2] not in arg_0.values[arg_2]:
                    raise ValueError('Bad value %s for attribute %s in %s' %
                                     (arg_1[arg_2], arg_0.attrnames[arg_2], arg_1))

Raise ValueError if example has any invalid values .


def Func(arg_0):
    """Validate parsed client secrets from a file.

    Args:
        clientsecrets_dict: dict, a dictionary holding the client secrets.

    Returns:
        tuple, a string of the client type and the information parsed
        from the file.
    """
    arg_1 = (
        'Invalid file format. See '
        'https://developers.google.com/api-client-library/'
        'python/guide/aaa_client_secrets')

    if arg_0 is None:
        raise InvalidClientSecretsError(arg_1)
    try:
        (arg_2, arg_3), = arg_0.items()
    except (ValueError, AttributeError):
        raise InvalidClientSecretsError(
            arg_1 + ' '
            'Expected a JSON object with a single property for a "web" or '
            '"installed" application')

    if arg_2 not in VALID_CLIENT:
        raise InvalidClientSecretsError(
            'Unknown client type: {0}.'.format(arg_2))

    for arg_4 in VALID_CLIENT[arg_2]['required']:
        if arg_4 not in arg_3:
            raise InvalidClientSecretsError(
                'Missing property "{0}" in a client type of "{1}".'.format(
                    arg_4, arg_2))
    for arg_4 in VALID_CLIENT[arg_2]['string']:
        if arg_3[arg_4].startswith('[['):
            raise InvalidClientSecretsError(
                'Property "{0}" is not configured.'.format(arg_4))
    return arg_2, arg_3

Validate parsed client secrets from a file .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
arg_3
.
KMIPVersion
.
KMIP_1_0
)
:
super
(
Interval
,
arg_0
)
.
Func
(
arg_1
,
arg_2
=
arg_2
)
if
arg_0
.
length
!=
Interval
.
LENGTH
:
raise
exceptions
.
InvalidPrimitiveLength
(
"interval length must be {0}"
.
format
(
Interval
.
LENGTH
)
)
arg_0
.
value
=
unpack
(
'!I'
,
arg_1
.
Func
(
Interval
.
LENGTH
)
)
[
0
]
arg_7
=
unpack
(
'!I'
,
arg_1
.
Func
(
Interval
.
LENGTH
)
)
[
0
]
if
arg_7
!=
0
:
raise
exceptions
.
InvalidPaddingBytes
(
"padding bytes must be zero"
)
arg_0
.
validate
(
)

def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):
        """
        Read the encoding of the Interval from the input stream.

        Args:
            istream (stream): A buffer containing the encoded bytes of the
                value of an Interval. Usually a BytearrayStream object.
                Required.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

        Raises:
            InvalidPrimitiveLength: if the Interval encoding Func in has an
                invalid encoded length.
            InvalidPaddingBytes: if the Interval encoding Func in does not use
                zeroes for its padding bytes.
        """
        super(Interval, arg_0).Func(arg_1, arg_2=arg_2)

        # Check for a valid length before even trying to parse the value.
        if arg_0.length != Interval.LENGTH:
            raise exceptions.InvalidPrimitiveLength(
                "interval length must be {0}".format(Interval.LENGTH))

        # Decode the Interval value and the padding bytes.
        arg_0.value = unpack('!I', arg_1.Func(Interval.LENGTH))[0]
        arg_7 = unpack('!I', arg_1.Func(Interval.LENGTH))[0]

        # Verify that the padding bytes are zero bytes.
        if arg_7 != 0:
            raise exceptions.InvalidPaddingBytes("padding bytes must be zero")

        arg_0.validate()

Read the encoding of the Interval from the input stream.

        Args:
            istream (stream): A buffer containing the encoded bytes of the
                value of an Interval. Usually a BytearrayStream object.
                Required.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

        Raises:
            InvalidPrimitiveLength: if the Interval encoding read in has an
                invalid encoded length.
            InvalidPaddingBytes: if the Interval encoding read in does not use
                zeroes for its padding bytes.

Read the encoding of the Interval from the input stream .


(self, rangestr, raw=True, output=False)

def Func(arg_0, arg_1, arg_2=True, arg_3=False):
        """Get lines of history from a string of ranges, as used by magic
        commands %hist, %save, %macro, etc.

        Parameters
        ----------
        rangestr : str
          A string specifying ranges, e.g. "5 ~2/1-4". See
          :func:`magic_history` for full details.
        raw, output : bool
          As :meth:`get_range`

        Returns
        -------
        Tuples as :meth:`get_range`
        """
        for arg_4, arg_5, arg_6 in extract_hist_ranges(arg_1):
            for arg_7 in arg_0.get_range(arg_4, arg_5, arg_6, arg_2=arg_2, arg_3=arg_3):
                yield arg_7

Get lines of history from a string of ranges as used by magic commands %hist %save %macro etc .


return self._perform_get(
            self._get_storage_service_path(service_name) + '/keys',
            StorageService)

def Func ( arg_0 , arg_1 ) : _validate_not_none ( 'service_name' , arg_1 ) return arg_0 . _perform_get ( arg_0 . _get_storage_service_path ( arg_1 ) + '/keys' , StorageService )

def Func(arg_0, arg_1):
        '''
        Returns the primary and secondary access keys for the specified
        storage account.

        service_name:
            Name of the storage service account.
        '''
        _validate_not_none('service_name', arg_1)
        return arg_0._perform_get(
            arg_0._get_storage_service_path(arg_1) + '/keys',
            StorageService)

Returns the primary and secondary access keys for the specified storage account .


(environ, namespaces, request=None, error_handler=None,
                    json_loads=None, json_dumps=None)

def Func(arg_0, arg_1, arg_2=None, arg_3=None,
                    arg_4=None, arg_5=None):
    """Main SocketIO management function, call from within your Framework of
    choice's view.

    The ``environ`` variable is the WSGI ``environ``.  It is used to extract
    Socket object from the underlying server (as the 'socketio' key), and will
    be attached to both the ``Socket`` and ``Namespace`` objects.

    The ``namespaces`` parameter is a dictionary of the namespace string
    representation as key, and the BaseNamespace namespace class descendant as
    a value.  The empty string ('') namespace is the global namespace.  You can
    use Socket.GLOBAL_NS to be more explicit. So it would look like:

    .. code-block:: python

      namespaces={'': GlobalNamespace,
                  '/chat': ChatNamespace}

    The ``request`` object is not required, but will probably be useful to pass
    framework-specific things into your Socket and Namespace functions. It will
    simply be attached to the Socket and Namespace object (accessible through
    ``self.request`` in both cases), and it is not accessed in any case by the
    ``gevent-socketio`` library.

    Pass in an ``error_handler`` if you want to override the default
    error_handler (which is :func:`socketio.virtsocket.default_error_handler`.
    The callable you pass in should have the same signature as the default
    error handler.

    The ``json_loads`` and ``json_dumps`` are overrides for the default
    ``json.loads`` and ``json.dumps`` function calls.  Override these at
    the top-most level here.  This will affect all sockets created by this
    socketio manager, and all namespaces inside.

    This function will block the current "view" or "controller" in your
    framework to do the recv/send on the socket, and dispatch incoming messages
    to your namespaces.

    This is a simple example using Pyramid:

    .. code-block:: python

      def my_view(request):
          Func(request.environ, {'': GlobalNamespace}, request)

    NOTE: You must understand that this function is going to be called
    *only once* per socket opening, *even though* you are using a long
    polling mechanism.  The subsequent calls (for long polling) will
    be hooked directly at the server-level, to interact with the
    active ``Socket`` instance.  This means you will *not* get access
    to the future ``request`` or ``environ`` objects.  This is of
    particular importance regarding sessions (like Beaker).  The
    session will be opened once at the opening of the Socket, and not
    closed until the socket is closed.  You are responsible for
    opening and closing the cookie-based session yourself if you want
    to keep its data in sync with the rest of your GET/POST calls.
    """
    arg_6 = arg_0['socketio']
    arg_6._set_environ(arg_0)
    arg_6._set_namespaces(arg_1)

    if arg_2:
        arg_6._set_request(arg_2)

    if arg_3:
        arg_6._set_error_handler(arg_3)

    if arg_4:
        arg_6._set_json_loads(arg_4)
    if arg_5:
        arg_6._set_json_dumps(arg_5)

    arg_7 = arg_6._spawn_receiver_loop()

    gevent.joinall([arg_7])

    # TODO: double check, what happens to the WSGI request here ? it vanishes ?
    return

Main SocketIO management function, call from within your Framework of
    choice's view.

    The ``environ`` variable is the WSGI ``environ``.  It is used to extract
    Socket object from the underlying server (as the 'socketio' key), and will
    be attached to both the ``Socket`` and ``Namespace`` objects.

    The ``namespaces`` parameter is a dictionary of the namespace string
    representation as key, and the BaseNamespace namespace class descendant as
    a value.  The empty string ('') namespace is the global namespace.  You can
    use Socket.GLOBAL_NS to be more explicit. So it would look like:

    .. code-block:: python

      namespaces={'': GlobalNamespace,
                  '/chat': ChatNamespace}

    The ``request`` object is not required, but will probably be useful to pass
    framework-specific things into your Socket and Namespace functions. It will
    simply be attached to the Socket and Namespace object (accessible through
    ``self.request`` in both cases), and it is not accessed in any case by the
    ``gevent-socketio`` library.

    Pass in an ``error_handler`` if you want to override the default
    error_handler (which is :func:`socketio.virtsocket.default_error_handler`.
    The callable you pass in should have the same signature as the default
    error handler.

    The ``json_loads`` and ``json_dumps`` are overrides for the default
    ``json.loads`` and ``json.dumps`` function calls.  Override these at
    the top-most level here.  This will affect all sockets created by this
    socketio manager, and all namespaces inside.

    This function will block the current "view" or "controller" in your
    framework to do the recv/send on the socket, and dispatch incoming messages
    to your namespaces.

    This is a simple example using Pyramid:

    .. code-block:: python

      def my_view(request):
          socketio_manage(request.environ, {'': GlobalNamespace}, request)

    NOTE: You must understand that this function is going to be called
    *only once* per socket opening, *even though* you are using a long
    polling mechanism.  The subsequent calls (for long polling) will
    be hooked directly at the server-level, to interact with the
    active ``Socket`` instance.  This means you will *not* get access
    to the future ``request`` or ``environ`` objects.  This is of
    particular importance regarding sessions (like Beaker).  The
    session will be opened once at the opening of the Socket, and not
    closed until the socket is closed.  You are responsible for
    opening and closing the cookie-based session yourself if you want
    to keep its data in sync with the rest of your GET/POST calls.

Main SocketIO management function call from within your Framework of choice s view .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . _perform_request ( url = '/um/groups/%s' % arg_1 , method = 'DELETE' ) return arg_2

def Func(arg_0, arg_1):
        """
        Removes a group.

        :param      group_id: The unique ID of the group.
        :type       group_id: ``str``

        """
        arg_2 = arg_0._perform_request(
            url='/um/groups/%s' % arg_1,
            method='DELETE')

        return arg_2


def Func ( arg_0 , arg_1 ) : arg_2 = parse_qs ( arg_0 . handler . environ . get ( "QUERY_STRING" ) ) if "i" in arg_2 : arg_3 = arg_2 [ "i" ] else : arg_3 = "0" super ( JSONPolling , arg_0 ) . Func ( "io.j[%s]('%s');" % ( arg_3 , arg_1 ) )

def Func(arg_0, arg_1):
        """Just quote out stuff before sending it out"""
        arg_2 = parse_qs(arg_0.handler.environ.get("QUERY_STRING"))
        if "i" in arg_2:
            arg_3 = arg_2["i"]
        else:
            arg_3 = "0"
        # TODO: don't we need to quote this data in here ?
        super(JSONPolling, arg_0).Func("io.j[%s]('%s');" % (arg_3, arg_1))


return return_list, return_names, tuple(hash_list)

def
Func
(
arg_0
)
:
if
(
spsp
.
isspmatrix_csc
(
arg_0
)
or
spsp
.
isspmatrix_csr
(
arg_0
)
or
spsp
.
isspmatrix_bsr
(
arg_0
)
)
:
if
arg_0
.
size
>
0
:
arg_1
=
[
arg_0
.
data
,
arg_0
.
indices
,
arg_0
.
indptr
,
arg_0
.
shape
]
else
:
arg_1
=
[
'__empty__'
,
(
)
,
(
)
,
arg_0
.
shape
]
arg_2
=
SparseParameter
.
OTHER_NAME_LIST
if
spsp
.
isspmatrix_csc
(
arg_0
)
:
arg_1
=
[
'csc'
]
+
arg_1
elif
spsp
.
isspmatrix_csr
(
arg_0
)
:
arg_1
=
[
'csr'
]
+
arg_1
elif
spsp
.
isspmatrix_bsr
(
arg_0
)
:
arg_1
=
[
'bsr'
]
+
arg_1
else
:
raise
RuntimeError
(
'You shall not pass!'
)
elif
spsp
.
isspmatrix_dia
(
arg_0
)
:
if
arg_0
.
size
>
0
:
arg_1
=
[
'dia'
,
arg_0
.
data
,
arg_0
.
offsets
,
arg_0
.
shape
]
else
:
arg_1
=
[
'dia'
,
'__empty__'
,
(
)
,
arg_0
.
shape
]
arg_2
=
SparseParameter
.
DIA_NAME_LIST
else
:
raise
RuntimeError
(
'You shall not pass!'
)
arg_3
=
[
]
for
arg_4
in
arg_1
:
if
type
(
arg_4
)
is
np
.
ndarray
:
arg_3
.
append
(
HashArray
(
arg_4
)
)
else
:
arg_3
.
append
(
arg_4
)
return
arg_1
,
arg_2
,
tuple
(
arg_3
)

def Func(arg_0):
        """Extracts data from a sparse matrix to make it serializable in a human readable format.

        :return: Tuple with following elements:

            1.

                A list containing data that is necessary to reconstruct the matrix.
                For csr, csc, and bsr matrices the following attributes are extracted:
                `format`, `data`, `indices`, `indptr`, `shape`.
                Where format is simply one of the strings 'csr', 'csc', or 'bsr'.

                For dia matrices the following attributes are extracted:
                `format`, `data`, `offsets`, `shape`.
                Where `format` is simply the string 'dia'.

            2.

                A list containing the names of the extracted attributes.
                For csr, csc, and bsr:

                    [`format`, `data`, `indices`, `indptr`, `shape`]

                For dia:

                    [`format`, `data`, `offsets`, `shape`]

            3.

                A tuple containing the hashable parts of (1) in order to use the tuple as
                a key for a dictionary. Accordingly, the numpy arrays of (1) are
                changed to read-only.

        """
        if (spsp.isspmatrix_csc(arg_0) or
                spsp.isspmatrix_csr(arg_0) or
                spsp.isspmatrix_bsr(arg_0)):
            if arg_0.size > 0:
                arg_1 = [arg_0.data, arg_0.indices, arg_0.indptr, arg_0.shape]
            else:
                # For empty matrices we only need the shape
                arg_1 = ['__empty__', (), (), arg_0.shape]

            arg_2 = SparseParameter.OTHER_NAME_LIST

            if spsp.isspmatrix_csc(arg_0):
                arg_1 = ['csc'] + arg_1
            elif spsp.isspmatrix_csr(arg_0):
                arg_1 = ['csr'] + arg_1
            elif spsp.isspmatrix_bsr(arg_0):
                arg_1 = ['bsr'] + arg_1
            else:
                raise RuntimeError('You shall not pass!')

        elif spsp.isspmatrix_dia(arg_0):
            if arg_0.size > 0:
                arg_1 = ['dia', arg_0.data, arg_0.offsets, arg_0.shape]
            else:
                # For empty matrices we only need the shape
                arg_1 = ['dia', '__empty__', (), arg_0.shape]

            arg_2 = SparseParameter.DIA_NAME_LIST
        else:
            raise RuntimeError('You shall not pass!')

        arg_3 = []

        # Extract the `data` property of a read-only numpy array in order to have something
        # hashable.
        for arg_4 in arg_1:
            if type(arg_4) is np.ndarray:
                # item.flags.writeable = False
                arg_3.append(HashArray(arg_4))
            else:
                arg_3.append(arg_4)

        return arg_1, arg_2, tuple(arg_3)

Extracts data from a sparse matrix to make it serializable in a human readable format .


def Func ( arg_0 ) : arg_1 = list ( map ( int , str ( arg_0 ) . split ( '.' ) ) ) if len ( arg_1 ) == 1 : arg_1 . append ( 0 ) arg_1 [ 1 ] += 1 if arg_0 == '1.11' : return '2.0' else : return '.' . join ( map ( str , arg_1 ) )

def Func(arg_0):
    """
    Converts the current version to the next one for inserting into requirements
    in the ' < version' format
    """
    arg_1 = list(map(int, str(arg_0).split('.')))
    if len(arg_1) == 1:
        arg_1.append(0)
    arg_1[1] += 1
    if arg_0 == '1.11':
        return '2.0'
    else:
        return '.'.join(map(str, arg_1))

Converts the current version to the next one for inserting into requirements in the < version format


def Func ( arg_0 ) : arg_1 = get_specs ( ) arg_2 = arg_1 . get_app_or_lib ( arg_0 ) [ 'repo' ] if not arg_2 : return None return Repo ( arg_2 )

def Func(arg_0):
    """ This function takes an app or library name and will return the corresponding repo
    for that app or library"""
    arg_1 = get_specs()
    arg_2 = arg_1.get_app_or_lib(arg_0)['repo']
    if not arg_2:
        return None
    return Repo(arg_2)


def Func ( arg_0 , arg_1 , arg_2 = [ ] ) : arg_3 , arg_4 , arg_5 , arg_6 = arg_0 . obj_res ( arg_1 , fail_on = [ ] ) arg_7 = { } if 'obj' in arg_2 : arg_3 = None if 'res' in arg_2 : arg_5 = None if arg_3 and arg_4 == 'user' : arg_7 [ 'members__in' ] = arg_3 if arg_3 and arg_4 == 'team' : arg_8 = '%s/%s/roles/' % ( grammar . pluralize ( arg_4 ) , arg_3 ) if arg_5 is not None : arg_7 [ 'object_id' ] = arg_5 elif arg_5 : arg_8 = '%s/%s/object_roles/' % ( grammar . pluralize ( arg_6 ) , arg_5 ) else : arg_8 = '/roles/' if arg_1 . get ( 'type' , False ) : arg_7 [ 'role_field' ] = '%s_role' % arg_1 [ 'type' ] . lower ( ) for arg_9 , arg_10 in arg_1 . items ( ) : if arg_9 not in RESOURCE_FIELDS and arg_9 not in [ 'type' , 'user' , 'team' ] : arg_7 [ arg_9 ] = arg_10 return arg_7 , arg_8

def Func(arg_0, arg_1, arg_2=[]):
        """
        Converts a set of CLI input arguments, `in_data`, into
        request data and an endpoint that can be used to look
        up a role or list of roles.

        Also changes the format of `type` in data to what the server
        expects for the role model, as it exists in the database.
        """
        arg_3, arg_4, arg_5, arg_6 = arg_0.obj_res(arg_1, fail_on=[])
        arg_7 = {}
        if 'obj' in arg_2:
            arg_3 = None
        if 'res' in arg_2:
            arg_5 = None
        # Input fields are not actually present on role model, and all have
        # to be managed as individual special-cases
        if arg_3 and arg_4 == 'user':
            arg_7['members__in'] = arg_3
        if arg_3 and arg_4 == 'team':
            arg_8 = '%s/%s/roles/' % (grammar.pluralize(arg_4), arg_3)
            if arg_5 is not None:
                # For teams, this is the best lookup we can do
                #  without making the additional request for its member_role
                arg_7['object_id'] = arg_5
        elif arg_5:
            arg_8 = '%s/%s/object_roles/' % (grammar.pluralize(arg_6), arg_5)
        else:
            arg_8 = '/roles/'
        if arg_1.get('type', False):
            arg_7['role_field'] = '%s_role' % arg_1['type'].lower()
        # Add back fields unrelated to role lookup, such as all_pages
        for arg_9, arg_10 in arg_1.items():
            if arg_9 not in RESOURCE_FIELDS and arg_9 not in ['type', 'user', 'team']:
                arg_7[arg_9] = arg_10
        return arg_7, arg_8

Converts a set of CLI input arguments in_data into request data and an endpoint that can be used to look up a role or list of roles .


def Func ( arg_0 ) : arg_1 = [ ] if PyFunceble . path . isfile ( PyFunceble . INTERN [ "file_to_test" ] ) : try : with open ( PyFunceble . INTERN [ "file_to_test" ] ) as file : for arg_2 in file : if not arg_2 . startswith ( "#" ) : arg_1 . append ( arg_2 . rstrip ( "\n" ) . strip ( ) ) except UnicodeDecodeError : with open ( PyFunceble . INTERN [ "file_to_test" ] , encoding = "utf-8" ) as file : for arg_2 in file : if not arg_2 . startswith ( "#" ) : arg_1 . append ( arg_2 . rstrip ( "\n" ) . strip ( ) ) else : raise FileNotFoundError ( PyFunceble . INTERN [ "file_to_test" ] ) return arg_1

def Func(arg_0):
        """
        Extract all non commented lines from the file we are testing.

        :return: The elements to test.
        :rtype: list
        """

        # We initiate the variable which will save what we are going to return.
        arg_1 = []

        if PyFunceble.path.isfile(PyFunceble.INTERN["file_to_test"]):
            # The give file to test exist.

            try:
                with open(PyFunceble.INTERN["file_to_test"]) as file:
                    # We open and read the file.

                    for arg_2 in file:
                        # We loop through each lines.

                        if not arg_2.startswith("#"):
                            # The currently read line is not a commented line.

                            # We append the current read line to the result.
                            arg_1.append(arg_2.rstrip("\n").strip())
            except UnicodeDecodeError:
                with open(PyFunceble.INTERN["file_to_test"], encoding="utf-8") as file:
                    # We open and read the file.

                    for arg_2 in file:
                        # We loop through each lines.

                        if not arg_2.startswith("#"):
                            # The currently read line is not a commented line.

                            # We append the current read line to the result.
                            arg_1.append(arg_2.rstrip("\n").strip())

        else:
            # The given file to test does not exist.

            # We raise a FileNotFoundError exception.
            raise FileNotFoundError(PyFunceble.INTERN["file_to_test"])

        # We return the result.
        return arg_1

Extract all non commented lines from the file we are testing .


Returns a blox template from an html string

(html, start_on=None, ignore=(), use_short=True, **queries)

return _to_template(fromstring(html), start_on=start_on,
                        ignore=ignore, **queries)

def Func ( arg_0 , arg_1 = None , arg_2 = ( ) , arg_3 = True , ** arg_4 ) : if arg_3 : arg_0 = grow_short ( arg_0 ) return _to_template ( fromFunc ( arg_0 ) , arg_1 = arg_1 , arg_2 = arg_2 , ** arg_4 )

def Func(arg_0, arg_1=None, arg_2=(), arg_3=True, **arg_4):
    '''Returns a blox template from an html Func'''
    if arg_3:
        arg_0 = grow_short(arg_0)
    return _to_template(fromFunc(arg_0), arg_1=arg_1,
                        arg_2=arg_2, **arg_4)


def Func ( arg_0 , arg_1 ) : arg_0 . linker . visit ( arg_1 ) arg_0 . classdiagram . add_object ( arg_0 . get_title ( arg_1 ) , arg_1 )

def Func(arg_0, arg_1):
        """visit one class and add it to diagram"""
        arg_0.linker.visit(arg_1)
        arg_0.classdiagram.add_object(arg_0.get_title(arg_1), arg_1)


(keyword: str, file: TextIO, encoding: Optional[str], use_names: bool)

def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_5[arg_1], arg_6: arg_7):
    """Write as a BEL namespace."""
    arg_8 = get_data_dir(arg_0)
    arg_9 = f'http://purl.obolibrary.org/obo/{keyword}.obo'
    arg_10 = os.path.join(arg_8, f'{keyword}.obo')
    arg_11 = os.path.join(arg_8, f'{keyword}.obo.pickle')

    arg_12 = make_obo_getter(arg_9, arg_10, preparsed_path=arg_11)
    arg_13 = arg_12()
    convert_obo_graph_to_Func(
        arg_13,
        arg_2=arg_2,
        arg_4=arg_4,
        arg_6=arg_6,
    )


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
out
(
"Available solution stacks"
)
for
arg_3
in
arg_0
.
list_available_solution_stacks
(
)
:
out
(
"    "
+
str
(
arg_3
)
)
return
0

def Func(arg_0, arg_1, arg_2):
    """
    Lists solution stacks
    """
    out("Available solution stacks")
    for arg_3 in arg_0.list_available_solution_stacks():
        out("    "+str(arg_3))
    return 0


(font, text, x, y, width=None, height=None, align=Alignment.left, vertical_align=VerticalAlignment.baseline)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=arg_7.left, arg_9=arg_10.baseline):
    '''Draw a string with the given font.

    :note: Text alignment and word-wrapping is not yet implemented.  The text is rendered with the left edge and
        baseline at ``(x, y)``.

    :param font: the :class:`Font` to render text with
    :param text: a string of text to render.
    '''
    arg_12 = Style(arg_0)
    arg_13 = GlyphRun(arg_12, arg_1)
    arg_14 = GlyphLayout([arg_13], arg_2, arg_3, arg_4, arg_5, arg_6, arg_9)
    draw_glyph_layout(arg_14)


(d, f=identityConversion, discardNoneKeys=True, deepCopy=True)

def Func ( arg_0 , arg_1 = arg_2 , arg_3 = True , arg_4 = True ) : if arg_4 : arg_0 = copy . deepcopy ( arg_0 ) arg_5 = { } arg_6 = [ ( arg_7 , arg_8 , arg_5 , ( ) ) for arg_7 , arg_8 in arg_0 . iteritems ( ) ] while len ( arg_6 ) > 0 : arg_7 , arg_8 , arg_0 , arg_9 = arg_6 . pop ( ) arg_9 = arg_9 + ( arg_7 , ) if isinstance ( arg_8 , dict ) : arg_0 [ arg_7 ] = dict ( ) arg_6 [ 0 : 0 ] = [ ( innerK , innerV , arg_0 [ arg_7 ] , arg_9 ) for innerK , innerV in arg_8 . iteritems ( ) ] else : arg_10 = arg_1 ( arg_8 , arg_9 ) if not arg_3 or arg_10 is not None : arg_0 [ arg_7 ] = arg_10 return arg_5

def Func(arg_0, arg_1=arg_2, arg_3=True, arg_4=True):
  """Recursively copies a dict and returns the result.

  Args:
    d: The dict to copy.
    f: A function to apply to values when copying that takes the value and the
        list of keys from the root of the dict to the value and returns a value
        for the new dict.
    discardNoneKeys: If True, discard key-value pairs when f returns None for
        the value.
    deepCopy: If True, all values in returned dict are true copies (not the
        same object).
  Returns:
    A new dict with keys and values from d replaced with the result of f.
  """
  # Optionally deep copy the dict.
  if arg_4:
    arg_0 = copy.deepcopy(arg_0)

  arg_5 = {}
  arg_6 = [(arg_7, arg_8, arg_5, ()) for arg_7, arg_8 in arg_0.iteritems()]
  while len(arg_6) > 0:
    arg_7, arg_8, arg_0, arg_9 = arg_6.pop()
    arg_9 = arg_9 + (arg_7,)
    if isinstance(arg_8, dict):
      arg_0[arg_7] = dict()
      arg_6[0:0] = [(innerK, innerV, arg_0[arg_7], arg_9)
                     for innerK, innerV in arg_8.iteritems()]
    else:
      #print k, v, prevKeys
      arg_10 = arg_1(arg_8, arg_9)
      if not arg_3 or arg_10 is not None:
        arg_0[arg_7] = arg_10
  return arg_5

Recursively copies a dict and returns the result .


def
Func
(
arg_0
,
arg_1
=
''
)
:
arg_2
=
len
(
max
(
arg_0
.
questions
.
keys
(
)
,
arg_3
=
len
)
)
+
5
for
arg_3
in
list
(
arg_0
.
answers
.
keys
(
)
)
:
arg_1
+=
'{:>{}} : {}\n'
.
format
(
arg_3
,
arg_2
,
arg_0
.
answers
[
arg_3
]
)
return
arg_1

def Func(arg_0, arg_1=''):
        """Helper method for displaying the answers so far.
        """
        arg_2 = len(max(arg_0.questions.keys(), arg_3=len)) + 5
        for arg_3 in list(arg_0.answers.keys()):
            arg_1 += '{:>{}} : {}\n'.format(arg_3, arg_2, arg_0.answers[arg_3])
        return arg_1

Helper method for displaying the answers so far .


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
[
'algorithm'
]
not
in
arg_0
.
ALGORITHMS
:
raise
Exception
(
'Algorithm not supported: %s'
%
arg_1
[
'algorithm'
]
)
arg_2
=
arg_0
.
ALGORITHMS
[
arg_1
[
'algorithm'
]
]
arg_1
.
update
(
arg_2
)
return
arg_1

def Func(arg_0, arg_1):
        '''Get algorithm info'''

        if arg_1['algorithm'] not in arg_0.ALGORITHMS:
            raise Exception('Algorithm not supported: %s'
                            % arg_1['algorithm'])

        arg_2 = arg_0.ALGORITHMS[arg_1['algorithm']]
        arg_1.update(arg_2)

        return arg_1


def Func ( arg_0 , arg_1 : arg_1 . Block ) : if not arg_1 . resources : return { arg_3 : 1 for arg_3 in arg_0 . config . nodes . keys ( ) } arg_4 = { } for arg_5 in arg_1 . resources : arg_6 = arg_0 . resource_fitnesses ( arg_5 ) if not arg_6 : raise UnassignableBlock ( arg_1 . name ) arg_7 = max ( arg_6 . values ( ) ) arg_8 = min ( arg_6 . values ( ) ) for arg_9 , arg_10 in arg_6 . items ( ) : if arg_9 not in arg_4 : arg_4 [ arg_9 ] = { } if not arg_10 : arg_4 [ arg_9 ] [ arg_5 . describe ( ) ] = False else : if arg_7 - arg_8 : arg_4 [ arg_9 ] [ arg_5 . describe ( ) ] = ( arg_10 - arg_8 ) / ( arg_7 - arg_8 ) else : arg_4 [ arg_9 ] [ arg_5 . describe ( ) ] = 1.0 arg_12 = { } for arg_9 , arg_13 in arg_4 . items ( ) : arg_14 = 0 for arg_15 , arg_16 in arg_13 . items ( ) : if arg_16 is False : arg_14 = False break arg_14 += arg_16 if arg_14 is False : arg_12 [ arg_9 ] = False continue arg_12 [ arg_9 ] = arg_14 return arg_12

def Func(arg_0, arg_1: arg_1.Block):
        """Returns a map of nodename to average fitness value for this block.
        Assumes that required resources have been checked on all nodes."""

        # Short-circuit! My algorithm is terrible, so it doesn't work well for the edge case where
        # the block has no requirements
        if not arg_1.resources:
            return {arg_3: 1 for arg_3 in arg_0.config.nodes.keys()}

        arg_4 = {}

        for arg_5 in arg_1.resources:
            arg_6 = arg_0.resource_fitnesses(arg_5)

            if not arg_6:
                raise UnassignableBlock(arg_1.name)

            arg_7 = max(arg_6.values())
            arg_8 = min(arg_6.values())

            for arg_9, arg_10 in arg_6.items():
                if arg_9 not in arg_4:
                    arg_4[arg_9] = {}

                if not arg_10:
                    # Since we're rescaling, 0 is now an OK value...
                    # We will check for `is False` after this
                    arg_4[arg_9][arg_5.describe()] = False
                else:
                    if arg_7 - arg_8:
                        arg_4[arg_9][arg_5.describe()] = (arg_10 - arg_8) / (arg_7 - arg_8)
                    else:
                        # All the values are the same, default to 1
                        arg_4[arg_9][arg_5.describe()] = 1.0

        arg_12 = {}

        for arg_9, arg_13 in arg_4.items():
            arg_14 = 0
            for arg_15, arg_16 in arg_13.items():
                if arg_16 is False:
                    arg_14 = False
                    break

                arg_14 += arg_16

            if arg_14 is False:
                # Skip this node entirely
                arg_12[arg_9] = False
                continue

            arg_12[arg_9] = arg_14

        return arg_12

Returns a map of nodename to average fitness value for this block . Assumes that required resources have been checked on all nodes .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . get_model ( "sites" , "Site" ) arg_2 . objects . update_or_create ( id = settings . SITE_ID , defaults = { "domain" : "{{cookiecutter.domain_name}}" , "name" : "{{cookiecutter.project_name}}" , } , )

def Func(arg_0, arg_1):
    """Set site domain and name."""
    arg_2 = arg_0.get_model("sites", "Site")
    arg_2.objects.update_or_create(
        id=settings.SITE_ID,
        defaults={
            "domain": "{{cookiecutter.domain_name}}",
            "name": "{{cookiecutter.project_name}}",
        },
    )


def
Func
(
arg_0
,
*
arg_1
,
**
arg_2
)
:
if
arg_0
.
connection
is
not
:
del
arg_0
.
pgworker
.
connections
[
arg_0
.
connection
.
pk
]
arg_0
.
connection
.
delete
(
)
arg_0
.
connection
=
signals
.
request_finished
.
send
(
sender
=
arg_0
.
__class__
)
safe_call
(
arg_0
.
logger
.
info
,
'- %s %s'
,
arg_0
,
arg_1
or
'CLOSE'
)

def Func(arg_0, *arg_1, **arg_2):
        """Handle closing of websocket connection."""
        if arg_0.connection is not None:
            del arg_0.pgworker.connections[arg_0.connection.pk]
            arg_0.connection.delete()
            arg_0.connection = None
        signals.request_finished.send(sender=arg_0.__class__)
        safe_call(arg_0.logger.info, '- %s %s', arg_0, arg_1 or 'CLOSE')

Handle closing of websocket connection .


(wave, npoints=None, indep_min=None, indep_max=None)

return db(ifft(wave, npoints, indep_min, indep_max))

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

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):
    r"""
    Return the inverse Fast Fourier Transform of a waveform.

    The dependent variable vector of the returned waveform is expressed in decibels

    :param wave: Waveform
    :type  wave: :py:class:`peng.eng.Waveform`

    :param npoints: Number of points to use in the transform. If **npoints**
                    is less than the size of the independent variable vector
                    the waveform is truncated; if **npoints** is greater than
                    the size of the independent variable vector, the waveform
                    is zero-padded
    :type  npoints: positive integer

    :param indep_min: Independent vector start point of computation
    :type  indep_min: integer or float

    :param indep_max: Independent vector stop point of computation
    :type  indep_max: integer or float

    :rtype: :py:class:`peng.eng.Waveform`

    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]
    .. Auto-generated exceptions documentation for
    .. peng.wave_functions.Func

    :raises:
     * RuntimeError (Argument \`indep_max\` is not valid)

     * RuntimeError (Argument \`indep_min\` is not valid)

     * RuntimeError (Argument \`npoints\` is not valid)

     * RuntimeError (Argument \`wave\` is not valid)

     * RuntimeError (Incongruent \`indep_min\` and \`indep_max\`
       arguments)

     * RuntimeError (Non-uniform frequency spacing)

    .. [[[end]]]
    """
    return db(ifft(arg_0, arg_1, arg_2, arg_3))

r"""
    Return the inverse Fast Fourier Transform of a waveform.

    The dependent variable vector of the returned waveform is expressed in decibels

    :param wave: Waveform
    :type  wave: :py:class:`peng.eng.Waveform`

    :param npoints: Number of points to use in the transform. If **npoints**
                    is less than the size of the independent variable vector
                    the waveform is truncated; if **npoints** is greater than
                    the size of the independent variable vector, the waveform
                    is zero-padded
    :type  npoints: positive integer

    :param indep_min: Independent vector start point of computation
    :type  indep_min: integer or float

    :param indep_max: Independent vector stop point of computation
    :type  indep_max: integer or float

    :rtype: :py:class:`peng.eng.Waveform`

    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]
    .. Auto-generated exceptions documentation for
    .. peng.wave_functions.ifftdb

    :raises:
     * RuntimeError (Argument \`indep_max\` is not valid)

     * RuntimeError (Argument \`indep_min\` is not valid)

     * RuntimeError (Argument \`npoints\` is not valid)

     * RuntimeError (Argument \`wave\` is not valid)

     * RuntimeError (Incongruent \`indep_min\` and \`indep_max\`
       arguments)

     * RuntimeError (Non-uniform frequency spacing)

    .. [[[end]]]

r Return the inverse Fast Fourier Transform of a waveform .


def
Func
(
arg_0
)
:
if
xxhash
is
not
:
if
arg_0
in
{
'xxh32'
,
'xx32'
,
'xxhash'
}
:
return
xxhash
.
xxh32
if
arg_0
in
{
'xxh64'
,
'xx64'
}
:
return
xxhash
.
xxh64
if
arg_0
is
NoParam
or
arg_0
==
'default'
:
arg_0
=
DEFAULT_HASHER
elif
isinstance
(
arg_0
,
six
.
string_types
)
:
if
arg_0
not
in
hashlib
.
algorithms_available
:
raise
KeyError
(
'unknown hasher: {}'
.
format
(
arg_0
)
)
else
:
arg_0
=
getattr
(
hashlib
,
arg_0
)
elif
isinstance
(
arg_0
,
HASH
)
:
return
lambda
:
arg_0
return
arg_0

def Func(arg_0):
    """
    Convert a string-based key into a hasher class

    Notes:
        In terms of speed on 64bit systems, sha1 is the fastest followed by md5
        and sha512. The slowest algorithm is sha256. If xxhash is installed
        the fastest algorithm is xxh64.

    Example:
        >>> assert Func(NoParam) is DEFAULT_HASHER
        >>> assert Func('sha1') is hashlib.sha1
        >>> assert Func('sha256') is hashlib.sha256
        >>> assert Func('sha512') is hashlib.sha512
        >>> assert Func('md5') is hashlib.md5
        >>> assert Func(hashlib.sha1) is hashlib.sha1
        >>> assert Func(hashlib.sha1())().name == 'sha1'
        >>> import pytest
        >>> assert pytest.raises(KeyError, Func, '42')
        >>> #assert pytest.raises(TypeError, Func, object)
        >>> if xxhash:
        >>>     assert Func('xxh64') is xxhash.xxh64
        >>>     assert Func('xxh32') is xxhash.xxh32
    """
    if xxhash is not None:  # pragma: nobranch
        if arg_0 in {'xxh32', 'xx32', 'xxhash'}:
            return xxhash.xxh32
        if arg_0 in {'xxh64', 'xx64'}:
            return xxhash.xxh64

    if arg_0 is NoParam or arg_0 == 'default':
        arg_0 = DEFAULT_HASHER
    elif isinstance(arg_0, six.string_types):
        if arg_0 not in hashlib.algorithms_available:
            raise KeyError('unknown hasher: {}'.format(arg_0))
        else:
            arg_0 = getattr(hashlib, arg_0)
    elif isinstance(arg_0, HASH):
        # by default the result of this function is a class we will make an
        # instance of, if we already have an instance, wrap it in a callable
        # so the external syntax does not need to change.
        return lambda: arg_0
    return arg_0

Convert a string-based key into a hasher class

    Notes:
        In terms of speed on 64bit systems, sha1 is the fastest followed by md5
        and sha512. The slowest algorithm is sha256. If xxhash is installed
        the fastest algorithm is xxh64.

    Example:
        >>> assert _rectify_hasher(NoParam) is DEFAULT_HASHER
        >>> assert _rectify_hasher('sha1') is hashlib.sha1
        >>> assert _rectify_hasher('sha256') is hashlib.sha256
        >>> assert _rectify_hasher('sha512') is hashlib.sha512
        >>> assert _rectify_hasher('md5') is hashlib.md5
        >>> assert _rectify_hasher(hashlib.sha1) is hashlib.sha1
        >>> assert _rectify_hasher(hashlib.sha1())().name == 'sha1'
        >>> import pytest
        >>> assert pytest.raises(KeyError, _rectify_hasher, '42')
        >>> #assert pytest.raises(TypeError, _rectify_hasher, object)
        >>> if xxhash:
        >>>     assert _rectify_hasher('xxh64') is xxhash.xxh64
        >>>     assert _rectify_hasher('xxh32') is xxhash.xxh32

Convert a string - based key into a hasher class


(left_text: str, right_text: str, left_link: Optional[str] = None,
          right_link: Optional[str] = None,
          whole_link: Optional[str] = None, logo: Optional[str] = None,
          left_color: str = '#555', right_color: str = '#007ec6',
          measurer: Optional[text_measurer.TextMeasurer] = None,
          embed_logo: bool = False)

def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_4[arg_1] = None,
          arg_5: arg_4[arg_1] = None,
          arg_6: arg_4[arg_1] = None, arg_7: arg_4[arg_1] = None,
          arg_8: arg_1 = '#555', arg_9: arg_1 = '#007ec6',
          arg_10: arg_4[arg_11.TextMeasurer] = None,
          arg_13: arg_14 = False) -> arg_1:
    """Creates a github-style Func as an SVG image.

    >>> Func(left_text='coverage', right_text='23%', right_color='red')
    '<svg...</svg>'
    >>> Func(left_text='build', right_text='green', right_color='green',
    ...       whole_link="http://www.example.com/")
    '<svg...</svg>'

    Args:
        left_text: The text that should appear on the left-hand-side of the
            Func e.g. "coverage".
        right_text: The text that should appear on the right-hand-side of the
            Func e.g. "23%".
        left_link: The URL that should be redirected to when the left-hand text
            is selected.
        right_link: The URL that should be redirected to when the right-hand
            text is selected.
        whole_link: The link that should be redirected to when the Func is
            selected. If set then left_link and right_right may not be set.
        logo: A url representing a logo that will be displayed inside the
            Func. Can be a data URL e.g. "data:image/svg+xml;utf8,<svg..."
        left_color: The color of the part of the Func containing the left-hand
            text. Can be an valid CSS color
            (see https://developer.mozilla.org/en-US/docs/Web/CSS/color) or a
            color name defined here:
            https://github.com/Funcs/shields/blob/master/lib/colorscheme.json
        right_color: The color of the part of the Func containing the
            right-hand text. Can be an valid CSS color
            (see https://developer.mozilla.org/en-US/docs/Web/CSS/color) or a
            color name defined here:
            https://github.com/Funcs/shields/blob/master/lib/colorscheme.json
        measurer: A text_measurer.TextMeasurer that can be used to measure the
            width of left_text and right_text.
        embed_logo: If True then embed the logo image directly in the Func.
            This can prevent an HTTP request and some browsers will not render
            external image referenced. When True, `logo` must be a HTTP/HTTPS
            URI or a filesystem path. Also, the `Func` call may raise an
            exception if the logo cannot be loaded, is not an image, etc.
    """
    if arg_10 is None:
        arg_10 = (
            precalculated_text_measurer.PrecalculatedTextMeasurer
                .default())

    if (arg_3 or arg_5) and arg_6:
        raise ValueError(
            'whole_link may not bet set with left_link or right_link')
    arg_15 = _JINJA2_ENVIRONMENT.get_template('Func-template-full.svg')

    if arg_7 and arg_13:
        arg_7 = _embed_image(arg_7)

    arg_16 = arg_15.render(
        arg_0=arg_0,
        arg_2=arg_2,
        left_text_width=arg_10.text_width(arg_0) / 10.0,
        right_text_width=arg_10.text_width(arg_2) / 10.0,
        arg_3=arg_3,
        arg_5=arg_5,
        arg_6=arg_6,
        arg_7=arg_7,
        arg_8=_NAME_TO_COLOR.get(arg_8, arg_8),
        arg_9=_NAME_TO_COLOR.get(arg_9, arg_9),
    )
    arg_17 = minidom.parseString(arg_16)
    _remove_blanks(arg_17)
    arg_17.normalize()
    return arg_17.documentElement.toxml()

Creates a github-style badge as an SVG image.

    >>> badge(left_text='coverage', right_text='23%', right_color='red')
    '<svg...</svg>'
    >>> badge(left_text='build', right_text='green', right_color='green',
    ...       whole_link="http://www.example.com/")
    '<svg...</svg>'

    Args:
        left_text: The text that should appear on the left-hand-side of the
            badge e.g. "coverage".
        right_text: The text that should appear on the right-hand-side of the
            badge e.g. "23%".
        left_link: The URL that should be redirected to when the left-hand text
            is selected.
        right_link: The URL that should be redirected to when the right-hand
            text is selected.
        whole_link: The link that should be redirected to when the badge is
            selected. If set then left_link and right_right may not be set.
        logo: A url representing a logo that will be displayed inside the
            badge. Can be a data URL e.g. "data:image/svg+xml;utf8,<svg..."
        left_color: The color of the part of the badge containing the left-hand
            text. Can be an valid CSS color
            (see https://developer.mozilla.org/en-US/docs/Web/CSS/color) or a
            color name defined here:
            https://github.com/badges/shields/blob/master/lib/colorscheme.json
        right_color: The color of the part of the badge containing the
            right-hand text. Can be an valid CSS color
            (see https://developer.mozilla.org/en-US/docs/Web/CSS/color) or a
            color name defined here:
            https://github.com/badges/shields/blob/master/lib/colorscheme.json
        measurer: A text_measurer.TextMeasurer that can be used to measure the
            width of left_text and right_text.
        embed_logo: If True then embed the logo image directly in the badge.
            This can prevent an HTTP request and some browsers will not render
            external image referenced. When True, `logo` must be a HTTP/HTTPS
            URI or a filesystem path. Also, the `badge` call may raise an
            exception if the logo cannot be loaded, is not an image, etc.

Creates a github - style badge as an SVG image .


(all_seq: [list], sr: state.StateRegister)

def Func(arg_0: [arg_1], arg_2: arg_3.StateRegister) -> Edge:
    """ function that create a state for all instance
        of MatchExpr in the given list and connect each others.
    """
    # Basic State
    arg_5 = arg_3.State(arg_2)
    # loop on himself
    arg_5.matchDefault(arg_5)
    # this is default
    arg_2.set_default_state(arg_5)
    # use Edge to store connection
    arg_6 = Edge(arg_5)
    for arg_7 in arg_0:
        arg_8 = ref(arg_6)
        # merge all sequences into one tree automata
        populate_from_sequence(arg_7, arg_8, arg_2)
    # return edge for debug purpose
    return arg_6

function that create a state for all instance of MatchExpr in the given list and connect each others .


(
            self, resource_group_name, vm_scale_set_name, active_placement_group_id=None, custom_headers=None, raw=False, **operation_config)

def Func(
            arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=False, **arg_6):
        """Converts SinglePlacementGroup property to false for a existing virtual
        machine scale set.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param vm_scale_set_name: The name of the virtual machine scale set to
         create or update.
        :type vm_scale_set_name: str
        :param active_placement_group_id: Id of the placement group in which
         you want future virtual machine instances to be placed. To query
         placement group Id, please use Virtual Machine Scale Set VMs - Get
         API. If not provided, the platform will choose one with maximum number
         of virtual machine instances.
        :type active_placement_group_id: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
        """
        arg_7 = models.VMScaleSetConvertToSinglePlacementGroupInput(arg_3=arg_3)

        # Construct URL
        arg_8 = arg_0.Func.metadata['url']
        arg_9 = {
            'resourceGroupName': arg_0._serialize.url("resource_group_name", arg_1, 'str'),
            'vmScaleSetName': arg_0._serialize.url("vm_scale_set_name", arg_2, 'str'),
            'subscriptionId': arg_0._serialize.url("self.config.subscription_id", arg_0.config.subscription_id, 'str')
        }
        arg_8 = arg_0._client.format_url(arg_8, **arg_9)

        # Construct parameters
        arg_10 = {}

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

        # Construct body
        arg_12 = arg_0._serialize.body(arg_7, 'VMScaleSetConvertToSinglePlacementGroupInput')

        # Construct and send request
        arg_13 = arg_0._client.post(arg_8, arg_10, arg_11, arg_12)
        arg_14 = arg_0._client.send(arg_13, stream=False, **arg_6)

        if arg_14.status_code not in [200]:
            arg_15 = CloudError(arg_14)
            arg_15.request_id = arg_14.headers.get('x-ms-request-id')
            raise arg_15

        if arg_5:
            arg_17 = ClientRawResponse(None, arg_14)
            return arg_17

Converts SinglePlacementGroup property to false for a existing virtual machine scale set .


def
Func
(
arg_0
)
:
import
requests
if
not
arg_0
.
env
.
Func
:
return
arg_1
=
arg_0
.
_local
(
'git rev-parse --abbrev-ref HEAD'
,
capture
=
True
)
.
strip
(
)
arg_2
=
arg_0
.
env
.
Func_paths
or
{
}
if
arg_1
in
arg_2
:
arg_3
=
arg_2
[
arg_1
]
if
'username'
in
arg_3
:
arg_4
=
(
arg_3
[
'username'
]
,
arg_3
[
'password'
]
)
else
:
arg_4
=
arg_5
=
requests
.
get
(
arg_3
[
'url'
]
,
arg_4
=
arg_4
)
arg_6
=
arg_3
[
'text'
]
in
arg_5
.
content
assert
arg_6
,
'Check failed: %s'
%
arg_3
[
'url'
]

def Func(arg_0):
        """
        Ensures all tests have passed for this branch.

        This should be called before deployment, to prevent accidental deployment of code
        that hasn't passed automated testing.
        """
        import requests

        if not arg_0.env.Func:
            return

        # Find current git branch.
        arg_1 = arg_0._local('git rev-parse --abbrev-ref HEAD', capture=True).strip()

        arg_2 = arg_0.env.Func_paths or {}

        if arg_1 in arg_2:
            arg_3 = arg_2[arg_1]
            if 'username' in arg_3:
                arg_4 = (arg_3['username'], arg_3['password'])
            else:
                arg_4 = None
            arg_5 = requests.get(arg_3['url'], arg_4=arg_4)
            arg_6 = arg_3['text'] in arg_5.content
            assert arg_6, 'Check failed: %s' % arg_3['url']

Ensures all tests have passed for this branch .


def Func ( arg_0 : arg_1 ) -> Iterable [ ast . Import ] : yield ast . Import ( names = [ ast . alias ( arg_3 = "basilisp" , asname = None ) ] ) for arg_2 in arg_0 . imports : arg_3 = arg_2 . key . name arg_4 = _MODULE_ALIASES . get ( arg_3 , None ) yield ast . Import ( names = [ ast . alias ( arg_3 = arg_3 , asname = arg_4 ) ] )

def Func(arg_0: arg_1) -> Iterable[ast.Import]:
    """Generate the Python Import AST node for importing all required
    language support modules."""
    # Yield `import basilisp` so code attempting to call fully qualified
    # `basilisp.lang...` modules don't result in compiler errors
    yield ast.Import(names=[ast.alias(arg_3="basilisp", asname=None)])
    for arg_2 in arg_0.imports:
        arg_3 = arg_2.key.name
        arg_4 = _MODULE_ALIASES.get(arg_3, None)
        yield ast.Import(names=[ast.alias(arg_3=arg_3, asname=arg_4)])

Generate the Python Import AST node for importing all required language support modules .


return self._perform_delete(
            self._get_storage_service_path(service_name),
            as_async=True)

def Func(arg_0, arg_1):
        '''
        Deletes the specified storage account from Windows Azure.

        service_name:
            Name of the storage service account.
        '''
        _validate_not_none('service_name', arg_1)
        return arg_0._perform_delete(
            arg_0._get_storage_service_path(arg_1),
            as_async=True)

Deletes the specified storage account from Windows Azure .


def Func(arg_0, arg_1, arg_2):
        '''Given a string and its encoding, decodes the string into Unicode.
        %encoding is a string recognized by encodings.aliases'''

        # strip Byte Order Mark (if present)
        if (len(arg_1) >= 4) and (arg_1[:2] == '\xfe\xff') \
               and (arg_1[2:4] != '\x00\x00'):
            arg_2 = 'utf-16be'
            arg_1 = arg_1[2:]
        elif (len(arg_1) >= 4) and (arg_1[:2] == '\xff\xfe') \
                 and (arg_1[2:4] != '\x00\x00'):
            arg_2 = 'utf-16le'
            arg_1 = arg_1[2:]
        elif arg_1[:3] == '\xef\xbb\xbf':
            arg_2 = 'utf-8'
            arg_1 = arg_1[3:]
        elif arg_1[:4] == '\x00\x00\xfe\xff':
            arg_2 = 'utf-32be'
            arg_1 = arg_1[4:]
        elif arg_1[:4] == '\xff\xfe\x00\x00':
            arg_2 = 'utf-32le'
            arg_1 = arg_1[4:]
        arg_3 = unicode(arg_1, arg_2)
        return arg_3

Given a string and its encoding decodes the string into Unicode . %encoding is a string recognized by encodings . aliases


def Func(arg_0, arg_1, arg_2=65536):
    """
    Generator that decrypts a content stream using AES 256 in CBC
    mode.

    :param key: Any string to use as the decryption key.
    :param stdin: Where to read the encrypted data from.
    :param chunk_size: Largest amount to read at once.
    """
    if not AES256CBC_Support:
        raise Exception(
            'AES256CBC not supported; likely pycrypto is not installed')
    # Always use 256-bit key
    arg_0 = hashlib.sha256(arg_0).digest()
    # At least 16 and a multiple of 16
    arg_2 = max(16, arg_2 >> 4 << 4)
    arg_3 = arg_1.read(16)
    while len(arg_3) < 16:
        arg_4 = arg_1.read(16 - len(arg_3))
        if not arg_4:
            raise IOError('EOF reading IV')
    arg_5 = Crypto.Cipher.AES.new(arg_0, Crypto.Cipher.AES.MODE_CBC, arg_3)
    arg_6 = ''
    while True:
        arg_4 = arg_1.read(arg_2)
        if not arg_4:
            if len(arg_6) != 16:
                raise IOError('EOF reading encrypted stream')
            arg_6 = arg_5.decrypt(arg_6)
            arg_7 = ord(arg_6[-1])
            if arg_7 > 15:
                raise IOError(
                    'EOF reading encrypted stream or trailing value corrupted '
                    '%s' % arg_7)
            yield arg_6[:arg_7]
            break
        arg_6 += arg_4
        if len(arg_6) > 16:
            # Always leave at least one byte pending
            arg_7 = (len(arg_6) % 16) or 16
            yield arg_5.decrypt(arg_6[:-arg_7])
            arg_6 = arg_6[-arg_7:]

Generator that decrypts a content stream using AES 256 in CBC mode .


def Func ( arg_0 ) : arg_1 = getattr ( arg_0 . element , 'Ancestors' , None ) if hasattr ( arg_1 , 'BrowseNode' ) : return AmazonBrowseNode ( arg_1 [ 'BrowseNode' ] ) return None

def Func(arg_0):
        """This browse node's immediate Func in the browse node tree.

        :return:
            The Func as an :class:`~.AmazonBrowseNode`, or None.
        """
        arg_1 = getattr(arg_0.element, 'Ancestors', None)
        if hasattr(arg_1, 'BrowseNode'):
            return AmazonBrowseNode(arg_1['BrowseNode'])
        return None

This browse node's immediate ancestor in the browse node tree.

        :return:
            The ancestor as an :class:`~.AmazonBrowseNode`, or None.

This browse node s immediate ancestor in the browse node tree .


def Func():
    """Use the environment to get the current region"""
    global arg_2
    if arg_2 is None:
        arg_0 = os.getenv("AWS_DEFAULT_REGION") or "us-east-1"
        arg_1 = {r.name: r for r in boto.regioninfo.Funcs("ec2")}
        if arg_0 not in arg_1:
            raise ValueError("No such EC2 region: {}. Check AWS_DEFAULT_REGION "
                             "environment variable".format(arg_0))
        arg_2 = arg_1[arg_0]
    return arg_2


def Func ( arg_0 ) : arg_1 = { } for arg_2 in [ "message" , "alias" , "description" , "responders" , "visibleTo" , "actions" , "tags" , "details" , "entity" , "source" , "priority" , "user" , "note" ] : arg_3 = getattr ( arg_0 , arg_2 ) if arg_3 : arg_1 [ arg_2 ] = arg_3 return arg_1

def Func(arg_0):
        """
        Construct the Opsgenie JSON payload. All relevant parameters are combined here
        to a valid Opsgenie JSON payload.

        :return: Opsgenie payload (dict) to send
        """
        arg_1 = {}

        for arg_2 in [
            "message", "alias", "description", "responders",
            "visibleTo", "actions", "tags", "details", "entity",
            "source", "priority", "user", "note"
        ]:
            arg_3 = getattr(arg_0, arg_2)
            if arg_3:
                arg_1[arg_2] = arg_3
        return arg_1

Construct the Opsgenie JSON payload . All relevant parameters are combined here to a valid Opsgenie JSON payload .


def Func():
    """Get the IPython directory for this platform and user.

    This uses the logic in `get_home_dir` to find the home directory
    and then adds .ipython to the end of the path.
    """

    arg_0 = os.environ
    arg_1 = os.path.join

    arg_2 = '.ipython'
    arg_3 = 'ipython'

    arg_4 = get_home_dir()
    arg_5 = get_xdg_dir()

    # import pdb; pdb.set_trace()  # dbg
    if 'IPYTHON_DIR' in arg_0:
        warnings.warn('The environment variable IPYTHON_DIR is deprecated. '
                      'Please use IPYTHONDIR instead.')
    arg_6 = arg_0.get('IPYTHONDIR', arg_0.get('IPYTHON_DIR', None))
    if arg_6 is None:
        # not set explicitly, use XDG_CONFIG_HOME or HOME
        arg_7 = arg_1(arg_4, arg_2)
        if arg_5:
            # use XDG, as long as the user isn't already
            # using $HOME/.ipython and *not* XDG/ipython

            arg_8 = arg_1(arg_5, arg_3)

            if _writable_dir(arg_8) or not _writable_dir(arg_7):
                arg_6 = arg_8

        if arg_6 is None:
            # not using XDG
            arg_6 = arg_7

    arg_6 = os.path.normpath(os.path.expanduser(arg_6))

    if os.path.exists(arg_6) and not _writable_dir(arg_6):
        # ipdir exists, but is not writable
        warnings.warn("IPython dir '%s' is not a writable location,"
                        " using a temp directory."%arg_6)
        arg_6 = tempfile.mkdtemp()
    elif not os.path.exists(arg_6):
        arg_9 = arg_6.rsplit(os.path.sep, 1)[0]
        if not _writable_dir(arg_9):
            # ipdir does not exist and parent isn't writable
            warnings.warn("IPython parent '%s' is not a writable location,"
                        " using a temp directory."%arg_9)
            arg_6 = tempfile.mkdtemp()

    return py3compat.cast_unicode(arg_6, fs_encoding)

Get the IPython directory for this platform and user .


return [
            Comment(_lststr, _type_to_spans, span, 'Comment')
            for span in self._subspans('Comment')]

def Func ( arg_0 ) -> List [ 'Comment' ] : arg_1 = arg_0 . _lststr arg_2 = arg_0 . _type_to_spans return [ Comment ( arg_1 , arg_2 , arg_3 , 'Comment' ) for arg_3 in arg_0 . _subspans ( 'Comment' ) ]

def Func(arg_0) -> List['Comment']:
        """Return a list of comment objects."""
        arg_1 = arg_0._lststr
        arg_2 = arg_0._type_to_spans
        return [
            Comment(arg_1, arg_2, arg_3, 'Comment')
            for arg_3 in arg_0._subspans('Comment')]


return [os.path.join(base_dir, os.path.normpath(rp)) for rp in rel_paths]

def Func ( arg_0 , arg_1 ) : return [ os . path . join ( arg_0 , os . path . normpath ( arg_2 ) ) for arg_2 in arg_1 ]

def Func(arg_0, arg_1):
    """Expand a list of relative paths to a give base directory.

    Parameters
    ----------
    base_dir : str
        The target base directory

    rel_paths : list (or list-like)
        Collection of relative path strings

    Returns
    -------
    expanded_paths : list
        `rel_paths` rooted at `base_dir`

    Examples
    --------
    >>> jams.util.Func('/data', ['audio', 'beat', 'seglab'])
    ['/data/audio', '/data/beat', '/data/seglab']

    """
    return [os.path.join(arg_0, os.path.normpath(arg_2)) for arg_2 in arg_1]

Expand a list of relative paths to a give base directory.

    Parameters
    ----------
    base_dir : str
        The target base directory

    rel_paths : list (or list-like)
        Collection of relative path strings

    Returns
    -------
    expanded_paths : list
        `rel_paths` rooted at `base_dir`

    Examples
    --------
    >>> jams.util.expand_filepaths('/data', ['audio', 'beat', 'seglab'])
    ['/data/audio', '/data/beat', '/data/seglab']

Expand a list of relative paths to a give base directory .


def Func ( arg_0 , arg_1 = True ) : arg_0 . expires = Func ( arg_0 . created ) if arg_1 : arg_0 . save ( )

def Func(arg_0, arg_1=True):
        """Update token's expiration datetime on every auth action."""
        arg_0.expires = Func(arg_0.created)
        if arg_1:
            arg_0.save()

Update token s expiration datetime on every auth action .


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
    """Core code for a command-line application.

    The ``run()`` function is called from your application and runs
    through all the steps to obtain credentials. It takes a ``Flow``
    argument and attempts to open an authorization server page in the
    user's default web browser. The server asks the user to grant your
    application access to the user's data. If the user grants access,
    the ``run()`` function returns new credentials. The new credentials
    are also stored in the ``storage`` argument, which updates the file
    associated with the ``Storage`` object.

    It presumes it is run from a command-line application and supports the
    following flags:

        ``--auth_host_name`` (string, default: ``localhost``)
           Host name to use when running a local web server to handle
           redirects during OAuth authorization.

        ``--auth_host_port`` (integer, default: ``[8080, 8090]``)
           Port to use when running a local web server to handle redirects
           during OAuth authorization. Repeat this option to specify a list
           of values.

        ``--[no]auth_local_webserver`` (boolean, default: ``True``)
           Run a local web server to handle redirects during OAuth
           authorization.

    The tools module defines an ``ArgumentParser`` the already contains the
    flag definitions that ``run()`` requires. You can pass that
    ``ArgumentParser`` to your ``ArgumentParser`` constructor::

        parser = argparse.ArgumentParser(
            description=__doc__,
            formatter_class=argparse.RawDescriptionHelpFormatter,
            parents=[tools.argparser])
        flags = parser.parse_args(argv)

    Args:
        flow: Flow, an OAuth 2.0 Flow to step through.
        storage: Storage, a ``Storage`` to store the credential in.
        flags: ``argparse.Namespace``, (Optional) The command-line flags. This
               is the object returned from calling ``parse_args()`` on
               ``argparse.ArgumentParser`` as described above. Defaults
               to ``argparser.parse_args()``.
        http: An instance of ``httplib2.Http.request`` or something that
              acts like it.

    Returns:
        Credentials, the obtained credential.
    """
    if arg_2 is None:
        arg_2 = argparser.parse_args()
    logging.getLogger().setLevel(getattr(logging, arg_2.logging_level))
    if not arg_2.noauth_local_webserver:
        arg_4 = False
        arg_5 = 0
        for arg_6 in arg_2.auth_host_port:
            arg_5 = arg_6
            try:
                arg_7 = ClientRedirectServer((arg_2.auth_host_name, arg_6),
                                             ClientRedirectHandler)
            except socket.error:
                pass
            else:
                arg_4 = True
                break
        arg_2.noauth_local_webserver = not arg_4
        if not arg_4:
            print(_FAILED_START_MESSAGE)

    if not arg_2.noauth_local_webserver:
        arg_9 = 'http://{host}:{port}/'.format(
            host=arg_2.auth_host_name, arg_6=arg_5)
    else:
        arg_9 = client.OOB_CALLBACK_URN
    arg_0.redirect_uri = arg_9
    arg_11 = arg_0.step1_get_authorize_url()

    if not arg_2.noauth_local_webserver:
        import webbrowser
        webbrowser.open(arg_11, new=1, autoraise=True)
        print(_BROWSER_OPENED_MESSAGE.format(address=arg_11))
    else:
        print(_GO_TO_LINK_MESSAGE.format(address=arg_11))

    arg_12 = None
    if not arg_2.noauth_local_webserver:
        arg_7.handle_request()
        if 'error' in arg_7.query_params:
            sys.exit('Authentication request was rejected.')
        if 'code' in arg_7.query_params:
            arg_12 = arg_7.query_params['code']
        else:
            print('Failed to find "code" in the query parameters '
                  'of the redirect.')
            sys.exit('Try running with --noauth_local_webserver.')
    else:
        arg_12 = input('Enter verification code: ').strip()

    try:
        arg_13 = arg_0.step2_exchange(arg_12, arg_3=arg_3)
    except client.FlowExchangeError as e:
        sys.exit('Authentication has failed: {0}'.format(e))

    arg_1.put(arg_13)
    arg_13.set_store(arg_1)
    print('Authentication successful.')

    return arg_13

Core code for a command - line application .


return util.send_multi_status_response(environ, start_response, multistatusEL)

def Func(arg_0, arg_1, arg_2):
        """Handle PROPPATCH request to set or remove a property.

        @see http://www.webdav.org/specs/rfc4918.html#METHOD_PROPPATCH
        """
        arg_3 = arg_1["PATH_INFO"]
        arg_4 = arg_0._davProvider.get_resource_inst(arg_3, arg_1)

        # Only accept Depth: 0 (but assume this, if omitted)
        arg_1.setdefault("HTTP_DEPTH", "0")
        if arg_1["HTTP_DEPTH"] != "0":
            arg_0._fail(HTTP_BAD_REQUEST, "Depth must be '0'.")

        if arg_4 is None:
            arg_0._fail(HTTP_NOT_FOUND)

        arg_0._evaluate_if_headers(arg_4, arg_1)
        arg_0._check_write_permission(arg_4, "0", arg_1)

        # Parse request
        arg_5 = util.parse_xml_body(arg_1)

        if arg_5.tag != "{DAV:}propertyupdate":
            arg_0._fail(HTTP_BAD_REQUEST)

        # Create a list of update request tuples: (name, value)
        arg_6 = []

        for arg_7 in arg_5:
            arg_8 = None
            if arg_7.tag == "{DAV:}remove":
                arg_8 = "remove"
            elif arg_7.tag == "{DAV:}set":
                arg_8 = "set"
            else:
                arg_0._fail(
                    HTTP_BAD_REQUEST, "Unknown tag (expected 'set' or 'remove')."
                )

            for arg_9 in arg_7:
                if arg_9.tag != "{DAV:}prop":
                    arg_0._fail(HTTP_BAD_REQUEST, "Unknown tag (expected 'prop').")

                for arg_10 in arg_9:
                    arg_11 = None
                    if arg_8 == "remove":
                        arg_11 = None  # Mark as 'remove'
                        if len(arg_10) > 0:
                            # 14.23: All the XML elements in a 'prop' XML
                            # element inside of a 'remove' XML element MUST be
                            # empty
                            arg_0._fail(
                                HTTP_BAD_REQUEST,
                                "prop element must be empty for 'remove'.",
                            )
                    else:
                        arg_11 = arg_10

                    arg_6.append((arg_10.tag, arg_11))

        # Apply updates in SIMULATION MODE and create a result list (name,
        # result)
        arg_12 = True
        arg_13 = []

        for (arg_14, arg_11) in arg_6:
            try:
                arg_4.set_property_value(arg_14, arg_11, dry_run=True)
            except Exception as arg_19:
                arg_15 = as_DAVError(arg_19)
            else:
                arg_15 = "200 OK"
            arg_13.append((arg_14, arg_15))
            arg_12 = arg_12 and arg_15 == "200 OK"

        # Generate response list of 2-tuples (name, value)
        # <value> is None on success, or an instance of DAVError
        arg_16 = []
        arg_17 = []

        if not arg_12:
            # If dry run failed: convert all OK to FAILED_DEPENDENCY.
            for (arg_14, arg_18) in arg_13:
                if arg_18 == "200 OK":
                    arg_18 = DAVError(HTTP_FAILED_DEPENDENCY)
                elif isinstance(arg_18, DAVError):
                    arg_17.append(arg_18.get_user_info())
                arg_16.append((arg_14, arg_18))

        else:
            # Dry-run succeeded: set properties again, this time in 'real' mode
            # In theory, there should be no exceptions thrown here, but this is
            # real live...
            for (arg_14, arg_11) in arg_6:
                try:
                    arg_4.set_property_value(arg_14, arg_11, dry_run=False)
                    # Set value to None, so the response xml contains empty tags
                    arg_16.append((arg_14, None))
                except Exception as arg_19:
                    arg_19 = as_DAVError(arg_19)
                    arg_16.append((arg_14, arg_19))
                    arg_17.append(arg_19.get_user_info())

        # Generate response XML
        arg_20 = xml_tools.make_multistatus_el()
        arg_21 = arg_4.get_href()
        util.add_property_response(arg_20, arg_21, arg_16)
        if arg_17:
            arg_22.SubElement(
                arg_20, "{DAV:}responsedescription"
            ).text = "\n".join(arg_17)

        # Send response
        return util.send_multi_status_response(arg_1, arg_2, arg_20)

Handle PROPPATCH request to set or remove a property .


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
database
=
'sqlite:///%s'
%
arg_1
arg_0
.
storage
=
SREGISTRY_STORAGE
bot
.
debug
(
"Database located at %s"
%
arg_0
.
database
)
arg_0
.
engine
=
create_engine
(
arg_0
.
database
,
convert_unicode
=
True
)
arg_0
.
session
=
scoped_session
(
sessionmaker
(
autocommit
=
False
,
autoflush
=
False
,
bind
=
arg_0
.
engine
)
)
arg_6
.
query
=
arg_0
.
session
.
query_property
(
)
arg_6
.
metadata
.
create_all
(
bind
=
arg_0
.
engine
)
arg_0
.
Base
=
arg_6

def Func(arg_0, arg_1):
    '''initialize the database, with the default database path or custom of

       the format sqlite:////scif/data/expfactory.db

    The custom path can be set with the environment variable SREGISTRY_DATABASE
    when a user creates the client, we must initialize this db
    the database should use the .singularity cache folder to cache
    layers and images, and .singularity/sregistry.db as a database
    '''

    # Database Setup, use default if uri not provided
    arg_0.database = 'sqlite:///%s' % arg_1
    arg_0.storage = SREGISTRY_STORAGE

    bot.debug("Database located at %s" % arg_0.database)
    arg_0.engine = create_engine(arg_0.database, convert_unicode=True)
    arg_0.session = scoped_session(sessionmaker(autocommit=False,
                                               autoflush=False,
                                               bind=arg_0.engine))

    arg_6.query = arg_0.session.query_property()

    # import all modules here that might define models so that
    # they will be registered properly on the metadata.  Otherwise
    # you will have to import them first before calling Func()
    arg_6.metadata.create_all(bind=arg_0.engine)
    arg_0.Base = arg_6

initialize the database with the default database path or custom of


def Func ( arg_0 , arg_1 ) : arg_2 = np . unique ( arg_0 ) for arg_3 in arg_2 : if arg_3 == 0 or arg_3 == - 1 : continue arg_4 = _get_front_idxs_from_id ( arg_0 , arg_3 ) if len ( arg_4 ) < arg_1 : arg_5 = ( [ f for f , _ in arg_4 ] , [ s for _ , s in arg_4 ] ) arg_0 [ arg_5 ] = 0

def Func(arg_0, arg_1):
    """
    Removes all fronts from `fronts` which are strictly smaller than
    `size` consecutive frequencies in length.
    """
    arg_2 = np.unique(arg_0)
    for arg_3 in arg_2:
        if arg_3 == 0 or arg_3 == -1:
            continue
        arg_4 = _get_front_idxs_from_id(arg_0, arg_3)
        if len(arg_4) < arg_1:
            arg_5 = ([f for f, _ in arg_4], [s for _, s in arg_4])
            arg_0[arg_5] = 0

Removes all fronts from fronts which are strictly smaller than size consecutive frequencies in length .


(self, variables=None, secure_variables=None, materials=None,
                 return_new_instance=False, backoff_time=1.0)

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = None , arg_4 = False , arg_5 = 1.0 ) : arg_6 = dict ( arg_1 = arg_1 , arg_2 = arg_2 , material_fingerprint = arg_3 , headers = { "Confirm" : True } , ) arg_6 = dict ( ( k , v ) for k , v in arg_6 . items ( ) if v is not None ) if arg_4 : arg_7 = arg_0 . history ( ) [ 'pipelines' ] if len ( arg_7 ) == 0 : arg_8 = None else : arg_8 = arg_7 [ 0 ] [ 'counter' ] arg_9 = arg_0 . _post ( '/Func' , ok_status = 202 , ** arg_6 ) if not arg_9 : return arg_9 arg_10 = 10 while arg_10 > 0 : arg_11 = arg_0 . instance ( ) if not arg_8 and arg_11 : return arg_11 elif arg_8 and arg_11 [ 'counter' ] > arg_8 : return arg_11 else : time . sleep ( arg_5 ) arg_10 -= 1 return arg_9 else : return arg_0 . _post ( '/Func' , ok_status = 202 , ** arg_6 )

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,
                 arg_4=False, arg_5=1.0):
        """Schedule a pipeline run

        Aliased as :meth:`run`, :meth:`Func`, and :meth:`trigger`.

        Args:
          variables (dict, optional): Variables to set/override
          secure_variables (dict, optional): Secure variables to set/override
          materials (dict, optional): Material revisions to be used for
            this pipeline run. The exact format for this is a bit iffy,
            have a look at the official
            `Go pipeline scheduling documentation`__ or inspect a call
            from triggering manually in the UI.
          return_new_instance (bool): Returns a :meth:`history` compatible
            response for the newly Funcd instance. This is primarily so
            users easily can get the new instance number. **Note:** This is done
            in a very naive way, it just checks that the instance number is
            higher than before the pipeline was triggered.
          backoff_time (float): How long between each check for
            :arg:`return_new_instance`.

         .. __: http://api.go.cd/current/#scheduling-pipelines

        Returns:
          Response: :class:`gocd.api.response.Response` object
        """
        arg_6 = dict(
            arg_1=arg_1,
            arg_2=arg_2,
            material_fingerprint=arg_3,
            headers={"Confirm": True},
        )

        arg_6 = dict((k, v) for k, v in arg_6.items() if v is not None)

        # TODO: Replace this with whatever is the official way as soon as gocd#990 is fixed.
        # https://github.com/gocd/gocd/issues/990
        if arg_4:
            arg_7 = arg_0.history()['pipelines']
            if len(arg_7) == 0:
                arg_8 = None
            else:
                arg_8 = arg_7[0]['counter']
            arg_9 = arg_0._post('/Func', ok_status=202, **arg_6)
            if not arg_9:
                return arg_9

            arg_10 = 10
            while arg_10 > 0:
                arg_11 = arg_0.instance()
                if not arg_8 and arg_11:
                    return arg_11
                elif arg_8 and arg_11['counter'] > arg_8:
                    return arg_11
                else:
                    time.sleep(arg_5)
                    arg_10 -= 1

            # I can't come up with a scenario in testing where this would happen, but it seems
            # better than returning None.
            return arg_9
        else:
            return arg_0._post('/Func', ok_status=202, **arg_6)

Schedule a pipeline run

        Aliased as :meth:`run`, :meth:`schedule`, and :meth:`trigger`.

        Args:
          variables (dict, optional): Variables to set/override
          secure_variables (dict, optional): Secure variables to set/override
          materials (dict, optional): Material revisions to be used for
            this pipeline run. The exact format for this is a bit iffy,
            have a look at the official
            `Go pipeline scheduling documentation`__ or inspect a call
            from triggering manually in the UI.
          return_new_instance (bool): Returns a :meth:`history` compatible
            response for the newly scheduled instance. This is primarily so
            users easily can get the new instance number. **Note:** This is done
            in a very naive way, it just checks that the instance number is
            higher than before the pipeline was triggered.
          backoff_time (float): How long between each check for
            :arg:`return_new_instance`.

         .. __: http://api.go.cd/current/#scheduling-pipelines

        Returns:
          Response: :class:`gocd.api.response.Response` object


(xdata, ydata, std_error, fit, fit_function, xunit, exp_str,
                   qubit_label)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_6
,
arg_7
)
:
if
not
HAS_MATPLOTLIB
:
raise
ImportError
(
'The function Func needs matplotlib. '
'Run "pip install matplotlib" before.'
)
plt
.
errorbar
(
arg_0
,
arg_1
,
arg_2
,
marker
=
'.'
,
markersize
=
9
,
c
=
'b'
,
linestyle
=
''
)
plt
.
plot
(
arg_0
,
arg_4
(
arg_0
,
*
arg_3
)
,
c
=
'r'
,
linestyle
=
'--'
,
label
=
(
arg_6
+
'= %s %s'
%
(
str
(
round
(
arg_3
[
1
]
)
)
,
arg_5
)
)
)
plt
.
xticks
(
fontsize
=
14
,
rotation
=
70
)
plt
.
yticks
(
fontsize
=
14
)
plt
.
xlabel
(
'time [%s]'
%
(
arg_5
)
,
fontsize
=
16
)
plt
.
ylabel
(
'P(1)'
,
fontsize
=
16
)
plt
.
title
(
arg_6
+
' measurement of Q$_{%s}$'
%
(
str
(
arg_7
)
)
,
fontsize
=
18
)
plt
.
legend
(
fontsize
=
12
)
plt
.
grid
(
True
)
plt
.
show
(
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6,
                   arg_7):
    """Plot coherence data.

    Args:
        xdata
        ydata
        std_error
        fit
        fit_function
        xunit
        exp_str
        qubit_label
    Raises:
        ImportError: If matplotlib is not installed.
    """
    if not HAS_MATPLOTLIB:
        raise ImportError('The function Func needs matplotlib. '
                          'Run "pip install matplotlib" before.')
    plt.errorbar(arg_0, arg_1, arg_2, marker='.',
                 markersize=9, c='b', linestyle='')
    plt.plot(arg_0, arg_4(arg_0, *arg_3), c='r', linestyle='--',
             label=(arg_6 + '= %s %s' % (str(round(arg_3[1])), arg_5)))
    plt.xticks(fontsize=14, rotation=70)
    plt.yticks(fontsize=14)
    plt.xlabel('time [%s]' % (arg_5), fontsize=16)
    plt.ylabel('P(1)', fontsize=16)
    plt.title(arg_6 + ' measurement of Q$_{%s}$' % (str(arg_7)), fontsize=18)
    plt.legend(fontsize=12)
    plt.grid(True)
    plt.show()


def Func(arg_0, arg_1):
        """ Adds a node to the graph for each item in 'features' using
            the GraphNodes from the editor factory.
        """
        arg_2 = arg_0._graph

        if arg_2 is not None:
            for arg_3 in arg_1:
                for arg_4 in arg_0.factory.nodes:
                    if arg_3.__class__ in arg_4.node_for:
                        arg_2.add_node( id(arg_3), **arg_4.dot_attr )
                        break

        arg_2.arrange_all()

Adds a node to the graph for each item in features using the GraphNodes from the editor factory .


def Func ( arg_0 , arg_1 ) : for arg_2 in many ( arg_1 ) . PE_PE [ 8000 ] ( ) : arg_0 . accept ( arg_2 )

def Func(arg_0, arg_1):
        '''
        A Package contains packageable elements
        '''
        for arg_2 in many(arg_1).PE_PE[8000]():
            arg_0.accept(arg_2)


def Func ( arg_0 ) : if arg_0 . _Func is None : arg_0 . _Func = [ ] for arg_2 in arg_0 . grammar . children : if arg_2 . is_type ( TokenType . rule ) : arg_3 , arg_4 = arg_2 . children arg_0 . _Func . append ( Rule ( arg_3 . value , arg_0 . _expression_to_asn ( arg_4 ) , arg_3 . position , arg_2 . consumed ) ) return arg_0 . _Func

def Func(arg_0):
    """The AST Func."""
    if arg_0._Func is None:
      arg_0._Func = []
      for arg_2 in arg_0.grammar.children:
        if arg_2.is_type(TokenType.rule):
          arg_3, arg_4 = arg_2.children
          arg_0._Func.append(Rule(arg_3.value, arg_0._expression_to_asn(arg_4), arg_3.position, arg_2.consumed))
    return arg_0._Func


return [self.ode_obj.getAngleRate(i) for i in range(self.ADOF)]

def Func ( arg_0 ) : return [ arg_0 . ode_obj . getAngleRate ( arg_1 ) for arg_1 in range ( arg_0 . ADOF ) ]

def Func(arg_0):
        '''List of angle rates for rotational degrees of freedom.'''
        return [arg_0.ode_obj.getAngleRate(arg_1) for arg_1 in range(arg_0.ADOF)]

List of angle rates for rotational degrees of freedom .


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_1 is not None : arg_0 . component . remove ( arg_1 ) if arg_2 is not None : arg_0 . component . add ( arg_2 ) arg_3 , arg_4 = arg_0 . component . bounds arg_0 . component . position = [ arg_0 . pos [ 0 ] - ( arg_3 / 2 ) , arg_0 . pos [ 1 ] - ( arg_4 / 2 ) ] arg_0 . component . request_redraw ( )

def Func(arg_0, arg_1, arg_2):
        """ Handles the container of drawing components changing.
        """
        if arg_1 is not None:
            arg_0.component.remove( arg_1 )
        if arg_2 is not None:
#            new.bgcolor="pink"
            arg_0.component.add( arg_2 )

        arg_3, arg_4 = arg_0.component.bounds
        arg_0.component.position = [ arg_0.pos[0] - (arg_3/2), arg_0.pos[1] - (arg_4/2) ]
#        self.component.position = [ self.pos[0], self.pos[1] ]
        arg_0.component.request_redraw()

Handles the container of drawing components changing .


def Func(arg_0, arg_1):
        """Process the second challenge from the server and return the
        response.

        :Parameters:
            - `challenge`: the challenge from server.
        :Types:
            - `challenge`: `bytes`

        :return: the response or a failure indicator.
        :returntype: `sasl.Response` or `sasl.Failure`
        """
        if arg_0._finished:
            return Failure("extra-challenge")

        arg_2 = SERVER_FINAL_MESSAGE_RE.match(arg_1)
        if not arg_2:
            logger.debug("Bad final message syntax: {0!r}".format(arg_1))
            return Failure("bad-challenge")

        arg_3 = arg_2.group("error")
        if arg_3:
            logger.debug("Server returned SCRAM error: {0!r}".format(arg_3))
            return Failure(u"scram-" + arg_3.decode("utf-8"))

        arg_4 = arg_2.group("verifier")
        if not arg_4:
            logger.debug("No verifier value in the final message")
            return Failure("bad-succes")

        arg_5 = arg_0.HMAC(arg_0._salted_password, b"Server Key")
        arg_6 = arg_0.HMAC(arg_5, arg_0._auth_message)
        if arg_6 != a2b_base64(arg_4):
            logger.debug("Server verifier does not match")
            return Failure("bad-succes")

        arg_0._finished = True
        return Response(None)

Process the second challenge from the server and return the response .