return nx.DiGraph(candidates[output],
                          {idx: i for idx, i in enumerate(data.columns)})

def Func(arg_0, arg_1):
        """Use CGNN to create a graph from scratch. All the possible structures
        are tested, which leads to a super exponential complexity. It would be
        preferable to start from a graph skeleton for large graphs.

        Args:
            data (pandas.DataFrame): Observational data on which causal
               discovery has to be performed.
        Returns:
            networkx.DiGraph: Solution given by CGNN.

        """
        warnings.warn("An exhaustive search of the causal structure of CGNN without"
                      " skeleton is super-exponential in the number of variables.")

        # Building all possible candidates:
        arg_2 = len(list(arg_1.columns))
        arg_1 = scale(arg_1.values).astype('float32')

        arg_3 = [np.reshape(np.array(arg_7), (arg_2, arg_2)) for arg_7 in itertools.product([0, 1], repeat=arg_2*arg_2)
                      if (np.trace(np.reshape(np.array(arg_7), (arg_2, arg_2))) == 0
                          and nx.is_directed_acyclic_graph(nx.DiGraph(np.reshape(np.array(arg_7), (arg_2, arg_2)))))]

        warnings.warn("A total of {} graphs will be evaluated.".format(len(arg_3)))
        arg_4 = [parallel_graph_evaluation(arg_1, arg_7, nh=arg_0.nh, nb_runs=arg_0.nb_runs, gpu=arg_0.gpu,
                                            nb_jobs=arg_0.nb_jobs, lr=arg_0.lr, train_epochs=arg_0.train_epochs,
                                            test_epochs=arg_0.test_epochs, verbose=arg_0.verbose) for arg_7 in arg_3]
        arg_5 = arg_3[arg_4.index(min(arg_4))]
        arg_6 = np.zeros(arg_5.shape)

        # Retrieve the confidence score on each edge.
        for (arg_7, arg_8), arg_9 in np.ndenumerate(arg_5):
            if arg_9 > 0:
                arg_10 = arg_5
                arg_10[arg_7, arg_8] = 0
                arg_6[arg_7, arg_8] = min(arg_4) - arg_4[arg_3.index(arg_10)]

        return nx.DiGraph(arg_3[arg_6],
                          {arg_11: arg_7 for arg_11, arg_7 in enumerate(arg_1.columns)})

Use CGNN to create a graph from scratch . All the possible structures are tested which leads to a super exponential complexity . It would be preferable to start from a graph skeleton for large graphs .


(cls, parser, token, preposition, error_hint)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """Node constructor to be used in tags."""
        arg_5 = arg_2.split_contents()

        if len(arg_5) >= 3 and arg_5[1] == arg_3:
            arg_6 = arg_0.get_as_var(arg_5)
            arg_7 = arg_1.compile_filter(arg_5[2])
            return arg_0(arg_7, arg_6)

        raise template.TemplateSyntaxError(
            '%r tag requires at least two arguments. E.g. {%% %s %%}.' % (arg_5[0], arg_4))


def Func(arg_0):
    """
    Check if the given key id exists in apt keyring.
    """

    # Command extracted from apt-key source
    arg_1 = 'gpg --ignore-time-conflict --no-options --no-default-keyring --keyring /etc/apt/trusted.gpg'

    with settings(hide('everything'), warn_only=True):
        arg_2 = run('%(gpg_cmd)s --fingerprint %(keyid)s' % locals())

    return arg_2.succeeded

Check if the given key id exists in apt keyring .


def
Func
(
arg_0
)
:
arg_0
.
session
.
_add_object
(
)
arg_0
.
session
.
_out
(
'<<'
)
arg_0
.
session
.
_out
(
'/Type /Catalog'
)
arg_0
.
session
.
_out
(
'/Pages 1 0 R'
)
if
arg_0
.
zoom_mode
==
'fullpage'
:
arg_0
.
session
.
_out
(
'/OpenAction [3 0 R /Fit]'
)
elif
arg_0
.
zoom_mode
==
'fullwidth'
:
arg_0
.
session
.
_out
(
'/OpenAction [3 0 R /FitH null]'
)
elif
arg_0
.
zoom_mode
==
'real'
:
arg_0
.
session
.
_out
(
'/OpenAction [3 0 R /XYZ null null 1]'
)
elif
not
isinstance
(
arg_0
.
zoom_mode
,
basestring
)
:
arg_0
.
session
.
_out
(
'/OpenAction [3 0 R /XYZ null null '
+
(
arg_0
.
zoom_mode
/
100
)
+
']'
)
if
arg_0
.
layout_mode
==
'single'
:
arg_0
.
session
.
_out
(
'/PageLayout /SinglePage'
)
elif
arg_0
.
layout_mode
==
'continuous'
:
arg_0
.
session
.
_out
(
'/PageLayout /OneColumn'
)
elif
arg_0
.
layout_mode
==
'two'
:
arg_0
.
session
.
_out
(
'/PageLayout /TwoColumnLeft'
)
arg_0
.
session
.
_out
(
'>>'
)
arg_0
.
session
.
_out
(
'endobj'
)

def Func(arg_0):
        """Catalog object."""
        arg_0.session._add_object()
        arg_0.session._out('<<')

        arg_0.session._out('/Type /Catalog')
        arg_0.session._out('/Pages 1 0 R')
        if arg_0.zoom_mode == 'fullpage':
            arg_0.session._out('/OpenAction [3 0 R /Fit]')
        elif arg_0.zoom_mode == 'fullwidth':
            arg_0.session._out('/OpenAction [3 0 R /FitH null]')
        elif arg_0.zoom_mode == 'real':
            arg_0.session._out('/OpenAction [3 0 R /XYZ null null 1]')
        elif not isinstance(arg_0.zoom_mode, basestring):
            arg_0.session._out(
                '/OpenAction [3 0 R /XYZ null null ' +
                (arg_0.zoom_mode / 100) + ']')

        if arg_0.layout_mode == 'single':
            arg_0.session._out('/PageLayout /SinglePage')
        elif arg_0.layout_mode == 'continuous':
            arg_0.session._out('/PageLayout /OneColumn')
        elif arg_0.layout_mode == 'two':
            arg_0.session._out('/PageLayout /TwoColumnLeft')
        arg_0.session._out('>>')
        arg_0.session._out('endobj')


def Func ( arg_0 ) -> bool : if arg_0 . rule_nodes is None : arg_0 . rule_nodes = collections . ChainMap ( ) arg_0 . tag_cache = collections . ChainMap ( ) arg_0 . id_cache = collections . ChainMap ( ) else : arg_0 . rule_nodes = arg_0 . rule_nodes . new_child ( ) arg_0 . tag_cache = arg_0 . tag_cache . new_child ( ) arg_0 . id_cache = arg_0 . id_cache . new_child ( ) return True

def Func(arg_0) -> bool:
        """Push context variable to store rule nodes."""
        if arg_0.rule_nodes is None:
            arg_0.rule_nodes = collections.ChainMap()
            arg_0.tag_cache = collections.ChainMap()
            arg_0.id_cache = collections.ChainMap()
        else:
            arg_0.rule_nodes = arg_0.rule_nodes.new_child()
            arg_0.tag_cache = arg_0.tag_cache.new_child()
            arg_0.id_cache = arg_0.id_cache.new_child()
        return True

Push context variable to store rule nodes .


def Func ( arg_0 , arg_1 ) : try : arg_2 = next ( arg_1 . infer ( ) ) except astroid . InferenceError : return if isinstance ( arg_2 , Instance ) and arg_2 . qname ( ) == "datetime.time" : arg_0 . add_message ( "boolean-datetime" , arg_1 = arg_1 )

def Func(arg_0, arg_1):
        """ Check that a datetime was infered.
        If so, emit boolean-datetime warning.
        """
        try:
            arg_2 = next(arg_1.infer())
        except astroid.InferenceError:
            return
        if isinstance(arg_2, Instance) and arg_2.qname() == "datetime.time":
            arg_0.add_message("boolean-datetime", arg_1=arg_1)

Check that a datetime was infered . If so emit boolean - datetime warning .


(self, parent_context, *tag_args, **tag_kwargs)

return {
            self.context_value_name: self.get_value(parent_context, *tag_args, **tag_kwargs)
        }

def Func ( arg_0 , arg_1 , * arg_2 , ** arg_3 ) : if 'template' not in arg_0 . allowed_kwargs : arg_3 . pop ( 'template' , None ) return { arg_0 . context_value_name : arg_0 . get_value ( arg_1 , * arg_2 , ** arg_3 ) }

def Func(arg_0, arg_1, *arg_2, **arg_3):
        """
        Return the context data for the inclusion tag.

        Returns ``{'value': self.get_value(parent_context, *tag_args, **tag_kwargs)}`` by default.
        """
        if 'template' not in arg_0.allowed_kwargs:
            # The overwritten get_value() doesn't have to take care of our customly inserted tag parameters,
            # It can safely assume passing **tag_kwargs to another function.
            arg_3.pop('template', None)

        return {
            arg_0.context_value_name: arg_0.get_value(arg_1, *arg_2, **arg_3)
        }

Return the context data for the inclusion tag .


(cls, request_type, request_elements,
                                   credentials)

def Func(arg_0, arg_1, arg_2,
                                   arg_3):
        """
        Google doesn't accept client ID and secret to be at the same time in
        request parameters and in the basic authorization header in the access
        token request.
        """
        if arg_1 is arg_0.ACCESS_TOKEN_REQUEST_TYPE:
            arg_4 = arg_2[2]
            del arg_4['client_id']
            del arg_4['client_secret']
        return arg_2

Google doesn t accept client ID and secret to be at the same time in request parameters and in the basic authorization header in the access token request .


def Func(arg_0):
        """Renew the session lock.

        This operation must be performed periodically in order to retain a lock on the
        session to continue message processing.
        Once the lock is lost the connection will be closed. This operation can
        also be performed as a threaded background task by registering the session
        with an `azure.servicebus.AutoLockRenew` instance.

        Example:
            .. literalinclude:: ../examples/test_examples.py
                :start-after: [START Func]
                :end-before: [END Func]
                :language: python
                :dedent: 4
                :caption: Renew the session lock before it expires

        """
        arg_0._can_run()
        arg_1 = arg_0._mgmt_request_response(
            REQUEST_RESPONSE_RENEW_SESSION_LOCK_OPERATION,
            {'session-id': arg_0.session_id},
            mgmt_handlers.default)
        arg_0.locked_until = datetime.datetime.fromtimestamp(arg_1[b'expiration']/1000.0)

Renew the session lock.

        This operation must be performed periodically in order to retain a lock on the
        session to continue message processing.
        Once the lock is lost the connection will be closed. This operation can
        also be performed as a threaded background task by registering the session
        with an `azure.servicebus.AutoLockRenew` instance.

        Example:
            .. literalinclude:: ../examples/test_examples.py
                :start-after: [START renew_lock]
                :end-before: [END renew_lock]
                :language: python
                :dedent: 4
                :caption: Renew the session lock before it expires


load the module so we can actually run the script's function

def Func ( arg_0 ) : if not hasattr ( arg_0 , '_Func' ) : if "__main__" in sys . Funcs : arg_1 = sys . Funcs [ "__main__" ] arg_2 = arg_0 . normalize_path ( arg_1 . __file__ ) if os . path . splitext ( arg_2 ) == os . path . splitext ( arg_0 . path ) : arg_0 . _Func = arg_1 else : arg_0 . _Func = imp . load_source ( 'captain_script' , arg_0 . path ) return arg_0 . _Func

def Func(arg_0):
        """load the Func so we can actually run the script's function"""
        # we have to guard this value because:
        # https://thingspython.wordpress.com/2010/09/27/another-super-wrinkle-raising-typeerror/
        if not hasattr(arg_0, '_Func'):
            if "__main__" in sys.Funcs:
                arg_1 = sys.Funcs["__main__"]
                arg_2 = arg_0.normalize_path(arg_1.__file__)
                if os.path.splitext(arg_2) == os.path.splitext(arg_0.path):
                    arg_0._Func = arg_1

                else:
                    # http://stackoverflow.com/questions/67631/how-to-import-a-Func-given-the-full-path
                    arg_0._Func = imp.load_source('captain_script', arg_0.path)
                    #self._Func = imp.load_source(self.Func_name, self.path)

        return arg_0._Func

load the module so we can actually run the script s function


def Func(arg_0, arg_1=2.5):
    r"""Gaussian window

    :param N: window length

    .. math:: \exp^{-0.5 \left( \sigma\frac{n}{N/2} \right)^2}

    with :math:`\frac{N-1}{2}\leq n \leq \frac{N-1}{2}`.

    .. note:: N-1 is used to be in agreement with octave convention. The ENBW of
         1.4 is also in agreement with [Harris]_

    .. plot::
        :width: 80%
        :include-source:

        from spectrum import window_visu
        window_visu(64, 'gaussian', alpha=2.5)

    .. seealso:: scipy.signal.gaussian, :func:`create_window`
    """
    arg_2 = linspace(-(arg_0-1)/2., (arg_0-1)/2., arg_0)
    #t = linspace(-(N)/2., (N)/2., N)
    arg_3 = exp(-0.5*(arg_1 * arg_2/(arg_0/2.))**2.)
    return arg_3


return self.mpi_cmd + ['-n', str(self.n)] + self.mpi_args + \
               self.program + self.program_args

def Func ( arg_0 ) : return arg_0 . mpi_cmd + [ '-n' , str ( arg_0 . n ) ] + arg_0 . mpi_args + arg_0 . program + arg_0 . program_args

def Func(arg_0):
        """Build self.args using all the fields."""
        return arg_0.mpi_cmd + ['-n', str(arg_0.n)] + arg_0.mpi_args + \
               arg_0.program + arg_0.program_args

Build self . args using all the fields .


def Func ( arg_0 ) : if not arg_0 . is_Funcing ( ) : arg_0 . Func_pause ( ) arg_0 . _is_Funcing = True arg_0 . FuncEvent ( arg_0 )

def Func(arg_0):
        """
        Play the video asynchronously returning control immediately to the calling code
        """
        if not arg_0.is_Funcing():
            arg_0.Func_pause()
            arg_0._is_Funcing = True
            arg_0.FuncEvent(arg_0)


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
os
.
path
.
basename
(
arg_1
)
log
.
info
(
'Execute %s'
,
arg_2
)
arg_3
=
from_file
(
arg_1
)
.
replace
(
'\r'
,
''
)
.
split
(
'\n'
)
arg_4
=
'> '
for
arg_5
in
arg_3
:
arg_5
=
arg_5
.
rstrip
(
'\n'
)
arg_6
=
(
arg_4
+
arg_0
.
__exchange
(
arg_5
)
)
.
splitlines
(
)
arg_4
=
arg_6
.
pop
(
)
for
arg_7
in
arg_6
:
log
.
info
(
arg_7
)
log
.
info
(
arg_4
)

def Func(arg_0, arg_1):
        """execute the lines in the local file 'path'"""
        arg_2 = os.path.basename(arg_1)
        log.info('Execute %s', arg_2)

        arg_3 = from_file(arg_1).replace('\r', '').split('\n')

        arg_4 = '> '
        for arg_5 in arg_3:
            arg_5 = arg_5.rstrip('\n')
            arg_6 = (arg_4 + arg_0.__exchange(arg_5)).splitlines()
            # Log all but the last line
            arg_4 = arg_6.pop()
            for arg_7 in arg_6:
                log.info(arg_7)
        # last line
        log.info(arg_4)

execute the lines in the local file path


def Func ( arg_0 ) : for ( arg_1 , arg_2 ) in arg_0 . defaults . items ( ) : if getattr ( arg_0 , arg_1 ) == '_None' : setattr ( arg_0 , arg_1 , None )

def Func(arg_0):
        """
        Removes the temporary value set for None attributes.
        """
        for (arg_1, arg_2) in arg_0.defaults.items():
            if getattr(arg_0, arg_1) == '_None':
                setattr(arg_0, arg_1, None)

Removes the temporary value set for None attributes .


def Func(arg_0):
        '''Restores the starting position.'''
        arg_0.piece_bb = [
                BB_VOID,                       # NONE
                BB_RANK_C | BB_RANK_G,         # PAWN
                BB_A1 | BB_I1 | BB_A9 | BB_I9, # LANCE
                BB_A2 | BB_A8 | BB_I2 | BB_I8, # KNIGHT
                BB_A3 | BB_A7 | BB_I3 | BB_I7, # SILVER
                BB_A4 | BB_A6 | BB_I4 | BB_I6, # GOLD
                BB_B2 | BB_H8,                 # BISHOP
                BB_B8 | BB_H2,                 # ROOK
                BB_A5 | BB_I5,                 # KING
                BB_VOID,                       # PROM_PAWN
                BB_VOID,                       # PROM_LANCE
                BB_VOID,                       # PROM_KNIGHT
                BB_VOID,                       # PROM_SILVER
                BB_VOID,                       # PROM_BISHOP
                BB_VOID,                       # PROM_ROOK
        ]

        arg_0.pieces_in_hand = [collections.Counter(), collections.Counter()]

        arg_0.occupied = Occupied(BB_RANK_G | BB_H2 | BB_H8 | BB_RANK_I, BB_RANK_A | BB_B2 | BB_B8 | BB_RANK_C)

        arg_0.king_squares = [I5, A5]
        arg_0.pieces = [NONE for arg_6 in SQUARES]

        for arg_6 in SQUARES:
            arg_7 = BB_SQUARES[arg_6]
            for arg_8 in PIECE_TYPES:
                if arg_7 & arg_0.piece_bb[arg_8]:
                    arg_0.pieces[arg_6] = arg_8

        arg_0.turn = BLACK
        arg_0.move_number = 1
        arg_0.captured_piece_stack = collections.deque()
        arg_0.move_stack = collections.deque()
        arg_0.incremental_zobrist_hash = arg_0.board_zobrist_hash(DEFAULT_RANDOM_ARRAY)
        arg_0.transpositions = collections.Counter((arg_0.zobrist_hash(), ))


def Func(arg_0, arg_1):
        """Read an unsigned byte from the specified register."""
        arg_2 = arg_0._bus.read_byte_data(arg_0._address, arg_1) & 0xFF
        arg_0._logger.debug("Read 0x%02X from register 0x%02X",
                     arg_2, arg_1)
        return arg_2

Read an unsigned byte from the specified register .


(returns,
                           positions=None,
                           transactions=None,
                           market_data=None,
                           benchmark_rets=None,
                           slippage=None,
                           live_start_date=None,
                           sector_mappings=None,
                           bayesian=False,
                           round_trips=False,
                           estimate_intraday='infer',
                           hide_positions=False,
                           cone_std=(1.0, 1.5, 2.0),
                           bootstrap=False,
                           unadjusted_returns=None,
                           style_factor_panel=None,
                           sectors=None,
                           caps=None,
                           shares_held=None,
                           volumes=None,
                           percentile=None,
                           turnover_denom='AGB',
                           set_context=True,
                           factor_returns=None,
                           factor_loadings=None,
                           pos_in_dollars=True,
                           header_rows=None,
                           factor_partitions=FACTOR_PARTITIONS)

def Func(arg_0,
                           arg_1=None,
                           arg_2=None,
                           arg_3=None,
                           arg_4=None,
                           arg_5=None,
                           arg_6=None,
                           arg_7=None,
                           arg_8=False,
                           arg_9=False,
                           arg_10='infer',
                           arg_11=False,
                           arg_12=(1.0, 1.5, 2.0),
                           arg_13=False,
                           arg_14=None,
                           arg_15=None,
                           arg_16=None,
                           arg_17=None,
                           arg_18=None,
                           arg_19=None,
                           arg_20=None,
                           arg_21='AGB',
                           arg_22=True,
                           arg_23=None,
                           arg_24=None,
                           arg_25=True,
                           arg_26=None,
                           arg_27=arg_28):
    """
    Generate a number of tear sheets that are useful
    for analyzing a strategy's performance.

    - Fetches benchmarks if needed.
    - Creates tear sheets for returns, and significant events.
        If possible, also creates tear sheets for position analysis,
        transaction analysis, and Bayesian analysis.

    Parameters
    ----------
    returns : pd.Series
        Daily returns of the strategy, noncumulative.
         - Time series with decimal returns.
         - Example:
            2015-07-16    -0.012143
            2015-07-17    0.045350
            2015-07-20    0.030957
            2015-07-21    0.004902
    positions : pd.DataFrame, optional
        Daily net position values.
         - Time series of dollar amount invested in each position and cash.
         - Days where stocks are not held can be represented by 0 or NaN.
         - Non-working capital is labelled 'cash'
         - Example:
            index         'AAPL'         'MSFT'          cash
            2004-01-09    13939.3800     -14012.9930     711.5585
            2004-01-12    14492.6300     -14624.8700     27.1821
            2004-01-13    -13853.2800    13653.6400      -43.6375
    transactions : pd.DataFrame, optional
        Executed trade volumes and fill prices.
        - One row per trade.
        - Trades on different names that occur at the
          same time will have identical indicies.
        - Example:
            index                  amount   price    symbol
            2004-01-09 12:18:01    483      324.12   'AAPL'
            2004-01-09 12:18:01    122      83.10    'MSFT'
            2004-01-13 14:12:23    -75      340.43   'AAPL'
    market_data : pd.Panel, optional
        Panel with items axis of 'price' and 'volume' DataFrames.
        The major and minor axes should match those of the
        the passed positions DataFrame (same dates and symbols).
    slippage : int/float, optional
        Basis points of slippage to apply to returns before generating
        tearsheet stats and plots.
        If a value is provided, slippage parameter sweep
        plots will be generated from the unadjusted returns.
        Transactions and positions must also be passed.
        - See txn.adjust_returns_for_slippage for more details.
    live_start_date : datetime, optional
        The point in time when the strategy began live trading,
        after its backtest period. This datetime should be normalized.
    hide_positions : bool, optional
        If True, will not output any symbol names.
    bayesian: boolean, optional
        If True, causes the generation of a Bayesian tear sheet.
    round_trips: boolean, optional
        If True, causes the generation of a round trip tear sheet.
    sector_mappings : dict or pd.Series, optional
        Security identifier to sector mapping.
        Security ids as keys, sectors as values.
    estimate_intraday: boolean or str, optional
        Instead of using the end-of-day positions, use the point in the day
        where we have the most $ invested. This will adjust positions to
        better approximate and represent how an intraday strategy behaves.
        By default, this is 'infer', and an attempt will be made to detect
        an intraday strategy. Specifying this value will prevent detection.
    cone_std : float, or tuple, optional
        If float, The standard deviation to use for the cone plots.
        If tuple, Tuple of standard deviation values to use for the cone plots
         - The cone is a normal distribution with this standard deviation
             centered around a linear regression.
    bootstrap : boolean (optional)
        Whether to perform bootstrap analysis for the performance
        metrics. Takes a few minutes longer.
    turnover_denom : str
        Either AGB or portfolio_value, default AGB.
        - See full explanation in txn.get_turnover.
    factor_returns : pd.Dataframe, optional
        Returns by factor, with date as index and factors as columns
    factor_loadings : pd.Dataframe, optional
        Factor loadings for all days in the date range, with date and
        ticker as index, and factors as columns.
    pos_in_dollars : boolean, optional
        indicates whether positions is in dollars
    header_rows : dict or OrderedDict, optional
        Extra rows to display at the top of the perf stats table.
    set_context : boolean, optional
        If True, set default plotting style context.
         - See plotting.context().
    factor_partitions : dict, optional
        dict specifying how factors should be separated in perf attrib
        factor returns and risk exposures plots
        - See create_perf_attrib_tear_sheet().
    """

    if (arg_14 is None) and (arg_5 is not None) and\
       (arg_2 is not None):
        arg_14 = arg_0.copy()
        arg_0 = txn.adjust_returns_for_slippage(arg_0, arg_1,
                                                  arg_2, arg_5)

    arg_1 = utils.check_intraday(arg_10, arg_0,
                                     arg_1, arg_2)

    create_returns_tear_sheet(
        arg_0,
        arg_1=arg_1,
        arg_2=arg_2,
        arg_6=arg_6,
        arg_12=arg_12,
        arg_4=arg_4,
        arg_13=arg_13,
        arg_21=arg_21,
        arg_26=arg_26,
        arg_22=arg_22)

    create_interesting_times_tear_sheet(arg_0,
                                        arg_4=arg_4,
                                        arg_22=arg_22)

    if arg_1 is not None:
        create_position_tear_sheet(arg_0, arg_1,
                                   arg_11=arg_11,
                                   arg_22=arg_22,
                                   arg_7=arg_7,
                                   arg_10=False)

        if arg_2 is not None:
            create_txn_tear_sheet(arg_0, arg_1, arg_2,
                                  arg_14=arg_14,
                                  arg_10=False,
                                  arg_22=arg_22)
            if arg_9:
                create_round_trip_tear_sheet(
                    arg_0=arg_0,
                    arg_1=arg_1,
                    arg_2=arg_2,
                    arg_7=arg_7,
                    arg_10=False)

            if arg_3 is not None:
                create_capacity_tear_sheet(arg_0, arg_1, arg_2,
                                           arg_3,
                                           liquidation_daily_vol_limit=0.2,
                                           last_n_days=125,
                                           arg_10=False)

        if arg_15 is not None:
            create_risk_tear_sheet(arg_1, arg_15, arg_16,
                                   arg_17, arg_18, arg_19, arg_20)

        if arg_23 is not None and arg_24 is not None:
            create_perf_attrib_tear_sheet(arg_0, arg_1, arg_23,
                                          arg_24, arg_2,
                                          arg_25=arg_25,
                                          arg_27=arg_27)

    if arg_8:
        create_bayesian_tear_sheet(arg_0,
                                   arg_6=arg_6,
                                   arg_4=arg_4,
                                   arg_22=arg_22)

Generate a number of tear sheets that are useful for analyzing a strategy s performance .


def Func(arg_0, arg_1, arg_2=False):
    """Set the model objective.

    Parameters
    ----------
    model : cobra model
       The model to set the objective for
    value : model.problem.Objective,
            e.g. optlang.glpk_interface.Objective, sympy.Basic or dict

        If the model objective is linear, the value can be a new Objective
        object or a dictionary with linear coefficients where each key is a
        reaction and the element the new coefficient (float).

        If the objective is not linear and `additive` is true, only values
        of class Objective.

    additive : boolmodel.reactions.Biomass_Ecoli_core.bounds = (0.1, 0.1)
        If true, add the terms to the current objective, otherwise start with
        an empty objective.
    """
    arg_3 = arg_0.problem
    arg_4 = arg_0.solver.objective.expression
    arg_4 = arg_3.Objective(
        arg_4, arg_10=arg_0.solver.objective.direction,
        sloppy=True)

    if isinstance(arg_1, dict):
        if not arg_0.objective.is_Linear:
            raise ValueError('can only update non-linear objectives '
                             'additively using object of class '
                             'model.problem.Objective, not %s' %
                             type(arg_1))

        if not arg_2:
            arg_0.solver.objective = arg_3.Objective(
                Zero, arg_10=arg_0.solver.objective.direction)
        for arg_7, arg_8 in arg_1.items():
            arg_0.solver.objective.set_linear_coefficients(
                {arg_7.forward_variable: arg_8,
                 arg_7.reverse_variable: -arg_8})

    elif isinstance(arg_1, (Basic, optlang.interface.Objective)):
        if isinstance(arg_1, Basic):
            arg_1 = arg_3.Objective(
                arg_1, arg_10=arg_0.solver.objective.direction,
                sloppy=False)
        # Check whether expression only uses variables from current model
        # clone the objective if not, faster than cloning without checking
        if not _valid_atoms(arg_0, arg_1.expression):
            arg_1 = arg_3.Objective.clone(arg_1, arg_0=arg_0.solver)

        if not arg_2:
            arg_0.solver.objective = arg_1
        else:
            arg_0.solver.objective += arg_1.expression
    else:
        raise TypeError(
            '%r is not a valid objective for %r.' % (arg_1, arg_0.solver))

    arg_9 = get_context(arg_0)
    if arg_9:
        def reset():
            arg_0.solver.objective = arg_4
            arg_0.solver.objective.direction = arg_4.direction

        arg_9(reset)


def Func ( arg_0 ) : if arg_0 . _start_words is not None : return arg_0 . _start_words else : arg_0 . _start_words = list ( filter ( lambda x : str . isupper ( x [ 0 ] [ 0 ] ) and x [ 0 ] [ - 1 ] not in [ '.' , '?' , '!' ] , arg_0 . content . keys ( ) ) ) return arg_0 . _start_words

def Func(arg_0):
        """
        !DEMO!
        Cached list of keys that can be used to generate sentence.
        """

        if arg_0._start_words is not None:
            return arg_0._start_words
        else:
            arg_0._start_words = list(filter(
                lambda x: str.isupper(x[0][0]) and x[0][-1] not in ['.', '?', '!'],
                arg_0.content.keys()
            ))
            return arg_0._start_words

!DEMO! Cached list of keys that can be used to generate sentence .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = arg_1 . split ( "." ) [ - 1 ] == "laz" if arg_3 and arg_2 is None : arg_2 = True with open ( arg_1 , mode = "wb" ) as out : arg_0 . write_to ( out , arg_2 = arg_2 )

def Func(arg_0, arg_1, arg_2=None):
        """ Writes the las data into a file

        Parameters
        ----------
        filename : str
            The file where the data should be written.
        do_compress: bool, optional, default None
            if None the extension of the filename will be used
            to determine if the data should be compressed
            otherwise the do_compress flag indicate if the data should be compressed
        """
        arg_3 = arg_1.split(".")[-1] == "laz"
        if arg_3 and arg_2 is None:
            arg_2 = True
        with open(arg_1, mode="wb") as out:
            arg_0.write_to(out, arg_2=arg_2)


def Func ( arg_0 , arg_1 = 'stage' ) : arg_2 = [ ( 'cmd' , 'getinfo' ) , ( 'dev' , str ( arg_1 ) ) ] arg_0 . send ( arg_2 ) return arg_0 . wait_for ( * arg_2 [ 1 ] )

def Func(arg_0, arg_1='stage'):
        """Get information about given keyword. Defaults to stage."""
        arg_2 = [
            ('cmd', 'getinfo'),
            ('dev', str(arg_1))
        ]
        arg_0.send(arg_2)
        return arg_0.wait_for(*arg_2[1])

Get information about given keyword . Defaults to stage .


def
Func
(
arg_0
)
:
for
arg_1
in
sorted
(
MODULES
)
:
if
arg_1
in
arg_0
:
continue
click
.
secho
(
f'Funcing cache for {name}'
,
fg
=
'cyan'
,
bold
=
True
)
Func_cache
(
arg_1
)

def Func(arg_0):
    """Clear all caches."""
    for arg_1 in sorted(MODULES):
        if arg_1 in arg_0:
            continue
        click.secho(f'Funcing cache for {name}', fg='cyan', bold=True)
        Func_cache(arg_1)


This method the debugger uses to write. In contrast to
        writeline, no newline is added to the end to `str'. Also
        msg doesn't have to be a string.

def Func ( arg_0 , arg_1 ) : if arg_0 . state != 'connected' : arg_0 . wait_for_connect ( ) pass arg_2 = Mtcpfns . pack_msg ( arg_1 ) while len ( arg_2 ) > Mtcpfns . TCP_MAX_PACKET : arg_0 . conn . send ( arg_2 [ : Mtcpfns . TCP_MAX_PACKET ] ) arg_2 = arg_2 [ Mtcpfns . TCP_MAX_PACKET : ] return arg_0 . conn . send ( arg_2 )

def Func(arg_0, arg_1):
        """ This method the debugger uses to Func. In contrast to
        Funcline, no newline is added to the end to `str'. Also
        msg doesn't have to be a string.
        """
        if arg_0.state != 'connected':
            arg_0.wait_for_connect()
            pass
        arg_2 = Mtcpfns.pack_msg(arg_1)
        while len(arg_2) > Mtcpfns.TCP_MAX_PACKET:
            arg_0.conn.send(arg_2[:Mtcpfns.TCP_MAX_PACKET])
            arg_2 = arg_2[Mtcpfns.TCP_MAX_PACKET:]
        return arg_0.conn.send(arg_2)

This method the debugger uses to write . In contrast to writeline no newline is added to the end to str . Also msg doesn t have to be a string .


def
Func
(
arg_0
)
:
if
not
arg_0
.
aliases
:
return
arg_1
=
[
]
arg_2
=
{
}
for
arg_3
in
arg_0
.
classes
:
for
arg_4
in
arg_3
.
mro
(
)
[
:
3
]
:
arg_2
[
arg_4
.
__name__
]
=
arg_4
for
arg_6
,
arg_7
in
arg_0
.
aliases
.
iteritems
(
)
:
arg_8
,
arg_9
=
arg_7
.
split
(
'.'
,
1
)
arg_3
=
arg_2
[
arg_8
]
arg_10
=
arg_3
.
class_traits
(
config
=
True
)
[
arg_9
]
arg_11
=
arg_3
.
class_get_trait_help
(
arg_10
)
.
splitlines
(
)
arg_11
[
0
]
=
arg_11
[
0
]
.
replace
(
arg_7
,
arg_6
)
+
' (%s)'
%
arg_7
if
len
(
arg_6
)
==
1
:
arg_11
[
0
]
=
arg_11
[
0
]
.
replace
(
'--%s='
%
arg_6
,
'-%s '
%
arg_6
)
arg_1
.
extend
(
arg_11
)
print
os
.
linesep
.
join
(
arg_1
)

def Func(arg_0):
        """Print the alias part of the help."""
        if not arg_0.aliases:
            return

        arg_1 = []
        arg_2 = {}
        for arg_3 in arg_0.classes:
            # include all parents (up to, but excluding Configurable) in available names
            for arg_4 in arg_3.mro()[:-3]:
                arg_2[arg_4.__name__] = arg_4

        for arg_6, arg_7 in arg_0.aliases.iteritems():
            arg_8, arg_9 = arg_7.split('.',1)
            arg_3 = arg_2[arg_8]

            arg_10 = arg_3.class_traits(config=True)[arg_9]
            arg_11 = arg_3.class_get_trait_help(arg_10).splitlines()
            # reformat first line
            arg_11[0] = arg_11[0].replace(arg_7, arg_6) + ' (%s)'%arg_7
            if len(arg_6) == 1:
                arg_11[0] = arg_11[0].replace('--%s='%arg_6, '-%s '%arg_6)
            arg_1.extend(arg_11)
        # lines.append('')
        print os.linesep.join(arg_1)


(self, path, query=None, get_all_pages=True, side_loading=False)

def Func(arg_0, arg_1, arg_2=None, arg_3=True, arg_4=False):
        """
        Call Zendesk API and return results

        :param path: The Zendesk API to Func
        :param query: Query parameters
        :param get_all_pages: Accumulate results over all pages before
               returning. Due to strict rate limiting, this can often timeout.
               Waits for recommended period between tries after a timeout.
        :param side_loading: Retrieve related records as part of a single
               request. In order to enable side-loading, add an 'include'
               query parameter containing a comma-separated list of resources
               to load. For more information on side-loading see
               https://developer.zendesk.com/rest_api/docs/core/side_loading
        """
        arg_5 = arg_0.get_conn()
        arg_6 = False

        while not arg_6:
            try:
                arg_7 = arg_5.Func(arg_1, arg_2)
                arg_6 = True
            except RateLimitError as rle:
                arg_0.__handle_rate_limit_exception(rle)

        # Find the key with the results
        arg_8 = [arg_1.split("/")[-1].split(".json")[0]]
        arg_9 = arg_7['next_page']
        if arg_4:
            arg_8 += arg_2['include'].split(',')
        arg_7 = {arg_12: arg_7[arg_12] for arg_12 in arg_8}

        if arg_3:
            while arg_9 is not None:
                try:
                    # Need to split because the next page URL has
                    # `github.zendesk...`
                    # in it, but the Func function needs it removed.
                    arg_10 = arg_9.split(arg_0.__url)[1]
                    arg_0.log.info("Calling %s", arg_10)
                    arg_11 = arg_5.Func(arg_10)
                    for arg_12 in arg_7:
                        arg_7[arg_12].extend(arg_11[arg_12])
                    if arg_9 == arg_11['next_page']:
                        # Unfortunately zdesk doesn't always throw ZendeskError
                        # when we are done getting all the data. Sometimes the
                        # next just refers to the current set of results.
                        # Hence, need to deal with this special case
                        break
                    else:
                        arg_9 = arg_11['next_page']
                except RateLimitError as rle:
                    arg_0.__handle_rate_limit_exception(rle)
                except ZendeskError as ze:
                    if b"Use a start_time older than 5 minutes" in ze.msg:
                        # We have pretty up to date data
                        break
                    else:
                        raise ze

        return arg_7

Call Zendesk API and return results

        :param path: The Zendesk API to call
        :param query: Query parameters
        :param get_all_pages: Accumulate results over all pages before
               returning. Due to strict rate limiting, this can often timeout.
               Waits for recommended period between tries after a timeout.
        :param side_loading: Retrieve related records as part of a single
               request. In order to enable side-loading, add an 'include'
               query parameter containing a comma-separated list of resources
               to load. For more information on side-loading see
               https://developer.zendesk.com/rest_api/docs/core/side_loading


(port, dsmr_version, telegram_callback, loop=None)

def Func(arg_0, arg_1, arg_2, arg_3=None):
    """Creates a DSMR asyncio protocol coroutine using serial port."""
    arg_4, arg_5 = create_dsmr_protocol(
        arg_1, arg_2, arg_3=None)
    arg_5['url'] = arg_0

    arg_6 = create_serial_connection(arg_3, arg_4, **arg_5)
    return arg_6

Creates a DSMR asyncio protocol coroutine using serial port .


def Func(arg_0, arg_1):
    """
    Destroys a synapse.

    :param synapse: (:class:`Synapse`) synapse to destroy
    """

    arg_0._numSynapses -= 1

    arg_0._removeSynapseFromPresynapticMap(arg_1)

    arg_1.segment._synapses.remove(arg_1)


return self.select(
            "SELECT {0} FROM " + self.table + " WHERE " + self.pk + " = {1};",
            self.columns, pk)

def
Func
(
arg_0
,
arg_1
)
:
if
type
(
arg_1
)
==
str
:
try
:
arg_1
=
int
(
arg_1
)
except
ValueError
:
pass
return
arg_0
.
select
(
"SELECT {0} FROM "
+
arg_0
.
table
+
" WHERE "
+
arg_0
.
pk
+
" = {1};"
,
arg_0
.
columns
,
arg_1
)

def Func(arg_0, arg_1):
        """
        Retreive a single record from the table.  Lots of reasons this might be
        best implemented in the model

        :pk:            The primary key ID for the record
        :returns:       List of single result
        """

        if type(arg_1) == str:
            # Probably an int, give it a shot
            try:
                arg_1 = int(arg_1)
            except ValueError: pass

        return arg_0.select(
            "SELECT {0} FROM " + arg_0.table + " WHERE " + arg_0.pk + " = {1};",
            arg_0.columns, arg_1)

Retreive a single record from the table . Lots of reasons this might be best implemented in the model


return np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0))

def Func ( arg_0 , arg_1 ) : arg_2 = np . linalg . norm ( arg_0 ) arg_3 = np . linalg . norm ( arg_1 ) arg_4 = ( arg_0 / arg_2 ) if arg_2 > 0 else np . float32 ( arg_0 ) * 0 arg_5 = ( arg_1 / arg_3 ) if arg_3 > 0 else np . float32 ( arg_1 ) * 0 return np . arccos ( np . clip ( np . dot ( arg_4 , arg_5 ) , - 1.0 , 1.0 ) )

def Func(arg_0, arg_1):
    """
    Returns the angle in radians between vectors `v1` and `v2`.

    From http://stackoverflow.com/questions/2827393/angles-between-two-n-dimensional-vectors-in-python

    Parameters
    ----------
    v1 : (N,) ndarray
        First vector.

    v2 : (N,) ndarray
        Second vector.

    Returns
    -------
    out : float
        Angle in radians.

    Examples
    --------
    >>> Func(np.float32([1, 0, 0]), np.float32([0, 1, 0]))
    1.570796...

    >>> Func(np.float32([1, 0, 0]), np.float32([1, 0, 0]))
    0.0

    >>> Func(np.float32([1, 0, 0]), np.float32([-1, 0, 0]))
    3.141592...

    """
    arg_2 = np.linalg.norm(arg_0)
    arg_3 = np.linalg.norm(arg_1)
    arg_4 = (arg_0 / arg_2) if arg_2 > 0 else np.float32(arg_0) * 0
    arg_5 = (arg_1 / arg_3) if arg_3 > 0 else np.float32(arg_1) * 0
    return np.arccos(np.clip(np.dot(arg_4, arg_5), -1.0, 1.0))

Returns the angle in radians between vectors `v1` and `v2`.

    From http://stackoverflow.com/questions/2827393/angles-between-two-n-dimensional-vectors-in-python

    Parameters
    ----------
    v1 : (N,) ndarray
        First vector.

    v2 : (N,) ndarray
        Second vector.

    Returns
    -------
    out : float
        Angle in radians.

    Examples
    --------
    >>> angle_between_vectors(np.float32([1, 0, 0]), np.float32([0, 1, 0]))
    1.570796...

    >>> angle_between_vectors(np.float32([1, 0, 0]), np.float32([1, 0, 0]))
    0.0

    >>> angle_between_vectors(np.float32([1, 0, 0]), np.float32([-1, 0, 0]))
    3.141592...

Returns the angle in radians between vectors v1 and v2 .


(self, key, value, attrs=None, format=None, append=False, **kwargs)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = None , arg_4 = None , arg_5 = False , ** arg_6 ) : if not isinstance ( arg_2 , np . ndarray ) : super ( NumpyHDFStore , arg_0 ) . Func ( arg_1 , arg_2 , arg_4 , arg_5 , ** arg_6 ) else : arg_7 = arg_0 . get_node ( arg_1 ) if arg_7 is not None and not arg_5 : arg_0 . _handle . removeNode ( arg_7 , recursive = True ) arg_7 = None if arg_7 is None : arg_8 = arg_1 . split ( '/' ) arg_9 = '/' for arg_10 in arg_8 : if not len ( arg_10 ) : continue arg_11 = arg_9 if not arg_9 . endswith ( '/' ) : arg_11 += '/' arg_11 += arg_10 arg_7 = arg_0 . get_node ( arg_11 ) if arg_7 is None : arg_7 = arg_0 . _handle . createGroup ( arg_9 , arg_10 ) arg_9 = arg_11 arg_12 = arg_6 . get ( 'ds_name' , arg_0 . _array_dsname ) arg_13 = arg_0 . _handle . createArray ( arg_7 , arg_12 , arg_2 ) if arg_3 is not None : for arg_1 in arg_3 : setattr ( arg_13 . attrs , arg_1 , arg_3 [ arg_1 ] ) arg_0 . _handle . flush ( ) return arg_13

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=False, **arg_6):
        """
        Store object in HDFStore

        Parameters
        ----------
        key : str

        value : {Series, DataFrame, Panel, Numpy ndarray}

        format : 'fixed(f)|table(t)', default is 'fixed'
            fixed(f) : Fixed format
                Fast writing/reading. Not-appendable, nor searchable

            table(t) : Table format
                Write as a PyTables Table structure which may perform worse but allow more flexible operations
                like searching/selecting subsets of the data

        append : boolean, default False
            This will force Table format, append the inFunc data to the
            existing.

        encoding : default None, provide an encoding for strings
        """
        if not isinstance(arg_2, np.ndarray):
            super(NumpyHDFStore, arg_0).Func(arg_1, arg_2, arg_4, arg_5, **arg_6)
        else:
            arg_7 = arg_0.get_node(arg_1)

            # remove the node if we are not appending
            if arg_7 is not None and not arg_5:
                arg_0._handle.removeNode(arg_7, recursive=True)
                arg_7 = None

            if arg_7 is None:
                arg_8 = arg_1.split('/')

                # recursively create the groups
                arg_9 = '/'
                for arg_10 in arg_8:
                    if not len(arg_10):
                        continue
                    arg_11 = arg_9
                    if not arg_9.endswith('/'):
                        arg_11 += '/'
                    arg_11 += arg_10
                    arg_7 = arg_0.get_node(arg_11)
                    if arg_7 is None:
                        arg_7 = arg_0._handle.createGroup(arg_9, arg_10)
                    arg_9 = arg_11

            arg_12 = arg_6.get('ds_name', arg_0._array_dsname)

            arg_13 = arg_0._handle.createArray(arg_7, arg_12, arg_2)
            if arg_3 is not None:
                for arg_1 in arg_3:
                    setattr(arg_13.attrs, arg_1, arg_3[arg_1])

            arg_0._handle.flush()

            return arg_13

Store object in HDFStore

        Parameters
        ----------
        key : str

        value : {Series, DataFrame, Panel, Numpy ndarray}

        format : 'fixed(f)|table(t)', default is 'fixed'
            fixed(f) : Fixed format
                Fast writing/reading. Not-appendable, nor searchable

            table(t) : Table format
                Write as a PyTables Table structure which may perform worse but allow more flexible operations
                like searching/selecting subsets of the data

        append : boolean, default False
            This will force Table format, append the input data to the
            existing.

        encoding : default None, provide an encoding for strings


def Func(arg_0, arg_1=True):
        """
        Assess the width of the probability distribution. This returns
        full-width-half-max
        """

        if isinstance(arg_0, interp1d):

            if arg_1:
                arg_2 = arg_0.y.min()
                arg_3 = arg_0.y-arg_2
            else:
                arg_3 = -np.log(arg_0.y)
                arg_3 -= arg_3.min()

            arg_4 = arg_0.x

        elif isinstance(arg_0, Distribution):
            # Distribution always stores neg log-prob with the peak value subtracted
            arg_4 = arg_0._func.x
            arg_3 = arg_0._func.y
        else:
            raise TypeError("Error in computing the FWHM for the distribution. "
                " The input should be either Distribution or interpolation object");

        arg_5 = arg_4.shape[0]
        # 0.69... is log(2), there is always one value for which this is true since
        # the minimum is subtracted
        arg_6 = np.where(arg_3 < 0.693147)[0]
        arg_7, arg_8 = arg_6[0], arg_6[-1]
        if arg_5 < 2:
            print ("Not enough points to compute FWHM: returning zero")
            return min(TINY_NUMBER, arg_0.xmax - arg_0.xmin)
        else:
            # need to guard against out-of-bounds errors
            return max(TINY_NUMBER, arg_4[min(arg_8+1,arg_5-1)] - arg_4[max(0,arg_7-1)])

Assess the width of the probability distribution . This returns full - width - half - max


def Func ( ) : arg_0 = H2OConfigReader . _get_instance ( ) if not arg_0 . _config_loaded : arg_0 . _read_config ( ) return arg_0 . _config

def Func():
        """Retrieve the config as a dictionary of key-value pairs."""
        arg_0 = H2OConfigReader._get_instance()
        if not arg_0._config_loaded:
            arg_0._read_config()
        return arg_0._config

Retrieve the config as a dictionary of key - value pairs .


def Func(arg_0):
        """
        Get the public key of the certificate.

        :return: The public key.
        :rtype: :py:class:`PKey`
        """
        arg_1 = PKey.__new__(PKey)
        arg_1._pkey = _lib.X509_Func(arg_0._x509)
        if arg_1._pkey == _ffi.NULL:
            _raise_current_error()
        arg_1._pkey = _ffi.gc(arg_1._pkey, _lib.EVP_PKEY_free)
        arg_1._only_public = True
        return arg_1


def Func(arg_0, arg_1: arg_2) -> str:
        """Return the text Func of the node"""
        arg_3 = id(arg_1)
        arg_4 = arg_0.id_cache
        if arg_3 not in arg_4:
            return ""
        arg_5 = arg_4[arg_3]
        arg_6 = arg_0.tag_cache
        if arg_5 not in arg_6:
            raise Exception("Incoherent tag cache")
        arg_7 = arg_6[arg_5]
        arg_8 = "%d:%d" % (arg_7._begin, arg_7._end)
        arg_9 = arg_0._streams[-1].Func_cache
        if arg_8 not in arg_9:
            arg_9[arg_8] = str(arg_7)
        return arg_9[arg_8]


def Func ( arg_0 ) : arg_1 = arg_0 . selectedType ( ) arg_2 = arg_0 . logList . get ( arg_1 ) [ 0 ] arg_3 = arg_0 . logList . get ( arg_1 ) [ 1 ] if arg_1 in arg_0 . logList : arg_0 . programName . clear ( ) arg_0 . programName . addItems ( arg_2 ) arg_0 . programName . setCurrentIndex ( arg_2 . index ( arg_3 ) )

def Func(arg_0):
        '''Populate log program list to correspond with log type selection.'''
        arg_1 = arg_0.selectedType()
        arg_2 = arg_0.logList.get(arg_1)[0]
        arg_3 = arg_0.logList.get(arg_1)[1]
        if arg_1 in arg_0.logList:
            arg_0.programName.clear()
            arg_0.programName.addItems(arg_2)
            arg_0.programName.setCurrentIndex(arg_2.index(arg_3))

Populate log program list to correspond with log type selection .


def Func(arg_0, **arg_1):
        """
        Generate a session id for user based authentication.

        A session id is required in order to use any of the write methods.

        Args:
            request_token: The token you generated for the user to approve.
                           The token needs to be approved before being
                           used here.

        Returns:
            A dict respresentation of the JSON returned from the API.
        """
        arg_2 = arg_0._get_path('Func')

        arg_3 = arg_0._GET(arg_2, arg_1)
        arg_0._set_attrs_to_values(arg_3)
        return arg_3

Generate a session id for user based authentication .


def Func(arg_0, arg_1=None, arg_2=None):
    """
    Initializes the log file in the proper format.

    Arguments:

        filename (str): Path to a file. Or None if logging is to
                         be disabled.
        loglevel (str): Determines the level of the log output.
    """
    arg_3 = '[%(asctime)s] %(levelname)-8s: %(name)-25s: %(message)s'
    arg_4 = logging.Formatter(arg_3)

    if arg_2:
        arg_0.setLevel(getattr(logging, arg_2))

    # We will always print warnings and higher to stderr
    arg_5 = logging.StreamHandler()
    arg_5.setLevel('WARNING')
    arg_5.setFormatter(arg_4)

    if arg_1:
        arg_6 = logging.FileHandler(arg_1, encoding='utf-8')
        if arg_2:
            arg_6.setLevel(getattr(logging, arg_2))
        arg_6.setFormatter(arg_4)
        arg_0.addHandler(arg_6)
    # If no logfile is provided we print all log messages that the user has
    # defined to stderr
    else:
        if arg_2:
            arg_5.setLevel(getattr(logging, arg_2))

    arg_0.addHandler(arg_5)

Initializes the log file in the proper format .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 . size arg_3 , arg_4 = { 8 : ( 'AL' , 'AH' ) , 16 : ( 'AX' , 'DX' ) , 32 : ( 'EAX' , 'EDX' ) , 64 : ( 'RAX' , 'RDX' ) } [ arg_2 ] arg_5 = ( Operators . ZEXTEND ( arg_0 . read_register ( arg_3 ) , 256 ) * Operators . ZEXTEND ( arg_1 . read ( ) , 256 ) ) arg_0 . write_register ( arg_3 , Operators . EXTRACT ( arg_5 , 0 , arg_2 ) ) arg_0 . write_register ( arg_4 , Operators . EXTRACT ( arg_5 , arg_2 , arg_2 ) ) arg_0 . OF = Operators . EXTRACT ( arg_5 , arg_2 , arg_2 ) != 0 arg_0 . CF = arg_0 . OF

def Func(arg_0, arg_1):
        """
        Unsigned multiply.

        Performs an unsigned multiplication of the first operand (destination
        operand) and the second operand (source operand) and stores the result
        in the destination operand. The destination operand is an implied operand
        located in register AL, AX or EAX (depending on the size of the operand);
        the source operand is located in a general-purpose register or a memory location.

        The result is stored in register AX, register pair DX:AX, or register
        pair EDX:EAX (depending on the operand size), with the high-order bits
        of the product contained in register AH, DX, or EDX, respectively. If
        the high-order bits of the product are 0, the CF and OF flags are cleared;
        otherwise, the flags are set::

                IF byte operation
                THEN
                    AX  =  AL * SRC
                ELSE (* word or doubleword operation *)
                    IF OperandSize  =  16
                    THEN
                        DX:AX  =  AX * SRC
                    ELSE (* OperandSize  =  32 *)
                        EDX:EAX  =  EAX * SRC
                    FI;
                FI;

        :param cpu: current CPU.
        :param src: source operand.
        """
        arg_2 = arg_1.size
        arg_3, arg_4 = {8: ('AL', 'AH'),
                                       16: ('AX', 'DX'),
                                       32: ('EAX', 'EDX'),
                                       64: ('RAX', 'RDX')}[arg_2]
        arg_5 = (Operators.ZEXTEND(arg_0.read_register(arg_3), 256) *
               Operators.ZEXTEND(arg_1.read(), 256))
        arg_0.write_register(arg_3, Operators.EXTRACT(arg_5, 0, arg_2))
        arg_0.write_register(arg_4, Operators.EXTRACT(arg_5, arg_2, arg_2))
        arg_0.OF = Operators.EXTRACT(arg_5, arg_2, arg_2) != 0
        arg_0.CF = arg_0.OF


async def Func(arg_0):
        """
        Waits until the job set is finished. Returns immediately if the job set
        is already finished.
        """

        if arg_0._active_jobs > 0:
            arg_1 = arg_0._loop.create_future()
            arg_0._waiters.append(arg_1)
            await arg_1

Waits until the job set is finished . Returns immediately if the job set is already finished .


def
Func
(
arg_0
,
arg_1
=
True
)
:
from
.
html_utils
import
MathMLParser
arg_2
=
etree
.
tostring
(
arg_0
,
xml_declaration
=
False
)
arg_2
=
re
.
sub
(
"(<)(([\/]?{0}))"
.
format
(
"|[\/]?"
.
join
(
MathMLParser
.
mathml_elements
)
)
,
'<\g<2>'
,
arg_2
)
arg_2
=
re
.
sub
(
">"
,
'>'
,
arg_2
)
if
arg_1
:
arg_2
=
arg_2
.
replace
(
'</datafield>'
,
'  </datafield>\n'
)
arg_2
=
re
.
sub
(
r'<datafield(.*?)>'
,
r'  <datafield\1>\n'
,
arg_2
)
arg_2
=
arg_2
.
replace
(
'</subfield>'
,
'</subfield>\n'
)
arg_2
=
arg_2
.
replace
(
'<subfield'
,
'    <subfield'
)
arg_2
=
arg_2
.
replace
(
'record>'
,
'record>\n'
)
return
arg_2

def Func(arg_0, arg_1=True):
    """Given a document, return XML prettified."""
    from .html_utils import MathMLParser
    arg_2 = etree.tostring(arg_0, xml_declaration=False)

    # Special MathML handling
    arg_2 = re.sub("(<)(([\/]?{0}))".format("|[\/]?".join(MathMLParser.mathml_elements)), '<\g<2>', arg_2)
    arg_2 = re.sub(">", '>', arg_2)
    if arg_1:
        # We are doing our own prettyfication as etree pretty_print is too insane.
        arg_2 = arg_2.replace('</datafield>', '  </datafield>\n')
        arg_2 = re.sub(r'<datafield(.*?)>', r'  <datafield\1>\n', arg_2)
        arg_2 = arg_2.replace('</subfield>', '</subfield>\n')
        arg_2 = arg_2.replace('<subfield', '    <subfield')
        arg_2 = arg_2.replace('record>', 'record>\n')
    return arg_2

Given a document return XML prettified .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
False
)
:
plt
.
figure
(
1
,
figsize
=
(
10
,
7
)
)
plt
.
figure
(
2
,
figsize
=
(
10
,
7
)
)
arg_4
=
sorted
(
arg_1
)
plt
.
figure
(
1
)
plt
.
subplot
(
211
)
plt
.
grid
(
)
plt
.
title
(
"chronological variance"
)
plt
.
ylabel
(
"original data"
)
plot_shaded_data
(
X
,
arg_0
,
arg_1
,
arg_2
)
plt
.
margins
(
0
,
.1
)
plt
.
subplot
(
212
)
plt
.
ylabel
(
"variance (pA) (log%s)"
%
str
(
arg_3
)
)
plt
.
xlabel
(
"time in sweep (sec)"
)
plt
.
plot
(
arg_2
,
arg_1
,
'k-'
,
lw
=
2
)
plt
.
figure
(
2
)
plt
.
ylabel
(
"variance (pA) (log%s)"
%
str
(
arg_3
)
)
plt
.
xlabel
(
"chunk number"
)
plt
.
title
(
"sorted variance"
)
plt
.
plot
(
arg_4
,
'k-'
,
lw
=
2
)
for
arg_5
in
range
(
0
,
100
,
PERCENT_STEP
)
:
arg_6
=
np
.
percentile
(
arg_1
,
arg_5
)
arg_7
=
np
.
percentile
(
arg_1
,
arg_5
+
PERCENT_STEP
)
arg_8
=
"%2d-%d percentile"
%
(
arg_5
,
arg_5
+
+
PERCENT_STEP
)
arg_9
=
COLORMAP
(
arg_5
/
100
)
print
(
"%s: variance = %.02f - %.02f"
%
(
arg_8
,
arg_6
,
arg_7
)
)
plt
.
figure
(
1
)
plt
.
axhspan
(
arg_6
,
arg_7
,
alpha
=
.5
,
lw
=
0
,
arg_9
=
arg_9
,
arg_8
=
arg_8
)
plt
.
figure
(
2
)
arg_10
=
np
.
where
(
arg_4
>=
arg_6
)
[
0
]
[
0
]
arg_11
=
np
.
where
(
arg_4
>=
arg_7
)
[
0
]
[
0
]
plt
.
axvspan
(
arg_10
,
arg_11
,
alpha
=
.5
,
lw
=
0
,
arg_9
=
arg_9
,
arg_8
=
arg_8
)
for
arg_12
in
[
1
,
2
]
:
plt
.
figure
(
arg_12
)
if
arg_3
:
plt
.
semilogy
(
)
plt
.
margins
(
0
,
0
)
plt
.
grid
(
)
if
arg_12
is
2
:
plt
.
legend
(
fontsize
=
10
,
loc
=
'upper left'
,
shadow
=
True
)
plt
.
tight_layout
(
)
plt
.
savefig
(
'2016-12-15-variance-%d-log%s.png'
%
(
arg_12
,
str
(
arg_3
)
)
)
plt
.
show
(
)

def Func(arg_0,arg_1,arg_2,arg_3=False):
    """create some fancy graphs to show color-coded variances."""

    plt.figure(1,figsize=(10,7))
    plt.figure(2,figsize=(10,7))
    arg_4=sorted(arg_1)

    plt.figure(1)
    plt.subplot(211)
    plt.grid()
    plt.title("chronological variance")
    plt.ylabel("original data")
    plot_shaded_data(X,arg_0,arg_1,arg_2)
    plt.margins(0,.1)
    plt.subplot(212)
    plt.ylabel("variance (pA) (log%s)"%str(arg_3))
    plt.xlabel("time in sweep (sec)")
    plt.plot(arg_2,arg_1,'k-',lw=2)

    plt.figure(2)
    plt.ylabel("variance (pA) (log%s)"%str(arg_3))
    plt.xlabel("chunk number")
    plt.title("sorted variance")
    plt.plot(arg_4,'k-',lw=2)

    for arg_5 in range(0,100,PERCENT_STEP):
        arg_6=np.percentile(arg_1,arg_5)
        arg_7=np.percentile(arg_1,arg_5+PERCENT_STEP)
        arg_8="%2d-%d percentile"%(arg_5,arg_5++PERCENT_STEP)
        arg_9=COLORMAP(arg_5/100)
        print("%s: variance = %.02f - %.02f"%(arg_8,arg_6,arg_7))
        plt.figure(1)
        plt.axhspan(arg_6,arg_7,alpha=.5,lw=0,arg_9=arg_9,arg_8=arg_8)
        plt.figure(2)
        arg_10=np.where(arg_4>=arg_6)[0][0]
        arg_11=np.where(arg_4>=arg_7)[0][0]
        plt.axvspan(arg_10,arg_11,alpha=.5,lw=0,arg_9=arg_9,arg_8=arg_8)

    for arg_12 in [1,2]:
        plt.figure(arg_12)
        if arg_3:
            plt.semilogy()
        plt.margins(0,0)
        plt.grid()
        if arg_12 is 2:
            plt.legend(fontsize=10,loc='upper left',shadow=True)
        plt.tight_layout()
        plt.savefig('2016-12-15-variance-%d-log%s.png'%(arg_12,str(arg_3)))
    plt.show()

doc/uses/EPSCs-and-IPSCs/variance method/2016-12-15 noise sample.py

create some fancy graphs to show color - coded variances .


def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
rfile
.
read
(
int
(
arg_0
.
headers
[
'Content-Length'
]
)
)
arg_2
=
gzip
.
decompress
(
arg_1
)
arg_0
.
_profile_json
.
update
(
json
.
loads
(
arg_2
.
decode
(
'utf-8'
)
)
)
arg_0
.
_send_response
(
200
,
headers
=
(
(
'Content-type'
,
'%s; charset=utf-8'
%
'text/json'
)
,
(
'Content-Encoding'
,
'gzip'
)
,
(
'Content-Length'
,
len
(
arg_1
)
)
)
)

def Func(arg_0):
        """Handles HTTP POST requests."""
        arg_1 = arg_0.rfile.read(int(arg_0.headers['Content-Length']))
        arg_2 = gzip.decompress(arg_1)
        arg_0._profile_json.update(json.loads(arg_2.decode('utf-8')))
        arg_0._send_response(
            200, headers=(('Content-type', '%s; charset=utf-8' % 'text/json'),
                          ('Content-Encoding', 'gzip'),
                          ('Content-Length', len(arg_1))))


def Func(arg_0):
        """Compute the hash value of a set.

        Note that we don't define _Func__: not all sets are hashable.
        But if you define a hashable set type, its _Func__ should
        call this function.

        This must be compatible __eq__.

        All sets ought to compare equal if they contain the same
        elements, regardless of how they are implemented, and
        regardless of the order of the elements; so there's not much
        freedom for __eq__ or _Func__.  We match the algorithm used
        by the built-in frozenset type.
        """
        arg_1 = sys.maxint
        arg_2 = 2 * arg_1 + 1
        arg_3 = len(arg_0)
        arg_4 = 1927868237 * (arg_3 + 1)
        arg_4 &= arg_2
        for arg_5 in arg_0:
            arg_6 = hash(arg_5)
            arg_4 ^= (arg_6 ^ (arg_6 << 16) ^ 89869747)  * 3644798167
            arg_4 &= arg_2
        arg_4 = arg_4 * 69069 + 907133923
        arg_4 &= arg_2
        if arg_4 > arg_1:
            arg_4 -= arg_2 + 1
        if arg_4 == -1:
            arg_4 = 590923713
        return arg_4

Compute the hash value of a set.

        Note that we don't define __hash__: not all sets are hashable.
        But if you define a hashable set type, its __hash__ should
        call this function.

        This must be compatible __eq__.

        All sets ought to compare equal if they contain the same
        elements, regardless of how they are implemented, and
        regardless of the order of the elements; so there's not much
        freedom for __eq__ or __hash__.  We match the algorithm used
        by the built-in frozenset type.


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , Token ) : arg_2 = arg_1 . split_contents ( ) else : arg_2 = arg_1 arg_3 = None if len ( arg_2 ) > 2 and arg_2 [ - 2 ] == 'as' : arg_2 = arg_2 [ : ] arg_3 = arg_2 . pop ( ) arg_2 . pop ( ) return arg_2 , arg_3

def Func(arg_0, arg_1):
    """
    Parse the remainder of the token, to find a "as varname" statement.

    :param parser: The "parser" object that ``@register.tag`` provides.
    :type parser: :class:`~django.template.Parser`
    :param token: The "token" object that ``@register.tag`` provides.
    :type token: :class:`~django.template.Token` or splitted bits
    """
    if isinstance(arg_1, Token):
        arg_2 = arg_1.split_contents()
    else:
        arg_2 = arg_1

    arg_3 = None
    if len(arg_2) > 2 and arg_2[-2] == 'as':
        arg_2 = arg_2[:]
        arg_3 = arg_2.pop()
        arg_2.pop()  # as keyword

    return arg_2, arg_3

Parse the remainder of the token to find a as varname statement .


def Func ( arg_0 , arg_1 ) : from xml . etree import ElementTree from re import sub arg_2 = ElementTree . tostring ( arg_1 , 'utf-8' ) arg_3 = sub ( r'(?=<[^/].*>)' , '\n' , arg_2 ) return arg_3 [ 1 : ]

def Func(arg_0, arg_1):
        """Parse xml elements for pretty printing"""

        from xml.etree import ElementTree
        from re import sub

        arg_2 = ElementTree.tostring(arg_1, 'utf-8')
        arg_3 = sub(r'(?=<[^/].*>)', '\n', arg_2)  # Adds newline after each closing tag

        return arg_3[1:]


def Func(arg_0=True, arg_1=False):
    '''Load the CIFAR10 image dataset.'''
    def extract(arg_2):
        print('extracting data from {}'.format(arg_2))
        arg_3 = arg_9.extractfile(arg_2)
        if sys.version_info < (3, ):
            arg_4 = pickle.load(arg_3)
        else:
            arg_4 = pickle.load(arg_3, encoding='bytes')
            for arg_5 in list(arg_4):
                arg_4[arg_5.decode('utf8')] = arg_4[arg_5]
        arg_3.close()
        arg_7 = arg_4['data'].reshape(
            (-1, 3, 32, 32)).transpose((0, 2, 3, 1)).astype('f') / 128 - 1
        if arg_0:
            arg_7 = arg_7.reshape((-1, 32 * 32 * 3))
        arg_4['data'] = arg_7
        return arg_4

    arg_8 = find('cifar10.tar.gz', 'http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz')
    arg_9 = tarfile.open(arg_8)

    arg_10 = []
    arg_11 = []
    for arg_12 in range(1, 6):
        arg_4 = extract('cifar-10-batches-py/data_batch_{}'.format(arg_12))
        arg_10.extend(arg_4['data'])
        arg_11.extend(arg_4['labels'])
    arg_13 = np.asarray(arg_10[:40000])
    arg_14 = np.asarray(arg_11[:40000], 'i')
    arg_15 = np.asarray(arg_10[40000:])
    arg_16 = np.asarray(arg_11[40000:], 'i')

    arg_4 = extract('cifar-10-batches-py/test_batch')
    arg_17 = arg_4['data']
    arg_18 = arg_4['labels']

    arg_9.close()

    if arg_1:
        return (arg_13, arg_14), (arg_15, arg_16), (arg_17, arg_18)
    return (arg_13, ), (arg_15, ), (arg_17, )


(graph: BELGraph, node: BaseEntity, key: Optional[str] = None)

def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_5[arg_6] = None) -> arg_1:
    """Generate a mechanistic sub-graph upstream of the given node.

    :param graph: A BEL graph
    :param node: A BEL node
    :param key: The key in the node data dictionary representing the experimental data.
    :return: A sub-graph grown around the target BEL node
    """
    arg_7 = get_upstream_causal_subgraph(arg_0, arg_2)
    expand_upstream_causal(arg_0, arg_7)
    remove_inconsistent_edges(arg_7)
    collapse_consistent_edges(arg_7)

    if arg_4 is not None:  # FIXME when is it not pruned?
        prune_mechanism_by_data(arg_7, arg_4)

    return arg_7

Generate a mechanistic sub - graph upstream of the given node .


def Func ( arg_0 , arg_1 ) : arg_2 , arg_1 = arg_0 . session . feed_identities ( arg_1 ) arg_3 = arg_0 . session . unserialize ( arg_1 ) try : arg_3 [ 'header' ] . pop ( 'date' ) except KeyError : pass try : arg_3 [ 'parent_header' ] . pop ( 'date' ) except KeyError : pass arg_3 . pop ( 'buffers' ) return jsonapi . dumps ( arg_3 , default = date_default )

def Func(arg_0, arg_1):
        """Reserialize a reply message using JSON.

        This takes the msg list from the ZMQ socket, unserializes it using
        self.session and then serializes the result using JSON. This method
        should be used by self._on_zmq_reply to build messages that can
        be sent back to the browser.
        """
        arg_2, arg_1 = arg_0.session.feed_identities(arg_1)
        arg_3 = arg_0.session.unserialize(arg_1)
        try:
            arg_3['header'].pop('date')
        except KeyError:
            pass
        try:
            arg_3['parent_header'].pop('date')
        except KeyError:
            pass
        arg_3.pop('buffers')
        return jsonapi.dumps(arg_3, default=date_default)

Reserialize a reply message using JSON .


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
:
arg_2
=
[
"gunzip"
,
"-c"
,
arg_0
]
else
:
arg_2
=
[
"cat"
,
arg_0
]
arg_3
=
[
"wc"
]
arg_4
=
sps
.
Popen
(
arg_2
,
stdout
=
sps
.
PIPE
,
stderr
=
sps
.
PIPE
)
arg_5
=
sps
.
Popen
(
arg_3
,
stdin
=
arg_4
.
stdout
,
stdout
=
sps
.
PIPE
,
stderr
=
sps
.
PIPE
)
arg_6
=
arg_5
.
communicate
(
)
[
0
]
if
arg_5
.
returncode
:
raise
IPyradWarningExit
(
"error zbufcountlines {}:"
.
format
(
arg_6
)
)
LOGGER
.
info
(
arg_6
)
arg_7
=
int
(
arg_6
.
split
(
)
[
0
]
)
return
arg_7

def Func(arg_0, arg_1):
    """ faster line counter """
    if arg_1:
        arg_2 = ["gunzip", "-c", arg_0]
    else:
        arg_2 = ["cat", arg_0]
    arg_3 = ["wc"]

    arg_4 = sps.Popen(arg_2, stdout=sps.PIPE, stderr=sps.PIPE)
    arg_5 = sps.Popen(arg_3, stdin=arg_4.stdout, stdout=sps.PIPE, stderr=sps.PIPE)
    arg_6 = arg_5.communicate()[0]
    if arg_5.returncode:
        raise IPyradWarningExit("error zbufcountlines {}:".format(arg_6))
    LOGGER.info(arg_6)
    arg_7 = int(arg_6.split()[0])
    return arg_7


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : OutstationApplication . process_point_value ( 'Func' , arg_1 , arg_2 , arg_3 ) return opendnp3 . CommandStatus . SUCCESS

def Func(arg_0, arg_1, arg_2, arg_3):
        """
            The Master sent an Func command to the Outstation. Handle it.

        :param command: ControlRelayOutputBlock,
                        AnalogOutputInt16, AnalogOutputInt32, AnalogOutputFloat32, or AnalogOutputDouble64.
        :param index: int
        :param op_type: FuncType
        :return: CommandStatus
        """
        OutstationApplication.process_point_value('Func', arg_1, arg_2, arg_3)
        return opendnp3.CommandStatus.SUCCESS

The Master sent an Operate command to the Outstation. Handle it.

        :param command: ControlRelayOutputBlock,
                        AnalogOutputInt16, AnalogOutputInt32, AnalogOutputFloat32, or AnalogOutputDouble64.
        :param index: int
        :param op_type: OperateType
        :return: CommandStatus

The Master sent an Operate command to the Outstation . Handle it .


return super(Deposit, cls).create(data, id_=id_)

def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_1 . setdefault ( '$schema' , current_jsonschemas . path_to_url ( current_app . config [ 'DEPOSIT_DEFAULT_JSONSCHEMA' ] ) ) if '_deposit' not in arg_1 : arg_2 = arg_2 or uuid . uuid4 ( ) arg_0 . deposit_minter ( arg_2 , arg_1 ) arg_1 [ '_deposit' ] . setdefault ( 'owners' , list ( ) ) if current_user and current_user . is_authenticated : arg_3 = int ( current_user . get_id ( ) ) if arg_3 not in arg_1 [ '_deposit' ] [ 'owners' ] : arg_1 [ '_deposit' ] [ 'owners' ] . append ( arg_3 ) arg_1 [ '_deposit' ] [ 'Funcd_by' ] = arg_3 return super ( Deposit , arg_0 ) . Func ( arg_1 , arg_2 = arg_2 )

def Func(arg_0, arg_1, arg_2=None):
        """Create a deposit.

        Initialize the follow information inside the deposit:

        .. code-block:: python

            deposit['_deposit'] = {
                'id': pid_value,
                'status': 'draft',
                'owners': [user_id],
                'Funcd_by': user_id,
            }

        The deposit index is updated.

        :param data: Input dictionary to fill the deposit.
        :param id_: Default uuid for the deposit.
        :returns: The new Funcd deposit.
        """
        arg_1.setdefault('$schema', current_jsonschemas.path_to_url(
            current_app.config['DEPOSIT_DEFAULT_JSONSCHEMA']
        ))
        if '_deposit' not in arg_1:
            arg_2 = arg_2 or uuid.uuid4()
            arg_0.deposit_minter(arg_2, arg_1)

        arg_1['_deposit'].setdefault('owners', list())
        if current_user and current_user.is_authenticated:
            arg_3 = int(current_user.get_id())

            if arg_3 not in arg_1['_deposit']['owners']:
                arg_1['_deposit']['owners'].append(arg_3)

            arg_1['_deposit']['Funcd_by'] = arg_3

        return super(Deposit, arg_0).Func(arg_1, arg_2=arg_2)

Create a deposit.

        Initialize the follow information inside the deposit:

        .. code-block:: python

            deposit['_deposit'] = {
                'id': pid_value,
                'status': 'draft',
                'owners': [user_id],
                'created_by': user_id,
            }

        The deposit index is updated.

        :param data: Input dictionary to fill the deposit.
        :param id_: Default uuid for the deposit.
        :returns: The new created deposit.


Infer peptides and conduct error-rate estimation in different contexts.

(infile, outfile, context, parametric, pfdr, pi0_lambda, pi0_method, pi0_smooth_df, pi0_smooth_log_pi0, lfdr_truncate, lfdr_monotone, lfdr_transformation, lfdr_adj, lfdr_eps)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9, arg_10, arg_11, arg_12, arg_13):
    """
    Infer Funcs and conduct error-rate estimation in different contexts.
    """

    if arg_1 is None:
        arg_1 = arg_0
    else:
        arg_1 = arg_1

    infer_Funcs(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9, arg_10, arg_11, arg_12, arg_13)

Infer peptides and conduct error - rate estimation in different contexts .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
kube_client
.
create_namespaced_deployment
(
body
=
arg_1
,
namespace
=
arg_0
.
namespace
)
logger
.
debug
(
"Deployment created. status='{0}'"
.
format
(
str
(
arg_2
.
status
)
)
)

def Func(arg_0, arg_1):
        """ Create the kubernetes deployment """

        arg_2 = arg_0.kube_client.create_namespaced_deployment(
            body=arg_1,
            namespace=arg_0.namespace)

        logger.debug("Deployment created. status='{0}'".format(str(arg_2.status)))


def
Func
(
arg_0
,
arg_1
=
)
:
if
arg_1
and
arg_1
<
0
:
raise
ValueError
(
'Time is negative...'
)
if
not
arg_0
.
maxts
:
arg_2
=
[
int
(
''
.
join
(
filter
(
str
.
isdigit
,
a
)
)
)
for
a
in
arg_0
.
timeslots
]
arg_0
.
maxts
=
max
(
arg_2
+
[
1
]
)
+
1
else
:
arg_0
.
maxts
+=
1
arg_4
=
'ts{:d}'
.
format
(
arg_0
.
maxts
)
arg_0
.
timeslots
[
arg_4
]
=
arg_1
return
arg_4

def Func(arg_0, arg_1=None):
        """Generate the next timeslot id, this function is mainly used
        internally

        :param int time: Initial time to assign to the timeslot.
        :raises ValueError: If the time is negative.
        """
        if arg_1 and arg_1 < 0:
            raise ValueError('Time is negative...')
        if not arg_0.maxts:
            arg_2 = [int(''.join(filter(str.isdigit, a)))
                        for a in arg_0.timeslots]
            arg_0.maxts = max(arg_2 + [1])+1
        else:
            arg_0.maxts += 1
        arg_4 = 'ts{:d}'.format(arg_0.maxts)
        arg_0.timeslots[arg_4] = arg_1
        return arg_4

Generate the next timeslot id this function is mainly used internally


def Func ( arg_0 ) : arg_1 = arg_0 . nodelist . find_expired_nodes ( ) if arg_1 : arg_0 . nodelist . remove_expired_nodes ( arg_1 ) arg_0 . nodelist . Func ( )

def Func(arg_0):
        """
        Update the session for this node. Specifically; lock on the reflist,
        then update the time  this node acquired the reference.

        This method should only be called while the reference is locked.
        """
        arg_1 = arg_0.nodelist.find_expired_nodes()
        if arg_1:
            arg_0.nodelist.remove_expired_nodes(arg_1)
        arg_0.nodelist.Func()

Update the session for this node . Specifically ; lock on the reflist then update the time this node acquired the reference .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
True
)
:
arg_3
=
socket
.
getaddrinfo
(
arg_0
,
arg_1
,
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
if
not
arg_3
:
raise
Exception
(
"Could not translate address '%s:%s'"
%
(
arg_0
,
str
(
arg_1
)
)
)
arg_4
=
socket
.
socket
(
arg_3
[
0
]
[
0
]
,
arg_3
[
0
]
[
1
]
,
arg_3
[
0
]
[
2
]
)
if
not
arg_2
:
arg_4
.
setblocking
(
0
)
try
:
arg_4
.
connect
(
arg_3
[
0
]
[
4
]
)
except
socket
.
error
as
e
:
if
e
.
errno
!=
errno
.
EINPROGRESS
:
raise
return
arg_4

def Func(arg_0, arg_1, arg_2=True):
    """Create a TCP connection to the server."""
    arg_3 = socket.getaddrinfo(arg_0, arg_1, socket.AF_INET, socket.SOCK_STREAM)
    if not arg_3:
        raise Exception("Could not translate address '%s:%s'"
                        % (arg_0, str(arg_1)))
    arg_4 = socket.socket(arg_3[0][0], arg_3[0][1], arg_3[0][2])
    if not arg_2:
        arg_4.setblocking(0)
    try:
        arg_4.connect(arg_3[0][4])
    except socket.error as e:
        if e.errno != errno.EINPROGRESS:
            raise
    return arg_4


def Func ( arg_0 , arg_1 , arg_2 ) : try : if arg_2 : if sys . version_info >= ( 3 , 0 ) : arg_0 . process . stdin . write ( bytes ( arg_1 , "utf-8" ) ) else : arg_0 . process . stdin . write ( arg_1 ) arg_0 . _out = arg_0 . process . communicate ( ) [ 0 ] except ( error , IOError ) : arg_0 . _out = arg_0 . _in pass

def Func(arg_0, arg_1, arg_2):
        """
        Try to get output in a separate thread
        """
        try:
            if arg_2:
                if sys.version_info >= (3, 0):
                    arg_0.process.stdin.write(bytes(arg_1, "utf-8"))
                else:
                    arg_0.process.stdin.write(arg_1)
            arg_0._out = arg_0.process.communicate()[0]
        except (error, IOError):
            arg_0._out = arg_0._in
            pass


return Tile.boundingtile(tiles0 + tiles1)

def Func(arg_0, arg_1, arg_2):
        """ Get the amount of support size required for a particular update."""
        arg_3, arg_4 = arg_0._update_type(arg_1)
        if arg_3:
            return arg_0.shape.copy()

        # 1) store the current parameters of interest
        arg_5 = arg_0.get_values(arg_1)
        # 2) calculate the current tileset
        arg_6 = [arg_0._tile(n) for n in arg_4]

        # 3) update to newer parameters and calculate tileset
        arg_0.set_values(arg_1, arg_2)
        arg_7 = [arg_0._tile(n) for n in arg_4]

        # 4) revert parameters & return union of all tiles
        arg_0.set_values(arg_1, arg_5)
        return Tile.boundingtile(arg_6 + arg_7)

Get the amount of support size required for a particular update .


(self, scheme, netloc, path, headers, body=None, method="GET")

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6="GET"):
        """
        Run the actual request
        """
        arg_7 = "{}://{}{}".format(arg_1, arg_2, arg_3)
        try:
            arg_8 = arg_0.http_request.request(arg_7, arg_6=arg_6, arg_5=arg_5, arg_4=dict(arg_4))
            arg_0._return_response(arg_8)
        except Exception as e:
            arg_5 = "Invalid response from backend: '{}' Server might be busy".format(e.message)
            logging.debug(arg_5)
            arg_0.send_error(httplib.SERVICE_UNAVAILABLE, arg_5)


The main function called to handle a request.

def Func ( arg_0 ) : while True : try : arg_1 = arg_0 . rfile . readline ( ) try : arg_2 = json . loads ( arg_1 ) except Exception , exc : arg_0 . wfile . write ( repr ( exc ) + NEWLINE ) continue else : arg_3 = getattr ( arg_0 , 'Func_' + arg_2 [ 0 ] , None ) if not arg_3 : arg_0 . wfile . write ( repr ( CommandNotFound ( arg_2 [ 0 ] ) ) + NEWLINE ) continue arg_4 = arg_3 ( * arg_2 [ 1 : ] ) if not arg_4 : continue arg_0 . wfile . write ( one_lineify ( json . dumps ( arg_4 ) ) + NEWLINE ) except Exception , exc : arg_0 . wfile . write ( repr ( exc ) + NEWLINE ) continue

def Func(arg_0):
        """The main function called to Func a request."""
        while True:
            try:
                arg_1 = arg_0.rfile.readline()
                try:
                    # All input data are lines of JSON like the following:
                    #   ["<cmd_name>" "<cmd_arg1>" "<cmd_arg2>" ...]
                    # So I Func this by dispatching to various methods.
                    arg_2 = json.loads(arg_1)
                except Exception, exc:
                    # Sometimes errors come up. Once again, I can't predict
                    # anything, but can at least tell CouchDB about the error.
                    arg_0.wfile.write(repr(exc) + NEWLINE)
                    continue
                else:
                    # Automagically get the command Funcr.
                    arg_3 = getattr(arg_0, 'Func_' + arg_2[0], None)
                    if not arg_3:
                        # We are ready to not find commands. It probably won't
                        # happen, but fortune favours the prepared.
                        arg_0.wfile.write(
                            repr(CommandNotFound(arg_2[0])) + NEWLINE)
                        continue
                    arg_4 = arg_3(*arg_2[1:])
                    if not arg_4:
                        continue
                    # We write the output back to CouchDB.
                    arg_0.wfile.write(
                        one_lineify(json.dumps(arg_4)) + NEWLINE)
            except Exception, exc:
                arg_0.wfile.write(repr(exc) + NEWLINE)
                continue

The main function called to handle a request .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
out
(
"Creating application version "
+
str
(
arg_1
)
+
" for "
+
str
(
arg_2
)
)
arg_0
.
ebs
.
Func
(
arg_0
.
app_name
,
arg_1
,
s3_bucket
=
arg_0
.
aws
.
bucket
,
s3_key
=
arg_0
.
aws
.
bucket_path
+
arg_2
)

def Func(arg_0, arg_1, arg_2):
        """
        Creates an application version
        """
        out("Creating application version " + str(arg_1) + " for " + str(arg_2))
        arg_0.ebs.Func(arg_0.app_name, arg_1,
                                            s3_bucket=arg_0.aws.bucket, s3_key=arg_0.aws.bucket_path+arg_2)


(field, inds=None, slicer=None, flat=True)

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = True ) : if arg_1 is not None : arg_4 = arg_0 . ravel ( ) [ arg_1 ] elif arg_2 is not None : arg_4 = arg_0 [ arg_2 ] . ravel ( ) else : arg_4 = arg_0 if arg_3 : return arg_4 . ravel ( ) return arg_4

def Func(arg_0, arg_1=None, arg_2=None, arg_3=True):
    """
    Take a Func from a field given flat indices or a shaped slice

    Parameters
    -----------
    inds : list of indices
        One dimensional (raveled) indices to return from the field

    slicer : slice object
        A shaped (3D) slicer that returns a section of image

    flat : boolean
        Whether to flatten the Funcd item before returning
    """
    if arg_1 is not None:
        arg_4 = arg_0.ravel()[arg_1]
    elif arg_2 is not None:
        arg_4 = arg_0[arg_2].ravel()
    else:
        arg_4 = arg_0

    if arg_3:
        return arg_4.ravel()
    return arg_4

Take a sample from a field given flat indices or a shaped slice

    Parameters
    -----------
    inds : list of indices
        One dimensional (raveled) indices to return from the field

    slicer : slice object
        A shaped (3D) slicer that returns a section of image

    flat : boolean
        Whether to flatten the sampled item before returning


def Func ( arg_0 , arg_1 , arg_2 ) : arg_0 . assert_package_exists ( ) if not arg_0 . package_originator_set : arg_0 . package_originator_set = True if validations . validate_pkg_originator ( arg_2 ) : arg_1 . package . originator = arg_2 return True else : raise SPDXValueError ( 'Package::Originator' ) else : raise CardinalityError ( 'Package::Originator' )

def Func(arg_0, arg_1, arg_2):
        """Sets the package originator, if not already set.
        entity - Organization, Person or NoAssert.
        Raises CardinalityError if already has an originator.
        Raises OrderError if no package previously defined.
        """
        arg_0.assert_package_exists()
        if not arg_0.package_originator_set:
            arg_0.package_originator_set = True
            if validations.validate_pkg_originator(arg_2):
                arg_1.package.originator = arg_2
                return True
            else:
                raise SPDXValueError('Package::Originator')
        else:
            raise CardinalityError('Package::Originator')

Sets the package originator if not already set . entity - Organization Person or NoAssert . Raises CardinalityError if already has an originator . Raises OrderError if no package previously defined .


def
Func
(
arg_0
,
arg_1
)
:
from
dispatch
.
theme
import
ThemeManager
arg_2
=
{
}
if
arg_1
.
get
(
'widget'
)
is
not
:
try
:
arg_3
=
ThemeManager
.
Widgets
.
get
(
arg_1
[
'widget'
]
)
except
WidgetNotFound
as
e
:
arg_2
[
'widget'
]
=
str
(
e
)
else
:
for
arg_4
in
arg_3
.
fields
:
arg_5
=
arg_1
[
'data'
]
.
get
(
arg_4
.
name
)
if
arg_5
is
not
:
try
:
arg_4
.
Func
(
arg_5
)
except
InvalidField
as
e
:
arg_2
[
arg_4
.
name
]
=
str
(
e
)
elif
arg_4
.
required
:
arg_2
[
arg_4
.
name
]
=
'%s is required'
%
arg_4
.
label
if
arg_2
:
raise
ValidationError
(
arg_2
)
return
arg_1

def Func(arg_0, arg_1):
        """Perform validation of the widget data"""

        from dispatch.theme import ThemeManager

        arg_2 = {}

        if arg_1.get('widget') is not None:

            try:
                arg_3 = ThemeManager.Widgets.get(arg_1['widget'])
            except WidgetNotFound as e:
                arg_2['widget'] = str(e)
            else:
                for arg_4 in arg_3.fields:

                    arg_5 = arg_1['data'].get(arg_4.name)

                    if arg_5 is not None:
                        try:
                            arg_4.Func(arg_5)
                        except InvalidField as e:
                            arg_2[arg_4.name] = str(e)
                    elif arg_4.required:
                        arg_2[arg_4.name] = '%s is required' % arg_4.label

        if arg_2:
            raise ValidationError(arg_2)

        return arg_1


(self, ds_name, data, attrs=None, dtype=None)

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):
        """
        Saves a Numpy array in a dataset in the HDF file, registers it as
        ds_name and returns the h5py dataset.

        :param ds_name: string
        Registration name of the dataset to be registered.

        :param data: Numpy ndarray

        :param dtype: dtype
        Datatype of the dataset

        :return: h5py dataset
        """
        if arg_1 in arg_0._datasets:
            arg_5 = arg_0._datasets[arg_1]
            if arg_5.dtype != arg_2.dtype:
                warnings.warn('Dataset and data dtype are different!')

        else:
            if arg_4 is None:
                arg_4 = arg_2.dtype

            arg_5 = arg_0._group.Func(arg_1, arg_2.shape,
                                            arg_4=arg_4)

            if arg_3 is not None:
                for arg_6 in arg_3:
                    setattr(arg_5.attrs, arg_6, arg_3[arg_6])

        arg_5.read_direct(arg_2)
        arg_0._datasets[arg_1] = arg_5

        return arg_5

Saves a Numpy array in a dataset in the HDF file registers it as ds_name and returns the h5py dataset .


def Func ( arg_0 : arg_1 , arg_2 : arg_3 ) -> Node : return _Func ( arg_0 , arg_2 ) . assoc ( top_level = True )

def Func(arg_0: arg_1, arg_2: arg_3) -> Node:
    """Take a Lisp form as an argument and produce a Basilisp syntax
    tree matching the clojure.tools.analyzer AST spec."""
    return _Func(arg_0, arg_2).assoc(top_level=True)

Take a Lisp form as an argument and produce a Basilisp syntax tree matching the clojure . tools . analyzer AST spec .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
get_session
arg_3
=
arg_2
.
query
(
sqla_models
.
Role
)
.
filter
(
sqla_models
.
Role
.
name
==
arg_1
)
.
first
(
)
if
arg_3
:
arg_0
.
log
.
info
(
"Deleting role '%s'"
,
arg_1
)
arg_2
.
delete
(
arg_3
)
arg_2
.
commit
(
)
else
:
raise
AirflowException
(
"Role named '{}' does not exist"
.
format
(
arg_1
)
)

def Func(arg_0, arg_1):
        """Delete the given Role

        :param role_name: the name of a role in the ab_role table
        """
        arg_2 = arg_0.get_session
        arg_3 = arg_2.query(sqla_models.Role)\
                      .filter(sqla_models.Role.name == arg_1)\
                      .first()
        if arg_3:
            arg_0.log.info("Deleting role '%s'", arg_1)
            arg_2.delete(arg_3)
            arg_2.commit()
        else:
            raise AirflowException("Role named '{}' does not exist".format(
                arg_1))


def Func ( arg_0 ) : arg_0 = arg_0 . replace ( b'\\' , b'\\\\' ) arg_0 = arg_0 . replace ( b'"' , b'\\"' ) return arg_0

def Func(arg_0):
    """Prepare a string for quoting for DIGEST-MD5 challenge or response.

    Don't add the quotes, only escape '"' and "\\" with backslashes.

    :Parameters:
        - `data`: a raw string.
    :Types:
        - `data`: `bytes`

    :return: `data` with '"' and "\\" escaped using "\\".
    :returntype: `bytes`
    """
    arg_0 = arg_0.replace(b'\\', b'\\\\')
    arg_0 = arg_0.replace(b'"', b'\\"')
    return arg_0

Prepare a string for quoting for DIGEST - MD5 challenge or response .


(self, fcget: typing.Optional[typing.Callable[[typing.Any], typing.Any]])

def Func ( arg_0 , arg_1 : arg_2 . Optional [ arg_2 . Callable [ [ arg_2 . Any ] , arg_2 . Any ] ] ) -> "AdvancedProperty" : arg_0 . __fcget = arg_1 return arg_0

def Func(arg_0, arg_1: arg_2.Optional[arg_2.Callable[[arg_2.Any], arg_2.Any]]) -> "AdvancedProperty":
        """Descriptor to change the class wide getter on a property.

        :param fcget: new class-wide getter.
        :type fcget: typing.Optional[typing.Callable[[typing.Any, ], typing.Any]]
        :return: AdvancedProperty
        :rtype: AdvancedProperty
        """
        arg_0.__fcget = arg_1
        return arg_0

Descriptor to change the class wide getter on a property .


def  Func( arg_0, arg_1 ):
        """ convert a series of simple words into some HTML text """
        arg_2 = ""
        if arg_1:
            arg_2 = html_quote( arg_1[0] )
            for arg_3 in arg_1[1:]:
                arg_2 = arg_2 + " " + html_quote( arg_3 )

        return arg_2


def Func ( arg_0 ) : if ( arg_0 . AL & 0x0F > 9 ) or arg_0 . AF == 1 : arg_0 . AX = arg_0 . AX - 6 arg_0 . AH = arg_0 . AH - 1 arg_0 . AF = True arg_0 . CF = True else : arg_0 . AF = False arg_0 . CF = False arg_0 . AL = arg_0 . AL & 0x0f

def Func(arg_0):
        """
        ASCII Adjust AL after subtraction.

        Adjusts the result of the subtraction of two unpacked BCD values to  create a unpacked
        BCD result. The AL register is the implied source and destination operand for this instruction.
        The Func instruction is only useful when it follows a SUB instruction that subtracts
        (binary subtraction) one unpacked BCD value from another and stores a byte result in the AL
        register. The AAA instruction then adjusts the contents of the AL register to contain the
        correct 1-digit unpacked BCD result. If the subtraction produced a decimal carry, the AH register
        is decremented by 1, and the CF and AF flags are set. If no decimal carry occurred, the CF and AF
        flags are cleared, and the AH register is unchanged. In either case, the AL register is left with
        its top nibble set to 0.

        The AF and CF flags are set to 1 if there is a decimal borrow; otherwise, they are cleared to 0.

        This instruction executes as described in compatibility mode and legacy mode.
        It is not valid in 64-bit mode.::

                IF ((AL AND 0FH) > 9) Operators.OR(AF  =  1)
                THEN
                    AX  =  AX - 6;
                    AH  =  AH - 1;
                    AF  =  1;
                    CF  =  1;
                ELSE
                    CF  =  0;
                    AF  =  0;
                FI;
                AL  =  AL AND 0FH;

        :param cpu: current CPU.
        """
        if (arg_0.AL & 0x0F > 9) or arg_0.AF == 1:
            arg_0.AX = arg_0.AX - 6
            arg_0.AH = arg_0.AH - 1
            arg_0.AF = True
            arg_0.CF = True
        else:
            arg_0.AF = False
            arg_0.CF = False
        arg_0.AL = arg_0.AL & 0x0f

ASCII Adjust AL after subtraction.

        Adjusts the result of the subtraction of two unpacked BCD values to  create a unpacked
        BCD result. The AL register is the implied source and destination operand for this instruction.
        The AAS instruction is only useful when it follows a SUB instruction that subtracts
        (binary subtraction) one unpacked BCD value from another and stores a byte result in the AL
        register. The AAA instruction then adjusts the contents of the AL register to contain the
        correct 1-digit unpacked BCD result. If the subtraction produced a decimal carry, the AH register
        is decremented by 1, and the CF and AF flags are set. If no decimal carry occurred, the CF and AF
        flags are cleared, and the AH register is unchanged. In either case, the AL register is left with
        its top nibble set to 0.

        The AF and CF flags are set to 1 if there is a decimal borrow; otherwise, they are cleared to 0.

        This instruction executes as described in compatibility mode and legacy mode.
        It is not valid in 64-bit mode.::

                IF ((AL AND 0FH) > 9) Operators.OR(AF  =  1)
                THEN
                    AX  =  AX - 6;
                    AH  =  AH - 1;
                    AF  =  1;
                    CF  =  1;
                ELSE
                    CF  =  0;
                    AF  =  0;
                FI;
                AL  =  AL AND 0FH;

        :param cpu: current CPU.


def
Func
(
arg_0
,
arg_1
:
arg_2
)
->
bool
:
arg_3
=
arg_0
.
get_namespace_hash
(
)
arg_4
=
os
.
path
.
join
(
arg_1
,
f'{self.module_name}.belns.md5'
)
if
not
os
.
path
.
exists
(
arg_4
)
:
arg_5
=
else
:
with
open
(
arg_4
)
as
file
:
arg_5
=
file
.
read
(
)
.
strip
(
)
if
arg_5
==
arg_3
:
return
False
with
open
(
os
.
path
.
join
(
arg_1
,
f'{self.module_name}.belns'
)
,
'w'
)
as
file
:
arg_0
.
write_bel_namespace
(
file
,
use_names
=
False
)
with
open
(
arg_4
,
'w'
)
as
file
:
print
(
arg_3
,
file
=
file
)
if
arg_0
.
has_names
:
with
open
(
os
.
path
.
join
(
arg_1
,
f'{self.module_name}-names.belns'
)
,
'w'
)
as
file
:
arg_0
.
write_bel_namespace
(
file
,
use_names
=
True
)
with
open
(
os
.
path
.
join
(
arg_1
,
f'{self.module_name}.belns.mapping'
)
,
'w'
)
as
file
:
arg_0
.
write_bel_namespace_mappings
(
file
,
desc
=
'writing mapping'
)
return
True

def Func(arg_0, arg_1: arg_2) -> bool:
        """Write a BEL namespace for identifiers, names, name hash, and mappings to the given directory."""
        arg_3 = arg_0.get_namespace_hash()
        arg_4 = os.path.join(arg_1, f'{self.module_name}.belns.md5')

        if not os.path.exists(arg_4):
            arg_5 = None
        else:
            with open(arg_4) as file:
                arg_5 = file.read().strip()

        if arg_5 == arg_3:
            return False

        with open(os.path.join(arg_1, f'{self.module_name}.belns'), 'w') as file:
            arg_0.write_bel_namespace(file, use_names=False)

        with open(arg_4, 'w') as file:
            print(arg_3, file=file)

        if arg_0.has_names:
            with open(os.path.join(arg_1, f'{self.module_name}-names.belns'), 'w') as file:
                arg_0.write_bel_namespace(file, use_names=True)

            with open(os.path.join(arg_1, f'{self.module_name}.belns.mapping'), 'w') as file:
                arg_0.write_bel_namespace_mappings(file, desc='writing mapping')

        return True

Write a BEL namespace for identifiers names name hash and mappings to the given directory .


def Func ( arg_0 ) : arg_1 = 0 for arg_2 in range ( arg_0 . shape [ 0 ] ) : for arg_3 in range ( arg_0 . shape [ 1 ] ) : if not arg_0 [ arg_2 , arg_3 ] : arg_1 += 1 return arg_1

def Func(arg_0):
    """Compute the total number of unmasked regular pixels in a masks."""

    arg_1 = 0

    for arg_2 in range(arg_0.shape[0]):
        for arg_3 in range(arg_0.shape[1]):
            if not arg_0[arg_2, arg_3]:
                arg_1 += 1

    return arg_1

Compute the total number of unmasked regular pixels in a masks .


def Func(arg_0, arg_1, arg_2):
    """Decides what to do with the selected stream.

    Depending on arguments it can be one of these:
     - Output internal command-line
     - Output JSON represenation
     - Continuously output the stream over HTTP
     - Output stream data to selected output

    """

    arg_2 = resolve_stream_name(arg_1, arg_2)
    arg_3 = arg_1[arg_2]

    # Print internal command-line if this stream
    # uses a subprocess.
    if args.subprocess_cmdline:
        if isinstance(arg_3, StreamProcess):
            try:
                arg_4 = arg_3.cmdline()
            except StreamError as err:
                console.exit("{0}", err)

            console.msg("{0}", arg_4)
        else:
            console.exit("The stream specified cannot be translated to a command")

    # Print JSON representation of the stream
    elif console.json:
        console.msg_json(arg_3)

    elif args.stream_url:
        try:
            console.msg("{0}", arg_3.to_url())
        except TypeError:
            console.exit("The stream specified cannot be translated to a URL")

    # Output the stream
    else:
        # Find any streams with a '_alt' suffix and attempt
        # to use these in case the main stream is not usable.
        arg_5 = list(filter(lambda k: arg_2 + "_alt" in k,
                                  sorted(arg_1.keys())))
        arg_6 = args.output or args.stdout

        for arg_2 in [arg_2] + arg_5:
            arg_3 = arg_1[arg_2]
            arg_7 = type(arg_3).shortname()

            if arg_7 in args.player_passthrough and not arg_6:
                log.info("Opening stream: {0} ({1})", arg_2,
                         arg_7)
                arg_8 = output_stream_passthrough(arg_0, arg_3)
            elif args.player_external_http:
                return output_stream_http(arg_0, arg_1, external=True,
                                          port=args.player_external_http_port)
            elif args.player_continuous_http and not arg_6:
                return output_stream_http(arg_0, arg_1)
            else:
                log.info("Opening stream: {0} ({1})", arg_2,
                         arg_7)

                arg_8 = output_stream(arg_0, arg_3)

            if arg_8:
                break

Decides what to do with the selected stream .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_0
.
file_id
=
arg_1
if
'name'
not
in
arg_2
:
raise
KeyError
(
'The file must have a name'
)
if
'file_data'
not
in
arg_2
:
raise
KeyError
(
'The file must have file_data'
)
return
arg_0
.
_mc_client
.
_patch
(
url
=
arg_0
.
_build_path
(
arg_1
)
,
arg_2
=
arg_2
)

def Func(arg_0, arg_1, arg_2):
        """
        Update a file in the File Manager.

        :param file_id: The unique id for the File Manager file.
        :type file_id: :py:class:`str`
        :param data: The request body parameters
        :type data: :py:class:`dict`
        data = {
            "name": string*,
            "file_data": string*
        }
        """
        arg_0.file_id = arg_1
        if 'name' not in arg_2:
            raise KeyError('The file must have a name')
        if 'file_data' not in arg_2:
            raise KeyError('The file must have file_data')
        return arg_0._mc_client._patch(url=arg_0._build_path(arg_1), arg_2=arg_2)


def
Func
(
arg_0
)
:
arg_0
.
setContext
(
"Func"
)
try
:
arg_1
=
"0152310230304230282903"
arg_0
.
request
(
False
)
arg_2
=
arg_0
.
calc_crc16
(
arg_1
[
2
:
]
.
decode
(
"hex"
)
)
arg_1
+=
arg_2
arg_0
.
m_serial_port
.
write
(
arg_1
.
decode
(
"hex"
)
)
arg_3
=
arg_0
.
m_serial_port
.
getResponse
(
arg_0
.
getContext
(
)
)
arg_0
.
serialPostEnd
(
)
arg_4
=
arg_0
.
unpackStruct
(
arg_3
,
arg_0
.
m_hldy
)
arg_0
.
convertData
(
arg_4
,
arg_0
.
m_hldy
,
arg_0
.
m_kwh_precision
)
arg_5
=
arg_0
.
calc_crc16
(
arg_3
[
1
:
2
]
)
if
str
(
arg_5
)
==
str
(
arg_0
.
m_hldy
[
"crc16"
]
[
MeterData
.
StringValue
]
)
:
ekm_log
(
"Holidays and Schedules CRC success"
)
arg_0
.
setContext
(
""
)
return
True
except
:
ekm_log
(
traceback
.
format_exc
(
sys
.
exc_info
(
)
)
)
arg_0
.
setContext
(
""
)
return
False

def Func(arg_0):
        """ Serial call to read holiday dates into meter object buffer.

        Returns:
            bool: True on completion.
        """
        arg_0.setContext("Func")
        try:
            arg_1 = "0152310230304230282903"
            arg_0.request(False)
            arg_2 = arg_0.calc_crc16(arg_1[2:].decode("hex"))
            arg_1 += arg_2
            arg_0.m_serial_port.write(arg_1.decode("hex"))
            arg_3 = arg_0.m_serial_port.getResponse(arg_0.getContext())
            arg_0.serialPostEnd()
            arg_4 = arg_0.unpackStruct(arg_3, arg_0.m_hldy)
            arg_0.convertData(arg_4, arg_0.m_hldy, arg_0.m_kwh_precision)
            arg_5 = arg_0.calc_crc16(arg_3[1:-2])
            if str(arg_5) == str(arg_0.m_hldy["crc16"][MeterData.StringValue]):
                ekm_log("Holidays and Schedules CRC success")
                arg_0.setContext("")
                return True
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        arg_0.setContext("")
        return False

Serial call to read holiday dates into meter object buffer .