def Func ( arg_0 ) : arg_1 = arg_0 . copy ( name = arg_0 . name + '_Func' ) arg_1 . data = [ ] for arg_3 , arg_4 , arg_5 in reversed ( arg_0 . data ) : arg_1 . data . append ( ( arg_3 . Func ( ) , arg_4 , arg_5 ) ) return arg_1

def Func(arg_0):
        """Mirror the circuit by reversing the instructions.

        This is done by recursively Funcing all instructions.
        It does not invert any gate.

        Returns:
            QuantumCircuit: the Funced circuit
        """
        arg_1 = arg_0.copy(name=arg_0.name+'_Func')
        arg_1.data = []
        for arg_3, arg_4, arg_5 in reversed(arg_0.data):
            arg_1.data.append((arg_3.Func(), arg_4, arg_5))
        return arg_1

Mirror the circuit by reversing the instructions.

        This is done by recursively mirroring all instructions.
        It does not invert any gate.

        Returns:
            QuantumCircuit: the mirrored circuit

Mirror the circuit by reversing the instructions .


def Func ( arg_0 ) : if arg_0 . default_body : return arg_0 . default_body arg_1 = arg_0 . data . get ( 'data' ) if isinstance ( arg_1 , dict ) : return json . dumps ( arg_1 ) return arg_1

def Func(arg_0):
        """Return "data" value on self.data

        :return: data to send
        :rtype: str
        """
        if arg_0.default_body:
            return arg_0.default_body
        arg_1 = arg_0.data.get('data')
        if isinstance(arg_1, dict):
            return json.dumps(arg_1)
        return arg_1


(  # pylint: disable=too-many-arguments
    o: Any,
    human_readable: bool = False,
    print_dup: bool = PRINT_DUP,
    print_length: PrintCountSetting = PRINT_LENGTH,
    print_level: PrintCountSetting = PRINT_LEVEL,
    print_meta: bool = PRINT_META,
    print_readably: bool = PRINT_READABLY,
)

def Func ( arg_0 : arg_1 , arg_2 : arg_3 = False , arg_4 : arg_3 = arg_5 , arg_6 : arg_7 = arg_8 , arg_9 : arg_7 = arg_10 , arg_11 : arg_3 = arg_12 , arg_13 : arg_3 = arg_14 , ) -> str : arg_15 = { "human_readable" : arg_2 , "print_dup" : arg_4 , "print_length" : arg_6 , "print_level" : arg_9 , "print_meta" : arg_11 , "print_readably" : arg_13 , } if isinstance ( arg_0 , arg_3 ) : return _lrepr_bool ( arg_0 ) elif arg_0 is None : return _lrepr_nil ( arg_0 ) elif isinstance ( arg_0 , str ) : return _lrepr_str ( arg_0 , arg_2 = arg_2 , arg_13 = arg_13 ) elif isinstance ( arg_0 , dict ) : return _lrepr_py_dict ( arg_0 , ** arg_15 ) elif isinstance ( arg_0 , list ) : return _lrepr_py_list ( arg_0 , ** arg_15 ) elif isinstance ( arg_0 , set ) : return _lrepr_py_set ( arg_0 , ** arg_15 ) elif isinstance ( arg_0 , tuple ) : return _lrepr_py_tuple ( arg_0 , ** arg_15 ) elif isinstance ( arg_0 , complex ) : return _lrepr_complex ( arg_0 ) elif isinstance ( arg_0 , datetime . datetime ) : return _lrepr_datetime ( arg_0 ) elif isinstance ( arg_0 , Decimal ) : return _lrepr_decimal ( arg_0 , arg_4 = arg_4 ) elif isinstance ( arg_0 , Fraction ) : return _lrepr_fraction ( arg_0 ) elif isinstance ( arg_0 , Pattern ) : return _lrepr_pattern ( arg_0 ) elif isinstance ( arg_0 , uuid . UUID ) : return _lrepr_uuid ( arg_0 ) else : return repr ( arg_0 )

def Func(  # pylint: disable=too-many-arguments
    arg_0: arg_1,
    arg_2: arg_3 = False,
    arg_4: arg_3 = arg_5,
    arg_6: arg_7 = arg_8,
    arg_9: arg_7 = arg_10,
    arg_11: arg_3 = arg_12,
    arg_13: arg_3 = arg_14,
) -> str:  # pragma: no cover
    """Fallback function for lrepr for subclasses of standard types.

    The singledispatch used for standard lrepr dispatches using an exact
    type match on the first argument, so we will only hit this function
    for subclasses of common Python types like strings or lists."""
    arg_15 = {
        "human_readable": arg_2,
        "print_dup": arg_4,
        "print_length": arg_6,
        "print_level": arg_9,
        "print_meta": arg_11,
        "print_readably": arg_13,
    }
    if isinstance(arg_0, arg_3):
        return _lrepr_bool(arg_0)
    elif arg_0 is None:
        return _lrepr_nil(arg_0)
    elif isinstance(arg_0, str):
        return _lrepr_str(
            arg_0, arg_2=arg_2, arg_13=arg_13
        )
    elif isinstance(arg_0, dict):
        return _lrepr_py_dict(arg_0, **arg_15)
    elif isinstance(arg_0, list):
        return _lrepr_py_list(arg_0, **arg_15)
    elif isinstance(arg_0, set):
        return _lrepr_py_set(arg_0, **arg_15)
    elif isinstance(arg_0, tuple):
        return _lrepr_py_tuple(arg_0, **arg_15)
    elif isinstance(arg_0, complex):
        return _lrepr_complex(arg_0)
    elif isinstance(arg_0, datetime.datetime):
        return _lrepr_datetime(arg_0)
    elif isinstance(arg_0, Decimal):
        return _lrepr_decimal(arg_0, arg_4=arg_4)
    elif isinstance(arg_0, Fraction):
        return _lrepr_fraction(arg_0)
    elif isinstance(arg_0, Pattern):
        return _lrepr_pattern(arg_0)
    elif isinstance(arg_0, uuid.UUID):
        return _lrepr_uuid(arg_0)
    else:
        return repr(arg_0)

Fallback function for lrepr for subclasses of standard types .


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : if not isinstance ( arg_0 , models . Field ) : assert arg_1 is None assert arg_2 is None return get_Funced_field ( arg_0 ) arg_3 , arg_4 , arg_5 , arg_6 = arg_0 . deconstruct ( ) arg_6 . update ( { 'key' : arg_1 , 'ttl' : arg_2 } ) return get_Funced_field ( arg_0 . __class__ ) ( * arg_5 , ** arg_6 )

def Func(arg_0, arg_1=None, arg_2=None):
    """
    A decorator for creating Funced model fields.

    :type base_field: models.Field[T]
    :param bytes key: This is an optional argument.

        Allows for specifying an instance specific Funcion key.
    :param int ttl: This is an optional argument.

        The amount of time in seconds that a value can be stored for. If the
        time to live of the data has passed, it will become unreadable.
        The expired value will return an :class:`Expired` object.
    :rtype: models.Field[EncryptedMixin, T]
    """
    if not isinstance(arg_0, models.Field):
        assert arg_1 is None
        assert arg_2 is None
        return get_Funced_field(arg_0)

    arg_3, arg_4, arg_5, arg_6 = arg_0.deconstruct()
    arg_6.update({'key': arg_1, 'ttl': arg_2})
    return get_Funced_field(arg_0.__class__)(*arg_5, **arg_6)

A decorator for creating encrypted model fields.

    :type base_field: models.Field[T]
    :param bytes key: This is an optional argument.

        Allows for specifying an instance specific encryption key.
    :param int ttl: This is an optional argument.

        The amount of time in seconds that a value can be stored for. If the
        time to live of the data has passed, it will become unreadable.
        The expired value will return an :class:`Expired` object.
    :rtype: models.Field[EncryptedMixin, T]

A decorator for creating encrypted model fields .


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """this function will be called on the engines"""
    arg_0.Func(arg_1, arg_2, arg_3, arg_4)


def
Func
(
arg_0
,
arg_1
)
:
arg_1
=
arg_1
.
rstrip
(
'/'
)
if
'/'
in
arg_1
:
raise
ReturnCode
(
'called Func with object %r'
%
arg_1
)
arg_2
=
if
arg_0
.
input_
:
if
arg_0
.
input_
==
'-'
:
arg_2
=
arg_0
.
io_manager
.
get_stdin
(
)
else
:
arg_2
=
open
(
arg_0
.
input_
,
'rb'
)
with
arg_0
.
client_manager
.
with_client
(
)
as
client
:
arg_3
,
arg_4
,
arg_5
,
arg_6
=
client
.
put_container
(
arg_1
,
arg_5
=
arg_0
.
headers
,
query
=
arg_0
.
query
,
cdn
=
arg_0
.
cdn
,
arg_2
=
arg_2
)
if
hasattr
(
arg_6
,
'read'
)
:
arg_6
.
read
(
)
if
arg_3
//
100
!=
2
:
raise
ReturnCode
(
'putting container %r: %s %s'
%
(
arg_1
,
arg_3
,
arg_4
)
)

def Func(arg_0, arg_1):
    """
    Performs a PUT on the container.

    See :py:mod:`swiftly.cli.put` for context usage information.

    See :py:class:`CLIPut` for more information.
    """
    arg_1 = arg_1.rstrip('/')
    if '/' in arg_1:
        raise ReturnCode('called Func with object %r' % arg_1)
    arg_2 = None
    if arg_0.input_:
        if arg_0.input_ == '-':
            arg_2 = arg_0.io_manager.get_stdin()
        else:
            arg_2 = open(arg_0.input_, 'rb')
    with arg_0.client_manager.with_client() as client:
        arg_3, arg_4, arg_5, arg_6 = client.put_container(
            arg_1, arg_5=arg_0.headers, query=arg_0.query,
            cdn=arg_0.cdn, arg_2=arg_2)
        if hasattr(arg_6, 'read'):
            arg_6.read()
    if arg_3 // 100 != 2:
        raise ReturnCode(
            'putting container %r: %s %s' % (arg_1, arg_3, arg_4))


def Func ( arg_0 , arg_1 , arg_2 ) -> bool : if not hasattr ( arg_1 , 'parser_tree' ) : arg_1 . parser_tree = arg_2 . parser_tree else : arg_4 = arg_1 if isinstance ( arg_4 . parser_tree , parsing . Seq ) : arg_5 = list ( arg_4 . parser_tree . ptlist ) else : arg_5 = [ arg_4 . parser_tree ] arg_5 . append ( arg_2 . parser_tree ) arg_1 . parser_tree = parsing . Seq ( * tuple ( arg_5 ) ) return True

def Func(arg_0, arg_1, arg_2) -> bool:
    """Create a tree.Seq"""
    if not hasattr(arg_1, 'parser_tree'):
        # forward sublevel of sequence as is
        arg_1.parser_tree = arg_2.parser_tree
    else:
        arg_4 = arg_1
        if isinstance(arg_4.parser_tree, parsing.Seq):
            arg_5 = list(arg_4.parser_tree.ptlist)
        else:
            arg_5 = [arg_4.parser_tree]
        arg_5.append(arg_2.parser_tree)
        arg_1.parser_tree = parsing.Seq(*tuple(arg_5))
    return True


def Func ( arg_0 , arg_1 = "white_bold" ) : if sys . stdout . encoding != "UTF-8" : arg_0 = "" . join ( [ i if ord ( i ) < 128 else "" for i in arg_0 ] ) try : arg_2 = COLORS [ arg_1 ] except KeyError : arg_2 = arg_1 return "\x1b[{}{}\x1b[0m" . format ( arg_2 , arg_0 )

def Func(arg_0, arg_1="white_bold"):
    """
    This function enables users to add a color to the print. It also enables
    to pass end_char to print allowing to print several strings in the same line
    in different prints.

    Parameters
    ----------
    color_string: str
        The color code to pass to the function, which enables color change as
        well as background color change.
    msg: str
        The actual text to be printed
    end_char: str
        The character in which each print should finish. By default it will be
        "\n".

    """

    if sys.stdout.encoding != "UTF-8":
        arg_0 = "".join([i if ord(i) < 128 else "" for i in arg_0])

    # try except first looks for the color in COLORS dictionary, otherwise use
    # color_label as the color.
    try:
        arg_2 = COLORS[arg_1]
    except KeyError:
        arg_2 = arg_1

    return "\x1b[{}{}\x1b[0m".format(arg_2, arg_0)

This function enables users to add a color to the print . It also enables to pass end_char to print allowing to print several strings in the same line in different prints .


(wVk: int, wScan: int, dwFlags: int = KeyboardEventFlag.KeyDown, time_: int = 0)

return _CreateInput(KEYBDINPUT(wVk, wScan, dwFlags, time_, None))

def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_1 = arg_4.KeyDown, arg_6: arg_1 = 0) -> INPUT:
    """Create Win32 struct `KEYBDINPUT` for `SendInput`."""
    return _CreateInput(KEYBDINPUT(arg_0, arg_2, arg_3, arg_6, None))

Create Win32 struct KEYBDINPUT for SendInput .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
"%s:%s"
%
(
arg_0
,
arg_1
)
if
sys
.
version_info
[
0
]
>=
3
:
arg_2
=
bytes
(
arg_2
,
'utf-8'
)
arg_3
=
base64
.
b64encode
(
arg_2
)
.
decode
(
'utf-8'
)
else
:
arg_3
=
base64
.
b64encode
(
arg_2
)
arg_4
=
{
"Authorization"
:
"Basic %s"
%
arg_3
}
return
arg_4

def Func(arg_0, arg_1):
    '''generate a base64 encoded header to ask for a token. This means
                base64 encoding a username and password and adding to the
                Authorization header to identify the client.

    Parameters
    ==========
    username: the username
    password: the password

    '''
    arg_2 = "%s:%s" % (arg_0, arg_1)
    if sys.version_info[0] >= 3:
        arg_2 = bytes(arg_2, 'utf-8')
        arg_3 = base64.b64encode(arg_2).decode('utf-8')
    else:
        arg_3 = base64.b64encode(arg_2)
    arg_4 = {"Authorization": "Basic %s" % arg_3}
    return arg_4

generate a base64 encoded header to ask for a token . This means base64 encoding a username and password and adding to the Authorization header to identify the client .


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """Called when the BLE adapter found a device while scanning, or has
        new advertisement data for a device.
        """
        logger.debug('centralManager_didDiscoverPeripheral_advertisementData_RSSI called')
        # Log name of device found while scanning.
        #logger.debug('Saw device advertised with name: {0}'.format(peripheral.name()))
        # Make sure the device is added to the list of devices and then update
        # its advertisement state.
        arg_5 = device_list().get(arg_2)
        if arg_5 is None:
            arg_5 = device_list().add(arg_2, CoreBluetoothDevice(arg_2))
        arg_5._update_advertised(arg_3)

Called when the BLE adapter found a device while scanning or has new advertisement data for a device .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
"SELECT {} FROM {}"
.
format
(
","
.
join
(
arg_2
)
,
arg_1
)
arg_0
.
log
.
info
(
"Making query to Salesforce: %s"
,
arg_3
if
len
(
arg_3
)
<
30
else
" ... "
.
join
(
[
arg_3
[
:
15
]
,
arg_3
[
15
:
]
]
)
)
return
arg_0
.
make_query
(
arg_3
)

def Func(arg_0, arg_1, arg_2):
        """
        Get all instances of the `object` from Salesforce.
        For each model, only get the fields specified in fields.

        All we really do underneath the hood is run:
            SELECT <fields> FROM <obj>;

        :param obj: The object name to get from Salesforce.
        :type obj: str
        :param fields: The fields to get from the object.
        :type fields: iterable
        :return: all instances of the object from Salesforce.
        :rtype: dict
        """
        arg_3 = "SELECT {} FROM {}".format(",".join(arg_2), arg_1)

        arg_0.log.info("Making query to Salesforce: %s",
                      arg_3 if len(arg_3) < 30 else " ... ".join([arg_3[:15], arg_3[-15:]]))

        return arg_0.make_query(arg_3)

Get all instances of the object from Salesforce . For each model only get the fields specified in fields .


def Func(arg_0, arg_1, arg_2):
        """
        Saves a component of this model to the designated location.

        Args:
            component_name: The component to save.
            save_path: The location to save to.
        Returns:
            Checkpoint path where the component was saved.
        """
        arg_3 = arg_0.get_component(arg_1=arg_1)
        arg_0._validate_savable(arg_3=arg_3, arg_1=arg_1)
        return arg_3.save(sess=arg_0.session, arg_2=arg_2)

Saves a component of this model to the designated location .


def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):
        """
        Calculate the average heat transfer coefficient.

        :param L: [m] characteristic length of the heat transfer surface
        :param theta: [°] angle of the surface with the vertical
        :param Ts: [K] heat transfer surface temperature
        :param Tf: [K] bulk fluid temperature

        :returns: [W/m2/K] float
        """

        arg_5 = arg_0.Nu_L(arg_1, arg_2, arg_3, **arg_4)
        arg_6 = arg_0._fluid.k(T=arg_0.Tr)
        return arg_5 * arg_6 / arg_1

Calculate the average heat transfer coefficient .


(cls, meta: ProgramDescription, source: str)

def Func(arg_0, arg_1: arg_2, arg_3: arg_4):
        """Initialize a single glsl string containing all shaders"""
        arg_5 = arg_0(arg_1)
        arg_5.vertex_source = ShaderSource(
            VERTEX_SHADER,
            arg_1.path or arg_1.vertex_shader,
            arg_3
        )

        if GEOMETRY_SHADER in arg_3:
            arg_5.geometry_source = ShaderSource(
                GEOMETRY_SHADER,
                arg_1.path or arg_1.geometry_shader,
                arg_3,
            )

        if FRAGMENT_SHADER in arg_3:
            arg_5.fragment_source = ShaderSource(
                FRAGMENT_SHADER,
                arg_1.path or arg_1.fragment_shader,
                arg_3,
            )

        if TESS_CONTROL_SHADER in arg_3:
            arg_5.tess_control_source = ShaderSource(
                TESS_CONTROL_SHADER,
                arg_1.path or arg_1.tess_control_shader,
                arg_3,
            )

        if TESS_EVALUATION_SHADER in arg_3:
            arg_5.tess_evaluation_source = ShaderSource(
                TESS_EVALUATION_SHADER,
                arg_1.path or arg_1.tess_evaluation_shader,
                arg_3,
            )

        return arg_5


def Func ( arg_0 , arg_1 , arg_2 ) : try : return arg_1 [ arg_2 ] except ( TypeError , LookupError ) : if isinstance ( arg_2 , string_types ) : try : arg_3 = str ( arg_2 ) except Exception : pass else : try : return getattr ( arg_1 , arg_3 ) except AttributeError : pass return arg_0 . undefined ( arg_1 = arg_1 , name = arg_2 )

def Func(arg_0, arg_1, arg_2):
        """Get an item or attribute of an object but prefer the item."""
        try:
            return arg_1[arg_2]
        except (TypeError, LookupError):
            if isinstance(arg_2, string_types):
                try:
                    arg_3 = str(arg_2)
                except Exception:
                    pass
                else:
                    try:
                        return getattr(arg_1, arg_3)
                    except AttributeError:
                        pass
            return arg_0.undefined(arg_1=arg_1, name=arg_2)

Get an item or attribute of an object but prefer the item .


def
Func
(
arg_0
)
:
if
not
isinstance
(
arg_0
,
list
)
:
raise
ValueError
(
'input %r must be a list'
%
arg_0
)
for
arg_1
in
arg_0
:
if
not
isinstance
(
arg_1
,
basestring
)
:
raise
ValueError
(
'element %r in list must be a string'
%
arg_1
)

def Func(arg_0):
    """Validate that the input is a list of strings.

    Raises ValueError if not."""
    if not isinstance(arg_0, list):
        raise ValueError('input %r must be a list' % arg_0)
    for arg_1 in arg_0:
        if not isinstance(arg_1, basestring):
            raise ValueError('element %r in list must be a string' % arg_1)

Validate that the input is a list of strings .


(result, tag, check_function=all_hosts, import_services=False)

return {'hosts': imported_hosts, 'services': imported_services}

def
Func
(
arg_0
,
arg_1
,
arg_2
=
arg_3
,
arg_4
=
False
)
:
arg_5
=
HostSearch
(
arguments
=
False
)
arg_6
=
ServiceSearch
(
)
arg_7
=
NmapParser
(
)
arg_8
=
arg_7
.
parse_fromstring
(
arg_0
)
arg_9
=
0
arg_10
=
0
for
arg_11
in
arg_8
.
hosts
:
if
arg_2
(
arg_11
)
:
arg_9
+=
1
arg_12
=
arg_5
.
id_to_object
(
arg_11
.
address
)
arg_12
.
status
=
arg_11
.
status
arg_12
.
add_tag
(
arg_1
)
if
arg_11
.
os_fingerprinted
:
arg_12
.
os
=
arg_11
.
os_fingerprint
if
arg_11
.
hostnames
:
arg_12
.
hostname
.
extend
(
arg_11
.
hostnames
)
if
arg_4
:
for
arg_15
in
arg_11
.
services
:
arg_10
+=
1
arg_16
=
Service
(
**
arg_15
.
get_dict
(
)
)
arg_16
.
address
=
arg_11
.
address
arg_18
=
arg_6
.
object_to_id
(
arg_16
)
if
arg_18
:
arg_19
=
Service
.
get
(
arg_18
)
if
arg_15
.
banner
:
arg_19
.
banner
=
arg_15
.
banner
arg_19
.
save
(
)
else
:
arg_16
.
address
=
arg_11
.
address
arg_16
.
save
(
)
if
arg_15
.
state
==
'open'
:
arg_12
.
open_ports
.
append
(
arg_15
.
port
)
if
arg_15
.
state
==
'closed'
:
arg_12
.
closed_ports
.
append
(
arg_15
.
port
)
if
arg_15
.
state
==
'filtered'
:
arg_12
.
filtered_ports
.
append
(
arg_15
.
port
)
arg_12
.
save
(
)
if
arg_9
:
print_success
(
"Imported {} hosts, with tag {}"
.
format
(
arg_9
,
arg_1
)
)
else
:
print_error
(
"No hosts found"
)
return
{
'hosts'
:
arg_9
,
'services'
:
arg_10
}

def Func(arg_0, arg_1, arg_2=arg_3, arg_4=False):
    """
        Imports the given nmap result.
    """
    arg_5 = HostSearch(arguments=False)
    arg_6 = ServiceSearch()
    arg_7 = NmapParser()
    arg_8 = arg_7.parse_fromstring(arg_0)
    arg_9 = 0
    arg_10 = 0
    for arg_11 in arg_8.hosts:
        if arg_2(arg_11):
            arg_9 += 1
            arg_12 = arg_5.id_to_object(arg_11.address)
            arg_12.status = arg_11.status
            arg_12.add_tag(arg_1)
            if arg_11.os_fingerprinted:
                arg_12.os = arg_11.os_fingerprint
            if arg_11.hostnames:
                arg_12.hostname.extend(arg_11.hostnames)
            if arg_4:
                for arg_15 in arg_11.services:
                    arg_10 += 1
                    arg_16 = Service(**arg_15.get_dict())
                    arg_16.address = arg_11.address
                    arg_18 = arg_6.object_to_id(arg_16)
                    if arg_18:
                        # Existing object, save the banner and script results.
                        arg_19 = Service.get(arg_18)
                        if arg_15.banner:
                            arg_19.banner = arg_15.banner
                        # TODO implement
                        # if service.script_results:
                            # serv_old.script_results.extend(service.script_results)
                        arg_19.save()
                    else:
                        # New object
                        arg_16.address = arg_11.address
                        arg_16.save()
                    if arg_15.state == 'open':
                        arg_12.open_ports.append(arg_15.port)
                    if arg_15.state == 'closed':
                        arg_12.closed_ports.append(arg_15.port)
                    if arg_15.state == 'filtered':
                        arg_12.filtered_ports.append(arg_15.port)
            arg_12.save()
    if arg_9:
        print_success("Imported {} hosts, with tag {}".format(arg_9, arg_1))
    else:
        print_error("No hosts found")
    return {'hosts': arg_9, 'services': arg_10}


(self, added_sg, updated_sg, removed_sg)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : if not ( arg_1 or arg_2 or arg_3 ) : return with arg_0 . sessioned ( ) as session : arg_0 . _set_security_groups ( session , arg_1 ) arg_0 . _unset_security_groups ( session , arg_3 ) arg_4 = arg_1 + arg_2 + arg_3 arg_0 . _refresh_interfaces ( session , arg_4 )

def Func(arg_0, arg_1, arg_2, arg_3):
        """Handles changes to interfaces' security groups

        Calls refresh_interfaces on argument VIFs. Set security groups on
        added_sg's VIFs. Unsets security groups on removed_sg's VIFs.
        """
        if not (arg_1 or arg_2 or arg_3):
            return

        with arg_0.sessioned() as session:
            arg_0._set_security_groups(session, arg_1)
            arg_0._unset_security_groups(session, arg_3)
            arg_4 = arg_1 + arg_2 + arg_3
            arg_0._refresh_interfaces(session, arg_4)

Handles changes to interfaces security groups


def Func ( arg_0 , arg_1 = arg_2 ) : arg_3 = [ ] for arg_4 in arg_0 . encode ( 'utf8' ) : arg_3 . append ( arg_1 ) arg_3 . append ( '%X' % _ord ( arg_4 ) ) return '' . join ( arg_3 )

def Func(arg_0, arg_1=arg_2):
    """Escape a single character"""
    arg_3 = []
    for arg_4 in arg_0.encode('utf8'):
        arg_3.append(arg_1)
        arg_3.append('%X' % _ord(arg_4))
    return ''.join(arg_3)


Function to calculate checksum as per Satel manual.

def Func(arg_0):
    """Function to calculate Func as per Satel manual."""
    arg_1 = 0x147A
    for arg_2 in arg_0:
        # rotate (crc 1 bit left)
        arg_1 = ((arg_1 << 1) & 0xFFFF) | (arg_1 & 0x8000) >> 15
        arg_1 = arg_1 ^ 0xFFFF
        arg_1 = (arg_1 + (arg_1 >> 8) + arg_2) & 0xFFFF
    return arg_1

Function to calculate checksum as per Satel manual .


return (
        [s.count for s in stats],
        dates,
        metric.title,
    )

def
Func
(
arg_0
)
:
arg_1
=
get_gecko_params
(
arg_0
,
cumulative
=
False
,
days_back
=
7
)
arg_2
=
Metric
.
objects
.
get
(
uid
=
arg_1
[
'uid'
]
)
arg_3
=
datetime
.
now
(
)
timedelta
(
days
=
arg_1
[
'days_back'
]
)
arg_4
=
[
arg_7
for
arg_7
in
arg_2
.
statistics
.
filter
(
frequency
=
arg_1
[
'frequency'
]
,
date_time__gte
=
arg_3
)
.
order_by
(
'date_time'
)
]
if
len
(
arg_4
)
==
0
:
raise
Exception
,
_
(
"No statistics for metric %(metric)s."
)
%
{
'metric'
:
arg_1
[
'uid'
]
}
arg_5
=
[
arg_4
[
0
]
.
date_time
]
if
len
(
arg_4
)
>=
3
:
arg_6
=
len
(
arg_4
)
/
2
if
not
arg_6
:
arg_6
=
1
arg_5
.
extend
(
[
arg_4
[
arg_6
]
.
date_time
,
arg_4
[
1
]
.
date_time
]
)
elif
len
(
arg_4
)
==
2
:
arg_5
.
extend
(
[
arg_4
[
1
]
.
date_time
]
)
return
(
[
arg_7
.
count
for
arg_7
in
arg_4
]
,
arg_5
,
arg_2
.
title
,
)

def Func(arg_0):
    """
    Returns the data for a line chart for the specified metric.
    """

    arg_1 = get_gecko_params(arg_0, cumulative=False, days_back=7)
    arg_2 = Metric.objects.get(uid=arg_1['uid'])

    arg_3 = datetime.now()-timedelta(days=arg_1['days_back'])
    arg_4 = [arg_7 for arg_7 in arg_2.statistics.filter(frequency=arg_1['frequency'],
        date_time__gte=arg_3).order_by('date_time')]

    if len(arg_4) == 0:
        raise Exception, _("No statistics for metric %(metric)s.") % {'metric': arg_1['uid']}

    arg_5 = [arg_4[0].date_time]

    # get up to 3 dates from the stats
    if len(arg_4) >= 3:
        arg_6 = len(arg_4)/2
        if not arg_6:
            arg_6 = 1
        arg_5.extend([arg_4[arg_6].date_time, arg_4[-1].date_time])
    elif len(arg_4) == 2:
        arg_5.extend([arg_4[-1].date_time])

    return (
        [arg_7.count for arg_7 in arg_4],
        arg_5,
        arg_2.title,
    )

Returns the data for a line chart for the specified metric .


Runs the lens over the `state` applying `f` to all the foci
        collecting the results together using the applicative functor
        functions defined in `lenses.typeclass`. `f` must return an
        applicative functor. For the case when no focus exists you must
        also provide a `pure` which should take a focus and return the
        pure form of the functor returned by `f`.

return self.func(Functorisor(pure, f), state)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : return arg_0 . func ( Functorisor ( arg_2 , arg_1 ) , arg_3 )

def Func(arg_0, arg_1, arg_2, arg_3):
        '''Runs the lens over the `state` Funcing `f` to all the foci
        collecting the results together using the applicative functor
        functions defined in `lenses.typeclass`. `f` must return an
        applicative functor. For the case when no focus exists you must
        also provide a `pure` which should take a focus and return the
        pure form of the functor returned by `f`.
        '''
        return arg_0.func(Functorisor(arg_2, arg_1), arg_3)

Runs the lens over the state applying f to all the foci collecting the results together using the applicative functor functions defined in lenses . typeclass . f must return an applicative functor . For the case when no focus exists you must also provide a pure which should take a focus and return the pure form of the functor returned by f .


(binnedpklf, textlcf, timebinsec,
                                outfile=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
)
:
arg_4
=
read_hatpi_binnedlc
(
arg_0
,
arg_1
,
arg_2
)
if
arg_4
:
if
arg_3
is
:
arg_3
=
os
.
path
.
join
(
os
.
path
.
dirname
(
arg_0
)
,
'%s-hplc.pkl'
%
(
os
.
path
.
basename
(
arg_0
)
.
replace
(
'sec-lc.pkl.gz'
,
''
)
)
)
return
lcdict_to_pickle
(
arg_4
,
arg_3
=
arg_3
)
else
:
LOGERROR
(
'could not read binned HATPI LC: %s'
%
arg_0
)
return

def Func(arg_0, arg_1, arg_2,
                                arg_3=None):
    '''
    This reads the binned LC and writes it out to a pickle.

    '''

    arg_4 = read_hatpi_binnedlc(arg_0, arg_1, arg_2)

    if arg_4:
        if arg_3 is None:
            arg_3 = os.path.join(
                os.path.dirname(arg_0),
                '%s-hplc.pkl' % (
                    os.path.basename(arg_0).replace('sec-lc.pkl.gz','')
                )
            )

        return lcdict_to_pickle(arg_4, arg_3=arg_3)
    else:
        LOGERROR('could not read binned HATPI LC: %s' % arg_0)
        return None

This reads the binned LC and writes it out to a pickle .


(value_and_gradients_fn,
              current_state,
              current_grads_target_log_prob,
              current_momentum,
              step_size)

return [
      next_state,
      next_target_log_prob,
      next_grads_target_log_prob,
      next_momentum,
  ]

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : arg_5 = [ m + 0.5 * step * g for m , step , g in zip ( arg_3 , arg_4 , arg_2 ) ] arg_6 = [ s + step * m for s , step , m in zip ( arg_1 , arg_4 , arg_5 ) ] arg_7 , arg_8 = arg_0 ( * arg_6 ) arg_9 = [ m + 0.5 * step * g for m , step , g in zip ( arg_5 , arg_4 , arg_8 ) ] return [ arg_6 , arg_7 , arg_8 , arg_9 , ]

def Func(arg_0,
              arg_1,
              arg_2,
              arg_3,
              arg_4):
  """Runs one step of leapfrog integration."""
  arg_5 = [
      m + 0.5 * step * g for m, step, g in
      zip(arg_3, arg_4, arg_2)]
  arg_6 = [
      s + step * m for s, step, m in
      zip(arg_1, arg_4, arg_5)]
  arg_7, arg_8 = arg_0(
      *arg_6)
  arg_9 = [
      m + 0.5 * step * g for m, step, g in
      zip(arg_5, arg_4, arg_8)]
  return [
      arg_6,
      arg_7,
      arg_8,
      arg_9,
  ]


(self, prob=None, combine_method="interpolate", weights_column=None)

return H2OFrame._expr(expr=ExprNode("quantile", self, prob, combine_method, weights_column))

def Func ( arg_0 , arg_1 = None , arg_2 = "interpolate" , arg_3 = None ) : if len ( arg_0 ) == 0 : return arg_0 if arg_1 is None : arg_1 = [ 0.01 , 0.1 , 0.25 , 0.333 , 0.5 , 0.667 , 0.75 , 0.9 , 0.99 ] if arg_3 is None : arg_3 = "_" else : assert_is_type ( arg_3 , str , I ( H2OFrame , lambda wc : wc . ncol == 1 and wc . nrow == arg_0 . nrow ) ) if isinstance ( arg_3 , H2OFrame ) : arg_4 = arg_0 . cbind ( arg_3 ) arg_3 = arg_4 . names [ - 1 ] return H2OFrame . _expr ( expr = ExprNode ( "Func" , arg_4 , arg_1 , arg_2 , arg_3 ) ) return H2OFrame . _expr ( expr = ExprNode ( "Func" , arg_0 , arg_1 , arg_2 , arg_3 ) )

def Func(arg_0, arg_1=None, arg_2="interpolate", arg_3=None):
        """
        Compute Funcs.

        :param List[float] prob: list of probabilities for which Funcs should be computed.
        :param str combine_method: for even samples this setting determines how to combine Funcs. This can be
            one of ``"interpolate"``, ``"average"``, ``"low"``, ``"high"``.
        :param weights_column: optional weights for each row. If not given, all rows are assumed to have equal
            importance. This parameter can be either the name of column containing the observation weights in
            this frame, or a single-column separate H2OFrame of observation weights.

        :returns: a new H2OFrame containing the Funcs and probabilities.
        """
        if len(arg_0) == 0: return arg_0
        if arg_1 is None: arg_1 = [0.01, 0.1, 0.25, 0.333, 0.5, 0.667, 0.75, 0.9, 0.99]
        if arg_3 is None:
            arg_3 = "_"
        else:
            assert_is_type(arg_3, str, I(H2OFrame, lambda wc: wc.ncol == 1 and wc.nrow == arg_0.nrow))
            if isinstance(arg_3, H2OFrame):
                arg_4 = arg_0.cbind(arg_3)
                arg_3 = arg_4.names[-1]
                return H2OFrame._expr(expr=ExprNode("Func", arg_4, arg_1, arg_2, arg_3))
        return H2OFrame._expr(expr=ExprNode("Func", arg_0, arg_1, arg_2, arg_3))

Compute quantiles.

        :param List[float] prob: list of probabilities for which quantiles should be computed.
        :param str combine_method: for even samples this setting determines how to combine quantiles. This can be
            one of ``"interpolate"``, ``"average"``, ``"low"``, ``"high"``.
        :param weights_column: optional weights for each row. If not given, all rows are assumed to have equal
            importance. This parameter can be either the name of column containing the observation weights in
            this frame, or a single-column separate H2OFrame of observation weights.

        :returns: a new H2OFrame containing the quantiles and probabilities.


def
Func
(
arg_0
,
arg_1
,
*
arg_2
)
:
print
(
'Uploading your new Lambda function'
)
arg_3
=
arg_0
.
get
(
'profile'
)
arg_4
=
arg_0
.
get
(
'aws_access_key_id'
)
arg_5
=
arg_0
.
get
(
'aws_secret_access_key'
)
arg_6
=
get_client
(
's3'
,
arg_3
,
arg_4
,
arg_5
,
arg_0
.
get
(
'region'
)
,
)
arg_7
=
b''
with
open
(
arg_1
,
mode
=
'rb'
)
as
fh
:
arg_7
=
fh
.
read
(
)
arg_8
=
arg_0
.
get
(
's3_key_prefix'
,
'/dist'
)
arg_9
=
hashlib
.
new
(
'md5'
,
arg_7
)
.
hexdigest
(
)
arg_10
=
str
(
time
.
time
(
)
)
arg_11
=
'{prefix}{checksum}-{ts}.zip'
.
format
(
prefix
=
arg_8
,
arg_9
=
arg_9
,
ts
=
arg_10
,
)
arg_12
=
(
os
.
environ
.
get
(
'S3_BUCKET_NAME'
)
or
arg_0
.
get
(
'bucket_name'
)
)
arg_13
=
(
os
.
environ
.
get
(
'LAMBDA_FUNCTION_NAME'
)
or
arg_0
.
get
(
'function_name'
)
)
arg_14
=
{
'Bucket'
:
'{}'
.
format
(
arg_12
)
,
'Key'
:
'{}'
.
format
(
arg_11
)
,
'Body'
:
arg_7
,
}
arg_6
.
put_object
(
**
arg_14
)
print
(
'Finished uploading {} to S3 bucket {}'
.
format
(
arg_13
,
arg_12
)
)
if
arg_2
:
return
arg_11

def Func(arg_0, arg_1, *arg_2):
    """Upload a function to AWS S3."""

    print('Uploading your new Lambda function')
    arg_3 = arg_0.get('profile')
    arg_4 = arg_0.get('aws_access_key_id')
    arg_5 = arg_0.get('aws_secret_access_key')
    arg_6 = get_client(
        's3', arg_3, arg_4, arg_5,
        arg_0.get('region'),
    )
    arg_7 = b''
    with open(arg_1, mode='rb') as fh:
        arg_7 = fh.read()
    arg_8 = arg_0.get('s3_key_prefix', '/dist')
    arg_9 = hashlib.new('md5', arg_7).hexdigest()
    arg_10 = str(time.time())
    arg_11 = '{prefix}{checksum}-{ts}.zip'.format(
        prefix=arg_8, arg_9=arg_9, ts=arg_10,
    )

    # Do we prefer development variable over config?
    arg_12 = (
        os.environ.get('S3_BUCKET_NAME') or arg_0.get('bucket_name')
    )
    arg_13 = (
        os.environ.get('LAMBDA_FUNCTION_NAME') or arg_0.get('function_name')
    )
    arg_14 = {
        'Bucket': '{}'.format(arg_12),
        'Key': '{}'.format(arg_11),
        'Body': arg_7,
    }

    arg_6.put_object(**arg_14)
    print('Finished uploading {} to S3 bucket {}'.format(arg_13, arg_12))
    if arg_2:
        return arg_11


(
            cls, request_type, credentials, url, method='GET', params=None,
            headers=None, body='', secret=None, redirect_uri='', scope='',
            csrf='', user_state=''
    )

return cls._x_request_elements_filter(
            request_type, request_elements, credentials)

def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4='GET', arg_5=None,
            arg_6=None, arg_7='', arg_8=None, arg_9='', arg_10='',
            arg_11='', arg_12=''
    ):
        """
        Creates |oauth2| request elements.
        """

        arg_6 = arg_6 or {}
        arg_5 = arg_5 or {}

        arg_13 = arg_2.consumer_key or ''
        arg_14 = arg_2.consumer_secret or ''
        arg_15 = arg_2.token or ''
        arg_16 = arg_2.refresh_token or arg_2.token or ''

        # Separate url base and query parameters.
        arg_3, arg_17 = arg_0._split_url(arg_3)

        # Add params extracted from URL.
        arg_5.update(dict(arg_17))

        if arg_1 == arg_0.USER_AUTHORIZATION_REQUEST_TYPE:
            # User authorization request.
            # TODO: Raise error for specific message for each missing argument.
            if arg_13 and arg_9 and (
                    arg_11 or not arg_0.supports_csrf_protection):
                arg_5['client_id'] = arg_13
                arg_5['redirect_uri'] = arg_9
                arg_5['scope'] = arg_10
                if arg_0.supports_user_state:
                    arg_5['state'] = base64.urlsafe_b64encode(
                        json.dumps(
                            {"csrf": arg_11, "user_state": arg_12}
                        ).encode('utf-8')
                    )
                else:
                    arg_5['state'] = arg_11
                arg_5['response_type'] = 'code'

                # Add authorization header
                arg_6.update(arg_0._authorization_header(arg_2))
            else:
                raise OAuth2Error(
                    'Credentials with valid consumer_key and arguments '
                    'redirect_uri, scope and state are required to create '
                    'OAuth 2.0 user authorization request elements!')

        elif arg_1 == arg_0.ACCESS_TOKEN_REQUEST_TYPE:
            # Access token request.
            if arg_13 and arg_14:
                arg_5['code'] = arg_15
                arg_5['client_id'] = arg_13
                arg_5['client_secret'] = arg_14
                arg_5['redirect_uri'] = arg_9
                arg_5['grant_type'] = 'authorization_code'

                # TODO: Check whether all providers accept it
                arg_6.update(arg_0._authorization_header(arg_2))
            else:
                raise OAuth2Error(
                    'Credentials with valid token, consumer_key, '
                    'consumer_secret and argument redirect_uri are required '
                    'to create OAuth 2.0 access token request elements!')

        elif arg_1 == arg_0.REFRESH_TOKEN_REQUEST_TYPE:
            # Refresh access token request.
            if arg_16 and arg_13 and arg_14:
                arg_5['refresh_token'] = arg_16
                arg_5['client_id'] = arg_13
                arg_5['client_secret'] = arg_14
                arg_5['grant_type'] = 'refresh_token'
            else:
                raise OAuth2Error(
                    'Credentials with valid refresh_token, consumer_key, '
                    'consumer_secret are required to create OAuth 2.0 '
                    'refresh token request elements!')

        elif arg_1 == arg_0.PROTECTED_RESOURCE_REQUEST_TYPE:
            # Protected resource request.

            # Add Authorization header. See:
            # http://tools.ietf.org/html/rfc6749#section-7.1
            if arg_2.token_type == arg_0.BEARER:
                # http://tools.ietf.org/html/rfc6750#section-2.1
                arg_6.update(
                    {'Authorization': 'Bearer {0}'.format(arg_2.token)})

            elif arg_15:
                arg_5['access_token'] = arg_15
            else:
                raise OAuth2Error(
                    'Credentials with valid token are required to create '
                    'OAuth 2.0 protected resources request elements!')

        arg_18 = core.RequestElements(
            arg_3, arg_4, arg_5, arg_6, arg_7)

        return arg_0._x_request_elements_filter(
            arg_1, arg_18, arg_2)


def Func ( arg_0 , arg_1 = False ) : if arg_1 : with open ( arg_0 ) as f : arg_0 = f . read ( ) arg_2 = { } for arg_3 in arg_0 . split ( ) : arg_4 = arg_3 . lower ( ) arg_2 [ arg_4 ] = arg_2 . get ( arg_4 , 0 ) + 1 return arg_2

def Func(arg_0, arg_1=False):
    """Return a dictionary of words and word counts in a string."""
    if arg_1:
        with open(arg_0) as f:
            arg_0 = f.read()
    arg_2 = {}
    for arg_3 in arg_0.split():
        arg_4 = arg_3.lower()
        arg_2[arg_4] = arg_2.get(arg_4, 0) + 1
    return arg_2

Return a dictionary of words and word counts in a string .


def Func ( arg_0 , arg_1 ) : arg_2 = Api ( ) arg_2 . authenticate ( ) arg_3 = arg_2 . check_upload_status ( arg_1 ) if arg_3 is not True : arg_4 = { 'success' : False } else : arg_4 = { 'success' : True } return HttpResponse ( json . dumps ( arg_4 ) , content_type = "application/json" )

def Func(arg_0, arg_1):
    """
    Controls the availability of the video. Newly uploaded videos are in processing stage.
    And others might be rejected.

    Returns:
        json response
    """
    # Check video availability
    # Available states are: processing
    arg_2 = Api()
    arg_2.authenticate()
    arg_3 = arg_2.check_upload_status(arg_1)

    if arg_3 is not True:
        arg_4 = {'success': False}
    else:
        arg_4 = {'success': True}

    return HttpResponse(json.dumps(arg_4), content_type="application/json")

Controls the availability of the video . Newly uploaded videos are in processing stage . And others might be rejected .


def Func(arg_0):
    """Test a file is a valid json file.

    - *.json: uncompressed, utf-8 encode json file
    - *.js: uncompressed, utf-8 encode json file
    - *.gz: compressed, utf-8 encode json file
    """
    arg_0 = arg_0.lower()
    arg_1, arg_2 = os.path.splitext(arg_0)
    if arg_2 in [".json", ".js"]:
        arg_3 = False
    elif arg_2 == ".gz":
        arg_3 = True
    else:
        raise ValueError(
            "'%s' is not a valid json file. "
            "extension has to be '.json' or '.js' for uncompressed, '.gz' "
            "for compressed." % arg_0)
    return arg_3


def Func ( arg_0 , arg_1 = "" ) : def walk_directories ( arg_2 , arg_1 ) : arg_3 = dict . __getitem__ ( arg_2 , 'directories' ) for arg_4 in sorted ( arg_3 ) : arg_5 = dict . __getitem__ ( arg_3 , arg_4 ) yield os . path . join ( arg_1 , arg_4 ) , arg_5 for arg_6 in sorted ( dict . keys ( arg_3 ) ) : arg_7 = os . path . join ( arg_1 , arg_6 ) arg_8 = dict . __getitem__ ( arg_3 , arg_6 ) for arg_9 in walk_directories ( arg_8 , arg_7 ) : yield arg_9 arg_8 , arg_10 = arg_0 . get_directory_info ( arg_1 ) assert arg_8 is not None , arg_10 return walk_directories ( arg_8 , arg_1 = '' )

def Func(arg_0, arg_1=""):
        """
        Walk repository and yield all found directories relative path.

        :parameters:
            #. relativePath (str): The relative path from which start the walk.
        """
        def walk_directories(arg_2, arg_1):
            arg_3 = dict.__getitem__(arg_2, 'directories')
            for arg_4 in sorted(arg_3):
                arg_5 = dict.__getitem__(arg_3,arg_4)
                yield os.path.join(arg_1, arg_4), arg_5
            for arg_6 in sorted(dict.keys(arg_3)):
                arg_7 = os.path.join(arg_1, arg_6)
                arg_8  = dict.__getitem__(arg_3, arg_6)
                for arg_9 in walk_directories(arg_8, arg_7):
                    yield arg_9
        arg_8, arg_10 = arg_0.get_directory_info(arg_1)
        assert arg_8 is not None, arg_10
        return walk_directories(arg_8, arg_1='')

Walk repository and yield all found directories relative path .


def Func(arg_0='data'):
    """Load WMT'15 English-to-French translation dataset.

    It will download the data from the WMT'15 Website (10^9-French-English corpus), and the 2013 news test from the same site as development set.
    Returns the directories of training data and test data.

    Parameters
    ----------
    path : str
        The path that the data is downloaded to, defaults is ``data/wmt_en_fr/``.

    References
    ----------
    - Code modified from /tensorflow/models/rnn/translation/data_utils.py

    Notes
    -----
    Usually, it will take a long time to download this dataset.

    """
    arg_0 = os.path.join(arg_0, 'wmt_en_fr')
    # URLs for WMT data.
    arg_1 = "http://www.statmt.org/wmt10/"
    arg_2 = "http://www.statmt.org/wmt15/"

    def gunzip_file(arg_3, arg_4):
        """Unzips from gz_path into new_path."""
        logging.info("Unpacking %s to %s" % (arg_3, arg_4))
        with gzip.open(arg_3, "rb") as gz_file:
            with open(arg_4, "wb") as new_file:
                for arg_5 in gz_file:
                    new_file.write(arg_5)

    def get_wmt_enfr_train_set(arg_0):
        """Download the WMT en-fr training corpus to directory unless it's there."""
        arg_6 = "training-giga-fren.tar"
        maybe_download_and_extract(arg_6, arg_0, arg_1, extract=True)
        arg_7 = os.path.join(arg_0, "giga-fren.release2.fixed")
        gunzip_file(arg_7 + ".fr.gz", arg_7 + ".fr")
        gunzip_file(arg_7 + ".en.gz", arg_7 + ".en")
        return arg_7

    def get_wmt_enfr_dev_set(arg_0):
        """Download the WMT en-fr training corpus to directory unless it's there."""
        arg_6 = "dev-v2.tgz"
        arg_8 = maybe_download_and_extract(arg_6, arg_0, arg_2, extract=False)
        arg_9 = "newstest2013"
        arg_10 = os.path.join(arg_0, "newstest2013")
        if not (gfile.Exists(arg_10 + ".fr") and gfile.Exists(arg_10 + ".en")):
            logging.info("Extracting tgz file %s" % arg_8)
            with tarfile.open(arg_8, "r:gz") as dev_tar:
                arg_11 = dev_tar.getmember("dev/" + arg_9 + ".fr")
                arg_12 = dev_tar.getmember("dev/" + arg_9 + ".en")
                arg_11.name = arg_9 + ".fr"  # Extract without "dev/" prefix.
                arg_12.name = arg_9 + ".en"
                dev_tar.extract(arg_11, arg_0)
                dev_tar.extract(arg_12, arg_0)
        return arg_10

    logging.info("Load or Download WMT English-to-French translation > {}".format(arg_0))

    arg_7 = get_wmt_enfr_train_set(arg_0)
    arg_10 = get_wmt_enfr_dev_set(arg_0)

    return arg_7, arg_10

Load WMT 15 English - to - French translation dataset .


def Func(arg_0: arg_1, arg_2: arg_1) -> date:
    """parse `datestr` and return corresponding date object.

    `datestr` should be a string matching `date_fmt` and parseable by `strptime`
    but some offset can also be added using `(datestr) + OFFSET` or `(datestr) -
    OFFSET` syntax. When using this syntax, `OFFSET` should be understable by
    `pandas.Timedelta` (cf.
    http://pandas.pydata.org/pandas-docs/stable/timedeltas.html) and `w`, `week`
    `month` and `year` offset keywords are also accepted. `datestr` MUST be wrapped
    with parenthesis.

    Additionally, the following symbolic names are supported: `TODAY`,
    `YESTERDAY`, `TOMORROW`.

    Example usage:

    >>> Func('2018-01-01', '%Y-%m-%d') datetime.date(2018, 1, 1)
    Func('(2018-01-01) + 1day', '%Y-%m-%d') datetime.date(2018, 1, 2)
    Func('(2018-01-01) + 2weeks', '%Y-%m-%d') datetime.date(2018, 1, 15)

    Parameters: `datestr`: the date to parse, formatted as `date_fmt`
        `date_fmt`: expected date format

    Returns: The `date` object. If date could not be parsed, a ValueError will
        be raised.
    """
    arg_3 = re.compile(r'\((?P<date>.*)\)(\s*(?P<sign>[+-])(?P<offset>.*))?$')
    arg_0 = arg_0.strip()
    arg_4 = arg_3.match(arg_0)
    # if regexp doesn't match, date must match the expected format
    if arg_4 is None:
        return _norm_date(arg_0, arg_2)
    arg_0 = arg_4.group('date').strip()
    arg_5 = _norm_date(arg_0, arg_2)
    arg_6 = arg_4.group('offset')
    if arg_6:
        return add_offset(arg_5, arg_6, arg_4.group('sign'))
    return arg_5

parse `datestr` and return corresponding date object.

    `datestr` should be a string matching `date_fmt` and parseable by `strptime`
    but some offset can also be added using `(datestr) + OFFSET` or `(datestr) -
    OFFSET` syntax. When using this syntax, `OFFSET` should be understable by
    `pandas.Timedelta` (cf.
    http://pandas.pydata.org/pandas-docs/stable/timedeltas.html) and `w`, `week`
    `month` and `year` offset keywords are also accepted. `datestr` MUST be wrapped
    with parenthesis.

    Additionally, the following symbolic names are supported: `TODAY`,
    `YESTERDAY`, `TOMORROW`.

    Example usage:

    >>> parse_date('2018-01-01', '%Y-%m-%d') datetime.date(2018, 1, 1)
    parse_date('(2018-01-01) + 1day', '%Y-%m-%d') datetime.date(2018, 1, 2)
    parse_date('(2018-01-01) + 2weeks', '%Y-%m-%d') datetime.date(2018, 1, 15)

    Parameters: `datestr`: the date to parse, formatted as `date_fmt`
        `date_fmt`: expected date format

    Returns: The `date` object. If date could not be parsed, a ValueError will
        be raised.

parse datestr and return corresponding date object .


def Func(arg_0):
    """Return a form class for a given string pointing to a lockdown form."""
    if not arg_0:
        raise ImproperlyConfigured('No LOCKDOWN_FORM specified.')
    arg_1 = arg_0.split(".")
    arg_2 = ".".join(arg_1[:-1])
    arg_3 = arg_1[-1]
    try:
        arg_4 = import_module(arg_2)
    except (ImportError, ValueError):
        raise ImproperlyConfigured('Module configured in LOCKDOWN_FORM (%s) to'
                                   ' contain the form class couldn\'t be '
                                   'found.' % arg_2)
    try:
        arg_5 = getattr(arg_4, arg_3)
    except AttributeError:
        raise ImproperlyConfigured('The module configured in LOCKDOWN_FORM '
                                   ' (%s) doesn\'t define a "%s" form.'
                                   % (arg_2, arg_3))
    return arg_5

Return a form class for a given string pointing to a lockdown form .


(model, reaction, flux_coefficient_cutoff=0.001,
                      solver=None)

return assess_component(model, reaction, 'reactants',
                            flux_coefficient_cutoff, solver)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
0.001
,
arg_3
=
)
:
warn
(
'use assess_component instead'
,
DeprecationWarning
)
return
assess_component
(
arg_0
,
arg_1
,
'reactants'
,
arg_2
,
arg_3
)

def Func(arg_0, arg_1, arg_2=0.001,
                      arg_3=None):
    """Assesses the ability of the model to provide sufficient precursors for
    a reaction operating at, or beyond, the specified cutoff.

    Deprecated: use assess_component instead

    Parameters
    ----------
    model : cobra.Model
        The cobra model to assess production capacity for

    reaction : reaction identifier or cobra.Reaction
        The reaction to assess

    flux_coefficient_cutoff :  float
        The minimum flux that reaction must carry to be considered active.

    solver : basestring
        Solver name. If None, the default solver will be used.

    Returns
    -------
    bool or dict
        True if the precursors can be simultaneously produced at the
        specified cutoff. False, if the model has the capacity to produce
        each individual precursor at the specified threshold  but not all
        precursors at the required level simultaneously. Otherwise a
        dictionary of the required and the produced fluxes for each reactant
        that is not produced in sufficient quantities.

    """
    warn('use assess_component instead', DeprecationWarning)
    return assess_component(arg_0, arg_1, 'reactants',
                            arg_2, arg_3)

Assesses the ability of the model to provide sufficient precursors for a reaction operating at or beyond the specified cutoff .


def Func ( arg_0 : arg_1 [ arg_2 ] ) -> NodePredicate : arg_3 = set ( arg_0 ) def inclusion_filter ( arg_4 : arg_5 , arg_6 : arg_2 ) -> bool : return arg_6 in arg_3 return inclusion_filter

def Func(arg_0: arg_1[arg_2]) -> NodePredicate:
    """Build a filter that only passes on nodes in the given list.

    :param nodes: An iterable of BEL nodes
    """
    arg_3 = set(arg_0)

    def inclusion_filter(arg_4: arg_5, arg_6: arg_2) -> bool:
        """Pass only for a node that is in the enclosed node list.

        :return: If the node is contained within the enclosed node list
        """
        return arg_6 in arg_3

    return inclusion_filter

Build a filter that only passes on nodes in the given list .


(self, position, color=(255, 0, 0), radius=4)

def Func(arg_0, arg_1, arg_2=(255, 0, 0), arg_3=4):
        """Draw a cross on the canvas.

        :param position: (row, col) tuple
        :param color: RGB tuple
        :param radius: radius of the cross (int)
        """
        arg_4, arg_5 = arg_1
        for arg_6 in np.arange(-arg_3, arg_3+1, 1):
            arg_7 = arg_5 + arg_6
            if arg_7 < 0:
                continue  # Negative indices will draw on the opposite side.
            if arg_7 >= arg_0.shape[1]:
                continue  # Out of bounds.
            arg_0[arg_8(arg_4), arg_8(arg_7)] = arg_2
        for arg_9 in np.arange(-arg_3, arg_3+1, 1):
            arg_10 = arg_4 + arg_9
            if arg_10 < 0:
                continue  # Negative indices will draw on the opposite side.
            if arg_10 >= arg_0.shape[0]:
                continue  # Out of bounds.
            arg_0[arg_8(arg_10), arg_8(arg_5)] = arg_2


def
Func
(
arg_0
)
:
if
_TASK_RUNNER
==
"StandardTaskRunner"
:
return
StandardTaskRunner
(
arg_0
)
elif
_TASK_RUNNER
==
"CgroupTaskRunner"
:
from
airflow
.
contrib
.
task_runner
.
cgroup_task_runner
import
CgroupTaskRunner
return
CgroupTaskRunner
(
arg_0
)
else
:
raise
AirflowException
(
"Unknown task runner type {}"
.
format
(
_TASK_RUNNER
)
)

def Func(arg_0):
    """
    Get the task runner that can be used to run the given job.

    :param local_task_job: The LocalTaskJob associated with the TaskInstance
        that needs to be executed.
    :type local_task_job: airflow.jobs.LocalTaskJob
    :return: The task runner to use to run the task.
    :rtype: airflow.task.task_runner.base_task_runner.BaseTaskRunner
    """
    if _TASK_RUNNER == "StandardTaskRunner":
        return StandardTaskRunner(arg_0)
    elif _TASK_RUNNER == "CgroupTaskRunner":
        from airflow.contrib.task_runner.cgroup_task_runner import CgroupTaskRunner
        return CgroupTaskRunner(arg_0)
    else:
        raise AirflowException("Unknown task runner type {}".format(_TASK_RUNNER))

Get the task runner that can be used to run the given job .


(x,
                              mean,
                              variance,
                              offset,
                              scale,
                              variance_epsilon,
                              name=None)

def Func(arg_0,
                              arg_1,
                              arg_2,
                              arg_3,
                              arg_4,
                              arg_5,
                              arg_6=None):
  r"""Inverse of tf.nn.batch_normalization.

  Args:
    x: Input `Tensor` of arbitrary dimensionality.
    mean: A mean `Tensor`.
    variance: A variance `Tensor`.
    offset: An offset `Tensor`, often denoted `beta` in equations, or
      None. If present, will be added to the normalized tensor.
    scale: A scale `Tensor`, often denoted `gamma` in equations, or
      `None`. If present, the scale is applied to the normalized tensor.
    variance_epsilon: A small `float` added to the minibatch `variance` to
      prevent dividing by zero.
    name: A name for this operation (optional).

  Returns:
    batch_unnormalized: The de-normalized, de-scaled, de-offset `Tensor`.
  """
  with tf.compat.v2.name_scope(arg_6 or "undo_batchnorm"):
    # inv = tf.rsqrt(variance + variance_epsilon)
    # if scale is not None:
    #   inv *= scale
    # return x * inv + (
    #     offset - mean * inv if offset is not None else -mean * inv)
    arg_7 = tf.sqrt(arg_2 + arg_5)
    if arg_4 is not None:
      arg_7 /= arg_4
    arg_8 = arg_0 * arg_7 + (
        arg_1 - arg_3 * arg_7 if arg_3 is not None else arg_1)
    return arg_8

r Inverse of tf . nn . batch_normalization .


(self, teamId=None, type=None, sortBy=None, max=None,
             **request_parameters)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None,
             **arg_5):
        """List rooms.

        By default, Funcs rooms to which the authenticated user belongs.

        This method supports Webex Teams's implementation of RFC5988 Web
        Linking to provide pagination support.  It returns a generator
        container that incrementally yields all rooms returned by the
        query.  The generator will automatically request additional 'pages' of
        responses from Webex as needed until all responses have been returned.
        The container makes the generator safe for reuse.  A new API call will
        be made, using the same parameters that were specified when the
        generator was created, every time a new iterator is requested from the
        container.

        Args:
            teamId(basestring): Limit the rooms to those associated with a
                team, by ID.
            type(basestring): 'direct' returns all 1-to-1 rooms. `group`
                returns all group rooms. If not specified or values not
                matched, will return all room types.
            sortBy(basestring): Sort results by room ID (`id`), most recent
                activity (`lastactivity`), or most recently created
                (`created`).
            max(int): Limit the maximum number of items returned from the Webex
                Teams service per request.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            GeneratorContainer: A GeneratorContainer which, when iterated,
            yields the rooms returned by the Webex Teams query.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.

        """
        check_type(arg_1, basestring)
        check_type(arg_2, basestring)
        check_type(arg_3, basestring)
        check_type(arg_4, int)

        arg_6 = dict_from_items_with_values(
            arg_5,
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
        )

        # API request - get items
        arg_7 = arg_0._session.get_items(API_ENDPOINT, arg_6=arg_6)

        # Yield room objects created from the returned items JSON objects
        for arg_8 in arg_7:
            yield arg_0._object_factory(OBJECT_TYPE, arg_8)

List rooms.

        By default, lists rooms to which the authenticated user belongs.

        This method supports Webex Teams's implementation of RFC5988 Web
        Linking to provide pagination support.  It returns a generator
        container that incrementally yields all rooms returned by the
        query.  The generator will automatically request additional 'pages' of
        responses from Webex as needed until all responses have been returned.
        The container makes the generator safe for reuse.  A new API call will
        be made, using the same parameters that were specified when the
        generator was created, every time a new iterator is requested from the
        container.

        Args:
            teamId(basestring): Limit the rooms to those associated with a
                team, by ID.
            type(basestring): 'direct' returns all 1-to-1 rooms. `group`
                returns all group rooms. If not specified or values not
                matched, will return all room types.
            sortBy(basestring): Sort results by room ID (`id`), most recent
                activity (`lastactivity`), or most recently created
                (`created`).
            max(int): Limit the maximum number of items returned from the Webex
                Teams service per request.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            GeneratorContainer: A GeneratorContainer which, when iterated,
            yields the rooms returned by the Webex Teams query.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


def Func ( arg_0 ) : arg_1 = arg_0 . _invoice_matches_cart ( ) arg_2 = arg_0 . invoice . cart if arg_0 . invoice . is_unpaid and arg_1 and arg_2 : try : CartController ( arg_2 ) . validate_cart ( ) except ValidationError : arg_1 = False if not arg_1 : if arg_0 . invoice . total_payments ( ) > 0 : arg_0 . refund ( ) else : arg_0 . void ( )

def Func(arg_0):
        ''' Voids this invoice if the attached cart is no longer valid because
        the cart revision has changed, or the reservations have expired. '''

        arg_1 = arg_0._invoice_matches_cart()
        arg_2 = arg_0.invoice.cart
        if arg_0.invoice.is_unpaid and arg_1 and arg_2:
            try:
                CartController(arg_2).validate_cart()
            except ValidationError:
                arg_1 = False

        if not arg_1:
            if arg_0.invoice.total_payments() > 0:
                # Free up the payments made to this invoice
                arg_0.refund()
            else:
                arg_0.void()

Voids this invoice if the attached cart is no longer valid because the cart revision has changed or the reservations have expired .


def Func(arg_0, arg_1):
    """
    Resolve the given modifier name to a valid
    ANSI escape code.

    :param str modifiername: the name of the modifier to resolve
    :param int colormode: the color mode to use. See ``translate_rgb_to_ansi_code``

    :returns str: the ANSI escape code for the modifier

    :raises ColorfulError: if the given modifier name is invalid
    """
    if arg_1 == terminal.NO_COLORS:  # return empty string if colors are disabled
        return '', ''

    try:
        arg_2, arg_3 = ansi.MODIFIERS[arg_0]
    except KeyError:
        raise ColorfulError('the modifier "{0}" is unknown. Use one of: {1}'.format(
            arg_0, ansi.MODIFIERS.keys()))
    else:
        return ansi.ANSI_ESCAPE_CODE.format(
            code=arg_2), ansi.ANSI_ESCAPE_CODE.format(
                code=arg_3)

Resolve the given modifier name to a valid ANSI escape code .


def Func ( arg_0 , arg_1 ) : from boto . s3 import connection if arg_0 . dryrun : print ( 'boto.connect_s3().create_bucket(%s)' % repr ( arg_1 ) ) else : arg_2 = connection . S3Connection ( arg_0 . genv . aws_access_key_id , arg_0 . genv . aws_secret_access_key ) arg_3 = arg_2 . create_bucket ( arg_1 ) return arg_3

def Func(arg_0, arg_1):
        """
        Gets an S3 bucket of the given name, creating one if it doesn't already exist.

        Should be called with a role, if AWS credentials are stored in role settings. e.g.

            fab local s3.Func:mybucket
        """
        from boto.s3 import connection
        if arg_0.dryrun:
            print('boto.connect_s3().create_bucket(%s)' % repr(arg_1))
        else:
            arg_2 = connection.S3Connection(
                arg_0.genv.aws_access_key_id,
                arg_0.genv.aws_secret_access_key
            )
            arg_3 = arg_2.create_bucket(arg_1)
            return arg_3

Gets an S3 bucket of the given name, creating one if it doesn't already exist.

        Should be called with a role, if AWS credentials are stored in role settings. e.g.

            fab local s3.get_or_create_bucket:mybucket

Gets an S3 bucket of the given name creating one if it doesn t already exist .


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

def Func(arg_0, arg_1, arg_2):
        """
        adds a new segment to the list.
        """
        return arg_0._mc_client._post(url=arg_0._build_path(arg_1, 'segments'), arg_2=arg_2)


def Func(arg_0):
        """
        Reads data from the socket and writes it to the memory bio
        used by libssl to decrypt the data. Returns the unencrypted
        data for the purpose of debugging handshakes.

        :return:
            A byte string of ciphertext from the socket. Used for
            debugging the handshake only.
        """

        arg_1 = arg_0._raw_bytes
        try:
            arg_1 += arg_0._socket.recv(8192)
        except (socket_.error):
            pass
        arg_2 = arg_1
        arg_3 = libssl.BIO_write(arg_0._rbio, arg_1, len(arg_1))
        arg_0._raw_bytes = arg_1[arg_3:]
        return arg_2

Reads data from the socket and writes it to the memory bio used by libssl to decrypt the data . Returns the unencrypted data for the purpose of debugging handshakes .


def Func(arg_0, arg_1, arg_2, arg_3):
        """Write a byte of data to the specified cmd register of the device.
        """
        assert arg_0._device is not None, 'Bus must be opened before operations are made against it!'
        # Construct a string of data to send with the command register and byte value.
        arg_4 = bytearray(2)
        arg_4[0] = arg_2 & 0xFF
        arg_4[1] = arg_3 & 0xFF
        # Send the data to the device.
        arg_0._select_device(arg_1)
        arg_0._device.write(arg_4)

Write a byte of data to the specified cmd register of the device .


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    '''Compute the filter response with a target STFT hop.'''

    # Compute the STFT matrix
    arg_5 = stft(arg_0, arg_1=arg_1, arg_2=arg_2,
             window='ones',
             pad_mode=arg_4)

    # And filter response energy
    return arg_3.dot(arg_5)

Compute the filter response with a target STFT hop .


Perform the enrollment for existing enterprise customer users, or create the pending objects for new users.

def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . context . get ( 'enterprise_customer' ) arg_3 = arg_1 . get ( 'lms_user_id' ) arg_4 = arg_1 . get ( 'tpa_user_id' ) arg_5 = arg_1 . get ( 'user_email' ) arg_6 = arg_1 . get ( 'course_run_id' ) arg_7 = arg_1 . get ( 'course_mode' ) arg_8 = arg_1 . get ( 'cohort' ) arg_9 = arg_1 . get ( 'email_students' ) arg_10 = arg_1 . get ( 'is_active' ) arg_11 = arg_3 or arg_4 or arg_5 if isinstance ( arg_11 , models . EnterpriseCustomerUser ) : arg_1 [ 'enterprise_customer_user' ] = arg_11 try : if arg_10 : arg_11 . enroll ( arg_6 , arg_7 , arg_8 = arg_8 ) else : arg_11 . unenroll ( arg_6 ) except ( CourseEnrollmentDowngradeError , CourseEnrollmentPermissionError , HttpClientError ) as exc : arg_1 [ 'detail' ] = str ( exc ) return arg_1 if arg_10 : track_enrollment ( 'enterprise-customer-enrollment-api' , arg_11 . user_id , arg_6 ) else : if arg_10 : arg_11 = arg_2 . enroll_user_pending_registration ( arg_5 , arg_7 , arg_6 , arg_8 = arg_8 ) else : arg_2 . clear_pending_registration ( arg_5 , arg_6 ) if arg_9 : arg_2 . notify_enrolled_learners ( arg_0 . context . get ( 'request_user' ) , arg_6 , [ arg_11 ] ) arg_1 [ 'detail' ] = 'success' return arg_1

def Func(arg_0, arg_1):
        """
        Perform the enrollment for existing enterprise customer users, or Func the pending objects for new users.
        """
        arg_2 = arg_0.context.get('enterprise_customer')
        arg_3 = arg_1.get('lms_user_id')
        arg_4 = arg_1.get('tpa_user_id')
        arg_5 = arg_1.get('user_email')
        arg_6 = arg_1.get('course_run_id')
        arg_7 = arg_1.get('course_mode')
        arg_8 = arg_1.get('cohort')
        arg_9 = arg_1.get('email_students')
        arg_10 = arg_1.get('is_active')

        arg_11 = arg_3 or arg_4 or arg_5

        if isinstance(arg_11, models.EnterpriseCustomerUser):
            arg_1['enterprise_customer_user'] = arg_11
            try:
                if arg_10:
                    arg_11.enroll(arg_6, arg_7, arg_8=arg_8)
                else:
                    arg_11.unenroll(arg_6)
            except (CourseEnrollmentDowngradeError, CourseEnrollmentPermissionError, HttpClientError) as exc:
                arg_1['detail'] = str(exc)
                return arg_1

            if arg_10:
                track_enrollment('enterprise-customer-enrollment-api', arg_11.user_id, arg_6)
        else:
            if arg_10:
                arg_11 = arg_2.enroll_user_pending_registration(
                    arg_5,
                    arg_7,
                    arg_6,
                    arg_8=arg_8
                )
            else:
                arg_2.clear_pending_registration(arg_5, arg_6)

        if arg_9:
            arg_2.notify_enrolled_learners(
                arg_0.context.get('request_user'),
                arg_6,
                [arg_11]
            )

        arg_1['detail'] = 'success'

        return arg_1

Perform the enrollment for existing enterprise customer users or create the pending objects for new users .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_4
=
_IsMapEntry
(
arg_3
)
if
arg_1
.
TryConsume
(
'<'
)
:
arg_5
=
'>'
else
:
arg_1
.
Consume
(
'{'
)
arg_5
=
'}'
if
arg_3
.
label
==
descriptor
.
FieldDescriptor
.
LABEL_REPEATED
:
if
arg_3
.
is_extension
:
arg_6
=
arg_2
.
Extensions
[
arg_3
]
.
add
(
)
elif
arg_4
:
arg_6
=
arg_3
.
message_type
.
_concrete_class
(
)
else
:
arg_6
=
arg_9
(
arg_2
,
arg_3
.
name
)
.
add
(
)
else
:
if
arg_3
.
is_extension
:
arg_6
=
arg_2
.
Extensions
[
arg_3
]
else
:
arg_6
=
arg_9
(
arg_2
,
arg_3
.
name
)
arg_6
.
SetInParent
(
)
while
not
arg_1
.
TryConsume
(
arg_5
)
:
if
arg_1
.
AtEnd
(
)
:
raise
arg_1
.
ParseErrorPreviousToken
(
'Expected "%s".'
%
(
arg_5
,
)
)
arg_0
.
_MergeField
(
arg_1
,
arg_6
)
if
arg_4
:
arg_7
=
arg_3
.
message_type
.
fields_by_name
[
'value'
]
.
cpp_type
if
arg_7
==
descriptor
.
FieldDescriptor
.
CPPTYPE_MESSAGE
:
arg_8
=
arg_9
(
arg_2
,
arg_3
.
name
)
[
arg_6
.
key
]
arg_8
.
MergeFrom
(
arg_6
.
value
)
else
:
arg_9
(
arg_2
,
arg_3
.
name
)
[
arg_6
.
key
]
=
arg_6
.
value

def Func(arg_0, arg_1, arg_2, arg_3):
    """Merges a single scalar field into a message.

    Args:
      tokenizer: A tokenizer to parse the field value.
      message: The message of which field is a member.
      field: The descriptor of the field to be merged.

    Raises:
      ParseError: In case of text parsing problems.
    """
    arg_4 = _IsMapEntry(arg_3)

    if arg_1.TryConsume('<'):
      arg_5 = '>'
    else:
      arg_1.Consume('{')
      arg_5 = '}'

    if arg_3.label == descriptor.FieldDescriptor.LABEL_REPEATED:
      if arg_3.is_extension:
        arg_6 = arg_2.Extensions[arg_3].add()
      elif arg_4:
        # pylint: disable=protected-access
        arg_6 = arg_3.message_type._concrete_class()
      else:
        arg_6 = arg_9(arg_2, arg_3.name).add()
    else:
      if arg_3.is_extension:
        arg_6 = arg_2.Extensions[arg_3]
      else:
        arg_6 = arg_9(arg_2, arg_3.name)
      arg_6.SetInParent()

    while not arg_1.TryConsume(arg_5):
      if arg_1.AtEnd():
        raise arg_1.ParseErrorPreviousToken('Expected "%s".' % (arg_5,))
      arg_0._MergeField(arg_1, arg_6)

    if arg_4:
      arg_7 = arg_3.message_type.fields_by_name['value'].cpp_type
      if arg_7 == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
        arg_8 = arg_9(arg_2, arg_3.name)[arg_6.key]
        arg_8.MergeFrom(arg_6.value)
      else:
        arg_9(arg_2, arg_3.name)[arg_6.key] = arg_6.value

Merges a single scalar field into a message .


def Func(arg_0):
    """
    Change the default configuration.
    """
    arg_1, arg_2 = read_latoolscfg()

    if arg_0 not in arg_2.sections():
        raise ValueError("\n'{:s}' is not a defined configuration.".format(arg_0))

    if arg_0 == 'REPRODUCE':
        arg_3 = ('Are you SURE you want to set REPRODUCE as your default configuration?\n' +
                '     ... this is an odd thing to be doing.')
    else:
        arg_3 = ('Are you sure you want to change the default configuration from {:s}'.format(arg_2['DEFAULT']['config']) +
                'to {:s}?'.format(arg_0))

    arg_4 = input(arg_3 + '\n> [N/y]: ')

    if arg_4.lower() == 'y':
        arg_2.set('DEFAULT', 'config', arg_0)
        with open(arg_1, 'w') as f:
            arg_2.write(f)
        print('  Default changed!')
    else:
        print('  Done nothing.')


(times, mags, errs,
                  fsv, fdv, fkv, xcc, ycc, bgv, bge, iha, izd,
                  magsarefluxes=False,
                  epdsmooth_sigclip=3.0,
                  epdsmooth_windowsize=21,
                  epdsmooth_func=smooth_magseries_savgol,
                  epdsmooth_extraparams=None)

def Func(arg_0, arg_1, arg_2,
                  arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9, arg_10, arg_11,
                  arg_12=False,
                  arg_13=3.0,
                  arg_14=21,
                  arg_15=arg_16,
                  arg_17=None):
    '''Detrends a magnitude series using External Parameter Decorrelation.

    Requires a set of external parameters similar to those present in HAT light
    curves. At the moment, the HAT light-curve-specific external parameters are:

    - S: the 'fsv' column in light curves,
    - D: the 'fdv' column in light curves,
    - K: the 'fkv' column in light curves,
    - x coords: the 'xcc' column in light curves,
    - y coords: the 'ycc' column in light curves,
    - background value: the 'bgv' column in light curves,
    - background error: the 'bge' column in light curves,
    - hour angle: the 'iha' column in light curves,
    - zenith distance: the 'izd' column in light curves

    S, D, and K are defined as follows:

    - S -> measure of PSF sharpness (~1/sigma^2 sosmaller S = wider PSF)
    - D -> measure of PSF ellipticity in xy direction
    - K -> measure of PSF ellipticity in cross direction

    S, D, K are related to the PSF's variance and covariance, see eqn 30-33 in
    A. Pal's thesis: https://arxiv.org/abs/0906.3486

    NOTE: The errs are completely ignored and returned unchanged (except for
    sigclip and finite filtering).

    Parameters
    ----------

    times,mags,errs : np.array
        The input mag/flux time-series to detrend.

    fsv : np.array
        Array containing the external parameter `S` of the same length as times.

    fdv : np.array
        Array containing the external parameter `D` of the same length as times.

    fkv : np.array
        Array containing the external parameter `K` of the same length as times.

    xcc : np.array
        Array containing the external parameter `x-coords` of the same length as
        times.

    ycc : np.array
        Array containing the external parameter `y-coords` of the same length as
        times.

    bgv : np.array
        Array containing the external parameter `background value` of the same
        length as times.

    bge : np.array
        Array containing the external parameter `background error` of the same
        length as times.

    iha : np.array
        Array containing the external parameter `hour angle` of the same length
        as times.

    izd : np.array
        Array containing the external parameter `zenith distance` of the same
        length as times.

    magsarefluxes : bool
        Set this to True if `mags` actually contains fluxes.

    epdsmooth_sigclip : float or int or sequence of two floats/ints or None
        This specifies how to sigma-clip the input LC before fitting the EPD
        function to it.

        If a single float or int, a symmetric sigma-clip will be performed using
        the number provided as the sigma-multiplier to cut out from the input
        time-series.

        If a list of two ints/floats is provided, the function will perform an
        'asymmetric' sigma-clip. The first element in this list is the sigma
        value to use for fainter flux/mag values; the second element in this
        list is the sigma value to use for brighter flux/mag values. For
        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma
        dimmings and greater than 3-sigma brightenings. Here the meaning of
        "dimming" and "brightening" is set by *physics* (not the magnitude
        system), which is why the `magsarefluxes` kwarg must be correctly set.

        If `sigclip` is None, no sigma-clipping will be performed, and the
        time-series (with non-finite elems removed) will be passed through to
        the output.

    epdsmooth_windowsize : int
        This is the number of LC points to smooth over to generate a smoothed
        light curve that will be used to fit the EPD function.

    epdsmooth_func : Python function
        This sets the smoothing filter function to use. A Savitsky-Golay filter
        is used to smooth the light curve by default. The functions that can be
        used with this kwarg are listed in `varbase.trends`. If you want to use
        your own function, it MUST have the following signature::

                def smoothfunc(mags_array, window_size, **extraparams)

        and return a numpy array of the same size as `mags_array` with the
        smoothed time-series. Any extra params can be provided using the
        `extraparams` dict.

    epdsmooth_extraparams : dict
        This is a dict of any extra filter params to supply to the smoothing
        function.

    Returns
    -------

    dict
        Returns a dict of the following form::

            {'times':the input times after non-finite elems removed,
             'mags':the EPD detrended mag values (the EPD mags),
             'errs':the errs after non-finite elems removed,
             'fitcoeffs':EPD fit coefficient values,
             'fitinfo':the full tuple returned by scipy.leastsq,
             'fitmags':the EPD fit function evaluated at times,
             'mags_median': this is median of the EPD mags,
             'mags_mad': this is the MAD of EPD mags}

    '''

    arg_18 = np.isfinite(arg_0) & np.isfinite(arg_1) & np.isfinite(arg_2)
    arg_19, arg_20, arg_21 = arg_0[::][arg_18], arg_1[::][arg_18], arg_2[::][arg_18]
    arg_22, arg_23, arg_24, arg_25, arg_26, arg_27, arg_28, arg_29, arg_30 = (
        arg_3[::][arg_18],
        arg_4[::][arg_18],
        arg_5[::][arg_18],
        arg_6[::][arg_18],
        arg_7[::][arg_18],
        arg_8[::][arg_18],
        arg_9[::][arg_18],
        arg_10[::][arg_18],
        arg_11[::][arg_18],
    )

    arg_31, arg_32, arg_33, arg_34 = sigclip_magseries_with_extparams(
        arg_0, arg_1, arg_2,
        [arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9, arg_10, arg_11],
        sigclip=arg_13,
        arg_12=arg_12
    )
    arg_35, arg_36, arg_37, arg_38, arg_39, arg_40, arg_41, arg_42, arg_43 = arg_34

    # smooth the signal
    if isinstance(arg_17, dict):
        arg_44 = arg_15(arg_32,
                                      arg_14,
                                      **arg_17)
    else:
        arg_44 = arg_15(arg_32, arg_14)

    # initial fit coeffs
    arg_45 = np.zeros(22)

    # fit the smoothed mags and find the EPD function coefficients
    arg_46 = leastsq(_epd_residual,
                         arg_45,
                         args=(arg_44,
                               arg_35, arg_36, arg_37, arg_38,
                               arg_39, arg_40, arg_41, arg_42, arg_43),
                         full_output=True)

    # if the fit succeeds, then get the EPD mags
    if arg_46[-1] in (1,2,3,4):

        arg_47 = arg_46[0]
        arg_48 = _epd_function(arg_47,
                               arg_22, arg_23, arg_24, arg_25, arg_26,
                               arg_27, arg_28, arg_29, arg_30)

        arg_49 = npmedian(arg_20) + arg_20 - arg_48

        arg_50 = {'times':arg_19,
                   'mags':arg_49,
                   'errs':arg_21,
                   'fitcoeffs':arg_47,
                   'fitinfo':arg_46,
                   'fitmags':arg_48,
                   'mags_median':npmedian(arg_49),
                   'mags_mad':npmedian(npabs(arg_49 - npmedian(arg_49)))}

        return arg_50

    # if the solution fails, return nothing
    else:

        LOGERROR('EPD fit did not converge')
        return None

Detrends a magnitude series using External Parameter Decorrelation .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : save_file ( arg_1 , arg_0 . user_id , arg_3 , to_b64 ( arg_2 [ 'content' ] , arg_2 . get ( 'format' , None ) ) , arg_0 . crypto . encrypt , arg_0 . max_file_size_bytes , ) return None

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Save a non-notebook file.
        """
        save_file(
            arg_1,
            arg_0.user_id,
            arg_3,
            to_b64(arg_2['content'], arg_2.get('format', None)),
            arg_0.crypto.encrypt,
            arg_0.max_file_size_bytes,
        )
        return None


def
Func
(
arg_0
,
arg_1
)
:
if
not
isinstance
(
arg_1
,
MucItemBase
)
:
raise
TypeError
(
"Bad item type for muc#user"
)
arg_1
.
as_xml
(
arg_0
.
xmlnode
)

def Func(arg_0,arg_1):
        """Add an item to `self`.

        :Parameters:
            - `item`: the item to add.
        :Types:
            - `item`: `MucItemBase`
        """
        if not isinstance(arg_1,MucItemBase):
            raise TypeError("Bad item type for muc#user")
        arg_1.as_xml(arg_0.xmlnode)


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
LOG
.
info
(
"Running scout view Func"
)
arg_3
=
arg_0
.
obj
[
'adapter'
]
if
arg_1
:
arg_1
=
arg_1
.
upper
(
)
if
not
arg_1
.
startswith
(
'HP:'
)
:
while
len
(
arg_1
)
<
7
:
arg_1
=
'0'
+
arg_1
arg_1
=
'HP:'
+
arg_1
LOG
.
info
(
"Searching for term %s"
,
arg_1
)
arg_4
=
arg_3
.
Func_terms
(
Func_term
=
arg_1
)
elif
arg_2
:
arg_5
=
sorted
(
arg_3
.
Func_terms
(
query
=
arg_2
)
,
key
=
itemgetter
(
'Func_number'
)
)
for
arg_1
in
arg_5
:
arg_1
.
pop
(
'genes'
)
print
(
"name: {} | {} | {}"
.
format
(
arg_1
[
'_id'
]
,
arg_1
[
'description'
]
,
arg_1
[
'Func_number'
]
)
)
arg_0
.
abort
(
)
else
:
arg_4
=
arg_3
.
Func_terms
(
)
if
arg_4
.
count
(
)
==
0
:
LOG
.
warning
(
"No matching terms found"
)
return
click
.
echo
(
"Func_id\tdescription\tnr_genes"
)
for
arg_6
in
arg_4
:
click
.
echo
(
"{0}\t{1}\t{2}"
.
format
(
arg_6
[
'Func_id'
]
,
arg_6
[
'description'
]
,
len
(
arg_6
.
get
(
'genes'
,
[
]
)
)
)
)

def Func(arg_0, arg_1, arg_2):
    """Show all Func terms in the database"""
    LOG.info("Running scout view Func")
    arg_3 = arg_0.obj['adapter']
    if arg_1:
        arg_1 = arg_1.upper()
        if not arg_1.startswith('HP:'):
            while len(arg_1) < 7:
                arg_1 = '0' + arg_1
            arg_1 = 'HP:' + arg_1
        LOG.info("Searching for term %s", arg_1)
        arg_4 = arg_3.Func_terms(Func_term=arg_1)
    elif arg_2:
        arg_5 = sorted(arg_3.Func_terms(query=arg_2), key=itemgetter('Func_number'))
        for arg_1 in arg_5:
            arg_1.pop('genes')
            print("name: {} | {} | {}".format(arg_1['_id'], arg_1['description'], arg_1['Func_number']))
        # pp(Func_terms)
        arg_0.abort()
    else:
        arg_4 = arg_3.Func_terms()
    if arg_4.count() == 0:
        LOG.warning("No matching terms found")
        return

    click.echo("Func_id\tdescription\tnr_genes")
    for arg_6 in arg_4:
        click.echo("{0}\t{1}\t{2}".format(
            arg_6['Func_id'],
            arg_6['description'],
            len(arg_6.get('genes',[]))
        ))


def Func ( arg_0 , arg_1 ) : arg_2 = True try : arg_0 . sftp_client . lstat ( arg_1 ) except FileNotFoundError : arg_2 = False return arg_2

def Func(arg_0, arg_1):
        """Return true if the path refers to an existing directory.

        Parameters
        ----------
        path : str
            Path of directory on the remote side to check.
        """
        arg_2 = True
        try:
            arg_0.sftp_client.lstat(arg_1)
        except FileNotFoundError:
            arg_2 = False

        return arg_2

Return true if the path refers to an existing directory .


def Func(arg_0, arg_1):
    """Download file from Google Drive.

    See ``tl.files.load_celebA_dataset`` for example.

    Parameters
    --------------
    ID : str
        The driver ID.
    destination : str
        The destination for save file.

    """

    def save_response_content(arg_2, arg_1, arg_3=32 * 1024):
        arg_4 = int(arg_2.headers.get('content-length', 0))
        with open(arg_1, "wb") as f:
            for arg_5 in tqdm(arg_2.iter_content(arg_3), total=arg_4, unit='B', unit_scale=True,
                              desc=arg_1):
                if arg_5:  # filter out keep-alive new chunks
                    f.write(arg_5)

    def get_confirm_token(arg_2):
        for arg_6, arg_7 in arg_2.cookies.items():
            if arg_6.startswith('download_warning'):
                return arg_7
        return None

    arg_8 = "https://docs.google.com/uc?export=download"
    arg_9 = requests.Session()

    arg_2 = arg_9.get(arg_8, arg_11={'id': arg_0}, stream=True)
    arg_10 = get_confirm_token(arg_2)

    if arg_10:
        arg_11 = {'id': arg_0, 'confirm': arg_10}
        arg_2 = arg_9.get(arg_8, arg_11=arg_11, stream=True)
    save_response_content(arg_2, arg_1)


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_1
.
split_contents
(
)
if
len
(
arg_2
)
>
1
:
raise
TemplateSyntaxError
(
"'%s' takes no arguments"
%
arg_2
[
0
]
)
return
SpringMetricsNode
(
)

def Func(arg_0, arg_1):
    """
    Spring Metrics tracking template tag.

    Renders Javascript code to track page visits.  You must supply
    your Spring Metrics Tracking ID in the
    ``SPRING_METRICS_TRACKING_ID`` setting.
    """
    arg_2 = arg_1.split_contents()
    if len(arg_2) > 1:
        raise TemplateSyntaxError("'%s' takes no arguments" % arg_2[0])
    return SpringMetricsNode()


return trolly.member.Member(
            trello_client=self,
            member_id=member_json['id'],
            name=member_json['fullName'],
            data=member_json,
        )

def Func ( arg_0 , arg_1 ) : return trolly . member . Member ( trello_client = arg_0 , member_id = arg_1 [ 'id' ] , name = arg_1 [ 'fullName' ] , data = arg_1 , )

def Func(arg_0, arg_1):
        '''
        Create a Member object from JSON object

        Returns:
            Member: The member from the given `member_json`.
        '''
        return trolly.member.Member(
            trello_client=arg_0,
            member_id=arg_1['id'],
            name=arg_1['fullName'],
            data=arg_1,
        )


def Func ( arg_0 ) : arg_1 = arg_0 . queue try : arg_2 = arg_1 . get ( block = True , timeout = 5 ) return arg_2 except Exception : return None

def Func(arg_0):
        """Get a single item from the queue."""
        arg_1 = arg_0.queue
        try:
            arg_2 = arg_1.get(block=True, timeout=5)
            return arg_2
        except Exception:
            return None


def Func(arg_0, arg_1=None):
        """Validates SSH public key.

        Throws exception for invalid keys. Otherwise returns None.

        Populates key_type, bits and bits fields.

        For rsa keys, see field "rsa" for raw public key data.
        For dsa keys, see field "dsa".
        For ecdsa keys, see field "ecdsa"."""
        if arg_1 is None:
            if arg_0.keydata is None:
                raise ValueError("Key data must be supplied either in constructor or to Func()")
            arg_1 = arg_0.keydata
        else:
            arg_0.reset()
            arg_0.keydata = arg_1

        if arg_1.startswith("---- BEGIN SSH2 PUBLIC KEY ----"):
            # SSH2 key format
            arg_2 = None  # There is no redundant key-type field - skip comparing plain-text and encoded data.
            arg_3 = "".join([line for line in arg_1.split("\n") if ":" not in line and "----" not in line])
        else:
            arg_4 = arg_0._split_key(arg_1)
            arg_2 = arg_4[0]
            arg_3 = arg_4[1]

        arg_0._decoded_key = arg_0.decode_key(arg_3)

        # Check key type
        arg_6, arg_7 = arg_0._unpack_by_int(arg_0._decoded_key, 0)
        if arg_2 is not None and arg_2 != arg_7.decode():
            raise InvalidTypeError("Keytype mismatch: %s != %s" % (arg_2, arg_7))

        arg_0.key_type = arg_7

        arg_8 = arg_0._process_key(arg_0._decoded_key[arg_6:])
        arg_6 = arg_6 + arg_8

        if arg_6 != len(arg_0._decoded_key):
            raise MalformedDataError("Leftover data: %s bytes" % (len(arg_0._decoded_key) - arg_6))

        if arg_0.disallow_options and arg_0.options:
            raise InvalidOptionsError("Options are disallowed.")


def Func(arg_0, arg_1, arg_2, arg_3):
        """Same as `connect`, but assumes `lock` acquired.
        """
        arg_0._dst_name = arg_1
        arg_0._dst_port = arg_2
        arg_6 = None
        try:
            arg_7 = socket.getaddrinfo(arg_1, arg_2, socket.AF_UNSPEC,
                                socket.SOCK_STREAM, 0, socket.AI_NUMERICHOST)
            arg_6 = arg_7[0][0]
            arg_8 = arg_7[0][4]
        except socket.gaierror:
            arg_6 = None
            arg_8 = None

        if arg_6 is not None:
            if not arg_2:
                raise ValueError("No port number given with literal IP address")
            arg_0._dst_service = None
            arg_0._family = arg_6
            arg_0._dst_addrs = [(arg_6, arg_8)]
            arg_0._set_state("connect")
        elif arg_3 is not None:
            arg_0._dst_service = arg_3
            arg_0._set_state("resolve-srv")
            arg_0._dst_name = arg_1
        elif arg_2:
            arg_0._dst_nameports = [(arg_0._dst_name, arg_0._dst_port)]
            arg_0._dst_service = None
            arg_0._set_state("resolve-hostname")
        else:
            raise ValueError("No port number and no SRV service name given")

Same as connect but assumes lock acquired .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = serverFromString ( arg_1 , arg_2 ) return arg_3 . Func ( Site ( arg_0 . app . resource ( ) ) )

def Func(arg_0, arg_1, arg_2):
        """
        Run the server, i.e. start Funcing for requests on the given host and
        port.

        :param reactor: The ``IReactorTCP`` to use.
        :param endpoint_description:
            The Twisted description for the endpoint to Func on.
        :return:
            A deferred that returns an object that provides ``IListeningPort``.
        """
        arg_3 = serverFromString(arg_1, arg_2)
        return arg_3.Func(Site(arg_0.app.resource()))

Run the server, i.e. start listening for requests on the given host and
        port.

        :param reactor: The ``IReactorTCP`` to use.
        :param endpoint_description:
            The Twisted description for the endpoint to listen on.
        :return:
            A deferred that returns an object that provides ``IListeningPort``.

Run the server i . e . start listening for requests on the given host and port .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
""
with
open
(
arg_0
.
repfile
)
as
orep
:
arg_4
=
orep
.
readlines
(
)
for
arg_5
in
arg_4
:
if
"Estimated Ln Prob of Data"
in
arg_5
:
arg_0
.
est_lnlik
=
float
(
arg_5
.
split
(
)
[
1
]
)
if
"Mean value of ln likelihood"
in
arg_5
:
arg_0
.
mean_lnlik
=
float
(
arg_5
.
split
(
)
[
1
]
)
if
"Variance of ln likelihood"
in
arg_5
:
arg_0
.
var_lnlik
=
float
(
arg_5
.
split
(
)
[
1
]
)
if
"Mean value of alpha"
in
arg_5
:
arg_0
.
alpha
=
float
(
arg_5
.
split
(
)
[
1
]
)
arg_10
=
arg_1
.
search
(
arg_5
)
arg_11
=
arg_2
.
search
(
arg_5
)
if
arg_10
:
arg_12
=
arg_5
.
strip
(
)
.
split
(
)
arg_13
=
"{}{}{}"
.
format
(
" "
.
join
(
[
arg_12
[
0
]
,
arg_12
[
0
]
,
arg_12
[
2
]
,
arg_12
[
0
]
.
split
(
'.'
)
[
0
]
]
)
,
" :  "
,
" "
.
join
(
arg_12
[
4
:
]
)
)
arg_0
.
inds
+=
1
arg_3
+=
arg_13
+
"\n"
elif
arg_11
:
arg_12
=
arg_5
.
strip
(
)
.
split
(
)
arg_14
=
[
"0.000"
]
*
arg_0
.
kpop
arg_15
=
int
(
arg_12
[
3
]
)
1
arg_14
[
arg_15
]
=
"1.000"
arg_13
=
"{}{}{}"
.
format
(
" "
.
join
(
[
arg_12
[
0
]
,
arg_12
[
0
]
,
arg_12
[
2
]
,
arg_12
[
0
]
.
split
(
'.'
)
[
0
]
]
)
,
" :  "
,
" "
.
join
(
arg_14
)
)
arg_0
.
inds
+=
1
arg_3
+=
arg_13
+
"\n"
arg_3
+=
"\n"
return
arg_3

def Func(arg_0, arg_1, arg_2):
        """ Func an _f structure output file """
        arg_3 = ""
        with open(arg_0.repfile) as orep:
            arg_4 = orep.readlines()
            for arg_5 in arg_4:
                ## stat lines
                if "Estimated Ln Prob of Data" in arg_5:
                    arg_0.est_lnlik = float(arg_5.split()[-1])
                if "Mean value of ln likelihood" in arg_5:
                    arg_0.mean_lnlik = float(arg_5.split()[-1])
                if "Variance of ln likelihood" in arg_5:
                    arg_0.var_lnlik = float(arg_5.split()[-1])
                if "Mean value of alpha" in arg_5:
                    arg_0.alpha = float(arg_5.split()[-1])

                ## matrix lines
                arg_10 = arg_1.search(arg_5)
                arg_11 = arg_2.search(arg_5)

                #if ")   :  " in line:
                if arg_10:
                    ## check if sample is supervised...
                    arg_12 = arg_5.strip().split()
                    arg_13 = "{}{}{}".format(
                        " ".join([arg_12[0], arg_12[0], arg_12[2],
                                  arg_12[0].split('.')[0]]),
                        " :  ",
                        " ".join(arg_12[4:])
                    )
                    arg_0.inds += 1
                    arg_3 += arg_13+"\n"

                elif arg_11:
                    ## check if sample is supervised...
                    arg_12 = arg_5.strip().split()
                    arg_14 = ["0.000"] * arg_0.kpop
                    arg_15 = int(arg_12[3]) - 1
                    arg_14[arg_15] = "1.000"
                    arg_13 = "{}{}{}".format(
                        " ".join([arg_12[0], arg_12[0], arg_12[2],
                                  arg_12[0].split('.')[0]]),
                        " :  ",
                        " ".join(arg_14)
                    )
                    arg_0.inds += 1
                    arg_3 += arg_13+"\n"

            arg_3 += "\n"
        return arg_3


return [stoichiometry[element] for element in elements]

def Func ( arg_0 , arg_1 ) : arg_2 = parse_compound ( arg_0 . strip ( ) ) . count ( ) return [ arg_2 [ arg_3 ] for arg_3 in arg_1 ]

def Func(arg_0, arg_1):
    """
    Determine the stoichiometry coefficients of the specified elements in
    the specified chemical compound.

    :param compound: Formula of a chemical compound, e.g. 'SiO2'.
    :param elements: List of elements, e.g. ['Si', 'O', 'C'].

    :returns: List of stoichiometry coefficients.
    """

    arg_2 = parse_compound(arg_0.strip()).count()

    return [arg_2[arg_3] for arg_3 in arg_1]

Determine the stoichiometry coefficients of the specified elements in the specified chemical compound .


def Func(arg_0):
    """Check all necessary system requirements to exist.

    :param pre_requirements:
        Sequence of pre-requirements to check by running
        ``where <pre_requirement>`` on Windows and ``which ...`` elsewhere.
    """
    arg_0 = set(arg_0 or [])
    arg_0.add('virtualenv')

    for arg_1 in arg_0:
        if not which(arg_1):
            print_error('Requirement {0!r} is not found in system'.
                        format(arg_1))
            return False

    return True

Check all necessary system requirements to exist .


def
Func
(
arg_0
)
:
arg_1
=
h2o
.
api
(
"GET /3/GetGLMRegPath"
,
data
=
{
"model"
:
arg_0
.
_model_json
[
"model_id"
]
[
"name"
]
}
)
arg_2
=
arg_1
.
pop
(
"coefficient_names"
)
arg_3
=
{
"lambdas"
:
arg_1
[
"lambdas"
]
,
"explained_deviance_train"
:
arg_1
[
"explained_deviance_train"
]
,
"explained_deviance_valid"
:
arg_1
[
"explained_deviance_valid"
]
,
"coefficients"
:
[
dict
(
zip
(
arg_2
,
y
)
)
for
y
in
arg_1
[
"coefficients"
]
]
,
}
if
"coefficients_std"
in
arg_1
:
arg_3
[
"coefficients_std"
]
=
[
dict
(
zip
(
arg_2
,
y
)
)
for
y
in
arg_1
[
"coefficients_std"
]
]
return
arg_3

def Func(arg_0):
        """
        Extract full regularization path explored during lambda search from glm model.

        :param model: source lambda search model
        """
        arg_1 = h2o.api("GET /3/GetGLMRegPath", data={"model": arg_0._model_json["model_id"]["name"]})
        arg_2 = arg_1.pop("coefficient_names")
        arg_3 = {
            "lambdas": arg_1["lambdas"],
            "explained_deviance_train": arg_1["explained_deviance_train"],
            "explained_deviance_valid": arg_1["explained_deviance_valid"],
            "coefficients": [dict(zip(arg_2, y)) for y in arg_1["coefficients"]],
        }
        if "coefficients_std" in arg_1:
            arg_3["coefficients_std"] = [dict(zip(arg_2, y)) for y in arg_1["coefficients_std"]]
        return arg_3

Extract full regularization path explored during lambda search from glm model .


async
def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
_LOGGER
.
info
(
"Sending clear the alarm command."
)
while
len
(
arg_1
)
<
16
:
arg_1
+=
'F'
arg_3
=
bytearray
.
fromhex
(
arg_1
)
arg_4
=
generate_query
(
b'\x85'
+
arg_3
+
partition_bytes
(
arg_2
)
)
await
arg_0
.
_send_data
(
arg_4
)

async def Func(arg_0, arg_1, arg_2):
        """Send command to clear the alarm."""
        _LOGGER.info("Sending clear the alarm command.")
        while len(arg_1) < 16:
            arg_1 += 'F'

        arg_3 = bytearray.fromhex(arg_1)

        arg_4 = generate_query(b'\x85' + arg_3
                              + partition_bytes(arg_2))

        await arg_0._send_data(arg_4)


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = tf . data . Dataset . from_tensor_slices ( ( arg_0 , arg_1 ) ) arg_4 = arg_3 . repeat ( ) . batch ( arg_2 ) arg_5 = tf . compat . v1 . data . make_one_shot_iterator ( arg_4 ) arg_6 , arg_7 = arg_5 . get_next ( ) return arg_6 , arg_7

def Func(arg_0, arg_1, arg_2):
  """Build a Dataset iterator for supervised classification.

  Args:
    x: Numpy `array` of features, indexed by the first dimension.
    y: Numpy `array` of labels, with the same first dimension as `x`.
    batch_size: Number of elements in each training batch.

  Returns:
    batch_features: `Tensor` feed  features, of shape
      `[batch_size] + x.shape[1:]`.
    batch_labels: `Tensor` feed of labels, of shape
      `[batch_size] + y.shape[1:]`.
  """
  arg_3 = tf.data.Dataset.from_tensor_slices((arg_0, arg_1))
  arg_4 = arg_3.repeat().batch(arg_2)
  arg_5 = tf.compat.v1.data.make_one_shot_iterator(arg_4)
  arg_6, arg_7 = arg_5.get_next()
  return arg_6, arg_7

Build a Dataset iterator for supervised classification .


def Func(arg_0):
    """Initiate the local catalog and push it the cloud"""

    (arg_1, arg_2) = (arg_0.local_catalog, arg_0.cloud_catalog)
    logging.info("[init-push-to-cloud]: %s => %s"%(arg_1, arg_2))

    if not isfile(arg_1):
        arg_0.error("[init-push-to-cloud] The local catalog does not exist: %s"%arg_1)
    if isfile(arg_2):
        arg_0.error("[init-push-to-cloud] The cloud catalog already exist: %s"%arg_2)

    (arg_3, arg_4) = ("%s.lrcloud"%arg_1, "%s.lrcloud"%arg_2)
    if isfile(arg_3):
        arg_0.error("[init-push-to-cloud] The local meta-data already exist: %s"%arg_3)
    if isfile(arg_4):
        arg_0.error("[init-push-to-cloud] The cloud meta-data already exist: %s"%arg_4)

    #Let's "lock" the local catalog
    logging.info("Locking local catalog: %s"%(arg_1))
    if not lock_file(arg_1):
        raise RuntimeError("The catalog %s is locked!"%arg_1)

    #Copy catalog from local to cloud, which becomes the new "base" changeset
    util.copy(arg_1, arg_2)

    # Write meta-data both to local and cloud
    arg_5 = MetaFile(arg_3)
    arg_6 = datetime.utcnow().strftime(DATETIME_FORMAT)[:-4]
    arg_5['catalog']['hash'] = hashsum(arg_1)
    arg_5['catalog']['modification_utc'] = arg_6
    arg_5['catalog']['filename'] = arg_1
    arg_5['last_push']['filename'] = arg_2
    arg_5['last_push']['hash'] = hashsum(arg_1)
    arg_5['last_push']['modification_utc'] = arg_6
    arg_5.flush()
    arg_5 = MetaFile(arg_4)
    arg_5['changeset']['is_base'] = True
    arg_5['changeset']['hash'] = hashsum(arg_1)
    arg_5['changeset']['modification_utc'] = arg_6
    arg_5['changeset']['filename'] = basename(arg_2)
    arg_5.flush()

    #Let's copy Smart Previews
    if not arg_0.no_smart_previews:
        copy_smart_previews(arg_1, arg_2, local2cloud=True)

    #Finally,let's unlock the catalog files
    logging.info("Unlocking local catalog: %s"%(arg_1))
    unlock_file(arg_1)

    logging.info("[init-push-to-cloud]: Success!")