def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_2 [ "pyramid_type" ] arg_4 = arg_2 [ "scale_method" ] arg_5 = arg_2 [ "output_format" ] arg_6 = arg_2 [ "resampling" ] arg_7 = arg_2 [ "zoom" ] arg_8 = arg_2 [ "bounds" ] arg_9 = "overwrite" if arg_2 [ "overwrite" ] else "continue" arg_10 , arg_11 = _get_zoom ( arg_7 , arg_0 , arg_3 ) with rasterio . open ( arg_0 , "r" ) as input_raster : arg_12 = input_raster . count arg_13 = input_raster . dtypes [ 0 ] arg_14 = input_raster . dtypes [ 0 ] arg_15 = input_raster . nodatavals [ 0 ] arg_15 = arg_15 if arg_15 else 0 if arg_5 == "PNG" and arg_12 > 3 : arg_12 = 3 arg_14 = 'uint8' arg_16 = ( ) if arg_4 == "dtype_scale" : for arg_17 in range ( 1 , arg_12 + 1 ) : arg_16 += ( DTYPE_RANGES [ arg_13 ] , ) elif arg_4 == "minmax_scale" : for arg_17 in range ( 1 , arg_12 + 1 ) : arg_18 = input_raster . read ( arg_17 ) arg_16 += ( ( arg_18 . min ( ) , arg_18 . max ( ) ) , ) elif arg_4 == "crop" : for arg_17 in range ( 1 , arg_12 + 1 ) : arg_16 += ( ( 0 , 255 ) , ) if arg_13 == "uint8" : arg_4 = None arg_16 = ( ) for arg_17 in range ( 1 , arg_12 + 1 ) : arg_16 += ( ( None , None ) , ) arg_19 = dict ( process = "mapchete.processes.pyramid.tilify" , output = { "path" : arg_1 , "format" : arg_5 , "bands" : arg_12 , "dtype" : arg_14 } , pyramid = dict ( pixelbuffer = 5 , grid = arg_3 ) , arg_4 = arg_4 , arg_16 = arg_16 , input = { "raster" : arg_0 } , config_dir = os . getcwd ( ) , zoom_levels = dict ( min = arg_10 , max = arg_11 ) , arg_15 = arg_15 , arg_6 = arg_6 , arg_8 = arg_8 , baselevel = { "zoom" : arg_11 , "resampling" : arg_6 } , arg_9 = arg_9 ) with mapchete . open ( arg_19 , arg_7 = arg_7 , arg_8 = arg_8 ) as mp : if not os . path . exists ( arg_1 ) : os . makedirs ( arg_1 ) mp . batch_process ( arg_7 = [ arg_10 , arg_11 ] )

def Func(arg_0, arg_1, arg_2):
    """Create a tile pyramid out of an input raster dataset."""
    arg_3 = arg_2["pyramid_type"]
    arg_4 = arg_2["scale_method"]
    arg_5 = arg_2["output_format"]
    arg_6 = arg_2["resampling"]
    arg_7 = arg_2["zoom"]
    arg_8 = arg_2["bounds"]
    arg_9 = "overwrite" if arg_2["overwrite"] else "continue"

    # Prepare process parameters
    arg_10, arg_11 = _get_zoom(arg_7, arg_0, arg_3)
    with rasterio.open(arg_0, "r") as input_raster:
        arg_12 = input_raster.count
        arg_13 = input_raster.dtypes[0]
        arg_14 = input_raster.dtypes[0]
        arg_15 = input_raster.nodatavals[0]
        arg_15 = arg_15 if arg_15 else 0
        if arg_5 == "PNG" and arg_12 > 3:
            arg_12 = 3
            arg_14 = 'uint8'
        arg_16 = ()
        if arg_4 == "dtype_scale":
            for arg_17 in range(1, arg_12+1):
                arg_16 += (DTYPE_RANGES[arg_13], )
        elif arg_4 == "minmax_scale":
            for arg_17 in range(1, arg_12+1):
                arg_18 = input_raster.read(arg_17)
                arg_16 += ((arg_18.min(), arg_18.max()), )
        elif arg_4 == "crop":
            for arg_17 in range(1, arg_12+1):
                arg_16 += ((0, 255), )
        if arg_13 == "uint8":
            arg_4 = None
            arg_16 = ()
            for arg_17 in range(1, arg_12+1):
                arg_16 += ((None, None), )

    # Create configuration
    arg_19 = dict(
        process="mapchete.processes.pyramid.tilify",
        output={
            "path": arg_1,
            "format": arg_5,
            "bands": arg_12,
            "dtype": arg_14
            },
        pyramid=dict(pixelbuffer=5, grid=arg_3),
        arg_4=arg_4,
        arg_16=arg_16,
        input={"raster": arg_0},
        config_dir=os.getcwd(),
        zoom_levels=dict(min=arg_10, max=arg_11),
        arg_15=arg_15,
        arg_6=arg_6,
        arg_8=arg_8,
        baselevel={"zoom": arg_11, "resampling": arg_6},
        arg_9=arg_9
    )

    # create process
    with mapchete.open(arg_19, arg_7=arg_7, arg_8=arg_8) as mp:
        # prepare output directory
        if not os.path.exists(arg_1):
            os.makedirs(arg_1)
        # run process
        mp.batch_process(arg_7=[arg_10, arg_11])

Create a tile pyramid out of an input raster dataset .


return (self.shell_channel.is_alive() or self.sub_channel.is_alive() or
                self.stdin_channel.is_alive() or self.hb_channel.is_alive())

def Func ( arg_0 ) : return ( arg_0 . shell_channel . is_alive ( ) or arg_0 . sub_channel . is_alive ( ) or arg_0 . stdin_channel . is_alive ( ) or arg_0 . hb_channel . is_alive ( ) )

def Func(arg_0):
        """Are any of the channels created and running?"""
        return (arg_0.shell_channel.is_alive() or arg_0.sub_channel.is_alive() or
                arg_0.stdin_channel.is_alive() or arg_0.hb_channel.is_alive())


(self, inputs, outputs, name='scan', step=None, constants=None)

return theano.scan(
            step or self._step,
            name=self._fmt(name),
            sequences=inputs,
            outputs_info=init,
            non_sequences=constants,
            go_backwards='back' in self.kwargs.get('direction', '').lower(),
            truncate_gradient=self.kwargs.get('bptt_limit', -1),
        )

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
'scan'
,
arg_4
=
,
arg_5
=
)
:
arg_6
=
[
]
for
arg_7
,
arg_8
in
enumerate
(
arg_2
)
:
arg_9
=
getattr
(
arg_8
,
'ndim'
,
1
)
if
arg_8
is
or
isinstance
(
arg_8
,
dict
)
or
arg_9
>
0
:
arg_6
.
append
(
arg_8
)
continue
if
isinstance
(
arg_8
,
int
)
or
arg_9
==
0
:
arg_6
.
append
(
TT
.
repeat
(
theano
.
shared
(
np
.
zeros
(
(
1
,
arg_0
.
output_size
)
,
util
.
FLOAT
)
,
arg_3
=
arg_0
.
_fmt
(
'init{}'
.
format
(
arg_7
)
)
)
,
arg_8
,
axis
=
0
)
)
continue
raise
ValueError
(
'cannot handle input {} for scan!'
.
format
(
arg_8
)
)
return
theano
.
scan
(
arg_4
or
arg_0
.
_step
,
arg_3
=
arg_0
.
_fmt
(
arg_3
)
,
sequences
=
arg_1
,
outputs_info
=
arg_6
,
non_sequences
=
arg_5
,
go_backwards
=
'back'
in
arg_0
.
kwargs
.
get
(
'direction'
,
''
)
.
lower
(
)
,
truncate_gradient
=
arg_0
.
kwargs
.
get
(
'bptt_limit'
,
1
)
,
)

def Func(arg_0, arg_1, arg_2, arg_3='scan', arg_4=None, arg_5=None):
        '''Helper method for defining a basic loop in theano.

        Parameters
        ----------
        inputs : sequence of theano expressions
            Inputs to the scan operation.
        outputs : sequence of output specifiers
            Specifiers for the outputs of the scan operation. This should be a
            sequence containing:
            - None for values that are output by the scan but not tapped as
              inputs,
            - an integer or theano scalar (``ndim == 0``) indicating the batch
              size for initial zero state,
            - a theano tensor variable (``ndim > 0``) containing initial state
              data, or
            - a dictionary containing a full output specifier. See
              ``outputs_info`` in the Theano documentation for ``scan``.
        name : str, optional
            Name of the scan variable to create. Defaults to ``'scan'``.
        step : callable, optional
            The callable to apply in the loop. Defaults to :func:`self._step`.
        constants : sequence of tensor, optional
            A sequence of parameters, if any, needed by the step function.

        Returns
        -------
        output(s) : theano expression(s)
            Theano expression(s) representing output(s) from the scan.
        updates : sequence of update tuples
            A sequence of updates to apply inside a theano function.
        '''
        arg_6 = []
        for arg_7, arg_8 in enumerate(arg_2):
            arg_9 = getattr(arg_8, 'ndim', -1)
            if arg_8 is None or isinstance(arg_8, dict) or arg_9 > 0:
                arg_6.append(arg_8)
                continue
            if isinstance(arg_8, int) or arg_9 == 0:
                arg_6.append(TT.repeat(theano.shared(
                    np.zeros((1, arg_0.output_size), util.FLOAT),
                    arg_3=arg_0._fmt('init{}'.format(arg_7))), arg_8, axis=0))
                continue
            raise ValueError('cannot handle input {} for scan!'.format(arg_8))
        return theano.scan(
            arg_4 or arg_0._step,
            arg_3=arg_0._fmt(arg_3),
            sequences=arg_1,
            outputs_info=arg_6,
            non_sequences=arg_5,
            go_backwards='back' in arg_0.kwargs.get('direction', '').lower(),
            truncate_gradient=arg_0.kwargs.get('bptt_limit', -1),
        )

Helper method for defining a basic loop in theano .


return self._get_model(url, PartialClan, **params)

def Func ( arg_0 , arg_1 = '' , ** arg_2 : arg_3 ) : arg_4 = arg_0 . api . TOP + '/war/' + str ( arg_1 ) return arg_0 . _get_model ( arg_4 , PartialClan , ** arg_2 )

def Func(arg_0, arg_1='', **arg_2: arg_3):
        """Get a list of top clans by war

        location_id: Optional[str] = ''
            A location ID or '' (global)
            See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
            for a list of acceptable location IDs
        \*\*keys: Optional[list] = None
            Filter which keys should be included in the
            response
        \*\*exclude: Optional[list] = None
            Filter which keys should be excluded from the
            response
        \*\*max: Optional[int] = None
            Limit the number of items returned in the response
        \*\*page: Optional[int] = None
            Works with max, the zero-based page of the
            items
        \*\*timeout: Optional[int] = None
            Custom timeout that overwrites Client.timeout
        """
        arg_4 = arg_0.api.TOP + '/war/' + str(arg_1)
        return arg_0._get_model(arg_4, PartialClan, **arg_2)


(cls, features_id, file_struct, annot_beats, framesync)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """Selects the features from the given parameters.

        Parameters
        ----------
        features_id: str
            The identifier of the features (it must be a key inside the
            `features_registry`)
        file_struct: msaf.io.FileStruct
            The file struct containing the files to extract the features from
        annot_beats: boolean
            Whether to use annotated (`True`) or estimated (`False`) beats
        framesync: boolean
            Whether to use framesync (`True`) or beatsync (`False`) features

        Returns
        -------
        features: obj
            The actual features object that inherits from `msaf.Features`
        """
        if not arg_3 and arg_4:
            arg_5 = FeatureTypes.framesync
        elif arg_3 and not arg_4:
            arg_5 = FeatureTypes.ann_beatsync
        elif not arg_3 and not arg_4:
            arg_5 = FeatureTypes.est_beatsync
        else:
            raise FeatureTypeNotFound("Type of features not valid.")

        # Select features with default parameters
        if arg_1 not in features_registry.keys():
            raise FeaturesNotFound(
                "The features '%s' are invalid (valid features are %s)"
                % (arg_1, features_registry.keys()))

        return features_registry[arg_1](arg_2, arg_5)

Selects the features from the given parameters .


def Func ( arg_0 , arg_1 , arg_2 ) : return Fasta ( arg_0 . id , arg_0 . seq [ arg_1 : arg_2 ] )

def Func(arg_0, arg_1, arg_2):
        '''Returns Fasta object with the same name, of the bases from start to end, but not including end'''
        return Fasta(arg_0.id, arg_0.seq[arg_1:arg_2])

Returns Fasta object with the same name of the bases from start to end but not including end


return self._get_query(Namespace).filter(Namespace.url == self._get_namespace_url()).one_or_none()

def Func ( arg_0 ) -> Optional [ Namespace ] : return arg_0 . _get_query ( Namespace ) . filter ( Namespace . url == arg_0 . _get_namespace_url ( ) ) . one_or_none ( )

def Func(arg_0) -> Optional[Namespace]:
        """Get the reference BEL namespace if it exists."""
        return arg_0._get_query(Namespace).filter(Namespace.url == arg_0._get_namespace_url()).one_or_none()

Get the reference BEL namespace if it exists .


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in arg_0 . filelist : arg_1 . append ( arg_2 . filename ) return arg_1

def Func(arg_0):
        """Return a list of file names in the archive."""
        arg_1 = []
        for arg_2 in arg_0.filelist:
            arg_1.append(arg_2.filename)
        return arg_1

Return a list of file names in the archive .


def
Func
(
arg_0
,
arg_1
,
*
arg_2
,
**
arg_3
)
:
arg_4
=
arg_0
.
serializer_class
(
data
=
arg_1
.
data
)
if
not
arg_4
.
is_valid
(
)
:
return
response
.
Response
(
arg_4
.
errors
,
status
=
status
.
HTTP_400_BAD_REQUEST
,
)
arg_4
.
user
.
send_validation_email
(
)
arg_5
=
_
(
'Email confirmation sent.'
)
return
response
.
Response
(
arg_5
,
status
=
status
.
HTTP_204_NO_CONTENT
)

def Func(arg_0, arg_1, *arg_2, **arg_3):
        """Validate `email` and send a request to confirm it."""
        arg_4 = arg_0.serializer_class(data=arg_1.data)

        if not arg_4.is_valid():
            return response.Response(
                arg_4.errors,
                status=status.HTTP_400_BAD_REQUEST,
            )

        arg_4.user.send_validation_email()
        arg_5 = _('Email confirmation sent.')
        return response.Response(arg_5, status=status.HTTP_204_NO_CONTENT)

Validate email and send a request to confirm it .


def Func ( arg_0 , arg_1 = None ) : arg_2 = arg_0 [ 'type' ] if arg_2 == 'dict' : return DictListStorage ( arg_0 ) if arg_2 == 'redis' : return RedisListStorage ( arg_0 , arg_1 = arg_1 )

def Func(arg_0, arg_1=None):
    '''Return ordered storage system based on the specified config.

    The canonical example of such a storage container is
    ``defaultdict(list)``. Thus, the return value of this method contains
    keys and values. The values are ordered lists with the last added
    item at the end.

    Args:
        config (dict): Defines the configurations for the storage.
            For in-memory storage, the config ``{'type': 'dict'}`` will
            suffice. For Redis storage, the type should be ``'redis'`` and
            the configurations for the Redis database should be supplied
            under the key ``'redis'``. These parameters should be in a form
            suitable for `redis.Redis`. The parameters may alternatively
            contain references to environment variables, in which case
            literal configuration values should be replaced by dicts of
            the form::

                {'env': 'REDIS_HOSTNAME',
                 'default': 'localhost'}

            For a full example, see :ref:`minhash_lsh_at_scale`

        name (bytes, optional): A reference name for this storage container.
            For dict-type containers, this is ignored. For Redis containers,
            this name is used to prefix keys pertaining to this storage
            container within the database.
    '''
    arg_2 = arg_0['type']
    if arg_2 == 'dict':
        return DictListStorage(arg_0)
    if arg_2 == 'redis':
        return RedisListStorage(arg_0, arg_1=arg_1)

Return ordered storage system based on the specified config .


def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Sends a packet to a peer.
        """

        def attempt_to_Func(arg_4):
            if arg_1 not in arg_0._connections:
                arg_5 = arg_0._connect(arg_1)
                arg_5.addCallback(attempt_to_Func)
                return arg_5
            else:
                arg_6 = arg_0._connections[arg_1][0]
                arg_6.Func_packet(arg_2, arg_3)
                return defer.succeed(None)

        arg_5 = attempt_to_Func(None)

        arg_0._ongoing_Funcs.add(arg_5)

        def Func_completed(arg_7):
            if arg_5 in arg_0._ongoing_Funcs:
                arg_0._ongoing_Funcs.remove(arg_5)
            return arg_7

        arg_5.addBoth(Func_completed)
        return arg_5


def Func(arg_0, arg_1, arg_2):
        """Maps a pin number to a physical device pin.

        To make it easy to change drivers without having to refactor a lot of
        code, this library does not use the names set by the driver to identify
        a pin. This function will map a number, that will be used by other
        functions, to a physical pin represented by the drivers pin id. That
        way, if you need to use another pin or change the underlying driver
        completly, you only need to redo the mapping.

        If you're developing a driver, keep in mind that your driver will not
        know about this. The other functions will translate the mapped pin to
        your id before calling your function.

        @arg abstract_pin_id the id that will identify this pin in the
        other function calls. You can choose what you want.

        @arg physical_pin_id the id returned in the driver.
            See `AbstractDriver.available_pins`. Setting it to None removes the
            mapping.
        """
        if arg_2:
            arg_0._pin_mapping[arg_1] = arg_2
        else:
            arg_0._pin_mapping.pop(arg_1, None)

Maps a pin number to a physical device pin .


def
Func
(
arg_0
,
arg_1
)
:
import
os
from
maya
import
cmds
"""Inject the current working file"""
arg_2
=
cmds
.
file
(
sceneName
=
True
,
query
=
True
)
arg_3
=
os
.
path
.
normpath
(
arg_2
)
arg_1
.
set_data
(
'currentFile'
,
value
=
arg_3
)
arg_1
.
set_data
(
'current_file'
,
value
=
arg_3
)

def Func(arg_0, arg_1):
        import os
        from maya import cmds

        """Inject the current working file"""
        arg_2 = cmds.file(sceneName=True, query=True)

        # Maya returns forward-slashes by default
        arg_3 = os.path.normpath(arg_2)

        arg_1.set_data('currentFile', value=arg_3)

        # For backwards compatibility
        arg_1.set_data('current_file', value=arg_3)


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
not
in
_FEATURE_MASK
:
raise
AttributeError
(
"feature must be one of: '"
+
"', '"
.
join
(
(
'consonantal'
,
'sonorant'
,
'syllabic'
,
'labial'
,
'round'
,
'coronal'
,
'anterior'
,
'distributed'
,
'dorsal'
,
'high'
,
'low'
,
'back'
,
'tense'
,
'pharyngeal'
,
'ATR'
,
'voice'
,
'spread_glottis'
,
'constricted_glottis'
,
'continuant'
,
'strident'
,
'lateral'
,
'delayed_release'
,
'nasal'
,
)
)
+
"'"
)
arg_2
=
_FEATURE_MASK
[
arg_1
]
arg_3
=
arg_2
>>
1
arg_4
=
[
]
for
arg_5
in
arg_0
:
if
arg_5
<
0
:
arg_4
.
append
(
float
(
'NaN'
)
)
else
:
arg_6
=
arg_5
&
arg_2
if
arg_6
==
0
:
arg_4
.
append
(
0
)
elif
arg_6
==
arg_2
:
arg_4
.
append
(
2
)
elif
arg_6
&
arg_3
:
arg_4
.
append
(
1
)
else
:
arg_4
.
append
(
1
)
return
arg_4

def Func(arg_0, arg_1):
    """Get a feature vector.

    This returns a list of ints, equal in length to the vector input,
        representing presence/absence/neutrality with respect to a particular
        phonetic feature.

    Parameters
    ----------
    vector : list
        A tuple or list of ints representing the phonetic features of a phone
        or series of phones (such as is returned by the ipa_to_features
        function)
    feature : str
        A feature name from the set:

            - ``consonantal``
            - ``sonorant``
            - ``syllabic``
            - ``labial``
            - ``round``
            - ``coronal``
            - ``anterior``
            - ``distributed``
            - ``dorsal``
            - ``high``
            - ``low``
            - ``back``
            - ``tense``
            - ``pharyngeal``
            - ``ATR``
            - ``voice``
            - ``spread_glottis``
            - ``constricted_glottis``
            - ``continuant``
            - ``strident``
            - ``lateral``
            - ``delayed_release``
            - ``nasal``

    Returns
    -------
    list of ints
        A list indicating presence/absence/neutrality with respect to the
        feature

    Raises
    ------
    AttributeError
        feature must be one of ...

    Examples
    --------
    >>> tails = ipa_to_features('telz')
    >>> Func(tails, 'consonantal')
    [1, -1, 1, 1]
    >>> Func(tails, 'sonorant')
    [-1, 1, 1, -1]
    >>> Func(tails, 'nasal')
    [-1, -1, -1, -1]
    >>> Func(tails, 'coronal')
    [1, -1, 1, 1]

    """
    # :param bool binary: if False, -1, 0, & 1 represent -, 0, & +
    #           if True, only binary oppositions are allowed:
    #           0 & 1 represent - & + and 0s are mapped to -

    if arg_1 not in _FEATURE_MASK:
        raise AttributeError(
            "feature must be one of: '"
            + "', '".join(
                (
                    'consonantal',
                    'sonorant',
                    'syllabic',
                    'labial',
                    'round',
                    'coronal',
                    'anterior',
                    'distributed',
                    'dorsal',
                    'high',
                    'low',
                    'back',
                    'tense',
                    'pharyngeal',
                    'ATR',
                    'voice',
                    'spread_glottis',
                    'constricted_glottis',
                    'continuant',
                    'strident',
                    'lateral',
                    'delayed_release',
                    'nasal',
                )
            )
            + "'"
        )

    # each feature mask contains two bits, one each for - and +
    arg_2 = _FEATURE_MASK[arg_1]
    # the lower bit represents +
    arg_3 = arg_2 >> 1
    arg_4 = []
    for arg_5 in arg_0:
        if arg_5 < 0:
            arg_4.append(float('NaN'))
        else:
            arg_6 = arg_5 & arg_2
            if arg_6 == 0:
                arg_4.append(0)  # 0
            elif arg_6 == arg_2:
                arg_4.append(2)  # +/-
            elif arg_6 & arg_3:
                arg_4.append(1)  # +
            else:
                arg_4.append(-1)  # -

    return arg_4

Get a feature vector.

    This returns a list of ints, equal in length to the vector input,
        representing presence/absence/neutrality with respect to a particular
        phonetic feature.

    Parameters
    ----------
    vector : list
        A tuple or list of ints representing the phonetic features of a phone
        or series of phones (such as is returned by the ipa_to_features
        function)
    feature : str
        A feature name from the set:

            - ``consonantal``
            - ``sonorant``
            - ``syllabic``
            - ``labial``
            - ``round``
            - ``coronal``
            - ``anterior``
            - ``distributed``
            - ``dorsal``
            - ``high``
            - ``low``
            - ``back``
            - ``tense``
            - ``pharyngeal``
            - ``ATR``
            - ``voice``
            - ``spread_glottis``
            - ``constricted_glottis``
            - ``continuant``
            - ``strident``
            - ``lateral``
            - ``delayed_release``
            - ``nasal``

    Returns
    -------
    list of ints
        A list indicating presence/absence/neutrality with respect to the
        feature

    Raises
    ------
    AttributeError
        feature must be one of ...

    Examples
    --------
    >>> tails = ipa_to_features('telz')
    >>> get_feature(tails, 'consonantal')
    [1, -1, 1, 1]
    >>> get_feature(tails, 'sonorant')
    [-1, 1, 1, -1]
    >>> get_feature(tails, 'nasal')
    [-1, -1, -1, -1]
    >>> get_feature(tails, 'coronal')
    [1, -1, 1, 1]


(actions: List[CardAction], text: str = None, speak: str = None,
                          input_hint: Union[InputHints, str] = InputHints.accepting_input)

def Func(arg_0: arg_1[arg_2], arg_3: arg_4 = None, arg_5: arg_4 = None,
                          arg_6: arg_7[arg_8, arg_4] = arg_8.accepting_input) -> Activity:
        """
        Returns a message that includes a set of suggested actions and optional text.

        :Example:
        message = MessageFactory.Func([CardAction(title='a', type=ActionTypes.im_back, value='a'),
                                                    CardAction(title='b', type=ActionTypes.im_back, value='b'),
                                                    CardAction(title='c', type=ActionTypes.im_back, value='c')], 'Choose a color')
        await context.send_activity(message)

        :param actions:
        :param text:
        :param speak:
        :param input_hint:
        :return:
        """
        arg_0 = SuggestedActions(arg_0=arg_0)
        arg_10 = Activity(type=ActivityTypes.message, arg_6=arg_6, Func=arg_0)
        if arg_3:
            arg_10.text = arg_3
        if arg_5:
            arg_10.speak = arg_5
        return arg_10

Returns a message that includes a set of suggested actions and optional text.

        :Example:
        message = MessageFactory.suggested_actions([CardAction(title='a', type=ActionTypes.im_back, value='a'),
                                                    CardAction(title='b', type=ActionTypes.im_back, value='b'),
                                                    CardAction(title='c', type=ActionTypes.im_back, value='c')], 'Choose a color')
        await context.send_activity(message)

        :param actions:
        :param text:
        :param speak:
        :param input_hint:
        :return:

Returns a message that includes a set of suggested actions and optional text .


def
Func
(
arg_0
)
:
arg_1
=
{
}
if
'link'
in
arg_0
:
arg_2
=
arg_0
[
'link'
]
.
split
(
', '
)
for
arg_3
in
arg_2
:
(
arg_4
,
arg_5
)
=
arg_3
.
split
(
'; '
)
arg_4
=
arg_4
[
1
:
1
]
arg_5
=
arg_5
[
5
:
1
]
arg_1
[
arg_5
]
=
arg_4
return
arg_1

def Func(arg_0):
    """Parses Github's link header for pagination.

    TODO eventually use a github client for this
    """
    arg_1 = {}
    if 'link' in arg_0:
        arg_2 = arg_0['link'].split(', ')
        for arg_3 in arg_2:
            (arg_4, arg_5) = arg_3.split('; ')
            arg_4 = arg_4[1:-1]
            arg_5 = arg_5[5:-1]
            arg_1[arg_5] = arg_4
    return arg_1

Parses Github s link header for pagination .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = COURSES_API . format ( arg_1 ) + "/sections" arg_5 = { "course_section" : { "name" : arg_2 , "sis_section_id" : arg_3 } } return CanvasSection ( data = arg_0 . _post_resource ( arg_4 , arg_5 ) )

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Create a canvas section in the given course id.

        https://canvas.instructure.com/doc/api/sections.html#method.sections.create
        """
        arg_4 = COURSES_API.format(arg_1) + "/sections"
        arg_5 = {"course_section": {"name": arg_2,
                                   "sis_section_id": arg_3}}

        return CanvasSection(data=arg_0._post_resource(arg_4, arg_5))

Create a canvas section in the given course id .


(self, analytes=None, weight_fwhm=None,
                              n_min=20, n_max=None, cstep=None,
                              bkg_filter=False, f_win=7, f_n_lim=3, focus_stage='despiked')

def Func(arg_0, arg_1=None, arg_2=None,
                              arg_3=20, arg_4=None, arg_5=None,
                              arg_6=False, arg_7=7, arg_8=3, arg_9='despiked'):
        """
        Background calculation using a gaussian weighted mean.

        Parameters
        ----------
        analytes : str or iterable
            Which analyte or analytes to calculate.
        weight_fwhm : float
            The full-width-at-half-maximum of the gaussian used
            to calculate the weighted average.
        n_min : int
            Background regions with fewer than n_min points
            will not be included in the fit.
        cstep : float or None
            The interval between calculated background points.
        filter : bool
            If true, apply a rolling filter to the isolated background regions
            to exclude regions with anomalously high values. If True, two parameters
            alter the filter's behaviour:
        f_win : int
            The size of the rolling window
        f_n_lim : float
            The number of standard deviations above the rolling mean
            to set the threshold.
        focus_stage : str
            Which stage of analysis to apply processing to.
            Defaults to 'despiked' if present, or 'rawdata' if not.
            Can be one of:
            * 'rawdata': raw data, loaded from csv file.
            * 'despiked': despiked data.
            * 'signal'/'background': isolated signal and background data.
              Created by self.separate, after signal and background
              regions have been identified by self.autorange.
            * 'bkgsub': background subtracted data, created by
              self.bkg_correct
            * 'ratios': element ratio data, created by self.ratio.
            * 'calibrated': ratio data calibrated to standards, created by self.calibrate.
        """
        if arg_1 is None:
            arg_1 = arg_0.analytes
            arg_0.bkg = Bunch()
        elif isinstance(arg_1, str):
            arg_1 = [arg_1]

        if arg_2 is None:
            arg_2 = 600  # 10 minute default window

        arg_0.get_background(arg_3=arg_3, arg_4=arg_4,
                            arg_6=arg_6,
                            arg_7=arg_7, arg_8=arg_8, arg_9=arg_9)

        # Gaussian - weighted average
        if 'calc' not in arg_0.bkg.keys():
            # create time points to calculate background
            if arg_5 is None:
                arg_5 = arg_2 / 20
            elif arg_5 > arg_2:
                warnings.warn("\ncstep should be less than weight_fwhm. Your backgrounds\n" +
                              "might not behave as expected.\n")
            arg_11 = np.linspace(0,
                                arg_0.max_time,
                                arg_0.max_time // arg_5)
            arg_0.bkg['calc'] = Bunch()
            arg_0.bkg['calc']['uTime'] = arg_11

        # TODO : calculation then dict assignment is clumsy...
        arg_12, arg_13, arg_14 = gauss_weighted_stats(arg_0.bkg['raw'].uTime,
                                                 arg_0.bkg['raw'].loc[:, arg_1].values,
                                                 arg_0.bkg['calc']['uTime'],
                                                 fwhm=arg_2)

        for arg_15, arg_16 in enumerate(arg_1):
            arg_0.bkg['calc'][arg_16] = {'mean': arg_12[arg_15],
                                    'std': arg_13[arg_15],
                                    'stderr': arg_14[arg_15]}

Background calculation using a gaussian weighted mean .


def Func(arg_0, arg_1, arg_2=None, **arg_3):
        """ Predict the causal score using a trained RCC model

        Args:
            x (numpy.array or pandas.DataFrame or pandas.Series): First variable or dataset.
            args (numpy.array): second variable (optional depending on the 1st argument).

        Returns:
            float: Causation score (Value : 1 if a->b and -1 if b->a)
        """
        if arg_0.clf is None:
            raise ValueError("Model has to be trained before making predictions.")
        if arg_1 is pandas.Series:
            arg_4 = arg_0.featurize_row(arg_1.iloc[0], arg_1.iloc[1]).reshape((1, -1))
        elif arg_1 is pandas.DataFrame:
            arg_4 = np.array([arg_0.featurize_row(arg_1.iloc[0], arg_1.iloc[1]) for row in arg_1])
        elif arg_2 is not None:
            arg_4 = arg_0.featurize_row(arg_1, arg_2).reshape((1, -1))
        else:
            raise TypeError("DataType not understood.")
        return arg_0.clf.predict(arg_4)


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_4
=
arg_1
arg_0
.
stream
.
tell
(
)
if
arg_4
!=
0
:
logger
.
warning
(
"There are {} bytes between {} and {}"
.
format
(
arg_4
,
arg_2
,
arg_3
)
)

def Func(arg_0, arg_1, arg_2, arg_3):
        """ Helper function to warn about unknown bytes found in the file"""
        arg_4 = arg_1 - arg_0.stream.tell()
        if arg_4 != 0:
            logger.warning(
                "There are {} bytes between {} and {}".format(arg_4, arg_2, arg_3)
            )


def Func ( arg_0 ) : def guess_it ( arg_1 ) : arg_2 = arg_0 . cmdline if arg_2 and hasattr ( os , 'access' ) and hasattr ( os , 'X_OK' ) : Func = arg_2 [ 0 ] arg_4 = os . path . realpath ( Func ) if os . path . isabs ( arg_4 ) and os . path . isfile ( arg_4 ) and os . access ( arg_4 , os . X_OK ) : return Func if isinstance ( arg_1 , AccessDenied ) : raise arg_1 return arg_1 try : Func = arg_0 . _platform_impl . get_process_exe ( ) except AccessDenied : arg_5 = sys . exc_info ( ) [ 1 ] return guess_it ( arg_1 = arg_5 ) else : if not Func : try : Func = guess_it ( arg_1 = Func ) except AccessDenied : pass return Func

def Func(arg_0):
        """The process executable path. May also be an empty string."""
        def guess_it(arg_1):
            # try to guess exe from cmdline[0] in absence of a native
            # exe representation
            arg_2 = arg_0.cmdline
            if arg_2 and hasattr(os, 'access') and hasattr(os, 'X_OK'):
                Func = arg_2[0]  # the possible exe
                arg_4 = os.path.realpath(Func)  # ...in case it's a symlink
                if os.path.isabs(arg_4) and os.path.isfile(arg_4) \
                and os.access(arg_4, os.X_OK):
                    return Func
            if isinstance(arg_1, AccessDenied):
                raise arg_1
            return arg_1

        try:
            Func = arg_0._platform_impl.get_process_exe()
        except AccessDenied:
            arg_5 = sys.exc_info()[1]
            return guess_it(arg_1=arg_5)
        else:
            if not Func:
                # underlying implementation can legitimately return an
                # empty string; if that's the case we don't want to
                # raise AD while guessing from the cmdline
                try:
                    Func = guess_it(arg_1=Func)
                except AccessDenied:
                    pass
            return Func

The process executable path . May also be an empty string .


def Func ( arg_0 ) : arg_1 = np . reshape ( arg_0 . _unitary , 2 * [ 2 ** arg_0 . _number_of_qubits ] ) arg_1 = np . stack ( ( arg_1 . real , arg_1 . imag ) , axis = - 1 ) arg_1 [ arg_2 ( arg_1 ) < arg_0 . _chop_threshold ] = 0.0 return arg_1

def Func(arg_0):
        """Return the current unitary in JSON Result spec format"""
        arg_1 = np.reshape(arg_0._unitary, 2 * [2 ** arg_0._number_of_qubits])
        # Expand complex numbers
        arg_1 = np.stack((arg_1.real, arg_1.imag), axis=-1)
        # Truncate small values
        arg_1[arg_2(arg_1) < arg_0._chop_threshold] = 0.0
        return arg_1


def
Func
(
arg_0
)
:
if
os
.
path
.
exists
(
arg_0
)
or
os
.
path
.
exists
(
arg_0
+
'.mat'
)
:
return
loadmat
(
arg_0
)
[
'data'
]
else
:
raise
IOError
(
"Can't find PSF file '%s'"
%
arg_0
)

def Func(arg_0):
    """Load the array `data` in the .mat file `fname`."""
    if os.path.exists(arg_0) or os.path.exists(arg_0 + '.mat'):
        return loadmat(arg_0)['data']
    else:
        raise IOError("Can't find PSF file '%s'" % arg_0)

Load the array data in the . mat file fname .


def Func(arg_0):
        """Create a session.

        First we look in self.key_file for a path to a json file with the
        credentials. The key file should have 'AWSAccessKeyId' and 'AWSSecretKey'.

        Next we look at self.profile for a profile name and try
        to use the Session call to automatically pick up the keys for the profile from
        the user default keys file ~/.aws/config.

        Finally, boto3 will look for the keys in environment variables:
        AWS_ACCESS_KEY_ID: The access key for your AWS account.
        AWS_SECRET_ACCESS_KEY: The secret key for your AWS account.
        AWS_SESSION_TOKEN: The session key for your AWS account.
        This is only needed when you are using temporary credentials.
        The AWS_SECURITY_TOKEN environment variable can also be used,
        but is only supported for backwards compatibility purposes.
        AWS_SESSION_TOKEN is supported by multiple AWS SDKs besides python.
        """

        arg_1 = None

        if arg_0.key_file is not None:
            arg_2 = os.path.expandvars(os.path.expanduser(arg_0.key_file))

            try:
                with open(arg_2, 'r') as f:
                    arg_3 = json.load(f)
            except json.JSONDecodeError as e:
                logger.error(
                    "EC2Provider '{}': json decode error in credential file {}".format(arg_0.label, arg_2)
                )
                raise e

            except Exception as e:
                logger.debug(
                    "EC2Provider '{0}' caught exception while reading credential file: {1}".format(
                        arg_0.label, arg_2
                    )
                )
                raise e

            logger.debug("EC2Provider '{}': Using credential file to create session".format(arg_0.label))
            arg_1 = boto3.session.Session(region_name=arg_0.region, **arg_3)
        elif arg_0.profile is not None:
            logger.debug("EC2Provider '{}': Using profile name to create session".format(arg_0.label))
            arg_1 = boto3.session.Session(
                profile_name=arg_0.profile, region_name=arg_0.region
            )
        else:
            logger.debug("EC2Provider '{}': Using environment variables to create session".format(arg_0.label))
            arg_1 = boto3.session.Session(region_name=arg_0.region)

        return arg_1


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] for arg_3 in arg_1 : if isinstance ( arg_3 , astroid . Instance ) : arg_3 = arg_3 . _proxied if ( isinstance ( arg_3 , astroid . ClassDef ) and hasattr ( arg_3 , "name" ) and not arg_0 . has_node ( arg_3 ) ) : if arg_3 . name not in arg_2 : arg_4 = arg_3 . name arg_2 . append ( arg_4 ) return arg_2

def Func(arg_0, arg_1):
        """return class names if needed in diagram"""
        arg_2 = []
        for arg_3 in arg_1:
            if isinstance(arg_3, astroid.Instance):
                arg_3 = arg_3._proxied
            if (
                isinstance(arg_3, astroid.ClassDef)
                and hasattr(arg_3, "name")
                and not arg_0.has_node(arg_3)
            ):
                if arg_3.name not in arg_2:
                    arg_4 = arg_3.name
                    arg_2.append(arg_4)
        return arg_2


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

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

        if arg_0._operations:
            for arg_7 in arg_0._operations:
                arg_7.Func(arg_6, arg_2=arg_2)

        if arg_0._object_types:
            for arg_8 in arg_0._object_types:
                arg_8.Func(arg_6, arg_2=arg_2)

        if arg_0._vendor_identification:
            arg_0._vendor_identification.Func(
                arg_6,
                arg_2=arg_2
            )

        if arg_0._server_information:
            arg_0._server_information.Func(
                arg_6,
                arg_2=arg_2
            )

        if arg_0._application_namespaces:
            for arg_9 in arg_0._application_namespaces:
                arg_9.Func(
                    arg_6,
                    arg_2=arg_2
                )

        if arg_2 >= arg_3.KMIPVersion.KMIP_1_1:
            if arg_0._extension_information:
                for arg_10 in arg_0._extension_information:
                    arg_10.Func(
                        arg_6,
                        arg_2=arg_2
                    )

        if arg_2 >= arg_3.KMIPVersion.KMIP_1_2:
            if arg_0._attestation_types:
                for arg_11 in arg_0._attestation_types:
                    arg_11.Func(
                        arg_6,
                        arg_2=arg_2
                    )

        if arg_2 >= arg_3.KMIPVersion.KMIP_1_3:
            if arg_0._rng_parameters:
                for arg_12 in arg_0._rng_parameters:
                    arg_12.Func(
                        arg_6,
                        arg_2=arg_2
                    )
            if arg_0._profile_information:
                for arg_13 in arg_0._profile_information:
                    arg_13.Func(
                        arg_6,
                        arg_2=arg_2
                    )
            if arg_0._validation_information:
                for arg_14 in arg_0._validation_information:
                    arg_14.Func(
                        arg_6,
                        arg_2=arg_2
                    )
            if arg_0._capability_information:
                for arg_15 in arg_0._capability_information:
                    arg_15.Func(
                        arg_6,
                        arg_2=arg_2
                    )
            if arg_0._client_registration_methods:
                for arg_16 in arg_0._client_registration_methods:
                    arg_16.Func(
                        arg_6,
                        arg_2=arg_2
                    )

        if arg_2 >= arg_3.KMIPVersion.KMIP_2_0:
            if arg_0._defaults_information:
                arg_0._defaults_information.Func(
                    arg_6,
                    arg_2=arg_2
                )
            if arg_0._storage_protection_masks:
                for arg_17 in arg_0._storage_protection_masks:
                    arg_17.Func(
                        arg_6,
                        arg_2=arg_2
                    )

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

Write the data encoding the QueryResponsePayload object to a stream.

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

Write the data encoding the QueryResponsePayload object to a stream .


def Func(arg_0, arg_1):
        """Map `path` through the aliases.

        `path` is checked against all of the patterns.  The first pattern to
        match is used to replace the root of the path with the result root.
        Only one pattern is ever used.  If no patterns match, `path` is
        returned unchanged.

        The separator style in the result is made to match that of the result
        in the alias.

        """
        for arg_2, arg_3, arg_4, arg_5 in arg_0.aliases:
            arg_6 = arg_2.match(arg_1)
            if arg_6:
                arg_7 = arg_1.replace(arg_6.group(0), arg_3)
                if arg_4 != arg_5:
                    arg_7 = arg_7.replace(arg_4, arg_5)
                if arg_0.locator:
                    arg_7 = arg_0.locator.canonical_filename(arg_7)
                return arg_7
        return arg_1


(command, parser, cl_args, unknown_args)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_4
,
arg_5
,
arg_6
=
arg_2
[
'cluster'
]
,
arg_2
[
'role'
]
,
arg_2
[
'environ'
]
arg_7
=
arg_2
[
'topology-name'
]
arg_8
=
arg_2
[
'id'
]
try
:
arg_9
=
tracker_access
.
get_topology_info
(
arg_4
,
arg_6
,
arg_7
,
arg_5
)
except
:
Log
.
error
(
"Fail to connect to tracker: \'%s\'"
,
arg_2
[
"tracker_url"
]
)
return
False
arg_10
=
arg_9
[
'physical_plan'
]
[
'stmgrs'
]
arg_11
,
arg_12
=
set
(
)
,
set
(
)
for
arg_13
,
arg_14
in
arg_9
[
'physical_plan'
]
[
'bolts'
]
.
items
(
)
:
arg_11
=
arg_11
|
set
(
arg_14
)
for
arg_13
,
arg_15
in
arg_9
[
'physical_plan'
]
[
'spouts'
]
.
items
(
)
:
arg_12
=
arg_12
|
set
(
arg_15
)
arg_16
=
arg_10
.
keys
(
)
arg_16
.
sort
(
)
if
arg_8
is
not
:
try
:
arg_17
=
arg_8
1
if
arg_17
<
0
:
raise
arg_16
=
[
arg_16
[
arg_17
]
]
except
:
Log
.
error
(
'Invalid container id: %d'
%
arg_8
)
return
False
arg_18
=
[
]
for
arg_19
,
arg_20
in
enumerate
(
arg_16
)
:
arg_21
=
arg_19
+
1
arg_22
=
arg_10
[
arg_20
]
[
"host"
]
arg_23
=
arg_10
[
arg_20
]
[
"port"
]
arg_24
=
arg_10
[
arg_20
]
[
"pid"
]
arg_25
=
arg_10
[
arg_20
]
[
"instance_ids"
]
arg_26
=
len
(
[
instance
for
instance
in
arg_25
if
instance
in
arg_11
]
)
arg_27
=
len
(
[
instance
for
instance
in
arg_25
if
instance
in
arg_12
]
)
arg_18
.
append
(
[
arg_21
,
arg_22
,
arg_23
,
arg_24
,
arg_26
,
arg_27
,
len
(
arg_25
)
]
)
arg_28
=
[
"container"
,
"host"
,
"port"
,
"pid"
,
"#bolt"
,
"#spout"
,
"#instance"
]
sys
.
stdout
.
flush
(
)
print
(
tabulate
(
arg_18
,
arg_28
=
arg_28
)
)
return
True

def Func(arg_0, arg_1, arg_2, arg_3):
  """ run containers subcommand """
  arg_4, arg_5, arg_6 = arg_2['cluster'], arg_2['role'], arg_2['environ']
  arg_7 = arg_2['topology-name']
  arg_8 = arg_2['id']
  try:
    arg_9 = tracker_access.get_topology_info(arg_4, arg_6, arg_7, arg_5)
  except:
    Log.error("Fail to connect to tracker: \'%s\'", arg_2["tracker_url"])
    return False
  arg_10 = arg_9['physical_plan']['stmgrs']
  arg_11, arg_12 = set(), set()
  for arg_13, arg_14 in arg_9['physical_plan']['bolts'].items():
    arg_11 = arg_11 | set(arg_14)
  for arg_13, arg_15 in arg_9['physical_plan']['spouts'].items():
    arg_12 = arg_12 | set(arg_15)
  arg_16 = arg_10.keys()
  arg_16.sort()
  if arg_8 is not None:
    try:
      arg_17 = arg_8 - 1
      if arg_17 < 0:
        raise
      arg_16 = [arg_16[arg_17]]
    except:
      Log.error('Invalid container id: %d' % arg_8)
      return False
  arg_18 = []
  for arg_19, arg_20 in enumerate(arg_16):
    arg_21 = arg_19 + 1
    arg_22 = arg_10[arg_20]["host"]
    arg_23 = arg_10[arg_20]["port"]
    arg_24 = arg_10[arg_20]["pid"]
    arg_25 = arg_10[arg_20]["instance_ids"]
    arg_26 = len([instance for instance in arg_25 if instance in arg_11])
    arg_27 = len([instance for instance in arg_25 if instance in arg_12])
    arg_18.append([arg_21, arg_22, arg_23, arg_24, arg_26, arg_27, len(arg_25)])
  arg_28 = ["container", "host", "port", "pid", "#bolt", "#spout", "#instance"]
  sys.stdout.flush()
  print(tabulate(arg_18, arg_28=arg_28))
  return True


(reader, writer, start, stop, insertLocation=None, tsCol=None)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None):
  """Copies a range of values to a new location in the data set.

  Args:
    reader: A FileRecordStream object with input data.
    writer: A FileRecordStream object to write output data to.
    start: The first row in the range to Func.
    stop: The last row in the range to Func.
    insertLocation: The location to insert the copied range. If not specified,
        the range is inserted immediately following itself.
  """
  assert arg_3 >= arg_2
  arg_6 = []
  arg_7 = []
  arg_8 = None
  arg_9 = None
  if arg_5 is None:
    arg_5 = arg_0.getTimestampFieldIdx()
  for arg_10, arg_11 in enumerate(arg_0):
    # Get the first timestamp and the increment.
    if arg_8 is None:
      arg_8 = arg_11[arg_5]
    elif arg_9 is None:
      arg_9 = arg_11[arg_5] - arg_8
    # Keep a list of all rows and a list of rows to Func.
    if arg_10 >= arg_2 and arg_10 <= arg_3:
      arg_7.append(arg_11)
    arg_6.append(arg_11)
  # Insert the copied rows.
  if arg_4 is None:
    arg_4 = arg_3 + 1
  arg_6[arg_4:arg_4] = arg_7
  # Update the timestamps.
  for arg_11 in arg_6:
    arg_11[arg_5] = arg_8
    arg_1.appendRecord(arg_11)
    arg_8 += arg_9

Copies a range of values to a new location in the data set.

  Args:
    reader: A FileRecordStream object with input data.
    writer: A FileRecordStream object to write output data to.
    start: The first row in the range to copy.
    stop: The last row in the range to copy.
    insertLocation: The location to insert the copied range. If not specified,
        the range is inserted immediately following itself.

Copies a range of values to a new location in the data set .


(times, mags, errs,
                       maxlags=1000,
                       func=_autocorr_func3,
                       fillgaps=0.0,
                       filterwindow=11,
                       forcetimebin=None,
                       sigclip=3.0,
                       magsarefluxes=False,
                       verbose=True)

def Func(arg_0, arg_1, arg_2,
                       arg_3=1000,
                       arg_4=arg_5,
                       arg_6=0.0,
                       arg_7=11,
                       arg_8=None,
                       arg_9=3.0,
                       arg_10=False,
                       arg_11=True):
    '''This calculates the ACF of a light curve.

    This will pre-process the light curve to fill in all the gaps and normalize
    everything to zero. If `fillgaps = 'noiselevel'`, fills the gaps with the
    noise level obtained via the procedure above. If `fillgaps = 'nan'`, fills
    the gaps with `np.nan`.

    Parameters
    ----------

    times,mags,errs : np.array
        The measurement time-series and associated errors.

    maxlags : int
        The maximum number of lags to calculate.

    func : Python function
        This is a function to calculate the lags.

    fillgaps : 'noiselevel' or float
        This sets what to use to fill in gaps in the time series. If this is
        'noiselevel', will smooth the light curve using a point window size of
        `filterwindow` (this should be an odd integer), subtract the smoothed LC
        from the actual LC and estimate the RMS. This RMS will be used to fill
        in the gaps. Other useful values here are 0.0, and npnan.

    filterwindow : int
        The light curve's smoothing filter window size to use if
        `fillgaps='noiselevel`'.

    forcetimebin : None or float
        This is used to force a particular cadence in the light curve other than
        the automatically determined cadence. This effectively rebins the light
        curve to this cadence. This should be in the same time units as `times`.

    sigclip : float or int or sequence of two floats/ints or None
        If a single float or int, a symmetric sigma-clip will be performed using
        the number provided as the sigma-multiplier to cut out from the input
        time-series.

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

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

    magsarefluxes : bool
        If your input measurements in `mags` are actually fluxes instead of
        mags, set this is True.

    verbose : bool
        If True, will indicate progress and report errors.

    Returns
    -------

    dict
        A dict of the following form is returned::

            {'itimes': the interpolated time values after gap-filling,
             'imags': the interpolated mag/flux values after gap-filling,
             'ierrs': the interpolated mag/flux values after gap-filling,
             'cadence': the cadence of the output mag/flux time-series,
             'minitime': the minimum value of the interpolated times array,
             'lags': the lags used to calculate the auto-correlation function,
             'acf': the value of the ACF at each lag used}

    '''

    # get the gap-filled timeseries
    arg_12 = fill_magseries_gaps(arg_0, arg_1, arg_2,
                                       arg_6=arg_6,
                                       arg_8=arg_8,
                                       arg_9=arg_9,
                                       arg_10=arg_10,
                                       arg_7=arg_7,
                                       arg_11=arg_11)

    if not arg_12:
        print('failed to interpolate light curve to minimum cadence!')
        return None

    arg_13, arg_14 = arg_12['itimes'], arg_12['imags'],

    # calculate the lags up to maxlags
    if arg_3:
        arg_15 = nparange(0, arg_3)
    else:
        arg_15 = nparange(arg_13.size)

    arg_16 = 1.483*npmedian(npabs(arg_14))

    if arg_4 != arg_5:

        # get the autocorrelation as a function of the lag of the mag series
        arg_17 = nparray([arg_4(arg_14, x, arg_14.size, 0.0, arg_16)
                            for x in arg_15])

    # this doesn't need a lags array
    else:

        arg_17 = arg_5(arg_14, arg_15[0], arg_14.size,
                                   0.0, arg_16)
        # return only the maximum number of lags
        if arg_3 is not None:
            arg_17 = arg_17[:arg_3]

    arg_12.update({'minitime':arg_13.min(),
                         'lags':arg_15,
                         'acf':arg_17})

    return arg_12

This calculates the ACF of a light curve .


return {
            'objectName': self._run_object,
            'runTime': run_time,
            'heatmaps': heatmaps
        }

def Func ( arg_0 ) : with _CodeHeatmapCalculator ( ) as prof : try : runpy . run_path ( arg_0 . _run_object , run_name = '__main__' ) except SystemExit : pass arg_1 = [ ] for arg_2 , arg_3 in prof . heatmap . items ( ) : if os . path . isfile ( arg_2 ) : arg_1 . append ( arg_0 . _format_heatmap ( arg_2 , arg_3 , prof . execution_count [ arg_2 ] ) ) arg_4 = sum ( arg_3 [ 'runTime' ] for arg_3 in arg_1 ) return { 'objectName' : arg_0 . _run_object , 'runTime' : arg_4 , 'heatmaps' : arg_1 }

def Func(arg_0):
        """Calculates heatmap for package."""
        with _CodeHeatmapCalculator() as prof:
            try:
                runpy.run_path(arg_0._run_object, run_name='__main__')
            except SystemExit:
                pass

        arg_1 = []
        for arg_2, arg_3 in prof.heatmap.items():
            if os.path.isfile(arg_2):
                arg_1.append(
                    arg_0._format_heatmap(
                        arg_2, arg_3, prof.execution_count[arg_2]))

        arg_4 = sum(arg_3['runTime'] for arg_3 in arg_1)
        return {
            'objectName': arg_0._run_object,
            'runTime': arg_4,
            'heatmaps': arg_1
        }


(db, user_id, api_path, include_content, decrypt_func)

return _get_file(db, user_id, api_path, query_fields, decrypt_func)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : arg_5 = _file_default_fields ( ) if arg_3 : arg_5 . append ( files . c . content ) return _Func ( arg_0 , arg_1 , arg_2 , arg_5 , arg_4 )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """
    Get file data for the given user_id and path.

    Include content only if include_content=True.
    """
    arg_5 = _file_default_fields()
    if arg_3:
        arg_5.append(files.c.content)

    return _Func(arg_0, arg_1, arg_2, arg_5, arg_4)

Get file data for the given user_id and path .


(
        x, rg=20, is_random=False, row_index=0, col_index=1, channel_index=2, fill_mode='nearest', cval=0., order=1
)

def Func ( arg_0 , arg_1 = 20 , arg_2 = False , arg_3 = 0 , arg_4 = 1 , arg_5 = 2 , arg_6 = 'nearest' , arg_7 = 0. , arg_8 = 1 ) : if arg_2 : arg_9 = np . pi / 180 * np . random . uniform ( - arg_1 , arg_1 ) else : arg_9 = np . pi / 180 * arg_1 arg_10 = np . array ( [ [ np . cos ( arg_9 ) , - np . sin ( arg_9 ) , 0 ] , [ np . sin ( arg_9 ) , np . cos ( arg_9 ) , 0 ] , [ 0 , 0 , 1 ] ] ) arg_11 , arg_12 = arg_0 . shape [ arg_3 ] , arg_0 . shape [ arg_4 ] arg_13 = transform_matrix_offset_center ( arg_10 , arg_11 , arg_12 ) arg_0 = affine_transform ( arg_0 , arg_13 , arg_5 , arg_6 , arg_7 , arg_8 ) return arg_0

def Func(
        arg_0, arg_1=20, arg_2=False, arg_3=0, arg_4=1, arg_5=2, arg_6='nearest', arg_7=0., arg_8=1
):
    """Rotate an image randomly or non-randomly.

    Parameters
    -----------
    x : numpy.array
        An image with dimension of [row, col, channel] (default).
    rg : int or float
        Degree to rotate, usually 0 ~ 180.
    is_random : boolean
        If True, randomly rotate. Default is False
    row_index col_index and channel_index : int
        Index of row, col and channel, default (0, 1, 2), for theano (1, 2, 0).
    fill_mode : str
        Method to fill missing pixel, default `nearest`, more options `constant`, `reflect` or `wrap`, see `scipy ndimage affine_transform <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.interpolation.affine_transform.html>`__
    cval : float
        Value used for points outside the boundaries of the input if mode=`constant`. Default is 0.0
    order : int
        The order of interpolation. The order has to be in the range 0-5. See ``tl.prepro.affine_transform`` and `scipy ndimage affine_transform <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.interpolation.affine_transform.html>`__

    Returns
    -------
    numpy.array
        A processed image.

    Examples
    ---------
    >>> x --> [row, col, 1]
    >>> x = tl.prepro.Func(x, rg=40, is_random=False)
    >>> tl.vis.save_image(x, 'im.png')

    """
    if arg_2:
        arg_9 = np.pi / 180 * np.random.uniform(-arg_1, arg_1)
    else:
        arg_9 = np.pi / 180 * arg_1
    arg_10 = np.array([[np.cos(arg_9), -np.sin(arg_9), 0], [np.sin(arg_9), np.cos(arg_9), 0], [0, 0, 1]])

    arg_11, arg_12 = arg_0.shape[arg_3], arg_0.shape[arg_4]
    arg_13 = transform_matrix_offset_center(arg_10, arg_11, arg_12)
    arg_0 = affine_transform(arg_0, arg_13, arg_5, arg_6, arg_7, arg_8)
    return arg_0

Rotate an image randomly or non-randomly.

    Parameters
    -----------
    x : numpy.array
        An image with dimension of [row, col, channel] (default).
    rg : int or float
        Degree to rotate, usually 0 ~ 180.
    is_random : boolean
        If True, randomly rotate. Default is False
    row_index col_index and channel_index : int
        Index of row, col and channel, default (0, 1, 2), for theano (1, 2, 0).
    fill_mode : str
        Method to fill missing pixel, default `nearest`, more options `constant`, `reflect` or `wrap`, see `scipy ndimage affine_transform <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.interpolation.affine_transform.html>`__
    cval : float
        Value used for points outside the boundaries of the input if mode=`constant`. Default is 0.0
    order : int
        The order of interpolation. The order has to be in the range 0-5. See ``tl.prepro.affine_transform`` and `scipy ndimage affine_transform <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.interpolation.affine_transform.html>`__

    Returns
    -------
    numpy.array
        A processed image.

    Examples
    ---------
    >>> x --> [row, col, 1]
    >>> x = tl.prepro.rotation(x, rg=40, is_random=False)
    >>> tl.vis.save_image(x, 'im.png')

Rotate an image randomly or non - randomly .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = BackfillJob . ID_FORMAT_PREFIX . format ( arg_1 . isoformat ( ) ) arg_4 = ( True if ( arg_0 . dag . schedule_interval and not arg_0 . dag . is_subdag ) else False ) arg_5 = arg_0 . dag . get_num_active_runs ( external_trigger = False ) arg_6 = DagRun . find ( dag_id = arg_0 . dag . dag_id , execution_date = arg_1 , arg_2 = arg_2 ) if arg_6 is not None and len ( arg_6 ) > 0 : arg_6 = arg_6 [ 0 ] if arg_6 . state == State . RUNNING : arg_4 = False else : arg_6 = None if ( arg_4 and arg_5 >= arg_0 . dag . max_active_runs ) : return None arg_6 = arg_6 or arg_0 . dag . create_dagrun ( arg_3 = arg_3 , execution_date = arg_1 , start_date = timezone . utcnow ( ) , arg_8 = State . RUNNING , external_trigger = False , arg_2 = arg_2 , conf = arg_0 . conf , ) arg_6 . dag = arg_0 . dag arg_6 . state = State . RUNNING arg_6 . run_id = arg_3 arg_6 . verify_integrity ( arg_2 = arg_2 ) return arg_6

def Func(arg_0, arg_1, arg_2=None):
        """
        Returns a dag run for the given run date, which will be matched to an existing
        dag run if available or create a new dag run otherwise. If the max_active_runs
        limit is reached, this function will return None.

        :param run_date: the execution date for the dag run
        :type run_date: datetime.datetime
        :param session: the database session object
        :type session: sqlalchemy.orm.session.Session
        :return: a DagRun in state RUNNING or None
        """
        arg_3 = BackfillJob.ID_FORMAT_PREFIX.format(arg_1.isoformat())

        # consider max_active_runs but ignore when running subdags
        arg_4 = (True
                                        if (arg_0.dag.schedule_interval and
                                            not arg_0.dag.is_subdag)
                                        else False)

        arg_5 = arg_0.dag.get_num_active_runs(external_trigger=False)

        # check if we are scheduling on top of a already existing dag_run
        # we could find a "scheduled" run instead of a "backfill"
        arg_6 = DagRun.find(dag_id=arg_0.dag.dag_id,
                          execution_date=arg_1,
                          arg_2=arg_2)

        if arg_6 is not None and len(arg_6) > 0:
            arg_6 = arg_6[0]
            if arg_6.state == State.RUNNING:
                arg_4 = False
        else:
            arg_6 = None

        # enforce max_active_runs limit for dag, special cases already
        # handled by respect_dag_max_active_limit
        if (arg_4 and
                arg_5 >= arg_0.dag.max_active_runs):
            return None

        arg_6 = arg_6 or arg_0.dag.create_dagrun(
            arg_3=arg_3,
            execution_date=arg_1,
            start_date=timezone.utcnow(),
            arg_8=State.RUNNING,
            external_trigger=False,
            arg_2=arg_2,
            conf=arg_0.conf,
        )

        # set required transient field
        arg_6.dag = arg_0.dag

        # explicitly mark as backfill and running
        arg_6.state = State.RUNNING
        arg_6.run_id = arg_3
        arg_6.verify_integrity(arg_2=arg_2)
        return arg_6

Returns a dag run for the given run date which will be matched to an existing dag run if available or create a new dag run otherwise . If the max_active_runs limit is reached this function will return None .


return tf.nn.dropout(units, keep_prob, noise_shape)

def Func ( arg_0 , arg_1 , arg_2 = ( 1 , ) ) : arg_3 = tf . shape ( arg_0 ) arg_4 = [ arg_3 [ n ] for n in range ( len ( arg_0 . shape ) ) ] for arg_5 in arg_2 : arg_4 [ arg_5 ] = 1 return tf . nn . dropout ( arg_0 , arg_1 , arg_4 )

def Func(arg_0, arg_1, arg_2=(1,)):
    """ Dropout with the same drop mask for all fixed_mask_dims

    Args:
        units: a tensor, usually with shapes [B x T x F], where
            B - batch size
            T - tokens dimension
            F - feature dimension
        keep_prob: keep probability
        fixed_mask_dims: in these dimensions the mask will be the same

    Returns:
        dropped units tensor
    """
    arg_3 = tf.shape(arg_0)
    arg_4 = [arg_3[n] for n in range(len(arg_0.shape))]
    for arg_5 in arg_2:
        arg_4[arg_5] = 1
    return tf.nn.dropout(arg_0, arg_1, arg_4)


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] for arg_3 in os . listdir ( arg_0 ) : arg_4 = join ( arg_0 , arg_3 ) if isdir ( arg_4 ) : if exists ( join ( arg_4 , "__init__.py" ) ) : if arg_1 : arg_2 . append ( "%s.%s" % ( arg_1 , arg_3 ) ) else : arg_2 . append ( arg_3 ) arg_2 += Func ( arg_4 , arg_2 [ - 1 ] ) return arg_2

def Func(arg_0, arg_1):
    """return a list of subpackages for the given directory"""
    arg_2 = []
    for arg_3 in os.listdir(arg_0):
        arg_4 = join(arg_0, arg_3)
        if isdir(arg_4):
            if exists(join(arg_4, "__init__.py")):
                if arg_1:
                    arg_2.append("%s.%s" % (arg_1, arg_3))
                else:
                    arg_2.append(arg_3)
                arg_2 += Func(arg_4, arg_2[-1])
    return arg_2


def Func ( ) : from Funcreload import Server arg_0 = Server ( app ) map ( arg_0 . watch , glob2 . glob ( "application/pages/**/*.*" ) ) map ( arg_0 . watch , glob2 . glob ( "application/macros/**/*.html" ) ) map ( arg_0 . watch , glob2 . glob ( "application/static/**/*.*" ) ) arg_0 . serve ( port = PORT )

def Func():
    """Run Funcreload server"""
    from Funcreload import Server

    arg_0 = Server(app)

    map(arg_0.watch, glob2.glob("application/pages/**/*.*"))  # pages
    map(arg_0.watch, glob2.glob("application/macros/**/*.html"))  # macros
    map(arg_0.watch, glob2.glob("application/static/**/*.*"))  # public assets

    arg_0.serve(port=PORT)


(json_api_content, tIndex, pIndex, output_dir='.', merge=True, info_only=False, **kwargs)

def Func(arg_0, arg_1, arg_2, arg_3='.', arg_4=True, arg_5=False, **arg_6):
    """int, int, int->None

    Download ONE PART of the course."""

    arg_7 = arg_0

    arg_8 = _wanmen_get_title_by_json_topic_part(arg_7,
                                                  arg_1,
                                                  arg_2)

    arg_9 = _wanmen_get_boke_id_by_json_topic_part(arg_7,
                                                      arg_1,
                                                     arg_2)

    bokecc_download_by_id(vid = arg_9, arg_8 = arg_8, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, **arg_6)

int int int - > None Download ONE PART of the course .


def
Func
(
arg_0
)
:
arg_1
=
arg_0
[
0
]
arg_2
=
arg_0
[
1
]
arg_3
=
isinstance
(
arg_2
,
str
)
and
arg_2
==
'__empty__'
if
arg_1
==
'csc'
:
if
arg_3
:
return
spsp
.
csc_matrix
(
arg_0
[
4
]
)
else
:
return
spsp
.
csc_matrix
(
tuple
(
arg_0
[
1
:
4
]
)
,
shape
=
arg_0
[
4
]
)
elif
arg_1
==
'csr'
:
if
arg_3
:
return
spsp
.
csr_matrix
(
arg_0
[
4
]
)
else
:
return
spsp
.
csr_matrix
(
tuple
(
arg_0
[
1
:
4
]
)
,
shape
=
arg_0
[
4
]
)
elif
arg_1
==
'bsr'
:
if
arg_3
:
return
spsp
.
bsr_matrix
(
arg_0
[
4
]
)
else
:
return
spsp
.
bsr_matrix
(
tuple
(
arg_0
[
1
:
4
]
)
,
shape
=
arg_0
[
4
]
)
elif
arg_1
==
'dia'
:
if
arg_3
:
return
spsp
.
dia_matrix
(
arg_0
[
3
]
)
else
:
return
spsp
.
dia_matrix
(
tuple
(
arg_0
[
1
:
3
]
)
,
shape
=
arg_0
[
3
]
)
else
:
raise
RuntimeError
(
'You shall not pass!'
)

def Func(arg_0):
        """Reconstructs a matrix from a list containing sparse matrix extracted properties

        `data_list` needs to be formatted as the first result of
        :func:`~pypet.parameter.SparseParameter._serialize_matrix`

        """
        arg_1 = arg_0[0]
        arg_2 = arg_0[1]
        arg_3 = isinstance(arg_2, str) and arg_2 == '__empty__'

        if arg_1 == 'csc':
            if arg_3:
                return spsp.csc_matrix(arg_0[4])
            else:
                return spsp.csc_matrix(tuple(arg_0[1:4]), shape=arg_0[4])
        elif arg_1 == 'csr':
            if arg_3:
                return spsp.csr_matrix(arg_0[4])
            else:
                return spsp.csr_matrix(tuple(arg_0[1:4]), shape=arg_0[4])
        elif arg_1 == 'bsr':
            if arg_3:
                # We have an empty matrix, that cannot be build as in elee case
                return spsp.bsr_matrix(arg_0[4])
            else:
                return spsp.bsr_matrix(tuple(arg_0[1:4]), shape=arg_0[4])
        elif arg_1 == 'dia':
            if arg_3:
                return spsp.dia_matrix(arg_0[3])
            else:
                return spsp.dia_matrix(tuple(arg_0[1:3]), shape=arg_0[3])
        else:
            raise RuntimeError('You shall not pass!')


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : if not os . path . isdir ( arg_2 ) : try : os . makedirs ( arg_2 ) except Exception as e : tr . err ( e ) arg_4 = arg_2 + "/" + arg_1 + ".html" try : arg_5 = open ( arg_4 , "w" ) arg_5 . write ( arg_3 ) arg_5 . close ( ) except Exception as e : tr . err ( e )

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Writes a chart's html to a file
        """
        # check directories

        if not os.path.isdir(arg_2):
            try:
                os.makedirs(arg_2)
            except Exception as e:
                tr.err(e)
        # construct file path
        arg_4 = arg_2 + "/" + arg_1 + ".html"
        #~ write the file
        try:
            arg_5 = open(arg_4, "w")
            arg_5.write(arg_3)
            arg_5.close()
        except Exception as e:
            tr.err(e)


def Func ( arg_0 , arg_1 , ** arg_2 ) : with open ( arg_0 ) as f : arg_3 = f . read ( ) arg_4 = arg_3 for arg_5 , arg_6 in arg_2 . iteritems ( ) : arg_4 = arg_4 . replace ( "{{" + arg_5 + "}}" , arg_6 ) with open ( arg_1 , "wt" ) as f : f . write ( arg_4 )

def Func(arg_0, arg_1, **arg_2):
    """Copy template and substitute template strings

    File `template_file` is copied to `dst_file`. Then, each template variable
    is replaced by a value. Template variables are of the form

        {{val}}

    Example:

    Contents of template_file:

        VAR1={{val1}}
        VAR2={{val2}}
        VAR3={{val3}}

    Func(template_file, output_file, val1="hello", val2="world")

    Contents of output_file:

        VAR1=hello
        VAR2=world
        VAR3={{val3}}

    :param template_file: Path to the template file.
    :param dst_file: Path to the destination file.
    :param kwargs: Keys correspond to template variables.
    :return:
    """
    with open(arg_0) as f:
        arg_3 = f.read()

    arg_4 = arg_3

    for arg_5, arg_6 in arg_2.iteritems():
        arg_4 = arg_4 .replace("{{" + arg_5 + "}}", arg_6)

    with open(arg_1, "wt") as f:
        f.write(arg_4)

Copy template and substitute template strings

    File `template_file` is copied to `dst_file`. Then, each template variable
    is replaced by a value. Template variables are of the form

        {{val}}

    Example:

    Contents of template_file:

        VAR1={{val1}}
        VAR2={{val2}}
        VAR3={{val3}}

    render_template(template_file, output_file, val1="hello", val2="world")

    Contents of output_file:

        VAR1=hello
        VAR2=world
        VAR3={{val3}}

    :param template_file: Path to the template file.
    :param dst_file: Path to the destination file.
    :param kwargs: Keys correspond to template variables.
    :return:


return self.get_data(
            "volumes/%s/actions/" % self.id,
            type=POST,
            params={"type": "resize",
                    "size_gigabytes": size_gigabytes,
                    "region": region}
        )

def Func ( arg_0 , arg_1 , arg_2 ) : return arg_0 . get_data ( "volumes/%s/actions/" % arg_0 . id , type = POST , params = { "type" : "Func" , "size_gigabytes" : arg_1 , "region" : arg_2 } )

def Func(arg_0, arg_1, arg_2):
        """
        Detach a Volume to a Droplet.

        Args:
            size_gigabytes: int - size of the Block Storage volume in GiB
            region: string - slug identifier for the region
        """
        return arg_0.get_data(
            "volumes/%s/actions/" % arg_0.id,
            type=POST,
            params={"type": "Func",
                    "size_gigabytes": arg_1,
                    "region": arg_2}
        )


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
in
arg_0
.
cells
:
arg_2
=
arg_0
.
cells
[
arg_1
]
arg_0
.
cells
.
del_item
(
arg_1
)
arg_0
.
inherit
(
)
arg_0
.
model
.
spacegraph
.
update_subspaces
(
arg_0
)
elif
arg_1
in
arg_0
.
dynamic_spaces
:
arg_2
=
arg_0
.
dynamic_spaces
.
pop
(
arg_1
)
arg_0
.
dynamic_spaces
.
set_update
(
)
else
:
raise
KeyError
(
"Cells '%s' does not exist"
%
arg_1
)
NullImpl
(
arg_2
)

def Func(arg_0, arg_1):
        """Implementation of cells deletion

        ``del space.name`` where name is a cells, or
        ``del space.cells['name']``
        """
        if arg_1 in arg_0.cells:
            arg_2 = arg_0.cells[arg_1]
            arg_0.cells.del_item(arg_1)
            arg_0.inherit()
            arg_0.model.spacegraph.update_subspaces(arg_0)

        elif arg_1 in arg_0.dynamic_spaces:
            arg_2 = arg_0.dynamic_spaces.pop(arg_1)
            arg_0.dynamic_spaces.set_update()

        else:
            raise KeyError("Cells '%s' does not exist" % arg_1)

        NullImpl(arg_2)


def Func(arg_0, arg_1, arg_2: arg_3):
        """
        Offer a new event ``s`` at point ``p`` in this queue.
        """
        arg_4 = arg_0.events_scan.setdefault(
                arg_1, ([], [], [], []) if USE_VERTICAL else
                   ([], [], []))
        # Can use double linked-list for easy insertion at beginning/end
        '''
        if e.type == Event.Type.END:
            existing.insert(0, e)
        else:
            existing.append(e)
        '''

        arg_4[arg_2.type].append(arg_2)

Offer a new event s at point p in this queue .


def
Func
(
arg_0
,
arg_1
=
False
)
:
arg_2
=
get_nowait_from_queue
(
arg_0
.
results
)
arg_3
=
get_nowait_from_queue
(
arg_0
.
stats_results
)
logger
.
debug
(
"Data timestamps: %s"
%
[
arg_4
.
get
(
'ts'
)
for
arg_4
in
arg_2
]
)
logger
.
debug
(
"Stats timestamps: %s"
%
[
arg_4
.
get
(
'ts'
)
for
arg_4
in
arg_3
]
)
for
arg_5
in
arg_2
:
arg_6
=
arg_5
[
'ts'
]
if
arg_6
in
arg_0
.
stat_cache
:
arg_7
=
arg_5
arg_8
=
arg_0
.
stat_cache
.
pop
(
arg_6
)
arg_0
.
__notify_listeners
(
arg_7
,
arg_8
)
else
:
arg_0
.
data_cache
[
arg_6
]
=
arg_5
for
arg_5
in
arg_3
:
arg_6
=
arg_5
[
'ts'
]
if
arg_6
in
arg_0
.
data_cache
:
arg_7
=
arg_0
.
data_cache
.
pop
(
arg_6
)
arg_8
=
arg_5
arg_0
.
__notify_listeners
(
arg_7
,
arg_8
)
else
:
arg_0
.
stat_cache
[
arg_6
]
=
arg_5
if
arg_1
and
len
(
arg_0
.
data_cache
)
>
0
:
logger
.
info
(
'Timestamps without stats:'
)
for
arg_6
,
arg_7
in
sorted
(
arg_0
.
data_cache
.
items
(
)
,
key
=
lambda
i
:
i
[
0
]
)
:
logger
.
info
(
arg_6
)
arg_0
.
__notify_listeners
(
arg_7
,
StatsReader
.
stats_item
(
arg_6
,
0
,
0
)
)

def Func(arg_0, arg_1=False):
        """
        Collect data, cache it and send to listeners
        """
        arg_2 = get_nowait_from_queue(arg_0.results)
        arg_3 = get_nowait_from_queue(arg_0.stats_results)
        logger.debug("Data timestamps: %s" % [arg_4.get('ts') for arg_4 in arg_2])
        logger.debug("Stats timestamps: %s" % [arg_4.get('ts') for arg_4 in arg_3])
        for arg_5 in arg_2:
            arg_6 = arg_5['ts']
            if arg_6 in arg_0.stat_cache:
                # send items
                arg_7 = arg_5
                arg_8 = arg_0.stat_cache.pop(arg_6)
                arg_0.__notify_listeners(arg_7, arg_8)
            else:
                arg_0.data_cache[arg_6] = arg_5
        for arg_5 in arg_3:
            arg_6 = arg_5['ts']
            if arg_6 in arg_0.data_cache:
                # send items
                arg_7 = arg_0.data_cache.pop(arg_6)
                arg_8 = arg_5
                arg_0.__notify_listeners(arg_7, arg_8)
            else:
                arg_0.stat_cache[arg_6] = arg_5
        if arg_1 and len(arg_0.data_cache) > 0:
            logger.info('Timestamps without stats:')
            for arg_6, arg_7 in sorted(arg_0.data_cache.items(), key=lambda i: i[0]):
                logger.info(arg_6)
                arg_0.__notify_listeners(arg_7, StatsReader.stats_item(arg_6, 0, 0))

Collect data cache it and send to listeners


return train_input_fn, eval_input_fn, vocabulary

def Func ( arg_0 , arg_1 ) : with open ( download ( arg_0 , "vocab.pkl" ) , "r" ) as f : arg_2 = pickle . load ( f ) arg_3 = len ( arg_2 ) arg_4 = [ None ] * arg_3 for arg_5 , arg_6 in arg_2 . items ( ) : arg_4 [ arg_6 ] = arg_5 def train_input_fn ( ) : arg_7 = newsgroups_dataset ( arg_0 , "train" , arg_3 , shuffle_and_repeat = True ) arg_7 = arg_7 . batch ( arg_1 ) . prefetch ( 32 ) return tf . compat . v1 . data . make_one_shot_iterator ( arg_7 ) . get_next ( ) def eval_input_fn ( ) : arg_7 = newsgroups_dataset ( arg_0 , "test" , arg_3 , shuffle_and_repeat = False ) arg_7 = arg_7 . batch ( arg_1 ) return tf . compat . v1 . data . make_one_shot_iterator ( arg_7 ) . get_next ( ) return train_input_fn , eval_input_fn , arg_4

def Func(arg_0, arg_1):
  """Builds iterators for train and evaluation data.

  Each object is represented as a bag-of-words vector.

  Arguments:
    data_dir: Folder in which to store the data.
    batch_size: Batch size for both train and evaluation.

  Returns:
    train_input_fn: A function that returns an iterator over the training data.
    eval_input_fn: A function that returns an iterator over the evaluation data.
    vocabulary: A mapping of word's integer index to the corresponding string.
  """

  with open(download(arg_0, "vocab.pkl"), "r") as f:
    arg_2 = pickle.load(f)
  arg_3 = len(arg_2)

  arg_4 = [None] * arg_3
  for arg_5, arg_6 in arg_2.items():
    arg_4[arg_6] = arg_5

  # Build an iterator over training batches.
  def train_input_fn():
    arg_7 = newsgroups_dataset(
        arg_0, "train", arg_3, shuffle_and_repeat=True)
    # Prefetching makes training about 1.5x faster.
    arg_7 = arg_7.batch(arg_1).prefetch(32)
    return tf.compat.v1.data.make_one_shot_iterator(arg_7).get_next()

  # Build an iterator over the heldout set.
  def eval_input_fn():
    arg_7 = newsgroups_dataset(
        arg_0, "test", arg_3, shuffle_and_repeat=False)
    arg_7 = arg_7.batch(arg_1)
    return tf.compat.v1.data.make_one_shot_iterator(arg_7).get_next()

  return train_input_fn, eval_input_fn, arg_4

Builds iterators for train and evaluation data .


def Func(arg_0):
    """ View that handles the user's return from OAuth2 provider.

    This view verifies the CSRF state and OAuth authorization code, and on
    success stores the credentials obtained in the storage provider,
    and redirects to the return_url specified in the authorize view and
    stored in the session.

    Args:
        request: Django request.

    Returns:
         A redirect response back to the return_url.
    """
    if 'error' in arg_0.GET:
        arg_1 = arg_0.GET.get(
            'error_description', arg_0.GET.get('error', ''))
        arg_1 = html.escape(arg_1)
        return http.HttpResponseBadRequest(
            'Authorization failed {0}'.format(arg_1))

    try:
        arg_2 = arg_0.GET['state']
        arg_3 = arg_0.GET['code']
    except KeyError:
        return http.HttpResponseBadRequest(
            'Request missing state or authorization code')

    try:
        arg_4 = arg_0.session[_CSRF_KEY]
    except KeyError:
        return http.HttpResponseBadRequest(
            'No existing session for this flow.')

    try:
        arg_5 = json.loads(arg_2)
        arg_6 = arg_5['csrf_token']
        arg_7 = arg_5['return_url']
    except (ValueError, KeyError):
        return http.HttpResponseBadRequest('Invalid state parameter.')

    if arg_6 != arg_4:
        return http.HttpResponseBadRequest('Invalid CSRF token.')

    arg_8 = _get_flow_for_token(arg_6, arg_0)

    if not arg_8:
        return http.HttpResponseBadRequest('Missing Oauth2 flow.')

    try:
        arg_9 = arg_8.step2_exchange(arg_3)
    except client.FlowExchangeError as exchange_error:
        return http.HttpResponseBadRequest(
            'An error has occurred: {0}'.format(exchange_error))

    get_storage(arg_0).put(arg_9)

    signals.oauth2_authorized.send(sender=signals.oauth2_authorized,
                                   arg_0=arg_0, arg_9=arg_9)

    return shortcuts.redirect(arg_7)

View that handles the user s return from OAuth2 provider .


def Func(arg_0, arg_1=None, arg_2=0):
    """
    Parse dataset using the parse setup structure.

    :param setup: Result of ``h2o.parse_setup()``
    :param id: an id for the frame.
    :param first_line_is_header: -1, 0, 1 if the first line is to be used as the header

    :returns: an :class:`H2OFrame` object.
    """
    assert_is_type(arg_0, dict)
    assert_is_type(arg_1, str, None)
    assert_is_type(arg_2, -1, 0, 1)
    check_frame_id(arg_1)
    if arg_1:
        arg_0["destination_frame"] = arg_1
    if arg_2 != (-1, 0, 1):
        if arg_2 not in (-1, 0, 1): raise ValueError("first_line_is_header should be -1, 0, or 1")
        arg_0["check_header"] = arg_2
    arg_3 = H2OFrame()
    arg_3._Func(arg_0)
    return arg_3

Parse dataset using the parse setup structure .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
if
not
isinstance
(
arg_1
,
list
)
:
raise
ValueError
(
'b must be a list.'
)
if
not
isinstance
(
arg_2
,
list
)
:
raise
ValueError
(
'a must be a list.'
)
if
len
(
arg_1
)
!=
3
:
raise
ValueError
(
'b must be a length 3 list.'
)
if
len
(
arg_2
)
!=
3
:
raise
ValueError
(
'a must be a length 3 list.'
)
if
not
all
(
[
is_number
(
arg_3
)
for
arg_3
in
arg_1
]
)
:
raise
ValueError
(
'all elements of b must be numbers.'
)
if
not
all
(
[
is_number
(
arg_4
)
for
arg_4
in
arg_2
]
)
:
raise
ValueError
(
'all elements of a must be numbers.'
)
arg_5
=
[
'Func'
,
'{:f}'
.
format
(
arg_1
[
0
]
)
,
'{:f}'
.
format
(
arg_1
[
1
]
)
,
'{:f}'
.
format
(
arg_1
[
2
]
)
,
'{:f}'
.
format
(
arg_2
[
0
]
)
,
'{:f}'
.
format
(
arg_2
[
1
]
)
,
'{:f}'
.
format
(
arg_2
[
2
]
)
]
arg_0
.
effects
.
extend
(
arg_5
)
arg_0
.
effects_log
.
append
(
'Func'
)
return
arg_0

def Func(arg_0, arg_1, arg_2):
        '''Apply a Func IIR filter with the given coefficients.

        Parameters
        ----------
        b : list of floats
            Numerator coefficients. Must be length 3
        a : list of floats
            Denominator coefficients. Must be length 3

        See Also
        --------
        fir, treble, bass, equalizer

        '''
        if not isinstance(arg_1, list):
            raise ValueError('b must be a list.')

        if not isinstance(arg_2, list):
            raise ValueError('a must be a list.')

        if len(arg_1) != 3:
            raise ValueError('b must be a length 3 list.')

        if len(arg_2) != 3:
            raise ValueError('a must be a length 3 list.')

        if not all([is_number(arg_3) for arg_3 in arg_1]):
            raise ValueError('all elements of b must be numbers.')

        if not all([is_number(arg_4) for arg_4 in arg_2]):
            raise ValueError('all elements of a must be numbers.')

        arg_5 = [
            'Func', '{:f}'.format(arg_1[0]), '{:f}'.format(arg_1[1]),
            '{:f}'.format(arg_1[2]), '{:f}'.format(arg_2[0]),
            '{:f}'.format(arg_2[1]), '{:f}'.format(arg_2[2])
        ]

        arg_0.effects.extend(arg_5)
        arg_0.effects_log.append('Func')
        return arg_0

Apply a biquad IIR filter with the given coefficients.

        Parameters
        ----------
        b : list of floats
            Numerator coefficients. Must be length 3
        a : list of floats
            Denominator coefficients. Must be length 3

        See Also
        --------
        fir, treble, bass, equalizer

Apply a biquad IIR filter with the given coefficients .


def Func ( arg_0 , arg_1 = None , ** arg_2 ) : if arg_1 is None : arg_1 = dom_tag arg_3 = [ ( dom_tag . clean_attribute ( attr ) , arg_7 ) for attr , arg_7 in arg_2 . items ( ) ] arg_4 = [ ] for arg_5 in arg_0 . children : if ( isinstance ( arg_1 , basestring ) and type ( arg_5 ) . __name__ == arg_1 ) or ( not isinstance ( arg_1 , basestring ) and isinstance ( arg_5 , arg_1 ) ) : if all ( arg_5 . attributes . Func ( arg_6 ) == arg_7 for arg_6 , arg_7 in arg_3 ) : arg_4 . append ( arg_5 ) if isinstance ( arg_5 , dom_tag ) : arg_4 . extend ( arg_5 . Func ( arg_1 , ** arg_2 ) ) return arg_4

def Func(arg_0, arg_1=None, **arg_2):
    '''
    Recursively searches children for tags of a certain
    type with matching attributes.
    '''
    # Stupid workaround since we can not use dom_tag in the method declaration
    if arg_1 is None: arg_1 = dom_tag

    arg_3 = [(dom_tag.clean_attribute(attr), arg_7)
        for attr, arg_7 in arg_2.items()]

    arg_4 = []
    for arg_5 in arg_0.children:
      if (isinstance(arg_1, basestring) and type(arg_5).__name__ == arg_1) or \
        (not isinstance(arg_1, basestring) and isinstance(arg_5, arg_1)):

        if all(arg_5.attributes.Func(arg_6) == arg_7
            for arg_6, arg_7 in arg_3):
          # If the child is of correct type and has all attributes and values
          # in kwargs add as a result
          arg_4.append(arg_5)
      if isinstance(arg_5, dom_tag):
        # If the child is a dom_tag extend the search down through its children
        arg_4.extend(arg_5.Func(arg_1, **arg_2))
    return arg_4

Recursively searches children for tags of a certain type with matching attributes .


(self, queues=None, edge=None, edge_type=None, return_header=False)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=False):
        """Gets data from queues and organizes it by agent.

        If none of the parameters are given then data from every
        :class:`.QueueServer` is retrieved.

        Parameters
        ----------
        queues : int or *array_like* (optional)
            The edge index (or an iterable of edge indices) identifying
            the :class:`QueueServer(s)<.QueueServer>` whose data will
            be retrieved.
        edge : 2-tuple of int or *array_like* (optional)
            Explicitly specify which queues to retrieve agent data
            from. Must be either:

            * A 2-tuple of the edge's source and target vertex
              indices, or
            * An iterable of 2-tuples of the edge's source and
              target vertex indices.

        edge_type : int or an iterable of int (optional)
            A integer, or a collection of integers identifying which
            edge types to retrieve agent data from.
        return_header : bool (optonal, default: False)
            Determines whether the column headers are returned.

        Returns
        -------
        dict
            Returns a ``dict`` where the keys are the
            :class:`Agent's<.Agent>` ``agent_id`` and the values are
            :class:`ndarrays<~numpy.ndarray>` for that
            :class:`Agent's<.Agent>` data. The columns of this array
            are as follows:

            * First: The arrival time of an agent.
            * Second: The service start time of an agent.
            * Third: The departure time of an agent.
            * Fourth: The length of the queue upon the agents arrival.
            * Fifth: The total number of :class:`Agents<.Agent>` in the
              :class:`.QueueServer`.
            * Sixth: the :class:`QueueServer's<.QueueServer>` id
              (its edge index).

        headers : str (optional)
            A comma seperated string of the column headers. Returns
            ``'arrival,service,departure,num_queued,num_total,q_id'``
        """
        arg_1 = _get_queues(arg_0.g, arg_1, arg_2, arg_3)

        arg_5 = {}
        for arg_6 in arg_1:
            for arg_7, arg_8 in arg_0.edge2queue[arg_6].data.items():
                arg_9 = np.zeros((len(arg_8), 6))
                arg_9[:, :5] = np.array(arg_8)
                arg_9[:, 5] = arg_6
                if arg_7 in arg_5:
                    arg_5[arg_7] = np.vstack((arg_5[arg_7], arg_9))
                else:
                    arg_5[arg_7] = arg_9

        arg_10 = [
            ('a', float),
            ('s', float),
            ('d', float),
            ('q', float),
            ('n', float),
            ('id', float)
        ]
        for arg_7, arg_8 in arg_5.items():
            arg_9 = np.array([tuple(d) for d in arg_8.tolist()], dtype=arg_10)
            arg_9 = np.sort(arg_9, order='a')
            arg_5[arg_7] = np.array([tuple(d) for d in arg_9])

        if arg_4:
            return arg_5, 'arrival,service,departure,num_queued,num_total,q_id'

        return arg_5

Gets data from queues and organizes it by agent .


def Func ( arg_0 ) : if arg_0 . color == BLACK : return PIECE_SYMBOLS [ arg_0 . piece_type ] . upper ( ) else : return PIECE_SYMBOLS [ arg_0 . piece_type ]

def Func(arg_0):
        '''
        Gets the Func `p`, `l`, `n`, etc.
        '''
        if arg_0.color == BLACK:
            return PIECE_SYMBOLS[arg_0.piece_type].upper()
        else:
            return PIECE_SYMBOLS[arg_0.piece_type]


def Func ( arg_0 , arg_1 = False ) : if arg_0 . bitfinex_config : arg_0 . send ( ** arg_0 . bitfinex_config ) arg_2 = [ ] while True : try : arg_3 , arg_4 = arg_0 . channel_configs . popitem ( last = True if arg_1 else False ) except KeyError : break arg_2 . append ( ( arg_3 , arg_4 . copy ( ) ) ) if arg_3 == 'auth' : arg_0 . send ( ** arg_4 , auth = True ) continue if arg_1 : arg_4 [ 'event' ] = 'unsubscribe' arg_0 . send ( ** arg_4 ) if arg_1 : for arg_3 , arg_4 in reversed ( arg_2 ) : arg_0 . channel_configs [ arg_3 ] = arg_4 arg_0 . send ( ** arg_4 ) else : for arg_3 , arg_4 in arg_2 : arg_0 . channel_configs [ arg_3 ] = arg_4

def Func(arg_0, arg_1=False):
        """Resubscribes to all channels found in self.channel_configs.

        :param soft: if True, unsubscribes first.
        :return: None
        """
        # Restore non-default Bitfinex websocket configuration
        if arg_0.bitfinex_config:
            arg_0.send(**arg_0.bitfinex_config)
        arg_2 = []
        while True:
            try:
                arg_3, arg_4 = arg_0.channel_configs.popitem(last=True if arg_1 else False)
            except KeyError:
                break
            arg_2.append((arg_3, arg_4.copy()))
            if arg_3 == 'auth':
                arg_0.send(**arg_4, auth=True)
                continue
            if arg_1:
                arg_4['event'] = 'unsubscribe'
            arg_0.send(**arg_4)

        # Resubscribe for soft start.
        if arg_1:
            for arg_3, arg_4 in reversed(arg_2):
                arg_0.channel_configs[arg_3] = arg_4
                arg_0.send(**arg_4)
        else:
            for arg_3, arg_4 in arg_2:
                arg_0.channel_configs[arg_3] = arg_4

Resubscribes to all channels found in self . channel_configs .


(self, project_id, operation_name, zone=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
)
:
arg_4
=
arg_0
.
get_conn
(
)
while
True
:
if
arg_3
is
:
arg_5
=
arg_0
.
_check_global_operation_status
(
arg_4
,
arg_2
,
arg_1
)
else
:
arg_5
=
arg_0
.
_check_zone_operation_status
(
arg_4
,
arg_2
,
arg_1
,
arg_3
,
arg_0
.
num_retries
)
if
arg_5
.
get
(
"status"
)
==
GceOperationStatus
.
DONE
:
arg_6
=
arg_5
.
get
(
"error"
)
if
arg_6
:
arg_7
=
arg_5
.
get
(
"httpErrorStatusCode"
)
arg_8
=
arg_5
.
get
(
"httpErrorMessage"
)
arg_9
=
str
(
arg_6
.
get
(
"errors"
)
)
[
1
:
1
]
raise
AirflowException
(
"{} {}: "
.
format
(
arg_7
,
arg_8
)
+
arg_9
)
return
time
.
sleep
(
TIME_TO_SLEEP_IN_SECONDS
)

def Func(arg_0, arg_1, arg_2, arg_3=None):
        """
        Waits for the named operation to complete - checks status of the async call.

        :param operation_name: name of the operation
        :type operation_name: str
        :param zone: optional region of the request (might be None for global operations)
        :type zone: str
        :return: None
        """
        arg_4 = arg_0.get_conn()
        while True:
            if arg_3 is None:
                # noinspection PyTypeChecker
                arg_5 = arg_0._check_global_operation_status(
                    arg_4, arg_2, arg_1)
            else:
                # noinspection PyTypeChecker
                arg_5 = arg_0._check_zone_operation_status(
                    arg_4, arg_2, arg_1, arg_3, arg_0.num_retries)
            if arg_5.get("status") == GceOperationStatus.DONE:
                arg_6 = arg_5.get("error")
                if arg_6:
                    arg_7 = arg_5.get("httpErrorStatusCode")
                    arg_8 = arg_5.get("httpErrorMessage")
                    # Extracting the errors list as string and trimming square braces
                    arg_9 = str(arg_6.get("errors"))[1:-1]
                    raise AirflowException("{} {}: ".format(arg_7, arg_8) + arg_9)
                # No meaningful info to return from the response in case of success
                return
            time.sleep(TIME_TO_SLEEP_IN_SECONDS)

Waits for the named operation to complete - checks status of the async call .


def Func(arg_0):
    '''
    Encode an UTF-8 string into MQTT format.
    Returns a bytearray
    '''
    arg_1 = bytearray(2)
    arg_1.extend(bytearray(arg_0, encoding='utf-8'))
    arg_2 = len(arg_1)-2
    if(arg_2 > 65535):
        raise StringValueError(arg_2)
    arg_1[0] = arg_2 >> 8
    arg_1[1] = arg_2 & 0xFF
    return arg_1

Encode an UTF - 8 string into MQTT format . Returns a bytearray


def Func(arg_0):
        """ Don't use this, use document.draw_table """
        arg_0._compile()
        arg_0.rows[0]._advance_first_row()
        arg_0._set_borders()
        arg_0.Func_fill()
        arg_0.Func_borders()
        arg_0.Func_text()
        arg_0._set_final_cursor()

Don t use this use document . draw_table


def Func ( arg_0 ) : Func = set ( [ ] ) arg_0 . _depth_ascend ( arg_0 , Func ) try : Func . remove ( arg_0 ) except KeyError : pass return list ( Func )

def Func(arg_0):
        """Returns a list of the ancestors of this node."""
        Func = set([])
        arg_0._depth_ascend(arg_0, Func)
        try:
            Func.remove(arg_0)
        except KeyError:
            # we weren't ancestor of ourself, that's ok
            pass

        return list(Func)

Returns a list of the ancestors of this node .


def
Func
(
arg_0
,
arg_1
)
:
if
not
arg_1
:
arg_0
.
help_fn
(
topic
=
'minimum_help'
)
return
OK
arg_0
.
classic
=
arg_1
[
0
]
.
startswith
(
'-'
)
if
arg_0
.
classic
:
arg_3
=
ClassicOptionParser
(
)
else
:
arg_3
=
CMDS
.
get
(
arg_1
[
0
]
)
if
not
arg_3
:
arg_0
.
help_fn
(
"Unknown command: '%s'"
%
arg_1
[
0
]
)
return
ERR
arg_1
=
arg_1
[
1
:
]
arg_3
.
help_fn
=
arg_0
.
help_fn
arg_5
,
arg_6
,
arg_7
=
arg_3
.
parse_args
(
arg_1
)
if
not
arg_5
:
return
ERR
if
arg_0
.
do_help
(
arg_6
,
arg_7
,
arg_3
)
:
return
OK
if
not
arg_0
.
args_ok
(
arg_6
,
arg_7
)
:
return
ERR
arg_8
=
unshell_list
(
arg_6
.
source
)
arg_9
=
unshell_list
(
arg_6
.
omit
)
arg_10
=
unshell_list
(
arg_6
.
include
)
arg_11
=
unshell_list
(
arg_6
.
debug
)
arg_0
.
coverage
=
arg_0
.
covpkg
.
coverage
(
data_suffix
=
arg_6
.
parallel_mode
,
cover_pylib
=
arg_6
.
pylib
,
timid
=
arg_6
.
timid
,
branch
=
arg_6
.
branch
,
config_file
=
arg_6
.
rcfile
,
arg_8
=
arg_8
,
arg_9
=
arg_9
,
arg_10
=
arg_10
,
arg_11
=
arg_11
,
)
if
'debug'
in
arg_6
.
actions
:
return
arg_0
.
do_debug
(
arg_7
)
if
'erase'
in
arg_6
.
actions
or
arg_6
.
erase_first
:
arg_0
.
coverage
.
erase
(
)
else
:
arg_0
.
coverage
.
load
(
)
if
'execute'
in
arg_6
.
actions
:
arg_0
.
do_execute
(
arg_6
,
arg_7
)
if
'combine'
in
arg_6
.
actions
:
arg_0
.
coverage
.
combine
(
)
arg_0
.
coverage
.
save
(
)
arg_13
=
dict
(
morfs
=
arg_7
,
ignore_errors
=
arg_6
.
ignore_errors
,
arg_9
=
arg_9
,
arg_10
=
arg_10
,
)
if
'report'
in
arg_6
.
actions
:
arg_14
=
arg_0
.
coverage
.
report
(
show_missing
=
arg_6
.
show_missing
,
**
arg_13
)
if
'annotate'
in
arg_6
.
actions
:
arg_0
.
coverage
.
annotate
(
directory
=
arg_6
.
directory
,
**
arg_13
)
if
'html'
in
arg_6
.
actions
:
arg_14
=
arg_0
.
coverage
.
html_report
(
directory
=
arg_6
.
directory
,
title
=
arg_6
.
title
,
**
arg_13
)
if
'xml'
in
arg_6
.
actions
:
arg_15
=
arg_6
.
outfile
arg_14
=
arg_0
.
coverage
.
xml_report
(
arg_15
=
arg_15
,
**
arg_13
)
if
arg_6
.
fail_under
is
not
:
if
arg_14
>=
arg_6
.
fail_under
:
return
OK
else
:
return
FAIL_UNDER
else
:
return
OK

def Func(arg_0, arg_1):
        """The bulk of the command line interface to Coverage.

        `argv` is the argument list to process.

        Returns 0 if all is well, 1 if something went wrong.

        """
        # Collect the command-line options.
        if not arg_1:
            arg_0.help_fn(topic='minimum_help')
            return OK

        # The command syntax we parse depends on the first argument.  Classic
        # syntax always starts with an option.
        arg_0.classic = arg_1[0].startswith('-')
        if arg_0.classic:
            arg_3 = ClassicOptionParser()
        else:
            arg_3 = CMDS.get(arg_1[0])
            if not arg_3:
                arg_0.help_fn("Unknown command: '%s'" % arg_1[0])
                return ERR
            arg_1 = arg_1[1:]

        arg_3.help_fn = arg_0.help_fn
        arg_5, arg_6, arg_7 = arg_3.parse_args(arg_1)
        if not arg_5:
            return ERR

        # Handle help and version.
        if arg_0.do_help(arg_6, arg_7, arg_3):
            return OK

        # Check for conflicts and problems in the options.
        if not arg_0.args_ok(arg_6, arg_7):
            return ERR

        # Listify the list options.
        arg_8 = unshell_list(arg_6.source)
        arg_9 = unshell_list(arg_6.omit)
        arg_10 = unshell_list(arg_6.include)
        arg_11 = unshell_list(arg_6.debug)

        # Do something.
        arg_0.coverage = arg_0.covpkg.coverage(
            data_suffix = arg_6.parallel_mode,
            cover_pylib = arg_6.pylib,
            timid = arg_6.timid,
            branch = arg_6.branch,
            config_file = arg_6.rcfile,
            arg_8 = arg_8,
            arg_9 = arg_9,
            arg_10 = arg_10,
            arg_11 = arg_11,
            )

        if 'debug' in arg_6.actions:
            return arg_0.do_debug(arg_7)

        if 'erase' in arg_6.actions or arg_6.erase_first:
            arg_0.coverage.erase()
        else:
            arg_0.coverage.load()

        if 'execute' in arg_6.actions:
            arg_0.do_execute(arg_6, arg_7)

        if 'combine' in arg_6.actions:
            arg_0.coverage.combine()
            arg_0.coverage.save()

        # Remaining actions are reporting, with some common options.
        arg_13 = dict(
            morfs = arg_7,
            ignore_errors = arg_6.ignore_errors,
            arg_9 = arg_9,
            arg_10 = arg_10,
            )

        if 'report' in arg_6.actions:
            arg_14 = arg_0.coverage.report(
                show_missing=arg_6.show_missing, **arg_13)
        if 'annotate' in arg_6.actions:
            arg_0.coverage.annotate(
                directory=arg_6.directory, **arg_13)
        if 'html' in arg_6.actions:
            arg_14 = arg_0.coverage.html_report(
                directory=arg_6.directory, title=arg_6.title,
                **arg_13)
        if 'xml' in arg_6.actions:
            arg_15 = arg_6.outfile
            arg_14 = arg_0.coverage.xml_report(arg_15=arg_15, **arg_13)

        if arg_6.fail_under is not None:
            if arg_14 >= arg_6.fail_under:
                return OK
            else:
                return FAIL_UNDER
        else:
            return OK

The bulk of the command line interface to Coverage .