(annotation, sr=22050, length=None, **kwargs)

return filter_kwargs(mir_eval.sonify.time_frequency,
                         gram, pitches, intervals,
                         sr, length=length, **kwargs)

def Func ( arg_0 , arg_1 = 22050 , arg_2 = None , ** arg_3 ) : arg_4 , arg_5 = arg_0 . to_interval_values ( ) arg_6 = { arg_9 : idx for idx , arg_9 in enumerate ( np . unique ( arg_5 ) ) } arg_7 = np . zeros ( ( len ( arg_6 ) , len ( arg_4 ) ) ) for arg_8 , arg_9 in enumerate ( arg_5 ) : arg_7 [ arg_6 [ arg_9 ] , arg_8 ] = 1 return filter_kwargs ( mir_eval . sonify . time_frequency , arg_7 , arg_5 , arg_4 , arg_1 , arg_2 = arg_2 , ** arg_3 )

def Func(arg_0, arg_1=22050, arg_2=None, **arg_3):
    '''Sonify a piano-roll

    This uses mir_eval.sonify.time_frequency, and is appropriate
    for sparse transcription data, e.g., annotations in the `note_midi`
    namespace.
    '''

    arg_4, arg_5 = arg_0.to_interval_values()

    # Construct the pitchogram
    arg_6 = {arg_9: idx for idx, arg_9 in enumerate(np.unique(arg_5))}

    arg_7 = np.zeros((len(arg_6), len(arg_4)))

    for arg_8, arg_9 in enumerate(arg_5):
        arg_7[arg_6[arg_9], arg_8] = 1

    return filter_kwargs(mir_eval.sonify.time_frequency,
                         arg_7, arg_5, arg_4,
                         arg_1, arg_2=arg_2, **arg_3)


def
Func
(
arg_0
,
arg_1
=
''
)
:
arg_2
=
[
row
[
'lat'
]
for
row
in
arg_0
]
arg_3
=
[
row
[
'lon'
]
for
row
in
arg_0
]
print
(
'COORDS'
+
'-'
*
5
)
print
(
"%slat, %slon = %r, %r"
%
(
arg_1
,
arg_1
,
arg_2
,
arg_3
)
)
print
(
'-'
*
5
)

def Func(arg_0, arg_1=''):
    """Print coordinates within a sequence.

    This is only used for debugging.  Printed in a form that can be
    pasted into Python for visualization."""
    arg_2 = [row['lat'] for row in arg_0]
    arg_3 = [row['lon'] for row in arg_0]
    print('COORDS'+'-' * 5)
    print("%slat, %slon = %r, %r" % (arg_1, arg_1, arg_2, arg_3))
    print('-'*5)


def Func ( arg_0 ) : if '#' in arg_0 : arg_1 , arg_2 , arg_3 , arg_4 , arg_5 , arg_6 = urlparse ( arg_0 ) arg_7 = urlunparse ( ( arg_1 , arg_2 , arg_3 , arg_4 , arg_5 , '' ) ) return arg_7 , arg_6 else : return arg_0 , ''

def Func(arg_0):
    """Removes any existing fragment from URL.

    Returns a tuple of the defragmented URL and the fragment.  If
    the URL contained no fragments, the second element is the
    empty string.
    """
    if '#' in arg_0:
        arg_1, arg_2, arg_3, arg_4, arg_5, arg_6 = urlparse(arg_0)
        arg_7 = urlunparse((arg_1, arg_2, arg_3, arg_4, arg_5, ''))
        return arg_7, arg_6
    else:
        return arg_0, ''

Removes any existing fragment from URL .


def Func(arg_0):
        """This is a temporary patch pending a fix in uAMQP."""
        # pylint: disable=protected-access
        arg_0._handler.message_handler = arg_0._handler.receiver_type(
            arg_0._handler._session,
            arg_0._handler._remote_address,
            arg_0._handler._name,
            on_message_received=arg_0._handler._message_received,
            name='receiver-link-{}'.format(uuid.uuid4()),
            debug=arg_0._handler._debug_trace,
            prefetch=arg_0._handler._prefetch,
            max_message_size=arg_0._handler._max_message_size,
            properties=arg_0._handler._link_properties,
            error_policy=arg_0._handler._error_policy,
            encoding=arg_0._handler._encoding)
        if arg_0.mode != ReceiveSettleMode.PeekLock:
            arg_0._handler.message_handler.send_settle_mode = constants.SenderSettleMode.Settled
            arg_0._handler.message_handler.receive_settle_mode = constants.ReceiverSettleMode.ReceiveAndDelete
            arg_0._handler.message_handler._settle_mode = constants.ReceiverSettleMode.ReceiveAndDelete
        arg_0._handler.message_handler.open()

This is a temporary patch pending a fix in uAMQP .


def
Func
(
arg_0
)
:
arg_0
.
log
.
debug
(
'Cleaning faulty perms'
)
arg_1
=
arg_0
.
get_session
arg_2
=
(
arg_1
.
query
(
sqla_models
.
PermissionView
)
.
filter
(
or_
(
sqla_models
.
PermissionView
.
permission
==
,
sqla_models
.
PermissionView
.
view_menu
==
,
)
)
)
arg_3
=
arg_2
.
delete
(
)
arg_1
.
commit
(
)
if
arg_3
:
arg_0
.
log
.
info
(
'Deleted %s faulty permissions'
,
arg_3
)

def Func(arg_0):
        """
        FAB leaves faulty permissions that need to be cleaned up
        """
        arg_0.log.debug('Cleaning faulty perms')
        arg_1 = arg_0.get_session
        arg_2 = (
            arg_1.query(sqla_models.PermissionView)
            .filter(or_(
                sqla_models.PermissionView.permission == None,  # NOQA
                sqla_models.PermissionView.view_menu == None,  # NOQA
            ))
        )
        arg_3 = arg_2.delete()
        arg_1.commit()
        if arg_3:
            arg_0.log.info('Deleted %s faulty permissions', arg_3)


def Func ( arg_0 , arg_1 , arg_2 ) : if not arg_0 . created_date_set : arg_0 . created_date_set = True arg_4 = utils . datetime_from_iso_format ( arg_2 ) if arg_4 is not None : arg_1 . creation_info . created = arg_4 return True else : raise SPDXValueError ( 'CreationInfo::Date' ) else : raise CardinalityError ( 'CreationInfo::Created' )

def Func(arg_0, arg_1, arg_2):
        """Sets created date, Raises CardinalityError if
        created date already set.
        Raises SPDXValueError if created is not a date.
        """
        if not arg_0.created_date_set:
            arg_0.created_date_set = True
            arg_4 = utils.datetime_from_iso_format(arg_2)
            if arg_4 is not None:
                arg_1.creation_info.created = arg_4
                return True
            else:
                raise SPDXValueError('CreationInfo::Date')
        else:
            raise CardinalityError('CreationInfo::Created')

Sets created date Raises CardinalityError if created date already set . Raises SPDXValueError if created is not a date .


def
Func
(
arg_0
,
arg_1
,
*
arg_2
,
**
arg_3
)
:
if
not
arg_0
.
isopen
:
arg_4
=
logging
.
getLogger
(
__name__
)
arg_4
.
warning
(
'the drop box is not open'
)
return
arg_5
=
TaskPackage
(
arg_1
=
arg_1
,
arg_2
=
arg_2
,
arg_3
=
arg_3
)
return
arg_0
.
dropbox
.
Func
(
arg_5
)

def Func(arg_0, arg_1, *arg_2, **arg_3):
        """Func a task and its arguments

        If you need to Func multiple tasks, it can be faster to Func
        multiple tasks with `Func_multiple()` than to use this method
        multiple times.

        Parameters
        ----------
        task : a function
            A function to be executed
        args : list
            A list of positional arguments to the `task`
        kwargs : dict
            A dict with keyword arguments to the `task`

        Returns
        -------
        int, str, or any hashable and sortable
            A task ID. IDs are sortable in the order in which the
            corresponding tasks are Func.

        """
        if not arg_0.isopen:
            arg_4 = logging.getLogger(__name__)
            arg_4.warning('the drop box is not open')
            return
        arg_5 = TaskPackage(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)
        return arg_0.dropbox.Func(arg_5)

put a task and its arguments

        If you need to put multiple tasks, it can be faster to put
        multiple tasks with `put_multiple()` than to use this method
        multiple times.

        Parameters
        ----------
        task : a function
            A function to be executed
        args : list
            A list of positional arguments to the `task`
        kwargs : dict
            A dict with keyword arguments to the `task`

        Returns
        -------
        int, str, or any hashable and sortable
            A task ID. IDs are sortable in the order in which the
            corresponding tasks are put.


def Func(arg_0):
    """Get the property node for the given setter node.

    :param node: The node to get the property for.
    :type node: astroid.FunctionDef

    :rtype: astroid.FunctionDef or None
    :returns: The node relating to the property of the given setter node,
        or None if one could not be found.
    """
    arg_1 = None

    arg_2 = Func_name(arg_0)
    arg_3 = utils.node_frame_class(arg_0)
    if arg_2 and arg_3:
        arg_4 = arg_3.getattr(arg_0.name)
        for arg_5 in arg_4:
            if utils.decorated_with_property(arg_5):
                arg_1 = arg_5
                break

    return arg_1

Get the property node for the given setter node .


def Func ( arg_0 ) : arg_1 = { 'client_id' : arg_0 . client_id , 'redirect_uri' : quote ( arg_0 . redirect_uri ) , } if arg_0 . scope is not None : arg_1 [ 'scope' ] = quote ( arg_0 . scope ) if arg_0 . state is not None : arg_1 [ 'state' ] = arg_0 . state return arg_1

def Func(arg_0):
        """Attributes used when constructing url parameters."""
        arg_1 = {
            'client_id': arg_0.client_id,
            'redirect_uri': quote(arg_0.redirect_uri),
        }

        if arg_0.scope is not None:
            arg_1['scope'] = quote(arg_0.scope)

        if arg_0.state is not None:
            arg_1['state'] = arg_0.state

        return arg_1

Attributes used when constructing url parameters .


def Func(arg_0, arg_1):
    """
    Return number of `ch` characters at the start of `line`.

    Example:

    >>> Func('   abc', ' ')
    3
    """

    arg_2, arg_3 = 0, len(arg_0)
    while arg_2 < arg_3 and arg_0[arg_2] == arg_1:
        arg_2 += 1
    return arg_2

Return number of `ch` characters at the start of `line`.

    Example:

    >>> _count_leading('   abc', ' ')
    3

Return number of ch characters at the start of line .


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_0 == 'future' : arg_3 = 1 - ( 1. / ( 1 + arg_1 ) ) else : arg_3 = 0 def _sample_her_transitions ( arg_4 , arg_5 ) : arg_6 = arg_4 [ 'u' ] . shape [ 1 ] arg_7 = arg_4 [ 'u' ] . shape [ 0 ] arg_8 = arg_5 arg_9 = np . random . randint ( 0 , arg_7 , arg_8 ) arg_10 = np . random . randint ( arg_6 , size = arg_8 ) arg_11 = { arg_17 : arg_4 [ arg_17 ] [ arg_9 , arg_10 ] . copy ( ) for arg_17 in arg_4 . keys ( ) } arg_12 = np . where ( np . random . uniform ( size = arg_8 ) < arg_3 ) arg_13 = np . random . uniform ( size = arg_8 ) * ( arg_6 - arg_10 ) arg_13 = arg_13 . astype ( int ) arg_14 = ( arg_10 + 1 + arg_13 ) [ arg_12 ] arg_15 = arg_4 [ 'ag' ] [ arg_9 [ arg_12 ] , arg_14 ] arg_11 [ 'g' ] [ arg_12 ] = arg_15 arg_16 = { } for arg_17 , arg_18 in arg_11 . items ( ) : if arg_17 . startswith ( 'info_' ) : arg_16 [ arg_17 . replace ( 'info_' , '' ) ] = arg_18 arg_20 = { k : arg_11 [ k ] for k in [ 'ag_2' , 'g' ] } arg_20 [ 'info' ] = arg_16 arg_11 [ 'r' ] = arg_2 ( ** arg_20 ) arg_11 = { k : arg_11 [ k ] . reshape ( arg_8 , * arg_11 [ k ] . shape [ 1 : ] ) for k in arg_11 . keys ( ) } assert ( arg_11 [ 'u' ] . shape [ 0 ] == arg_5 ) return arg_11 return _sample_her_transitions

def Func(arg_0, arg_1, arg_2):
    """Creates a sample function that can be used for HER experience replay.

    Args:
        replay_strategy (in ['future', 'none']): the HER replay strategy; if set to 'none',
            regular DDPG experience replay is used
        replay_k (int): the ratio between HER replays and regular replays (e.g. k = 4 -> 4 times
            as many HER replays as regular replays are used)
        reward_fun (function): function to re-compute the reward with substituted goals
    """
    if arg_0 == 'future':
        arg_3 = 1 - (1. / (1 + arg_1))
    else:  # 'replay_strategy' == 'none'
        arg_3 = 0

    def _sample_her_transitions(arg_4, arg_5):
        """episode_batch is {key: array(buffer_size x T x dim_key)}
        """
        arg_6 = arg_4['u'].shape[1]
        arg_7 = arg_4['u'].shape[0]
        arg_8 = arg_5

        # Select which episodes and time steps to use.
        arg_9 = np.random.randint(0, arg_7, arg_8)
        arg_10 = np.random.randint(arg_6, size=arg_8)
        arg_11 = {arg_17: arg_4[arg_17][arg_9, arg_10].copy()
                       for arg_17 in arg_4.keys()}

        # Select future time indexes proportional with probability future_p. These
        # will be used for HER replay by substituting in future goals.
        arg_12 = np.where(np.random.uniform(size=arg_8) < arg_3)
        arg_13 = np.random.uniform(size=arg_8) * (arg_6 - arg_10)
        arg_13 = arg_13.astype(int)
        arg_14 = (arg_10 + 1 + arg_13)[arg_12]

        # Replace goal with achieved goal but only for the previously-selected
        # HER transitions (as defined by her_indexes). For the other transitions,
        # keep the original goal.
        arg_15 = arg_4['ag'][arg_9[arg_12], arg_14]
        arg_11['g'][arg_12] = arg_15

        # Reconstruct info dictionary for reward  computation.
        arg_16 = {}
        for arg_17, arg_18 in arg_11.items():
            if arg_17.startswith('info_'):
                arg_16[arg_17.replace('info_', '')] = arg_18

        # Re-compute reward since we may have substituted the goal.
        arg_20 = {k: arg_11[k] for k in ['ag_2', 'g']}
        arg_20['info'] = arg_16
        arg_11['r'] = arg_2(**arg_20)

        arg_11 = {k: arg_11[k].reshape(arg_8, *arg_11[k].shape[1:])
                       for k in arg_11.keys()}

        assert(arg_11['u'].shape[0] == arg_5)

        return arg_11

    return _sample_her_transitions

Creates a sample function that can be used for HER experience replay .


async def Func(arg_0, arg_1=None):
        """Update the timestamp of the latest event which has been read.

        This method will avoid making an API request if it will have no effect.

        Args:
            read_timestamp (datetime.datetime): (optional) Timestamp to set.
                Defaults to the timestamp of the newest event.

        Raises:
            .NetworkError: If the timestamp cannot be updated.
        """
        if arg_1 is None:
            arg_1 = (arg_0.events[-1].timestamp if arg_0.events else
                              datetime.datetime.now(datetime.timezone.utc))
        if arg_1 > arg_0.latest_read_timestamp:
            logger.info(
                'Setting {} latest_read_timestamp from {} to {}'
                .format(arg_0.id_, arg_0.latest_read_timestamp, arg_1)
            )
            # Prevent duplicate requests by updating the conversation now.
            arg_2 = arg_0._conversation.self_conversation_state
            arg_2.self_read_state.latest_read_timestamp = (
                parsers.to_timestamp(arg_1)
            )
            try:
                await arg_0._client.update_watermark(
                    hangouts_pb2.UpdateWatermarkRequest(
                        request_header=arg_0._client.get_request_header(),
                        conversation_id=hangouts_pb2.ConversationId(
                            id=arg_0.id_
                        ),
                        last_read_timestamp=parsers.to_timestamp(
                            arg_1
                        ),
                    )
                )
            except exceptions.NetworkError as e:
                logger.warning('Failed to update read timestamp: {}'.format(e))
                raise

Update the timestamp of the latest event which has been read .


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
in
arg_0
.
exclude_dirs
:
log
.
debug
(
"excluded: %s"
%
arg_1
)
return
False
else
:
return

def Func(arg_0, arg_1):
        """Check if directory is eligible for test discovery"""
        if arg_1 in arg_0.exclude_dirs:
            log.debug("excluded: %s" % arg_1)
            return False
        else:
            return None


Parse the command line and start PyJFuzz

def Func ( arg_0 ) : from . pjf_worker import PJFWorker arg_1 = PJFWorker ( arg_0 ) if arg_0 . update_pjf : arg_1 . update_library ( ) elif arg_0 . browser_auto : arg_1 . browser_autopwn ( ) elif arg_0 . fuzz_web : arg_1 . web_fuzzer ( ) elif arg_0 . json : if not arg_0 . web_server and not arg_0 . ext_fuzz and not arg_0 . cmd_fuzz : arg_1 . fuzz ( ) elif arg_0 . ext_fuzz : if arg_0 . stdin : arg_1 . fuzz_stdin ( ) else : arg_1 . fuzz_command_line ( ) elif arg_0 . cmd_fuzz : if arg_0 . stdin : arg_1 . fuzz_external ( True ) else : arg_1 . fuzz_external ( ) else : arg_1 . Func_http_server ( ) elif arg_0 . json_file : arg_1 . Func_file_fuzz ( ) elif arg_0 . process_to_monitor : arg_1 . Func_process_monitor ( )

def Func(arg_0):
        """
        Parse the command line and Func PyJFuzz
        """
        from .pjf_worker import PJFWorker
        arg_1 = PJFWorker(arg_0)
        if arg_0.update_pjf:
            arg_1.update_library()
        elif arg_0.browser_auto:
            arg_1.browser_autopwn()
        elif arg_0.fuzz_web:
            arg_1.web_fuzzer()
        elif arg_0.json:
            if not arg_0.web_server and not arg_0.ext_fuzz and not arg_0.cmd_fuzz:
                arg_1.fuzz()
            elif arg_0.ext_fuzz:
                if arg_0.stdin:
                    arg_1.fuzz_stdin()
                else:
                    arg_1.fuzz_command_line()
            elif arg_0.cmd_fuzz:
                if arg_0.stdin:
                    arg_1.fuzz_external(True)
                else:
                    arg_1.fuzz_external()
            else:
                arg_1.Func_http_server()
        elif arg_0.json_file:
            arg_1.Func_file_fuzz()
        elif arg_0.process_to_monitor:
            arg_1.Func_process_monitor()


def Func ( arg_0 , arg_1 ) : arg_1 = arg_1 . rstrip ( '\n' ) if arg_1 != arg_0 . source : arg_0 . source = arg_1 arg_2 = base64 . b64encode ( bytes ( bytearray ( arg_1 , "ascii" ) ) ) arg_0 . send_command ( CMD_LOAD_BASE64 , arg_2 )

def Func(arg_0, arg_1):
        """
        Send new source code to the bot

        :param source:
        :param good_cb: callback called if code was good
        :param bad_cb: callback called if code was bad (will get contents of exception)
        :return:
        """
        arg_1 = arg_1.rstrip('\n')
        if arg_1 != arg_0.source:
            arg_0.source = arg_1
            arg_2 = base64.b64encode(bytes(bytearray(arg_1, "ascii")))
            arg_0.send_command(CMD_LOAD_BASE64, arg_2)


def Func ( arg_0 , arg_1 ) : for arg_2 in list ( arg_1 . keys ( ) ) : if arg_2 in arg_1 : if SparseResult . IDENTIFIER in arg_2 : arg_3 = arg_2 . split ( SparseResult . IDENTIFIER ) [ 0 ] arg_4 = arg_1 . pop ( arg_3 + SparseResult . IDENTIFIER + 'is_dia' ) arg_5 = SparseParameter . _get_name_list ( arg_4 ) arg_6 = [ '%s%s%s' % ( arg_3 , SparseResult . IDENTIFIER , name ) for name in arg_5 ] arg_7 = [ arg_1 . pop ( name ) for name in arg_6 ] arg_8 = SparseParameter . _reconstruct_matrix ( arg_7 ) arg_0 . _data [ arg_3 ] = arg_8 else : arg_0 . _data [ arg_2 ] = arg_1 [ arg_2 ]

def Func(arg_0, arg_1):
        """Loads data from `load_dict`

        Reconstruction of sparse matrices similar to the :class:`~pypet.parameter.SparseParameter`.

        """
        for arg_2 in list(arg_1.keys()):
            # We delete keys over time:
            if arg_2 in arg_1:
                if SparseResult.IDENTIFIER in arg_2:
                    arg_3 = arg_2.split(SparseResult.IDENTIFIER)[0]

                    arg_4 = arg_1.pop(arg_3 + SparseResult.IDENTIFIER + 'is_dia')

                    arg_5 = SparseParameter._get_name_list(arg_4)
                    arg_6 = ['%s%s%s' % (arg_3, SparseResult.IDENTIFIER, name)
                                   for name in arg_5]

                    arg_7 = [arg_1.pop(name) for name in arg_6]
                    arg_8 = SparseParameter._reconstruct_matrix(arg_7)
                    arg_0._data[arg_3] = arg_8
                else:
                    arg_0._data[arg_2] = arg_1[arg_2]


(self, keychr, modFlags=0, globally=False)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
0
,
arg_3
=
False
)
:
if
not
arg_1
:
return
if
not
hasattr
(
arg_0
,
'keyboard'
)
:
arg_0
.
keyboard
=
AXKeyboard
.
loadKeyboard
(
)
if
arg_1
in
arg_0
.
keyboard
[
'upperSymbols'
]
and
not
arg_2
:
arg_0
.
_sendKeyWithModifiers
(
arg_1
,
[
AXKeyCodeConstants
.
SHIFT
]
,
arg_3
)
return
if
arg_1
.
isupper
(
)
and
not
arg_2
:
arg_0
.
_sendKeyWithModifiers
(
arg_1
.
lower
(
)
,
[
AXKeyCodeConstants
.
SHIFT
]
,
arg_3
)
return
if
arg_1
not
in
arg_0
.
keyboard
:
arg_0
.
_clearEventQueue
(
)
raise
ValueError
(
'Key %s not found in keyboard layout'
%
arg_1
)
arg_5
=
Quartz
.
CGEventCreateKeyboardEvent
(
,
arg_0
.
keyboard
[
arg_1
]
,
True
)
arg_6
=
Quartz
.
CGEventCreateKeyboardEvent
(
,
arg_0
.
keyboard
[
arg_1
]
,
False
)
Quartz
.
CGEventSetFlags
(
arg_5
,
arg_2
)
Quartz
.
CGEventSetFlags
(
arg_6
,
arg_2
)
if
not
arg_3
:
arg_7
,
arg_8
,
arg_8
=
platform
.
mac_ver
(
)
arg_7
=
int
(
arg_7
.
split
(
'.'
)
[
1
]
)
if
arg_7
>
10
:
arg_9
=
arg_0
.
_getPid
(
)
arg_0
.
_queueEvent
(
Quartz
.
CGEventPostToPid
,
(
arg_9
,
arg_5
)
)
arg_0
.
_queueEvent
(
Quartz
.
CGEventPostToPid
,
(
arg_9
,
arg_6
)
)
else
:
arg_10
=
arg_0
.
_getPsnForPid
(
arg_0
.
_getPid
(
)
)
arg_0
.
_queueEvent
(
Quartz
.
CGEventPostToPSN
,
(
arg_10
,
arg_5
)
)
arg_0
.
_queueEvent
(
Quartz
.
CGEventPostToPSN
,
(
arg_10
,
arg_6
)
)
else
:
arg_0
.
_queueEvent
(
Quartz
.
CGEventPost
,
(
0
,
arg_5
)
)
arg_0
.
_queueEvent
(
Quartz
.
CGEventPost
,
(
0
,
arg_6
)
)

def Func(arg_0, arg_1, arg_2=0, arg_3=False):
        """Add keypress to queue.

        Parameters: key character or constant referring to a non-alpha-numeric
                    key (e.g. RETURN or TAB)
                    modifiers
                    global or app specific
        Returns: None or raise ValueError exception.
        """
        # Awkward, but makes modifier-key-only combinations possible
        # (since sendKeyWithModifiers() calls this)
        if not arg_1:
            return

        if not hasattr(arg_0, 'keyboard'):
            arg_0.keyboard = AXKeyboard.loadKeyboard()

        if arg_1 in arg_0.keyboard['upperSymbols'] and not arg_2:
            arg_0._sendKeyWithModifiers(arg_1,
                                       [AXKeyCodeConstants.SHIFT],
                                       arg_3)
            return

        if arg_1.isupper() and not arg_2:
            arg_0._sendKeyWithModifiers(
                arg_1.lower(),
                [AXKeyCodeConstants.SHIFT],
                arg_3
            )
            return

        if arg_1 not in arg_0.keyboard:
            arg_0._clearEventQueue()
            raise ValueError('Key %s not found in keyboard layout' % arg_1)

        # Press the key
        arg_5 = Quartz.CGEventCreateKeyboardEvent(None,
                                                    arg_0.keyboard[arg_1],
                                                    True)
        # Release the key
        arg_6 = Quartz.CGEventCreateKeyboardEvent(None,
                                                  arg_0.keyboard[arg_1],
                                                  False)
        # Set modflags on keyDown (default None):
        Quartz.CGEventSetFlags(arg_5, arg_2)
        # Set modflags on keyUp:
        Quartz.CGEventSetFlags(arg_6, arg_2)

        # Post the event to the given app
        if not arg_3:
            # To direct output to the correct application need the PSN (macOS <=10.10) or PID(macOS > 10.10):
            arg_7, arg_8, arg_8 = platform.mac_ver()
            arg_7 = int(arg_7.split('.')[1])
            if arg_7 > 10:
                arg_9 = arg_0._getPid()
                arg_0._queueEvent(Quartz.CGEventPostToPid, (arg_9, arg_5))
                arg_0._queueEvent(Quartz.CGEventPostToPid, (arg_9, arg_6))
            else:
                arg_10 = arg_0._getPsnForPid(arg_0._getPid())
                arg_0._queueEvent(Quartz.CGEventPostToPSN, (arg_10, arg_5))
                arg_0._queueEvent(Quartz.CGEventPostToPSN, (arg_10, arg_6))
        else:
            arg_0._queueEvent(Quartz.CGEventPost, (0, arg_5))
            arg_0._queueEvent(Quartz.CGEventPost, (0, arg_6))


def Func ( arg_0 , arg_1 , arg_2 = False ) : if not arg_2 : if arg_0 . tag == 'img' : yield ( 'img' , arg_0 . get ( 'src' ) , start_tag ( arg_0 ) ) else : yield start_tag ( arg_0 ) if arg_0 . tag in empty_tags and not arg_0 . text and not len ( arg_0 ) and not arg_0 . tail : return arg_3 = split_words ( arg_0 . text ) for arg_4 in arg_3 : yield html_escape ( arg_4 ) for arg_5 in arg_0 : for arg_6 in Func ( arg_5 , arg_1 = arg_1 ) : yield arg_6 if arg_0 . tag == 'a' and arg_0 . get ( 'href' ) and arg_1 : yield ( 'href' , arg_0 . get ( 'href' ) ) if not arg_2 : yield end_tag ( arg_0 ) arg_7 = split_words ( arg_0 . tail ) for arg_4 in arg_7 : yield html_escape ( arg_4 )

def Func(arg_0, arg_1, arg_2=False):
    """ Takes an lxml element el, and generates all the text chunks for
    that tag.  Each start tag is a chunk, each word is a chunk, and each
    end tag is a chunk.

    If skip_tag is true, then the outermost container tag is
    not returned (just its contents)."""
    if not arg_2:
        if arg_0.tag == 'img':
            yield ('img', arg_0.get('src'), start_tag(arg_0))
        else:
            yield start_tag(arg_0)
    if arg_0.tag in empty_tags and not arg_0.text and not len(arg_0) and not arg_0.tail:
        return
    arg_3 = split_words(arg_0.text)
    for arg_4 in arg_3:
        yield html_escape(arg_4)
    for arg_5 in arg_0:
        for arg_6 in Func(arg_5, arg_1=arg_1):
            yield arg_6
    if arg_0.tag == 'a' and arg_0.get('href') and arg_1:
        yield ('href', arg_0.get('href'))
    if not arg_2:
        yield end_tag(arg_0)
        arg_7 = split_words(arg_0.tail)
        for arg_4 in arg_7:
            yield html_escape(arg_4)

Takes an lxml element el and generates all the text chunks for that tag . Each start tag is a chunk each word is a chunk and each end tag is a chunk .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . api_request ( 'GET' , '/app-setups/%s' % arg_1 ) arg_3 = arg_2 . get ( 'status' ) if arg_3 == 'pending' : return False elif arg_3 == 'succeeded' : return True else : raise BuildError ( str ( arg_2 ) )

def Func(arg_0, arg_1):
        """Checks the status of an app-setups build.

        :param build_id: ID of the build to check.
        :returns: ``True`` if succeeded, ``False`` if pending.
        """
        arg_2 = arg_0.api_request('GET', '/app-setups/%s' % arg_1)

        arg_3 = arg_2.get('status')

        if arg_3 == 'pending':
            return False
        elif arg_3 == 'succeeded':
            return True
        else:
            raise BuildError(str(arg_2))

Checks the status of an app - setups build .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
True
)
:
arg_3
=
namesgenerator
.
get_sane_name
(
arg_1
.
name
)
if
not
arg_3
:
arg_3
=
namesgenerator
.
get_random_name
(
)
if
arg_0
.
collection
.
count_documents
(
{
'name'
:
arg_3
}
)
>
0
:
arg_3
=
namesgenerator
.
get_random_name
(
retry
=
True
)
if
arg_0
.
collection
.
count_documents
(
{
'name'
:
arg_3
}
)
>
0
:
if
arg_2
:
arg_0
.
collection
.
delete_one
(
{
'name'
:
arg_3
}
)
else
:
raise
Exception
(
"service name already registered."
)
arg_0
.
collection
.
insert_one
(
Service
(
arg_3
=
arg_3
,
url
=
baseurl
(
arg_1
.
url
)
,
type
=
arg_1
.
type
,
purl
=
arg_1
.
purl
,
public
=
arg_1
.
public
,
auth
=
arg_1
.
auth
,
verify
=
arg_1
.
verify
)
)
return
arg_0
.
fetch_by_name
(
arg_3
=
arg_3
)

def Func(arg_0, arg_1, arg_2=True):
        """
        Stores an OWS service in mongodb.
        """
        arg_3 = namesgenerator.get_sane_name(arg_1.name)
        if not arg_3:
            arg_3 = namesgenerator.get_random_name()
            if arg_0.collection.count_documents({'name': arg_3}) > 0:
                arg_3 = namesgenerator.get_random_name(retry=True)
        # check if service is already registered
        if arg_0.collection.count_documents({'name': arg_3}) > 0:
            if arg_2:
                arg_0.collection.delete_one({'name': arg_3})
            else:
                raise Exception("service name already registered.")
        arg_0.collection.insert_one(Service(
            arg_3=arg_3,
            url=baseurl(arg_1.url),
            type=arg_1.type,
            purl=arg_1.purl,
            public=arg_1.public,
            auth=arg_1.auth,
            verify=arg_1.verify))
        return arg_0.fetch_by_name(arg_3=arg_3)


def Func ( arg_0 , arg_1 ) : if hasattr ( arg_1 , "_handled" ) : return arg_1 . _handled = True if arg_1 . name in arg_1 . frame ( ) : arg_3 = arg_1 . frame ( ) else : arg_3 = arg_1 . root ( ) try : if not hasattr ( arg_3 , "locals_type" ) : if isinstance ( arg_3 , astroid . ClassDef ) : arg_0 . visit_classdef ( arg_3 ) elif isinstance ( arg_3 , astroid . FunctionDef ) : arg_0 . visit_functiondef ( arg_3 ) else : arg_0 . visit_module ( arg_3 ) arg_4 = arg_3 . locals_type [ arg_1 . name ] arg_5 = set ( arg_1 . infer ( ) ) arg_3 . locals_type [ arg_1 . name ] = list ( set ( arg_4 ) | arg_5 ) except astroid . InferenceError : pass

def Func(arg_0, arg_1):
        """visit an astroid.AssignName node

        handle locals_type
        """
        # avoid double parsing done by different Linkers.visit
        # running over the same project:
        if hasattr(arg_1, "_handled"):
            return
        arg_1._handled = True
        if arg_1.name in arg_1.frame():
            arg_3 = arg_1.frame()
        else:
            # the name has been defined as 'global' in the frame and belongs
            # there.
            arg_3 = arg_1.root()
        try:
            if not hasattr(arg_3, "locals_type"):
                # If the frame doesn't have a locals_type yet,
                # it means it wasn't yet visited. Visit it now
                # to add what's missing from it.
                if isinstance(arg_3, astroid.ClassDef):
                    arg_0.visit_classdef(arg_3)
                elif isinstance(arg_3, astroid.FunctionDef):
                    arg_0.visit_functiondef(arg_3)
                else:
                    arg_0.visit_module(arg_3)

            arg_4 = arg_3.locals_type[arg_1.name]
            arg_5 = set(arg_1.infer())
            arg_3.locals_type[arg_1.name] = list(set(arg_4) | arg_5)
        except astroid.InferenceError:
            pass


(
        src, requirements=None, local_package=None,
        config_file='config.yaml', profile_name=None,
)

def Func(
        arg_0, arg_1=None, arg_2=None,
        arg_3='config.yaml', arg_4=None,
):
    """Uploads a new function to AWS S3.

    :param str src:
        The path to your Lambda ready project (folder must contain a valid
        config.yaml and handler module (e.g.: service.py).
    :param str local_package:
        The path to a local package with should be included in the deploy as
        well (and/or is not available on PyPi)
    """
    # Load and parse the config file.
    arg_5 = os.path.join(arg_0, arg_3)
    arg_6 = read_cfg(arg_5, arg_4)

    # Copy all the pip dependencies required to run your code into a temporary
    # folder then add the handler file in the root of this directory.
    # Zip the contents of this folder into a single file and output to the dist
    # directory.
    arg_7 = build(
        arg_0, arg_3=arg_3, arg_1=arg_1,
        arg_2=arg_2,
    )

    Func_s3(arg_6, arg_7)


(self, filename, linenum=None, wait=True)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
True
)
:
Func
=
arg_0
.
editor
if
arg_2
is
or
Func
==
'notepad'
:
arg_5
=
''
else
:
arg_5
=
'+%d'
%
int
(
arg_2
)
if
' '
in
Func
and
os
.
path
.
isfile
(
Func
)
and
Func
[
0
]
!=
'"'
:
Func
=
'"%s"'
%
Func
arg_6
=
subprocess
.
Popen
(
'%s %s %s'
%
(
Func
,
arg_5
,
arg_1
)
,
shell
=
True
)
if
arg_3
and
arg_6
.
wait
(
)
!=
0
:
raise
TryNext
(
)

def Func(arg_0, arg_1, arg_2=None, arg_3=True):
    """Open the default editor at the given filename and linenumber.

    This is IPython's default editor hook, you can use it as an example to
    write your own modified one.  To set your own editor function as the
    new editor hook, call ip.set_hook('editor',yourfunc)."""

    # IPython configures a default editor at startup by reading $EDITOR from
    # the environment, and falling back on vi (unix) or notepad (win32).
    Func = arg_0.editor

    # marker for at which line to open the file (for existing objects)
    if arg_2 is None or Func=='notepad':
        arg_5 = ''
    else:
        arg_5 = '+%d' % int(arg_2)

    # Enclose in quotes if necessary and legal
    if ' ' in Func and os.path.isfile(Func) and Func[0] != '"':
        Func = '"%s"' % Func

    # Call the actual editor
    arg_6 = subprocess.Popen('%s %s %s' % (Func, arg_5, arg_1),
                            shell=True)
    if arg_3 and arg_6.wait() != 0:
        raise TryNext()

Open the default editor at the given filename and linenumber .


def
Func
(
)
:
arg_0
=
CommandHelper
(
)
arg_0
.
Func
(
"npm"
)
arg_0
=
CommandHelper
(
)
arg_0
.
Func
(
"nodejs-legacy"
)
arg_0
=
CommandHelper
(
)
arg_0
.
command
=
"npm Func -g retire"
arg_0
.
execute
(
)
if
arg_0
.
errors
:
from
termcolor
import
colored
print
colored
(
arg_0
.
errors
,
"red"
)
else
:
print
arg_0
.
output

def Func():
		"""
		Install all the dependences
		"""
		arg_0 = CommandHelper()
		arg_0.Func("npm")

		arg_0 = CommandHelper()
		arg_0.Func("nodejs-legacy")

		# Install retre with npm
		arg_0 = CommandHelper()
		arg_0.command = "npm Func -g retire"
		arg_0.execute()

		if arg_0.errors:
			from termcolor import colored
			print colored(arg_0.errors, "red")
		else:
			print arg_0.output


def Func(arg_0, arg_1, arg_2=None):
        """ Add a list of patches to the patches list """
        if arg_2 is None:
            arg_0.insert_patches(arg_1)
        else:
            arg_0._check_patch(arg_2)
            arg_3 = arg_0._patchlines_before(arg_2)
            arg_3.append(arg_0.patch2line[arg_2])
            for arg_4 in arg_1:
                arg_5 = PatchLine(arg_4)
                arg_3.append(arg_5)
                arg_0.patch2line[arg_5.get_patch()] = arg_5
            arg_3.extend(arg_0._patchlines_after(arg_2))
            arg_0.patchlines = arg_3


def Func ( arg_0 , arg_1 = 2 ) : arg_2 = arg_0 . copy ( ) arg_3 = bool_2_indices ( ~ arg_0 ) arg_4 = ( np . diff ( arg_3 ) >= arg_1 ) [ : , 0 ] if any ( arg_4 ) : if arg_3 [ arg_4 ] . shape [ 0 ] > 1 : arg_5 = arg_3 [ arg_4 ] [ 1 , 0 ] arg_2 [ arg_5 : ] = False return arg_2

def Func(arg_0, arg_1=2):
    """
    Exclude all data after the first excluded portion.

    This makes sense for spot measurements where, because
    of the signal mixing inherent in LA-ICPMS, once a
    contaminant is ablated, it will always be present to
    some degree in signals from further down the ablation
    pit.

    Parameters
    ----------
    filt : boolean array
    threshold : int

    Returns
    -------
    filter : boolean array
    """
    arg_2 = arg_0.copy()

    arg_3 = bool_2_indices(~arg_0)

    arg_4 = (np.diff(arg_3) >= arg_1)[:, 0]

    if any(arg_4):
        if arg_3[arg_4].shape[0] > 1:
            arg_5 = arg_3[arg_4][1, 0]
            arg_2[arg_5:] = False

    return arg_2

Exclude all data after the first excluded portion .


def Func ( arg_0 ) : arg_1 = getattr ( arg_0 , '_Func' , None ) if arg_1 is None : arg_1 = arg_0 . _Func = arg_0 . tenant . get_token ( ) return arg_1

def Func(arg_0):
        """The cached token of the current tenant."""
        arg_1 = getattr(arg_0, '_Func', None)
        if arg_1 is None:
            arg_1 = arg_0._Func = arg_0.tenant.get_token()
        return arg_1

The cached token of the current tenant .


return self._get_model(url, FullClan, timeout=timeout)

def Func ( arg_0 , arg_1 : arg_2 , arg_3 : arg_4 = None ) : arg_5 = arg_0 . api . CLAN + '/' + arg_1 return arg_0 . _get_model ( arg_5 , FullClan , arg_3 = arg_3 )

def Func(arg_0, arg_1: arg_2, arg_3: arg_4=None):
        """Get inforamtion about a clan

        Parameters
        ----------
        tag: str
            A valid tournament tag. Minimum length: 3
            Valid characters: 0289PYLQGRJCUV
        timeout: Optional[int] = None
            Custom timeout that overwrites Client.timeout
        """
        arg_5 = arg_0.api.CLAN + '/' + arg_1
        return arg_0._get_model(arg_5, FullClan, arg_3=arg_3)


return {name: _LSSTTEXMF_BIB_CACHE[name] for name in bibtex_names}

def
Func
(
arg_0
=
)
:
arg_1
=
logging
.
getLogger
(
__name__
)
if
arg_0
is
:
arg_2
=
KNOWN_LSSTTEXMF_BIB_NAMES
else
:
arg_2
=
[
]
for
arg_3
in
arg_0
:
arg_4
=
os
.
path
.
basename
(
os
.
path
.
splitext
(
arg_3
)
[
0
]
)
if
arg_4
not
in
KNOWN_LSSTTEXMF_BIB_NAMES
:
arg_1
.
warning
(
'%r is not a known lsst-texmf bib file'
,
arg_4
)
continue
arg_2
.
append
(
arg_4
)
arg_5
=
[
arg_4
for
arg_4
in
arg_2
if
arg_4
not
in
arg_9
]
if
len
(
arg_5
)
>
0
:
arg_6
=
asyncio
.
get_event_loop
(
)
arg_7
=
asyncio
.
ensure_future
(
_download_lsst_bibtex
(
arg_5
)
)
arg_6
.
run_until_complete
(
arg_7
)
for
arg_4
,
arg_8
in
zip
(
arg_2
,
arg_7
.
result
(
)
)
:
arg_9
[
arg_4
]
=
arg_8
return
{
arg_4
:
arg_9
[
arg_4
]
for
arg_4
in
arg_2
}

def Func(arg_0=None):
    """Get content of lsst-texmf bibliographies.

    BibTeX content is downloaded from GitHub (``master`` branch of
    https://github.com/lsst/lsst-texmf or retrieved from an in-memory cache.

    Parameters
    ----------
    bibtex_filenames : sequence of `str`, optional
        List of lsst-texmf BibTeX files to retrieve. These can be the filenames
        of lsst-bibtex files (for example, ``['lsst.bib', 'lsst-dm.bib']``)
        or names without an extension (``['lsst', 'lsst-dm']``). The default
        (recommended) is to get *all* lsst-texmf bibliographies:

        .. code-block:: python

           ['lsst', 'lsst-dm', 'refs', 'books', 'refs_ads']

    Returns
    -------
    bibtex : `dict`
        Dictionary with keys that are bibtex file names (such as ``'lsst'``,
        ``'lsst-dm'``). Values are the corresponding bibtex file content
        (`str`).
    """
    arg_1 = logging.getLogger(__name__)

    if arg_0 is None:
        # Default lsst-texmf bibliography files
        arg_2 = KNOWN_LSSTTEXMF_BIB_NAMES
    else:
        # Sanitize filenames (remove extensions, path)
        arg_2 = []
        for arg_3 in arg_0:
            arg_4 = os.path.basename(os.path.splitext(arg_3)[0])
            if arg_4 not in KNOWN_LSSTTEXMF_BIB_NAMES:
                arg_1.warning('%r is not a known lsst-texmf bib file',
                               arg_4)
                continue
            arg_2.append(arg_4)

    # names of bibtex files not in cache
    arg_5 = [arg_4 for arg_4 in arg_2
                      if arg_4 not in arg_9]
    if len(arg_5) > 0:
        # Download bibtex and put into the cache
        arg_6 = asyncio.get_event_loop()
        arg_7 = asyncio.ensure_future(_download_lsst_bibtex(arg_5))
        arg_6.run_until_complete(arg_7)
        for arg_4, arg_8 in zip(arg_2, arg_7.result()):
            arg_9[arg_4] = arg_8

    return {arg_4: arg_9[arg_4] for arg_4 in arg_2}

Get content of lsst - texmf bibliographies .


def Func(arg_0, arg_1):
        """
        Emit a record.

        Format the record and send it to the specified addressees.
        """
        try:
            # First, remove all records from the rate limiter list that are over a minute old
            arg_2 = timetool.unix_time()
            arg_3 = arg_2 - 60
            arg_4 = [x for x in arg_0.rate_limiter if x > arg_3]
            log.debug('Rate limiter %s -> %s' % (len(arg_0.rate_limiter), len(arg_4)))
            arg_0.rate_limiter = arg_4

            # Now, get the number of emails sent in the last minute.  If it's less than the threshold, add another
            # entry to the rate limiter list
            arg_6 = len(arg_0.rate_limiter)
            arg_7 = arg_6 < arg_0.max_sends_per_minute
            if arg_7:
                arg_0.rate_limiter.append(arg_2)

            arg_8 = arg_0.format(arg_1)
            arg_8 = arg_0.add_details(arg_8)

            # Finally send the message!
            if arg_7:
                if DEBUG_ERROR_EMAIL_SENDING:
                    log.info('@@@> ! Sending error email to {} !'.format(arg_0.toaddrs))
                send_text_mail(arg_0.toaddrs, arg_0.subject, arg_8, arg_0.fromaddr)
            else:
                log.info('!! WARNING: Not sending email as too many emails have been sent in the past minute !!')
                log.info(arg_8)

        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception:
            arg_0.handleError(arg_1)


def
Func
(
arg_0
)
:
arg_1
=
json_load
(
os
.
path
.
join
(
"data"
,
"requirements.json"
)
)
arg_2
=
sorted
(
arg_1
.
keys
(
)
)
arg_3
=
[
]
for
arg_4
in
arg_2
:
arg_3
.
append
(
".. _{name}: {url}\n"
.
format
(
name
=
arg_1
[
arg_4
]
[
"name"
]
,
url
=
arg_1
[
arg_4
]
[
"url"
]
)
)
arg_5
=
[
]
for
arg_6
in
arg_3
:
arg_7
=
textwrap
.
wrap
(
arg_6
,
width
=
LINE_WIDTH
,
subsequent_indent
=
"   "
)
arg_5
.
append
(
"\n"
.
join
(
[
arg_4
for
arg_4
in
arg_7
]
)
)
arg_0
.
out
(
"\n"
.
join
(
arg_5
)
)

def Func(arg_0):
    """Define Sphinx requirements links."""
    arg_1 = json_load(os.path.join("data", "requirements.json"))
    arg_2 = sorted(arg_1.keys())
    arg_3 = []
    for arg_4 in arg_2:
        arg_3.append(
            ".. _{name}: {url}\n".format(
                name=arg_1[arg_4]["name"], url=arg_1[arg_4]["url"]
            )
        )
    arg_5 = []
    for arg_6 in arg_3:
        arg_7 = textwrap.wrap(arg_6, width=LINE_WIDTH, subsequent_indent="   ")
        arg_5.append("\n".join([arg_4 for arg_4 in arg_7]))
    arg_0.out("\n".join(arg_5))


(self, concepts, sort=None, language='any', reverse=False)

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = 'any' , arg_4 = False ) : arg_5 = copy . copy ( arg_1 ) if arg_2 : arg_5 . sort ( key = methodcaller ( 'Funckey' , arg_2 , arg_3 ) , arg_4 = arg_4 ) return arg_5

def Func(arg_0, arg_1, arg_2=None, arg_3='any', arg_4=False):
        '''
        Returns a sorted version of a list of concepts. Will leave the original
        list unsorted.

        :param list concepts: A list of concepts and collections.
        :param string sort: What to sort on: `id`, `label` or `sortlabel`
        :param string language: Language to use when sorting on `label` or
            `sortlabel`.
        :param boolean reverse: Reverse the sort order?
        :rtype: list
        '''
        arg_5 = copy.copy(arg_1)
        if arg_2:
            arg_5.sort(key=methodcaller('Funckey', arg_2, arg_3), arg_4=arg_4)
        return arg_5

Returns a sorted version of a list of concepts . Will leave the original list unsorted .


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
.
is_type
(
TokenType
.
identifier
)
:
return
Identifier
(
arg_1
.
svalue
)
elif
arg_1
.
is_type
(
TokenType
.
terminal
)
:
return
Terminal
(
arg_1
.
svalue
)
elif
arg_1
.
is_type
(
TokenType
.
option_group
)
:
arg_2
=
arg_1
.
children
[
0
]
return
OptionGroup
(
arg_0
.
_expression_to_asn
(
arg_2
)
)
elif
arg_1
.
is_type
(
TokenType
.
repetition_group
)
:
arg_2
=
arg_1
.
children
[
0
]
return
RepetitionGroup
(
arg_0
.
_expression_to_asn
(
arg_2
)
)
elif
arg_1
.
is_type
(
TokenType
.
grouping_group
)
:
arg_2
=
arg_1
.
children
[
0
]
return
GroupingGroup
(
arg_0
.
_expression_to_asn
(
arg_2
)
)
elif
arg_1
.
is_type
(
TokenType
.
special_handling
)
:
arg_3
=
arg_1
.
children
[
0
]
return
SpecialHandling
(
arg_3
)
elif
arg_1
.
is_type
(
TokenType
.
number
)
:
return
Number
(
arg_1
.
svalue
)
elif
arg_1
.
is_type
(
(
TokenType
.
operator
,
TokenType
.
op_mult
,
TokenType
.
op_add
)
)
:
return
OperatorNode
(
OPERATOR_INDEX
[
arg_1
.
svalue
]
,
arg_1
.
position
)
else
:
raise
Exception
(
"Unhandled parse tree node: {0}"
.
format
(
arg_1
)
)

def Func(arg_0, arg_1):
    """Convert a parse tree node into an absract syntax tree node."""
    if arg_1.is_type(TokenType.identifier):
      return Identifier(arg_1.svalue)

    elif arg_1.is_type(TokenType.terminal):
      return Terminal(arg_1.svalue)

    elif arg_1.is_type(TokenType.option_group):
      arg_2 = arg_1.children[0]
      return OptionGroup(arg_0._expression_to_asn(arg_2))

    elif arg_1.is_type(TokenType.repetition_group):
      arg_2 = arg_1.children[0]
      return RepetitionGroup(arg_0._expression_to_asn(arg_2))

    elif arg_1.is_type(TokenType.grouping_group):
      arg_2 = arg_1.children[0]
      return GroupingGroup(arg_0._expression_to_asn(arg_2))

    elif arg_1.is_type(TokenType.special_handling):
      arg_3 = arg_1.children[0]
      return SpecialHandling(arg_3)

    elif arg_1.is_type(TokenType.number):
      return Number(arg_1.svalue)

    elif arg_1.is_type((TokenType.operator, TokenType.op_mult, TokenType.op_add)):
      return OperatorNode(OPERATOR_INDEX[arg_1.svalue], arg_1.position)

    else:
      raise Exception("Unhandled parse tree node: {0}".format(arg_1))

Convert a parse tree node into an absract syntax tree node .


def Func ( ) : arg_0 = { } for arg_1 in CONFIG_OPTIONS : arg_2 = 'TOWER_' + arg_1 . upper ( ) arg_3 = os . getenv ( arg_2 , None ) if arg_3 is not None : arg_0 [ arg_1 ] = arg_3 return arg_0

def Func():
    """Read tower-cli config values from the environment if present, being
    careful not to override config values that were explicitly passed in.
    """
    arg_0 = {}
    for arg_1 in CONFIG_OPTIONS:
        arg_2 = 'TOWER_' + arg_1.upper()
        arg_3 = os.getenv(arg_2, None)
        if arg_3 is not None:
            arg_0[arg_1] = arg_3
    return arg_0

Read tower - cli config values from the environment if present being careful not to override config values that were explicitly passed in .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 , arg_5 = False ) : if arg_1 . is_terminal ( ) and arg_5 == False : if arg_2 is None or np . isinf ( arg_2 ) or np . isnan ( arg_2 ) : arg_6 = np . array ( [ 0 , 0 , 0 , 0 , 0 , 0 ] ) elif arg_4 == 0 : arg_6 = np . array ( [ np . inf , np . inf , np . inf , np . inf , np . inf , np . inf ] ) else : arg_6 = np . array ( [ arg_2 / arg_4 , arg_3 / arg_4 , arg_2 ** 2 / arg_4 , arg_3 * arg_2 / arg_4 , arg_3 ** 2 / arg_4 , 1.0 / arg_4 ] , dtype = float ) else : arg_7 = arg_1 . O if arg_5 else arg_1 . Q arg_8 = 1.0 / ( 1 + arg_4 * arg_7 [ sii ] ) arg_6 = np . array ( [ arg_7 [ tavgii ] * arg_8 , ( arg_7 [ davgii ] + arg_3 * arg_7 [ sii ] ) * arg_8 , arg_7 [ tsqii ] - arg_4 * arg_7 [ tavgii ] ** 2 * arg_8 , arg_7 [ dtavgii ] + arg_7 [ tavgii ] * arg_3 - arg_4 * arg_7 [ tavgii ] * ( arg_7 [ davgii ] + arg_3 * arg_7 [ sii ] ) * arg_8 , arg_7 [ dsqii ] + 2 * arg_3 * arg_7 [ davgii ] + arg_3 ** 2 * arg_7 [ sii ] - arg_4 * ( arg_7 [ davgii ] ** 2 + 2 * arg_3 * arg_7 [ davgii ] * arg_7 [ sii ] + arg_3 ** 2 * arg_7 [ sii ] ** 2 ) * arg_8 , arg_7 [ sii ] * arg_8 ] ) return arg_6

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=False):
        """
        This function implements the propagation of the means,
        variance, and covariances along a branch. It operates
        both towards the root and tips.

        Parameters
        ----------
         n : (node)
            the branch connecting this node to its parent is used
            for propagation
         tv : (float)
            tip value. Only required if not is terminal
         bl : (float)
            branch value. The increment of the tree associated quantity'

         var : (float)
            the variance increment along the branch

        Returns
        -------
         Q : (np.array)
            a vector of length 6 containing the updated quantities
        """
        if arg_1.is_terminal() and arg_5==False:
            if arg_2 is None or np.isinf(arg_2) or np.isnan(arg_2):
                arg_6 = np.array([0, 0, 0, 0, 0, 0])
            elif arg_4==0:
                arg_6 = np.array([np.inf, np.inf, np.inf, np.inf, np.inf, np.inf])
            else:
                arg_6 = np.array([
                    arg_2/arg_4,
                    arg_3/arg_4,
                    arg_2**2/arg_4,
                    arg_3*arg_2/arg_4,
                    arg_3**2/arg_4,
                    1.0/arg_4], dtype=float)
        else:
            arg_7 = arg_1.O if arg_5 else arg_1.Q
            arg_8 = 1.0/(1+arg_4*arg_7[sii])
            arg_6 = np.array([
                arg_7[tavgii]*arg_8,
                (arg_7[davgii] + arg_3*arg_7[sii])*arg_8,
                arg_7[tsqii] - arg_4*arg_7[tavgii]**2*arg_8,
                arg_7[dtavgii] + arg_7[tavgii]*arg_3 - arg_4*arg_7[tavgii]*(arg_7[davgii] + arg_3*arg_7[sii])*arg_8,
                arg_7[dsqii] + 2*arg_3*arg_7[davgii] + arg_3**2*arg_7[sii] - arg_4*(arg_7[davgii]**2 + 2*arg_3*arg_7[davgii]*arg_7[sii] + arg_3**2*arg_7[sii]**2)*arg_8,
                arg_7[sii]*arg_8]
            )

        return arg_6

This function implements the propagation of the means variance and covariances along a branch . It operates both towards the root and tips .


def Func(arg_0, arg_1):
        """Encodes a single span to protobuf."""
        if not protobuf.installed():
            raise ZipkinError(
                'protobuf encoding requires installing the protobuf\'s extra '
                'requirements. Use py-zipkin[protobuf] in your requirements.txt.'
            )

        arg_2 = protobuf.create_protobuf_span(arg_1)
        return protobuf.encode_pb_list([arg_2])


def Func(arg_0, arg_1):
    """
    Compute jenks natural breaks on a sequence of `values`, given `nb_class`,
    the number of desired class.

    Parameters
    ----------
    values : array-like
        The Iterable sequence of numbers (integer/float) to be used.
    nb_class : int
        The desired number of class (as some other functions requests
        a `k` value, `nb_class` is like `k` + 1). Have to be lesser than
        the length of `values` and greater than 2.

    Returns
    -------
    breaks : tuple of floats
        The computed break values, including minimum and maximum, in order
        to have all the bounds for building `nb_class` class,
        so the returned tuple has a length of `nb_class` + 1.

    Examples
    --------
    Using nb_class = 3, expecting 4 break values , including min and max :

    >>> Func(
            [1.3, 7.1, 7.3, 2.3, 3.9, 4.1, 7.8, 1.2, 4.3, 7.3, 5.0, 4.3],
            nb_class = 3)  # Should output (1.2, 2.3, 5.0, 7.8)

    """

    if not isinstance(arg_0, Iterable) or isinstance(arg_0, (str, bytes)):
        raise TypeError("A sequence of numbers is expected")
    if isinstance(arg_1, float) and int(arg_1) == arg_1:
        arg_1 = int(arg_1)
    if not isinstance(arg_1, int):
        raise TypeError(
            "Number of class have to be a positive integer: "
            "expected an instance of 'int' but found {}"
            .format(type(arg_1)))

    arg_2 = len(arg_0)
    if np and isinstance(arg_0, np.ndarray):
        arg_0 = arg_0[np.argwhere(np.isfinite(arg_0)).reshape(-1)]
    else:
        arg_0 = [i for i in arg_0 if isfinite(i)]

    if len(arg_0) != arg_2:
        warnings.warn('Invalid values encountered (NaN or Inf) were ignored')
        arg_2 = len(arg_0)

    if arg_1 >= arg_2 or arg_1 < 2:
        raise ValueError("Number of class have to be an integer "
                         "greater than 2 and "
                         "smaller than the number of values to use")

    return jenks._Func(arg_0, arg_1)

Compute jenks natural breaks on a sequence of `values`, given `nb_class`,
    the number of desired class.

    Parameters
    ----------
    values : array-like
        The Iterable sequence of numbers (integer/float) to be used.
    nb_class : int
        The desired number of class (as some other functions requests
        a `k` value, `nb_class` is like `k` + 1). Have to be lesser than
        the length of `values` and greater than 2.

    Returns
    -------
    breaks : tuple of floats
        The computed break values, including minimum and maximum, in order
        to have all the bounds for building `nb_class` class,
        so the returned tuple has a length of `nb_class` + 1.

    Examples
    --------
    Using nb_class = 3, expecting 4 break values , including min and max :

    >>> jenks_breaks(
            [1.3, 7.1, 7.3, 2.3, 3.9, 4.1, 7.8, 1.2, 4.3, 7.3, 5.0, 4.3],
            nb_class = 3)  # Should output (1.2, 2.3, 5.0, 7.8)

Compute jenks natural breaks on a sequence of values given nb_class the number of desired class .


def Func(arg_0, arg_1, arg_2=False):
        """Return the super parent of a given molecule.

        THe super parent is fragment, charge, isotope, stereochemistry and tautomer insensitive. From the input
        molecule, the largest fragment is taken. This is uncharged and then isotope and stereochemistry information is
        discarded. Finally, the canonical tautomer is determined and returned.

        :param mol: The input molecule.
        :type mol: rdkit.Chem.rdchem.Mol
        :param bool skip_standardize: Set to True if mol has already been standardized.
        :returns: The super parent molecule.
        :rtype: rdkit.Chem.rdchem.Mol
        """
        if not arg_2:
            arg_1 = arg_0.standardize(arg_1)
        # We don't need to get fragment parent, because the charge parent is the largest fragment
        arg_1 = arg_0.charge_parent(arg_1, arg_2=True)
        arg_1 = arg_0.isotope_parent(arg_1, arg_2=True)
        arg_1 = arg_0.stereo_parent(arg_1, arg_2=True)
        arg_1 = arg_0.tautomer_parent(arg_1, arg_2=True)
        arg_1 = arg_0.standardize(arg_1)
        return arg_1

Return the super parent of a given molecule .


def Func(arg_0):
        """Index of the instruction in the instructions of the row or None.

        :return: index in the :attr:`row`'s instructions or None, if the
          instruction is not in the row
        :rtype: int

        .. seealso:: :attr:`row_instructions`, :attr:`index_in_row`,
          :meth:`is_in_row`
        """
        arg_1 = arg_0._cached_index_in_row
        arg_2 = arg_0._row.instructions
        if arg_1 is not None and \
                0 <= arg_1 < len(arg_2) and \
                arg_2[arg_1] is arg_0:
            return arg_1
        for arg_3, arg_4 in enumerate(arg_2):
            if arg_4 is arg_0:
                arg_0._cached_index_in_row = arg_3
                return arg_3
        return None

Index of the instruction in the instructions of the row or None .


def Func ( arg_0 ) : while arg_0 . pos < len ( arg_0 . field ) : if arg_0 . field [ arg_0 . pos ] in arg_0 . LWS + '\n\r' : arg_0 . pos = arg_0 . pos + 1 elif arg_0 . field [ arg_0 . pos ] == '(' : arg_0 . commentlist . append ( arg_0 . getcomment ( ) ) else : break

def Func(arg_0):
        """Parse up to the start of the next address."""
        while arg_0.pos < len(arg_0.field):
            if arg_0.field[arg_0.pos] in arg_0.LWS + '\n\r':
                arg_0.pos = arg_0.pos + 1
            elif arg_0.field[arg_0.pos] == '(':
                arg_0.commentlist.append(arg_0.getcomment())
            else: break

Parse up to the start of the next address .


def Func(arg_0, arg_1, arg_2=0):
        """
        Return a tuple of offsets of an ArrayRef object in all dimensions.

        The index order is right to left (c-code order).
        e.g. c[i+1][j-2] -> (-2, +1)

        If aref is actually a c_ast.ID, None will be returned.
        """
        if isinstance(arg_1, c_ast.ID):
            return None

        # Check for restrictions
        assert type(arg_1.name) in [c_ast.ArrayRef, c_ast.ID], \
            "array references must only be used with variables or other array references"
        assert type(arg_1.subscript) in [c_ast.ID, c_ast.Constant, c_ast.BinaryOp], \
            'array subscript must only contain variables or binary operations'

        # Convert subscript to sympy and append
        arg_3 = [arg_0.conv_ast_to_sym(arg_1.subscript)]

        # Check for more indices (multi-dimensional access)
        if type(arg_1.name) is c_ast.ArrayRef:
            arg_3 += arg_0.Func(arg_1.name, arg_2=arg_2+1)

        # Reverse to preserver order (the subscripts in the AST are traversed backwards)
        if arg_2 == 0:
            arg_3.reverse()

        return tuple(arg_3)

Return a tuple of offsets of an ArrayRef object in all dimensions .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
[
'\\'
,
'|'
,
'/'
,
'-'
]
for
arg_4
in
range
(
arg_1
)
:
time
.
sleep
(
0.25
)
sys
.
stdout
.
write
(
"%(message)s... %(tag)s\r"
%
{
'message'
:
arg_2
,
'tag'
:
arg_3
[
arg_4
%
4
]
}
)
sys
.
stdout
.
flush
(
)
pass
sys
.
stdout
.
write
(
"%s... Done...\n"
%
arg_2
)
sys
.
stdout
.
flush
(
)
pass

def Func(arg_0, arg_1, arg_2):
        """
        print loading message on screen

        .. note::

            loading message only write to `sys.stdout`

        :param int wait: seconds to wait
        :param str message: message to print
        :return: None
        """
        arg_3 = ['\\', '|', '/', '-']

        for arg_4 in range(arg_1):
            time.sleep(0.25)
            sys.stdout.write("%(message)s... %(tag)s\r" % {
                'message': arg_2,
                'tag': arg_3[arg_4 % 4]
            })

            sys.stdout.flush()
            pass

        sys.stdout.write("%s... Done...\n" % arg_2)
        sys.stdout.flush()
        pass


def Func ( arg_0 , arg_1 , arg_2 ) : for arg_3 in arg_0 . legal_params [ arg_1 ] : if not hasattr ( arg_0 . opt , arg_3 ) or getattr ( arg_0 . opt , arg_3 ) is None : continue if arg_3 in arg_2 and type ( arg_2 [ arg_3 ] ) == dict : assert ( type ( getattr ( arg_0 . opt , arg_3 ) ) == dict ) for arg_4 , arg_5 in getattr ( arg_0 . opt , arg_3 ) . iteritems ( ) : arg_2 [ arg_3 ] [ arg_4 ] = arg_5 else : arg_2 [ arg_3 ] = getattr ( arg_0 . opt , arg_3 ) return arg_2

def Func(arg_0, arg_1, arg_2):
    '''Combine existing parameters with extra options supplied from command line
       options. Carefully merge special type of parameter if needed.
    '''
    for arg_3 in arg_0.legal_params[arg_1]:
      if not hasattr(arg_0.opt, arg_3) or getattr(arg_0.opt, arg_3) is None:
        continue
      if arg_3 in arg_2 and type(arg_2[arg_3]) == dict:
        assert(type(getattr(arg_0.opt, arg_3)) == dict)
        # Merge two dictionaries.
        for arg_4, arg_5 in getattr(arg_0.opt, arg_3).iteritems():
          arg_2[arg_3][arg_4] = arg_5
      else:
        # Overwrite values.
        arg_2[arg_3] = getattr(arg_0.opt, arg_3)

    return arg_2

Combine existing parameters with extra options supplied from command line options . Carefully merge special type of parameter if needed .


def Func ( arg_0 ) : if arg_0 . locked_until and arg_0 . locked_until <= datetime . datetime . now ( ) : return True return False

def Func(arg_0):
        """Whether the receivers lock on a particular session has Func.

        :rtype: bool
        """
        if arg_0.locked_until and arg_0.locked_until <= datetime.datetime.now():
            return True
        return False

Whether the receivers lock on a particular session has expired.

        :rtype: bool

Whether the receivers lock on a particular session has expired .


(
            self,
            index=0,
            count=1,
            security_level=AddressGenerator.DEFAULT_SECURITY_LEVEL,
    )

return commands.GetPrivateKeysCommand(self.adapter)(
            seed=self.seed,
            index=index,
            count=count,
            securityLevel=security_level,
        )

def Func ( arg_0 , arg_1 = 0 , arg_2 = 1 , arg_3 = arg_4 . DEFAULT_SECURITY_LEVEL , ) : return commands . GetPrivateKeysCommand ( arg_0 . adapter ) ( seed = arg_0 . seed , arg_1 = arg_1 , arg_2 = arg_2 , securityLevel = arg_3 , )

def Func(
            arg_0,
            arg_1=0,
            arg_2=1,
            arg_3=arg_4.DEFAULT_SECURITY_LEVEL,
    ):
        # type: (int, int, int) -> dict
        """
        Generates one or more private keys from the seed.

        As the name implies, private keys should not be shared.
        However, in a few cases it may be necessary (e.g., for M-of-N
        transactions).

        :param index:
            The starting key index.

        :param count:
            Number of keys to generate.

        :param security_level:
            Number of iterations to use when generating new keys.

            Larger values take longer, but the resulting signatures are
            more secure.

            This value must be between 1 and 3, inclusive.

        :return:
            Dict with the following items::

                {
                    'keys': List[PrivateKey],
                        Always contains a list, even if only one key was
                        generated.
                }

        References:

        - :py:class:`iota.crypto.signing.KeyGenerator`
        - https://github.com/iotaledger/wiki/blob/master/multisigs.md#how-m-of-n-works
        """
        return commands.GetPrivateKeysCommand(arg_0.adapter)(
            seed=arg_0.seed,
            arg_1=arg_1,
            arg_2=arg_2,
            securityLevel=arg_3,
        )

Generates one or more private keys from the seed .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
if
type
(
arg_1
)
is
list
:
for
arg_3
in
arg_1
:
arg_0
.
Func
(
arg_3
,
arg_2
)
return
arg_4
=
arg_0
.
_pin_mapping
.
get
(
arg_1
,
)
if
arg_4
and
type
(
arg_2
)
is
ahio
.
Direction
:
arg_0
.
_Func
(
arg_4
,
arg_2
)
else
:
raise
KeyError
(
'Requested pin is not mapped: %s'
%
arg_1
)

def Func(arg_0, arg_1, arg_2):
        """Sets pin `pin` to `direction`.

        The pin should support the requested mode. Calling this function
        on a unmapped pin does nothing. Calling it with a unsupported direction
        throws RuntimeError.

        If you're developing a driver, you should implement
        _Func(self, pin, direction) where `pin` will be one of
        your internal IDs. If a pin is set to OUTPUT, put it on LOW state.

        @arg pin pin id you've set using `AbstractDriver.map_pin`
        @arg mode a value from `AbstractDriver.Direction`

        @throw KeyError if pin isn't mapped.
        @throw RuntimeError if direction is not supported by pin.
        """
        if type(arg_1) is list:
            for arg_3 in arg_1:
                arg_0.Func(arg_3, arg_2)
            return

        arg_4 = arg_0._pin_mapping.get(arg_1, None)
        if arg_4 and type(arg_2) is ahio.Direction:
            arg_0._Func(arg_4, arg_2)
        else:
            raise KeyError('Requested pin is not mapped: %s' % arg_1)

Sets pin `pin` to `direction`.

        The pin should support the requested mode. Calling this function
        on a unmapped pin does nothing. Calling it with a unsupported direction
        throws RuntimeError.

        If you're developing a driver, you should implement
        _set_pin_direction(self, pin, direction) where `pin` will be one of
        your internal IDs. If a pin is set to OUTPUT, put it on LOW state.

        @arg pin pin id you've set using `AbstractDriver.map_pin`
        @arg mode a value from `AbstractDriver.Direction`

        @throw KeyError if pin isn't mapped.
        @throw RuntimeError if direction is not supported by pin.


def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
_weight_by_hue
(
)
arg_2
=
"<colors query=\""
+
arg_0
.
name
+
"\" tags=\""
+
", "
.
join
(
arg_0
.
tags
)
+
"\">\n\n"
for
arg_3
,
arg_4
,
arg_5
,
arg_6
in
arg_1
:
if
arg_5
==
arg_0
.
blue
:
arg_5
=
"blue"
arg_7
=
color
(
arg_5
)
arg_2
+=
"\t<color name=\""
+
arg_7
.
name
+
"\" weight=\""
+
str
(
arg_4
)
+
"\">\n "
arg_2
+=
"\t\t<rgb r=\""
+
str
(
arg_7
.
r
)
+
"\" g=\""
+
str
(
arg_7
.
g
)
+
"\" "
arg_2
+=
"b=\""
+
str
(
arg_7
.
b
)
+
"\" a=\""
+
str
(
arg_7
.
a
)
+
"\" />\n "
for
arg_7
,
arg_8
,
arg_9
in
arg_6
:
arg_2
+=
"\t\t<shade name=\""
+
str
(
arg_8
)
+
"\" weight=\""
+
str
(
arg_9
/
arg_3
)
+
"\" />\n "
arg_2
=
arg_2
.
rstrip
(
" "
)
+
"\t</color>\n\n"
arg_2
+=
"</colors>"
return
arg_2

def Func(arg_0):
        """
        Returns the color information as XML.

        The XML has the following structure:
        <colors query="">
            <color name="" weight="" />
                <rgb r="" g="" b="" />
                <shade name="" weight="" />
            </color>
        </colors>

        Notice that ranges are stored by name and retrieved in the _load()
        method with the shade() command - and are thus expected to be
        shades (e.g. intense, warm, ...) unless the shade() command would
        return any custom ranges as well. This can be done by appending custom
        ranges to the shades list.
        """
        arg_1 = arg_0._weight_by_hue()

        arg_2 = "<colors query=\"" + arg_0.name + "\" tags=\"" + ", ".join(arg_0.tags) + "\">\n\n"
        for arg_3, arg_4, arg_5, arg_6 in arg_1:
            if arg_5 == arg_0.blue: arg_5 = "blue"
            arg_7 = color(arg_5)
            arg_2 += "\t<color name=\"" + arg_7.name + "\" weight=\"" + str(arg_4) + "\">\n "
            arg_2 += "\t\t<rgb r=\"" + str(arg_7.r) + "\" g=\"" + str(arg_7.g) + "\" "
            arg_2 += "b=\"" + str(arg_7.b) + "\" a=\"" + str(arg_7.a) + "\" />\n "
            for arg_7, arg_8, arg_9 in arg_6:
                arg_2 += "\t\t<shade name=\"" + str(arg_8) + "\" weight=\"" + str(arg_9 / arg_3) + "\" />\n "
            arg_2 = arg_2.rstrip(" ") + "\t</color>\n\n"
        arg_2 += "</colors>"

        return arg_2


def Func(arg_0):
    """Decorator for glib callback methods of GLibMainLoop used to store the
    exception raised."""
    @functools.wraps(arg_0)
    def wrapper(arg_1, *arg_2, **arg_3):
        """Wrapper for methods decorated with `Func`."""
        # pylint: disable=W0703,W0212
        try:
            return arg_0(arg_1, *arg_2, **arg_3)
        except Exception:
            if arg_1.exc_info:
                raise
            if not arg_1._stack:
                logger.debug('@Func wrapped method {0!r} called'
                            ' from outside of the main loop'.format(arg_0))
                raise
            arg_1.exc_info = sys.exc_info()
            logger.debug(u"exception in glib main loop callback:",
                                                arg_4 = arg_1.exc_info)
            # pylint: disable=W0212
            arg_5 = arg_1._stack[-1]
            if arg_5 is not None:
                arg_5.quit()
            return False
    return wrapper

Decorator for glib callback methods of GLibMainLoop used to store the exception raised .


def Func(arg_0: arg_1, arg_2: arg_1) -> None:
    """Add causal edges between entities in the sub-graph.

    Is an extremely thin wrapper around :func:`expand_internal`.

    :param universe: A BEL graph representing the universe of all knowledge
    :param graph: The target BEL graph to enrich with causal relations between contained nodes

    Equivalent to:

    >>> from pybel_tools.mutation import expand_internal
    >>> from pybel.struct.filters.edge_predicates import is_causal_relation
    >>> expand_internal(universe, graph, edge_predicates=is_causal_relation)
    """
    expand_internal(arg_0, arg_2, edge_predicates=is_causal_relation)

Add causal edges between entities in the sub - graph .


def Func(arg_0, arg_1):
        """
        Adds this SubParser to the subparsers created by
        argparse.ArgumentParser.add_subparsers method.

        @param subparsers Normally a _SubParsersAction instance created by
        argparse.ArgumentParser.add_subparsers method
        """
        arg_2 = arg_1.add_parser(*arg_0._get_args(), **arg_0._get_kwargs())
        arg_2.set_defaults(**arg_0.get_defaults())
        for arg_3, arg_4 in arg_0.base_argument_groups:
            arg_4.Func(arg_2)
        for arg_3, arg_5 in arg_0.base_arguments:
            arg_5.Func(arg_2)
        arg_0.add_subparsers(arg_2)

Adds this SubParser to the subparsers created by argparse . ArgumentParser . add_subparsers method .


def Func ( arg_0 = None ) : arg_0 = get_complete_version ( arg_0 ) arg_1 = get_main_version ( arg_0 ) arg_2 = '' if arg_0 [ 3 ] == 'alpha' and arg_0 [ 4 ] == 0 : arg_3 = get_git_changeset ( ) if arg_3 : arg_2 = '.dev%s' % arg_3 elif arg_0 [ 3 ] != 'final' : arg_4 = { 'alpha' : 'a' , 'beta' : 'b' , 'rc' : 'c' } arg_2 = arg_4 [ arg_0 [ 3 ] ] + str ( arg_0 [ 4 ] ) return str ( arg_1 + arg_2 )

def Func(arg_0=None):
    """
    Returns a PEP 386-compliant version number from VERSION.
    """
    arg_0 = get_complete_version(arg_0)

    # Now build the two parts of the version number:
    # main = X.Y[.Z]
    # sub = .devN - for pre-alpha releases
    #     | {a|b|c}N - for alpha, beta and rc releases

    arg_1 = get_main_version(arg_0)

    arg_2 = ''
    if arg_0[3] == 'alpha' and arg_0[4] == 0:
        arg_3 = get_git_changeset()
        if arg_3:
            arg_2 = '.dev%s' % arg_3

    elif arg_0[3] != 'final':
        arg_4 = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
        arg_2 = arg_4[arg_0[3]] + str(arg_0[4])

    return str(arg_1 + arg_2)

Returns a PEP 386 - compliant version number from VERSION .


(adapter, collaborator, document_id=None, case_id=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
)
:
arg_4
=
[
]
if
arg_2
:
yield
arg_0
.
variant
(
arg_2
)
return
arg_5
=
arg_0
.
get_causatives
(
institute_id
=
arg_1
,
arg_3
=
arg_3
)
for
arg_2
in
arg_5
:
arg_6
=
arg_0
.
variant
(
arg_2
)
arg_7
=
arg_6
[
'chromosome'
]
arg_8
=
CHROMOSOME_INTEGERS
.
get
(
arg_7
)
if
not
arg_8
:
LOG
.
info
(
"Unknown chromosome %s"
,
arg_7
)
continue
arg_4
.
append
(
(
arg_8
,
arg_6
[
'position'
]
,
arg_6
)
)
arg_4
.
sort
(
key
=
lambda
x
:
(
x
[
0
]
,
x
[
1
]
)
)
for
arg_9
in
arg_4
:
arg_6
=
arg_9
[
2
]
yield
arg_6

def Func(arg_0, arg_1, arg_2=None, arg_3=None):
    """Export causative variants for a collaborator

    Args:
        adapter(MongoAdapter)
        collaborator(str)
        document_id(str): Search for a specific variant
        case_id(str): Search causative variants for a case

    Yields:
        variant_obj(scout.Models.Variant): Variants marked as causative ordered by position.
    """

    # Store the variants in a list for sorting
    arg_4 = []
    if arg_2:
        yield arg_0.variant(arg_2)
        return

    arg_5 = arg_0.get_causatives(
        institute_id=arg_1,
        arg_3=arg_3
        )
    ##TODO add check so that same variant is not included more than once
    for arg_2 in arg_5:

        arg_6 = arg_0.variant(arg_2)
        arg_7 = arg_6['chromosome']
        # Convert chromosome to integer for sorting
        arg_8 = CHROMOSOME_INTEGERS.get(arg_7)
        if not arg_8:
            LOG.info("Unknown chromosome %s", arg_7)
            continue

        # Add chromosome and position to prepare for sorting
        arg_4.append((arg_8, arg_6['position'], arg_6))

    # Sort varants based on position
    arg_4.sort(key=lambda x: (x[0], x[1]))

    for arg_9 in arg_4:
        arg_6 = arg_9[2]
        yield arg_6


def Func ( arg_0 ) : arg_0 . _readers_mutex . acquire ( ) arg_0 . _readers -= 1 if arg_0 . _readers == 0 : arg_0 . _access_mutex . release ( ) arg_0 . _readers_mutex . release ( )

def Func(arg_0):
        """Release the lock after reading"""

        arg_0._readers_mutex.acquire()

        arg_0._readers -= 1
        if arg_0._readers == 0:
            arg_0._access_mutex.release()

        arg_0._readers_mutex.release()


return tf.clip_by_value(x, clip_value_min=v_min, clip_value_max=v_max, name=name)

def Func(arg_0, arg_1=0, arg_2=1, arg_3=None):
    """Ramp activation function.

    Parameters
    ----------
    x : Tensor
        input.
    v_min : float
        cap input to v_min as a lower bound.
    v_max : float
        cap input to v_max as a upper bound.
    name : str
        The function name (optional).

    Returns
    -------
    Tensor
        A ``Tensor`` in the same type as ``x``.

    """
    return tf.clip_by_value(arg_0, clip_value_min=arg_1, clip_value_max=arg_2, arg_3=arg_3)


return\
        Route(relation.id,
              short_name,
              create_route_long_name(relation, short_name),
              map_osm_route_type_to_gtfs(relation.tags.get('route')),
              'https://www.openstreetmap.org/relation/{}'.format(relation.id),
              color.strip('#') if color else '',
              get_agency_id(relation))

def Func(arg_0):
    """Extract information of one route."""
    if arg_0.tags.get('type') != 'route':
        # Build route only for relations of type `route`
        return

    arg_1 = create_route_short_name(arg_0)
    arg_2 = arg_0.tags.get('color')
    return\
        Route(arg_0.id,
              arg_1,
              create_route_long_name(arg_0, arg_1),
              map_osm_route_type_to_gtfs(arg_0.tags.get('route')),
              'https://www.openstreetmap.org/relation/{}'.format(arg_0.id),
              arg_2.strip('#') if arg_2 else '',
              get_agency_id(arg_0))


def Func ( arg_0 , arg_1 ) : arg_2 = MgmtRequests . mgmtRequests arg_3 = arg_0 . _apiClient . post ( arg_2 , arg_1 ) if arg_3 . status_code == 202 : return arg_3 . json ( ) else : raise ApiException ( arg_3 )

def Func(arg_0, arg_1):
        """
        Initiates a device management request, such as reboot.
        In case of failure it throws APIException
        """
        arg_2 = MgmtRequests.mgmtRequests
        arg_3 = arg_0._apiClient.post(arg_2, arg_1)

        if arg_3.status_code == 202:
            return arg_3.json()
        else:
            raise ApiException(arg_3)

Initiates a device management request such as reboot . In case of failure it throws APIException


def Func ( arg_0 ) : arg_1 = arg_0 . replace ( ']' , '' ) . split ( '[' ) [ 0 ] arg_2 = arg_0 . replace ( ']' , '' ) . split ( '[' ) [ 1 ] return arg_1 , arg_2

def Func(arg_0):
    """
    Split a compound's combined formula and phase into separate strings for
    the formula and phase.

    :param compound_string: Formula and phase of a chemical compound, e.g.
      'SiO2[S1]'.

    :returns: Formula of chemical compound.
    :returns: Phase of chemical compound.
    """

    arg_1 = arg_0.replace(']', '').split('[')[0]
    arg_2 = arg_0.replace(']', '').split('[')[1]

    return arg_1, arg_2

Split a compound s combined formula and phase into separate strings for the formula and phase .


def Func ( arg_0 , arg_1 = None , arg_2 = False ) : arg_3 = super ( Q , arg_0 ) . Func ( arg_1 , arg_2 = arg_2 ) if arg_0 . escape : return repr ( arg_3 ) elif arg_0 . html_js_escape : return ( "'" + arg_3 . encode ( "string_escape" ) . replace ( "<" , "\\x3c" ) . replace ( ">" , "\\x3e" ) + "'" ) else : return "{q}{r}{q}" . format ( q = arg_0 . quote , r = arg_3 )

def Func(arg_0, arg_1=None, arg_2=False):
        """Build the ``Quote`` instance

        :param list pre: The prerequisites list
        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
        """
        arg_3 = super(Q, arg_0).Func(arg_1, arg_2=arg_2)

        if arg_0.escape:
            return repr(arg_3)
        elif arg_0.html_js_escape:
            return ("'" + arg_3.encode("string_escape").replace("<", "\\x3c").replace(">", "\\x3e") + "'")
        else:
            return "{q}{r}{q}".format(q=arg_0.quote, r=arg_3)


def
Func
(
arg_0
,
arg_1
=
1
)
:
arg_2
=
{
}
for
arg_3
in
arg_0
[
'memory hierarchy'
]
:
if
'cache per group'
not
in
arg_3
:
continue
arg_2
[
arg_3
[
'level'
]
]
=
deepcopy
(
arg_3
[
'cache per group'
]
)
if
arg_3
[
'cores per group'
]
>
1
:
arg_2
[
arg_3
[
'level'
]
]
[
'sets'
]
//=
arg_1
arg_4
,
arg_5
,
arg_6
=
cachesim
.
CacheSimulator
.
from_dict
(
arg_2
)
return
arg_4

def Func(arg_0, arg_1=1):
        """
        Return a cachesim.CacheSimulator object based on the machine description.

        :param cores: core count (default: 1)
        """
        arg_2 = {}
        for arg_3 in arg_0['memory hierarchy']:
            # Skip main memory
            if 'cache per group' not in arg_3:
                continue
            arg_2[arg_3['level']] = deepcopy(arg_3['cache per group'])
            # Scale size of shared caches according to cores
            if arg_3['cores per group'] > 1:
                arg_2[arg_3['level']]['sets'] //= arg_1

        arg_4, arg_5, arg_6 = cachesim.CacheSimulator.from_dict(arg_2)

        return arg_4

Return a cachesim . CacheSimulator object based on the machine description .


def Func ( arg_0 ) : arg_1 = hashlib . md5 ( arg_0 . abs_url ) . digest ( ) return ( arg_1 , int ( arg_0 . stream_time . epoch_ticks ) )

def Func(arg_0):
    '''Get a kvlayer key from a stream item.

    The return tuple can be used directly as a key in the
    :data:`STREAM_ITEMS_TABLE` table.  Note that this recalculates the
    stream ID, and if the internal data on the stream item is inconsistent
    then this could return a different result from
    :func:`stream_id_to_kvlayer_key`.

    :param si: stream item to get key for
    :return: :mod:`kvlayer` key tuple

    '''
    # get binary 16 byte digest
    arg_1 = hashlib.md5(arg_0.abs_url).digest()
    return (arg_1, int(arg_0.stream_time.epoch_ticks))


def Func(arg_0, arg_1):
        """
        Adds the argument to an argparse.ArgumentParser instance

        @param parser An argparse.ArgumentParser instance
        """
        arg_2 = arg_0._get_kwargs()
        arg_3 = arg_0._get_args()
        arg_1.add_argument(*arg_3, **arg_2)

Adds the argument to an argparse . ArgumentParser instance


def Func(arg_0, arg_1):
        '''
        Makes a wrapper function that executes a dispatch call for func. The
        wrapper has the dispatch and dispatch_first attributes, so that
        additional overloads can be added to the group.
        '''

        #TODO: consider using a class to make attribute forwarding easier.
        #TODO: consider using simply another DispatchGroup, with self.callees
        # assigned by reference to the original callees.
        @wraps(arg_1)
        def arg_4(*arg_2, **arg_3):
            return arg_0.execute(arg_2, arg_3)
        arg_4.dispatch = arg_0.dispatch
        arg_4.dispatch_first = arg_0.dispatch_first
        arg_4.func = arg_1
        arg_4.lookup = arg_0.lookup
        return arg_4

Makes a wrapper function that executes a dispatch call for func . The wrapper has the dispatch and dispatch_first attributes so that additional overloads can be added to the group .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
False
)
:
if
not
is_number
(
arg_1
)
:
raise
ValueError
(
"n_semitones must be a positive number"
)
if
arg_1
<
12
or
arg_1
>
12
:
logger
.
warning
(
"Using an extreme Func shift. "
"Quality of results will be poor"
)
if
not
isinstance
(
arg_2
,
bool
)
:
raise
ValueError
(
"quick must be a boolean."
)
arg_3
=
[
'Func'
]
if
arg_2
:
arg_3
.
append
(
'-q'
)
arg_3
.
append
(
'{:f}'
.
format
(
arg_1
*
100.
)
)
arg_0
.
effects
.
extend
(
arg_3
)
arg_0
.
effects_log
.
append
(
'Func'
)
return
arg_0

def Func(arg_0, arg_1, arg_2=False):
        '''Pitch shift the audio without changing the tempo.

        This effect uses the WSOLA algorithm. The audio is chopped up into
        segments which are then shifted in the time domain and overlapped
        (cross-faded) at points where their waveforms are most similar as
        determined by measurement of least squares.

        Parameters
        ----------
        n_semitones : float
            The number of semitones to shift. Can be positive or negative.
        quick : bool, default=False
            If True, this effect will run faster but with lower sound quality.

        See Also
        --------
        bend, speed, tempo

        '''
        if not is_number(arg_1):
            raise ValueError("n_semitones must be a positive number")

        if arg_1 < -12 or arg_1 > 12:
            logger.warning(
                "Using an extreme Func shift. "
                "Quality of results will be poor"
            )

        if not isinstance(arg_2, bool):
            raise ValueError("quick must be a boolean.")

        arg_3 = ['Func']

        if arg_2:
            arg_3.append('-q')

        arg_3.append('{:f}'.format(arg_1 * 100.))

        arg_0.effects.extend(arg_3)
        arg_0.effects_log.append('Func')

        return arg_0

Pitch shift the audio without changing the tempo .


def Func ( arg_0 , arg_1 , arg_2 = '' ) : try : arg_3 = arg_2 + inspect . formatargspec ( * getargspec ( arg_1 ) ) return py3compat . unicode_to_str ( arg_3 , 'ascii' ) except : return None

def Func(arg_0,arg_1,arg_2=''):
        """Return the definition header for any callable object.

        If any exception is generated, None is returned instead and the
        exception is suppressed."""

        try:
            # We need a plain string here, NOT unicode!
            arg_3 = arg_2 + inspect.formatargspec(*getargspec(arg_1))
            return py3compat.unicode_to_str(arg_3, 'ascii')
        except:
            return None

Return the definition header for any callable object .


def Func(arg_0, arg_1):
        """
        Ask the solver for one possible assignment for given expression using current set of constraints.
        The current set of expressions must be sat.

        NOTE: This is an internal method: it uses the current solver state (set of constraints!).
        """
        if not issymbolic(arg_1):
            return arg_1
        assert isinstance(arg_1, Variable)

        if isinstance(arg_1, Array):
            arg_2 = bytearray()
            for arg_3 in arg_1:
                arg_4 = translate_to_smtlib(arg_3)
                arg_0._send('(get-value (%s))' % arg_4)
                arg_5 = arg_0._recv()
                arg_2.append(int('0x{:s}'.format(arg_5.split(arg_4)[1][3:-2]), 16))
            return bytes(arg_2)
        else:
            arg_0._send('(get-value (%s))' % arg_1.name)
            arg_6 = arg_0._recv()
            assert arg_6.startswith('((') and arg_6.endswith('))'), arg_6

            if isinstance(arg_1, Bool):
                return {'true': True, 'false': False}[arg_6[2:-2].split(' ')[1]]
            elif isinstance(arg_1, BitVec):
                arg_7, arg_8 = arg_0._get_value_fmt
                arg_9 = arg_7.match(arg_6)
                arg_10, arg_11 = arg_9.group('expr'), arg_9.group('value')
                return int(arg_11, arg_8)

        raise NotImplementedError("Func only implemented for Bool and BitVec")

Ask the solver for one possible assignment for given expression using current set of constraints . The current set of expressions must be sat .


def Func ( arg_0 , arg_1 ) : arg_1 = kl . Lambda ( kb . one_hot , arguments = { "num_classes" : arg_0 . symbols_number_ } , output_shape = lambda x : tuple ( x ) + ( arg_0 . symbols_number_ , ) ) ( arg_1 ) arg_2 = kl . Dense ( arg_0 . char_embeddings_size , use_bias = False ) ( arg_1 ) arg_3 = [ ] arg_0 . char_output_dim_ = 0 for arg_5 , arg_6 in zip ( arg_0 . char_window_size , arg_0 . char_filters ) : arg_7 = arg_2 arg_8 = ( min ( arg_0 . char_filter_multiple * arg_5 , 200 ) if arg_6 is None else arg_6 ) for arg_9 in range ( arg_0 . char_conv_layers - 1 ) : arg_7 = kl . Conv2D ( arg_8 , ( 1 , arg_5 ) , padding = "same" , activation = "relu" , data_format = "channels_last" ) ( arg_7 ) if arg_0 . conv_dropout > 0.0 : arg_7 = kl . Dropout ( arg_0 . conv_dropout ) ( arg_7 ) arg_7 = kl . Conv2D ( arg_8 , ( 1 , arg_5 ) , padding = "same" , activation = "relu" , data_format = "channels_last" ) ( arg_7 ) arg_3 . append ( arg_7 ) arg_0 . char_output_dim_ += arg_8 if len ( arg_3 ) > 1 : arg_10 = kl . Concatenate ( axis = - 1 ) ( arg_3 ) else : arg_10 = arg_3 [ 0 ] arg_11 = kl . Lambda ( kb . max , arguments = { "axis" : - 2 } ) ( arg_10 ) if arg_0 . intermediate_dropout > 0.0 : arg_11 = kl . Dropout ( arg_0 . intermediate_dropout ) ( arg_11 ) for arg_12 in range ( arg_0 . char_highway_layers - 1 ) : arg_11 = Highway ( activation = "relu" ) ( arg_11 ) if arg_0 . highway_dropout > 0.0 : arg_11 = kl . Dropout ( arg_0 . highway_dropout ) ( arg_11 ) arg_13 = Highway ( activation = "relu" ) ( arg_11 ) return arg_13

def Func(arg_0, arg_1):
        """Builds word-level network
        """
        arg_1 = kl.Lambda(kb.one_hot, arguments={"num_classes": arg_0.symbols_number_},
                           output_shape=lambda x: tuple(x) + (arg_0.symbols_number_,))(arg_1)
        arg_2 = kl.Dense(arg_0.char_embeddings_size, use_bias=False)(arg_1)
        arg_3 = []
        arg_0.char_output_dim_ = 0
        for arg_5, arg_6 in zip(arg_0.char_window_size, arg_0.char_filters):
            arg_7 = arg_2
            arg_8 = (min(arg_0.char_filter_multiple * arg_5, 200)
                                   if arg_6 is None else arg_6)
            for arg_9 in range(arg_0.char_conv_layers - 1):
                arg_7 = kl.Conv2D(arg_8, (1, arg_5),
                                        padding="same", activation="relu",
                                        data_format="channels_last")(arg_7)
                if arg_0.conv_dropout > 0.0:
                    arg_7 = kl.Dropout(arg_0.conv_dropout)(arg_7)
            arg_7 = kl.Conv2D(arg_8, (1, arg_5),
                                    padding="same", activation="relu",
                                    data_format="channels_last")(arg_7)
            arg_3.append(arg_7)
            arg_0.char_output_dim_ += arg_8
        if len(arg_3) > 1:
            arg_10 = kl.Concatenate(axis=-1)(arg_3)
        else:
            arg_10 = arg_3[0]
        arg_11 = kl.Lambda(kb.max, arguments={"axis": -2})(arg_10)
        if arg_0.intermediate_dropout > 0.0:
            arg_11 = kl.Dropout(arg_0.intermediate_dropout)(arg_11)
        for arg_12 in range(arg_0.char_highway_layers - 1):
            arg_11 = Highway(activation="relu")(arg_11)
            if arg_0.highway_dropout > 0.0:
                arg_11 = kl.Dropout(arg_0.highway_dropout)(arg_11)
        arg_13 = Highway(activation="relu")(arg_11)
        return arg_13


def Func ( arg_0 = None ) : if arg_0 is None : arg_0 = GIT_PATH arg_1 = check_output ( [ arg_0 , "--version" ] ) . split ( ) [ 2 ] return arg_1

def Func(arg_0=None):
    """
    Get the Git version.
    """
    if arg_0 is None: arg_0 = GIT_PATH
    arg_1 = check_output([arg_0, "--version"]).split()[2]
    return arg_1


(self, path_or_file, strict=True, fmt='auto')

def Func ( arg_0 , arg_1 , arg_2 = True , arg_3 = 'auto' ) : arg_0 . validate ( arg_2 = arg_2 ) with _open ( arg_1 , mode = 'w' , arg_3 = arg_3 ) as fdesc : json . dump ( arg_0 . __json__ , fdesc , indent = 2 )

def Func(arg_0, arg_1, arg_2=True, arg_3='auto'):
        """Serialize annotation as a JSON formatted stream to file.

        Parameters
        ----------
        path_or_file : str or file-like
            Path to Func the JAMS object on disk
            OR
            An open file descriptor to write into

        strict : bool
            Force strict schema validation

        fmt : str ['auto', 'jams', 'jamz']
            The output encoding format.

            If `auto`, it is inferred from the file name.

            If the input is an open file handle, `jams` encoding
            is used.

        Raises
        ------
        SchemaError
            If `strict == True` and the JAMS object fails schema
            or namespace validation.

        See also
        --------
        validate
        """

        arg_0.validate(arg_2=arg_2)

        with _open(arg_1, mode='w', arg_3=arg_3) as fdesc:
            json.dump(arg_0.__json__, fdesc, indent=2)

Serialize annotation as a JSON formatted stream to file.

        Parameters
        ----------
        path_or_file : str or file-like
            Path to save the JAMS object on disk
            OR
            An open file descriptor to write into

        strict : bool
            Force strict schema validation

        fmt : str ['auto', 'jams', 'jamz']
            The output encoding format.

            If `auto`, it is inferred from the file name.

            If the input is an open file handle, `jams` encoding
            is used.

        Raises
        ------
        SchemaError
            If `strict == True` and the JAMS object fails schema
            or namespace validation.

        See also
        --------
        validate

Serialize annotation as a JSON formatted stream to file .


def
Func
(
arg_0
)
:
arg_1
=
try
:
with
open
(
arg_0
[
"TESTPLAN_FPATH"
]
)
as
declr_fd
:
arg_1
=
yaml
.
safe_load
(
declr_fd
)
except
AttributeError
as
exc
:
cij
.
err
(
"rnr: %r"
%
exc
)
if
not
arg_1
:
return
arg_2
=
copy
.
deepcopy
(
TRUN
)
arg_2
[
"ver"
]
=
cij
.
VERSION
arg_2
[
"conf"
]
=
copy
.
deepcopy
(
arg_0
)
arg_2
[
"res_root"
]
=
arg_0
[
"OUTPUT"
]
arg_2
[
"aux_root"
]
=
os
.
sep
.
join
(
[
arg_2
[
"res_root"
]
,
"_aux"
]
)
arg_2
[
"evars"
]
.
update
(
copy
.
deepcopy
(
arg_1
.
get
(
"evars"
,
{
}
)
)
)
os
.
makedirs
(
arg_2
[
"aux_root"
]
)
arg_3
=
arg_1
.
get
(
"hooks"
,
[
]
)
if
"lock"
not
in
arg_3
:
arg_3
=
[
"lock"
]
+
arg_3
if
arg_3
[
0
]
!=
"lock"
:
return
arg_2
[
"hooks"
]
=
hooks_setup
(
arg_2
,
arg_2
,
arg_3
)
for
arg_4
,
arg_1
in
enumerate
(
arg_1
[
"testsuites"
]
)
:
arg_5
=
tsuite_setup
(
arg_2
,
arg_1
,
arg_4
)
if
arg_5
is
:
cij
.
err
(
"main::FAILED: setting up tsuite: %r"
%
arg_5
)
return
1
arg_2
[
"testsuites"
]
.
append
(
arg_5
)
arg_2
[
"progress"
]
[
"UNKN"
]
+=
len
(
arg_5
[
"testcases"
]
)
return
arg_2

def Func(arg_0):
    """
    Setup the testrunner data-structure, embedding the parsed environment
    variables and command-line arguments and continues with setup for testplans,
    testsuites, and testcases
    """

    arg_1 = None
    try:
        with open(arg_0["TESTPLAN_FPATH"]) as declr_fd:
            arg_1 = yaml.safe_load(declr_fd)
    except AttributeError as exc:
        cij.err("rnr: %r" % exc)

    if not arg_1:
        return None

    arg_2 = copy.deepcopy(TRUN)
    arg_2["ver"] = cij.VERSION

    arg_2["conf"] = copy.deepcopy(arg_0)
    arg_2["res_root"] = arg_0["OUTPUT"]
    arg_2["aux_root"] = os.sep.join([arg_2["res_root"], "_aux"])
    arg_2["evars"].update(copy.deepcopy(arg_1.get("evars", {})))

    os.makedirs(arg_2["aux_root"])

    arg_3 = arg_1.get("hooks", [])
    if "lock" not in arg_3:
        arg_3 = ["lock"] + arg_3

    if arg_3[0] != "lock":
        return None

    # Setup top-level hooks
    arg_2["hooks"] = hooks_setup(arg_2, arg_2, arg_3)

    for arg_4, arg_1 in enumerate(arg_1["testsuites"]):  # Setup testsuites
        arg_5 = tsuite_setup(arg_2, arg_1, arg_4)
        if arg_5 is None:
            cij.err("main::FAILED: setting up tsuite: %r" % arg_5)
            return 1

        arg_2["testsuites"].append(arg_5)
        arg_2["progress"]["UNKN"] += len(arg_5["testcases"])

    return arg_2

Setup the testrunner data - structure embedding the parsed environment variables and command - line arguments and continues with setup for testplans testsuites and testcases


def Func(arg_0, arg_1):
        """
        If there are tasks left over in the executor,
        we set them back to SCHEDULED to avoid creating hanging tasks.

        :param session: session for ORM operations
        """
        if arg_0.executor.queued_tasks:
            arg_2 = models.TaskInstance
            arg_3 = (
                [and_(
                    arg_2.dag_id == dag_id,
                    arg_2.task_id == task_id,
                    arg_2.execution_date == execution_date,
                    # The TI.try_number will return raw try_number+1 since the
                    # ti is not running. And we need to -1 to match the DB record.
                    arg_2._try_number == try_number - 1,
                    arg_2.state == State.QUEUED)
                    for dag_id, task_id, execution_date, try_number
                    in arg_0.executor.queued_tasks.keys()])
            arg_4 = (arg_1.query(arg_2)
                        .filter(or_(*arg_3)))
            arg_5 = (arg_4
                                       .with_for_update()
                                       .all())
            if len(arg_5) == 0:
                arg_1.commit()
                return

            # set TIs to queued state
            for arg_6 in arg_5:
                arg_6.state = State.SCHEDULED

            arg_8 = "\n\t".join(
                [repr(x) for x in arg_5])

            arg_1.commit()
            arg_0.log.info("Set the following tasks to scheduled state:\n\t%s", arg_8)

If there are tasks left over in the executor we set them back to SCHEDULED to avoid creating hanging tasks .


def Func(arg_0):
        """GSEA main procedure"""

        assert arg_0.permutation_type in ["phenotype", "gene_set"]
        assert arg_0.min_size <= arg_0.max_size

        # Start Analysis
        arg_0._logger.info("Parsing data files for GSEA.............................")
        # phenotype labels parsing
        arg_1, arg_2, arg_3 = gsea_cls_parser(arg_0.classes)
        # select correct expression genes and values.
        arg_4 = arg_0.load_data(arg_3)
        # data frame must have length > 1
        assert len(arg_4) > 1
        # ranking metrics calculation.
        arg_5 = ranking_metric(df=arg_4, method=arg_0.method, pos=arg_1, neg=arg_2,
                              classes=arg_3, ascending=arg_0.ascending)
        arg_0.ranking = arg_5
        # filtering out gene sets and build gene sets dictionary
        arg_7 = arg_0.load_gmt(gene_list=arg_5.index.values, arg_7=arg_0.gene_sets)

        arg_0._logger.info("%04d gene_sets used for further statistical testing....."% len(arg_7))
        arg_0._logger.info("Start to Func GSEA...Might take a while..................")
        # cpu numbers
        arg_0._set_cores()
        # compute ES, NES, pval, FDR, RES
        arg_8 = arg_4 if arg_0.permutation_type =='phenotype' else arg_5
        arg_9,arg_10,arg_11, arg_12 = gsea_compute_tensor(data=arg_8, arg_7=arg_7, n=arg_0.permutation_num,
                                                             weighted_score_type=arg_0.weighted_score_type,
                                                             permutation_type=arg_0.permutation_type,
                                                             method=arg_0.method,
                                                             pheno_pos=arg_1, pheno_neg=arg_2,
                                                             classes=arg_3, ascending=arg_0.ascending,
                                                             processes=arg_0._processes, seed=arg_0.seed)

        arg_0._logger.info("Start to generate GSEApy reports and figures............")
        arg_13 = zip(arg_12, list(arg_9), arg_10, arg_11)
        arg_0._save_results(zipdata=arg_13, outdir=arg_0.outdir, module=arg_0.module,
                                   arg_7=arg_7, rank_metric=arg_5, permutation_type=arg_0.permutation_type)

        # reorder datarame for heatmap
        arg_0._heatmat(df=arg_4.loc[arg_5.index], classes=arg_3,
                      pheno_pos=arg_1, pheno_neg=arg_2)
        # Plotting
        if not arg_0._noplot:
            arg_0._plotting(rank_metric=arg_5, results=arg_0.results,
                           graph_num=arg_0.graph_num, outdir=arg_0.outdir,
                           figsize=arg_0.figsize, format=arg_0.format,
                           pheno_pos=arg_1, pheno_neg=arg_2)

        arg_0._logger.info("Congratulations. GSEApy ran successfully.................\n")
        if arg_0._outdir is None:
            arg_0._tmpdir.cleanup()

        return


def
Func
(
arg_0
,
arg_1
)
:
for
arg_2
,
arg_3
in
arg_0
.
get_registry
(
)
.
items
(
)
:
if
re
.
match
(
arg_3
,
arg_1
)
is
not
:
return
arg_2
raise
OEmbedMissingEndpoint
(
'No endpoint matches URL: %s'
%
arg_1
)

def Func(arg_0, arg_1):
        """
        Find the right provider for a URL
        """
        for arg_2, arg_3 in arg_0.get_registry().items():
            if re.match(arg_3, arg_1) is not None:
                return arg_2

        raise OEmbedMissingEndpoint('No endpoint matches URL: %s' % arg_1)


def Func(arg_0, arg_1):
        """
        Add certificate to chain

        :param certobj: The X509 certificate object to add to the chain
        :return: None
        """
        if not isinstance(arg_1, X509):
            raise TypeError("certobj must be an X509 instance")

        arg_2 = _lib.X509_dup(arg_1._x509)
        arg_3 = _lib.SSL_CTX_Func(arg_0._context, arg_2)
        if not arg_3:
            # TODO: This is untested.
            _lib.X509_free(arg_2)
            _raise_current_error()


def Func ( arg_0 ) : arg_0 . actionOpen . triggered . connect ( arg_0 . on_open ) arg_0 . actionNew . triggered . connect ( arg_0 . on_new ) arg_0 . actionSave . triggered . connect ( arg_0 . on_save ) arg_0 . actionSave_as . triggered . connect ( arg_0 . on_save_as ) arg_0 . actionQuit . triggered . connect ( QtWidgets . QApplication . instance ( ) . quit ) arg_0 . tabWidget . current_changed . connect ( arg_0 . on_current_tab_changed ) arg_0 . tabWidget . last_tab_closed . connect ( arg_0 . on_last_tab_closed ) arg_0 . actionAbout . triggered . connect ( arg_0 . on_about ) arg_0 . actionRun . triggered . connect ( arg_0 . on_run ) arg_0 . interactiveConsole . process_finished . connect ( arg_0 . on_process_finished ) arg_0 . actionConfigure_run . triggered . connect ( arg_0 . on_configure_run )

def Func(arg_0):
        """ Connects slots to signals """
        arg_0.actionOpen.triggered.connect(arg_0.on_open)
        arg_0.actionNew.triggered.connect(arg_0.on_new)
        arg_0.actionSave.triggered.connect(arg_0.on_save)
        arg_0.actionSave_as.triggered.connect(arg_0.on_save_as)
        arg_0.actionQuit.triggered.connect(
            QtWidgets.QApplication.instance().quit)
        arg_0.tabWidget.current_changed.connect(arg_0.on_current_tab_changed)
        arg_0.tabWidget.last_tab_closed.connect(arg_0.on_last_tab_closed)
        arg_0.actionAbout.triggered.connect(arg_0.on_about)
        arg_0.actionRun.triggered.connect(arg_0.on_run)
        arg_0.interactiveConsole.process_finished.connect(
            arg_0.on_process_finished)
        arg_0.actionConfigure_run.triggered.connect(arg_0.on_configure_run)


def Func ( arg_0 , arg_1 = 1000 ) : for arg_2 in range ( arg_1 ) : if arg_0 . is_done ( ) : return arg_0 . step ( )

def Func(arg_0, arg_1=1000):
        "Run the Environment for given number of time steps."
        for arg_2 in range(arg_1):
            if arg_0.is_done(): return
            arg_0.step()

Run the Environment for given number of time steps .


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

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

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

Selects even - even nuclei from the table