def
Func
(
arg_0
)
:
if
arg_0
.
src
.
upper
(
)
in
BANNED_DEVICES
:
arg_1
=
''
elif
arg_0
.
src
.
upper
(
)
[
:
8
]
in
AMAZON_DEVICES
:
arg_1
=
'{} (Amazon Device)'
.
format
(
arg_0
.
src
)
else
:
arg_1
=
arg_0
.
src
return
arg_1

def Func(arg_0):
    """Return source mac address for this Scapy Packet

    :param scapy.packet.Packet pkt: Scapy Packet
    :return: Mac address. Include (Amazon Device) for these devices
    :rtype: str
    """
    if arg_0.src.upper() in BANNED_DEVICES:
        arg_1 = ''
    elif arg_0.src.upper()[:8] in AMAZON_DEVICES:
        arg_1 = '{} (Amazon Device)'.format(arg_0.src)
    else:
        arg_1 = arg_0.src
    return arg_1


def Func ( arg_0 , arg_1 ) : arg_0 . _lock . acquire ( ) try : arg_0 . _fetcher = arg_1 finally : arg_0 . _lock . release ( )

def Func(arg_0, arg_1):
        """Set the fetcher class.

        :Parameters:
            - `fetcher_class`: the fetcher class.
        :Types:
            - `fetcher_class`: `CacheFetcher` based class
        """
        arg_0._lock.acquire()
        try:
            arg_0._fetcher = arg_1
        finally:
            arg_0._lock.release()


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_0 . config . get ( 'LDAP_BIND_DIRECT_CREDENTIALS' ) : arg_3 = arg_0 . Func_direct_credentials ( arg_1 , arg_2 ) elif not arg_0 . config . get ( 'LDAP_ALWAYS_SEARCH_BIND' ) and arg_0 . config . get ( 'LDAP_USER_RDN_ATTR' ) == arg_0 . config . get ( 'LDAP_USER_LOGIN_ATTR' ) : arg_3 = arg_0 . Func_direct_bind ( arg_1 , arg_2 ) else : arg_3 = arg_0 . Func_search_bind ( arg_1 , arg_2 ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """
        An abstracted authentication method. Decides whether to perform a
        direct bind or a search bind based upon the login attribute configured
        in the config.

        Args:
            username (str): Username of the user to bind
            password (str): User's password to bind with.

        Returns:
            AuthenticationResponse

        """
        if arg_0.config.get('LDAP_BIND_DIRECT_CREDENTIALS'):
            arg_3 = arg_0.Func_direct_credentials(arg_1, arg_2)

        elif not arg_0.config.get('LDAP_ALWAYS_SEARCH_BIND') and \
                arg_0.config.get('LDAP_USER_RDN_ATTR') == \
                arg_0.config.get('LDAP_USER_LOGIN_ATTR'):
            # Since the user's RDN is the same as the login field,
            # we can do a direct bind.
            arg_3 = arg_0.Func_direct_bind(arg_1, arg_2)
        else:
            # We need to search the User's DN to find who the user is (and
            # their DN) so we can try bind with their password.
            arg_3 = arg_0.Func_search_bind(arg_1, arg_2)

        return arg_3

An abstracted authentication method . Decides whether to perform a direct bind or a search bind based upon the login attribute configured in the config .


def Func ( arg_0 ) : arg_1 = arg_0 . matchdict [ 'uuid' ] arg_2 = arg_0 . json with db_connect ( ) as db_conn : with db_conn . cursor ( ) as cursor : remove_role_requests ( cursor , arg_1 , arg_2 ) arg_3 = arg_0 . response arg_3 . status_int = 200 return arg_3

def Func(arg_0):
    """Submission to remove a role acceptance request."""
    arg_1 = arg_0.matchdict['uuid']

    arg_2 = arg_0.json
    with db_connect() as db_conn:
        with db_conn.cursor() as cursor:
            remove_role_requests(cursor, arg_1, arg_2)

    arg_3 = arg_0.response
    arg_3.status_int = 200
    return arg_3

Submission to remove a role acceptance request .


def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
_ns_prefix
+
"error"
for
arg_2
in
arg_0
.
_element
:
if
arg_2
.
tag
==
arg_1
:
arg_0
.
_error
=
StanzaErrorElement
(
arg_2
)
return
raise
BadRequestProtocolError
(
"Error element missing in"
" an error stanza"
)

def Func(arg_0):
        """Decode error element of the stanza."""
        arg_1 = arg_0._ns_prefix + "error"
        for arg_2 in arg_0._element:
            if arg_2.tag == arg_1:
                arg_0._error = StanzaErrorElement(arg_2)
                return
        raise BadRequestProtocolError("Error element missing in"
                                                            " an error stanza")


def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
)
:
if
arg_2
is
not
:
arg_3
=
arg_0
.
make_subset
(
arg_2
)
arg_2
=
arg_0
.
_get_samples
(
arg_3
)
arg_4
=
arg_0
.
classifiers
[
arg_1
]
arg_5
=
arg_4
.
classifier
.
ulabels_
with
arg_0
.
pbar
.
set
(
total
=
len
(
arg_2
)
,
desc
=
'Applying '
+
arg_1
+
' classifier'
)
as
prog
:
for
arg_6
in
arg_2
:
arg_7
=
arg_0
.
data
[
arg_6
]
try
:
arg_8
=
arg_4
.
predict
(
arg_7
.
focus
)
except
ValueError
:
arg_8
=
np
.
array
(
[
2
]
*
len
(
arg_7
.
Time
)
)
for
arg_9
in
arg_5
:
arg_10
=
arg_8
==
arg_9
arg_7
.
filt
.
add
(
arg_1
=
arg_1
+
'_{:.0f}'
.
format
(
arg_9
)
,
filt
=
arg_10
,
info
=
arg_1
+
' '
+
arg_4
.
method
+
' classifier'
,
params
=
(
arg_4
.
analytes
,
arg_4
.
method
)
)
prog
.
update
(
)
return
arg_1

def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """
        Apply a clustering classifier based on all samples, or a subset.

        Parameters
        ----------
        name : str
            The name of the classifier to apply.
        subset : str
            The subset of samples to apply the classifier to.
        Returns
        -------
        name : str
        """
        if arg_2 is not None:
            arg_3 = arg_0.make_subset(arg_2)

        arg_2 = arg_0._get_samples(arg_3)

        arg_4 = arg_0.classifiers[arg_1]
        arg_5 = arg_4.classifier.ulabels_

        with arg_0.pbar.set(total=len(arg_2), desc='Applying ' + arg_1 + ' classifier') as prog:
            for arg_6 in arg_2:
                arg_7 = arg_0.data[arg_6]
                try:
                    arg_8 = arg_4.predict(arg_7.focus)
                except ValueError:
                    # in case there's no data
                    arg_8 = np.array([-2] * len(arg_7.Time))
                for arg_9 in arg_5:
                    arg_10 = arg_8 == arg_9
                    arg_7.filt.add(arg_1=arg_1 + '_{:.0f}'.format(arg_9),
                            filt=arg_10,
                            info=arg_1 + ' ' + arg_4.method + ' classifier',
                            params=(arg_4.analytes, arg_4.method))
                prog.update()

        return arg_1

Apply a clustering classifier based on all samples or a subset .


def
Func
(
arg_0
)
:
from
pkg_resources
import
iter_entry_points
arg_1
=
{
}
for
arg_2
,
arg_3
in
arg_0
.
entry_points
:
for
arg_4
in
iter_entry_points
(
arg_2
)
:
if
arg_4
.
name
in
arg_1
:
continue
arg_1
[
arg_4
.
name
]
=
True
log
.
debug
(
'%s load plugin %s'
,
arg_0
.
__class__
.
__name__
,
arg_4
)
try
:
arg_6
=
arg_4
.
load
(
)
except
KeyboardInterrupt
:
raise
except
Exception
,
e
:
warn
(
"Unable to load plugin %s: %s"
%
(
arg_4
,
e
)
,
RuntimeWarning
)
continue
if
arg_3
:
arg_7
=
arg_3
(
arg_6
(
)
)
else
:
arg_7
=
arg_6
(
)
arg_0
.
addPlugin
(
arg_7
)
super
(
EntryPointPluginManager
,
arg_0
)
.
Func
(
)

def Func(arg_0):
        """Load plugins by iterating the `nose.plugins` entry point.
        """
        from pkg_resources import iter_entry_points
        arg_1 = {}
        for arg_2, arg_3 in arg_0.entry_points:
            for arg_4 in iter_entry_points(arg_2):
                if arg_4.name in arg_1:
                    continue
                arg_1[arg_4.name] = True
                log.debug('%s load plugin %s', arg_0.__class__.__name__, arg_4)
                try:
                    arg_6 = arg_4.load()
                except KeyboardInterrupt:
                    raise
                except Exception, e:
                    # never want a plugin load to kill the test run
                    # but we can't log here because the logger is not yet
                    # configured
                    warn("Unable to load plugin %s: %s" % (arg_4, e),
                         RuntimeWarning)
                    continue
                if arg_3:
                    arg_7 = arg_3(arg_6())
                else:
                    arg_7 = arg_6()
                arg_0.addPlugin(arg_7)
        super(EntryPointPluginManager, arg_0).Func()

Load plugins by iterating the nose . plugins entry point .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = arg_0 . get_conn ( ) . instances ( ) . delete ( project = arg_2 , arg_1 = arg_1 , ) . execute ( num_retries = arg_0 . num_retries ) arg_4 = arg_3 [ "name" ] arg_0 . _wait_for_operation_to_complete ( arg_2 = arg_2 , arg_4 = arg_4 )

def Func(arg_0, arg_1, arg_2=None):
        """
        Deletes a Cloud SQL instance.

        :param project_id: Project ID of the project that contains the instance. If set
            to None or missing, the default project_id from the GCP connection is used.
        :type project_id: str
        :param instance: Cloud SQL instance ID. This does not include the project ID.
        :type instance: str
        :return: None
        """
        arg_3 = arg_0.get_conn().instances().delete(
            project=arg_2,
            arg_1=arg_1,
        ).execute(num_retries=arg_0.num_retries)
        arg_4 = arg_3["name"]
        arg_0._wait_for_operation_to_complete(arg_2=arg_2,
                                             arg_4=arg_4)


(self, traj_group, store_data=pypetconstants.STORE_DATA,
                         with_links=True, recursive=False, max_depth=None,
                         _hdf5_group=None, _newly_created=False)

def Func(arg_0, arg_1, arg_2=arg_3.STORE_DATA,
                         arg_5=True, arg_6=False, arg_7=None,
                         arg_8=None, arg_9=False):
        """Stores a group node.

        For group nodes only annotations and comments need to be stored.

        """
        if arg_2 == arg_3.STORE_NOTHING:
            return
        elif arg_2 == arg_3.STORE_DATA_SKIPPING and arg_1._stored:
            arg_0._logger.debug('Already found `%s` on disk I will not store it!' %
                                   arg_1.v_full_name)
        elif not arg_6:
            if arg_8 is None:
                arg_8, arg_9 = arg_0._all_create_or_get_groups(arg_1.v_full_name)

            arg_10 = arg_2 == arg_3.OVERWRITE_DATA

            if (arg_1.v_comment != '' and
                    (HDF5StorageService.COMMENT not in arg_8._v_attrs or arg_10)):
                setattr(arg_8._v_attrs, HDF5StorageService.COMMENT, arg_1.v_comment)

            if ((arg_9 or arg_10) and
                type(arg_1) not in (nn.NNGroupNode, nn.ConfigGroup, nn.ParameterGroup,
                                             nn.DerivedParameterGroup, nn.ResultGroup)):
                # We only store the name of the class if it is not one of the standard groups,
                # that are always used.
                setattr(arg_8._v_attrs, HDF5StorageService.CLASS_NAME,
                        arg_1.f_get_class_name())

            arg_0._ann_store_annotations(arg_1, arg_8, arg_10=arg_10)
            arg_0._hdf5file.flush()
            arg_1._stored = True

            # Signal completed node loading
            arg_0._node_processing_timer.signal_update()

        if arg_6:
            arg_12 = arg_1.f_get_parent()
            arg_13 = arg_0._all_create_or_get_groups(arg_12.v_full_name)[0]

            arg_0._tree_store_nodes_dfs(arg_12, arg_1.v_name, arg_2=arg_2,
                                       arg_5=arg_5, arg_6=arg_6,
                                       arg_7=arg_7, current_depth=0,
                                       arg_13=arg_13)


(self, data, session=None, instance=None, transient=False, *args, **kwargs)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
,
arg_4
=
False
,
*
arg_5
,
**
arg_6
)
:
arg_0
.
_session
=
arg_2
or
arg_0
.
_session
arg_0
.
_transient
=
arg_4
or
arg_0
.
_transient
if
not
(
arg_0
.
transient
or
arg_0
.
session
)
:
raise
ValueError
(
"Deserialization requires a session"
)
arg_0
.
instance
=
arg_3
or
arg_0
.
instance
try
:
return
super
(
ModelSchema
,
arg_0
)
.
Func
(
arg_1
,
*
arg_5
,
**
arg_6
)
finally
:
arg_0
.
instance
=

def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False, *arg_5, **arg_6):
        """Deserialize data to internal representation.

        :param session: Optional SQLAlchemy session.
        :param instance: Optional existing instance to modify.
        :param transient: Optional switch to allow transient instantiation.
        """
        arg_0._session = arg_2 or arg_0._session
        arg_0._transient = arg_4 or arg_0._transient
        if not (arg_0.transient or arg_0.session):
            raise ValueError("Deserialization requires a session")
        arg_0.instance = arg_3 or arg_0.instance
        try:
            return super(ModelSchema, arg_0).Func(arg_1, *arg_5, **arg_6)
        finally:
            arg_0.instance = None

Deserialize data to internal representation .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 = 60 ) : arg_0 . _halt_if_already_deleted ( ) arg_2 = locals ( ) del arg_2 [ 'self' ] return arg_0 . _add_record ( NSResourceRecordSet , ** arg_2 )

def Func(arg_0, arg_1, arg_2, arg_3=60):
        """
        Creates a NS record attached to this hosted zone.

        :param str name: The fully qualified name of the record to add.
        :param list values: A list of value strings for the record.
        :keyword int ttl: The time-to-live of the record (in seconds).
        :rtype: tuple
        :returns: A tuple in the form of ``(rrset, change_info)``, where
            ``rrset`` is the newly created NSResourceRecordSet instance.
        """

        arg_0._halt_if_already_deleted()

        # Grab the params/kwargs here for brevity's sake.
        arg_2 = locals()
        del arg_2['self']

        return arg_0._add_record(NSResourceRecordSet, **arg_2)

Creates a NS record attached to this hosted zone .


put text on on screen
    a tuple as first argument tells absolute position for the text
    does not change TermCursor position
    args = list of optional position, formatting tokens and strings

def Func ( arg_0 , * arg_1 ) : arg_2 = [ TermCursor . save , TermCursor . move ( * arg_0 ) , '' . join ( arg_1 ) , TermCursor . restore ] write ( '' . join ( arg_2 ) )

def Func(arg_0, *arg_1):
    """
    Func text on on screen
    a tuple as first argument tells absolute position for the text
    does not change TermCursor position
    args = list of optional position, formatting tokens and strings
    """
    arg_2 = [TermCursor.save, TermCursor.move(*arg_0), ''.join(arg_1), TermCursor.restore]
    write(''.join(arg_2))

put text on on screen a tuple as first argument tells absolute position for the text does not change TermCursor position args = list of optional position formatting tokens and strings


def Func(arg_0, arg_1, arg_2):
        """
        Bit test and complement.

        Selects the bit in a bit string (specified with the first operand, called
        the bit base) at the bit-position designated by the bit offset operand
        (second operand), stores the value of the bit in the CF flag, and complements
        the selected bit in the bit string.

        :param cpu: current CPU.
        :param dest: bit base operand.
        :param src: bit offset operand.
        """
        if arg_1.type == 'register':
            arg_3 = arg_1.read()
            arg_4 = arg_2.read() % arg_1.size
            arg_0.CF = arg_3 & (1 << arg_4) == 1 << arg_4
            arg_1.write(arg_3 ^ (1 << arg_4))
        elif arg_1.type == 'memory':
            arg_6, arg_4 = arg_0._getMemoryBit(arg_1, arg_2)
            arg_7, arg_8, arg_9 = arg_0.get_descriptor(arg_0.DS)
            arg_6 += arg_7
            arg_3 = arg_0.read_int(arg_6, 8)
            arg_0.CF = arg_3 & (1 << arg_4) == 1 << arg_4
            arg_3 = arg_3 ^ (1 << arg_4)
            arg_0.write_int(arg_6, arg_3, 8)
        else:
            raise NotImplementedError(f"Unknown operand for Func: {dest.type}")


async
def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
_LOGGER
.
info
(
"Sending Func command."
)
while
len
(
arg_1
)
<
16
:
arg_1
+=
'F'
arg_3
=
bytearray
.
fromhex
(
arg_1
)
arg_4
=
generate_query
(
b'\x84'
+
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 Func."""
        _LOGGER.info("Sending Func command.")
        while len(arg_1) < 16:
            arg_1 += 'F'

        arg_3 = bytearray.fromhex(arg_1)

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

        await arg_0._send_data(arg_4)


def Func(arg_0, arg_1, arg_2=True):
        """ Iterate over a grid of windows of a specified shape covering an image.

        The image is divided into a grid of tiles of size window_shape. Each iteration returns
        the next window.

        Args:
            window_shape (tuple): The desired shape of each image as (height,
                width) in pixels.
            pad: (bool): Whether or not to pad edge cells. If False, cells that do not
                have the desired shape will not be returned. Defaults to True.

        Yields:
            image: image object of same type.
        """
        arg_3, arg_4 = arg_1[0], arg_1[1]
        arg_5, arg_6, arg_7 = arg_0.shape
        arg_8, arg_9 = divmod(arg_6, arg_3)
        arg_10, arg_11 = divmod(arg_7, arg_4)

        arg_12 = arg_0
        if arg_2 is True:
            arg_13, arg_14 = arg_6, arg_7
            if arg_9 != 0:
                arg_13 = (arg_8 + 1) * arg_3
            if arg_11 != 0:
                arg_14 = (arg_10 + 1) * arg_4
            if (arg_13, arg_14) != (arg_6, arg_7):
                arg_15 = box(0, 0, arg_14, arg_13)
                arg_16 = ops.transform(arg_0.__geo_transform__.fwd, arg_15)
                arg_12 = arg_0[arg_16]

        arg_17 = range(0, arg_12.shape[1], arg_3)
        arg_18 = range(0, arg_12.shape[2], arg_4)
        for arg_19, arg_20 in product(arg_17, arg_18):
            arg_21 = arg_12[:, arg_19:(arg_19 + arg_3), arg_20:(arg_20 + arg_4)]
            if arg_2 is False:
                if arg_21.shape[1:] == arg_1:
                    yield arg_21
            else:
                yield arg_21

Iterate over a grid of windows of a specified shape covering an image .


def Func ( arg_0 , arg_1 ) : if not isinstance ( arg_1 , string_types ) or ( '.' not in arg_1 and not arg_1 . isdigit ( ) ) : return lambda x : arg_0 . getitem ( x , arg_1 ) arg_1 = arg_1 . split ( '.' ) def attrgetter ( arg_2 ) : for arg_3 in arg_1 : if arg_3 . isdigit ( ) : arg_3 = int ( arg_3 ) arg_2 = arg_0 . getitem ( arg_2 , arg_3 ) return arg_2 return attrgetter

def Func(arg_0, arg_1):
    """Returns a callable that looks up the given attribute from a
    passed object with the rules of the environment.  Dots are allowed
    to access attributes of attributes.  Integer parts in paths are
    looked up as integers.
    """
    if not isinstance(arg_1, string_types) \
       or ('.' not in arg_1 and not arg_1.isdigit()):
        return lambda x: arg_0.getitem(x, arg_1)
    arg_1 = arg_1.split('.')
    def attrgetter(arg_2):
        for arg_3 in arg_1:
            if arg_3.isdigit():
                arg_3 = int(arg_3)
            arg_2 = arg_0.getitem(arg_2, arg_3)
        return arg_2
    return attrgetter

Returns a callable that looks up the given attribute from a passed object with the rules of the environment . Dots are allowed to access attributes of attributes . Integer parts in paths are looked up as integers .


(self, fov: float = 75.0, near: float = 1.0, far: float = 100.0, aspect_ratio: float = None)

return matrix44.create_perspective_projection_matrix(
            fov,
            aspect_ratio or self.window.aspect_ratio,
            near,
            far,
            dtype='f4',
        )

def Func(arg_0, arg_1: arg_2 = 75.0, arg_3: arg_2 = 1.0, arg_4: arg_2 = 100.0, arg_5: arg_2 = None):
        """
        Create a projection matrix with the following parameters.
        When ``aspect_ratio`` is not provided the configured aspect
        ratio for the window will be used.

        Args:
            fov (float): Field of view (float)
            near (float): Camera near value
            far (float): Camrea far value

        Keyword Args:
            aspect_ratio (float): Aspect ratio of the viewport

        Returns:
            The projection matrix as a float32 :py:class:`numpy.array`
        """
        return matrix44.create_perspective_projection_matrix(
            arg_1,
            arg_5 or arg_0.window.aspect_ratio,
            arg_3,
            arg_4,
            dtype='f4',
        )

Create a projection matrix with the following parameters . When aspect_ratio is not provided the configured aspect ratio for the window will be used .


def Func ( arg_0 , arg_1 , arg_2 = True , ** arg_3 ) : from solvebio import Dataset from solvebio import DatasetMigration if isinstance ( arg_1 , Dataset ) : arg_4 = arg_1 . id else : arg_4 = arg_1 arg_5 = arg_3 . pop ( 'limit' , None ) if not arg_5 and arg_0 . _limit < float ( 'inf' ) : arg_5 = arg_0 . _limit arg_6 = arg_0 . _build_query ( arg_5 = arg_5 ) arg_6 . pop ( 'offset' , None ) arg_6 . pop ( 'ordering' , None ) arg_7 = DatasetMigration . create ( source_id = arg_0 . _dataset_id , arg_4 = arg_4 , source_params = arg_6 , client = arg_0 . _client , ** arg_3 ) if arg_2 : arg_7 . follow ( ) return arg_7

def Func(arg_0, arg_1, arg_2=True, **arg_3):
        """
        Migrate the data from the Query to a target dataset.

        Valid optional kwargs include:

        * target_fields
        * include_errors
        * validation_params
        * metadata
        * commit_mode

        """
        from solvebio import Dataset
        from solvebio import DatasetMigration

        # Target can be provided as a Dataset, or as an ID.
        if isinstance(arg_1, Dataset):
            arg_4 = arg_1.id
        else:
            arg_4 = arg_1

        # If a limit is set in the Query and not overridden here, use it.
        arg_5 = arg_3.pop('limit', None)
        if not arg_5 and arg_0._limit < float('inf'):
            arg_5 = arg_0._limit

        # Build the source_params
        arg_6 = arg_0._build_query(arg_5=arg_5)
        arg_6.pop('offset', None)
        arg_6.pop('ordering', None)

        arg_7 = DatasetMigration.create(
            source_id=arg_0._dataset_id,
            arg_4=arg_4,
            source_params=arg_6,
            client=arg_0._client,
            **arg_3)

        if arg_2:
            arg_7.follow()

        return arg_7

Migrate the data from the Query to a target dataset .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . FileObjFaker ( arg_1 , arg_2 . read ( arg_1 ) , arg_0 . process_row , arg_0 . verbose ) arg_0 . copy_from ( arg_3 , '"%s"' % arg_1 . name , [ '"%s"' % arg_4 [ 'name' ] for arg_4 in arg_1 . columns ] )

def Func(arg_0, arg_1, arg_2):
        """Write the contents of `table`

        :Parameters:
          - `table`: an instance of a :py:class:`mysql2pgsql.lib.mysql_reader.MysqlReader.Table` object that represents the table to read/write.
          - `reader`: an instance of a :py:class:`mysql2pgsql.lib.mysql_reader.MysqlReader` object that allows reading from the data source.

        Returns None
        """
        arg_3 = arg_0.FileObjFaker(arg_1, arg_2.read(arg_1), arg_0.process_row, arg_0.verbose)
        arg_0.copy_from(arg_3, '"%s"' % arg_1.name, ['"%s"' % arg_4['name'] for arg_4 in arg_1.columns])


return len(spiketimes) / float(traj.par.simulation.duration) *1000

def Func(arg_0):
    """Runs a simulation of a model neuron.

    :param traj:

        Container with all parameters.

    :return:

        An estimate of the firing rate of the neuron

    """

    # Extract all parameters from `traj`
    arg_1 = arg_0.par.neuron.V_init
    arg_2 = arg_0.par.neuron.I
    arg_3 = arg_0.par.neuron.tau_V
    arg_4 = arg_0.par.neuron.tau_ref
    arg_5 = arg_0.par.simulation.dt
    arg_6 = arg_0.par.simulation.duration

    arg_7 = int(arg_6 / float(arg_5))
    # Create some containers for the Euler integration
    arg_8 = np.zeros(arg_7)
    arg_8[0] = arg_1
    arg_9 = []  # List to collect all times of action potentials

    # Do the Euler integration:
    print('Starting Euler Integration')
    for arg_10 in range(1, arg_7):
        if arg_8[arg_10-1] >= 1:
            # The membrane potential crossed the threshold and we mark this as
            # an action potential
            arg_8[arg_10] = 0
            arg_9.append((arg_10-1)*arg_5)
        elif arg_9 and arg_10 * arg_5 - arg_9[-1] <= arg_4:
            # We are in the refractory period, so we simply clamp the voltage
            # to 0
            arg_8[arg_10] = 0
        else:
            # Euler Integration step:
            arg_11 = -1/arg_3 * arg_8[arg_10-1] + arg_2
            arg_8[arg_10] = arg_8[arg_10-1] + arg_11*arg_5

    print('Finished Euler Integration')

    # Add the voltage trace and spike times
    arg_0.f_add_result('neuron.$', V=arg_8, nspikes=len(arg_9),
                      comment='Contains the development of the membrane potential over time '
                              'as well as the number of spikes.')
    # This result will be renamed to `traj.results.neuron.run_XXXXXXXX`.

    # And finally we return the estimate of the firing rate
    return len(arg_9) / float(arg_0.par.simulation.duration) *1000


def Func ( arg_0 , arg_1 ) : if arg_1 . exc is None : return arg_2 = arg_1 . exc if arg_0 . _check_raise_value ( arg_1 , arg_2 ) : return try : arg_3 = next ( astroid . unpack_infer ( arg_2 ) ) except astroid . InferenceError : return arg_0 . _check_raise_value ( arg_1 , arg_3 )

def Func(arg_0, arg_1):
        """Visit a raise statement and check for raising
        strings or old-raise-syntax.
        """

        # Ignore empty raise.
        if arg_1.exc is None:
            return
        arg_2 = arg_1.exc
        if arg_0._check_raise_value(arg_1, arg_2):
            return
        try:
            arg_3 = next(astroid.unpack_infer(arg_2))
        except astroid.InferenceError:
            return
        arg_0._check_raise_value(arg_1, arg_3)

Visit a raise statement and check for raising strings or old - raise - syntax .


(shape, min_concentration=1e-3, min_scale=1e-5, name=None)

def Func ( arg_0 , arg_1 = 1e-3 , arg_2 = 1e-5 , arg_3 = None ) : with tf . compat . v1 . variable_scope ( None , default_name = "Func" ) : arg_4 = tf . compat . v1 . get_variable ( "unconstrained_concentration" , arg_0 , initializer = tf . compat . v1 . initializers . random_normal ( mean = 0.5 , stddev = 0.1 ) ) arg_5 = tf . compat . v1 . get_variable ( "unconstrained_scale" , arg_0 , initializer = tf . compat . v1 . initializers . random_normal ( stddev = 0.1 ) ) arg_6 = tf . maximum ( tf . nn . softplus ( arg_4 ) , arg_1 ) arg_7 = tf . maximum ( 1. / tf . nn . softplus ( arg_5 ) , 1. / arg_2 ) arg_8 = ed . Gamma ( arg_6 = arg_6 , arg_7 = arg_7 , arg_3 = arg_3 ) return arg_8

def Func(arg_0, arg_1=1e-3, arg_2=1e-5, arg_3=None):
  """Learnable Gamma via concentration and scale parameterization."""
  with tf.compat.v1.variable_scope(None, default_name="Func"):
    arg_4 = tf.compat.v1.get_variable(
        "unconstrained_concentration",
        arg_0,
        initializer=tf.compat.v1.initializers.random_normal(
            mean=0.5, stddev=0.1))
    arg_5 = tf.compat.v1.get_variable(
        "unconstrained_scale",
        arg_0,
        initializer=tf.compat.v1.initializers.random_normal(stddev=0.1))
    arg_6 = tf.maximum(tf.nn.softplus(arg_4),
                               arg_1)
    arg_7 = tf.maximum(1. / tf.nn.softplus(arg_5), 1. / arg_2)
    arg_8 = ed.Gamma(arg_6=arg_6, arg_7=arg_7, arg_3=arg_3)
    return arg_8

Learnable Gamma via concentration and scale parameterization .


return (math.fsum(squares1) + math.fsum(squares2)) / float(deg_freedom)

def Func ( arg_0 , arg_1 ) : arg_2 = len ( arg_0 ) + len ( arg_1 ) - 2 arg_3 = statistics . mean ( arg_0 ) arg_4 = ( ( x - arg_3 ) ** 2 for x in arg_0 ) arg_5 = statistics . mean ( arg_1 ) arg_6 = ( ( x - arg_5 ) ** 2 for x in arg_1 ) return ( math . fsum ( arg_4 ) + math . fsum ( arg_6 ) ) / float ( arg_2 )

def Func(arg_0, arg_1):
    """Find the pooled sample variance for two samples.

    Args:
        sample1: one sample.
        sample2: the other sample.

    Returns:
        Pooled sample variance, as a float.
    """
    arg_2 = len(arg_0) + len(arg_1) - 2
    arg_3 = statistics.mean(arg_0)
    arg_4 = ((x - arg_3) ** 2 for x in arg_0)
    arg_5 = statistics.mean(arg_1)
    arg_6 = ((x - arg_5) ** 2 for x in arg_1)

    return (math.fsum(arg_4) + math.fsum(arg_6)) / float(arg_2)

Find the pooled sample variance for two samples .


def Func ( arg_0 , arg_1 = None ) : if not arg_1 : arg_1 = len ( arg_0 [ 0 ] ) for arg_2 in arg_0 : if None in arg_2 or len ( arg_2 ) != arg_1 : return False return True

def Func(arg_0, arg_1=None):
    r'''Checks inputs for suitability of use by a mixing rule which requires
    all inputs to be of the same length and non-None. A number of variations
    were attempted for this function; this was found to be the quickest.

    Parameters
    ----------
    all_inputs : array-like of array-like
        list of all the lists of inputs, [-]
    length : int, optional
        Length of the desired inputs, [-]

    Returns
    -------
    False/True : bool
        Returns True only if all inputs are the same length (or length `length`)
        and none of the inputs contain None [-]

    Notes
    -----
    Does not check for nan values.

    Examples
    --------
    >>> Func(([1, 1], [1, 1], [1, 30], [10,0]), length=2)
    True
    '''
    if not arg_1:
        arg_1 = len(arg_0[0])
    for arg_2 in arg_0:
        if None in arg_2 or len(arg_2) != arg_1:
            return False
    return True

r'''Checks inputs for suitability of use by a mixing rule which requires
    all inputs to be of the same length and non-None. A number of variations
    were attempted for this function; this was found to be the quickest.

    Parameters
    ----------
    all_inputs : array-like of array-like
        list of all the lists of inputs, [-]
    length : int, optional
        Length of the desired inputs, [-]

    Returns
    -------
    False/True : bool
        Returns True only if all inputs are the same length (or length `length`)
        and none of the inputs contain None [-]

    Notes
    -----
    Does not check for nan values.

    Examples
    --------
    >>> none_and_length_check(([1, 1], [1, 1], [1, 30], [10,0]), length=2)
    True

r Checks inputs for suitability of use by a mixing rule which requires all inputs to be of the same length and non - None . A number of variations were attempted for this function ; this was found to be the quickest .


def Func ( arg_0 ) : arg_1 = arg_0 . Formatter ( ) if arg_0 . verbose : arg_1 = result . Verbose ( arg_1 ) if arg_0 . color : arg_1 = result . Colored ( arg_1 ) arg_2 = result . ExampleResult ( arg_1 ) arg_3 . current_result = arg_3 . _manager . result = arg_2

def Func(arg_0):
    """
    Setup the environment for an example run.

    """

    arg_1 = arg_0.Formatter()

    if arg_0.verbose:
        arg_1 = result.Verbose(arg_1)
    if arg_0.color:
        arg_1 = result.Colored(arg_1)

    arg_2 = result.ExampleResult(arg_1)

    arg_3.current_result = arg_3._manager.result = arg_2

Setup the environment for an example run .


def Func ( arg_0 : arg_1 ) -> None : for arg_2 , arg_3 , arg_4 , arg_5 in list ( arg_0 . edges ( keys = True , data = True ) ) : if CITATION not in arg_5 : continue if isinstance ( arg_2 , ListAbundance ) and isinstance ( arg_3 , ListAbundance ) : for arg_6 , arg_7 in itt . product ( arg_2 . members , arg_3 . members ) : arg_0 . add_qualified_edge ( arg_6 , arg_7 , relation = arg_5 [ RELATION ] , citation = arg_5 . get ( CITATION ) , evidence = arg_5 . get ( EVIDENCE ) , annotations = arg_5 . get ( ANNOTATIONS ) , ) elif isinstance ( arg_2 , ListAbundance ) : for arg_8 in arg_2 . members : arg_0 . add_qualified_edge ( arg_8 , arg_3 , relation = arg_5 [ RELATION ] , citation = arg_5 . get ( CITATION ) , evidence = arg_5 . get ( EVIDENCE ) , annotations = arg_5 . get ( ANNOTATIONS ) , ) elif isinstance ( arg_3 , ListAbundance ) : for arg_8 in arg_3 . members : arg_0 . add_qualified_edge ( arg_2 , arg_8 , relation = arg_5 [ RELATION ] , citation = arg_5 . get ( CITATION ) , evidence = arg_5 . get ( EVIDENCE ) , annotations = arg_5 . get ( ANNOTATIONS ) , ) _remove_list_abundance_nodes ( arg_0 )

def Func(arg_0: arg_1) -> None:
    """Expand all list abundances to simple subject-predicate-object networks."""
    for arg_2, arg_3, arg_4, arg_5 in list(arg_0.edges(keys=True, data=True)):
        if CITATION not in arg_5:
            continue

        if isinstance(arg_2, ListAbundance) and isinstance(arg_3, ListAbundance):
            for arg_6, arg_7 in itt.product(arg_2.members, arg_3.members):
                arg_0.add_qualified_edge(
                    arg_6, arg_7,
                    relation=arg_5[RELATION],
                    citation=arg_5.get(CITATION),
                    evidence=arg_5.get(EVIDENCE),
                    annotations=arg_5.get(ANNOTATIONS),
                )

        elif isinstance(arg_2, ListAbundance):
            for arg_8 in arg_2.members:
                arg_0.add_qualified_edge(
                    arg_8, arg_3,
                    relation=arg_5[RELATION],
                    citation=arg_5.get(CITATION),
                    evidence=arg_5.get(EVIDENCE),
                    annotations=arg_5.get(ANNOTATIONS),
                )

        elif isinstance(arg_3, ListAbundance):
            for arg_8 in arg_3.members:
                arg_0.add_qualified_edge(
                    arg_2, arg_8,
                    relation=arg_5[RELATION],
                    citation=arg_5.get(CITATION),
                    evidence=arg_5.get(EVIDENCE),
                    annotations=arg_5.get(ANNOTATIONS),
                )

    _remove_list_abundance_nodes(arg_0)

Expand all list abundances to simple subject - predicate - object networks .


def
Func
(
arg_0
,
arg_1
)
:
if
not
isinstance
(
arg_0
,
six
.
text_type
)
:
arg_0
=
arg_0
.
decode
(
'utf-8'
)
try
:
if
sys
.
version_info
<
(
2
,
7
)
:
arg_2
=
json
.
loads
(
arg_0
)
else
:
arg_2
=
json
.
loads
(
arg_0
,
object_pairs_hook
=
_DuplicateChecker
)
except
ValueError
as
e
:
raise
FuncError
(
'Failed to load JSON: {0}.'
.
format
(
str
(
e
)
)
)
_ConvertMessage
(
arg_2
,
arg_1
)
return
arg_1

def Func(arg_0, arg_1):
  """Funcs a JSON representation of a protocol message into a message.

  Args:
    text: Message JSON representation.
    message: A protocol beffer message to merge into.

  Returns:
    The same message passed as argument.

  Raises::
    FuncError: On JSON parsing problems.
  """
  if not isinstance(arg_0, six.text_type): arg_0 = arg_0.decode('utf-8')
  try:
    if sys.version_info < (2, 7):
      # object_pair_hook is not supported before python2.7
      arg_2 = json.loads(arg_0)
    else:
      arg_2 = json.loads(arg_0, object_pairs_hook=_DuplicateChecker)
  except ValueError as e:
    raise FuncError('Failed to load JSON: {0}.'.format(str(e)))
  _ConvertMessage(arg_2, arg_1)
  return arg_1

Parses a JSON representation of a protocol message into a message.

  Args:
    text: Message JSON representation.
    message: A protocol beffer message to merge into.

  Returns:
    The same message passed as argument.

  Raises::
    ParseError: On JSON parsing problems.

Parses a JSON representation of a protocol message into a message .


(self, arg, min_value=0, default=1, cmdname=None,
                at_most=None)

def Func(arg_0, arg_1, arg_2=0, arg_3=1, arg_4=None,
                arg_5=None):
        """If no argument use the default. If arg is a an integer between
        least min_value and at_most, use that. Otherwise report an error.
        If there's a stack frame use that in evaluation."""

        if arg_1 is None: return arg_3
        arg_3 = arg_0.Func_noerr(arg_1)
        if arg_3 is None:
            if arg_4:
                arg_0.errmsg(("Command '%s' expects an integer; "
                             + "got: %s.") % (arg_4, str(arg_1)))
            else:
                arg_0.errmsg('Expecting a positive integer, got: %s'
                            % str(arg_1))
                pass
            return None
            pass
        if arg_3 < arg_2:
            if arg_4:
                arg_0.errmsg(("Command '%s' expects an integer at least" +
                             ' %d; got: %d.')
                            % (arg_4, arg_2, arg_3))
            else:
                arg_0.errmsg(("Expecting a positive integer at least" +
                             ' %d; got: %d')
                            % (arg_2, arg_3))
                pass
            return None
        elif arg_5 and arg_3 > arg_5:
            if arg_4:
                arg_0.errmsg(("Command '%s' expects an integer at most" +
                             ' %d; got: %d.')
                            % (arg_4, arg_5, arg_3))
            else:
                arg_0.errmsg(("Expecting an integer at most %d; got: %d")
                            % (arg_5, arg_3))
                pass
            pass
        return arg_3

If no argument use the default . If arg is a an integer between least min_value and at_most use that . Otherwise report an error . If there s a stack frame use that in evaluation .


def Func ( arg_0 ) : arg_1 = inspect . getfullargspec ( arg_0 ) arg_2 = { } if arg_1 . defaults is not None : arg_2 = dict ( zip ( arg_1 . args [ - len ( arg_1 . defaults ) : ] , arg_1 . defaults ) ) if arg_1 . kwonlydefaults is not None : arg_2 . update ( arg_1 . kwonlydefaults ) arg_3 = arg_1 . args [ 1 : ] @ functools . wraps ( arg_0 ) def wrapper ( * arg_4 , ** arg_5 ) : arg_6 = arg_4 [ 0 ] arg_7 = arg_2 . copy ( ) for arg_8 , arg_9 in zip ( arg_3 , arg_4 [ 1 : ] ) : arg_7 [ arg_8 ] = arg_9 arg_7 . update ( arg_5 ) arg_6 . __dict__ . update ( arg_7 ) return arg_0 ( * arg_4 , ** arg_5 ) return wrapper

def Func(arg_0):
    """Stores provided method args as instance attributes.
    """
    arg_1 = inspect.getfullargspec(arg_0)
    arg_2 = {}
    if arg_1.defaults is not None:
        arg_2 = dict(
            zip(arg_1.args[-len(arg_1.defaults):], arg_1.defaults))
    if arg_1.kwonlydefaults is not None:
        arg_2.update(arg_1.kwonlydefaults)
    arg_3 = arg_1.args[1:]

    @functools.wraps(arg_0)
    def wrapper(*arg_4, **arg_5):
        arg_6 = arg_4[0]
        # Get default arg values
        arg_7 = arg_2.copy()
        # Add provided arg values
        for arg_8, arg_9 in zip(arg_3, arg_4[1:]):
            arg_7[arg_8] = arg_9
        arg_7.update(arg_5)
        arg_6.__dict__.update(arg_7)
        return arg_0(*arg_4, **arg_5)

    return wrapper

Stores provided method args as instance attributes .


def Func ( arg_0 , arg_1 ) : arg_2 = LearnerInfoSerializer ( arg_1 . user ) arg_3 = CourseInfoSerializer ( arg_1 . course ) arg_4 = LearnerCourseEnrollmentStatement ( arg_1 . user , arg_1 . course , arg_2 . data , arg_3 . data , ) EnterpriseXAPIClient ( arg_0 ) . save_statement ( arg_4 )

def Func(arg_0, arg_1):
    """
    Send xAPI statement for course enrollment.

    Arguments:
         lrs_configuration (XAPILRSConfiguration): XAPILRSConfiguration instance where to send statements.
         course_enrollment (CourseEnrollment): Course enrollment object.
    """
    arg_2 = LearnerInfoSerializer(arg_1.user)
    arg_3 = CourseInfoSerializer(arg_1.course)

    arg_4 = LearnerCourseEnrollmentStatement(
        arg_1.user,
        arg_1.course,
        arg_2.data,
        arg_3.data,
    )
    EnterpriseXAPIClient(arg_0).save_statement(arg_4)

Send xAPI statement for course enrollment .


(self, raw_cell, store_history=False, silent=False)

def Func(arg_0, arg_1, arg_2=False, arg_3=False):
        """Run a complete IPython cell.

        Parameters
        ----------
        raw_cell : str
          The code (including IPython code such as %magic functions) to run.
        store_history : bool
          If True, the raw and translated cell will be stored in IPython's
          history. For user code calling back into IPython's machinery, this
          should be set to False.
        silent : bool
          If True, avoid side-effets, such as implicit displayhooks, history,
          and logging.  silent=True forces store_history=False.
        """
        if (not arg_1) or arg_1.isspace():
            return

        if arg_3:
            arg_2 = False

        arg_0.input_splitter.push(arg_1)

        # Check for cell magics, which leave state behind.  This interface is
        # ugly, we need to do something cleaner later...  Now the logic is
        # simply that the input_splitter remembers if there was a cell magic,
        # and in that case we grab the cell body.
        if arg_0.input_splitter.cell_magic_parts:
            arg_0._current_cell_magic_body = \
                               ''.join(arg_0.input_splitter.cell_magic_parts)
        arg_5 = arg_0.input_splitter.source_reset()

        with arg_0.builtin_trap:
            arg_6 = False
            if len(arg_5.splitlines()) == 1:
                try:
                    # use prefilter_lines to handle trailing newlines
                    # restore trailing newline for ast.parse
                    arg_5 = arg_0.prefilter_manager.prefilter_lines(arg_5) + '\n'
                except AliasError as e:
                    error(e)
                    arg_6 = True
                except Exception:
                    # don't allow prefilter errors to crash IPython
                    arg_0.showtraceback()
                    arg_6 = True

            # Store raw and processed history
            if arg_2:
                arg_0.history_manager.store_inputs(arg_0.execution_count,
                                                  arg_5, arg_1)
            if not arg_3:
                arg_0.logger.log(arg_5, arg_1)

            if not arg_6:
                # don't run if prefilter failed
                arg_7 = arg_0.compile.cache(arg_5, arg_0.execution_count)

                with arg_0.display_trap:
                    try:
                        arg_8 = arg_0.compile.ast_parse(arg_5,
                                                          filename=arg_7)
                    except IndentationError:
                        arg_0.showindentationerror()
                        if arg_2:
                            arg_0.execution_count += 1
                        return None
                    except (OverflowError, SyntaxError, ValueError, TypeError,
                            MemoryError):
                        arg_0.showsyntaxerror()
                        if arg_2:
                            arg_0.execution_count += 1
                        return None

                    arg_9 = "none" if arg_3 else arg_0.ast_node_interactivity
                    arg_0.run_ast_nodes(arg_8.body, arg_7,
                                       arg_9=arg_9)

                    # Execute any registered post-execution functions.
                    # unless we are silent
                    arg_10 = [] if arg_3 else arg_0._post_execute.iteritems()

                    for arg_11, arg_12 in arg_10:
                        if arg_0.disable_failing_post_execute and not arg_12:
                            continue
                        try:
                            arg_11()
                        except KeyboardInterrupt:
                            print >> io.stderr, "\nKeyboardInterrupt"
                        except Exception:
                            # register as failing:
                            arg_0._post_execute[arg_11] = False
                            arg_0.showtraceback()
                            print >> io.stderr, '\n'.join([
                                "post-execution function %r produced an error." % arg_11,
                                "If this problem persists, you can disable failing post-exec functions with:",
                                "",
                                "    get_ipython().disable_failing_post_execute = True"
                            ])

        if arg_2:
            # Write output to the database. Does nothing unless
            # history output logging is enabled.
            arg_0.history_manager.store_output(arg_0.execution_count)
            # Each cell is a *single* input, regardless of how many lines it has
            arg_0.execution_count += 1


(bucket,
                filename,
                local_file,
                altexts=None,
                client=None,
                raiseonfail=False)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
,
arg_4
=
,
arg_5
=
False
)
:
if
not
arg_4
:
arg_4
=
boto3
.
client
(
's3'
)
try
:
arg_4
.
download_file
(
arg_0
,
arg_1
,
arg_2
)
return
arg_2
except
Exception
as
e
:
if
arg_3
is
not
:
for
arg_6
in
arg_3
:
arg_7
=
os
.
path
.
splitext
(
arg_1
)
arg_8
=
arg_7
[
0
]
+
arg_6
try
:
arg_4
.
download_file
(
arg_0
,
arg_8
,
arg_2
.
replace
(
arg_7
[
1
]
,
arg_6
)
)
return
arg_2
.
replace
(
arg_7
[
1
]
,
arg_6
)
except
Exception
as
e
:
pass
else
:
LOGEXCEPTION
(
'could not download s3://%s/%s'
%
(
arg_0
,
arg_1
)
)
if
arg_5
:
raise
return

def Func(arg_0,
                arg_1,
                arg_2,
                arg_3=None,
                arg_4=None,
                arg_5=False):

    """This gets a file from an S3 bucket.

    Parameters
    ----------

    bucket : str
        The AWS S3 bucket name.

    filename : str
        The full filename of the file to get from the bucket

    local_file : str
        Path to where the downloaded file will be stored.

    altexts : None or list of str
        If not None, this is a list of alternate extensions to try for the file
        other than the one provided in `filename`. For example, to get anything
        that's an .sqlite where .sqlite.gz is expected, use altexts=[''] to
        strip the .gz.

    client : boto3.Client or None
        If None, this function will instantiate a new `boto3.Client` object to
        use in its operations. Alternatively, pass in an existing `boto3.Client`
        instance to re-use it here.

    raiseonfail : bool
        If True, will re-raise whatever Exception caused the operation to fail
        and break out immediately.

    Returns
    -------

    str
        Path to the downloaded filename or None if the download was
        unsuccessful.

    """

    if not arg_4:
        arg_4 = boto3.client('s3')

    try:

        arg_4.download_file(arg_0, arg_1, arg_2)
        return arg_2

    except Exception as e:

        if arg_3 is not None:

            for arg_6 in arg_3:

                arg_7 = os.path.splitext(arg_1)
                arg_8 = arg_7[0] + arg_6
                try:
                    arg_4.download_file(
                        arg_0,
                        arg_8,
                        arg_2.replace(arg_7[-1],
                                           arg_6)
                    )
                    return arg_2.replace(arg_7[-1],
                                              arg_6)
                except Exception as e:
                    pass

        else:

            LOGEXCEPTION('could not download s3://%s/%s' % (arg_0, arg_1))

            if arg_5:
                raise

            return None


Creates the section value if it does not exists and sets the value.
            Use write_config to actually set the value.

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : if not arg_1 in arg_0 . config : arg_0 . config . add_section ( arg_1 ) arg_0 . config . Func ( arg_1 , arg_2 , arg_3 )

def Func(arg_0, arg_1, arg_2, arg_3):
        """
            Creates the section value if it does not exists and Funcs the value.
            Use write_config to actually Func the value.
        """
        if not arg_1 in arg_0.config:
            arg_0.config.add_section(arg_1)
        arg_0.config.Func(arg_1, arg_2, arg_3)

Creates the section value if it does not exists and sets the value . Use write_config to actually set the value .


def Func(arg_0, arg_1):
        """
        Remove a websocket subscriber.

        ws -- the websocket
        """
        if arg_1 in arg_0.subscribers:
            arg_0.subscribers.remove(arg_1)

        for arg_2 in arg_0.available_events:
            arg_0.remove_event_subscriber(arg_2, arg_1)


def Func ( arg_0 , arg_1 , arg_2 = False ) : arg_3 = 'wb' if arg_2 else 'w' with open ( os . path . join ( arg_0 . uri , arg_1 ) , arg_3 ) as f : yield f

def Func(arg_0, arg_1, arg_2=False):
        """
        Yield a file object representing `key`

        :param str key: The file to save to
        :param bool binary: Whether we should treat it as binary
        :return:
        """
        arg_3 = 'wb' if arg_2 else 'w'
        with open(os.path.join(arg_0.uri, arg_1), arg_3) as f:
            yield f


(arr, block_size, func, cval=0, preserve_dtype=True)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = 0 , arg_4 = True ) : from . import dtypes as iadt iadt . gate_dtypes ( arg_0 , allowed = [ "bool" , "uint8" , "uint16" , "uint32" , "int8" , "int16" , "int32" , "float16" , "float32" , "float64" , "float128" ] , disallowed = [ "uint64" , "uint128" , "uint256" , "int64" , "int128" , "int256" , "float256" ] , augmenter = None ) do_assert ( arg_0 . ndim in [ 2 , 3 ] ) arg_5 = is_single_integer ( arg_1 ) and arg_1 >= 1 arg_6 = is_iterable ( arg_1 ) and len ( arg_1 ) in [ 2 , 3 ] and [ is_single_integer ( val ) and val >= 1 for val in arg_1 ] do_assert ( arg_5 or arg_6 ) if is_single_integer ( arg_1 ) : arg_1 = [ arg_1 , arg_1 ] if len ( arg_1 ) < arg_0 . ndim : arg_1 = list ( arg_1 ) + [ 1 ] arg_7 = arg_0 . dtype arg_8 = skimage . measure . block_reduce ( arg_0 , tuple ( arg_1 ) , arg_2 , arg_3 = arg_3 ) if arg_4 and arg_8 . dtype . type != arg_7 : arg_8 = arg_8 . astype ( arg_7 ) return arg_8

def Func(arg_0, arg_1, arg_2, arg_3=0, arg_4=True):
    """
    Resize an array by Funcing values within blocks.

    dtype support::

        * ``uint8``: yes; fully tested
        * ``uint16``: yes; tested
        * ``uint32``: yes; tested (2)
        * ``uint64``: no (1)
        * ``int8``: yes; tested
        * ``int16``: yes; tested
        * ``int32``: yes; tested (2)
        * ``int64``: no (1)
        * ``float16``: yes; tested
        * ``float32``: yes; tested
        * ``float64``: yes; tested
        * ``float128``: yes; tested (2)
        * ``bool``: yes; tested

        - (1) results too inaccurate (at least when using np.average as func)
        - (2) Note that scikit-image documentation says that the wrapped Funcing function converts
              inputs to float64. Actual tests showed no indication of that happening (at least when
              using preserve_dtype=True).

    Parameters
    ----------
    arr : (H,W) ndarray or (H,W,C) ndarray
        Image-like array to Func. Ideally of datatype ``numpy.float64``.

    block_size : int or tuple of int
        Spatial size of each group of values to Func, aka kernel size.
        If a single integer, then a symmetric block of that size along height and width will be used.
        If a tuple of two values, it is assumed to be the block size along height and width of the image-like,
        with Funcing happening per channel.
        If a tuple of three values, it is assumed to be the block size along height, width and channels.

    func : callable
        Function to apply to a given block in order to convert it to a single number,
        e.g. :func:`numpy.average`, :func:`numpy.min`, :func:`numpy.max`.

    cval : number, optional
        Value to use in order to pad the array along its border if the array cannot be divided
        by `block_size` without remainder.

    preserve_dtype : bool, optional
        Whether to convert the array back to the input datatype if it is changed away from
        that in the Funcing process.

    Returns
    -------
    arr_reduced : (H',W') ndarray or (H',W',C') ndarray
        Array after Funcing.

    """
    # TODO find better way to avoid circular import
    from . import dtypes as iadt
    iadt.gate_dtypes(arg_0,
                     allowed=["bool", "uint8", "uint16", "uint32", "int8", "int16", "int32",
                              "float16", "float32", "float64", "float128"],
                     disallowed=["uint64", "uint128", "uint256", "int64", "int128", "int256",
                                 "float256"],
                     augmenter=None)

    do_assert(arg_0.ndim in [2, 3])
    arg_5 = is_single_integer(arg_1) and arg_1 >= 1
    arg_6 = is_iterable(arg_1) and len(arg_1) in [2, 3] \
        and [is_single_integer(val) and val >= 1 for val in arg_1]
    do_assert(arg_5 or arg_6)

    if is_single_integer(arg_1):
        arg_1 = [arg_1, arg_1]
    if len(arg_1) < arg_0.ndim:
        arg_1 = list(arg_1) + [1]

    arg_7 = arg_0.dtype
    arg_8 = skimage.measure.block_reduce(arg_0, tuple(arg_1), arg_2, arg_3=arg_3)
    if arg_4 and arg_8.dtype.type != arg_7:
        arg_8 = arg_8.astype(arg_7)
    return arg_8

Resize an array by pooling values within blocks.

    dtype support::

        * ``uint8``: yes; fully tested
        * ``uint16``: yes; tested
        * ``uint32``: yes; tested (2)
        * ``uint64``: no (1)
        * ``int8``: yes; tested
        * ``int16``: yes; tested
        * ``int32``: yes; tested (2)
        * ``int64``: no (1)
        * ``float16``: yes; tested
        * ``float32``: yes; tested
        * ``float64``: yes; tested
        * ``float128``: yes; tested (2)
        * ``bool``: yes; tested

        - (1) results too inaccurate (at least when using np.average as func)
        - (2) Note that scikit-image documentation says that the wrapped pooling function converts
              inputs to float64. Actual tests showed no indication of that happening (at least when
              using preserve_dtype=True).

    Parameters
    ----------
    arr : (H,W) ndarray or (H,W,C) ndarray
        Image-like array to pool. Ideally of datatype ``numpy.float64``.

    block_size : int or tuple of int
        Spatial size of each group of values to pool, aka kernel size.
        If a single integer, then a symmetric block of that size along height and width will be used.
        If a tuple of two values, it is assumed to be the block size along height and width of the image-like,
        with pooling happening per channel.
        If a tuple of three values, it is assumed to be the block size along height, width and channels.

    func : callable
        Function to apply to a given block in order to convert it to a single number,
        e.g. :func:`numpy.average`, :func:`numpy.min`, :func:`numpy.max`.

    cval : number, optional
        Value to use in order to pad the array along its border if the array cannot be divided
        by `block_size` without remainder.

    preserve_dtype : bool, optional
        Whether to convert the array back to the input datatype if it is changed away from
        that in the pooling process.

    Returns
    -------
    arr_reduced : (H',W') ndarray or (H',W',C') ndarray
        Array after pooling.

Resize an array by pooling values within blocks .


(self, network, params, spEnable, tmEnable)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """
    Attaches an 'AnomalyClassifier' region to the network. Will remove current
    'AnomalyClassifier' region if it exists.

    Parameters
    -----------
    network - network to add the AnomalyClassifier region
    params - parameters to pass to the region
    spEnable - True if network has an SP region
    tmEnable - True if network has a TM region; Currently requires True
    """

    arg_5 = copy.deepcopy(arg_2)
    arg_6 = dict(k=1,
                     distanceMethod='rawOverlap',
                     distanceNorm=1,
                     doBinarization=1,
                     replaceDuplicates=0,
                     maxStoredPatterns=1000)
    arg_5.update(arg_6)

    # Set defaults if not set
    if arg_5['trainRecords'] is None:
      arg_5['trainRecords'] = DEFAULT_ANOMALY_TRAINRECORDS

    if arg_5['cacheSize'] is None:
      arg_5['cacheSize'] = DEFAULT_ANOMALY_CACHESIZE

    # Remove current instance if already created (used for deserializing)
    if arg_0._netInfo is not None and arg_0._netInfo.net is not None \
              and arg_0._getAnomalyClassifier() is not None:
      arg_0._netInfo.net.removeRegion('AnomalyClassifier')

    arg_1.addRegion("AnomalyClassifier",
                      "py.KNNAnomalyClassifierRegion",
                      json.dumps(arg_5))

    # Attach link to SP
    if arg_3:
      arg_1.link("SP", "AnomalyClassifier", "UniformLink", "",
          srcOutput="bottomUpOut", destInput="spBottomUpOut")
    else:
      arg_1.link("sensor", "AnomalyClassifier", "UniformLink", "",
          srcOutput="dataOut", destInput="spBottomUpOut")

    # Attach link to TM
    if arg_4:
      arg_1.link("TM", "AnomalyClassifier", "UniformLink", "",
              srcOutput="topDownOut", destInput="tpTopDownOut")
      arg_1.link("TM", "AnomalyClassifier", "UniformLink", "",
              srcOutput="lrnActiveStateT", destInput="tpLrnActiveStateT")
    else:
      raise RuntimeError("TemporalAnomaly models require a TM region.")

Attaches an AnomalyClassifier region to the network . Will remove current AnomalyClassifier region if it exists .


def Func ( arg_0 , arg_1 ) : arg_2 . user_id = arg_1 . pk arg_2 . user_ddp_id = get_meteor_id ( arg_1 ) arg_2 . user_sub_id = meteor_random_id ( ) API . do_sub ( arg_2 . user_sub_id , 'LoggedInUser' , silent = True ) arg_0 . update_subs ( arg_1 . pk ) user_logged_in . send ( sender = arg_1 . __class__ , request = arg_2 . request , arg_1 = arg_1 , )

def Func(arg_0, arg_1):
        """Login a user."""
        arg_2.user_id = arg_1.pk
        arg_2.user_ddp_id = get_meteor_id(arg_1)
        # silent subscription (sans sub/nosub msg) to LoggedInUser pub
        arg_2.user_sub_id = meteor_random_id()
        API.do_sub(arg_2.user_sub_id, 'LoggedInUser', silent=True)
        arg_0.update_subs(arg_1.pk)
        user_logged_in.send(
            sender=arg_1.__class__, request=arg_2.request, arg_1=arg_1,
        )


def
Func
(
arg_0
,
arg_1
)
:
def
process
(
arg_2
)
:
if
not
arg_2
.
startswith
(
'#'
)
:
return
'    '
+
arg_2
arg_2
=
arg_2
[
2
:
]
if
arg_2
.
startswith
(
'===='
)
:
return
''
if
arg_2
.
startswith
(
'None'
)
:
return
'    # None.'
if
arg_2
.
endswith
(
':'
)
:
return
'#### '
+
arg_2
return
arg_2
arg_3
=
[
]
for
arg_2
in
arg_1
.
splitlines
(
)
:
arg_4
=
process
(
arg_2
)
if
arg_4
is
not
:
arg_3
.
append
(
arg_4
)
return
'\n'
.
join
(
arg_3
)

def Func(arg_0, arg_1):
    """Convert an operative config string to markdown format."""

    # TODO: Total hack below. Implement more principled formatting.
    def process(arg_2):
      """Convert a single line to markdown format."""
      if not arg_2.startswith('#'):
        return '    ' + arg_2

      arg_2 = arg_2[2:]
      if arg_2.startswith('===='):
        return ''
      if arg_2.startswith('None'):
        return '    # None.'
      if arg_2.endswith(':'):
        return '#### ' + arg_2
      return arg_2

    arg_3 = []
    for arg_2 in arg_1.splitlines():
      arg_4 = process(arg_2)
      if arg_4 is not None:
        arg_3.append(arg_4)

    return '\n'.join(arg_3)

Convert an operative config string to markdown format .


def Func(arg_0, arg_1, arg_2=None):
        """Add success output to Xunit report.
        """
        arg_3 = arg_0._timeTaken()
        arg_0.stats['passes'] += 1
        arg_4 = arg_1.id()
        arg_0.errorlist.append(
            '<testcase classname=%(cls)s name=%(name)s '
            'time="%(taken).3f" />' %
            {'cls': arg_0._quoteattr(id_split(arg_4)[0]),
             'name': arg_0._quoteattr(id_split(arg_4)[-1]),
             'taken': arg_3,
             })


def Func ( arg_0 , arg_1 ) : arg_2 = BufferedTilePyramid ( arg_1 ) with rasterio . open ( arg_0 , "r" ) as src : arg_3 , arg_4 , arg_5 , arg_6 = reproject_geometry ( segmentize_geometry ( box ( src . bounds . left , src . bounds . bottom , src . bounds . right , src . bounds . top ) , get_segmentize_value ( arg_0 , arg_2 ) ) , src_crs = src . crs , dst_crs = arg_2 . crs ) . bounds arg_7 = arg_5 - arg_3 arg_8 = arg_6 - arg_4 arg_9 = float ( src . width + src . height ) arg_10 = ( ( arg_7 / float ( src . width ) ) * ( float ( src . width ) / arg_9 ) + ( arg_8 / float ( src . height ) ) * ( float ( src . height ) / arg_9 ) ) for arg_11 in range ( 0 , 40 ) : if arg_2 . pixel_x_size ( arg_11 ) <= arg_10 : return arg_11 - 1

def Func(arg_0, arg_1):
    """
    Determine the best base zoom level for a raster.

    "Best" means the maximum zoom level where no oversampling has to be done.

    Parameters
    ----------
    input_file : path to raster file
    tile_pyramid_type : ``TilePyramid`` projection (``geodetic`` or``mercator``)

    Returns
    -------
    zoom : integer
    """
    arg_2 = BufferedTilePyramid(arg_1)
    with rasterio.open(arg_0, "r") as src:
        arg_3, arg_4, arg_5, arg_6 = reproject_geometry(
            segmentize_geometry(
                box(
                    src.bounds.left, src.bounds.bottom, src.bounds.right,
                    src.bounds.top
                ),
                get_segmentize_value(arg_0, arg_2)
            ),
            src_crs=src.crs, dst_crs=arg_2.crs
        ).bounds
        arg_7 = arg_5 - arg_3
        arg_8 = arg_6 - arg_4
        arg_9 = float(src.width + src.height)
        arg_10 = (
            (arg_7 / float(src.width)) * (float(src.width) / arg_9) +
            (arg_8 / float(src.height)) * (float(src.height) / arg_9)
        )

    for arg_11 in range(0, 40):
        if arg_2.pixel_x_size(arg_11) <= arg_10:
            return arg_11-1

Determine the best base zoom level for a raster .


def Func ( arg_0 , arg_1 = { } , arg_2 = [ ] ) : if arg_2 : for arg_3 in arg_2 : if arg_3 in arg_1 : arg_1 [ arg_3 ] = arg_0 . _parse_datetime ( arg_1 [ arg_3 ] ) super ( CampfireEntity , arg_0 ) . Func ( arg_1 )

def Func(arg_0, arg_1={}, arg_2=[]):
        """ Set entity data

        Args:
            data (dict): Entity data
            datetime_fields (array): Fields that should be parsed as datetimes
        """
        if arg_2:
            for arg_3 in arg_2:
                if arg_3 in arg_1:
                    arg_1[arg_3] = arg_0._parse_datetime(arg_1[arg_3])

        super(CampfireEntity, arg_0).Func(arg_1)


A decorator for marking functions as deprecated.

def Func(arg_0: arg_1):
    """A decorator for marking functions as Func. """
    assert isinstance(arg_0, arg_1), "The Func decorator requires a message string argument."

    def decorator(arg_2):
        @wraps(arg_2)
        def wrapper(*arg_3, **arg_4):
            warnings.warn(f"`{func.__qualname__}` is Func. {message}",
                          category=ManticoreDeprecationWarning, stacklevel=2)
            return arg_2(*arg_3, **arg_4)

        return wrapper

    return decorator

A decorator for marking functions as deprecated .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
if
arg_1
.
size
==
arg_2
.
size
and
arg_1
.
size
==
64
:
arg_1
.
write
(
arg_2
.
read
(
)
)
elif
arg_1
.
size
==
arg_2
.
size
and
arg_1
.
size
==
128
:
arg_3
=
Operators
.
EXTRACT
(
arg_2
.
read
(
)
,
0
,
64
)
arg_1
.
write
(
Operators
.
ZEXTEND
(
arg_3
,
128
)
)
elif
arg_1
.
size
==
128
and
arg_2
.
size
==
64
:
arg_1
.
write
(
Operators
.
ZEXTEND
(
arg_2
.
read
(
)
,
arg_1
.
size
)
)
elif
arg_1
.
size
==
64
and
arg_2
.
size
==
128
:
arg_1
.
write
(
Operators
.
EXTRACT
(
arg_2
.
read
(
)
,
0
,
arg_1
.
size
)
)
else
:
arg_4
=
'Invalid size in Func'
logger
.
error
(
arg_4
)
raise
Exception
(
arg_4
)

def Func(arg_0, arg_1, arg_2):
        """
        Move quadword.

        Copies a quadword from the source operand (second operand) to the destination operand (first operand).
        The source and destination operands can be MMX(TM) technology registers, XMM registers, or 64-bit memory
        locations. This instruction can be used to move a between two MMX registers or between an MMX register
        and a 64-bit memory location, or to move data between two XMM registers or between an XMM register and
        a 64-bit memory location. The instruction cannot be used to transfer data between memory locations.
        When the source operand is an XMM register, the low quadword is moved; when the destination operand is
        an XMM register, the quadword is stored to the low quadword of the register, and the high quadword is
        cleared to all 0s::

            Func instruction when operating on MMX registers and memory locations:

            DEST  =  SRC;

            Func instruction when source and destination operands are XMM registers:

            DEST[63-0]  =  SRC[63-0];

            Func instruction when source operand is XMM register and destination operand is memory location:

            DEST  =  SRC[63-0];

            Func instruction when source operand is memory location and destination operand is XMM register:

            DEST[63-0]  =  SRC;
            DEST[127-64]  =  0000000000000000H;

        :param cpu: current CPU.
        :param dest: destination operand.
        :param src: source operand.
        """
        # mmx to mmx or mmx to mem
        if arg_1.size == arg_2.size and arg_1.size == 64:
            arg_1.write(arg_2.read())
        # two xmm regs
        elif arg_1.size == arg_2.size and arg_1.size == 128:
            arg_3 = Operators.EXTRACT(arg_2.read(), 0, 64)
            arg_1.write(Operators.ZEXTEND(arg_3, 128))
        # mem to xmm
        elif arg_1.size == 128 and arg_2.size == 64:
            arg_1.write(Operators.ZEXTEND(arg_2.read(), arg_1.size))
        # xmm to mem
        elif arg_1.size == 64 and arg_2.size == 128:
            arg_1.write(Operators.EXTRACT(arg_2.read(), 0, arg_1.size))
        else:
            arg_4 = 'Invalid size in Func'
            logger.error(arg_4)
            raise Exception(arg_4)

Move quadword.

        Copies a quadword from the source operand (second operand) to the destination operand (first operand).
        The source and destination operands can be MMX(TM) technology registers, XMM registers, or 64-bit memory
        locations. This instruction can be used to move a between two MMX registers or between an MMX register
        and a 64-bit memory location, or to move data between two XMM registers or between an XMM register and
        a 64-bit memory location. The instruction cannot be used to transfer data between memory locations.
        When the source operand is an XMM register, the low quadword is moved; when the destination operand is
        an XMM register, the quadword is stored to the low quadword of the register, and the high quadword is
        cleared to all 0s::

            MOVQ instruction when operating on MMX registers and memory locations:

            DEST  =  SRC;

            MOVQ instruction when source and destination operands are XMM registers:

            DEST[63-0]  =  SRC[63-0];

            MOVQ instruction when source operand is XMM register and destination operand is memory location:

            DEST  =  SRC[63-0];

            MOVQ instruction when source operand is memory location and destination operand is XMM register:

            DEST[63-0]  =  SRC;
            DEST[127-64]  =  0000000000000000H;

        :param cpu: current CPU.
        :param dest: destination operand.
        :param src: source operand.


(self, client_key, token, request, uri=None,
                        realms=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
=
,
arg_5
=
)
:
log
.
debug
(
'Validate realms %r for %r'
,
arg_5
,
arg_1
)
if
arg_3
.
access_token
:
arg_6
=
arg_3
.
access_token
else
:
arg_6
=
arg_0
.
_tokengetter
(
arg_1
=
arg_1
,
arg_2
=
arg_2
)
arg_3
.
access_token
=
arg_6
if
not
arg_6
:
return
False
return
set
(
arg_6
.
realms
)
.
issuperset
(
set
(
arg_5
)
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None,
                        arg_5=None):
        """Check if the token has permission on those realms."""
        log.debug('Validate realms %r for %r', arg_5, arg_1)
        if arg_3.access_token:
            arg_6 = arg_3.access_token
        else:
            arg_6 = arg_0._tokengetter(arg_1=arg_1, arg_2=arg_2)
            arg_3.access_token = arg_6
        if not arg_6:
            return False
        return set(arg_6.realms).issuperset(set(arg_5))

Check if the token has permission on those realms .


def Func ( arg_0 ) : if '://' not in arg_0 . url : assert 'file:' not in arg_0 . url arg_0 . url = arg_0 . url . replace ( 'git+' , 'git+ssh://' ) arg_1 , arg_2 = super ( Git , arg_0 ) . Func ( ) arg_1 = arg_1 . replace ( 'ssh://' , '' ) else : arg_1 , arg_2 = super ( Git , arg_0 ) . Func ( ) return arg_1 , arg_2

def Func(arg_0):
        """
        Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'.
        That's required because although they use SSH they sometimes doesn't
        work with a ssh:// scheme (e.g. Github). But we need a scheme for
        parsing. Hence we remove it again afterwards and return it as a stub.
        """
        if '://' not in arg_0.url:
            assert 'file:' not in arg_0.url
            arg_0.url = arg_0.url.replace('git+', 'git+ssh://')
            arg_1, arg_2 = super(Git, arg_0).Func()
            arg_1 = arg_1.replace('ssh://', '')
        else:
            arg_1, arg_2 = super(Git, arg_0).Func()

        return arg_1, arg_2


return self._mc_client._get(url=self._build_path(workflow_id, 'emails', email_id))

def Func(arg_0, arg_1, arg_2):
        """
        Get information about an individual Automation workflow email.

        :param workflow_id: The unique id for the Automation workflow.
        :type workflow_id: :py:class:`str`
        :param email_id: The unique id for the Automation workflow email.
        :type email_id: :py:class:`str`
        """
        arg_0.workflow_id = arg_1
        arg_0.email_id = arg_2
        return arg_0._mc_client._Func(url=arg_0._build_path(arg_1, 'emails', arg_2))

Get information about an individual Automation workflow email .


(times, mags, errs,
                    externalparam_arrs,
                    magsarefluxes=False,
                    epdsmooth=True,
                    epdsmooth_sigclip=3.0,
                    epdsmooth_windowsize=21,
                    epdsmooth_func=smooth_magseries_savgol,
                    epdsmooth_extraparams=None,
                    rf_subsample=1.0,
                    rf_ntrees=300,
                    rf_extraparams={'criterion':'mse',
                                    'oob_score':False,
                                    'n_jobs':-1})

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = False , arg_5 = True , arg_6 = 3.0 , arg_7 = 21 , arg_8 = arg_9 , arg_10 = None , arg_11 = 1.0 , arg_12 = 300 , arg_13 = { 'criterion' : 'mse' , 'oob_score' : False , 'n_jobs' : - 1 } ) : arg_14 = np . isfinite ( arg_0 ) & np . isfinite ( arg_1 ) & np . isfinite ( arg_2 ) arg_15 , arg_16 , arg_17 = arg_0 [ : : ] [ arg_14 ] , arg_1 [ : : ] [ arg_14 ] , arg_2 [ : : ] [ arg_14 ] arg_18 = [ ] for arg_19 in arg_3 : arg_18 . append ( arg_19 [ : : ] [ arg_14 ] ) arg_20 , arg_21 , arg_22 , arg_23 = sigclip_magseries_with_extparams ( arg_0 , arg_1 , arg_2 , arg_3 , sigclip = arg_6 , arg_4 = arg_4 ) if arg_5 : if isinstance ( arg_10 , dict ) : arg_24 = arg_8 ( arg_21 , arg_7 , ** arg_10 ) else : arg_24 = arg_8 ( arg_21 , arg_7 ) else : arg_24 = arg_21 if isinstance ( arg_13 , dict ) : arg_25 = RandomForestRegressor ( n_estimators = arg_12 , ** arg_13 ) else : arg_25 = RandomForestRegressor ( n_estimators = arg_12 ) arg_26 = np . column_stack ( arg_23 ) if arg_11 < 1.0 : arg_27 = np . arange ( arg_24 . size ) arg_28 = np . sort ( npr . choice ( arg_27 , size = int ( arg_11 * arg_24 . size ) , replace = False ) ) else : arg_28 = np . arange ( arg_24 . size ) arg_25 . fit ( arg_26 [ arg_28 , : ] , arg_24 [ arg_28 ] ) arg_29 = arg_25 . predict ( np . column_stack ( arg_18 ) ) arg_30 = npmedian ( arg_16 ) + arg_16 - arg_29 arg_31 = { 'times' : arg_15 , 'mags' : arg_30 , 'errs' : arg_17 , 'feature_importances' : arg_25 . feature_importances_ , 'regressor' : arg_25 , 'mags_median' : npmedian ( arg_30 ) , 'mags_mad' : npmedian ( npabs ( arg_30 - npmedian ( arg_30 ) ) ) } return arg_31

def Func(arg_0, arg_1, arg_2,
                    arg_3,
                    arg_4=False,
                    arg_5=True,
                    arg_6=3.0,
                    arg_7=21,
                    arg_8=arg_9,
                    arg_10=None,
                    arg_11=1.0,
                    arg_12=300,
                    arg_13={'criterion':'mse',
                                    'oob_score':False,
                                    'n_jobs':-1}):
    '''This uses a `RandomForestRegressor` to de-correlate the given magseries.

    Parameters
    ----------

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

    externalparam_arrs : list of np.arrays
        This is a list of ndarrays of external parameters to decorrelate
        against. These should all be the same size as `times`, `mags`, `errs`.

    epdsmooth : bool
        If True, sets the training LC for the RandomForestRegress to be a
        smoothed version of the sigma-clipped light curve provided in `times`,
        `mags`, `errs`.

    epdsmooth_sigclip : float or int or sequence of two floats/ints or None
        This specifies how to sigma-clip the input LC before smoothing it and
        fitting the EPD function to it. The actual LC will not be sigma-clipped.

        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.

    rf_subsample : float
        Defines the fraction of the size of the `mags` array to use for
        training the random forest regressor.

    rf_ntrees : int
        This is the number of trees to use for the `RandomForestRegressor`.

    rf_extraprams : dict
        This is a dict of any extra kwargs to provide to the
        `RandomForestRegressor` instance used.

    Returns
    -------

    dict
        Returns a dict with decorrelated mags and the usual info from the
        `RandomForestRegressor`: variable importances, etc.

    '''

    # get finite times, mags, errs
    arg_14 = np.isfinite(arg_0) & np.isfinite(arg_1) & np.isfinite(arg_2)
    arg_15, arg_16, arg_17 = arg_0[::][arg_14], arg_1[::][arg_14], arg_2[::][arg_14]
    arg_18 = []
    for arg_19 in arg_3:
        arg_18.append(arg_19[::][arg_14])

    arg_20, arg_21, arg_22, arg_23 = sigclip_magseries_with_extparams(
        arg_0, arg_1, arg_2,
        arg_3,
        sigclip=arg_6,
        arg_4=arg_4
    )

    # smoothing is optional for RFR because we train on a fraction of the mag
    # series and so should not require a smoothed input to fit a function to
    if arg_5:

        # smooth the signal
        if isinstance(arg_10, dict):
            arg_24 = arg_8(arg_21,
                                          arg_7,
                                          **arg_10)
        else:
            arg_24 = arg_8(arg_21,
                                          arg_7)

    else:

        arg_24 = arg_21

    # set up the regressor
    if isinstance(arg_13, dict):
        arg_25 = RandomForestRegressor(n_estimators=arg_12,
                                    **arg_13)
    else:
        arg_25 = RandomForestRegressor(n_estimators=arg_12)

    # collect the features
    arg_26 = np.column_stack(arg_23)

    # fit, then generate the predicted values, then get corrected values

    # we fit on a randomly selected subsample of all the mags
    if arg_11 < 1.0:
        arg_27 = np.arange(arg_24.size)

        # these are sorted because time-order should be important
        arg_28 = np.sort(
            npr.choice(arg_27,
                       size=int(arg_11*arg_24.size),
                       replace=False)
        )
    else:
        arg_28 = np.arange(arg_24.size)

    arg_25.fit(arg_26[arg_28,:], arg_24[arg_28])

    # predict on the full feature set
    arg_29 = arg_25.predict(np.column_stack(arg_18))
    arg_30 = npmedian(arg_16) + arg_16 - arg_29

    arg_31 = {'times':arg_15,
               'mags':arg_30,
               'errs':arg_17,
               'feature_importances':arg_25.feature_importances_,
               'regressor':arg_25,
               'mags_median':npmedian(arg_30),
               'mags_mad':npmedian(npabs(arg_30 -
                                         npmedian(arg_30)))}

    return arg_31

This uses a RandomForestRegressor to de - correlate the given magseries .


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : arg_3 = { '$match' : { '$and' : [ { 'verb' : 'sanger' } , ] , } } if arg_1 : arg_3 [ '$match' ] [ '$and' ] . append ( { 'institute' : arg_1 } ) if arg_2 : arg_3 [ '$match' ] [ '$and' ] . append ( { 'user_id' : arg_2 } ) arg_4 = arg_0 . event_collection . aggregate ( [ arg_3 , { '$group' : { '_id' : "$case" , 'vars' : { '$addToSet' : '$variant_id' } } } ] ) Func = [ item for item in arg_4 ] return Func

def Func(arg_0, arg_1=None, arg_2=None):
        """Get all variants with validations ever ordered.

        Args:
            institute_id(str) : The id of an institute
            user_id(str) : The id of an user

        Returns:
            sanger_ordered(list) : a list of dictionaries, each with "case_id" as keys and list of variant ids as values
        """
        arg_3 = {'$match': {
                '$and': [
                    {'verb': 'sanger'},
                ],
            }}

        if arg_1:
            arg_3['$match']['$and'].append({'institute': arg_1})
        if arg_2:
            arg_3['$match']['$and'].append({'user_id': arg_2})

        # Get all sanger ordered variants grouped by case_id
        arg_4 = arg_0.event_collection.aggregate([
            arg_3,
            {'$group': {
                '_id': "$case",
                'vars': {'$addToSet' : '$variant_id'}
            }}
        ])

        Func =  [item for item in arg_4]
        return Func

Get all variants with validations ever ordered .


def Func(arg_0, arg_1, arg_2):
        """Checks whether a character matches set of arbitrary length. Assumes
        the code pointer is at the first member of the set."""
        arg_0.set_dispatcher.reset(arg_2)
        arg_3 = arg_1.code_position
        arg_4 = None
        while arg_4 is None:
            arg_4 = arg_0.set_dispatcher.dispatch(arg_1.peek_code(), arg_1)
        arg_1.code_position = arg_3
        return arg_4

Checks whether a character matches set of arbitrary length . Assumes the code pointer is at the first member of the set .


def Func ( arg_0 ) : arg_1 = arg_0 . __consume ( ) arg_0 . DXfield . add_comment ( arg_1 . value ( ) ) arg_0 . set_parser ( 'general' )

def Func(arg_0):
        """Level-1 parser for comments.

        pattern: #.*
        Append comment (with initial '# ' stripped) to all comments.
        """
        arg_1 = arg_0.__consume()
        arg_0.DXfield.add_comment(arg_1.value())
        arg_0.set_parser('general')


def Func ( arg_0 ) : arg_1 = open ( arg_0 ) arg_2 = json . load ( arg_1 ) [ "segments" ] arg_3 = [ ] arg_4 = [ ] for arg_5 in arg_2 : if not arg_5 [ "label" ] in arg_4 : arg_4 . append ( arg_5 [ "label" ] ) arg_3 . append ( len ( arg_4 ) - 1 ) else : arg_6 = np . where ( np . asarray ( arg_4 ) == arg_5 [ "label" ] ) [ 0 ] [ 0 ] arg_3 . append ( arg_6 ) arg_1 . close ( ) return np . asarray ( arg_3 )

def Func(arg_0):
    """Extracts the labels from a json file and puts them into
        an np array."""
    arg_1 = open(arg_0)
    arg_2 = json.load(arg_1)["segments"]
    arg_3 = []
    arg_4 = []
    for arg_5 in arg_2:
        if not arg_5["label"] in arg_4:
            arg_4.append(arg_5["label"])
            arg_3.append(len(arg_4)-1)
        else:
            arg_6 = np.where(np.asarray(arg_4) == arg_5["label"])[0][0]
            arg_3.append(arg_6)
    arg_1.close()
    return np.asarray(arg_3)

Extracts the labels from a json file and puts them into an np array .


def Func(arg_0, arg_1, arg_2, arg_3=1):
        # type: (str, float, float) -> None
        """Send a GaugeDelta metric to change a Gauge by the specified value"""

        if arg_0._should_send_metric(arg_1, arg_3):
            if not is_numeric(arg_2):
                arg_2 = float(arg_2)
            arg_0._request(
                GaugeDelta(
                    arg_0._create_metric_name_for_request(arg_1),
                    arg_2,
                    arg_3
                ).to_request()
            )


def Func ( arg_0 ) : arg_1 = chr ( arg_0 . SYSTEM_RESET ) arg_0 . pymata . transport . write ( arg_1 ) with arg_0 . pymata . data_lock : for arg_2 in range ( len ( arg_0 . digital_response_table ) ) : arg_0 . digital_response_table . pop ( ) for arg_2 in range ( len ( arg_0 . analog_response_table ) ) : arg_0 . analog_response_table . pop ( ) for arg_3 in range ( 0 , arg_0 . total_pins_discovered ) : arg_4 = [ arg_0 . pymata . INPUT , 0 , None ] arg_0 . digital_response_table . append ( arg_4 ) for arg_3 in range ( 0 , arg_0 . number_of_analog_pins_discovered ) : arg_4 = [ arg_0 . pymata . INPUT , 0 , None ] arg_0 . analog_response_table . append ( arg_4 )

def Func(arg_0):
        """
        Send the reset command to the Arduino.
        It resets the response tables to their initial values

        :return: No return value
        """
        arg_1 = chr(arg_0.SYSTEM_RESET)
        arg_0.pymata.transport.write(arg_1)

        # response table re-initialization
        # for each pin set the mode to input and the last read data value to zero
        with arg_0.pymata.data_lock:
            # remove all old entries from existing tables
            for arg_2 in range(len(arg_0.digital_response_table)):
                arg_0.digital_response_table.pop()

            for arg_2 in range(len(arg_0.analog_response_table)):
                arg_0.analog_response_table.pop()

            # reinitialize tables
            for arg_3 in range(0, arg_0.total_pins_discovered):
                arg_4 = [arg_0.pymata.INPUT, 0, None]
                arg_0.digital_response_table.append(arg_4)

            for arg_3 in range(0, arg_0.number_of_analog_pins_discovered):
                arg_4 = [arg_0.pymata.INPUT, 0, None]
                arg_0.analog_response_table.append(arg_4)

Send the reset command to the Arduino . It resets the response tables to their initial values


def Func ( arg_0 , arg_1 ) : arg_2 [ arg_1 ] = arg_0 arg_3 = sorted ( arg_2 . items ( ) , key = _key_func , reverse = True ) arg_4 [ : ] = [ k for ( k , v ) in arg_3 ] arg_5 [ : ] = [ k for ( k , v ) in arg_3 if v . _pyxmpp_sasl_secure ]

def Func(arg_0, arg_1):
    """Add a client authenticator class to `SERVER_MECHANISMS_D`,
    `SERVER_MECHANISMS` and, optionally, to `SECURE_SERVER_MECHANISMS`
    """
    # pylint: disable-msg=W0212
    arg_2[arg_1] = arg_0
    arg_3 = sorted(arg_2.items(), key = _key_func, reverse = True)
    arg_4[:] = [k for (k, v) in arg_3 ]
    arg_5[:] = [k for (k, v) in arg_3
                                                    if v._pyxmpp_sasl_secure]

Add a client authenticator class to SERVER_MECHANISMS_D SERVER_MECHANISMS and optionally to SECURE_SERVER_MECHANISMS


return self.select(lambda Z, N: (Z % 2) and not(N % 2), name=self.name)

def Func ( arg_0 ) : return arg_0 . select ( lambda Z , N : ( Z % 2 ) and not ( N % 2 ) , name = arg_0 . name )

def Func(arg_0):
        """
        Selects odd-even nuclei from the table
        """
        return arg_0.select(lambda Z, N: (Z % 2) and not(N % 2), name=arg_0.name)

Selects odd - even nuclei from the table


def Func ( arg_0 ) : arg_1 = { } arg_2 = LatexCommand ( 'newcommand' , { 'name' : 'name' , 'required' : True , 'bracket' : '{' } , { 'name' : 'content' , 'required' : True , 'bracket' : '{' } ) for arg_3 in arg_2 . parse ( arg_0 ) : arg_1 [ arg_3 [ 'name' ] ] = arg_3 [ 'content' ] return arg_1

def Func(arg_0):
    r"""Get all ``\newcommand`` macro definition from TeX source.

    Parameters
    ----------
    tex_source : `str`
        TeX source content.

    Returns
    -------
    macros : `dict`
        Keys are macro names (including leading ``\``) and values are the
        content (as `str`) of the macros.

    Notes
    -----
    ``\newcommand`` macros with arguments are not supported.
    """
    arg_1 = {}
    arg_2 = LatexCommand(
        'newcommand',
        {'name': 'name', 'required': True, 'bracket': '{'},
        {'name': 'content', 'required': True, 'bracket': '{'})

    for arg_3 in arg_2.parse(arg_0):
        arg_1[arg_3['name']] = arg_3['content']

    return arg_1

r Get all \ newcommand macro definition from TeX source .


def Func ( arg_0 , arg_1 ) : with cd ( arg_0 . rootdir ) : arg_2 = run ( arg_1 ) return arg_2

def Func(arg_0, arg_1):
    """
    Run a shell command within the repo's context

    Parameters
    ----------

    repo: Repository object
    args: Shell command
    """
    with cd(arg_0.rootdir):
        arg_2 = run(arg_1)
        return arg_2

Run a shell command within the repo s context


def Func(arg_0, arg_1, arg_2, arg_3=arg_4):
        """Set the input or output mode for a specified pin.  Mode should be
        either OUTPUT or INPUT.
        """
        arg_0.rpi_gpio.Func(arg_1, arg_0._dir_mapping[arg_2],
                            arg_3=arg_0._pud_mapping[arg_3])

Set the input or output mode for a specified pin . Mode should be either OUTPUT or INPUT .


def
Func
(
arg_0
)
:
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_6
=
urlparse
.
urlparse
(
arg_0
)
if
arg_2
.
endswith
(
':'
)
:
raise
httplib
.
InvalidURL
(
"nonnumeric port: ''"
)
if
arg_1
in
(
'http'
,
'https'
)
:
arg_7
,
arg_8
=
urllib2
.
splituser
(
arg_2
)
else
:
arg_7
=
if
arg_7
:
arg_7
=
"Basic "
+
_encode_auth
(
arg_7
)
arg_9
=
urlparse
.
urlunparse
(
(
arg_1
,
arg_8
,
arg_3
,
arg_4
,
arg_5
,
arg_6
)
)
arg_10
=
urllib2
.
Request
(
arg_9
)
arg_10
.
add_header
(
"Authorization"
,
arg_7
)
else
:
arg_10
=
urllib2
.
Request
(
arg_0
)
arg_10
.
add_header
(
'User-Agent'
,
user_agent
)
arg_11
=
urllib2
.
urlopen
(
arg_10
)
if
arg_7
:
arg_12
,
arg_13
,
arg_14
,
arg_15
,
arg_16
,
arg_17
=
urlparse
.
urlparse
(
arg_11
.
url
)
if
arg_12
==
arg_1
and
arg_13
==
arg_8
:
arg_11
.
url
=
urlparse
.
urlunparse
(
(
arg_12
,
arg_2
,
arg_14
,
arg_15
,
arg_16
,
arg_17
)
)
return
arg_11

def Func(arg_0):
    """Open a urllib2 request, handling HTTP authentication"""

    arg_1, arg_2, arg_3, arg_4, arg_5, arg_6 = urlparse.urlparse(arg_0)

    # Double scheme does not raise on Mac OS X as revealed by a
    # failing test. We would expect "nonnumeric port". Refs #20.
    if arg_2.endswith(':'):
        raise httplib.InvalidURL("nonnumeric port: ''")

    if arg_1 in ('http', 'https'):
        arg_7, arg_8 = urllib2.splituser(arg_2)
    else:
        arg_7 = None

    if arg_7:
        arg_7 = "Basic " + _encode_auth(arg_7)
        arg_9 = urlparse.urlunparse((arg_1,arg_8,arg_3,arg_4,arg_5,arg_6))
        arg_10 = urllib2.Request(arg_9)
        arg_10.add_header("Authorization", arg_7)
    else:
        arg_10 = urllib2.Request(arg_0)

    arg_10.add_header('User-Agent', user_agent)
    arg_11 = urllib2.urlopen(arg_10)

    if arg_7:
        # Put authentication info back into request URL if same host,
        # so that links found on the page will work
        arg_12, arg_13, arg_14, arg_15, arg_16, arg_17 = urlparse.urlparse(arg_11.url)
        if arg_12==arg_1 and arg_13==arg_8:
            arg_11.url = urlparse.urlunparse((arg_12,arg_2,arg_14,arg_15,arg_16,arg_17))

    return arg_11

Open a urllib2 request handling HTTP authentication


def Func ( arg_0 , arg_1 ) : if arg_0 . redirect is not None : arg_0 . redirect . Func ( arg_1 ) if six . PY2 : from xdoctest . utils . util_str import ensure_unicode arg_1 = ensure_unicode ( arg_1 ) super ( TeeStringIO , arg_0 ) . Func ( arg_1 )

def Func(arg_0, arg_1):
        """
        Write to this and the redirected stream
        """
        if arg_0.redirect is not None:
            arg_0.redirect.Func(arg_1)
        if six.PY2:
            from xdoctest.utils.util_str import ensure_unicode
            arg_1 = ensure_unicode(arg_1)
        super(TeeStringIO, arg_0).Func(arg_1)


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
is
not
:
if
'user-agent'
in
arg_0
:
arg_0
[
'user-agent'
]
=
(
arg_1
+
' '
+
arg_0
[
'user-agent'
]
)
else
:
arg_0
[
'user-agent'
]
=
arg_1
return
arg_0

def Func(arg_0, arg_1):
    """Adds a user-agent to the headers.

    Args:
        headers: dict, request headers to add / modify user
                 agent within.
        user_agent: str, the user agent to add.

    Returns:
        dict, the original headers passed in, but modified if the
        user agent is not None.
    """
    if arg_1 is not None:
        if 'user-agent' in arg_0:
            arg_0['user-agent'] = (arg_1 + ' ' + arg_0['user-agent'])
        else:
            arg_0['user-agent'] = arg_1

    return arg_0


(database: Database, archive_case: dict)

def Func ( arg_0 : arg_1 , arg_2 : arg_3 ) -> arg_3 : arg_4 = { 'collaborators' : arg_2 [ 'collaborators' ] , 'synopsis' : arg_2 . get ( 'synopsis' ) , 'assignees' : [ ] , 'suspects' : [ ] , 'causatives' : [ ] , 'phenotype_terms' : [ ] , 'phenotype_groups' : [ ] , } if arg_2 . get ( 'assignee' ) : arg_5 = arg_0 . user . find_one ( { '_id' : arg_2 [ 'assignee' ] } ) arg_4 [ 'assignee' ] . append ( arg_5 [ 'email' ] ) for arg_6 in [ 'suspects' , 'causatives' ] : for arg_7 in arg_2 . get ( arg_6 , [ ] ) : arg_8 = arg_0 . variant . find_one ( { '_id' : arg_7 } ) arg_4 [ arg_6 ] . append ( { 'chromosome' : arg_8 [ 'chromosome' ] , 'position' : arg_8 [ 'position' ] , 'reference' : arg_8 [ 'reference' ] , 'alternative' : arg_8 [ 'alternative' ] , 'variant_type' : arg_8 [ 'variant_type' ] , } ) for arg_6 in [ 'phenotype_terms' , 'phenotype_groups' ] : for arg_9 in arg_2 . get ( arg_6 , [ ] ) : arg_4 [ arg_6 ] . append ( { 'phenotype_id' : arg_9 [ 'phenotype_id' ] , 'feature' : arg_9 [ 'feature' ] , } ) return arg_4

def Func(arg_0: arg_1, arg_2: arg_3) -> arg_3:
    """Get information about a case from archive."""
    arg_4 = {
        'collaborators': arg_2['collaborators'],
        'synopsis': arg_2.get('synopsis'),
        'assignees': [],
        'suspects': [],
        'causatives': [],
        'phenotype_terms': [],
        'phenotype_groups': [],
    }
    if arg_2.get('assignee'):
        arg_5 = arg_0.user.find_one({'_id': arg_2['assignee']})
        arg_4['assignee'].append(arg_5['email'])

    for arg_6 in ['suspects', 'causatives']:
        for arg_7 in arg_2.get(arg_6, []):
            arg_8 = arg_0.variant.find_one({'_id': arg_7})
            arg_4[arg_6].append({
                'chromosome': arg_8['chromosome'],
                'position': arg_8['position'],
                'reference': arg_8['reference'],
                'alternative': arg_8['alternative'],
                'variant_type': arg_8['variant_type'],
            })

    for arg_6 in ['phenotype_terms', 'phenotype_groups']:
        for arg_9 in arg_2.get(arg_6, []):
            arg_4[arg_6].append({
                'phenotype_id': arg_9['phenotype_id'],
                'feature': arg_9['feature'],
            })

    return arg_4

Get information about a case from archive .


def Func(arg_0):
  """Set up log, process and signal handlers"""
  # pylint: disable=unused-argument
  def signal_handler(arg_1, arg_2):
    # We would do nothing here but just exit
    # Just catch the SIGTERM and then cleanup(), registered with atexit, would invoke
    Log.info('signal_handler invoked with signal %s', arg_1)
    arg_0.stop_state_manager_watches()
    sys.exit(arg_1)

  def cleanup():
    """Handler to trigger when receiving the SIGTERM signal
    Do cleanup inside this method, including:
    1. Terminate all children processes
    """
    Log.info('Executor terminated; exiting all process in executor.')

    # Kill child processes first and wait for log collection to finish
    for arg_3 in arg_0.processes_to_monitor.keys():
      os.kill(arg_3, signal.SIGTERM)
    time.sleep(5)

    # We would not wait or check whether process spawned dead or not
    os.killpg(0, signal.SIGTERM)

  # Redirect stdout and stderr to files in append mode
  # The filename format is heron-executor-<container_id>.stdxxx
  arg_4 = arg_0.shard
  log.configure(logfile='heron-executor-%s.stdout' % arg_4)

  arg_3 = os.getpid()
  arg_5 = os.getsid(arg_3)

  # POSIX prohibits the change of the process group ID of a session leader
  if arg_3 <> arg_5:
    Log.info('Set up process group; executor becomes leader')
    os.setpgrp() # create new process group, become its leader

  Log.info('Register the SIGTERM signal handler')
  signal.signal(signal.SIGTERM, signal_handler)

  Log.info('Register the atexit clean up')
  atexit.register(cleanup)


return lambda: seq[bisect.bisect(totals, random.uniform(0, totals[-1]))]

def Func ( arg_0 , arg_1 ) : arg_2 = [ ] for arg_3 in arg_1 : arg_2 . append ( arg_3 + arg_2 [ - 1 ] if arg_2 else arg_3 ) return lambda : arg_0 [ bisect . bisect ( arg_2 , random . uniform ( 0 , arg_2 [ - 1 ] ) ) ]

def Func(arg_0, arg_1):
    "Return a random-sample function that picks from seq weighted by weights."
    arg_2 = []
    for arg_3 in arg_1:
        arg_2.append(arg_3 + arg_2[-1] if arg_2 else arg_3)
    return lambda: arg_0[bisect.bisect(arg_2, random.uniform(0, arg_2[-1]))]

Return a random - sample function that picks from seq weighted by weights .


def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
True
)
:
from
IPython
.
core
.
pylabtools
import
mpl_runner
arg_3
=
{
}
try
:
arg_1
=
pylab_activate
(
arg_3
,
arg_1
,
arg_2
,
arg_0
)
except
KeyError
:
error
(
"Backend %r not supported"
%
arg_1
)
return
arg_0
.
user_ns
.
update
(
arg_3
)
arg_0
.
user_ns_hidden
.
update
(
arg_3
)
arg_0
.
enable_gui
(
arg_1
)
arg_0
.
magics_manager
.
registry
[
'ExecutionMagics'
]
.
default_runner
=
mpl_runner
(
arg_0
.
safe_execfile
)

def Func(arg_0, arg_1=None, arg_2=True):
        """Activate pylab support at runtime.

        This turns on support for matplotlib, preloads into the interactive
        namespace all of numpy and pylab, and configures IPython to correctly
        interact with the GUI event loop.  The GUI backend to be used can be
        optionally selected with the optional :param:`gui` argument.

        Parameters
        ----------
        gui : optional, string

          If given, dictates the choice of matplotlib GUI backend to use
          (should be one of IPython's supported backends, 'qt', 'osx', 'tk',
          'gtk', 'wx' or 'inline'), otherwise we use the default chosen by
          matplotlib (as dictated by the matplotlib build-time options plus the
          user's matplotlibrc configuration file).  Note that not all backends
          make sense in all contexts, for example a terminal ipython can't
          display figures inline.
        """
        from IPython.core.pylabtools import mpl_runner
        # We want to prevent the loading of pylab to pollute the user's
        # namespace as shown by the %who* magics, so we execute the activation
        # code in an empty namespace, and we update *both* user_ns and
        # user_ns_hidden with this information.
        arg_3 = {}
        try:
            arg_1 = pylab_activate(arg_3, arg_1, arg_2, arg_0)
        except KeyError:
            error("Backend %r not supported" % arg_1)
            return
        arg_0.user_ns.update(arg_3)
        arg_0.user_ns_hidden.update(arg_3)
        # Now we must activate the gui pylab wants to use, and fix %run to take
        # plot updates into account
        arg_0.enable_gui(arg_1)
        arg_0.magics_manager.registry['ExecutionMagics'].default_runner = \
        mpl_runner(arg_0.safe_execfile)


def Func(arg_0):
        """Calculate scene bbox"""
        arg_1, arg_2 = None, None
        for arg_3 in arg_0.root_nodes:
            arg_1, arg_2 = arg_3.calc_global_bbox(
                matrix44.create_identity(),
                arg_1,
                arg_2
            )

        arg_0.bbox_min = arg_1
        arg_0.bbox_max = arg_2

        arg_0.diagonal_size = vector3.length(arg_0.bbox_max - arg_0.bbox_min)


def Func ( arg_0 , arg_1 ) : arg_0 . lock . acquire ( ) try : arg_0 . __logger . debug ( "Authenticated" ) arg_0 . authenticated = True arg_0 . state_change ( "authorized" , arg_0 . my_jid ) arg_0 . _post_auth ( ) finally : arg_0 . lock . release ( )

def Func(arg_0, arg_1):
        """Handle success of the legacy authentication."""
        arg_0.lock.acquire()
        try:
            arg_0.__logger.debug("Authenticated")
            arg_0.authenticated=True
            arg_0.state_change("authorized",arg_0.my_jid)
            arg_0._post_auth()
        finally:
            arg_0.lock.release()

Handle success of the legacy authentication .


def Func ( arg_0 ) : arg_1 = arg_0 . read ( ) arg_0 . seek ( 0 ) arg_2 = hashlib . new ( 'sha1' , arg_1 ) . hexdigest ( ) return arg_2

def Func(arg_0):
    """Return the SHA1 hash of the given a file-like object as ``file``.
    This will seek the file back to 0 when it's finished.

    """
    arg_1 = arg_0.read()
    arg_0.seek(0)
    arg_2 = hashlib.new('sha1', arg_1).hexdigest()
    return arg_2

Return the SHA1 hash of the given a file - like object as file . This will seek the file back to 0 when it s finished .