def Func(arg_0, arg_1, arg_2):
        """
        Generate 2D OpenSimplex noise from X,Y coordinates.
        """
        # Place input coordinates onto grid.
        arg_3 = (arg_1 + arg_2) * STRETCH_CONSTANT_2D
        arg_4 = arg_1 + arg_3
        arg_5 = arg_2 + arg_3

        # Floor to get grid coordinates of rhombus (stretched square) super-cell origin.
        arg_6 = floor(arg_4)
        arg_7 = floor(arg_5)

        # Skew out to get actual coordinates of rhombus origin. We'll need these later.
        arg_8 = (arg_6 + arg_7) * SQUISH_CONSTANT_2D
        arg_9 = arg_6 + arg_8
        arg_10 = arg_7 + arg_8

        # Compute grid coordinates relative to rhombus origin.
        arg_11 = arg_4 - arg_6
        arg_12 = arg_5 - arg_7

        # Sum those together to get a value that determines which region we're in.
        arg_13 = arg_11 + arg_12

        # Positions relative to origin point.
        arg_14 = arg_1 - arg_9
        arg_15 = arg_2 - arg_10

        arg_16 = 0

        # Contribution (1,0)
        arg_17 = arg_14 - 1 - SQUISH_CONSTANT_2D
        arg_18 = arg_15 - 0 - SQUISH_CONSTANT_2D
        arg_19 = 2 - arg_17 * arg_17 - arg_18 * arg_18
        arg_20 = arg_0._extrapolate2d
        if arg_19 > 0:
            arg_19 *= arg_19
            arg_16 += arg_19 * arg_19 * arg_20(arg_6 + 1, arg_7 + 0, arg_17, arg_18)

        # Contribution (0,1)
        arg_21 = arg_14 - 0 - SQUISH_CONSTANT_2D
        arg_22 = arg_15 - 1 - SQUISH_CONSTANT_2D
        arg_23 = 2 - arg_21 * arg_21 - arg_22 * arg_22
        if arg_23 > 0:
            arg_23 *= arg_23
            arg_16 += arg_23 * arg_23 * arg_20(arg_6 + 0, arg_7 + 1, arg_21, arg_22)

        if arg_13 <= 1: # We're inside the triangle (2-Simplex) at (0,0)
            arg_24 = 1 - arg_13
            if arg_24 > arg_11 or arg_24 > arg_12: # (0,0) is one of the closest two triangular vertices
                if arg_11 > arg_12:
                    arg_25 = arg_6 + 1
                    arg_26 = arg_7 - 1
                    arg_27 = arg_14 - 1
                    arg_28 = arg_15 + 1
                else:
                    arg_25 = arg_6 - 1
                    arg_26 = arg_7 + 1
                    arg_27 = arg_14 + 1
                    arg_28 = arg_15 - 1
            else: # (1,0) and (0,1) are the closest two vertices.
                arg_25 = arg_6 + 1
                arg_26 = arg_7 + 1
                arg_27 = arg_14 - 1 - 2 * SQUISH_CONSTANT_2D
                arg_28 = arg_15 - 1 - 2 * SQUISH_CONSTANT_2D
        else: # We're inside the triangle (2-Simplex) at (1,1)
            arg_24 = 2 - arg_13
            if arg_24 < arg_11 or arg_24 < arg_12: # (0,0) is one of the closest two triangular vertices
                if arg_11 > arg_12:
                    arg_25 = arg_6 + 2
                    arg_26 = arg_7 + 0
                    arg_27 = arg_14 - 2 - 2 * SQUISH_CONSTANT_2D
                    arg_28 = arg_15 + 0 - 2 * SQUISH_CONSTANT_2D
                else:
                    arg_25 = arg_6 + 0
                    arg_26 = arg_7 + 2
                    arg_27 = arg_14 + 0 - 2 * SQUISH_CONSTANT_2D
                    arg_28 = arg_15 - 2 - 2 * SQUISH_CONSTANT_2D
            else: # (1,0) and (0,1) are the closest two vertices.
                arg_27 = arg_14
                arg_28 = arg_15
                arg_25 = arg_6
                arg_26 = arg_7
            arg_6 += 1
            arg_7 += 1
            arg_14 = arg_14 - 1 - 2 * SQUISH_CONSTANT_2D
            arg_15 = arg_15 - 1 - 2 * SQUISH_CONSTANT_2D

        # Contribution (0,0) or (1,1)
        arg_29 = 2 - arg_14 * arg_14 - arg_15 * arg_15
        if arg_29 > 0:
            arg_29 *= arg_29
            arg_16 += arg_29 * arg_29 * arg_20(arg_6, arg_7, arg_14, arg_15)

        # Extra Vertex
        arg_30 = 2 - arg_27 * arg_27 - arg_28 * arg_28
        if arg_30 > 0:
            arg_30 *= arg_30
            arg_16 += arg_30 * arg_30 * arg_20(arg_25, arg_26, arg_27, arg_28)

        return arg_16 / NORM_CONSTANT_2D

Generate 2D OpenSimplex noise from X Y coordinates .


def Func(arg_0, arg_1, arg_2):
        """Merges the set that contains ``a`` with the set that contains ``b``.

        Parameters
        ----------
        a, b : objects
            Two objects whose sets are to be merged.
        """
        arg_3, arg_4 = arg_0.find(arg_1), arg_0.find(arg_2)
        if arg_3 != arg_4:
            arg_5, arg_6  = arg_0._rank[arg_3], arg_0._rank[arg_4]
            if arg_6 > arg_5:
                arg_5, arg_6 = arg_6, arg_5
                arg_3, arg_4 = arg_4, arg_3
            if arg_5 == arg_6:
                arg_0._rank[arg_3] += 1

            arg_0._leader[arg_4] = arg_3
            arg_0._size[arg_3]  += arg_0._size[arg_4]
            arg_0.nClusters  -= 1

Merges the set that contains a with the set that contains b .


def Func ( arg_0 , arg_1 ) : if arg_1 is not None : if hasattr ( arg_1 , 'open' ) : arg_1 . open ( ) return super ( VersatileImageFormField , arg_0 ) . Func ( arg_1 )

def Func(arg_0, arg_1):
        """Ensure data is prepped properly before handing off to ImageField."""
        if arg_1 is not None:
            if hasattr(arg_1, 'open'):
                arg_1.open()
            return super(VersatileImageFormField, arg_0).Func(arg_1)

Ensure data is prepped properly before handing off to ImageField .


def Func ( arg_0 ) : dict . Func ( arg_0 ) arg_0 . nodes = [ ] arg_0 . edges = [ ] arg_0 . root = None arg_0 . layout . i = 0 arg_0 . alpha = 0

def Func(arg_0):

        """ Remove nodes and edges and reset the layout.
        """

        dict.Func(arg_0)
        arg_0.nodes = []
        arg_0.edges = []
        arg_0.root  = None

        arg_0.layout.i = 0
        arg_0.alpha = 0

Remove nodes and edges and reset the layout .


(source_jid, password, target_jid, body, subject = None,
                message_type = "chat", message_thread = None, settings = None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = None , arg_5 = "chat" , arg_6 = None , arg_7 = None ) : if sys . version_info . major < 3 : from locale import getpreferredencoding arg_8 = getpreferredencoding ( ) if isinstance ( arg_0 , str ) : arg_0 = arg_0 . decode ( arg_8 ) if isinstance ( arg_1 , str ) : arg_1 = arg_1 . decode ( arg_8 ) if isinstance ( arg_2 , str ) : arg_2 = arg_2 . decode ( arg_8 ) if isinstance ( arg_3 , str ) : arg_3 = arg_3 . decode ( arg_8 ) if isinstance ( arg_5 , str ) : arg_5 = arg_5 . decode ( arg_8 ) if isinstance ( arg_6 , str ) : arg_6 = arg_6 . decode ( arg_8 ) if not isinstance ( arg_0 , JID ) : arg_0 = JID ( arg_0 ) if not isinstance ( arg_2 , JID ) : arg_2 = JID ( arg_2 ) arg_9 = Message ( to_jid = arg_2 , arg_3 = arg_3 , arg_4 = arg_4 , stanza_type = arg_5 ) def action ( arg_10 ) : arg_10 . stream . send ( arg_9 ) if arg_7 is None : arg_7 = XMPPSettings ( { "starttls" : True , "tls_verify_peer" : False } ) if arg_1 is not None : arg_7 [ "password" ] = arg_1 arg_11 = FireAndForget ( arg_0 , action , arg_7 ) try : arg_11 . run ( ) except KeyboardInterrupt : arg_11 . disconnect ( ) raise

def Func(arg_0, arg_1, arg_2, arg_3, arg_4 = None,
                arg_5 = "chat", arg_6 = None, arg_7 = None):
    """Star an XMPP session and send a message, then exit.

    :Parameters:
        - `source_jid`: sender JID
        - `password`: sender password
        - `target_jid`: recipient JID
        - `body`: message body
        - `subject`: message subject
        - `message_type`: message type
        - `message_thread`: message thread id
        - `settings`: other settings
    :Types:
        - `source_jid`: `pyxmpp2.jid.JID` or `basestring`
        - `password`: `basestring`
        - `target_jid`: `pyxmpp.jid.JID` or `basestring`
        - `body`: `basestring`
        - `subject`: `basestring`
        - `message_type`: `basestring`
        - `settings`: `pyxmpp2.settings.XMPPSettings`
    """
    # pylint: disable=R0913,R0912
    if sys.version_info.major < 3:
        # pylint: disable-msg=W0404
        from locale import getpreferredencoding
        arg_8 = getpreferredencoding()
        if isinstance(arg_0, str):
            arg_0 = arg_0.decode(arg_8)
        if isinstance(arg_1, str):
            arg_1 = arg_1.decode(arg_8)
        if isinstance(arg_2, str):
            arg_2 = arg_2.decode(arg_8)
        if isinstance(arg_3, str):
            arg_3 = arg_3.decode(arg_8)
        if isinstance(arg_5, str):
            arg_5 = arg_5.decode(arg_8)
        if isinstance(arg_6, str):
            arg_6 = arg_6.decode(arg_8)

    if not isinstance(arg_0, JID):
        arg_0 = JID(arg_0)
    if not isinstance(arg_2, JID):
        arg_2 = JID(arg_2)

    arg_9 = Message(to_jid = arg_2, arg_3 = arg_3, arg_4 = arg_4,
                                                    stanza_type = arg_5)
    def action(arg_10):
        """Send a mesage `msg` via a client."""
        arg_10.stream.send(arg_9)

    if arg_7 is None:
        arg_7 = XMPPSettings({"starttls": True, "tls_verify_peer": False})

    if arg_1 is not None:
        arg_7["password"] = arg_1

    arg_11 = FireAndForget(arg_0, action, arg_7)
    try:
        arg_11.run()
    except KeyboardInterrupt:
        arg_11.disconnect()
        raise

Star an XMPP session and send a message then exit .


def
Func
(
arg_0
,
arg_1
)
:
assert
issubclass
(
arg_1
,
NativeContractBase
)
assert
len
(
arg_1
.
address
)
==
20
assert
arg_1
.
address
.
startswith
(
arg_0
.
native_contract_address_prefix
)
if
arg_0
.
native_contracts
.
get
(
arg_1
.
address
)
==
arg_1
.
_on_msg
:
log
.
debug
(
"already Funced"
,
arg_1
=
arg_1
,
arg_3
=
arg_1
.
address
)
return
assert
arg_1
.
address
not
in
arg_0
.
native_contracts
,
'address already taken'
arg_0
.
native_contracts
[
arg_1
.
address
]
=
arg_1
.
_on_msg
log
.
debug
(
"Funced native contract"
,
arg_1
=
arg_1
,
arg_3
=
arg_1
.
address
)

def Func(arg_0, arg_1):
        "Funcs NativeContract classes"
        assert issubclass(arg_1, NativeContractBase)
        assert len(arg_1.address) == 20
        assert arg_1.address.startswith(arg_0.native_contract_address_prefix)
        if arg_0.native_contracts.get(arg_1.address) == arg_1._on_msg:
            log.debug("already Funced", arg_1=arg_1, arg_3=arg_1.address)
            return
        assert arg_1.address not in arg_0.native_contracts, 'address already taken'
        arg_0.native_contracts[arg_1.address] = arg_1._on_msg
        log.debug("Funced native contract", arg_1=arg_1, arg_3=arg_1.address)


def Func(arg_0, arg_1):
        """
        Set the key wrapping data attributes using a dictionary.
        """
        if arg_1 is None:
            arg_1 = {}
        elif not isinstance(arg_1, dict):
            raise TypeError("Key wrapping data must be a dictionary.")

        arg_0._kdw_wrapping_method = arg_1.get('wrapping_method')

        arg_3 = arg_1.get('encryption_key_information')
        if arg_3 is None:
            arg_3 = {}
        arg_0._kdw_eki_unique_identifier = arg_3.get('unique_identifier')
        arg_5 = arg_3.get('cryptographic_parameters')
        if arg_5 is None:
            arg_5 = {}
        arg_0._kdw_eki_cp_block_cipher_mode = arg_5.get('block_cipher_mode')
        arg_0._kdw_eki_cp_padding_method = arg_5.get('padding_method')
        arg_0._kdw_eki_cp_hashing_algorithm = arg_5.get('hashing_algorithm')
        arg_0._kdw_eki_cp_key_role_type = arg_5.get('key_role_type')
        arg_0._kdw_eki_cp_digital_signature_algorithm = \
            arg_5.get('digital_signature_algorithm')
        arg_0._kdw_eki_cp_cryptographic_algorithm = \
            arg_5.get('cryptographic_algorithm')
        arg_0._kdw_eki_cp_random_iv = arg_5.get('random_iv')
        arg_0._kdw_eki_cp_iv_length = arg_5.get('iv_length')
        arg_0._kdw_eki_cp_tag_length = arg_5.get('tag_length')
        arg_0._kdw_eki_cp_fixed_field_length = arg_5.get('fixed_field_length')
        arg_0._kdw_eki_cp_invocation_field_length = \
            arg_5.get('invocation_field_length')
        arg_0._kdw_eki_cp_counter_length = arg_5.get('counter_length')
        arg_0._kdw_eki_cp_initial_counter_value = \
            arg_5.get('initial_counter_value')

        arg_19 = arg_1.get('mac_signature_key_information')
        if arg_19 is None:
            arg_19 = {}
        arg_0._kdw_mski_unique_identifier = arg_19.get('unique_identifier')
        arg_21 = arg_19.get('cryptographic_parameters')
        if arg_21 is None:
            arg_21 = {}
        arg_0._kdw_mski_cp_block_cipher_mode = arg_21.get('block_cipher_mode')
        arg_0._kdw_mski_cp_padding_method = arg_21.get('padding_method')
        arg_0._kdw_mski_cp_hashing_algorithm = arg_21.get('hashing_algorithm')
        arg_0._kdw_mski_cp_key_role_type = arg_21.get('key_role_type')
        arg_0._kdw_mski_cp_digital_signature_algorithm = \
            arg_21.get('digital_signature_algorithm')
        arg_0._kdw_mski_cp_cryptographic_algorithm = \
            arg_21.get('cryptographic_algorithm')
        arg_0._kdw_mski_cp_random_iv = arg_21.get('random_iv')
        arg_0._kdw_mski_cp_iv_length = arg_21.get('iv_length')
        arg_0._kdw_mski_cp_tag_length = arg_21.get('tag_length')
        arg_0._kdw_mski_cp_fixed_field_length = \
            arg_21.get('fixed_field_length')
        arg_0._kdw_mski_cp_invocation_field_length = \
            arg_21.get('invocation_field_length')
        arg_0._kdw_mski_cp_counter_length = arg_21.get('counter_length')
        arg_0._kdw_mski_cp_initial_counter_value = \
            arg_21.get('initial_counter_value')

        arg_0._kdw_mac_signature = arg_1.get('mac_signature')
        arg_0._kdw_iv_counter_nonce = arg_1.get('iv_counter_nonce')
        arg_0._kdw_encoding_option = arg_1.get('encoding_option')

Set the key wrapping data attributes using a dictionary .


def
Func
(
)
:
arg_0
=
get_docker_client
(
)
arg_1
=
get_exited_dusty_containers
(
)
arg_2
=
[
]
for
arg_3
in
arg_1
:
log_to_client
(
"Removing container {}"
.
format
(
arg_3
[
'Names'
]
[
0
]
)
)
try
:
arg_0
.
remove_container
(
arg_3
[
'Id'
]
,
v
=
True
)
arg_2
.
append
(
arg_3
)
except
Exception
as
e
:
log_to_client
(
e
.
message
or
str
(
e
)
)
return
arg_2

def Func():
    """Removed all dusty containers with 'Exited' in their status"""
    arg_0 = get_docker_client()
    arg_1 = get_exited_dusty_containers()
    arg_2 = []
    for arg_3 in arg_1:
        log_to_client("Removing container {}".format(arg_3['Names'][0]))
        try:
            arg_0.remove_container(arg_3['Id'], v=True)
            arg_2.append(arg_3)
        except Exception as e:
            log_to_client(e.message or str(e))
    return arg_2

Removed all dusty containers with Exited in their status


def Func(arg_0, arg_1):
    '''
    Moves a directory.

    :param unicode source_dir:

    :param unicode target_dir:

    :raises NotImplementedError:
        If trying to move anything other than:
            Local dir -> local dir
            FTP dir -> FTP dir (same host)
    '''
    if not IsDir(arg_0):
        from ._exceptions import DirectoryNotFoundError
        raise DirectoryNotFoundError(arg_0)

    if Exists(arg_1):
        from ._exceptions import DirectoryAlreadyExistsError
        raise DirectoryAlreadyExistsError(arg_1)

    from six.moves.urllib.parse import urlparse
    arg_2 = urlparse(arg_0)
    arg_3 = urlparse(arg_1)

    # Local to local
    if _UrlIsLocal(arg_2) and _UrlIsLocal(arg_3):
        import shutil
        shutil.move(arg_0, arg_1)

    # FTP to FTP
    elif arg_2.scheme == 'ftp' and arg_3.scheme == 'ftp':
        from ._exceptions import NotImplementedProtocol
        raise NotImplementedProtocol(arg_3.scheme)
    else:
        raise NotImplementedError('Can only move directories local->local or ftp->ftp')


def Func(arg_0, arg_1=None):
        """
        Send a GetAttributeList request to the server.

        Args:
            uid (string): The ID of the managed object with which the retrieved
                attribute names should be associated.

        Returns:
            result (GetAttributeListResult): A structure containing the results
                of the operation.
        """
        arg_2 = arg_0._build_Func_batch_item(arg_1)

        arg_3 = arg_0._build_request_message(None, [arg_2])
        arg_4 = arg_0._send_and_receive_message(arg_3)
        arg_5 = arg_0._process_batch_items(arg_4)
        return arg_5[0]

Send a GetAttributeList request to the server .


def Func ( arg_0 ) : arg_1 = arg_0 . config . get ( 'edit_Func' , False ) if arg_1 : return arg_1 else : return unicode ( inplace_settings . INPLACEEDIT_EDIT_EMPTY_VALUE )

def Func(arg_0):
        '''
        Get the text to display when the field is empty.
        '''
        arg_1 = arg_0.config.get('edit_Func', False)
        if arg_1:
            return arg_1
        else:
            return unicode(inplace_settings.INPLACEEDIT_EDIT_EMPTY_VALUE)

Get the text to display when the field is empty .


Render helper is used by template node functions
    to render given template with given tree items in context.

def Func ( arg_0 , arg_1 , arg_2 ) : arg_0 . push ( ) arg_0 [ 'sitetree_items' ] = arg_1 if isinstance ( arg_2 , FilterExpression ) : arg_2 = arg_2 . resolve ( arg_0 ) arg_3 = get_template ( arg_2 ) . Func ( arg_0 . flatten ( ) if _CONTEXT_FLATTEN else arg_0 ) arg_0 . pop ( ) return arg_3

def Func(arg_0, arg_1, arg_2):
    """Render helper is used by template node functions
    to Func given template with given tree items in context.

    """
    arg_0.push()
    arg_0['sitetree_items'] = arg_1

    if isinstance(arg_2, FilterExpression):
        arg_2 = arg_2.resolve(arg_0)

    arg_3 = get_template(arg_2).Func(arg_0.flatten() if _CONTEXT_FLATTEN else arg_0)
    arg_0.pop()

    return arg_3

Render helper is used by template node functions to render given template with given tree items in context .


def Func ( arg_0 , arg_1 , arg_2 ) : if not arg_2 . client : arg_2 . client = arg_0 . _clientgetter ( arg_1 = arg_1 ) if hasattr ( arg_2 . client , 'rsa_key' ) : return arg_2 . client . rsa_key return None

def Func(arg_0, arg_1, arg_2):
        """Retrieves a previously stored client provided RSA key."""
        if not arg_2.client:
            arg_2.client = arg_0._clientgetter(arg_1=arg_1)
        if hasattr(arg_2.client, 'rsa_key'):
            return arg_2.client.rsa_key
        return None

Retrieves a previously stored client provided RSA key .


def Func ( arg_0 , arg_1 = False , ** arg_2 ) : arg_0 . batch_id = None arg_0 . operation_status = None if arg_1 : return arg_0 . _iterate ( url = arg_0 . _build_path ( ) , ** arg_2 ) else : return arg_0 . _mc_client . _get ( url = arg_0 . _build_path ( ) , ** arg_2 )

def Func(arg_0, arg_1=False, **arg_2):
        """
        Get a summary of batch requests that have been made.

        :param get_Func: Should the query get Func results
        :type get_Func: :py:class:`bool`
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        queryparams['count'] = integer
        queryparams['offset'] = integer
        """
        arg_0.batch_id = None
        arg_0.operation_status = None
        if arg_1:
            return arg_0._iterate(url=arg_0._build_path(), **arg_2)
        else:
            return arg_0._mc_client._get(url=arg_0._build_path(), **arg_2)

Get a summary of batch requests that have been made.

        :param get_all: Should the query get all results
        :type get_all: :py:class:`bool`
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        queryparams['count'] = integer
        queryparams['offset'] = integer

Get a summary of batch requests that have been made .


(
        ns: sym.Symbol, name: sym.Symbol, val, dynamic: bool = False, meta=None
    )

def Func(
        arg_0: arg_1.Symbol, arg_3: arg_1.Symbol, arg_4, arg_5: arg_6 = False, arg_7=None
    ) -> "Var":
        """Intern the value bound to the symbol `name` in namespace `ns`."""
        arg_8 = Namespace.get_or_create(arg_0)
        arg_9 = arg_8.Func(arg_3, Var(arg_8, arg_3, arg_5=arg_5, arg_7=arg_7))
        arg_9.root = arg_4
        return arg_9

Intern the value bound to the symbol name in namespace ns .


def Func ( arg_0 ) : arg_1 = { } for arg_2 in arg_0 . parms : arg_1 [ arg_2 ] = arg_0 . parms [ arg_2 ] [ "default_value" ] return arg_1

def Func(arg_0):
        """Dictionary of the default parameters of the model."""
        arg_1 = {}
        for arg_2 in arg_0.parms:
            arg_1[arg_2] = arg_0.parms[arg_2]["default_value"]
        return arg_1

Dictionary of the default parameters of the model .


def Func(arg_0, arg_1):
        """
        Render all includes in asset by names

        :type name: str|unicode
        :rtype: str|unicode
        """
        arg_2 = ""
        if arg_0.has_asset(arg_1):
            arg_3 = arg_0.get_asset(arg_1)
            if arg_3.files:
                for arg_4 in arg_3.files:
                    arg_2 += arg_4.render_include() + "\r\n"
        return arg_2


def Func ( arg_0 ) : arg_1 = singledispatch ( arg_0 ) def arg_4 ( * arg_2 , ** arg_3 ) : return arg_1 . dispatch ( arg_2 [ 1 ] . __class__ ) ( * arg_2 , ** arg_3 ) arg_4 . register = arg_1 . register update_wrapper ( arg_4 , arg_1 ) return arg_4

def Func(arg_0):
    '''
    Enable singledispatch for class methods.

    See http://stackoverflow.com/a/24602374/274318
    '''
    arg_1 = singledispatch(arg_0)
    def arg_4(*arg_2, **arg_3):
        return arg_1.dispatch(arg_2[1].__class__)(*arg_2, **arg_3)
    arg_4.register = arg_1.register
    update_wrapper(arg_4, arg_1)
    return arg_4

Enable singledispatch for class methods .


def Func ( arg_0 , arg_1 = None ) : arg_2 = list ( arg_0 . common . sections ) if not arg_1 : if arg_0 . bare is not None : arg_2 . extend ( arg_0 . bare . sections ) return arg_2 return [ ] arg_2 . extend ( arg_0 . subcmds [ arg_1 ] . sections ) if arg_1 in arg_0 . _conf : arg_2 . append ( arg_1 ) return arg_2

def Func(arg_0, arg_1=None):
        """List of config sections used by a command.

        Args:
            cmd (str): command name, set to ``None`` or ``''`` for the bare
                command.

        Returns:
            list of str: list of configuration sections used by that command.
        """
        arg_2 = list(arg_0.common.sections)
        if not arg_1:
            if arg_0.bare is not None:
                arg_2.extend(arg_0.bare.sections)
                return arg_2
            return []
        arg_2.extend(arg_0.subcmds[arg_1].sections)
        if arg_1 in arg_0._conf:
            arg_2.append(arg_1)
        return arg_2

List of config sections used by a command .


return CloudSqlProxyRunner(
            path_prefix=self.sql_proxy_unique_path,
            instance_specification=self._get_sqlproxy_instance_specification(),
            project_id=self.project_id,
            sql_proxy_version=self.sql_proxy_version,
            sql_proxy_binary_path=self.sql_proxy_binary_path
        )

def Func(arg_0):
        """
        Retrieve Cloud SQL Proxy runner. It is used to manage the proxy
        lifecycle per task.

        :return: The Cloud SQL Proxy runner.
        :rtype: CloudSqlProxyRunner
        """
        if not arg_0.use_proxy:
            raise AirflowException("Proxy runner can only be retrieved in case of use_proxy = True")
        return CloudSqlProxyRunner(
            path_prefix=arg_0.sql_proxy_unique_path,
            instance_specification=arg_0._get_sqlproxy_instance_specification(),
            project_id=arg_0.project_id,
            sql_proxy_version=arg_0.sql_proxy_version,
            sql_proxy_binary_path=arg_0.sql_proxy_binary_path
        )

Retrieve Cloud SQL Proxy runner . It is used to manage the proxy lifecycle per task .


Generates a random sample from the discrete probability distribution
    and returns its value and the log of the probability of sampling that value.

def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 . uniform ( 0 , arg_0 . sum ) arg_3 = bisect . bisect ( arg_0 . cdf , arg_2 ) return arg_0 . keys [ arg_3 ] , numpy . log ( arg_0 . pmf [ arg_3 ] )

def Func(arg_0, arg_1):
    """Generates a random Func from the discrete probability distribution
    and returns its value and the log of the probability of sampling that value.
    """
    arg_2 = arg_1.uniform(0, arg_0.sum)
    arg_3 = bisect.bisect(arg_0.cdf, arg_2)
    return arg_0.keys[arg_3], numpy.log(arg_0.pmf[arg_3])

Generates a random sample from the discrete probability distribution and returns its value and the log of the probability of sampling that value .


def Func ( arg_0 , arg_1 , arg_2 = 0.04 , arg_3 = 1000 , arg_4 = False , arg_5 = False ) : arg_6 = arg_2 / 2.0 arg_7 = arg_6 / arg_1 arg_8 = 1 / arg_1 arg_9 = np . arange ( 0 , arg_3 ) arg_10 = ( arg_8 + arg_9 * arg_7 ) arg_10 = arg_10 . astype ( 'int' ) arg_11 = np . array ( np . reshape ( arg_10 [ : ] , ( arg_3 / 2 , 2 ) ) ) arg_11 [ : , 0 ] = arg_11 [ : , 0 ] + 1 arg_12 = np . array ( np . reshape ( arg_10 [ 1 : - 1 ] , ( arg_3 / 2 - 1 , 2 ) ) ) arg_12 [ : , 0 ] = arg_12 [ : , 0 ] + 1 arg_13 = [ ] arg_14 = [ ] for arg_15 in arg_11 : if arg_15 [ 1 ] != arg_15 [ 0 ] : arg_13 . append ( np . sum ( arg_0 [ arg_15 [ 0 ] : arg_15 [ 1 ] , : , : ] , axis = 0 ) / ( arg_15 [ 1 ] - arg_15 [ 0 ] ) ) for arg_15 in arg_12 : if arg_15 [ 1 ] != arg_15 [ 0 ] : arg_14 . append ( np . sum ( arg_0 [ arg_15 [ 0 ] : arg_15 [ 1 ] , : , : ] , axis = 0 ) / ( arg_15 [ 1 ] - arg_15 [ 0 ] ) ) if arg_4 == False : if arg_5 == False : return np . squeeze ( np . mean ( arg_13 , axis = 0 ) ) , np . squeeze ( np . mean ( arg_14 , axis = 0 ) ) else : return np . squeeze ( np . mean ( arg_13 , axis = 0 ) ) , np . squeeze ( np . mean ( arg_14 , axis = 0 ) ) , arg_11 , arg_12 if arg_4 == True : if arg_5 == False : return np . squeeze ( np . mean ( arg_14 , axis = 0 ) ) , np . squeeze ( np . mean ( arg_13 , axis = 0 ) ) else : return np . squeeze ( np . mean ( arg_14 , axis = 0 ) ) , np . squeeze ( np . mean ( arg_13 , axis = 0 ) ) , arg_12 , arg_11

def Func(arg_0,arg_1, arg_2=0.04,arg_3=1000,arg_4=False,arg_5=False):
    '''
    Returns time-averaged spectra of the ON and OFF measurements in a
    calibrator measurement with flickering noise diode

    Parameters
    ----------
    data : 2D Array object (float)
        2D dynamic spectrum for data (any Stokes parameter) with flickering noise diode.
    tsamp : float
        Sampling time of data in seconds
    diode_p : float
        Period of the flickering noise diode in seconds
    numsamps : int
        Number of samples over which to average noise diode ON and OFF
    switch : boolean
        Use switch=True if the noise diode "skips" turning from OFF to ON once or vice versa
    inds : boolean
        Use inds=True to also return the indexes of the time series where the ND is ON and OFF
    '''

    arg_6 = arg_2/2.0

    arg_7 = arg_6/arg_1   #number of time samples per diode switch

    arg_8 = 1/arg_1    #number of time samples in the first second

    #Find diode switches in units of time samples and round down to the nearest int
    arg_9 = np.arange(0,arg_3)
    arg_10 = (arg_8+arg_9*arg_7)
    arg_10 = arg_10.astype('int')

    arg_11 = np.array(np.reshape(arg_10[:],(arg_3/2,2)))
    arg_11[:,0] = arg_11[:,0]+1   #Find index ranges of ON time samples

    arg_12 = np.array(np.reshape(arg_10[1:-1],(arg_3/2-1,2)))
    arg_12[:,0] = arg_12[:,0]+1   #Find index ranges of OFF time samples

    arg_13 = []
    arg_14 = []

    #Average ON and OFF spectra separately with respect to time
    for arg_15 in arg_11:
        if arg_15[1]!=arg_15[0]:
            arg_13.append(np.sum(arg_0[arg_15[0]:arg_15[1],:,:],axis=0)/(arg_15[1]-arg_15[0]))

    for arg_15 in arg_12:
        if arg_15[1]!=arg_15[0]:
            arg_14.append(np.sum(arg_0[arg_15[0]:arg_15[1],:,:],axis=0)/(arg_15[1]-arg_15[0]))

    #If switch=True, flip the return statement since ON is actually OFF
    if arg_4==False:
        if arg_5==False:
            return np.squeeze(np.mean(arg_13,axis=0)), np.squeeze(np.mean(arg_14,axis=0))
        else:
            return np.squeeze(np.mean(arg_13,axis=0)), np.squeeze(np.mean(arg_14,axis=0)),arg_11,arg_12
    if arg_4==True:
        if arg_5==False:
            return np.squeeze(np.mean(arg_14,axis=0)), np.squeeze(np.mean(arg_13,axis=0))
        else:
            return np.squeeze(np.mean(arg_14,axis=0)), np.squeeze(np.mean(arg_13,axis=0)),arg_12,arg_11

Returns time - averaged spectra of the ON and OFF measurements in a calibrator measurement with flickering noise diode


return np.exp(np.log(a).mean() - np.log(b).mean())

def Func ( arg_0 , arg_1 ) : return np . exp ( np . log ( arg_0 ) . mean ( ) - np . log ( arg_1 ) . mean ( ) )

def Func(arg_0, arg_1):
    """Geometric mean bias
    """
    return np.exp(np.log(arg_0).mean() - np.log(arg_1).mean())


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_0 . curr_domains [ arg_1 ] . remove ( arg_2 ) if arg_3 is not None : arg_3 . append ( ( arg_1 , arg_2 ) )

def Func(arg_0, arg_1, arg_2, arg_3):
        "Rule out var=value."
        arg_0.curr_domains[arg_1].remove(arg_2)
        if arg_3 is not None: arg_3.append((arg_1, arg_2))


(self, container_name, prefix, **kwargs)

def Func ( arg_0 , arg_1 , arg_2 , ** arg_3 ) : arg_4 = arg_0 . connection . list_blobs ( arg_1 , arg_2 , num_results = 1 , ** arg_3 ) return len ( list ( arg_4 ) ) > 0

def Func(arg_0, arg_1, arg_2, **arg_3):
        """
        Check if a prefix exists on Azure Blob storage.

        :param container_name: Name of the container.
        :type container_name: str
        :param prefix: Prefix of the blob.
        :type prefix: str
        :param kwargs: Optional keyword arguments that
            `BlockBlobService.list_blobs()` takes.
        :type kwargs: object
        :return: True if blobs matching the prefix exist, False otherwise.
        :rtype: bool
        """
        arg_4 = arg_0.connection.list_blobs(arg_1, arg_2,
                                             num_results=1, **arg_3)
        return len(list(arg_4)) > 0

Check if a prefix exists on Azure Blob storage .


def Func(arg_0):
    """
    Highlight common SQL words in a string.
    """
    arg_0 = escape(arg_0)
    arg_0 = RE_SQL_NL.sub(u'
\n\\1', arg_0)
    arg_0 = RE_SQL.sub(u'\\1', arg_0)
    return arg_0

Highlight common SQL words in a string .


def Func ( arg_0 ) : for arg_1 in arg_0 . buffer : arg_0 . output_width += arg_1 . output ( arg_0 . output , arg_0 . output_width ) arg_0 . buffer . clear ( ) arg_0 . buffer_width = 0

def Func(arg_0):
        """Flush data that is left in the buffer."""
        for arg_1 in arg_0.buffer:
            arg_0.output_width += arg_1.output(arg_0.output, arg_0.output_width)
        arg_0.buffer.clear()
        arg_0.buffer_width = 0


return self.blockchain.finalizeOp(op, signers, "active", **kwargs)

def
Func
(
arg_0
,
arg_1
=
,
**
arg_2
)
:
if
not
arg_1
:
if
"default_account"
in
arg_0
.
blockchain
.
config
:
arg_1
=
arg_0
.
blockchain
.
config
[
"default_account"
]
if
not
arg_1
:
raise
ValueError
(
"You need to provide an account"
)
arg_1
=
arg_0
.
account_class
(
arg_1
,
blockchain_instance
=
arg_0
.
blockchain
)
arg_3
=
arg_0
.
blockchain
.
wallet
.
getPublicKeys
(
)
arg_4
=
dict
(
)
for
arg_5
in
arg_3
:
if
arg_5
[
:
len
(
arg_0
.
blockchain
.
prefix
)
]
!=
arg_0
.
blockchain
.
prefix
:
continue
arg_6
=
arg_0
.
publickey_class
(
arg_5
,
arg_12
=
arg_0
.
blockchain
.
prefix
)
arg_4
[
arg_7
(
arg_0
.
address_class
.
from_pubkey
(
arg_6
,
arg_10
=
False
,
arg_11
=
0
,
arg_12
=
arg_0
.
blockchain
.
prefix
,
)
)
]
=
arg_6
arg_4
[
arg_7
(
arg_0
.
address_class
.
from_pubkey
(
arg_6
,
arg_10
=
True
,
arg_11
=
0
,
arg_12
=
arg_0
.
blockchain
.
prefix
,
)
)
]
=
arg_6
arg_4
[
arg_7
(
arg_0
.
address_class
.
from_pubkey
(
arg_6
,
arg_10
=
False
,
arg_11
=
56
,
arg_12
=
arg_0
.
blockchain
.
prefix
,
)
)
]
=
arg_6
arg_4
[
arg_7
(
arg_0
.
address_class
.
from_pubkey
(
arg_6
,
arg_10
=
True
,
arg_11
=
56
,
arg_12
=
arg_0
.
blockchain
.
prefix
,
)
)
]
=
arg_6
if
arg_0
[
"owner"
]
not
in
arg_4
.
keys
(
)
:
raise
MissingKeyError
(
"Need key for address {}"
.
format
(
arg_0
[
"owner"
]
)
)
arg_14
=
arg_0
.
operations
.
Balance_Func
(
**
{
"fee"
:
{
"amount"
:
0
,
"asset_id"
:
"1.3.0"
}
,
"deposit_to_account"
:
arg_1
[
"id"
]
,
"balance_to_Func"
:
arg_0
[
"id"
]
,
"balance_owner_key"
:
arg_4
[
arg_0
[
"owner"
]
]
,
"total_Funced"
:
arg_0
[
"balance"
]
,
"prefix"
:
arg_0
.
blockchain
.
prefix
,
}
)
arg_15
=
[
arg_1
[
"name"
]
,
arg_4
.
get
(
arg_0
[
"owner"
]
)
,
]
return
arg_0
.
blockchain
.
finalizeOp
(
arg_14
,
arg_15
,
"active"
,
**
arg_2
)

def Func(arg_0, arg_1=None, **arg_2):
        """ Claim a balance from the genesis block

            :param str balance_id: The identifier that identifies the balance
                to Func (1.15.x)
            :param str account: (optional) the account that owns the bet
                (defaults to ``default_account``)
        """
        if not arg_1:
            if "default_account" in arg_0.blockchain.config:
                arg_1 = arg_0.blockchain.config["default_account"]
        if not arg_1:
            raise ValueError("You need to provide an account")
        arg_1 = arg_0.account_class(arg_1, blockchain_instance=arg_0.blockchain)
        arg_3 = arg_0.blockchain.wallet.getPublicKeys()
        arg_4 = dict()
        for arg_5 in arg_3:
            if arg_5[: len(arg_0.blockchain.prefix)] != arg_0.blockchain.prefix:
                continue
            arg_6 = arg_0.publickey_class(arg_5, arg_12=arg_0.blockchain.prefix)
            arg_4[
                arg_7(
                    arg_0.address_class.from_pubkey(
                        arg_6,
                        arg_10=False,
                        arg_11=0,
                        arg_12=arg_0.blockchain.prefix,
                    )
                )
            ] = arg_6
            arg_4[
                arg_7(
                    arg_0.address_class.from_pubkey(
                        arg_6,
                        arg_10=True,
                        arg_11=0,
                        arg_12=arg_0.blockchain.prefix,
                    )
                )
            ] = arg_6
            arg_4[
                arg_7(
                    arg_0.address_class.from_pubkey(
                        arg_6,
                        arg_10=False,
                        arg_11=56,
                        arg_12=arg_0.blockchain.prefix,
                    )
                )
            ] = arg_6
            arg_4[
                arg_7(
                    arg_0.address_class.from_pubkey(
                        arg_6,
                        arg_10=True,
                        arg_11=56,
                        arg_12=arg_0.blockchain.prefix,
                    )
                )
            ] = arg_6

        if arg_0["owner"] not in arg_4.keys():
            raise MissingKeyError("Need key for address {}".format(arg_0["owner"]))

        arg_14 = arg_0.operations.Balance_Func(
            **{
                "fee": {"amount": 0, "asset_id": "1.3.0"},
                "deposit_to_account": arg_1["id"],
                "balance_to_Func": arg_0["id"],
                "balance_owner_key": arg_4[arg_0["owner"]],
                "total_Funced": arg_0["balance"],
                "prefix": arg_0.blockchain.prefix,
            }
        )
        arg_15 = [
            arg_1["name"],  # The fee payer and receiver account
            arg_4.get(arg_0["owner"]),  # The genesis balance!
        ]
        return arg_0.blockchain.finalizeOp(arg_14, arg_15, "active", **arg_2)

Claim a balance from the genesis block

            :param str balance_id: The identifier that identifies the balance
                to claim (1.15.x)
            :param str account: (optional) the account that owns the bet
                (defaults to ``default_account``)


(value, _divisor=1., tz=UTC, encoding=None)

def Func ( arg_0 , arg_1 = 1. , arg_2 = arg_3 , arg_4 = None ) : arg_0 = Float ( arg_0 , arg_4 ) if arg_0 is not None : arg_0 = arg_0 / arg_1 return datetime . fromtimestamp ( arg_0 , arg_2 ) return None

def Func(arg_0, arg_1=1., arg_2=arg_3, arg_4=None):
    """
    Parse a value as a POSIX timestamp in seconds.

    :type  value: `unicode` or `bytes`
    :param value: Text value to parse, which should be the number of seconds
        since the epoch.

    :type  _divisor: `float`
    :param _divisor: Number to divide the value by.

    :type  tz: `tzinfo`
    :param tz: Timezone, defaults to UTC.

    :type  encoding: `bytes`
    :param encoding: Encoding to treat `bytes` values as, defaults to
        ``utf-8``.

    :rtype: `datetime.datetime`
    :return: Parsed datetime or ``None`` if ``value`` could not be parsed.
    """
    arg_0 = Float(arg_0, arg_4)
    if arg_0 is not None:
        arg_0 = arg_0 / arg_1
        return datetime.fromtimestamp(arg_0, arg_2)
    return None

Parse a value as a POSIX timestamp in seconds .


(
    f,
    p_log_prob,
    q,
    num_draws,
    use_reparametrization=None,
    seed=None,
    name=None)

def Func(
    arg_0,
    arg_1,
    arg_2,
    arg_3,
    arg_4=None,
    arg_5=None,
    arg_6=None):
  """Monte-Carlo approximation of the Csiszar f-Divergence.

  A Csiszar-function is a member of,

  ```none
  F = { f:R_+ to R : f convex }.
  ```

  The Csiszar f-Divergence for Csiszar-function f is given by:

  ```none
  D_f[p(X), q(X)] := E_{q(X)}[ f( p(X) / q(X) ) ]
                  ~= m**-1 sum_j^m f( p(x_j) / q(x_j) ),
                             where x_j ~iid q(X)
  ```

  Tricks: Reparameterization and Score-Gradient

  When q is "reparameterized", i.e., a diffeomorphic transformation of a
  parameterless distribution (e.g.,
  `Normal(Y; m, s) <=> Y = sX + m, X ~ Normal(0,1)`), we can swap gradient and
  expectation, i.e.,
  `grad[Avg{ s_i : i=1...n }] = Avg{ grad[s_i] : i=1...n }` where `S_n=Avg{s_i}`
  and `s_i = f(x_i), x_i ~iid q(X)`.

  However, if q is not reparameterized, TensorFlow's gradient will be incorrect
  since the chain-rule stops at samples of unreparameterized distributions. In
  this circumstance using the Score-Gradient trick results in an unbiased
  gradient, i.e.,

  ```none
  grad[ E_q[f(X)] ]
  = grad[ int dx q(x) f(x) ]
  = int dx grad[ q(x) f(x) ]
  = int dx [ q'(x) f(x) + q(x) f'(x) ]
  = int dx q(x) [q'(x) / q(x) f(x) + f'(x) ]
  = int dx q(x) grad[ f(x) q(x) / stop_grad[q(x)] ]
  = E_q[ grad[ f(x) q(x) / stop_grad[q(x)] ] ]
  ```

  Unless `q.reparameterization_type != tfd.FULLY_REPARAMETERIZED` it is
  usually preferable to set `use_reparametrization = True`.

  Example Application:

  The Csiszar f-Divergence is a useful framework for variational inference.
  I.e., observe that,

  ```none
  f(p(x)) =  f( E_{q(Z | x)}[ p(x, Z) / q(Z | x) ] )
          <= E_{q(Z | x)}[ f( p(x, Z) / q(Z | x) ) ]
          := D_f[p(x, Z), q(Z | x)]
  ```

  The inequality follows from the fact that the "perspective" of `f`, i.e.,
  `(s, t) |-> t f(s / t))`, is convex in `(s, t)` when `s/t in domain(f)` and
  `t` is a real. Since the above framework includes the popular Evidence Lower
  BOund (ELBO) as a special case, i.e., `f(u) = -log(u)`, we call this framework
  "Evidence Divergence Bound Optimization" (EDBO).

  Args:
    f: Python `callable` representing a Csiszar-function in log-space, i.e.,
      takes `p_log_prob(q_samples) - q.log_prob(q_samples)`.
    p_log_prob: Python `callable` taking (a batch of) samples from `q` and
      returning the natural-log of the probability under distribution `p`.
      (In variational inference `p` is the joint distribution.)
    q: `tf.Distribution`-like instance; must implement:
      `reparameterization_type`, `sample(n, seed)`, and `log_prob(x)`.
      (In variational inference `q` is the approximate posterior distribution.)
    num_draws: Integer scalar number of draws used to approximate the
      f-Divergence expectation.
    use_reparametrization: Python `bool`. When `None` (the default),
      automatically set to:
      `q.reparameterization_type == tfd.FULLY_REPARAMETERIZED`.
      When `True` uses the standard Monte-Carlo average. When `False` uses the
      score-gradient trick. (See above for details.)  When `False`, consider
      using `csiszar_vimco`.
    seed: Python `int` seed for `q.sample`.
    name: Python `str` name prefixed to Ops created by this function.

  Returns:
    Func: `float`-like `Tensor` Monte Carlo
      approximation of the Csiszar f-Divergence.

  Raises:
    ValueError: if `q` is not a reparameterized distribution and
      `use_reparametrization = True`. A distribution `q` is said to be
      "reparameterized" when its samples are generated by transforming the
      samples of another distribution which does not depend on the
      parameterization of `q`. This property ensures the gradient (with respect
      to parameters) is valid.
    TypeError: if `p_log_prob` is not a Python `callable`.
  """
  arg_7 = tf.nest.flatten(arg_2.reparameterization_type)
  with tf.compat.v1.name_scope(arg_6, "Func",
                               [arg_3]):
    if arg_4 is None:
      arg_4 = all(
          arg_8 == tfd.FULLY_REPARAMETERIZED
          for arg_8 in arg_7)
    elif (arg_4 and
          any(arg_8 != tfd.FULLY_REPARAMETERIZED
              for arg_8 in arg_7)):
      # TODO(jvdillon): Consider only raising an exception if the gradient is
      # requested.
      raise ValueError(
          "Distribution `q` must be reparameterized, i.e., a diffeomorphic "
          "transformation of a parameterless distribution. (Otherwise this "
          "function has a biased gradient.)")
    if not callable(arg_1):
      raise TypeError("`p_log_prob` must be a Python `callable` function.")
    return monte_carlo.expectation(
        arg_0=lambda q_samples: arg_0(arg_1(q_samples) - arg_2.log_prob(q_samples)),
        samples=arg_2.sample(arg_3, arg_5=arg_5),
        log_prob=arg_2.log_prob,  # Only used if use_reparametrization=False.
        arg_4=arg_4)

Monte-Carlo approximation of the Csiszar f-Divergence.

  A Csiszar-function is a member of,

  ```none
  F = { f:R_+ to R : f convex }.
  ```

  The Csiszar f-Divergence for Csiszar-function f is given by:

  ```none
  D_f[p(X), q(X)] := E_{q(X)}[ f( p(X) / q(X) ) ]
                  ~= m**-1 sum_j^m f( p(x_j) / q(x_j) ),
                             where x_j ~iid q(X)
  ```

  Tricks: Reparameterization and Score-Gradient

  When q is "reparameterized", i.e., a diffeomorphic transformation of a
  parameterless distribution (e.g.,
  `Normal(Y; m, s) <=> Y = sX + m, X ~ Normal(0,1)`), we can swap gradient and
  expectation, i.e.,
  `grad[Avg{ s_i : i=1...n }] = Avg{ grad[s_i] : i=1...n }` where `S_n=Avg{s_i}`
  and `s_i = f(x_i), x_i ~iid q(X)`.

  However, if q is not reparameterized, TensorFlow's gradient will be incorrect
  since the chain-rule stops at samples of unreparameterized distributions. In
  this circumstance using the Score-Gradient trick results in an unbiased
  gradient, i.e.,

  ```none
  grad[ E_q[f(X)] ]
  = grad[ int dx q(x) f(x) ]
  = int dx grad[ q(x) f(x) ]
  = int dx [ q'(x) f(x) + q(x) f'(x) ]
  = int dx q(x) [q'(x) / q(x) f(x) + f'(x) ]
  = int dx q(x) grad[ f(x) q(x) / stop_grad[q(x)] ]
  = E_q[ grad[ f(x) q(x) / stop_grad[q(x)] ] ]
  ```

  Unless `q.reparameterization_type != tfd.FULLY_REPARAMETERIZED` it is
  usually preferable to set `use_reparametrization = True`.

  Example Application:

  The Csiszar f-Divergence is a useful framework for variational inference.
  I.e., observe that,

  ```none
  f(p(x)) =  f( E_{q(Z | x)}[ p(x, Z) / q(Z | x) ] )
          <= E_{q(Z | x)}[ f( p(x, Z) / q(Z | x) ) ]
          := D_f[p(x, Z), q(Z | x)]
  ```

  The inequality follows from the fact that the "perspective" of `f`, i.e.,
  `(s, t) |-> t f(s / t))`, is convex in `(s, t)` when `s/t in domain(f)` and
  `t` is a real. Since the above framework includes the popular Evidence Lower
  BOund (ELBO) as a special case, i.e., `f(u) = -log(u)`, we call this framework
  "Evidence Divergence Bound Optimization" (EDBO).

  Args:
    f: Python `callable` representing a Csiszar-function in log-space, i.e.,
      takes `p_log_prob(q_samples) - q.log_prob(q_samples)`.
    p_log_prob: Python `callable` taking (a batch of) samples from `q` and
      returning the natural-log of the probability under distribution `p`.
      (In variational inference `p` is the joint distribution.)
    q: `tf.Distribution`-like instance; must implement:
      `reparameterization_type`, `sample(n, seed)`, and `log_prob(x)`.
      (In variational inference `q` is the approximate posterior distribution.)
    num_draws: Integer scalar number of draws used to approximate the
      f-Divergence expectation.
    use_reparametrization: Python `bool`. When `None` (the default),
      automatically set to:
      `q.reparameterization_type == tfd.FULLY_REPARAMETERIZED`.
      When `True` uses the standard Monte-Carlo average. When `False` uses the
      score-gradient trick. (See above for details.)  When `False`, consider
      using `csiszar_vimco`.
    seed: Python `int` seed for `q.sample`.
    name: Python `str` name prefixed to Ops created by this function.

  Returns:
    monte_carlo_csiszar_f_divergence: `float`-like `Tensor` Monte Carlo
      approximation of the Csiszar f-Divergence.

  Raises:
    ValueError: if `q` is not a reparameterized distribution and
      `use_reparametrization = True`. A distribution `q` is said to be
      "reparameterized" when its samples are generated by transforming the
      samples of another distribution which does not depend on the
      parameterization of `q`. This property ensures the gradient (with respect
      to parameters) is valid.
    TypeError: if `p_log_prob` is not a Python `callable`.

Monte - Carlo approximation of the Csiszar f - Divergence .


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : arg_3 = arg_0 . options . get ( 'transformer' , { } ) arg_4 = { } if arg_1 is not None : if arg_1 in arg_3 : arg_4 = { arg_1 : arg_3 [ arg_1 ] } else : arg_4 = { arg_1 : { 'files' : [ ] , } } else : arg_4 = arg_3 arg_5 = None if arg_2 is not None : arg_5 = arg_0 . find_matching_files ( [ arg_2 ] ) for arg_6 in arg_4 : for arg_7 in arg_4 [ arg_6 ] : if "files" not in arg_7 : continue if arg_7 == "files" and arg_5 is not None : arg_4 [ arg_6 ] [ arg_7 ] = arg_5 else : if arg_4 [ arg_6 ] [ arg_7 ] is None or len ( arg_4 [ arg_6 ] [ arg_7 ] ) == 0 : arg_4 [ arg_6 ] [ arg_7 ] = [ ] else : arg_8 = arg_0 . find_matching_files ( arg_4 [ arg_6 ] [ arg_7 ] ) arg_4 [ arg_6 ] [ arg_7 ] = arg_8 return arg_4

def Func(arg_0, arg_1=None, arg_2=None):
    """
    Instantiate the generator and filename specification
    """

    arg_3 = arg_0.options.get('transformer', {})

    # If a name is specified, then lookup the options from dgit.json
    # if specfied. Otherwise it is initialized to an empty list of
    # files.
    arg_4 = {}
    if arg_1 is not None:
        # Handle the case generator is specified..
        if arg_1 in arg_3:
            arg_4 = {
                arg_1 : arg_3[arg_1]
            }
        else:
            arg_4 = {
                arg_1 : {
                    'files': [],
                }
            }
    else:
        arg_4 = arg_3

    #=========================================
    # Map the filename patterns to list of files
    #=========================================
    # Instantiate the files from the patterns specified
    arg_5 = None
    if arg_2 is not None:
        arg_5 = arg_0.find_matching_files([arg_2])

    for arg_6 in arg_4:
        for arg_7 in arg_4[arg_6]:
            if "files" not in arg_7:
                continue
            if arg_7 == "files" and arg_5 is not None:
                # Use the files specified on the command line..
                arg_4[arg_6][arg_7] = arg_5
            else:
                # Try to match the specification
                if arg_4[arg_6][arg_7] is None or len(arg_4[arg_6][arg_7]) == 0:
                    arg_4[arg_6][arg_7] = []
                else:
                    arg_8 = arg_0.find_matching_files(arg_4[arg_6][arg_7])
                    arg_4[arg_6][arg_7] = arg_8

    return arg_4


def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 . getComponentByName ( 'notAfter' ) arg_2 = str ( arg_2 . getComponent ( ) ) if isinstance ( arg_2 , GeneralizedTime ) : arg_0 . not_after = datetime . strptime ( arg_2 , "%Y%m%d%H%M%SZ" ) else : arg_0 . not_after = datetime . strptime ( arg_2 , "%y%m%d%H%M%SZ" ) arg_0 . alt_names = defaultdict ( list )

def Func(arg_0, arg_1):
        """Load data from a ASN.1 validity value.
        """
        arg_2 = arg_1.getComponentByName('notAfter')
        arg_2 = str(arg_2.getComponent())
        if isinstance(arg_2, GeneralizedTime):
            arg_0.not_after = datetime.strptime(arg_2, "%Y%m%d%H%M%SZ")
        else:
            arg_0.not_after = datetime.strptime(arg_2, "%y%m%d%H%M%SZ")
        arg_0.alt_names = defaultdict(list)

Load data from a ASN . 1 validity value .


def Func(arg_0):
    """Convert a one-sided PSD to a twosided PSD

    In order to keep the power in the onesided PSD the same
    as in the twosided version, the onesided values are twice
    as much as in the input data (except for the zero-lag value).

    ::

        >>> Func([10, 2,3,3,2,8])
        array([ 10.,   4.,   6.,   8.])

    """
    assert len(arg_0) % 2 == 0
    arg_1 = len(arg_0)
    arg_2 = np.array(arg_0[0:arg_1//2+1]) * 2.
    arg_2[0] /= 2.
    arg_2[-1] = arg_0[-1]
    return arg_2

Convert a one-sided PSD to a twosided PSD

    In order to keep the power in the onesided PSD the same
    as in the twosided version, the onesided values are twice
    as much as in the input data (except for the zero-lag value).

    ::

        >>> twosided_2_onesided([10, 2,3,3,2,8])
        array([ 10.,   4.,   6.,   8.])

Convert a one - sided PSD to a twosided PSD


def Func ( arg_0 ) : if have_pyrex ( ) : return arg_1 = arg_0 . language or '' arg_2 = '.cpp' if arg_1 . lower ( ) == 'c++' else '.c' arg_3 = functools . partial ( re . sub , '.pyx$' , arg_2 ) arg_0 . sources = list ( map ( arg_3 , arg_0 . sources ) )

def Func(arg_0):
        """
        Replace sources with .pyx extensions to sources with the target
        language extension. This mechanism allows language authors to supply
        pre-converted sources but to prefer the .pyx sources.
        """
        if have_pyrex():
            # the build has Cython, so allow it to compile the .pyx files
            return
        arg_1 = arg_0.language or ''
        arg_2 = '.cpp' if arg_1.lower() == 'c++' else '.c'
        arg_3 = functools.partial(re.sub, '.pyx$', arg_2)
        arg_0.sources = list(map(arg_3, arg_0.sources))

Replace sources with . pyx extensions to sources with the target language extension . This mechanism allows language authors to supply pre - converted sources but to prefer the . pyx sources .


return 1 < sum([has_cnc, has_decreases, has_increases])

def Func ( arg_0 : arg_1 [ arg_2 ] ) -> bool : arg_3 = any ( relation in CAUSAL_INCREASE_RELATIONS for relation in arg_0 ) arg_4 = any ( relation in CAUSAL_DECREASE_RELATIONS for relation in arg_0 ) arg_5 = any ( relation == CAUSES_NO_CHANGE for relation in arg_0 ) return 1 < sum ( [ arg_5 , arg_4 , arg_3 ] )

def Func(arg_0: arg_1[arg_2]) -> bool:
    """Return if the set of BEL relations contains a contradiction."""
    arg_3 = any(relation in CAUSAL_INCREASE_RELATIONS for relation in arg_0)
    arg_4 = any(relation in CAUSAL_DECREASE_RELATIONS for relation in arg_0)
    arg_5 = any(relation == CAUSES_NO_CHANGE for relation in arg_0)
    return 1 < sum([arg_5, arg_4, arg_3])

Return if the set of BEL relations contains a contradiction .


(graph: BELGraph,
                       annotation: str,
                       value: str,
                       source_filter=None,
                       target_filter=None,
                       )

def Func(arg_0: arg_1,
                       arg_2: arg_3,
                       arg_4: arg_3,
                       arg_5=None,
                       arg_6=None,
                       ):
    """Gets all edges from a given subgraph whose source and target nodes pass all of the given filters

    :param pybel.BELGraph graph: A BEL graph
    :param str annotation:  The annotation to search
    :param str value: The annotation value to search by
    :param source_filter: Optional filter for source nodes (graph, node) -> bool
    :param target_filter: Optional filter for target nodes (graph, node) -> bool
    :return: An iterable of (source node, target node, key, data) for all edges that match the annotation/value and
             node filters
    :rtype: iter[tuple]
    """
    if arg_5 is None:
        arg_5 = keep_node_permissive

    if arg_6 is None:
        arg_6 = keep_node_permissive

    for arg_7, arg_8, arg_9, arg_10 in arg_0.edges(keys=True, arg_10=True):
        if not edge_has_annotation(arg_10, arg_2):
            continue
        if arg_10[ANNOTATIONS][arg_2] == arg_4 and arg_5(arg_0, arg_7) and arg_6(arg_0, arg_8):
            yield arg_7, arg_8, arg_9, arg_10


(item_matrix, select=None, header=None , footer=None)

def Func(arg_0, arg_1=None, arg_2=None , arg_3=None) :
    """ returnr a string for an html table"""
    if not arg_0 :
        return ''
    arg_4 = []
    arg_5 = lambda text : u''+text+u'  	'
    arg_6 = lambda text : u'
'+text+u'
'
    arg_7 = [map(arg_5, arg_8) for arg_8 in arg_0]
    if arg_1 :
        arg_8, arg_9 = arg_1
        arg_7[arg_8][arg_9] = u''\
                +arg_0[arg_8][arg_9]\
                +u'  	'
    #select the right item
    arg_4 = map(arg_6, (u''.join(arg_8) for arg_8 in arg_7))
    arg_10 = ''
    arg_11 = ''
    if arg_2 :
        arg_10 = (u'
'\
            +''.join((u''+arg_2+u'	')*len(arg_0[0]))\
            +'
')

    if arg_3 :
        arg_11 = (u'
'\
            +''.join((u''+arg_3+u'	')*len(arg_0[0]))\
            +'
')
    arg_12 = (u'
'+arg_10+(u''.join(arg_4))+arg_11+u'
')
    return arg_12


def Func ( arg_0 ) : if "iana_db" not in arg_1 . INTERN or not arg_1 . INTERN [ "iana_db" ] : arg_1 . INTERN [ "iana_db" ] = arg_0 . iana_db

def Func(arg_0):
        """
        Initiate the IANA database if it is not the case.
        """

        if "iana_db" not in arg_1.INTERN or not arg_1.INTERN["iana_db"]:
            # The global database is empty, None or does not exist.

            # We update it with the database content.
            arg_1.INTERN["iana_db"] = arg_0.iana_db

Initiate the IANA database if it is not the case .


return ListReport("Items sold", headings, data)

def
Func
(
)
:
arg_0
=
arg_1
=
arg_2
=
commerce
.
LineItem
.
objects
.
filter
(
invoice__status
=
commerce
.
Invoice
.
STATUS_PAID
,
)
.
select_related
(
"invoice"
)
arg_2
=
arg_2
.
order_by
(
"-price"
,
"description"
,
)
.
values
(
"price"
,
"description"
,
)
.
annotate
(
total_quantity
=
Sum
(
"quantity"
)
,
)
arg_1
=
[
"Description"
,
"Quantity"
,
"Price"
,
"Total"
]
arg_0
=
[
]
arg_3
=
0
for
arg_4
in
arg_2
:
arg_5
=
arg_4
[
"total_quantity"
]
*
arg_4
[
"price"
]
arg_0
.
append
(
[
arg_4
[
"description"
]
,
arg_4
[
"total_quantity"
]
,
arg_4
[
"price"
]
,
arg_5
,
]
)
arg_3
+=
arg_5
arg_0
.
append
(
[
"(TOTAL)"
,
"--"
,
"--"
,
arg_3
,
]
)
return
ListReport
(
"Items sold"
,
arg_1
,
arg_0
)

def Func():
    ''' Summarises the items sold and discounts granted for a given set of
    products, or products from categories. '''

    arg_0 = None
    arg_1 = None

    arg_2 = commerce.LineItem.objects.filter(
        invoice__status=commerce.Invoice.STATUS_PAID,
    ).select_related("invoice")

    arg_2 = arg_2.order_by(
        # sqlite requires an order_by for .values() to work
        "-price", "description",
    ).values(
        "price", "description",
    ).annotate(
        total_quantity=Sum("quantity"),
    )

    arg_1 = ["Description", "Quantity", "Price", "Total"]

    arg_0 = []
    arg_3 = 0
    for arg_4 in arg_2:
        arg_5 = arg_4["total_quantity"] * arg_4["price"]
        arg_0.append([
            arg_4["description"], arg_4["total_quantity"],
            arg_4["price"], arg_5,
        ])
        arg_3 += arg_5

    arg_0.append([
        "(TOTAL)", "--", "--", arg_3,
    ])

    return ListReport("Items sold", arg_1, arg_0)

Summarises the items sold and discounts granted for a given set of products or products from categories .


def Func ( arg_0 , arg_1 , arg_2 = - 1 ) : arg_3 = 0 arg_4 = None for arg_5 in arg_0 : if arg_4 is None : arg_4 = tuple ( [ ] for _ in range ( len ( arg_5 ) ) ) if ( arg_2 > 0 ) and ( arg_3 >= arg_2 ) : yield tuple ( _pack_accumulated ( arg_6 , arg_7 ) for arg_6 , arg_7 in zip ( arg_4 , arg_1 ) ) arg_4 = tuple ( [ ] for _ in range ( len ( arg_5 ) ) ) arg_3 = 0 for arg_8 , arg_6 in zip ( arg_5 , arg_4 ) : arg_6 . append ( arg_8 ) arg_3 += 1 if arg_3 > 0 : yield tuple ( _pack_accumulated ( arg_6 , arg_7 ) for arg_6 , arg_7 in zip ( arg_4 , arg_1 ) )

def Func(arg_0, arg_1, arg_2=-1):
    """Pack rdd of tuples as tuples of arrays or scipy.sparse matrices."""
    arg_3 = 0
    arg_4 = None
    for arg_5 in arg_0:
        if arg_4 is None:
            arg_4 = tuple([] for _ in range(len(arg_5)))

        if (arg_2 > 0) and (arg_3 >= arg_2):
            yield tuple(_pack_accumulated(arg_6, arg_7)
                        for arg_6, arg_7 in zip(arg_4, arg_1))
            arg_4 = tuple([] for _ in range(len(arg_5)))
            arg_3 = 0

        for arg_8, arg_6 in zip(arg_5, arg_4):
            arg_6.append(arg_8)
        arg_3 += 1
    if arg_3 > 0:
        yield tuple(_pack_accumulated(arg_6, arg_7)
                    for arg_6, arg_7 in zip(arg_4, arg_1))

Pack rdd of tuples as tuples of arrays or scipy . sparse matrices .


def Func ( arg_0 , ** arg_1 ) : arg_2 = arg_0 . _parse_geoms ( ** arg_1 ) if arg_2 is None : return arg_0 else : return arg_0 [ arg_2 ]

def Func(arg_0, **arg_1):
        """ Subsets the Image by the given bounds

        Args:
            bbox (list): optional. A bounding box array [minx, miny, maxx, maxy]
            wkt (str): optional. A WKT geometry string
            geojson (str): optional. A GeoJSON geometry dictionary

        Returns:
            image: an image instance of the same type
        """
        arg_2 = arg_0._parse_geoms(**arg_1)
        if arg_2 is None:
            return arg_0
        else:
            return arg_0[arg_2]


def Func ( arg_0 ) : if arg_0 is None : return [ ] elif not isinstance ( arg_0 , ( tuple , list , np . ndarray ) ) : return [ arg_0 ] return list ( arg_0 )

def Func(arg_0):
    """
    Convert a scalar ``a`` to a list and all iterables to list as well.

    Examples
    --------
    >>> Func(0)
    [0]

    >>> Func([1,2,3])
    [1, 2, 3]

    >>> Func('a')
    ['a']

    >>> Func(np.array([1,2,3]))
    [1, 2, 3]

    >>> Func('string')
    ['string']
    """
    if arg_0 is None:
        return []
    elif not isinstance(arg_0, (tuple, list, np.ndarray)):
        return [arg_0]
    return list(arg_0)

Convert a scalar ``a`` to a list and all iterables to list as well.

    Examples
    --------
    >>> listify(0)
    [0]

    >>> listify([1,2,3])
    [1, 2, 3]

    >>> listify('a')
    ['a']

    >>> listify(np.array([1,2,3]))
    [1, 2, 3]

    >>> listify('string')
    ['string']

Convert a scalar a to a list and all iterables to list as well .


(im, pos, rad, slab=None, mem_level='hi')

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = None , arg_4 = 'hi' ) : if arg_3 is not None : arg_5 = comp . ComponentCollection ( [ objs . PlatonicSpheresCollection ( arg_1 , arg_2 , zscale = zscale ) , arg_3 ] , category = 'obj' ) else : arg_5 = objs . PlatonicSpheresCollection ( arg_1 , arg_2 , zscale = zscale ) arg_6 = exactpsf . FixedSSChebLinePSF ( ) arg_7 , arg_8 = _calc_ilm_order ( arg_0 . get_image ( ) . shape ) arg_9 = ilms . BarnesStreakLegPoly2P1D ( arg_7 = arg_7 , zorder = arg_8 ) arg_10 = ilms . LegendrePoly2P1D ( order = ( 9 , 3 , 5 ) , category = 'bkg' ) arg_11 = comp . GlobalScalar ( 'offset' , 0.0 ) arg_12 = states . ImageState ( arg_0 , [ arg_5 , arg_9 , arg_10 , arg_11 , arg_6 ] ) runner . link_zscale ( arg_12 ) if arg_4 != 'hi' : arg_12 . set_mem_level ( arg_4 ) opt . do_levmarq ( arg_12 , [ 'ilm-scale' ] , max_iter = 1 , run_length = 6 , max_mem = 1e4 ) return arg_12

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4='hi'):
    """
    Workhorse for creating & optimizing states with an initial centroid
    guess.

    This is an example function that works for a particular microscope. For
    your own microscope, you'll need to change particulars such as the psf
    type and the orders of the background and illumination.

    Parameters
    ----------
        im : :class:`~peri.util.RawImage`
            A RawImage of the data.
        pos : [N,3] element numpy.ndarray.
            The initial guess for the N particle positions.
        rad : N element numpy.ndarray.
            The initial guess for the N particle radii.

        slab : :class:`peri.comp.objs.Slab` or None, optional
            If not None, a slab corresponding to that in the image. Default
            is None.
        mem_level : {'lo', 'med-lo', 'med', 'med-hi', 'hi'}, optional
            A valid memory level for the state to control the memory overhead
            at the expense of accuracy. Default is `'hi'`

    Returns
    -------
        :class:`~peri.states.ImageState`
            An ImageState with a linked z-scale, a ConfocalImageModel, and
            all the necessary components with orders at which are useful for
            my particular test case.
    """
    if arg_3 is not None:
        arg_5 = comp.ComponentCollection(
                [
                    objs.PlatonicSpheresCollection(arg_1, arg_2, zscale=zscale),
                    arg_3
                ],
                category='obj'
            )
    else:
        arg_5 = objs.PlatonicSpheresCollection(arg_1, arg_2, zscale=zscale)

    arg_6 = exactpsf.FixedSSChebLinePSF()
    arg_7, arg_8 = _calc_ilm_order(arg_0.get_image().shape)
    arg_9 = ilms.BarnesStreakLegPoly2P1D(arg_7=arg_7, zorder=arg_8)
    arg_10 = ilms.LegendrePoly2P1D(order=(9 ,3, 5), category='bkg')
    arg_11 = comp.GlobalScalar('offset', 0.0)
    arg_12 = states.ImageState(arg_0, [arg_5, arg_9, arg_10, arg_11, arg_6])
    runner.link_zscale(arg_12)
    if arg_4 != 'hi':
        arg_12.set_mem_level(arg_4)

    opt.do_levmarq(arg_12, ['ilm-scale'], max_iter=1, run_length=6, max_mem=1e4)
    return arg_12

Workhorse for creating & optimizing states with an initial centroid guess .


def Func(arg_0):
        """Checks integrity of workflow and reports any problems with it.

        Detects:
        - loops (tasks that wait on each other in a loop)
        :returns: empty list if valid, a list of errors if not
        """
        arg_1 = []
        from ..specs import Join

        def recursive_find_loop(arg_2, arg_3):
            arg_4 = arg_3[:]
            arg_4.append(arg_2)
            if isinstance(arg_2, Join):
                if arg_2 in arg_3:
                    arg_5 = "Found loop with '%s': %s then '%s' again" % (
                        arg_2.name, '->'.join([p.name for p in arg_3]),
                        arg_2.name)
                    raise Exception(arg_5)
                for arg_6 in arg_2.inputs:
                    recursive_find_loop(arg_6, arg_4)

            for arg_7 in arg_2.inputs:
                recursive_find_loop(arg_7, arg_4)

        for arg_8, arg_2 in list(arg_0.task_specs.items()):
            # Check for cyclic waits
            try:
                recursive_find_loop(arg_2, [])
            except Exception as exc:
                arg_1.append(exc.__str__())

            # Check for disconnected tasks
            if not arg_2.inputs and arg_2.name not in ['Start', 'Root']:
                if arg_2.outputs:
                    arg_1.append("Task '%s' is disconnected (no inputs)" %
                                   arg_2.name)
                else:
                    LOG.debug("Task '%s' is not being used" % arg_2.name)

        return arg_1

Checks integrity of workflow and reports any problems with it .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
False
)
:
arg_3
=
{
"selection"
:
{
"selectionType"
:
"thermostats"
,
"selectionMatch"
:
arg_0
.
thermostats
[
arg_1
]
[
'identifier'
]
}
,
"functions"
:
[
{
"type"
:
"resumeProgram"
,
"params"
:
{
"resumeAll"
:
arg_2
}
}
]
}
arg_4
=
"resume program"
return
arg_0
.
make_request
(
arg_3
,
arg_4
)

def Func(arg_0, arg_1, arg_2=False):
        ''' Resume currently scheduled program '''
        arg_3 = {"selection": {
                    "selectionType": "thermostats",
                    "selectionMatch": arg_0.thermostats[arg_1]['identifier']},
                "functions": [{"type": "resumeProgram", "params": {
                    "resumeAll": arg_2
                }}]}

        arg_4 = "resume program"
        return arg_0.make_request(arg_3, arg_4)


return ([len(ref) for ref in refs], maxcounts)

def Func ( arg_0 , arg_1 = 4 ) : arg_0 = [ normalize ( arg_3 ) for arg_3 in arg_0 ] arg_2 = { } for arg_3 in arg_0 : arg_4 = count_ngrams ( arg_3 , arg_1 ) for ( arg_5 , arg_6 ) in list ( arg_4 . items ( ) ) : arg_2 [ arg_5 ] = max ( arg_2 . get ( arg_5 , 0 ) , arg_6 ) return ( [ len ( arg_3 ) for arg_3 in arg_0 ] , arg_2 )

def Func(arg_0, arg_1=4):
    '''Takes a list of reference sentences for a single segment
    and returns an object that encapsulates everything that BLEU
    needs to know about them.'''

    arg_0 = [normalize(arg_3) for arg_3 in arg_0]
    arg_2 = {}
    for arg_3 in arg_0:
        arg_4 = count_ngrams(arg_3, arg_1)
        for (arg_5,arg_6) in list(arg_4.items()):
            arg_2[arg_5] = max(arg_2.get(arg_5,0), arg_6)
    return ([len(arg_3) for arg_3 in arg_0], arg_2)

Takes a list of reference sentences for a single segment and returns an object that encapsulates everything that BLEU needs to know about them .


def Func ( arg_0 ) : try : arg_1 = min ( len ( arg_2 ) - len ( arg_2 . lstrip ( ) ) for arg_2 in arg_0 if arg_2 ) except ValueError : return arg_0 else : return [ arg_2 [ arg_1 : ] for arg_2 in arg_0 ]

def Func(arg_0):
    """
    Remove common indentation from string.

    Unlike doctrim there is no special treatment of the first line.

    """
    try:
        # Determine minimum indentation:
        arg_1 = min(len(arg_2) - len(arg_2.lstrip())
                     for arg_2 in arg_0 if arg_2)
    except ValueError:
        return arg_0
    else:
        return [arg_2[arg_1:] for arg_2 in arg_0]


def Func(arg_0):
        """
        Check if date_str is in a recognised format and return an ISO
        yyyy-mm-dd format version if so. Raise DateFormatError if not.

        Recognised formats are:
        * RFC 7231 (e.g. Mon, 09 Sep 2011 23:36:00 GMT)
        * RFC 850 (e.g. Sunday, 06-Nov-94 08:49:37 GMT)
        * C time (e.g. Wed Dec 4 00:00:00 2002)
        * Amz-Date format (e.g. 20090325T010101Z)
        * ISO 8601 / RFC 3339 (e.g. 2009-03-25T10:11:12.13-01:00)

        date_str -- Str containing a date and optional time

        """
        arg_1 = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
                  'sep', 'oct', 'nov', 'dec']
        arg_2 = {
            # RFC 7231, e.g. 'Mon, 09 Sep 2011 23:36:00 GMT'
            r'^(?:\w{3}, )?(\d{2}) (\w{3}) (\d{4})\D.*$':
                lambda arg_6: '{}-{:02d}-{}'.format(
                                          arg_6.group(3),
                                          arg_1.index(arg_6.group(2).lower())+1,
                                          arg_6.group(1)),
            # RFC 850 (e.g. Sunday, 06-Nov-94 08:49:37 GMT)
            # assumes current century
            r'^\w+day, (\d{2})-(\w{3})-(\d{2})\D.*$':
                lambda arg_6: '{}{}-{:02d}-{}'.format(
                                            str(datetime.date.today().year)[:2],
                                            arg_6.group(3),
                                            arg_1.index(arg_6.group(2).lower())+1,
                                            arg_6.group(1)),
            # C time, e.g. 'Wed Dec 4 00:00:00 2002'
            r'^\w{3} (\w{3}) (\d{1,2}) \d{2}:\d{2}:\d{2} (\d{4})$':
                lambda arg_6: '{}-{:02d}-{:02d}'.format(
                                              arg_6.group(3),
                                              arg_1.index(arg_6.group(1).lower())+1,
                                              int(arg_6.group(2))),
            # x-amz-date format dates, e.g. 20100325T010101Z
            r'^(\d{4})(\d{2})(\d{2})T\d{6}Z$':
                lambda arg_6: '{}-{}-{}'.format(*arg_6.groups()),
            # ISO 8601 / RFC 3339, e.g. '2009-03-25T10:11:12.13-01:00'
            r'^(\d{4}-\d{2}-\d{2})(?:[Tt].*)?$':
                lambda arg_6: arg_6.group(1),
        }

        arg_3 = None
        for arg_4, arg_5 in arg_2.items():
            arg_6 = re.search(arg_4, arg_0)
            if arg_6:
                arg_3 = arg_5(arg_6)
                break
        if arg_3 is None:
            raise DateFormatError
        else:
            return arg_3

Check if date_str is in a recognised format and return an ISO yyyy - mm - dd format version if so . Raise DateFormatError if not .


def Func ( arg_0 ) : arg_1 = arg_0 . tags . get ( TextElement , 0 ) if arg_0 . last_tag is not TextElement : arg_1 += 1 return arg_1

def Func(arg_0):
        '''Returns the one-based index of the current text node.'''
        # This is the number of text nodes we've seen so far.
        # If we are currently in a text node, great; if not then add
        # one for the text node that's about to begin.
        arg_1 = arg_0.tags.get(TextElement, 0)
        if arg_0.last_tag is not TextElement:
            arg_1 += 1
        return arg_1

Returns the one - based index of the current text node .


(s, desc='finish', n_loop=4, max_mem=1e9, separate_psf=True,
        fractol=1e-7, errtol=1e-3, dowarn=True)

def Func(arg_0, arg_1='Func', arg_2=4, arg_3=1e9, arg_4=True,
        arg_5=1e-7, arg_6=1e-3, arg_7=True):
    """
    Crawls slowly to the minimum-cost state.

    Blocks the global parameters into small enough sections such that each
    can be optimized separately while including all the pixels (i.e. no
    decimation). Optimizes the globals, then the psf separately if desired,
    then particles, then a line minimization along the step direction to
    speed up convergence.

    Parameters
    ----------
        s : :class:`peri.states.ImageState`
            The state to optimize
        desc : string, optional
            Description to append to the states.save() call every loop.
            Set to `None` to avoid saving. Default is `'Func'`.
        n_loop : Int, optional
            The number of times to loop over in the optimizer. Default is 4.
        max_mem : Numeric, optional
            The maximum amount of memory allowed for the optimizers' J's,
            for both particles & globals. Default is 1e9.
        separate_psf : Bool, optional
            If True, does the psf optimization separately from the rest of
            the globals, since the psf has a more tortuous fit landscape.
            Default is True.
        fractol : Float, optional
            Fractional change in error at which to terminate. Default 1e-4
        errtol : Float, optional
            Absolute change in error at which to terminate. Default 1e-2
        dowarn : Bool, optional
            Whether to log a warning if termination results from Funcing
            loops rather than from convergence. Default is True.

    Returns
    -------
        dictionary
            Information about the optimization. Has two keys: ``'converged'``,
            a Bool which of whether optimization stopped due to convergence
            (True) or due to max number of iterations (False), and
            ``'loop_values'``, a [n_loop+1, N] ``numpy.ndarray`` of the
            state's values, at the start of optimization and at the end of
            each loop, before the line minimization.
    """
    arg_8 = [np.copy(arg_0.state[arg_0.params])]
    arg_9 = arg_0.get('psf').params if arg_4 else None
    # FIXME explicit params
    arg_10 = name_globals(arg_0, arg_9=arg_9)
    #FIXME this could be done much better, since much of the globals such
    #as the ilm are local. Could be done with sparse matrices and/or taking
    #nearby globals in a group and using the update tile only as the slicer,
    #rather than the full residuals.
    arg_11 = np.floor(arg_3 / arg_0.residuals.nbytes).astype('int')
    arg_12 = [arg_10[arg_13:arg_13+arg_11] for arg_13 in range(0, len(arg_10), arg_11)]
    CLOG.info('Start  ``Func``:\t{}'.format(arg_0.error))
    for arg_13 in range(arg_2):
        arg_14 = arg_0.error
        #1. Min globals:
        for arg_15 in arg_12:
            do_levmarq(arg_0, arg_15, damping=0.1, decrease_damp_factor=20.,
                    max_iter=1, arg_3=arg_3, eig_update=False)
        if arg_4:
            do_levmarq(arg_0, arg_9, arg_3=arg_3, max_iter=4,
                    eig_update=False)
        CLOG.info('Globals,   loop {}:\t{}'.format(arg_13, arg_0.error))
        if arg_1 is not None:
            states.save(arg_0, arg_1=arg_1)
        #2. Min particles
        do_levmarq_all_particle_groups(arg_0, max_iter=1, arg_3=arg_3)
        CLOG.info('Particles, loop {}:\t{}'.format(arg_13, arg_0.error))
        if arg_1 is not None:
            states.save(arg_0, arg_1=arg_1)
        #3. Append vals, line min:
        arg_8.append(np.copy(arg_0.state[arg_0.params]))
        # dv = (np.array(values[1:]) - np.array(values[0]))[-3:]
        # do_levmarq_n_directions(s, dv, damping=1e-2, max_iter=2, errtol=3e-4)
        # CLOG.info('Line min., loop {}:\t{}'.format(a, s.error))
        # if desc is not None:
            # states.save(s, desc=desc)
        #4. terminate?
        arg_16 = arg_0.error
        arg_17 = arg_14 - arg_16
        arg_18 = (arg_17/arg_16 < arg_5) or (arg_17 < arg_6)
        if arg_18:
            break

    if arg_7 and (not arg_18):
        CLOG.warn('Func() did not converge; consider re-running')
    return {'converged':arg_18, 'loop_values':np.array(arg_8)}

Crawls slowly to the minimum-cost state.

    Blocks the global parameters into small enough sections such that each
    can be optimized separately while including all the pixels (i.e. no
    decimation). Optimizes the globals, then the psf separately if desired,
    then particles, then a line minimization along the step direction to
    speed up convergence.

    Parameters
    ----------
        s : :class:`peri.states.ImageState`
            The state to optimize
        desc : string, optional
            Description to append to the states.save() call every loop.
            Set to `None` to avoid saving. Default is `'finish'`.
        n_loop : Int, optional
            The number of times to loop over in the optimizer. Default is 4.
        max_mem : Numeric, optional
            The maximum amount of memory allowed for the optimizers' J's,
            for both particles & globals. Default is 1e9.
        separate_psf : Bool, optional
            If True, does the psf optimization separately from the rest of
            the globals, since the psf has a more tortuous fit landscape.
            Default is True.
        fractol : Float, optional
            Fractional change in error at which to terminate. Default 1e-4
        errtol : Float, optional
            Absolute change in error at which to terminate. Default 1e-2
        dowarn : Bool, optional
            Whether to log a warning if termination results from finishing
            loops rather than from convergence. Default is True.

    Returns
    -------
        dictionary
            Information about the optimization. Has two keys: ``'converged'``,
            a Bool which of whether optimization stopped due to convergence
            (True) or due to max number of iterations (False), and
            ``'loop_values'``, a [n_loop+1, N] ``numpy.ndarray`` of the
            state's values, at the start of optimization and at the end of
            each loop, before the line minimization.

Crawls slowly to the minimum - cost state .


def Func(arg_0, *arg_1):
        """Exchange 1st and 2nd stack items"""
        arg_2 = arg_1[0]
        arg_3 = arg_1[-1]
        return (arg_3,) + arg_1[1:-1] + (arg_2,)


def Func ( arg_0 , arg_1 = '' ) : arg_2 = arg_0 . sockets . get ( arg_1 ) if arg_1 and not arg_2 : return None if arg_2 is None : arg_2 = Socket ( arg_0 , arg_0 . config ) arg_0 . sockets [ arg_2 . sessid ] = arg_2 else : arg_2 . incr_hits ( ) return arg_2

def Func(arg_0, arg_1=''):
        """Return an existing or new client Socket."""

        arg_2 = arg_0.sockets.get(arg_1)

        if arg_1 and not arg_2:
            return None  # you ask for a session that doesn't exist!
        if arg_2 is None:
            arg_2 = Socket(arg_0, arg_0.config)
            arg_0.sockets[arg_2.sessid] = arg_2
        else:
            arg_2.incr_hits()

        return arg_2

Return an existing or new client Socket .


def Func ( arg_0 ) : arg_1 = 0 if isinstance ( arg_0 , Assignment ) : return arg_0 . _instId elif isinstance ( arg_0 , WaitStm ) : return arg_1 else : for arg_2 in arg_0 . _iter_stms ( ) : arg_1 = max ( arg_1 , Func ( arg_2 ) ) return arg_1

def Func(arg_0):
    """
    Get maximum _instId from all assigments in statement
    """
    arg_1 = 0
    if isinstance(arg_0, Assignment):
        return arg_0._instId
    elif isinstance(arg_0, WaitStm):
        return arg_1
    else:
        for arg_2 in arg_0._iter_stms():
            arg_1 = max(arg_1, Func(arg_2))
        return arg_1


def Func ( arg_0 , arg_1 ) : arg_2 = { 'per_page' : PER_PAGE , } arg_3 = urijoin ( "pulls" , str ( arg_1 ) , "commits" ) return arg_0 . fetch_items ( arg_3 , arg_2 )

def Func(arg_0, arg_1):
        """Get pull request commits"""

        arg_2 = {
            'per_page': PER_PAGE,
        }

        arg_3 = urijoin("pulls", str(arg_1), "commits")
        return arg_0.fetch_items(arg_3, arg_2)


def Func(arg_0):
        """Terminate app with a given bundle ID.
        Requires 10.6.

        Return True if succeed.
        """
        arg_1 = AppKit.NSRunningApplication
        if getattr(arg_1, "runningApplicationsWithBundleIdentifier_"):
            arg_2 = arg_1.runningApplicationsWithBundleIdentifier_(arg_0)
            if arg_2 and len(arg_2) > 0:
                arg_3 = arg_2[0]
                return arg_3 and arg_3.terminate() and True or False
        return False

Terminate app with a given bundle ID . Requires 10 . 6 .


def Func(arg_0, arg_1, arg_2):
    '''This calculates the weighted mean, stdev, median, MAD, percentiles, skew,
    kurtosis, fraction of LC beyond 1-stdev, and IQR.

    Parameters
    ----------

    ftimes,fmags,ferrs : np.array
        The input mag/flux time-series with all non-finite elements removed.

    Returns
    -------

    dict
        A dict with all of the light curve moments calculated.

    '''

    arg_3 = len(arg_1)

    if arg_3 > 9:

        # now calculate the various things we need
        arg_4 = npmedian(arg_1)
        arg_5 = (
            npsum(arg_1*(1.0/(arg_2*arg_2)))/npsum(1.0/(arg_2*arg_2))
        )
        arg_6 = npmedian(npabs(arg_1 - arg_4))
        arg_7 = 1.483*arg_6
        arg_8 = spskew(arg_1)
        arg_9 = spkurtosis(arg_1)

        # get the beyond1std fraction
        arg_10 = len(arg_1[arg_1 > (arg_4 + arg_7)])
        arg_11 = len(arg_1[arg_1 < (arg_4 - arg_7)])

        # this is the fraction beyond 1 stdev
        arg_12 = (arg_10 + arg_11)/float(arg_3)

        # get the magnitude percentiles
        arg_13 = nppercentile(
            arg_1,
            [5.0,10,17.5,25,32.5,40,60,67.5,75,82.5,90,95]
        )

        return {
            'median':arg_4,
            'wmean':arg_5,
            'mad':arg_6,
            'stdev':arg_7,
            'skew':arg_8,
            'kurtosis':arg_9,
            'beyond1std':arg_12,
            'mag_percentiles':arg_13,
            'mag_iqr': arg_13[8] - arg_13[3],
        }

    else:
        LOGERROR('not enough detections in this magseries '
                 'to calculate light curve moments')
        return None

This calculates the weighted mean stdev median MAD percentiles skew kurtosis fraction of LC beyond 1 - stdev and IQR .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . parent . Func ( arg_1 ) arg_3 = arg_0 . parent . getRot ( arg_1 ) arg_4 = arg_0 . parent . getLength ( arg_1 ) arg_5 = calcSphereCoordinates ( arg_2 , arg_4 , arg_3 ) return arg_5

def Func(arg_0,arg_1):
        """
        Returns the point this bone pivots around on the given entity.

        This method works recursively by calling its parent and then adding its own offset.

        The resulting coordinate is relative to the entity, not the world.
        """
        arg_2 = arg_0.parent.Func(arg_1)
        arg_3 = arg_0.parent.getRot(arg_1)
        arg_4 = arg_0.parent.getLength(arg_1)
        arg_5 = calcSphereCoordinates(arg_2,arg_4,arg_3)
        return arg_5

Returns the point this bone pivots around on the given entity . This method works recursively by calling its parent and then adding its own offset . The resulting coordinate is relative to the entity not the world .


return a < b and (not args or less(b, *args))

def Func ( arg_0 , arg_1 , * arg_2 ) : arg_3 = set ( [ type ( arg_0 ) , type ( arg_1 ) ] ) if float in arg_3 or int in arg_3 : try : arg_0 , arg_1 = float ( arg_0 ) , float ( arg_1 ) except TypeError : return False return arg_0 < arg_1 and ( not arg_2 or Func ( arg_1 , * arg_2 ) )

def Func(arg_0, arg_1, *arg_2):
    """Implements the '<' operator with JS-style type coertion."""
    arg_3 = set([type(arg_0), type(arg_1)])
    if float in arg_3 or int in arg_3:
        try:
            arg_0, arg_1 = float(arg_0), float(arg_1)
        except TypeError:
            # NaN
            return False
    return arg_0 < arg_1 and (not arg_2 or Func(arg_1, *arg_2))

Implements the < operator with JS - style type coertion .


def
Func
(
arg_0
,
arg_1
)
:
for
arg_2
in
arg_0
.
events
:
for
arg_3
in
arg_2
.
cancellations
.
all
(
)
:
if
arg_3
.
date
==
arg_1
:
arg_2
.
title
+=
' (CANCELLED)'

def Func(arg_0, arg_1):
        """Check if any events are cancelled on the given date 'd'."""
        for arg_2 in arg_0.events:
            for arg_3 in arg_2.cancellations.all():
                if arg_3.date == arg_1:
                    arg_2.title += ' (CANCELLED)'

Check if any events are cancelled on the given date d .


def Func(arg_0, arg_1, arg_2="00000000"):
        """ Serial call to set CT ratio for attached inductive pickup.

        Args:
            new_ct (int): A :class:`~ekmmeters.CTRatio` value, a legal amperage setting.
            password (str): Optional password.

        Returns:
            bool: True on completion with ACK.
        """
        arg_3 = False
        arg_0.setContext("Func")
        try:
            arg_0.clearCmdMsg()
            if ((arg_1 != CTRatio.Amps_100) and (arg_1 != CTRatio.Amps_200) and
                    (arg_1 != CTRatio.Amps_400) and (arg_1 != CTRatio.Amps_600) and
                    (arg_1 != CTRatio.Amps_800) and (arg_1 != CTRatio.Amps_1000) and
                    (arg_1 != CTRatio.Amps_1200) and (arg_1 != CTRatio.Amps_1500) and
                    (arg_1 != CTRatio.Amps_2000) and (arg_1 != CTRatio.Amps_3000) and
                    (arg_1 != CTRatio.Amps_4000) and (arg_1 != CTRatio.Amps_5000)):
                arg_0.writeCmdMsg("Legal CT Ratios: 100, 200, 400, 600, " +
                                 "800, 1000, 1200, 1500, 2000, 3000, 4000 and 5000")
                arg_0.setContext("")
                return arg_3

            if len(arg_2) != 8:
                arg_0.writeCmdMsg("Invalid password length.")
                arg_0.setContext("")
                return arg_3

            if not arg_0.request(False):
                arg_0.writeCmdMsg("Bad read CRC on setting")
            else:
                if not arg_0.serialCmdPwdAuth(arg_2):
                    arg_0.writeCmdMsg("Password failure")
                else:
                    arg_4 = "015731023030443028" + binascii.hexlify(str(arg_1).zfill(4)) + "2903"
                    arg_4 += arg_0.calc_crc16(arg_4[2:].decode("hex"))
                    arg_0.m_serial_port.write(arg_4.decode("hex"))
                    if arg_0.m_serial_port.getResponse(arg_0.getContext()).encode("hex") == "06":
                        arg_0.writeCmdMsg("Success(Func): 06 returned.")
                        arg_3 = True
            arg_0.serialPostEnd()

        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        arg_0.setContext("")
        return arg_3

Serial call to set CT ratio for attached inductive pickup .


def
Func
(
arg_0
,
arg_1
)
:
logger
.
debug
(
"Writing the assembly report into: {}"
.
format
(
arg_1
)
)
with
open
(
arg_1
,
"w"
)
as
fh
:
for
arg_2
,
arg_3
in
arg_0
.
report
.
items
(
)
:
fh
.
write
(
"{}, {}\\n"
.
format
(
arg_2
,
arg_3
)
)

def Func(arg_0, arg_1):
        """Writes a report with the test results for the current assembly

        Parameters
        ----------
        output_file : str
            Name of the output assembly file.

        """

        logger.debug("Writing the assembly report into: {}".format(
            arg_1))
        with open(arg_1, "w") as fh:

            for arg_2, arg_3 in arg_0.report.items():
                fh.write("{}, {}\\n".format(arg_2, arg_3))


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . Funcs ( names = arg_1 ) return arg_0 . _return_first_item ( arg_2 )

def Func(arg_0, arg_1):
        '''
          returns a single workspace object.
          Will return None if no workspace is found.
          Will raise an error if more than one workspace with the same name is found.
        '''

        arg_2 = arg_0.Funcs(names=arg_1)
        return arg_0._return_first_item(arg_2)

returns a single workspace object . Will return None if no workspace is found . Will raise an error if more than one workspace with the same name is found .


def Func(arg_0, arg_1, arg_2, **arg_3):
        '''
        Make a HTTP request to the Dominos UK API with the given parameters for
        the current session.

        :param verb func: HTTP method on the session.
        :param string path: The API endpoint path.
        :params list kargs: A list of arguments.
        :return: A response from the Dominos UK API.
        :rtype: response.Response
        '''
        arg_4 = arg_1(arg_0.__url(arg_2), **arg_3)

        if arg_4.status_code != 200:
            raise ApiError('{}: {}'.format(arg_4.status_code, arg_4))

        return arg_4

Make a HTTP request to the Dominos UK API with the given parameters for the current session .


def Func ( arg_0 ) : if arg_0 in CUSTOM_PRJ : arg_1 = pyproj . Proj ( CUSTOM_PRJ [ arg_0 ] ) else : arg_1 = pyproj . Proj ( init = arg_0 ) return arg_1

def Func(arg_0):
    """
      Helper method for handling projection codes that are unknown to pyproj

      Args:
          prj_code (str): an epsg proj code

      Returns:
          projection: a pyproj projection
    """
    if arg_0 in CUSTOM_PRJ:
        arg_1 = pyproj.Proj(CUSTOM_PRJ[arg_0])
    else:
        arg_1 = pyproj.Proj(init=arg_0)
    return arg_1


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
)
:
assert
arg_2
>=
2
,
'batch_size must be at least 2!'
if
arg_3
is
or
isinstance
(
arg_3
,
int
)
:
arg_3
=
np
.
random
.
RandomState
(
arg_3
)
arg_4
=
np
.
arange
(
arg_1
)
def
batch
(
)
:
arg_5
=
np
.
zeros
(
(
arg_2
,
arg_1
,
1
+
len
(
arg_0
.
alpha
)
)
,
'f'
)
arg_6
=
np
.
zeros
(
(
arg_2
,
arg_1
)
,
'i'
)
for
arg_7
in
range
(
arg_2
)
:
arg_8
=
arg_3
.
randint
(
len
(
arg_0
.
text
)
arg_1
1
)
arg_9
=
arg_0
.
encode
(
arg_0
.
text
[
arg_8
:
arg_8
+
arg_1
+
1
]
)
arg_5
[
arg_7
,
arg_4
,
arg_9
[
:
1
]
]
=
1
arg_6
[
arg_7
,
arg_4
]
=
arg_9
[
1
:
]
return
[
arg_5
,
arg_6
]
return
batch

def Func(arg_0, arg_1, arg_2, arg_3=None):
        '''Create a callable that returns a batch of training data.

        Parameters
        ----------
        steps : int
            Number of time steps in each batch.
        batch_size : int
            Number of training examples per batch.
        rng : :class:`numpy.random.RandomState` or int, optional
            A random number generator, or an integer seed for a random number
            generator. If not provided, the random number generator will be
            created with an automatically chosen seed.

        Returns
        -------
        batch : callable
            A callable that, when called, returns a batch of data that can be
            used to train a classifier model.
        '''
        assert arg_2 >= 2, 'batch_size must be at least 2!'

        if arg_3 is None or isinstance(arg_3, int):
            arg_3 = np.random.RandomState(arg_3)

        arg_4 = np.arange(arg_1)

        def batch():
            arg_5 = np.zeros((arg_2, arg_1, 1 + len(arg_0.alpha)), 'f')
            arg_6 = np.zeros((arg_2, arg_1), 'i')
            for arg_7 in range(arg_2):
                arg_8 = arg_3.randint(len(arg_0.text) - arg_1 - 1)
                arg_9 = arg_0.encode(arg_0.text[arg_8:arg_8 + arg_1 + 1])
                arg_5[arg_7, arg_4, arg_9[:-1]] = 1
                arg_6[arg_7, arg_4] = arg_9[1:]
            return [arg_5, arg_6]

        return batch

Create a callable that returns a batch of training data .


def
Func
(
arg_0
)
:
if
arg_0
.
logfile
is
not
:
arg_0
.
logfile
.
close
(
)
arg_0
.
logfile
=
else
:
print
"Logging hadn't been started."
arg_0
.
log_active
=
False

def Func(arg_0):
        """Fully stop logging and close log file.

        In order to start logging again, a new logstart() call needs to be
        made, possibly (though not necessarily) with a new filename, mode and
        other options."""

        if arg_0.logfile is not None:
            arg_0.logfile.close()
            arg_0.logfile = None
        else:
            print "Logging hadn't been started."
        arg_0.log_active = False


def Func ( arg_0 : arg_1 , arg_2 = False ) : arg_3 = arg_0 . replace ( '\\' , '/' ) . split ( '/' ) for arg_4 in range ( 1 , len ( arg_3 ) + ( 0 if arg_2 else 1 ) ) : arg_5 = '/' . join ( arg_3 [ : arg_4 ] ) if not os . path . exists ( arg_5 ) : os . mkdir ( arg_5 )

def Func(arg_0: arg_1, arg_2=False):
    """
    Make folder as well as all parent folders if not exists

    Args:
        path_name: full path name
        is_file: whether input is name of file
    """
    arg_3 = arg_0.replace('\\', '/').split('/')
    for arg_4 in range(1, len(arg_3) + (0 if arg_2 else 1)):
        arg_5 = '/'.join(arg_3[:arg_4])
        if not os.path.exists(arg_5): os.mkdir(arg_5)


return ConversationMenu(
            self._coroutine_queue, self._conversation, close_callback,
            self._keys
        )

def Func(arg_0, arg_1):
        """Return the menu widget associated with this widget."""
        return ConversationMenu(
            arg_0._coroutine_queue, arg_0._conversation, arg_1,
            arg_0._keys
        )

Return the menu widget associated with this widget .


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_2 is not None : arg_3 = arg_0 . get_password ( arg_1 , arg_2 ) if arg_3 is not None : return credentials . SimpleCredential ( arg_2 , arg_3 , ) return None

def Func(arg_0, arg_1, arg_2):
        """Gets the username and password for the service.
        Returns a Credential instance.

        The *username* argument is optional and may be omitted by
        the caller or ignored by the backend. Callers must use the
        returned username.
        """
        # The default implementation requires a username here.
        if arg_2 is not None:
            arg_3 = arg_0.get_password(arg_1, arg_2)
            if arg_3 is not None:
                return credentials.SimpleCredential(
                    arg_2,
                    arg_3,
                )
        return None

Gets the username and password for the service . Returns a Credential instance .


def Func(arg_0):
    """
    Calculates the average value of a list of numbers
    Returns a float
    """
    arg_1 = 0.0
    for arg_2 in arg_0:
        arg_1 += arg_2
    return arg_1 / len(arg_0)


def Func ( arg_0 , * arg_1 , ** arg_2 ) : arg_2 [ 'feature_names' ] = False for arg_3 in arg_0 . _scan ( * arg_1 , ** arg_2 ) : yield did ( arg_3 [ '_id' ] )

def Func(arg_0, *arg_1, **arg_2):
        '''Scan for ids only in the given id ranges.

        :param key_ranges:
          ``key_ranges`` should be a list of pairs of ranges. The first
          value is the lower bound id and the second value is the
          upper bound id. Use ``()`` in either position to leave it
          unbounded. If no ``key_ranges`` are given, then all FCs in
          the store are returned.
        :param [str] feature_names:
          A list of feature names to retrieve. When ``None``, all
          features are retrieved. Wildcards are allowed.
        :rtype: Iterable of ``content_id``
        '''
        arg_2['feature_names'] = False
        for arg_3 in arg_0._scan(*arg_1, **arg_2):
            yield did(arg_3['_id'])

Scan for ids only in the given id ranges .


def Func ( arg_0 ) : arg_1 = arg_0 . signal if hasattr ( arg_0 , 'signal' ) else "SIGKILL" __with_containers ( arg_0 , Blockade . kill , signal = arg_1 )

def Func(arg_0):
    """Kill some or all containers
    """
    arg_1 = arg_0.signal if hasattr(arg_0, 'signal') else "SIGKILL"
    __with_containers(arg_0, Blockade.kill, signal=arg_1)


def Func ( arg_0 ) : arg_1 , arg_2 = itertools . tee ( arg_0 ) return next ( arg_1 ) , arg_2

def Func(arg_0):
	"""
	Get the next value from an iterable, but also return an iterable
	that will subsequently return that value and the rest of the
	original iterable.

	>>> l = iter([1,2,3])
	>>> val, l = Func(l)
	>>> val
	1
	>>> list(l)
	[1, 2, 3]
	"""
	arg_1, arg_2 = itertools.tee(arg_0)
	return next(arg_1), arg_2

Get the next value from an iterable, but also return an iterable
	that will subsequently return that value and the rest of the
	original iterable.

	>>> l = iter([1,2,3])
	>>> val, l = peek(l)
	>>> val
	1
	>>> list(l)
	[1, 2, 3]

Get the next value from an iterable but also return an iterable that will subsequently return that value and the rest of the original iterable .


def Func ( arg_0 , arg_1 ) : arg_2 = forms . VoucherForm ( arg_0 . POST or None , arg_1 = arg_1 ) arg_3 = CartController . for_user ( arg_0 . user ) if ( arg_2 . is_valid ( ) and arg_2 . cleaned_data [ "voucher" ] . strip ( ) ) : arg_4 = arg_2 . cleaned_data [ "voucher" ] arg_4 = inventory . Voucher . normalise_code ( arg_4 ) if len ( arg_3 . cart . vouchers . filter ( code = arg_4 ) ) > 0 : arg_5 = False else : try : arg_3 . apply_voucher ( arg_4 ) except Exception as e : arg_2 . add_error ( "voucher" , e ) arg_5 = True else : arg_5 = False return ( arg_2 , arg_5 )

def Func(arg_0, arg_1):
    ''' Handles a voucher form in the given request. Returns the voucher
    form instance, and whether the voucher code was handled. '''

    arg_2 = forms.VoucherForm(arg_0.POST or None, arg_1=arg_1)
    arg_3 = CartController.for_user(arg_0.user)

    if (arg_2.is_valid() and
            arg_2.cleaned_data["voucher"].strip()):

        arg_4 = arg_2.cleaned_data["voucher"]
        arg_4 = inventory.Voucher.normalise_code(arg_4)

        if len(arg_3.cart.vouchers.filter(code=arg_4)) > 0:
            # This voucher has already been applied to this cart.
            # Do not apply code
            arg_5 = False
        else:
            try:
                arg_3.apply_voucher(arg_4)
            except Exception as e:
                arg_2.add_error("voucher", e)
            arg_5 = True
    else:
        arg_5 = False

    return (arg_2, arg_5)

Handles a voucher form in the given request . Returns the voucher form instance and whether the voucher code was handled .


def Func ( arg_0 ) : try : from invenio . modules . records . api import Record arg_1 = Record . create ( arg_0 , 'marc' ) return arg_1 . dumps ( clean = True ) except ImportError : from invenio . bibfield import create_record arg_1 = create_record ( arg_0 , master_format = 'marc' ) return arg_1 . dumps ( )

def Func(arg_0):
    """Dump JSON of record."""
    try:
        from invenio.modules.records.api import Record
        arg_1 = Record.create(arg_0, 'marc')
        return arg_1.dumps(clean=True)
    except ImportError:
        from invenio.bibfield import create_record
        arg_1 = create_record(arg_0, master_format='marc')
        return arg_1.dumps()


def Func(arg_0, arg_1, arg_2):
    """
    Update package with latest template. Must be inside of the project
    folder to run.

    Using "-e" will prompt for re-entering the template parameters again
    even if the project is up to date.

    Use "-v" to Func to a particular version of a template.

    Using "-c" will perform a check that the project is up to date
    with the latest version of the template (or the version specified by "-v").
    No updating will happen when using this option.
    """
    if arg_0:
        if temple.Func.up_to_date(arg_2=arg_2):
            print('Temple package is up to date')
        else:
            arg_3 = (
                'This temple package is out of date with the latest template.'
                ' Update your package by running "temple Func" and commiting changes.'
            )
            raise temple.exceptions.NotUpToDateWithTemplateError(arg_3)
    else:
        temple.Func.Func(new_version=arg_2, arg_1=arg_1)

Update package with latest template. Must be inside of the project
    folder to run.

    Using "-e" will prompt for re-entering the template parameters again
    even if the project is up to date.

    Use "-v" to update to a particular version of a template.

    Using "-c" will perform a check that the project is up to date
    with the latest version of the template (or the version specified by "-v").
    No updating will happen when using this option.

Update package with latest template . Must be inside of the project folder to run .


(self, document_id, gene_panels=None, case_id=None)

def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """Returns the specified Func.

           Arguments:
               document_id : A md5 key that represents the Func or "Func_id"
               gene_panels(List[GenePanel])
               case_id (str): case id (will search with "Func_id")

           Returns:
               Func_object(Variant): A odm Func object
        """
        arg_4 = {}
        if arg_3:
            # search for a Func in a case
            arg_4['case_id'] = arg_3
            arg_4['Func_id'] = arg_1
        else:
            # search with a unique id
            arg_4['_id'] = arg_1

        arg_5 = arg_0.Func_collection.find_one(arg_4)
        if arg_5:
            arg_5 = arg_0.add_gene_info(arg_5, arg_2)
            if arg_5['chromosome'] in ['X', 'Y']:
                ## TODO add the build here
                arg_5['is_par'] = is_par(arg_5['chromosome'],
                                               arg_5['position'])
        return arg_5

Returns the specified variant.

           Arguments:
               document_id : A md5 key that represents the variant or "variant_id"
               gene_panels(List[GenePanel])
               case_id (str): case id (will search with "variant_id")

           Returns:
               variant_object(Variant): A odm variant object