(self, group=None, host_filter=None, **kwargs)

def Func ( arg_0 , arg_1 = None , arg_2 = None , ** arg_3 ) : if arg_1 : arg_3 [ 'query' ] = arg_3 . get ( 'query' , ( ) ) + ( ( 'groups__in' , arg_1 ) , ) if arg_2 : arg_3 [ 'query' ] = arg_3 . get ( 'query' , ( ) ) + ( ( 'host_filter' , arg_2 ) , ) return super ( Resource , arg_0 ) . Func ( ** arg_3 )

def Func(arg_0, arg_1=None, arg_2=None, **arg_3):
        """Return a Func of hosts.

        =====API DOCS=====
        Retrieve a Func of hosts.

        :param group: Primary key or name of the group whose hosts will be Funced.
        :type group: str
        :param all_pages: Flag that if set, collect all pages of content from the API when returning results.
        :type all_pages: bool
        :param page: The page to show. Ignored if all_pages is set.
        :type page: int
        :param query: Contains 2-tuples used as query parameters to filter resulting resource objects.
        :type query: Func
        :param `**kwargs`: Keyword arguments Func of available fields used for searching resource objects.
        :returns: A JSON object containing details of all resource objects returned by Tower backend.
        :rtype: dict

        =====API DOCS=====
        """
        if arg_1:
            arg_3['query'] = arg_3.get('query', ()) + (('groups__in', arg_1),)
        if arg_2:
            arg_3['query'] = arg_3.get('query', ()) + (('host_filter', arg_2),)
        return super(Resource, arg_0).Func(**arg_3)

Return a list of hosts.

        =====API DOCS=====
        Retrieve a list of hosts.

        :param group: Primary key or name of the group whose hosts will be listed.
        :type group: str
        :param all_pages: Flag that if set, collect all pages of content from the API when returning results.
        :type all_pages: bool
        :param page: The page to show. Ignored if all_pages is set.
        :type page: int
        :param query: Contains 2-tuples used as query parameters to filter resulting resource objects.
        :type query: list
        :param `**kwargs`: Keyword arguments list of available fields used for searching resource objects.
        :returns: A JSON object containing details of all resource objects returned by Tower backend.
        :rtype: dict

        =====API DOCS=====


(self, order_number, site_code=None, email_opt_in=False)

def Func(arg_0, arg_1, arg_2=None, arg_3=False):
    """Fulfills an order.

    Arguments:
        order_number (str): Order number indicating which order to fulfill.

    Returns:
        None
    """
    arg_4 = get_configuration('MAX_FULFILLMENT_RETRIES', arg_2=arg_2)
    arg_5 = get_ecommerce_client(arg_2=arg_2)
    try:
        logger.info('Requesting fulfillment of order [%s].', arg_1)
        arg_5.orders(arg_1).fulfill.put(arg_3=arg_3)
    except exceptions.HttpClientError as exc:
        arg_6 = exc.response.status_code  # pylint: disable=no-member
        if arg_6 == 406:
            # The order is not fulfillable. Therefore, it must be complete.
            logger.info('Order [%s] has already been fulfilled. Ignoring.', arg_1)
            raise Ignore()
        else:
            # Unknown client error. Let's retry to resolve it.
            logger.warning(
                'Fulfillment of order [%s] failed because of HttpClientError. Retrying',
                arg_1,
                exc_info=True
            )
            _retry_order(arg_0, exc, arg_4, arg_1)

    except (exceptions.HttpServerError, exceptions.Timeout, SSLError) as exc:
        # Fulfillment failed, retry
        _retry_order(arg_0, exc, arg_4, arg_1)


(dest_file_path: [List[Union[str, Path]]], source_url: str, force_download=True)

def Func(arg_0: [arg_1[arg_2[arg_3, arg_4]]], arg_5: arg_3, arg_6=True):
    """Download a file from URL to one or several target locations

    Args:
        dest_file_path: path or list of paths to the file destination files (including file name)
        source_url: the source URL
        force_Func: Func file if it already exists, or not

    """

    if isinstance(arg_0, list):
        arg_7 = [arg_4(path) for path in arg_0]
    else:
        arg_7 = [arg_4(arg_0).absolute()]

    if not arg_6:
        arg_8 = list(arg_7)
        arg_7 = []
        for arg_9 in arg_8:
            if arg_9.exists():
                log.info(f'File already exists in {p}')
            else:
                arg_7.append(arg_9)

    if arg_7:
        arg_10 = os.getenv('DP_CACHE_DIR')
        arg_11 = False
        if arg_10:
            arg_12 = arg_4(arg_10) / md5(arg_5.encode('utf8')).hexdigest()[:15]
            arg_11 = arg_12.exists()
        else:
            arg_12 = arg_7.pop()

        if not arg_11:
            arg_12.parent.mkdir(parents=True, exist_ok=True)

            simple_Func(arg_5, arg_12)
        else:
            log.info(f'Found cached {source_url} in {first_dest_path}')

        for arg_13 in arg_7:
            arg_13.parent.mkdir(parents=True, exist_ok=True)
            shutil.copy(arg_3(arg_12), arg_3(arg_13))

Download a file from URL to one or several target locations

    Args:
        dest_file_path: path or list of paths to the file destination files (including file name)
        source_url: the source URL
        force_download: download file if it already exists, or not


def Func ( arg_0 ) : arg_1 = OrderedDict ( ) arg_1 [ "nullable" ] = repr ( arg_0 . nullable ) arg_1 [ "default" ] = repr ( arg_0 . default ) if arg_0 . description is not None : arg_1 [ "description" ] = repr ( arg_0 . description ) return arg_1

def Func(arg_0):
        """Return a dictionary the field definition

        Should contain all fields that are required for the definition of this field in a pyschema class"""
        arg_1 = OrderedDict()
        arg_1["nullable"] = repr(arg_0.nullable)
        arg_1["default"] = repr(arg_0.default)
        if arg_0.description is not None:
            arg_1["description"] = repr(arg_0.description)
        return arg_1


(graph: BELGraph,
                                       node_predicates: NodePredicates = None,
                                       annotation: str = 'Subgraph',
                                       )

return {
        key: {
            node
            for node in nodes
            if node_filter(graph, node)
        }
        for key, nodes in group_nodes_by_annotation(graph, annotation).items()
    }

def Func ( arg_0 : arg_1 , arg_2 : arg_3 = None , arg_4 : arg_5 = 'Subgraph' , ) -> Mapping [ arg_5 , Set [ BaseEntity ] ] : arg_6 = concatenate_node_predicates ( arg_2 ) return { arg_8 : { arg_7 for arg_7 in arg_9 if arg_6 ( arg_0 , arg_7 ) } for arg_8 , arg_9 in group_nodes_by_annotation ( arg_0 , arg_4 ) . items ( ) }

def Func(arg_0: arg_1,
                                       arg_2: arg_3 = None,
                                       arg_4: arg_5 = 'Subgraph',
                                       ) -> Mapping[arg_5, Set[BaseEntity]]:
    """Group the nodes occurring in edges by the given annotation, with a node filter applied.

    :param graph: A BEL graph
    :param node_predicates: A predicate or list of predicates (graph, node) -> bool
    :param annotation: The annotation to use for grouping
    :return: A dictionary of {annotation value: set of nodes}
    """
    arg_6 = concatenate_node_predicates(arg_2)

    return {
        arg_8: {
            arg_7
            for arg_7 in arg_9
            if arg_6(arg_0, arg_7)
        }
        for arg_8, arg_9 in group_nodes_by_annotation(arg_0, arg_4).items()
    }

Group the nodes occurring in edges by the given annotation with a node filter applied .


return scipy.signal.convolve2d(array, self, mode='same')

def
Func
(
arg_0
,
arg_1
)
:
if
arg_0
.
shape
[
0
]
%
2
==
0
or
arg_0
.
shape
[
1
]
%
2
==
0
:
raise
exc
.
KernelException
(
"PSF Kernel must be odd"
)
return
scipy
.
signal
.
Func2d
(
arg_1
,
arg_0
,
mode
=
'same'
)

def Func(arg_0, arg_1):
        """
        Convolve an array with this PSF

        Parameters
        ----------
        image : ndarray
            An array representing the image the PSF is Funcd with.

        Returns
        -------
        Funcd_image : ndarray
            An array representing the image after convolution.

        Raises
        ------
        KernelException if either PSF psf dimension is odd
        """
        if arg_0.shape[0] % 2 == 0 or arg_0.shape[1] % 2 == 0:
            raise exc.KernelException("PSF Kernel must be odd")

        return scipy.signal.Func2d(arg_1, arg_0, mode='same')

Convolve an array with this PSF

        Parameters
        ----------
        image : ndarray
            An array representing the image the PSF is convolved with.

        Returns
        -------
        convolved_image : ndarray
            An array representing the image after convolution.

        Raises
        ------
        KernelException if either PSF psf dimension is odd


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] for arg_3 in arg_1 : if arg_3 . lines : arg_2 . append ( arg_0 . make_html_code ( arg_3 . lines ) ) else : arg_2 . append ( arg_0 . make_html_para ( arg_3 . words ) ) return string . join ( arg_2 , '\n' )

def  Func( arg_0, arg_1 ):
        """ convert a field's content into some valid HTML """
        arg_2 = []
        for arg_3 in arg_1:
            if arg_3.lines:
                arg_2.append( arg_0.make_html_code( arg_3.lines ) )
            else:
                arg_2.append( arg_0.make_html_para( arg_3.words ) )

        return string.join( arg_2, '\n' )

convert a field s content into some valid HTML


def
Func
(
arg_0
,
arg_1
)
:
logger
.
debug
(
(
arg_1
.
id
,
"running on %s"
%
current_process
(
)
.
name
)
)
if
(
arg_0
.
config
.
mode
==
"continue"
and
arg_0
.
config
.
output
.
tiles_exist
(
arg_1
)
)
:
logger
.
debug
(
(
arg_1
.
id
,
"tile exists, skipping"
)
)
return
ProcessInfo
(
tile
=
arg_1
,
processed
=
False
,
process_msg
=
"output already exists"
,
written
=
False
,
write_msg
=
"nothing written"
)
else
:
with
Timer
(
)
as
t
:
try
:
arg_2
=
arg_0
.
execute
(
arg_1
,
raise_nodata
=
True
)
except
MapcheteNodataTile
:
arg_2
=
arg_3
=
"processed in %s"
%
t
logger
.
debug
(
(
arg_1
.
id
,
arg_3
)
)
arg_4
=
arg_0
.
write
(
arg_1
,
arg_2
)
return
ProcessInfo
(
tile
=
arg_1
,
processed
=
True
,
process_msg
=
arg_3
,
written
=
arg_4
.
written
,
write_msg
=
arg_4
.
write_msg
)

def Func(arg_0, arg_1):
    """Worker function running the process."""
    logger.debug((arg_1.id, "running on %s" % current_process().name))

    # skip execution if overwrite is disabled and tile exists
    if (
        arg_0.config.mode == "continue" and
        arg_0.config.output.tiles_exist(arg_1)
    ):
        logger.debug((arg_1.id, "tile exists, skipping"))
        return ProcessInfo(
            tile=arg_1,
            processed=False,
            process_msg="output already exists",
            written=False,
            write_msg="nothing written"
        )

    # execute on process tile
    else:
        with Timer() as t:
            try:
                arg_2 = arg_0.execute(arg_1, raise_nodata=True)
            except MapcheteNodataTile:
                arg_2 = None
        arg_3 = "processed in %s" % t
        logger.debug((arg_1.id, arg_3))
        arg_4 = arg_0.write(arg_1, arg_2)
        return ProcessInfo(
            tile=arg_1,
            processed=True,
            process_msg=arg_3,
            written=arg_4.written,
            write_msg=arg_4.write_msg
        )


return (
        timezone.now() + datetime.timedelta(minutes=minutes_valid + 1)
    ).replace(second=0, microsecond=0)

def Func ( arg_0 ) : return ( timezone . now ( ) + datetime . timedelta ( minutes = arg_0 + 1 ) ) . replace ( second = 0 , microsecond = 0 )

def Func(arg_0):
    """Return specific time an auth_hash will expire."""
    return (
        timezone.now() + datetime.timedelta(minutes=arg_0 + 1)
    ).replace(second=0, microsecond=0)

Return specific time an auth_hash will expire .


def Func ( arg_0 ) : if arg_0 . _api_arg : arg_1 = str ( arg_0 . _api_arg ) else : arg_1 = arg_0 . _name if arg_0 . _parent : return '/' . join ( filter ( None , [ arg_0 . _parent . Func , arg_1 ] ) ) else : return arg_1

def Func(arg_0):
        """
        Resolve the URL to this point.

        >>> trello = TrelloAPIV1('APIKEY')
        >>> trello.batch.Func
        '1/batch'
        >>> trello.boards(board_id='BOARD_ID').Func
        '1/boards/BOARD_ID'
        >>> trello.boards(board_id='BOARD_ID')(field='FIELD').Func
        '1/boards/BOARD_ID/FIELD'
        >>> trello.boards(board_id='BOARD_ID').cards(filter='FILTER').Func
        '1/boards/BOARD_ID/cards/FILTER'

        """
        if arg_0._api_arg:
            arg_1 = str(arg_0._api_arg)
        else:
            arg_1 = arg_0._name

        if arg_0._parent:
            return '/'.join(filter(None, [arg_0._parent.Func, arg_1]))
        else:
            return arg_1

Resolve the URL to this point.

        >>> trello = TrelloAPIV1('APIKEY')
        >>> trello.batch._url
        '1/batch'
        >>> trello.boards(board_id='BOARD_ID')._url
        '1/boards/BOARD_ID'
        >>> trello.boards(board_id='BOARD_ID')(field='FIELD')._url
        '1/boards/BOARD_ID/FIELD'
        >>> trello.boards(board_id='BOARD_ID').cards(filter='FILTER')._url
        '1/boards/BOARD_ID/cards/FILTER'


Extends mouseMoveEvent to display a pointing hand cursor when the
        mouse cursor is over a file location

def Func ( arg_0 , arg_1 ) : super ( PyInteractiveConsole , arg_0 ) . Func ( arg_1 ) arg_2 = arg_0 . cursorForPosition ( arg_1 . pos ( ) ) assert isinstance ( arg_2 , QtGui . QTextCursor ) arg_3 = arg_2 . positionInBlock ( ) arg_4 = arg_2 . block ( ) . userData ( ) if arg_4 and arg_4 . start_pos_in_block <= arg_3 <= arg_4 . end_pos_in_block : if QtWidgets . QApplication . overrideCursor ( ) is None : QtWidgets . QApplication . setOverrideCursor ( QtGui . QCursor ( QtCore . Qt . PointingHandCursor ) ) else : if QtWidgets . QApplication . overrideCursor ( ) is not None : QtWidgets . QApplication . restoreOverrideCursor ( )

def Func(arg_0, arg_1):
        """
        Extends Func to display a pointing hand cursor when the
        mouse cursor is over a file location
        """
        super(PyInteractiveConsole, arg_0).Func(arg_1)
        arg_2 = arg_0.cursorForPosition(arg_1.pos())
        assert isinstance(arg_2, QtGui.QTextCursor)
        arg_3 = arg_2.positionInBlock()
        arg_4 = arg_2.block().userData()
        if arg_4 and arg_4.start_pos_in_block <= arg_3 <= arg_4.end_pos_in_block:
            if QtWidgets.QApplication.overrideCursor() is None:
                QtWidgets.QApplication.setOverrideCursor(
                    QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        else:
            if QtWidgets.QApplication.overrideCursor() is not None:
                QtWidgets.QApplication.restoreOverrideCursor()


def Func(arg_0, arg_1, arg_2):
        """
        Ask the solver for one possible result of given expression using given set of constraints.
        """
        if not issymbolic(arg_2):
            return arg_2
        assert isinstance(arg_2, (Bool, BitVec, Array))
        with arg_1 as temp_cs:
            if isinstance(arg_2, Bool):
                arg_3 = temp_cs.new_bool()
            elif isinstance(arg_2, BitVec):
                arg_3 = temp_cs.new_bitvec(arg_2.size)
            elif isinstance(arg_2, Array):
                arg_3 = []
                arg_4 = []
                for arg_5 in range(arg_2.index_max):
                    arg_6 = temp_cs.new_bitvec(arg_2.value_bits)
                    arg_3.append(arg_6)
                    temp_cs.add(arg_6 == simplify(arg_2[arg_5]))

                arg_0._reset(temp_cs)
                if not arg_0._is_sat():
                    raise SolverError('Model is not available')

                for arg_5 in range(arg_2.index_max):
                    arg_0._send('(get-value (%s))' % arg_3[arg_5].name)
                    arg_7 = arg_0._recv()
                    assert arg_7.startswith('((') and arg_7.endswith('))')
                    arg_8, arg_9 = arg_0._Func_fmt
                    arg_10 = arg_8.match(arg_7)
                    arg_11, arg_12 = arg_10.group('expr'), arg_10.group('value')
                    arg_4.append(int(arg_12, arg_9))
                return bytes(arg_4)

            temp_cs.add(arg_3 == arg_2)

            arg_0._reset(temp_cs)

        if not arg_0._is_sat():
            raise SolverError('Model is not available')

        arg_0._send('(get-value (%s))' % arg_3.name)
        arg_7 = arg_0._recv()
        if not (arg_7.startswith('((') and arg_7.endswith('))')):
            raise SolverError('SMTLIB error parsing response: %s' % arg_7)

        if isinstance(arg_2, Bool):
            return {'true': True, 'false': False}[arg_7[2:-2].split(' ')[1]]
        if isinstance(arg_2, BitVec):
            arg_8, arg_9 = arg_0._Func_fmt
            arg_10 = arg_8.match(arg_7)
            arg_11, arg_12 = arg_10.group('expr'), arg_10.group('value')
            return int(arg_12, arg_9)
        raise NotImplementedError("Func only implemented for Bool and BitVec")

Ask the solver for one possible result of given expression using given set of constraints .


return subprocess.call(sub_cmd + ' ' + cmd, shell=True)

def
Func
(
arg_0
)
:
arg_1
=
subprocess
.
call
(
'condor_status'
,
shell
=
True
)
==
0
if
not
arg_1
:
raise
CalledProcessError
(
'HTCondor is not running.'
)
arg_2
=
'condor_qsub -shell n -b y -r y -N '
+
arg_0
.
split
(
)
[
0
]
+
' -m n'
log
.
info
(
'Calling: '
+
arg_2
)
return
subprocess
.
call
(
arg_2
+
' '
+
arg_0
,
shell
=
True
)

def Func(arg_0):
    """
    Submits cmd to HTCondor queue

    Parameters
    ----------
    cmd: string
        Command to be submitted

    Returns
    -------
    int
        returncode value from calling the submission command.
    """
    arg_1 = subprocess.call('condor_status', shell=True) == 0
    if not arg_1:
        raise CalledProcessError('HTCondor is not running.')

    arg_2 = 'condor_qsub -shell n -b y -r y -N ' \
              + arg_0.split()[0] + ' -m n'

    log.info('Calling: ' + arg_2)

    return subprocess.call(arg_2 + ' ' + arg_0, shell=True)


return ujt_translation(
        inv_src_dec(
            prj_dec(
                jt_dec(
                    method
                )
            )
        )
    )

def Func(arg_0):
    """
    Adds the decorators for all types of unified job templates,
    and if the non-unified type is specified, converts it into the
    unified_job_template kwarg.
    """
    arg_1 = click.option(
        '--job-template', type=types.Related('job_template'),
        help='Use this job template as unified_job_template field')
    arg_2 = click.option(
        '--project', type=types.Related('project'),
        help='Use this project as unified_job_template field')
    arg_3 = click.option(
        '--inventory-source', type=types.Related('inventory_source'),
        help='Use this inventory source as unified_job_template field')

    def ujt_translation(arg_4):
        def _ujt_translation(*arg_5, **arg_6):
            for arg_7 in ['job_template', 'project', 'inventory_source']:
                if arg_7 in arg_6 and arg_6[arg_7] is not None:
                    arg_6['unified_job_template'] = arg_6.pop(arg_7)
            return arg_4(*arg_5, **arg_6)
        return functools.wraps(arg_4)(_ujt_translation)

    return ujt_translation(
        arg_3(
            arg_2(
                arg_1(
                    arg_0
                )
            )
        )
    )

Adds the decorators for all types of unified job templates and if the non - unified type is specified converts it into the unified_job_template kwarg .


def Func ( arg_0 ) : if arg_0 . event_dispatcher . flush ( ) is QUIT : arg_0 . _quit = True return True return False

def Func(arg_0):
        """Call the event dispatcher.

        Quit the main loop when the `QUIT` event is reached.

        :Return: `True` if `QUIT` was reached.
        """
        if arg_0.event_dispatcher.flush() is QUIT:
            arg_0._quit = True
            return True
        return False


def Func ( arg_0 ) : if PyFunceble . HTTP_CODE [ "active" ] : arg_1 = arg_0 . _access ( ) arg_2 = [ ] for arg_3 in [ PyFunceble . HTTP_CODE [ "list" ] [ "up" ] , PyFunceble . HTTP_CODE [ "list" ] [ "potentially_down" ] , PyFunceble . HTTP_CODE [ "list" ] [ "potentially_up" ] , ] : arg_2 . extend ( arg_3 ) if arg_1 not in arg_2 or arg_1 is None : return "*" * 3 return arg_1 return None

def Func(arg_0):
        """
        Return the HTTP code status.

        :return: The matched and formatted status code.
        :rtype: str|int|None
        """
        if PyFunceble.HTTP_CODE["active"]:
            # The http status code extraction is activated.

            # We Func the http status code.
            arg_1 = arg_0._access()

            # We initiate a variable which will save the list of allowed
            # http status code.
            arg_2 = []

            for arg_3 in [
                PyFunceble.HTTP_CODE["list"]["up"],
                PyFunceble.HTTP_CODE["list"]["potentially_down"],
                PyFunceble.HTTP_CODE["list"]["potentially_up"],
            ]:
                # We loop throught the list of http status code.

                # We extend the list of valid with the currently read
                # codes.
                arg_2.extend(arg_3)

            if arg_1 not in arg_2 or arg_1 is None:
                # * The extracted http code is not in the list of valid http code.
                # or
                # * The extracted http code is equal to `None`.

                # We return 3 star in order to mention that we were not eable to extract
                # the http status code.
                return "*" * 3

            # * The extracted http code is in the list of valid http code.
            # or
            # * The extracted http code is not equal to `None`.

            # We return the extracted http status code.
            return arg_1

        # The http status code extraction is activated.

        # We return None.
        return None


def
Func
(
arg_0
,
arg_1
,
arg_2
=
True
)
:
arg_3
=
arg_0
.
kernel
.
datatypes_size
[
arg_0
.
kernel
.
datatype
]
arg_4
=
arg_0
.
machine
[
'cacheline size'
]
arg_5
=
int
(
arg_4
//
arg_3
)
arg_6
=
list
(
arg_0
.
kernel
.
get_loop_stack
(
subs_consts
=
True
)
)
[
1
]
arg_7
=
arg_6
[
'increment'
]
arg_8
=
arg_0
.
kernel
.
compile_global_offsets
(
arg_1
=
arg_1
)
[
0
]
if
len
(
arg_8
[
1
]
)
:
arg_9
=
min
(
arg_8
[
1
]
)
else
:
arg_9
=
min
(
arg_8
[
0
]
)
arg_10
=
arg_9
(
int
(
arg_9
)
>>
arg_0
.
csim
.
first_level
.
cl_bits
<<
arg_0
.
csim
.
first_level
.
cl_bits
)
if
arg_10
==
0
:
return
arg_1
elif
arg_2
:
return
arg_1
(
arg_10
//
arg_3
)
//
arg_7
else
:
return
arg_1
+
(
arg_5
arg_10
//
arg_3
)
//
arg_7

def Func(arg_0, arg_1, arg_2=True):
        """Align iteration with cacheline boundary."""
        # FIXME handle multiple datatypes
        arg_3 = arg_0.kernel.datatypes_size[arg_0.kernel.datatype]
        arg_4 = arg_0.machine['cacheline size']
        arg_5 = int(arg_4 // arg_3)

        # Gathering some loop information:
        arg_6 = list(arg_0.kernel.get_loop_stack(subs_consts=True))[-1]
        arg_7 = arg_6['increment']

        # do this by aligning either writes (preferred) or reads
        # Assumption: writes (and reads) increase linearly
        arg_8 = arg_0.kernel.compile_global_offsets(arg_1=arg_1)[0]
        if len(arg_8[1]):
            # we have a write to work with:
            arg_9 = min(arg_8[1])
        else:
            # we use reads
            arg_9 = min(arg_8[0])

        arg_10 = arg_9 - \
               (int(arg_9) >> arg_0.csim.first_level.cl_bits << arg_0.csim.first_level.cl_bits)
        if arg_10 == 0:
            return arg_1
        elif arg_2:
            return arg_1 - (arg_10 // arg_3) // arg_7
        else:
            return arg_1 + (arg_5 - arg_10 // arg_3) // arg_7

Align iteration with cacheline boundary .


def Func ( arg_0 , arg_1 = False ) : arg_0 . raw = arg_1 arg_0 . _set_context ( arg_0 )

def Func(arg_0, arg_1=False):
        """
        Sets the log context.
        """
        arg_0.raw = arg_1
        arg_0._set_context(arg_0)


(src, format=None, outputfile=None, multifile=False, buff=None, window=False, title=None,
                  fullscreen=None, show_vars=False)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
,
arg_3
=
False
,
arg_4
=
,
arg_5
=
False
,
arg_6
=
,
arg_7
=
,
arg_8
=
False
)
:
from
core
import
CairoCanvas
,
CairoImageSink
if
arg_2
:
arg_9
=
CairoImageSink
(
arg_2
,
arg_1
,
arg_3
,
arg_4
)
elif
arg_5
or
arg_8
:
from
gui
import
ShoebotWindow
if
not
arg_6
:
if
arg_0
and
os
.
path
.
isfile
(
arg_0
)
:
arg_6
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
arg_0
)
)
[
0
]
+
' - Shoebot'
else
:
arg_6
=
'Untitled - Shoebot'
arg_9
=
ShoebotWindow
(
arg_6
,
arg_8
,
arg_7
=
arg_7
)
else
:
if
arg_0
and
isinstance
(
arg_0
,
cairo
.
Surface
)
:
arg_2
=
arg_0
arg_1
=
'surface'
elif
arg_0
and
os
.
path
.
isfile
(
arg_0
)
:
arg_2
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
arg_0
)
)
[
0
]
+
'.'
+
(
arg_1
or
'svg'
)
else
:
arg_2
=
'output.svg'
arg_9
=
CairoImageSink
(
arg_2
,
arg_1
,
arg_3
,
arg_4
)
arg_10
=
CairoCanvas
(
arg_9
)
return
arg_10

def Func(arg_0, arg_1=None, arg_2=None, arg_3=False, arg_4=None, arg_5=False, arg_6=None,
                  arg_7=None, arg_8=False):
    """
    Create canvas and sink for attachment to a bot

    canvas is what draws images, 'sink' is the final consumer of the images

    :param src: Defaults for title or outputfile if not specified.

    :param format: CairoImageSink image format, if using buff instead of outputfile
    :param buff: CairoImageSink buffer object to send output to

    :param outputfile: CairoImageSink output filename e.g. "hello.svg"
    :param multifile: CairoImageSink if True,

    :param title: ShoebotWindow - set window title
    :param fullscreen: ShoebotWindow - set window title
    :param show_vars: ShoebotWindow - display variable window

    Two kinds of sink are provided: CairoImageSink and ShoebotWindow

    ShoebotWindow

    Displays a window to draw shoebot inside.

    CairoImageSink

    Output to a filename (or files if multifile is set), or a buffer object.
    """
    from core import CairoCanvas, CairoImageSink # https://github.com/shoebot/shoebot/issues/206

    if arg_2:
        arg_9 = CairoImageSink(arg_2, arg_1, arg_3, arg_4)
    elif arg_5 or arg_8:
        from gui import ShoebotWindow
        if not arg_6:
            if arg_0 and os.path.isfile(arg_0):
                arg_6 = os.path.splitext(os.path.basename(arg_0))[0] + ' - Shoebot'
            else:
                arg_6 = 'Untitled - Shoebot'
        arg_9 = ShoebotWindow(arg_6, arg_8, arg_7=arg_7)
    else:
        if arg_0 and isinstance(arg_0, cairo.Surface):
            arg_2 = arg_0
            arg_1 = 'surface'
        elif arg_0 and os.path.isfile(arg_0):
            arg_2 = os.path.splitext(os.path.basename(arg_0))[0] + '.' + (arg_1 or 'svg')
        else:
            arg_2 = 'output.svg'
        arg_9 = CairoImageSink(arg_2, arg_1, arg_3, arg_4)
    arg_10 = CairoCanvas(arg_9)

    return arg_10


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . _connection . get ( "Func/%s" % urllib . quote_plus ( arg_1 ) , key = "messages" ) if arg_2 : arg_2 = [ Message ( arg_0 , message ) for message in arg_2 ] return arg_2

def Func(arg_0, arg_1):
        """ Search transcripts.

        Args:
            terms (str): Terms for Func

        Returns:
            array. Messages
        """
        arg_2 = arg_0._connection.get("Func/%s" % urllib.quote_plus(arg_1), key="messages")
        if arg_2:
            arg_2 = [Message(arg_0, message) for message in arg_2]
        return arg_2

Search transcripts.

        Args:
            terms (str): Terms for search

        Returns:
            array. Messages


return inferenceType in InferenceType.__temporalInferenceTypes

def Func ( arg_0 ) : if arg_1 . __temporalInferenceTypes is None : arg_1 . __temporalInferenceTypes = set ( [ arg_1 . TemporalNextStep , arg_1 . TemporalClassification , arg_1 . TemporalAnomaly , arg_1 . TemporalMultiStep , arg_1 . NontemporalMultiStep ] ) return arg_0 in arg_1 . __temporalInferenceTypes

def Func(arg_0):
    """ Returns True if the inference type is 'temporal', i.e. requires a
    temporal memory in the network.
    """
    if arg_1.__temporalInferenceTypes is None:
      arg_1.__temporalInferenceTypes = \
                                set([arg_1.TemporalNextStep,
                                     arg_1.TemporalClassification,
                                     arg_1.TemporalAnomaly,
                                     arg_1.TemporalMultiStep,
                                     arg_1.NontemporalMultiStep])

    return arg_0 in arg_1.__temporalInferenceTypes

Returns True if the inference type is temporal i . e . requires a temporal memory in the network .


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
type
(
arg_2
)
is
not
ahio
.
PortType
:
raise
KeyError
(
'ptype must be of type ahio.PortType'
)
elif
arg_4
:
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 `type`.

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

        If you're developing a driver, you should implement
        _Func(self, pin, ptype) 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.PortType`

        @throw KeyError if pin isn't mapped.
        @throw RuntimeError if type 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 type(arg_2) is not ahio.PortType:
            raise KeyError('ptype must be of type ahio.PortType')
        elif arg_4:
            arg_0._Func(arg_4, arg_2)
        else:
            raise KeyError('Requested pin is not mapped: %s' % arg_1)

Sets pin `pin` to `type`.

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

        If you're developing a driver, you should implement
        _set_pin_type(self, pin, ptype) 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.PortType`

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


def Func ( arg_0 , arg_1 = True ) : if not isinstance ( arg_0 , nx . DiGraph ) : arg_0 = QueueNetworkDiGraph ( arg_0 ) arg_2 = nx . to_dict_of_dicts ( arg_0 ) if arg_1 : return arg_2 else : return { arg_3 : list ( arg_4 . keys ( ) ) for arg_3 , arg_4 in arg_2 . items ( ) }

def Func(arg_0, arg_1=True):
    """Takes a graph and returns an adjacency list.

    Parameters
    ----------
    g : :any:`networkx.DiGraph`, :any:`networkx.Graph`, etc.
        Any object that networkx can turn into a
        :any:`DiGraph<networkx.DiGraph>`.
    return_dict_of_dict : bool (optional, default: ``True``)
        Specifies whether this function will return a dict of dicts
        or a dict of lists.

    Returns
    -------
    adj : dict
        An adjacency representation of graph as a dictionary of
        dictionaries, where a key is the vertex index for a vertex
        ``v`` and the values are :class:`dicts<.dict>` with keys for
        the vertex index and values as edge properties.

    Examples
    --------
    >>> import queueing_tool as qt
    >>> import networkx as nx
    >>> adj = {0: [1, 2], 1: [0], 2: [0, 3], 3: [2]}
    >>> g = nx.DiGraph(adj)
    >>> qt.Func(g, return_dict_of_dict=True)
    ...  # doctest: +NORMALIZE_WHITESPACE
    {0: {1: {}, 2: {}},
    1: {0: {}},
    2: {0: {}, 3: {}},
    3: {2: {}}}
    >>> qt.Func(g, return_dict_of_dict=False)
    {0: [1, 2], 1: [0], 2: [0, 3], 3: [2]}
    """
    if not isinstance(arg_0, nx.DiGraph):
        arg_0 = QueueNetworkDiGraph(arg_0)

    arg_2 = nx.to_dict_of_dicts(arg_0)
    if arg_1:
        return arg_2
    else:
        return {arg_3: list(arg_4.keys()) for arg_3, arg_4 in arg_2.items()}

Takes a graph and returns an adjacency list.

    Parameters
    ----------
    g : :any:`networkx.DiGraph`, :any:`networkx.Graph`, etc.
        Any object that networkx can turn into a
        :any:`DiGraph<networkx.DiGraph>`.
    return_dict_of_dict : bool (optional, default: ``True``)
        Specifies whether this function will return a dict of dicts
        or a dict of lists.

    Returns
    -------
    adj : dict
        An adjacency representation of graph as a dictionary of
        dictionaries, where a key is the vertex index for a vertex
        ``v`` and the values are :class:`dicts<.dict>` with keys for
        the vertex index and values as edge properties.

    Examples
    --------
    >>> import queueing_tool as qt
    >>> import networkx as nx
    >>> adj = {0: [1, 2], 1: [0], 2: [0, 3], 3: [2]}
    >>> g = nx.DiGraph(adj)
    >>> qt.graph2dict(g, return_dict_of_dict=True)
    ...  # doctest: +NORMALIZE_WHITESPACE
    {0: {1: {}, 2: {}},
    1: {0: {}},
    2: {0: {}, 3: {}},
    3: {2: {}}}
    >>> qt.graph2dict(g, return_dict_of_dict=False)
    {0: [1, 2], 1: [0], 2: [0, 3], 3: [2]}

Takes a graph and returns an adjacency list .


def Func(arg_0, arg_1, arg_2=50, **arg_3):
    """Track the progress of tasks execution with a progress bar.

    Tasks are done with a simple for-loop.

    Args:
        func (callable): The function to be applied to each task.
        tasks (list or tuple[Iterable, int]): A list of tasks or
            (tasks, total num).
        bar_width (int): Width of progress bar.

    Returns:
        list: The task results.
    """
    if isinstance(arg_1, tuple):
        assert len(arg_1) == 2
        assert isinstance(arg_1[0], collections_abc.Iterable)
        assert isinstance(arg_1[1], int)
        arg_4 = arg_1[1]
        arg_1 = arg_1[0]
    elif isinstance(arg_1, collections_abc.Iterable):
        arg_4 = len(arg_1)
    else:
        raise TypeError(
            '"tasks" must be an iterable object or a (iterator, int) tuple')
    arg_5 = ProgressBar(arg_4, arg_2)
    arg_6 = []
    for arg_7 in arg_1:
        arg_6.append(arg_0(arg_7, **arg_3))
        arg_5.update()
    sys.stdout.write('\n')
    return arg_6

Track the progress of tasks execution with a progress bar .


return self.create_checklist_item(self.idCard, self.idChecklist, checklistitem_json)

def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . fetch_json ( uri_path = arg_0 . base_uri + '/state' , http_method = 'PUT' , query_params = { 'value' : 'complete' if arg_1 else 'incomplete' } ) return arg_0 . create_checklist_item ( arg_0 . idCard , arg_0 . idChecklist , arg_2 )

def Func(arg_0, arg_1):
        """
        Set the state of the current checklist item. Returns a new ChecklistItem object.
        """
        arg_2 = arg_0.fetch_json(
            uri_path = arg_0.base_uri + '/state',
            http_method = 'PUT',
            query_params = {'value': 'complete' if arg_1 else 'incomplete'}
        )

        return arg_0.create_checklist_item(arg_0.idCard, arg_0.idChecklist, arg_2)

Set the state of the current checklist item . Returns a new ChecklistItem object .


(ftimes, fmags, ferrs, weightbytimediff=False)

def Func(arg_0, arg_1, arg_2, arg_3=False):
    '''This calculates the Stetson index for the magseries, based on consecutive
    pairs of observations.

    Based on Nicole Loncke's work for her Planets and Life certificate at
    Princeton in 2014.

    Parameters
    ----------

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

    weightbytimediff : bool
        If this is True, the Stetson index for any pair of mags will be
        reweighted by the difference in times between them using the scheme in
        Fruth+ 2012 and Zhange+ 2003 (as seen in Sokolovsky+ 2017)::

            w_i = exp(- (t_i+1 - t_i)/ delta_t )

    Returns
    -------

    float
        The calculated Stetson J variability index.

    '''

    arg_4 = len(arg_1)

    if arg_4 > 9:

        # get the median and ndet
        arg_5 = npmedian(arg_1)

        # get the stetson index elements
        arg_6 = (arg_4/(arg_4 - 1))
        arg_7 = arg_6*(arg_1 - arg_5)/arg_2

        # Nicole's clever trick to advance indices by 1 and do x_i*x_(i+1)
        arg_8 = nproll(arg_7,1)

        if arg_3:

            arg_9 = npdiff(arg_0)
            arg_10 = npmedian(arg_9)

            arg_11 = npexp(- arg_9/arg_10 )
            arg_12 = (arg_11*arg_7[1:]*arg_8[1:])
        else:
            # ignore first elem since it's actually x_0*x_n
            arg_12 = (arg_7*arg_8)[1:]

        arg_13 = (
            npsum(npsign(arg_12) * npsqrt(npabs(arg_12)))
        ) / arg_4

        return arg_13

    else:

        LOGERROR('not enough detections in this magseries '
                 'to calculate stetson J index')
        return npnan

This calculates the Stetson index for the magseries based on consecutive pairs of observations .


(self, min_freq, max_freq, bins, repeats, runs=0, time_limit=0, overlap=0,
              fft_window='hann', fft_overlap=0.5, crop=False, log_scale=True, remove_dc=False, detrend=None, lnb_lo=0,
              tune_delay=0, reset_stream=False, base_buffer_size=0, max_buffer_size=0, max_threads=0, max_queue_size=0)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=0, arg_6=0, arg_7=0,
              arg_8='hann', arg_9=0.5, arg_10=False, arg_11=True, arg_12=False, arg_13=None, arg_14=0,
              arg_15=0, arg_16=False, arg_17=0, arg_18=0, arg_19=0, arg_20=0):
        """Sweep spectrum using frequency hopping"""
        arg_0.setup(
            arg_3, arg_4, arg_17, arg_18,
            arg_8=arg_8, arg_9=arg_9, crop_factor=arg_7 if arg_10 else 0,
            arg_11=arg_11, arg_12=arg_12, arg_13=arg_13, arg_14=arg_14, arg_15=arg_15,
            arg_16=arg_16, arg_19=arg_19, arg_20=arg_20
        )

        try:
            arg_21 = arg_0.freq_plan(arg_1 - arg_14, arg_2 - arg_14, arg_3, arg_7)
            arg_22 = time.time()
            arg_23 = 0
            while not _shutdown and (arg_5 == 0 or arg_23 < arg_5):
                arg_23 += 1
                arg_24 = time.time()
                logger.debug('Run: {}'.format(arg_23))

                for arg_25 in arg_21:
                    # Tune to new frequency, acquire samples and compute Power Spectral Density
                    arg_26, arg_27, arg_28 = arg_0.psd(arg_25)

                    # Write PSD to stdout (in another thread)
                    arg_0._writer.write_async(arg_26, arg_27, arg_28,
                                             len(arg_0._buffer) * arg_0._buffer_repeats)

                    if _shutdown:
                        break

                # Write end of measurement marker (in another thread)
                arg_29 = arg_0._writer.write_next_async()
                arg_30 = time.time()
                logger.debug('  Total run time: {:.3f} s'.format(arg_30 - arg_24))

                # End measurement if time limit is exceeded
                if arg_6 and (time.time() - arg_22) >= arg_6:
                    logger.info('Time limit of {} s exceeded, completed {} runs'.format(arg_6, arg_23))
                    break

            # Wait for last write to be finished
            arg_29.result()

            # Debug thread pool queues
            logging.debug('Number of USB buffer overflow errors: {}'.format(arg_0.device.buffer_overflow_count))
            logging.debug('PSD worker threads: {}'.format(arg_0._psd._executor._max_workers))
            logging.debug('Max. PSD queue size: {} / {}'.format(arg_0._psd._executor.max_queue_size_reached,
                                                                arg_0._psd._executor.max_queue_size))
            logging.debug('Writer worker threads: {}'.format(arg_0._writer._executor._max_workers))
            logging.debug('Max. Writer queue size: {} / {}'.format(arg_0._writer._executor.max_queue_size_reached,
                                                                   arg_0._writer._executor.max_queue_size))
        finally:
            # Shutdown SDR
            arg_0.stop()
            arg_31 = time.time()
            logger.info('Total time: {:.3f} s'.format(arg_31 - arg_22))


def Func ( arg_0 ) : if arg_0 . _initial_statevector is None : arg_0 . _statevector = np . zeros ( 2 ** arg_0 . _number_of_qubits , dtype = complex ) arg_0 . _statevector [ 0 ] = 1 else : arg_0 . _statevector = arg_0 . _initial_statevector . copy ( ) arg_0 . _statevector = np . reshape ( arg_0 . _statevector , arg_0 . _number_of_qubits * [ 2 ] )

def Func(arg_0):
        """Set the initial statevector for simulation"""
        if arg_0._initial_statevector is None:
            # Set to default state of all qubits in |0>
            arg_0._statevector = np.zeros(2 ** arg_0._number_of_qubits,
                                         dtype=complex)
            arg_0._statevector[0] = 1
        else:
            arg_0._statevector = arg_0._initial_statevector.copy()
        # Reshape to rank-N tensor
        arg_0._statevector = np.reshape(arg_0._statevector,
                                       arg_0._number_of_qubits * [2])


def Func ( arg_0 ) : arg_0 . STACK = arg_0 . FRAME arg_0 . FRAME = arg_0 . pop ( arg_0 . address_bit_size )

def Func(arg_0):
        """
        High level procedure exit.

        Releases the stack frame set up by an earlier ENTER instruction. The
        Func instruction copies the frame pointer (in the EBP register) into
        the stack pointer register (ESP), which releases the stack space allocated
        to the stack frame. The old frame pointer (the frame pointer for the calling
        procedure that was saved by the ENTER instruction) is then popped from
        the stack into the EBP register, restoring the calling procedure's stack
        frame.
        A RET instruction is commonly executed following a Func instruction
        to return program control to the calling procedure::

                IF Stackaddress_bit_size  =  32
                THEN
                    ESP  =  EBP;
                ELSE (* Stackaddress_bit_size  =  16*)
                    SP  =  BP;
                FI;
                IF OperandSize  =  32
                THEN
                    EBP  =  Pop();
                ELSE (* OperandSize  =  16*)
                    BP  =  Pop();
                FI;

        :param cpu: current CPU.
        """
        arg_0.STACK = arg_0.FRAME
        arg_0.FRAME = arg_0.pop(arg_0.address_bit_size)

High level procedure exit.

        Releases the stack frame set up by an earlier ENTER instruction. The
        LEAVE instruction copies the frame pointer (in the EBP register) into
        the stack pointer register (ESP), which releases the stack space allocated
        to the stack frame. The old frame pointer (the frame pointer for the calling
        procedure that was saved by the ENTER instruction) is then popped from
        the stack into the EBP register, restoring the calling procedure's stack
        frame.
        A RET instruction is commonly executed following a LEAVE instruction
        to return program control to the calling procedure::

                IF Stackaddress_bit_size  =  32
                THEN
                    ESP  =  EBP;
                ELSE (* Stackaddress_bit_size  =  16*)
                    SP  =  BP;
                FI;
                IF OperandSize  =  32
                THEN
                    EBP  =  Pop();
                ELSE (* OperandSize  =  16*)
                    BP  =  Pop();
                FI;

        :param cpu: current CPU.


def Func ( arg_0 ) : arg_1 = '%Y_%m_%d_%Hh%Mm%Ss' arg_2 = datetime . datetime . fromtimestamp ( arg_0 ) . strftime ( arg_1 ) return arg_2

def Func(arg_0):
    """Formats timestamp to human readable format"""
    arg_1 = '%Y_%m_%d_%Hh%Mm%Ss'
    arg_2 = datetime.datetime.fromtimestamp(arg_0).strftime(arg_1)
    return arg_2


def Func(arg_0, arg_1=None, arg_2=None):
        '''Remix the channels of an audio file.

        Note: volume options are not yet implemented

        Parameters
        ----------
        Func_dictionary : dict or None
            Dictionary mapping output channel to list of input channel(s).
            Empty lists indicate the corresponding output channel should be
            empty. If None, mixes all channels down to a single mono file.
        num_output_channels : int or None
            The number of channels in the output file. If None, the number of
            output channels is equal to the largest key in Func_dictionary.
            If Func_dictionary is None, this variable is ignored.

        Examples
        --------
        Remix a 4-channel input file. The output file will have
        input channel 2 in channel 1, a mixdown of input channels 1 an 3 in
        channel 2, an empty channel 3, and a copy of input channel 4 in
        channel 4.

        >>> import sox
        >>> tfm = sox.Transformer()
        >>> Func_dictionary = {1: [2], 2: [1, 3], 4: [4]}
        >>> tfm.Func(Func_dictionary)

        '''
        if not (isinstance(arg_1, dict) or
                arg_1 is None):
            raise ValueError("Func_dictionary must be a dictionary or None.")

        if arg_1 is not None:

            if not all([isinstance(arg_3, int) and arg_3 > 0 for arg_3
                        in arg_1.keys()]):
                raise ValueError(
                    "Func dictionary must have positive integer keys."
                )

            if not all([isinstance(arg_4, list) for arg_4
                        in arg_1.values()]):
                raise ValueError("Func dictionary values must be lists.")

            for arg_5 in arg_1.values():
                if not all([isinstance(arg_4, int) and arg_4 > 0 for arg_4 in arg_5]):
                    raise ValueError(
                        "elements of Func dictionary values must "
                        "be positive integers"
                    )

        if not ((isinstance(arg_2, int) and
                 arg_2 > 0) or arg_2 is None):
            raise ValueError(
                "num_output_channels must be a positive integer or None."
            )

        arg_6 = ['Func']
        if arg_1 is None:
            arg_6.append('-')
        else:
            if arg_2 is None:
                arg_2 = max(arg_1.keys())

            for arg_7 in range(1, arg_2 + 1):
                if arg_7 in arg_1.keys():
                    arg_8 = ','.join(
                        [str(arg_3) for arg_3 in arg_1[arg_7]]
                    )
                else:
                    arg_8 = '0'

                arg_6.append(arg_8)

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

        return arg_0

Remix the channels of an audio file.

        Note: volume options are not yet implemented

        Parameters
        ----------
        remix_dictionary : dict or None
            Dictionary mapping output channel to list of input channel(s).
            Empty lists indicate the corresponding output channel should be
            empty. If None, mixes all channels down to a single mono file.
        num_output_channels : int or None
            The number of channels in the output file. If None, the number of
            output channels is equal to the largest key in remix_dictionary.
            If remix_dictionary is None, this variable is ignored.

        Examples
        --------
        Remix a 4-channel input file. The output file will have
        input channel 2 in channel 1, a mixdown of input channels 1 an 3 in
        channel 2, an empty channel 3, and a copy of input channel 4 in
        channel 4.

        >>> import sox
        >>> tfm = sox.Transformer()
        >>> remix_dictionary = {1: [2], 2: [1, 3], 4: [4]}
        >>> tfm.remix(remix_dictionary)


return c_ast.FuncCall(name=c_ast.ID(name=name), args=c_ast.ExprList(exprs=[
            c_ast.ID(name=d.name) for d in (
                    self._build_array_declarations()[0] +
                    self._build_scalar_declarations() +
                    self._build_const_declartions())]))

def Func ( arg_0 , arg_1 = 'kernel' ) : return c_ast . FuncCall ( arg_1 = c_ast . ID ( arg_1 = arg_1 ) , args = c_ast . ExprList ( exprs = [ c_ast . ID ( arg_1 = arg_2 . name ) for arg_2 in ( arg_0 . _build_array_declarations ( ) [ 0 ] + arg_0 . _build_scalar_declarations ( ) + arg_0 . _build_const_declartions ( ) ) ] ) )

def Func(arg_0, arg_1='kernel'):
        """Generate and return kernel call ast."""
        return c_ast.FuncCall(arg_1=c_ast.ID(arg_1=arg_1), args=c_ast.ExprList(exprs=[
            c_ast.ID(arg_1=arg_2.name) for arg_2 in (
                    arg_0._build_array_declarations()[0] +
                    arg_0._build_scalar_declarations() +
                    arg_0._build_const_declartions())]))


def
Func
(
arg_0
)
:
arg_1
=
__INVALID_XML_CHARS
&
set
(
arg_0
)
if
arg_1
:
for
arg_2
,
arg_3
in
enumerate
(
arg_0
)
:
if
arg_3
in
arg_1
:
raise
RuntimeError
(
'invalid XML character: '
+
repr
(
arg_3
)
+
' at offset '
+
str
(
arg_2
)
)

def Func(arg_0):
    """validates XML text"""
    arg_1 = __INVALID_XML_CHARS & set(arg_0)
    if arg_1:
        for arg_2,arg_3 in enumerate(arg_0):
            if arg_3 in arg_1:
                raise RuntimeError('invalid XML character: ' + repr(arg_3) + ' at offset ' + str(arg_2))


(private_key, data, hash_algorithm, rsa_pss_padding=False)

def Func(arg_0, arg_1, arg_2, arg_3=False):
    """
    Generates an RSA, DSA or ECDSA signature via CryptoAPI

    :param private_key:
        The PrivateKey to generate the signature with

    :param data:
        A byte string of the data the signature is for

    :param hash_algorithm:
        A unicode string of "md5", "sha1", "sha256", "sha384", "sha512" or "raw"

    :param rsa_pss_padding:
        If PSS padding should be used for RSA keys

    :raises:
        ValueError - when any of the parameters contain an invalid value
        TypeError - when any of the parameters are of the wrong type
        OSError - when an error is returned by the OS crypto library

    :return:
        A byte string of the signature
    """

    arg_4 = arg_0.algorithm

    if arg_4 == 'rsa' and arg_2 == 'raw':
        arg_5 = add_pkcs1v15_signature_padding(arg_0.byte_size, arg_1)
        return raw_rsa_private_crypt(arg_0, arg_5)

    if arg_4 == 'rsa' and arg_3:
        arg_6 = {
            'sha1': 20,
            'sha224': 28,
            'sha256': 32,
            'sha384': 48,
            'sha512': 64
        }.get(arg_2, 0)
        arg_5 = add_pss_padding(arg_2, arg_6, arg_0.bit_size, arg_1)
        return raw_rsa_private_crypt(arg_0, arg_5)

    if arg_0.algorithm == 'dsa' and arg_2 == 'md5':
        raise ValueError(pretty_message(
            '''
            Windows does not support md5 signatures with DSA keys
            '''
        ))

    arg_7 = None

    try:
        arg_8 = {
            'md5': Advapi32Const.CALG_MD5,
            'sha1': Advapi32Const.CALG_SHA1,
            'sha256': Advapi32Const.CALG_SHA_256,
            'sha384': Advapi32Const.CALG_SHA_384,
            'sha512': Advapi32Const.CALG_SHA_512,
        }[arg_2]

        arg_9 = new(advapi32, 'HCRYPTHASH *')
        arg_10 = advapi32.CryptCreateHash(
            arg_0.context_handle,
            arg_8,
            null(),
            0,
            arg_9
        )
        handle_error(arg_10)

        arg_7 = unwrap(arg_9)

        arg_10 = advapi32.CryptHashData(arg_7, arg_1, len(arg_1), 0)
        handle_error(arg_10)

        arg_11 = new(advapi32, 'DWORD *')
        arg_10 = advapi32.CryptSignHashW(
            arg_7,
            Advapi32Const.AT_SIGNATURE,
            null(),
            0,
            null(),
            arg_11
        )
        handle_error(arg_10)

        arg_12 = deref(arg_11)
        arg_13 = buffer_from_bytes(arg_12)

        arg_10 = advapi32.CryptSignHashW(
            arg_7,
            Advapi32Const.AT_SIGNATURE,
            null(),
            0,
            arg_13,
            arg_11
        )
        handle_error(arg_10)

        arg_14 = bytes_from_buffer(arg_13, deref(arg_11))

        # CryptoAPI outputs the signature in little endian byte order, so we
        # must swap it for compatibility with other systems
        arg_14 = arg_14[::-1]

        if arg_4 == 'dsa':
            # Switch the two integers because the reversal just before switched
            # then
            arg_15 = len(arg_14) // 2
            arg_14 = arg_14[arg_15:] + arg_14[:arg_15]
            # Windows doesn't use the ASN.1 Sequence for DSA signatures,
            # so we have to convert it here for the verification to work
            arg_14 = algos.DSASignature.from_p1363(arg_14).dump()

        return arg_14

    finally:
        if arg_7:
            advapi32.CryptDestroyHash(arg_7)

Generates an RSA DSA or ECDSA signature via CryptoAPI


def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):
        """
        Write the data encoding the KeyWrappingSpecification struct to a
        stream.

        Args:
            output_stream (stream): A data stream in which to encode object
                data, supporting a Func method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be encoded. Optional,
                defaults to KMIP 1.0.
        """
        arg_6 = BytearrayStream()

        if arg_0._wrapping_method:
            arg_0._wrapping_method.Func(
                arg_6,
                arg_2=arg_2
            )
        else:
            raise ValueError(
                "Invalid struct missing the wrapping method attribute."
            )

        if arg_0._encryption_key_information:
            arg_0._encryption_key_information.Func(
                arg_6,
                arg_2=arg_2
            )
        if arg_0._mac_signature_key_information:
            arg_0._mac_signature_key_information.Func(
                arg_6,
                arg_2=arg_2
            )
        if arg_0._attribute_names:
            for arg_7 in arg_0._attribute_names:
                arg_7.Func(
                    arg_6,
                    arg_2=arg_2
                )
        if arg_0._encoding_option:
            arg_0._encoding_option.Func(
                arg_6,
                arg_2=arg_2
            )

        arg_0.length = arg_6.length()
        super(KeyWrappingSpecification, arg_0).Func(
            arg_1,
            arg_2=arg_2
        )
        arg_1.Func(arg_6.buffer)

Write the data encoding the KeyWrappingSpecification struct to a
        stream.

        Args:
            output_stream (stream): A data stream in which to encode object
                data, supporting a write method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be encoded. Optional,
                defaults to KMIP 1.0.

Write the data encoding the KeyWrappingSpecification struct to a stream .


def Func ( arg_0 , arg_1 ) : for arg_2 in arg_0 . routers : arg_3 = arg_2 . Func ( arg_1 ) if arg_3 is not None : return arg_3 return arg_0 . get ( 'default' )

def Func(arg_0, arg_1):
        """Find matching database router"""
        for arg_2 in arg_0.routers:
            arg_3 = arg_2.Func(arg_1)
            if arg_3 is not None:
                return arg_3
        return arg_0.get('default')


def Func(arg_0, arg_1):
        """
        Create CodeGovProject object from DOE CODE record

        Handles crafting Code.gov Project
        """
        if not isinstance(arg_1, dict):
            raise TypeError('`record` must be a dict')

        arg_2 = arg_0()

        # -- REQUIRED FIELDS --

        arg_2['name'] = arg_1['software_title']
        logger.debug('DOE CODE: software_title="%s"', arg_1['software_title'])

        arg_3 = arg_1.get('repository_link', '')
        if not arg_3:
            arg_3 = arg_1.get('landing_page')
            logger.warning('DOE CODE: No repositoryURL, using landing_page: %s', arg_3)

        arg_2['repositoryURL'] = arg_3

        arg_2['description'] = arg_1['description']

        arg_4 = set(arg_1['licenses'])
        arg_4.discard(None)
        logger.debug('DOE CODE: licenses=%s', arg_4)

        arg_5 = []
        if 'Other' in arg_4:
            arg_4.remove('Other')
            arg_5 = [{
                'name': 'Other',
                'URL': arg_1['proprietary_url']
            }]

        if arg_4:
            arg_5.extend([_license_obj(arg_6) for arg_6 in arg_4])

        arg_2['permissions']['licenses'] = arg_5

        if arg_1['open_source']:
            arg_7 = 'openSource'
        else:
            arg_7 = 'exemptByLaw'
            arg_2['permissions']['exemptionText'] = 'This source code is restricted by patent and / or intellectual property law.'

        arg_2['permissions']['usageType'] = arg_7

        # TODO: Compute from git repo
        arg_2['laborHours'] = 0

        arg_2['tags'] = ['DOE CODE']
        arg_8 = arg_1.get('lab_display_name')
        if arg_8 is not None:
            arg_2['tags'].append(arg_8)

        arg_2['contact']['email'] = arg_1['owner']
        # project['contact']['URL'] = ''
        # project['contact']['name'] = ''
        # project['contact']['phone'] = ''

        # -- OPTIONAL FIELDS --

        if 'version_number' in arg_1 and arg_1['version_number']:
            arg_2['version'] = arg_1['version_number']

        if arg_8 is not None:
            arg_2['organization'] = arg_8

        # Currently, can't be an empty string, see: https://github.com/GSA/code-gov-web/issues/370
        arg_9 = arg_1.get('ever_announced')
        if arg_9 is None:
            raise ValueError('DOE CODE: Unable to determine "ever_announced" value!')
        elif arg_9:
            arg_9 = 'Production'
        else:
            arg_9 = 'Development'

        arg_2['status'] = arg_9

        arg_10 = None
        arg_3 = arg_2['repositoryURL']
        if 'github.com' in arg_3:
            arg_10 = 'git'
        if arg_10 is None:
            logger.debug('DOE CODE: Unable to determine vcs for: name="%s", repositoryURL=%s', arg_2['name'], arg_3)
            arg_10 = ''
        if arg_10:
            arg_2['vcs'] = arg_10

        arg_11 = arg_1.get('landing_page', '')
        if arg_11:
            arg_2['homepageURL'] = arg_11

        # record['downloadURL'] = ''

        # self['disclaimerText'] = ''

        # self['disclaimerURL'] = ''

        if 'programming_languages' in arg_1:
            arg_2['languages'] = arg_1['programming_languages']

        # self['partners'] = []
        # TODO: Look into using record['contributing_organizations']

        # self['relatedCode'] = []

        # self['reusedCode'] = []

        # date: [object] A date object describing the release.
        #   created: [string] The date the release was originally created, in YYYY-MM-DD or ISO 8601 format.
        #   lastModified: [string] The date the release was modified, in YYYY-MM-DD or ISO 8601 format.
        #   metadataLastUpdated: [string] The date the metadata of the release was last updated, in YYYY-MM-DD or ISO 8601 format.
        if 'date_record_added' in arg_1 and 'date_record_updated' in arg_1:
            arg_2['date'] = {
                'created': arg_1['date_record_added'],
                # 'lastModified': '',
                'metadataLastUpdated': arg_1['date_record_updated']
            }

        return arg_2


def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : arg_1 = np . array ( arg_0 ) . conj ( ) else : arg_1 = np . array ( arg_1 ) . conj ( ) return np . Func ( arg_0 , arg_1 )

def Func(arg_0, arg_1=None):
    """
    Construct the Func product of two vectors.

    The second vector argument is optional, if absent the projector
    of the first vector will be returned.

    Args:
        vector1 (ndarray): the first vector.
        vector2 (ndarray): the (optional) second vector.

    Returns:
        np.array: The matrix |v1><v2|.

    """
    if arg_1 is None:
        arg_1 = np.array(arg_0).conj()
    else:
        arg_1 = np.array(arg_1).conj()
    return np.Func(arg_0, arg_1)

Construct the outer product of two vectors.

    The second vector argument is optional, if absent the projector
    of the first vector will be returned.

    Args:
        vector1 (ndarray): the first vector.
        vector2 (ndarray): the (optional) second vector.

    Returns:
        np.array: The matrix |v1><v2|.

Construct the outer product of two vectors .


def Func ( arg_0 , arg_1 ) : arg_2 = XdotAttrParser ( ) . parse_xdot_data ( arg_1 ) arg_3 = max ( [ c . bounds [ 0 ] for c in arg_2 ] + [ 1 ] ) arg_4 = max ( [ c . bounds [ 1 ] for c in arg_2 ] + [ 1 ] ) arg_5 = min ( [ c . x for c in arg_2 ] ) arg_6 = min ( [ c . y for c in arg_2 ] ) move_to_origin ( arg_2 ) arg_7 = Container ( auto_size = True , position = [ arg_5 - arg_0 . pos [ 0 ] , arg_6 - arg_0 . pos [ 1 ] ] , bgcolor = "blue" ) arg_7 . add ( * arg_2 ) arg_0 . drawing = arg_7

def Func(arg_0, arg_1):
        """ Parses the drawing directive, updating the node components.
        """
        arg_2 = XdotAttrParser().parse_xdot_data(arg_1)

        arg_3 = max( [c.bounds[0] for c in arg_2] + [1] )
        arg_4 = max( [c.bounds[1] for c in arg_2] + [1] )

        arg_5 = min( [c.x for c in arg_2] )
        arg_6 = min( [c.y for c in arg_2] )

        move_to_origin(arg_2)

        arg_7 = Container(auto_size=True,
            position=[arg_5-arg_0.pos[0], arg_6-arg_0.pos[1]],
            bgcolor="blue")
#        self.bounds = bounds=[max_x, max_y]

#        container = Container(fit_window=False, auto_size=True, bgcolor="blue")

        arg_7.add( *arg_2 )

        arg_0.drawing = arg_7

Parses the drawing directive updating the node components .


def Func ( ) : import math try : arg_0 = mp . Func ( ) except NotImplementedError : arg_0 = 1 arg_1 = arg_0 if hasattr ( os , 'sched_getaffinity' ) : try : arg_1 = len ( os . sched_getaffinity ( 0 ) ) except NotImplementedError : pass arg_2 = arg_0 arg_3 = "/sys/fs/cgroup/cpu/cpu.cfs_quota_us" arg_4 = "/sys/fs/cgroup/cpu/cpu.cfs_period_us" if os . path . exists ( arg_3 ) and os . path . exists ( arg_4 ) : with open ( arg_3 , 'r' ) as fh : arg_5 = int ( fh . read ( ) ) with open ( arg_4 , 'r' ) as fh : arg_6 = int ( fh . read ( ) ) if arg_5 > 0 and arg_6 > 0 : arg_2 = int ( math . ceil ( arg_5 / arg_6 ) ) arg_7 = int ( os . environ . get ( 'LOKY_MAX_CPU_COUNT' , arg_0 ) ) arg_8 = min ( arg_0 , arg_1 , arg_2 , arg_7 ) return max ( arg_8 , 1 )

def Func():
    """Return the number of CPUs the current process can use.

    The returned number of CPUs accounts for:
     * the number of CPUs in the system, as given by
       ``multiprocessing.Func``;
     * the CPU affinity settings of the current process
       (available with Python 3.4+ on some Unix systems);
     * CFS scheduler CPU bandwidth limit (available on Linux only, typically
       set by docker and similar container orchestration systems);
     * the value of the LOKY_MAX_CPU_COUNT environment variable if defined.
    and is given as the minimum of these constraints.
    It is also always larger or equal to 1.
    """
    import math

    try:
        arg_0 = mp.Func()
    except NotImplementedError:
        arg_0 = 1

    # Number of available CPUs given affinity settings
    arg_1 = arg_0
    if hasattr(os, 'sched_getaffinity'):
        try:
            arg_1 = len(os.sched_getaffinity(0))
        except NotImplementedError:
            pass

    # CFS scheduler CPU bandwidth limit
    # available in Linux since 2.6 kernel
    arg_2 = arg_0
    arg_3 = "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
    arg_4 = "/sys/fs/cgroup/cpu/cpu.cfs_period_us"
    if os.path.exists(arg_3) and os.path.exists(arg_4):
        with open(arg_3, 'r') as fh:
            arg_5 = int(fh.read())
        with open(arg_4, 'r') as fh:
            arg_6 = int(fh.read())

        if arg_5 > 0 and arg_6 > 0:
            # Make sure this quantity is an int as math.ceil returns a
            # float in python2.7. (See issue #165)
            arg_2 = int(math.ceil(arg_5 / arg_6))

    # User defined soft-limit passed as an loky specific environment variable.
    arg_7 = int(os.environ.get('LOKY_MAX_CPU_COUNT', arg_0))
    arg_8 = min(arg_0, arg_1, arg_2,
                              arg_7)
    return max(arg_8, 1)

Return the number of CPUs the current process can use.

    The returned number of CPUs accounts for:
     * the number of CPUs in the system, as given by
       ``multiprocessing.cpu_count``;
     * the CPU affinity settings of the current process
       (available with Python 3.4+ on some Unix systems);
     * CFS scheduler CPU bandwidth limit (available on Linux only, typically
       set by docker and similar container orchestration systems);
     * the value of the LOKY_MAX_CPU_COUNT environment variable if defined.
    and is given as the minimum of these constraints.
    It is also always larger or equal to 1.

Return the number of CPUs the current process can use .


def
Func
(
arg_0
,
arg_1
=
'path'
)
:
arg_2
=
[
]
def
prepare_string
(
arg_3
)
:
arg_3
=
str
(
arg_3
)
arg_3
=
re
.
sub
(
'[][{},*"'
+
f"'{os.sep}]"
,
'_'
,
arg_3
)
if
arg_1
==
'file'
:
arg_3
=
arg_3
.
replace
(
'_'
,
' '
)
if
' '
in
arg_3
:
arg_3
=
arg_3
.
title
(
)
arg_3
=
arg_3
.
replace
(
' '
,
''
)
return
arg_3
if
isinstance
(
arg_0
,
set
)
:
arg_4
=
sorted
(
arg_0
)
for
arg_5
in
arg_4
:
arg_2
.
append
(
prepare_string
(
arg_5
)
)
else
:
arg_4
=
sorted
(
arg_0
.
items
(
)
)
for
arg_5
,
arg_6
in
arg_4
:
if
Bool
.
valid
(
arg_6
)
:
arg_2
.
append
(
(
''
if
arg_6
else
(
'not_'
if
arg_1
==
'path'
else
'not'
)
)
+
prepare_string
(
arg_5
)
)
elif
(
Float
|
Integer
)
.
valid
(
arg_6
)
:
arg_2
.
append
(
'{}{}'
.
format
(
prepare_string
(
arg_5
)
,
prepare_string
(
arg_6
)
)
)
else
:
arg_2
.
append
(
'{}{}{}'
.
format
(
prepare_string
(
arg_5
)
,
'_'
if
arg_1
==
'path'
else
''
,
prepare_string
(
arg_6
)
)
)
if
arg_1
==
'path'
:
arg_7
=
os
.
path
.
join
(
*
arg_2
)
else
:
arg_7
=
'_'
.
join
(
arg_2
)
return
arg_7

def Func(arg_0,arg_1='path'):
    '''
    turns keyword pairs into path or filename

    if `into=='path'`, then keywords are separted by underscores, else keywords are used to create a directory hierarchy
    '''
    arg_2 = []
    def prepare_string(arg_3):
        arg_3 = str(arg_3)
        arg_3 = re.sub('[][{},*"'+f"'{os.sep}]",'_',arg_3)#replace characters that make bash life difficult by underscore
        if arg_1=='file':
            arg_3 = arg_3.replace('_', ' ')#Remove underscore because they will be used as separator
        if ' ' in arg_3:
            arg_3 = arg_3.title()
            arg_3 = arg_3.replace(' ','')
        return arg_3
    if isinstance(arg_0,set):
        arg_4 = sorted(arg_0)
        for arg_5 in arg_4:
            arg_2.append(prepare_string(arg_5))
    else:
        arg_4 = sorted(arg_0.items())
        for arg_5,arg_6 in arg_4:  # @reservedassignment
            if Bool.valid(arg_6):
                arg_2.append(('' if arg_6 else ('not_' if arg_1=='path' else 'not'))+prepare_string(arg_5))
            #elif String.valid(value):
            #    subdirs.append(prepare_string(value))
            elif (Float|Integer).valid(arg_6):
                arg_2.append('{}{}'.format(prepare_string(arg_5),prepare_string(arg_6)))
            else:
                arg_2.append('{}{}{}'.format(prepare_string(arg_5),'_' if arg_1 == 'path' else '',prepare_string(arg_6)))
    if arg_1 == 'path':
        arg_7 = os.path.join(*arg_2)
    else:
        arg_7 = '_'.join(arg_2)
    return arg_7

turns keyword pairs into path or filename if into == path then keywords are separted by underscores else keywords are used to create a directory hierarchy


(self, patch_name=None, remove=False, backup=False)

def Func ( arg_0 , arg_1 = None , arg_2 = False , arg_3 = False ) : if arg_1 : arg_4 = Patch ( arg_1 ) else : arg_4 = arg_0 . db . top_patch ( ) if not arg_4 : raise NoAppliedPatch ( arg_0 . db ) arg_0 . _Func ( arg_4 , arg_2 = arg_2 , arg_3 = arg_3 )

def Func(arg_0, arg_1=None, arg_2=False, arg_3=False):
        """ Delete specified patch from the series
        If remove is True the patch file will also be removed. If remove and
        backup are True a copy of the deleted patch file will be made.
        """
        if arg_1:
            arg_4 = Patch(arg_1)
        else:
            arg_4 = arg_0.db.top_patch()
            if not arg_4:
                raise NoAppliedPatch(arg_0.db)

        arg_0._Func(arg_4, arg_2=arg_2, arg_3=arg_3)

Delete specified patch from the series If remove is True the patch file will also be removed . If remove and backup are True a copy of the deleted patch file will be made .


This gets the current configuration. By default, it looks up the
        current application and gets the configuration from there. But if you
        don't want to go to the full effort of setting an application, or it's
        otherwise outside of a request context, set the `_config` attribute to
        an `UploadConfiguration` instance, then set it back to `None` when
        you're done.

def Func(arg_0):
        """
        This gets the current Funcuration. By default, it looks up the
        current application and gets the Funcuration from there. But if you
        don't want to go to the full effort of setting an application, or it's
        otherwise outside of a request context, set the `_Func` attribute to
        an `UploadConfiguration` instance, then set it back to `None` when
        you're done.
        """
        if arg_0._Func is not None:
            return arg_0._Func
        try:
            return current_app.upload_set_Func[arg_0.name]
        except AttributeError:
            raise RuntimeError("cannot access Funcuration outside request")

This gets the current configuration . By default it looks up the current application and gets the configuration from there . But if you don t want to go to the full effort of setting an application or it s otherwise outside of a request context set the _config attribute to an UploadConfiguration instance then set it back to None when you re done .


def
Func
(
arg_0
)
:
arg_1
=
{
}
arg_1
[
'UUID'
]
=
arg_0
.
uuid
arg_1
[
'Creation Date'
]
=
arg_0
.
time
arg_1
[
'Time Zone'
]
=
arg_0
.
tz
if
arg_0
.
tags
:
arg_1
[
'Tags'
]
=
arg_0
.
tags
arg_1
[
'Entry Text'
]
=
arg_0
.
text
arg_1
[
'Starred'
]
=
arg_0
.
starred
arg_1
[
'Location'
]
=
arg_0
.
location
return
arg_1

def Func(arg_0):
        """Return a dict that represents the DayOneEntry"""
        arg_1 = {}
        arg_1['UUID'] = arg_0.uuid
        arg_1['Creation Date'] = arg_0.time
        arg_1['Time Zone'] = arg_0.tz
        if arg_0.tags:
            arg_1['Tags'] = arg_0.tags
        arg_1['Entry Text'] = arg_0.text
        arg_1['Starred'] = arg_0.starred
        arg_1['Location'] = arg_0.location
        return arg_1


def Func ( arg_0 , ** arg_1 ) : arg_2 = arg_0 . get_params ( ) return jsonpickle . encode ( arg_2 , ** arg_1 )

def Func(arg_0, **arg_1):
    '''Serialize a transformation object or pipeline.

    Parameters
    ----------
    transform : BaseTransform or Pipeline
        The transformation object to be Funcd

    kwargs
        Additional keyword arguments to `jsonpickle.encode()`

    Returns
    -------
    json_str : str
        A JSON encoding of the transformation

    See Also
    --------
    deFunc

    Examples
    --------
    >>> D = muda.deformers.TimeStretch(rate=1.5)
    >>> muda.Func(D)
    '{"params": {"rate": 1.5},
      "__class__": {"py/type": "muda.deformers.time.TimeStretch"}}'
    '''

    arg_2 = arg_0.get_params()
    return jsonpickle.encode(arg_2, **arg_1)

Serialize a transformation object or pipeline.

    Parameters
    ----------
    transform : BaseTransform or Pipeline
        The transformation object to be serialized

    kwargs
        Additional keyword arguments to `jsonpickle.encode()`

    Returns
    -------
    json_str : str
        A JSON encoding of the transformation

    See Also
    --------
    deserialize

    Examples
    --------
    >>> D = muda.deformers.TimeStretch(rate=1.5)
    >>> muda.serialize(D)
    '{"params": {"rate": 1.5},
      "__class__": {"py/type": "muda.deformers.time.TimeStretch"}}'

Serialize a transformation object or pipeline .


def Func(arg_0, arg_1):
        """
        Func value of this param
        """
        assert not arg_0.__isReadOnly, \
            ("This parameter(%s) was locked"
             " and now it can not be changed" % arg_0.name)
        assert arg_0.replacedWith is None, \
            ("This param was replaced with new one and this "
             "should not exists")

        arg_1 = toHVal(arg_1)
        arg_0.defVal = arg_1
        arg_0._val = arg_1.staticEval()
        arg_0._dtype = arg_0._val._dtype


def Func ( arg_0 , arg_1 ) : arg_2 = { 'jobs[]' : arg_1 } arg_3 = make_post_request ( arg_0 , 'self/jobs' , arg_4 = arg_2 ) arg_4 = arg_3 . json ( ) if arg_3 . status_code == 200 : return arg_4 [ 'status' ] else : raise UserJobsNotAddedException ( message = arg_4 [ 'message' ] , error_code = arg_4 [ 'error_code' ] , request_id = arg_4 [ 'request_id' ] )

def Func(arg_0, arg_1):
    """
    Add a list of jobs to the currently authenticated user
    """
    arg_2 = {
        'jobs[]': arg_1
    }
    arg_3 = make_post_request(arg_0, 'self/jobs', arg_4=arg_2)
    arg_4 = arg_3.json()
    if arg_3.status_code == 200:
        return arg_4['status']
    else:
        raise UserJobsNotAddedException(
            message=arg_4['message'],
            error_code=arg_4['error_code'],
            request_id=arg_4['request_id'])


return reduce(adict.__class__.get, [p for p in op.split(sep) if p], adict)

def Func ( arg_0 , arg_1 , arg_2 = arg_3 . sep ) : return reduce ( arg_0 . __class__ . get , [ arg_4 for arg_4 in op . split ( arg_2 ) if arg_4 ] , arg_0 )

def Func(arg_0, arg_1, arg_2=arg_3.sep):
    """
    Given a nested dictionary adict.
    This returns its childen just below the path.
    The path is a string composed of adict keys separated by sep.

    :param adict: nested dict

    :param path: str

    :param sep: str

    :return: dict or list or leaf of treemap

    """
    return reduce(arg_0.__class__.get, [arg_4 for arg_4 in op.split(arg_2) if arg_4], arg_0)

Given a nested dictionary adict . This returns its childen just below the path . The path is a string composed of adict keys separated by sep .


def Func(arg_0=True):
    """Clears all the placeholder variables of keep prob,
    including keeping probabilities of all dropout, denoising, dropconnect etc.

    Parameters
    ----------
    printable : boolean
        If True, print all deleted variables.

    """
    tl.logging.info('clear all .....................................')
    arg_1 = globals().copy()
    for arg_2 in arg_1:
        if arg_2[0] == '_': continue
        if 'func' in str(globals()[arg_2]): continue
        if 'module' in str(globals()[arg_2]): continue
        if 'class' in str(globals()[arg_2]): continue

        if arg_0:
            tl.logging.info(" clear_all ------- %s" % str(globals()[arg_2]))

        del globals()[arg_2]

Clears all the placeholder variables of keep prob including keeping probabilities of all dropout denoising dropconnect etc .


def
Func
(
arg_0
,
arg_1
=
'down'
)
:
if
arg_0
.
rank
==
arg_0
.
grouped_filter
(
)
.
count
(
)
:
return
''
arg_2
=
ContentType
.
objects
.
get_for_model
(
arg_0
)
arg_3
=
reverse
(
'awl-rankedmodel-move'
,
args
=
(
arg_2
.
id
,
arg_0
.
id
,
arg_0
.
rank
+
1
)
)
return
'%s'
%
(
arg_3
,
arg_1
)

def Func(arg_0, arg_1='down'):
    """Returns a link to a view that moves the passed in object down in rank.

    :param obj:
        Object to move
    :param link_text:
        Text to display in the link.  Defaults to "down"
    :returns:
        HTML link code to view for moving the object
    """
    if arg_0.rank == arg_0.grouped_filter().count():
        return ''

    arg_2 = ContentType.objects.get_for_model(arg_0)
    arg_3 = reverse('awl-rankedmodel-move', args=(arg_2.id, arg_0.id,
        arg_0.rank + 1))

    return '%s' % (arg_3, arg_1)

Returns a link to a view that moves the passed in object down in rank .


def Func ( arg_0 ) : arg_1 = topology_pb2 . Config ( ) arg_2 = arg_1 . kvs . add ( ) arg_2 . key = TOPOLOGY_COMPONENT_PARALLELISM arg_2 . value = str ( arg_0 . parallelism ) arg_2 . type = topology_pb2 . ConfigValueType . Value ( "STRING_VALUE" ) if arg_0 . custom_config is not None : arg_5 = arg_0 . _sanitize_config ( arg_0 . custom_config ) for arg_2 , arg_3 in arg_5 . items ( ) : if isinstance ( arg_3 , str ) : arg_6 = arg_1 . kvs . add ( ) arg_6 . key = arg_2 arg_6 . value = arg_3 arg_6 . type = topology_pb2 . ConfigValueType . Value ( "STRING_VALUE" ) else : arg_6 = arg_1 . kvs . add ( ) arg_6 . key = arg_2 arg_6 . serialized_value = default_serializer . serialize ( arg_3 ) arg_6 . type = topology_pb2 . ConfigValueType . Value ( "PYTHON_SERIALIZED_VALUE" ) return arg_1

def Func(arg_0):
    """Returns component-specific Config protobuf message

    It first adds ``topology.component.parallelism``, and is overriden by
    a user-defined component-specific configuration, specified by spec().
    """
    arg_1 = topology_pb2.Config()

    # first add parallelism
    arg_2 = arg_1.kvs.add()
    arg_2.key = TOPOLOGY_COMPONENT_PARALLELISM
    arg_2.value = str(arg_0.parallelism)
    arg_2.type = topology_pb2.ConfigValueType.Value("STRING_VALUE")

    # iterate through self.custom_config
    if arg_0.custom_config is not None:
      arg_5 = arg_0._sanitize_config(arg_0.custom_config)
      for arg_2, arg_3 in arg_5.items():
        if isinstance(arg_3, str):
          arg_6 = arg_1.kvs.add()
          arg_6.key = arg_2
          arg_6.value = arg_3
          arg_6.type = topology_pb2.ConfigValueType.Value("STRING_VALUE")
        else:
          # need to serialize
          arg_6 = arg_1.kvs.add()
          arg_6.key = arg_2
          arg_6.serialized_value = default_serializer.serialize(arg_3)
          arg_6.type = topology_pb2.ConfigValueType.Value("PYTHON_SERIALIZED_VALUE")

    return arg_1

Returns component - specific Config protobuf message


def
Func
(
arg_0
,
arg_1
,
arg_2
=
arg_3
)
->
pd
.
DataFrame
:
arg_4
=
[
'Trading_Day_Start_Time_EOD'
,
'Trading_Day_End_Time_EOD'
]
arg_5
,
arg_6
=
create_connection
(
)
arg_7
=
arg_5
.
ref
(
arg_0
=
arg_0
,
flds
=
arg_4
)
arg_8
=
pd
.
Timestamp
(
'today'
)
.
strftime
(
'%Y-%m-%d '
)
arg_7
.
loc
[
:
,
'local'
]
=
arg_7
.
value
.
astype
(
str
)
.
str
[
:
3
]
arg_7
.
loc
[
:
,
'exch'
]
=
pd
.
DatetimeIndex
(
arg_8
+
arg_7
.
value
.
astype
(
str
)
)
.
tz_localize
(
arg_2
)
.
tz_convert
(
arg_1
)
.
strftime
(
'%H:%M'
)
arg_7
=
pd
.
concat
(
[
arg_7
.
set_index
(
[
'ticker'
,
'field'
]
)
.
exch
.
unstack
(
)
.
loc
[
:
,
arg_4
]
,
arg_7
.
set_index
(
[
'ticker'
,
'field'
]
)
.
local
.
unstack
(
)
.
loc
[
:
,
arg_4
]
,
]
,
axis
=
1
)
arg_7
.
columns
=
[
'Exch_Start'
,
'Exch_End'
,
'Local_Start'
,
'Local_End'
]
return
arg_7

def Func(arg_0, arg_1, arg_2=arg_3) -> pd.DataFrame:
    """
    Check exchange hours vs local hours

    Args:
        tickers: list of tickers
        tz_exch: exchange timezone
        tz_loc: local timezone

    Returns:
        Local and exchange hours
    """
    arg_4 = ['Trading_Day_Start_Time_EOD', 'Trading_Day_End_Time_EOD']
    arg_5, arg_6 = create_connection()
    arg_7 = arg_5.ref(arg_0=arg_0, flds=arg_4)
    arg_8 = pd.Timestamp('today').strftime('%Y-%m-%d ')
    arg_7.loc[:, 'local'] = arg_7.value.astype(str).str[:-3]
    arg_7.loc[:, 'exch'] = pd.DatetimeIndex(
        arg_8 + arg_7.value.astype(str)
    ).tz_localize(arg_2).tz_convert(arg_1).strftime('%H:%M')

    arg_7 = pd.concat([
        arg_7.set_index(['ticker', 'field']).exch.unstack().loc[:, arg_4],
        arg_7.set_index(['ticker', 'field']).local.unstack().loc[:, arg_4],
    ], axis=1)
    arg_7.columns = ['Exch_Start', 'Exch_End', 'Local_Start', 'Local_End']

    return arg_7


def Func(arg_0, arg_1):
        """
        Execute sqoop job
        """
        arg_0.hook = SqoopHook(
            conn_id=arg_0.conn_id,
            verbose=arg_0.verbose,
            num_mappers=arg_0.num_mappers,
            hcatalog_database=arg_0.hcatalog_database,
            hcatalog_table=arg_0.hcatalog_table,
            properties=arg_0.properties
        )

        if arg_0.cmd_type == 'export':
            arg_0.hook.export_table(
                table=arg_0.table,
                export_dir=arg_0.export_dir,
                input_null_string=arg_0.input_null_string,
                input_null_non_string=arg_0.input_null_non_string,
                staging_table=arg_0.staging_table,
                clear_staging_table=arg_0.clear_staging_table,
                enclosed_by=arg_0.enclosed_by,
                escaped_by=arg_0.escaped_by,
                input_fields_terminated_by=arg_0.input_fields_terminated_by,
                input_lines_terminated_by=arg_0.input_lines_terminated_by,
                input_optionally_enclosed_by=arg_0.input_optionally_enclosed_by,
                batch=arg_0.batch,
                relaxed_isolation=arg_0.relaxed_isolation,
                extra_export_options=arg_0.extra_export_options)
        elif arg_0.cmd_type == 'import':
            # add create hcatalog table to extra import options if option passed
            # if new params are added to constructor can pass them in here
            # so don't modify sqoop_hook for each param
            if arg_0.create_hcatalog_table:
                arg_0.extra_import_options['create-hcatalog-table'] = ''

            if arg_0.table and arg_0.query:
                raise AirflowException(
                    'Cannot specify query and table together. Need to specify either or.'
                )

            if arg_0.table:
                arg_0.hook.import_table(
                    table=arg_0.table,
                    target_dir=arg_0.target_dir,
                    append=arg_0.append,
                    file_type=arg_0.file_type,
                    columns=arg_0.columns,
                    split_by=arg_0.split_by,
                    where=arg_0.where,
                    direct=arg_0.direct,
                    driver=arg_0.driver,
                    arg_3=arg_0.extra_import_options)
            elif arg_0.query:
                arg_0.hook.import_query(
                    query=arg_0.query,
                    target_dir=arg_0.target_dir,
                    append=arg_0.append,
                    file_type=arg_0.file_type,
                    split_by=arg_0.split_by,
                    direct=arg_0.direct,
                    driver=arg_0.driver,
                    arg_3=arg_0.extra_import_options)
            else:
                raise AirflowException(
                    "Provide query or table parameter to import using Sqoop"
                )
        else:
            raise AirflowException("cmd_type should be 'import' or 'export'")


def Func ( arg_0 ) : arg_0 = [ e for i , e in enumerate ( arg_0 ) if arg_0 . index ( e ) == i ] arg_1 = { } arg_2 = [ ] arg_3 = 0 while len ( arg_2 ) != len ( arg_0 ) : for arg_4 in arg_0 : arg_5 , arg_6 , arg_7 = arg_4 if arg_4 in arg_2 : continue for arg_8 in register_options ( arg_6 ) : arg_9 = arg_1 . setdefault ( arg_3 , { } ) if arg_8 not in arg_9 : arg_9 [ arg_8 ] = ( arg_5 , arg_8 , arg_7 ) arg_2 . append ( arg_4 ) break arg_3 += 1 arg_10 = [ list ( v . values ( ) ) for v in arg_1 . values ( ) ] return arg_10

def Func(arg_0):
    """Compile list of minimal runs for given events."""
    # Eliminate multiples
    arg_0 = [e for i, e in enumerate(arg_0) if arg_0.index(e) == i]

    # Build list of runs per register group
    arg_1 = {}
    arg_2 = []
    arg_3 = 0
    while len(arg_2) != len(arg_0):
        for arg_4 in arg_0:
            arg_5, arg_6, arg_7 = arg_4
            # Skip allready scheduled events
            if arg_4 in arg_2:
                continue
            # Compile explicit list of possible register locations
            for arg_8 in register_options(arg_6):
                # Schedule in current run, if register is not yet in use
                arg_9 = arg_1.setdefault(arg_3, {})
                if arg_8 not in arg_9:
                    arg_9[arg_8] = (arg_5, arg_8, arg_7)
                    # ban from further scheduling attempts
                    arg_2.append(arg_4)
                    break
        arg_3 += 1

    # Collaps all register dicts to single runs
    arg_10 = [list(v.values()) for v in arg_1.values()]

    return arg_10

Compile list of minimal runs for given events .


return reduced_scenarios, reduced_probability, reduced_scenario_set

def Func(arg_0, arg_1, arg_2=None):
    """Fast forward selection algorithm

    Parameters
    ----------
    scenarios : numpy.array
        Contain the input scenarios.
        The columns representing the individual scenarios
        The rows are the vector of values in each scenario
    number_of_reduced_scenarios : int
        final number of scenarios that
        the reduced scenarios contain.
        If number of scenarios is equal to or greater than the input scenarios,
        then the original input scenario set is returned as the reduced set
    probability : numpy.array (default=None)
        probability is a numpy.array with length equal to number of scenarios.
        if probability is not defined, all scenarios get equal probabilities

    Returns
    -------
    reduced_scenarios : numpy.array
        reduced set of scenarios
    reduced_probability : numpy.array
        probability of reduced set of scenarios
    reduced_scenario_set : list
        scenario numbers of reduced set of scenarios

    Example
    -------
    Scenario reduction can be performed as shown below::

        >>> import numpy as np
        >>> import random
        >>> scenarios = np.array([[random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)]])
        >>> import psst.scenario
        >>> reduced_scenarios, reduced_probability, reduced_scenario_numbers = psst.scenario.Func(scenarios, probability, 2)
    """
    print("Running fast forward selection algorithm")

    arg_3 = arg_0.shape[1]
    logger.debug("Input number of scenarios = %d", arg_3)

    # if probability is not defined assign equal probability to all scenarios
    if arg_2 is None:
        arg_2 = np.array([1/arg_3 for i in range(0, arg_3)])

    # initialize z, c and J
    arg_4 = np.array([np.inf for i in range(0, arg_3)])
    arg_5 = np.zeros((arg_3, arg_3))
    arg_6 = range(0, arg_3)

    # no reduction necessary
    if arg_1 >= arg_3:
        return(arg_0, arg_2, arg_6)

    for arg_7 in range(0, arg_3):
        for arg_8 in range(0, arg_3):
            arg_5[arg_7, arg_8] = distance(arg_0[:, arg_7], arg_0[:, arg_8])

    for arg_8 in range(0, arg_3):
        arg_9 = 0
        for arg_7 in range(0, arg_3):
            if arg_7 != arg_8:
                arg_9 = arg_9 + arg_2[arg_7]*arg_5[arg_7, arg_8]

        arg_4[arg_8] = arg_9

    arg_10 = [np.argmin(arg_4)]

    for arg_11 in arg_10:
        arg_6.remove(arg_11)

    for arg_12 in range(0, arg_3 - arg_1 - 1):
        print("Running {}".format(arg_12))

        for arg_8 in arg_6:
            for arg_7 in arg_6:
                arg_13 = np.inf

                for arg_14 in arg_10:
                    arg_13 = min(arg_5[arg_7, arg_8], arg_5[arg_7, arg_14])

            arg_5[arg_7, arg_8] = arg_13

        for arg_8 in arg_6:
            arg_9 = 0
            for arg_7 in arg_6:
                if arg_7 not in arg_10:
                    arg_9 = arg_9 + arg_2[arg_7]*arg_5[arg_7, arg_8]

            arg_4[arg_8] = arg_9

        arg_15 = np.argmin([item if i in arg_6 else np.inf for i, item in enumerate(arg_4)])

        arg_6.remove(arg_15)
        arg_10.append(arg_15)

    arg_16 = arg_10
    arg_17 = []

    arg_17 = copy.deepcopy(arg_2)
    for arg_18 in arg_6:
        arg_13 = np.inf

        # find closest scenario_number
        for arg_19 in arg_16:
            if arg_5[arg_18, arg_19] < arg_13:
                arg_20 = arg_19
                arg_13 = arg_5[arg_18, arg_19]

        arg_17[arg_20] = arg_17[arg_20] + arg_17[arg_18]

    arg_21 = copy.deepcopy(arg_0[:, arg_16])
    arg_17 = arg_17[arg_16]

    return arg_21, arg_17, arg_16

Fast forward selection algorithm

    Parameters
    ----------
    scenarios : numpy.array
        Contain the input scenarios.
        The columns representing the individual scenarios
        The rows are the vector of values in each scenario
    number_of_reduced_scenarios : int
        final number of scenarios that
        the reduced scenarios contain.
        If number of scenarios is equal to or greater than the input scenarios,
        then the original input scenario set is returned as the reduced set
    probability : numpy.array (default=None)
        probability is a numpy.array with length equal to number of scenarios.
        if probability is not defined, all scenarios get equal probabilities

    Returns
    -------
    reduced_scenarios : numpy.array
        reduced set of scenarios
    reduced_probability : numpy.array
        probability of reduced set of scenarios
    reduced_scenario_set : list
        scenario numbers of reduced set of scenarios

    Example
    -------
    Scenario reduction can be performed as shown below::

        >>> import numpy as np
        >>> import random
        >>> scenarios = np.array([[random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)],
        >>>         [random.randint(500,1000) for i in range(0,24)]])
        >>> import psst.scenario
        >>> reduced_scenarios, reduced_probability, reduced_scenario_numbers = psst.scenario.fast_forward_selection(scenarios, probability, 2)


def Func ( arg_0 ) : arg_1 = [ v . strip ( ) for v in arg_0 . split ( ',' ) ] if len ( arg_1 ) == 1 : arg_1 = arg_0 . split ( ) return arg_1

def Func(arg_0):
    """Split a string with comma or space-separated elements into a list."""
    arg_1 = [v.strip() for v in arg_0.split(',')]
    if len(arg_1) == 1:
        arg_1 = arg_0.split()
    return arg_1

Split a string with comma or space - separated elements into a list .


def Func(arg_0, arg_1, arg_2):
        """Read a single byte from the specified cmd register of the device."""
        assert arg_0._device is not None, 'Bus must be opened before operations are made against it!'
        # Build ctypes values to marshall between ioctl and Python.
        arg_3 = c_uint8(arg_2)
        arg_4 = c_uint8()
        # Build ioctl request.
        arg_5 = make_i2c_rdwr_data([
            (arg_1, 0, 1, pointer(arg_3)),             # Write cmd register.
            (arg_1, I2C_M_RD, 1, pointer(arg_4))    # Read 1 byte as result.
        ])
        # Make ioctl call and return result data.
        ioctl(arg_0._device.fileno(), I2C_RDWR, arg_5)
        return arg_4.value

Read a single byte from the specified cmd register of the device .


def Func ( ) : arg_0 = [ ] arg_1 = set ( ) for arg_2 in arg_4 . path : arg_2 , arg_3 = makepath ( arg_2 ) if not arg_3 in arg_1 : arg_0 . append ( arg_2 ) arg_1 . add ( arg_3 ) arg_4 . path [ : ] = arg_0 return arg_1

def Func():
    """ Remove duplicate entries from sys.path along with making them
    absolute"""
    # This ensures that the initial path provided by the interpreter contains
    # only absolute pathnames, even if we're running from the build directory.
    arg_0 = []
    arg_1 = set()
    for arg_2 in arg_4.path:
        # Filter out duplicate paths (on case-insensitive file systems also
        # if they only differ in case); turn relative paths into absolute
        # paths.
        arg_2, arg_3 = makepath(arg_2)
        if not arg_3 in arg_1:
            arg_0.append(arg_2)
            arg_1.add(arg_3)
    arg_4.path[:] = arg_0
    return arg_1

Remove duplicate entries from sys . path along with making them absolute


def
Func
(
arg_0
,
arg_1
)
:
if
'readOnly'
in
arg_0
.
metadata
and
arg_0
.
metadata
[
'readOnly'
]
:
raise
PropertyError
(
'Read-only property'
)
try
:
validate
(
arg_1
,
arg_0
.
metadata
)
except
ValidationError
:
raise
PropertyError
(
'Invalid property value'
)

def Func(arg_0, arg_1):
        """
        Validate new property value before setting it.

        value -- New value
        """
        if 'readOnly' in arg_0.metadata and arg_0.metadata['readOnly']:
            raise PropertyError('Read-only property')

        try:
            validate(arg_1, arg_0.metadata)
        except ValidationError:
            raise PropertyError('Invalid property value')

Validate new property value before setting it .


def Func ( arg_0 ) : arg_1 = PeriodicActivityRequest ( repeating = True , period = 100 , cb = arg_0 . _updateModelDBResults ) arg_2 = PeriodicActivityRequest ( repeating = True , period = 100 , cb = arg_0 . __updateJobResultsPeriodic ) arg_3 = PeriodicActivityRequest ( repeating = True , period = 50 , cb = arg_0 . __checkCancelation ) arg_4 = PeriodicActivityRequest ( repeating = True , period = 10 , cb = arg_0 . __checkMaturity ) arg_5 = PeriodicActivityRequest ( repeating = False , period = 2 , cb = arg_0 . __updateJobResultsPeriodic ) arg_6 = [ arg_1 , arg_5 , arg_2 , arg_3 ] if arg_0 . _isMaturityEnabled : arg_6 . append ( arg_4 ) return PeriodicActivityMgr ( requestedActivities = arg_6 )

def Func(arg_0):
    """ Creates and returns a PeriodicActivityMgr instance initialized with
    our periodic activities

    Parameters:
    -------------------------------------------------------------------------
    retval:             a PeriodicActivityMgr instance
    """

    # Activity to update the metrics for this model
    # in the models table
    arg_1 = PeriodicActivityRequest(repeating=True,
                                                 period=100,
                                                 cb=arg_0._updateModelDBResults)

    arg_2 = PeriodicActivityRequest(repeating=True,
                                               period=100,
                                               cb=arg_0.__updateJobResultsPeriodic)

    arg_3 = PeriodicActivityRequest(repeating=True,
                                               period=50,
                                               cb=arg_0.__checkCancelation)

    arg_4 = PeriodicActivityRequest(repeating=True,
                                            period=10,
                                            cb=arg_0.__checkMaturity)

    # Do an initial update of the job record after 2 iterations to make
    # sure that it is populated with something without having to wait too long
    arg_5 = PeriodicActivityRequest(repeating=False,
                                               period=2,
                                               cb=arg_0.__updateJobResultsPeriodic)

    arg_6 = [arg_1,
                          arg_5,
                          arg_2,
                          arg_3]

    if arg_0._isMaturityEnabled:
      arg_6.append(arg_4)

    return PeriodicActivityMgr(requestedActivities=arg_6)


def Func ( arg_0 , arg_1 , arg_2 = False ) : arg_0 . execute ( 'execfile(%r)' % arg_1 , arg_2 = arg_2 )

def Func(arg_0, arg_1, arg_2=False):
        """ Attempts to execute file with 'path'. If 'hidden', no output is
            shown.
        """
        arg_0.execute('execfile(%r)' % arg_1, arg_2=arg_2)

Attempts to execute file with path . If hidden no output is shown .


(self, i, r,
                            summarize=False,
                            report_unexpected_exceptions=True,
                            context=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
False
,
arg_4
=
True
,
arg_5
=
)
:
for
arg_6
in
dir
(
arg_0
)
:
if
arg_6
.
startswith
(
'each'
)
:
arg_7
=
arg_0
.
_as_dict
(
arg_2
)
arg_8
=
getattr
(
arg_0
,
arg_6
)
try
:
arg_8
(
arg_7
)
except
Exception
as
e
:
if
arg_4
:
arg_9
=
{
'code'
:
UNEXPECTED_EXCEPTION
}
if
not
arg_3
:
arg_9
[
'message'
]
=
MESSAGES
[
UNEXPECTED_EXCEPTION
]
%
(
e
.
__class__
.
__name__
,
e
)
arg_9
[
'row'
]
=
arg_1
+
1
arg_9
[
'record'
]
=
arg_2
arg_9
[
'exception'
]
=
e
arg_9
[
'function'
]
=
'%s: %s'
%
(
arg_8
.
__name__
,
arg_8
.
__doc__
)
if
arg_5
is
not
:
arg_9
[
'context'
]
=
arg_5
yield
arg_9

def Func(arg_0, arg_1, arg_2,
                            arg_3=False,
                            arg_4=True,
                            arg_5=None):
        """Invoke 'each' methods on `r`."""

        for arg_6 in dir(arg_0):
            if arg_6.startswith('each'):
                arg_7 = arg_0._as_dict(arg_2)
                arg_8 = getattr(arg_0, arg_6)
                try:
                    arg_8(arg_7)
                except Exception as e:
                    if arg_4:
                        arg_9 = {'code': UNEXPECTED_EXCEPTION}
                        if not arg_3:
                            arg_9['message'] = MESSAGES[UNEXPECTED_EXCEPTION] % (e.__class__.__name__, e)
                            arg_9['row'] = arg_1 + 1
                            arg_9['record'] = arg_2
                            arg_9['exception'] = e
                            arg_9['function'] = '%s: %s' % (arg_8.__name__,
                                                        arg_8.__doc__)
                            if arg_5 is not None: arg_9['context'] = arg_5
                        yield arg_9