def Func ( arg_0 ) : arg_1 = arg_0 . get_settings ( ) arg_2 = asbool ( arg_1 . get ( 'baka_model.should_create_all' , False ) ) arg_3 = asbool ( arg_1 . get ( 'baka_model.should_drop_all' , False ) ) arg_0 . add_settings ( { "retry.attempts" : 3 , "tm.activate_hook" : tm_activate_hook , "tm.annotate_user" : False , } ) arg_0 . include ( 'pyramid_retry' ) arg_0 . include ( 'pyramid_tm' ) arg_4 = get_engine ( arg_1 ) arg_5 = get_session_factory ( arg_4 ) arg_0 . registry [ 'db_session_factory' ] = arg_5 arg_0 . add_request_method ( lambda r : get_tm_session ( arg_5 , r . tm ) , 'db' , reify = True ) arg_0 . include ( '.service' ) arg_0 . action ( None , bind_engine , ( arg_4 , ) , { 'should_create' : arg_2 , 'should_drop' : arg_3 } , order = 10 )

def Func(arg_0):
    """
    Initialize the model for a Pyramid app.

    Activate this setup using ``config.include('baka_model')``.

    """
    arg_1 = arg_0.get_settings()
    arg_2 = asbool(arg_1.get('baka_model.should_create_all', False))
    arg_3 = asbool(arg_1.get('baka_model.should_drop_all', False))

    # Configure the transaction manager to support retrying retryable
    # exceptions. We also register the session factory with the thread-local
    # transaction manager, so that all sessions it creates are registered.
    #    "tm.attempts": 3,
    arg_0.add_settings({
        "retry.attempts": 3,
        "tm.activate_hook": tm_activate_hook,
        "tm.annotate_user": False,
    })

    # use pyramid_retry couse pyramid_tm disabled it
    arg_0.include('pyramid_retry')
    # use pyramid_tm to hook the transaction lifecycle to the request
    arg_0.include('pyramid_tm')

    arg_4 = get_engine(arg_1)
    arg_5 = get_session_factory(arg_4)

    arg_0.registry['db_session_factory'] = arg_5

    # make request.db available for use in Pyramid
    arg_0.add_request_method(
        # r.tm is the transaction manager used by pyramid_tm
        lambda r: get_tm_session(arg_5, r.tm),
        'db',
        reify=True
    )

    # service model factory
    arg_0.include('.service')

    # Register a deferred action to bind the engine when the configuration is
    # committed. Deferring the action means that this module can be included
    # before model modules without ill effect.
    arg_0.action(None, bind_engine, (arg_4,), {
        'should_create': arg_2,
        'should_drop': arg_3
    }, order=10)

Initialize the model for a Pyramid app .


return train_input_fn, eval_input_fn, vocabulary

def Func ( arg_0 ) : arg_1 = 1000 arg_2 = [ str ( i ) for i in range ( arg_1 ) ] arg_3 = np . random . randint ( 10 , size = ( arg_0 , arg_1 ) ) . astype ( np . float32 ) def train_input_fn ( ) : arg_4 = tf . data . Dataset . from_tensor_slices ( arg_3 ) arg_4 = arg_4 . batch ( arg_0 ) . repeat ( ) return tf . compat . v1 . data . make_one_shot_iterator ( arg_4 ) . get_next ( ) def eval_input_fn ( ) : arg_4 = tf . data . Dataset . from_tensor_slices ( arg_3 ) arg_4 = arg_4 . batch ( arg_0 ) return tf . compat . v1 . data . make_one_shot_iterator ( arg_4 ) . get_next ( ) return train_input_fn , eval_input_fn , arg_2

def Func(arg_0):
  """Builds fake data for unit testing."""
  arg_1 = 1000
  arg_2 = [str(i) for i in range(arg_1)]

  arg_3 = np.random.randint(
      10, size=(arg_0, arg_1)).astype(np.float32)

  def train_input_fn():
    arg_4 = tf.data.Dataset.from_tensor_slices(arg_3)
    arg_4 = arg_4.batch(arg_0).repeat()
    return tf.compat.v1.data.make_one_shot_iterator(arg_4).get_next()

  def eval_input_fn():
    arg_4 = tf.data.Dataset.from_tensor_slices(arg_3)
    arg_4 = arg_4.batch(arg_0)
    return tf.compat.v1.data.make_one_shot_iterator(arg_4).get_next()

  return train_input_fn, eval_input_fn, arg_2


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_1
=
_get_stash
(
arg_3
,
arg_1
,
arg_2
)
for
arg_4
in
arg_0
:
try
:
click
.
echo
(
'Deleting key {0}...'
.
format
(
arg_4
)
)
arg_1
.
delete
(
arg_0
=
arg_4
)
except
GhostError
as
ex
:
sys
.
exit
(
ex
)
click
.
echo
(
'Keys deleted successfully'
)

def Func(arg_0, arg_1, arg_2, arg_3):
    """Delete a key from the stash

    `KEY_NAME` is the name of the key to delete
    You can provide that multiple times to delete multiple keys at once
    """
    arg_1 = _get_stash(arg_3, arg_1, arg_2)

    for arg_4 in arg_0:
        try:
            click.echo('Deleting key {0}...'.format(arg_4))
            arg_1.delete(arg_0=arg_4)
        except GhostError as ex:
            sys.exit(ex)
    click.echo('Keys deleted successfully')


return HttpResponse(
            self.convert_context_to_json(context),
            content_type='application/json',
            **kwargs
        )

def Func ( arg_0 , arg_1 , ** arg_2 ) : return HttpResponse ( arg_0 . convert_context_to_json ( arg_1 ) , content_type = 'application/json' , ** arg_2 )

def Func(arg_0, arg_1, **arg_2):
        """
        Returns a JSON response, transforming 'context' to make the payload.
        """
        return HttpResponse(
            arg_0.convert_context_to_json(arg_1),
            content_type='application/json',
            **arg_2
        )

Returns a JSON response transforming context to make the payload .


def Func ( arg_0 ) : arg_1 = bs4 . BeautifulSoup ( arg_0 , "html.parser" ) try : arg_1 . select ( 'div.paginator' ) [ 0 ] except IndexError : return 1 else : return int ( arg_1 . select ( 'div.paginator' ) [ 0 ] . attrs [ 'data-num-pages' ] )

def Func(arg_0):
        """Parse number of answer pages to paginate over them.

        :param html_question: raw HTML question element

        :returns: an integer with the number of pages
        """
        arg_1 = bs4.BeautifulSoup(arg_0, "html.parser")
        try:
            arg_1.select('div.paginator')[0]
        except IndexError:
            return 1
        else:
            return int(arg_1.select('div.paginator')[0].attrs['data-num-pages'])

Parse number of answer pages to paginate over them .


def Func ( arg_0 , arg_1 ) : arg_2 = inventory . Category arg_3 = { arg_2 . RENDER_TYPE_QUANTITY : _QuantityBoxProductsForm , arg_2 . RENDER_TYPE_RADIO : _RadioButtonProductsForm , arg_2 . RENDER_TYPE_ITEM_QUANTITY : _ItemQuantityProductsForm , arg_2 . RENDER_TYPE_CHECKBOX : _CheckboxProductsForm , } class Func ( arg_3 [ arg_0 . render_type ] ) : pass arg_1 = list ( arg_1 ) arg_1 . sort ( key = lambda prod : prod . order ) Func . set_fields ( arg_0 , arg_1 ) if arg_0 . render_type == inventory . Category . RENDER_TYPE_ITEM_QUANTITY : Func = forms . formset_factory ( Func , formset = _ItemQuantityProductsFormSet , ) return Func

def Func(arg_0, arg_1):
    ''' Produces an appropriate _ProductsForm subclass for the given render
    type. '''

    # Each Category.RENDER_TYPE value has a subclass here.
    arg_2 = inventory.Category
    arg_3 = {
        arg_2.RENDER_TYPE_QUANTITY: _QuantityBoxProductsForm,
        arg_2.RENDER_TYPE_RADIO: _RadioButtonProductsForm,
        arg_2.RENDER_TYPE_ITEM_QUANTITY: _ItemQuantityProductsForm,
        arg_2.RENDER_TYPE_CHECKBOX: _CheckboxProductsForm,
    }

    # Produce a subclass of _ProductsForm which we can alter the base_fields on
    class Func(arg_3[arg_0.render_type]):
        pass

    arg_1 = list(arg_1)
    arg_1.sort(key=lambda prod: prod.order)

    Func.set_fields(arg_0, arg_1)

    if arg_0.render_type == inventory.Category.RENDER_TYPE_ITEM_QUANTITY:
        Func = forms.formset_factory(
            Func,
            formset=_ItemQuantityProductsFormSet,
        )

    return Func

Produces an appropriate _ProductsForm subclass for the given render type .


def Func ( arg_0 ) : arg_1 = 0 for arg_2 in arg_0 : if '0' <= arg_2 <= '9' : arg_3 = ord ( '0' ) elif 'a' <= arg_2 <= 'f' : arg_3 = ord ( 'a' ) - 10 elif 'A' <= arg_2 <= 'F' : arg_3 = ord ( 'A' ) - 10 else : break arg_1 = arg_1 * 16 + ( ord ( arg_2 ) - arg_3 ) return arg_1

def Func(arg_0):
    """Get the integer value of a hexadecimal number."""
    arg_1 = 0
    for arg_2 in arg_0:
        if '0' <= arg_2 <= '9':
            arg_3 = ord('0')
        elif 'a' <= arg_2 <= 'f':
            arg_3 = ord('a')-10
        elif 'A' <= arg_2 <= 'F':
            arg_3 = ord('A')-10
        else:
            break
        arg_1 = arg_1*16 + (ord(arg_2) - arg_3)
    return arg_1

Get the integer value of a hexadecimal number .


return defer.fail(MQTTStateError("Unexpected connect() operation", state))

def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
__class__
.
__name__
return
defer
.
fail
(
MQTTStateError
(
"Unexpected Func() operation"
,
arg_2
)
)

def Func(arg_0, arg_1):
        '''
        Send a CONNECT control packet.
        '''
        arg_2 = arg_0.__class__.__name__
        return defer.fail(MQTTStateError("Unexpected Func() operation", arg_2))


def Func ( arg_0 ) : arg_1 = minidom . parseString ( arg_0 ) arg_2 = ServiceBusRegion ( ) for arg_3 in _MinidomXmlToObject . get_children_from_path ( arg_1 , 'entry' , 'content' , 'RegionCodeDescription' ) : arg_4 = _MinidomXmlToObject . get_first_child_node_value ( arg_3 , 'Code' ) if arg_4 is not None : arg_2 . code = arg_4 arg_4 = _MinidomXmlToObject . get_first_child_node_value ( arg_3 , 'FullName' ) if arg_4 is not None : arg_2 . fullname = arg_4 return arg_2

def Func(arg_0):
        '''Converts xml response to service bus region

        The xml format for region:
<entry>
<id>uuid:157c311f-081f-4b4a-a0ba-a8f990ffd2a3;id=1756759</id>
<title type="text"></title>
<updated>2013-04-10T18:25:29Z</updated>
<content type="application/xml">
    <RegionCodeDescription
        xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"
        xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    East Asia
    <FullName>East Asia</FullName>
    </RegionCodeDescription>
</content>
</entry>
          '''
        arg_1 = minidom.parseString(arg_0)
        arg_2 = ServiceBusRegion()

        for arg_3 in _MinidomXmlToObject.get_children_from_path(arg_1, 'entry', 'content',
                                            'RegionCodeDescription'):
            arg_4 = _MinidomXmlToObject.get_first_child_node_value(arg_3, 'Code')
            if arg_4 is not None:
                arg_2.code = arg_4
            arg_4 = _MinidomXmlToObject.get_first_child_node_value(arg_3, 'FullName')
            if arg_4 is not None:
                arg_2.fullname = arg_4

        return arg_2


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
arg_0
.
get
(
arg_1
,
quiet
=
True
)
if
arg_3
is
not
:
if
arg_3
.
image
is
not
:
arg_4
=
os
.
path
.
dirname
(
arg_3
.
image
)
arg_5
=
parse_image_name
(
remove_uri
(
arg_2
)
)
arg_6
=
os
.
path
.
join
(
arg_0
.
storage
,
os
.
path
.
dirname
(
arg_5
[
'storage'
]
)
)
if
not
os
.
path
.
exists
(
arg_6
)
:
os
.
mkdir
(
arg_6
)
arg_7
=
os
.
path
.
abspath
(
os
.
path
.
join
(
arg_4
,
arg_5
[
'storage'
]
)
)
arg_3
=
arg_0
.
cp
(
move_to
=
arg_7
,
arg_3
=
arg_3
,
command
=
"Func"
)
if
arg_3
is
not
:
arg_3
.
uri
=
arg_5
[
'uri'
]
arg_0
.
session
.
commit
(
)
return
arg_3
bot
.
warning
(
'%s not found'
%
(
arg_1
)
)

def Func(arg_0, arg_1, arg_2):
    '''Func performs a move, but ensures the path is maintained in storage

       Parameters
       ==========
       image_name: the image name (uri) to Func to.
       path: the name to Func (basename is taken)

    '''
    arg_3 = arg_0.get(arg_1, quiet=True)

    if arg_3 is not None:
        if arg_3.image is not None:

            # The original directory for the container stays the same
            arg_4 = os.path.dirname(arg_3.image)

            # But we derive a new filename and uri

            arg_5 = parse_image_name( remove_uri (arg_2) )
            arg_6 = os.path.join( arg_0.storage,
                                    os.path.dirname(arg_5['storage']) )

            # This is the collection folder

            if not os.path.exists(arg_6):
                os.mkdir(arg_6)

            # Here we get the new full path, Func the container file

            arg_7 = os.path.abspath(os.path.join(arg_4, arg_5['storage']))
            arg_3 = arg_0.cp(move_to=arg_7,
                                arg_3=arg_3,
                                command="Func")

            # On successful Func of file, update the uri

            if arg_3 is not None:
                arg_3.uri = arg_5['uri']
                arg_0.session.commit()
                return arg_3

    bot.warning('%s not found' %(arg_1))

rename performs a move, but ensures the path is maintained in storage

       Parameters
       ==========
       image_name: the image name (uri) to rename to.
       path: the name to rename (basename is taken)

rename performs a move but ensures the path is maintained in storage


(
        featuresdir,
        magcol,
        outfile,
        pklglob='varfeatures-*.pkl',
        featurestouse=NONPERIODIC_FEATURES_TO_COLLECT,
        maxobjects=None,
        labeldict=None,
        labeltype='binary',
)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
'varfeatures-*.pkl'
,
arg_4
=
arg_5
,
arg_6
=
,
arg_7
=
,
arg_8
=
'binary'
,
)
:
arg_9
=
glob
.
glob
(
os
.
path
.
join
(
arg_0
,
arg_3
)
)
if
arg_6
:
arg_9
=
arg_9
[
:
arg_6
]
if
TQDM
:
arg_10
=
tqdm
(
arg_9
)
else
:
arg_10
=
arg_9
arg_11
=
{
'objectids'
:
[
]
,
'magcol'
:
arg_1
,
'availablefeatures'
:
[
]
}
LOGINFO
(
'collecting features for magcol: %s'
%
arg_1
)
for
arg_12
in
arg_10
:
with
open
(
arg_12
,
'rb'
)
as
infd
:
arg_13
=
pickle
.
load
(
infd
)
arg_14
=
arg_13
[
'objectid'
]
if
arg_14
not
in
arg_11
[
'objectids'
]
:
arg_11
[
'objectids'
]
.
append
(
arg_14
)
arg_15
=
arg_13
[
arg_1
]
if
arg_4
and
len
(
arg_4
)
>
0
:
arg_16
=
arg_4
else
:
arg_16
=
arg_5
for
arg_17
in
arg_16
:
if
(
(
arg_17
not
in
arg_11
[
'availablefeatures'
]
)
and
(
arg_17
in
arg_15
)
)
:
arg_11
[
'availablefeatures'
]
.
append
(
arg_17
)
arg_11
[
arg_17
]
=
[
]
if
arg_17
in
arg_15
:
arg_11
[
arg_17
]
.
append
(
arg_15
[
arg_17
]
)
for
arg_18
in
arg_11
[
'availablefeatures'
]
:
arg_11
[
arg_18
]
=
np
.
array
(
arg_11
[
arg_18
]
)
arg_11
[
'objectids'
]
=
np
.
array
(
arg_11
[
'objectids'
]
)
arg_19
=
np
.
column_stack
(
[
arg_11
[
arg_18
]
for
arg_18
in
arg_11
[
'availablefeatures'
]
]
)
arg_11
[
'features_array'
]
=
arg_19
if
isinstance
(
arg_7
,
dict
)
:
arg_20
=
np
.
zeros
(
arg_11
[
'objectids'
]
.
size
,
dtype
=
np
.
int64
)
for
arg_21
,
arg_14
in
enumerate
(
arg_11
[
'objectids'
]
)
:
if
arg_14
in
arg_7
:
if
arg_8
==
'binary'
:
if
arg_7
[
arg_14
]
:
arg_20
[
arg_21
]
=
1
elif
arg_8
==
'classes'
:
arg_20
[
arg_21
]
=
arg_7
[
arg_14
]
arg_11
[
'labels_array'
]
=
arg_20
arg_11
[
'kwargs'
]
=
{
'pklglob'
:
arg_3
,
'featurestouse'
:
arg_4
,
'maxobjects'
:
arg_6
,
'labeltype'
:
arg_8
}
with
open
(
arg_2
,
'wb'
)
as
outfd
:
pickle
.
dump
(
arg_11
,
outfd
,
pickle
.
HIGHEST_PROTOCOL
)
return
arg_11

def Func(
        arg_0,
        arg_1,
        arg_2,
        arg_3='varfeatures-*.pkl',
        arg_4=arg_5,
        arg_6=None,
        arg_7=None,
        arg_8='binary',
):
    '''This collects variability features into arrays for use with the classifer.

    Parameters
    ----------

    featuresdir : str
        This is the directory where all the varfeatures pickles are. Use
        `pklglob` to specify the glob to search for. The `varfeatures` pickles
        contain objectids, a light curve magcol, and features as dict
        key-vals. The :py:mod:`astrobase.lcproc.lcvfeatures` module can be used
        to produce these.

    magcol : str
        This is the key in each varfeatures pickle corresponding to the magcol
        of the light curve the variability features were extracted from.

    outfile : str
        This is the filename of the output pickle that will be written
        containing a dict of all the features extracted into np.arrays.

    pklglob : str
        This is the UNIX file glob to use to search for varfeatures pickle files
        in `featuresdir`.

    featurestouse : list of str
        Each varfeatures pickle can contain any combination of non-periodic,
        stellar, and periodic features; these must have the same names as
        elements in the list of strings provided in `featurestouse`.  This tries
        to get all the features listed in NONPERIODIC_FEATURES_TO_COLLECT by
        default. If `featurestouse` is provided as a list, gets only the
        features listed in this kwarg instead.

    maxobjects : int or None
        The controls how many pickles from the featuresdir to process. If None,
        will process all varfeatures pickles.

    labeldict : dict or None
        If this is provided, it must be a dict with the following key:val list::

            '<objectid>':<label value>

        for each objectid collected from the varfeatures pickles. This will turn
        the collected information into a training set for classifiers.

        Example: to carry out non-periodic variable feature collection of fake
        LCS prepared by :py:mod:`astrobase.fakelcs.generation`, use the value
        of the 'isvariable' dict elem from the `fakelcs-info.pkl` here, like
        so::

            labeldict={x:y for x,y in zip(fakelcinfo['objectid'],
                                          fakelcinfo['isvariable'])}

    labeltype : {'binary', 'classes'}
        This is either 'binary' or 'classes' for binary/multi-class
        classification respectively.

    Returns
    -------

    dict
        This returns a dict with all of the features collected into np.arrays,
        ready to use as input to a scikit-learn classifier.

    '''

    # list of input pickles generated by varfeatures in lcproc.py
    arg_9 = glob.glob(os.path.join(arg_0, arg_3))

    if arg_6:
        arg_9 = arg_9[:arg_6]

    # fancy progress bar with tqdm if present
    if TQDM:
        arg_10 = tqdm(arg_9)
    else:
        arg_10 = arg_9

    # go through all the varfeatures arrays

    arg_11 = {'objectids':[],'magcol':arg_1, 'availablefeatures':[]}

    LOGINFO('collecting features for magcol: %s' % arg_1)

    for arg_12 in arg_10:

        with open(arg_12,'rb') as infd:
            arg_13 = pickle.load(infd)

        # update the objectid list
        arg_14 = arg_13['objectid']
        if arg_14 not in arg_11['objectids']:
            arg_11['objectids'].append(arg_14)

        arg_15 = arg_13[arg_1]

        if arg_4 and len(arg_4) > 0:
            arg_16 = arg_4
        else:
            arg_16 = arg_5

        # collect all the features for this magcol/objectid combination
        for arg_17 in arg_16:

            # update the global feature list if necessary
            if ((arg_17 not in arg_11['availablefeatures']) and
                (arg_17 in arg_15)):

                arg_11['availablefeatures'].append(arg_17)
                arg_11[arg_17] = []

            if arg_17 in arg_15:

                arg_11[arg_17].append(
                    arg_15[arg_17]
                )

    # now that we've collected all the objects and their features, turn the list
    # into arrays, and then concatenate them
    for arg_18 in arg_11['availablefeatures']:
        arg_11[arg_18] = np.array(arg_11[arg_18])

    arg_11['objectids'] = np.array(arg_11['objectids'])

    arg_19 = np.column_stack([arg_11[arg_18] for arg_18 in
                                     arg_11['availablefeatures']])
    arg_11['features_array'] = arg_19

    # if there's a labeldict available, use it to generate a label array. this
    # feature collection is now a training set.
    if isinstance(arg_7, dict):

        arg_20 = np.zeros(arg_11['objectids'].size, dtype=np.int64)

        # populate the labels for each object in the training set
        for arg_21, arg_14 in enumerate(arg_11['objectids']):

            if arg_14 in arg_7:

                # if this is a binary classifier training set, convert bools to
                # ones and zeros
                if arg_8 == 'binary':

                    if arg_7[arg_14]:
                        arg_20[arg_21] = 1

                # otherwise, use the actual class label integer
                elif arg_8 == 'classes':
                    arg_20[arg_21] = arg_7[arg_14]

        arg_11['labels_array'] = arg_20

    arg_11['kwargs'] = {'pklglob':arg_3,
                              'featurestouse':arg_4,
                              'maxobjects':arg_6,
                              'labeltype':arg_8}

    # write the info to the output pickle
    with open(arg_2,'wb') as outfd:
        pickle.dump(arg_11, outfd, pickle.HIGHEST_PROTOCOL)

    # return the feature_dict
    return arg_11

This collects variability features into arrays for use with the classifer .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . storages . get ( arg_1 , None ) if arg_3 : if arg_3 . exists ( arg_2 ) : arg_4 = arg_3 . path ( arg_2 ) if arg_4 : return arg_4

def Func(arg_0, arg_1, arg_2):
        """
        Find a requested media file in an app's media fixtures locations.
        """
        arg_3 = arg_0.storages.get(arg_1, None)
        if arg_3:
            # only try to find a file if the source dir actually exists
            if arg_3.exists(arg_2):
                arg_4 = arg_3.path(arg_2)
                if arg_4:
                    return arg_4

Find a requested media file in an app s media fixtures locations .


f"SELECT c.id, c.realId, c.document, c._etag \FROM c WHERE c.id in ({parameter_sequence})"

'cosmosdb_storage.Func(): \provide at least one key'

async def Func(arg_0, arg_1: arg_2[arg_3]) -> dict:
        """Read storeitems from storage.

        :param keys:
        :return dict:
        """
        try:
            # check if the database and container exists and if not create
            if not arg_0.__container_exists:
                arg_0.__create_db_and_container()
            if len(arg_1) > 0:
                # create the parameters object
                arg_4 = [
                    {'name': f'@id{i}', 'value': f'{self.__sanitize_key(key)}'}
                    for i, key in enumerate(arg_1)
                    ]
                # get the names of the params
                arg_5 = ','.join(param.get('name')
                                              for param in arg_4)
                # create the query
                arg_6 = {
                    "query":
                    f"SELECT c.id, c.realId, c.document, c._etag \
FROM c WHERE c.id in ({parameter_sequence})",
                    "parameters": arg_4
                    }
                arg_7 = {'enableCrossPartitionQuery': True}
                # run the query and store the results as a list
                arg_8 = list(
                    arg_0.client.QueryItems(
                        arg_0.__container_link, arg_6, arg_7)
                    )
                # return a dict with a key and a StoreItem
                return {
                    arg_9.get('realId'): arg_0.__create_si(arg_9) for arg_9 in arg_8
                    }
            else:
                raise Exception('cosmosdb_storage.Func(): \
provide at least one key')
        except TypeError as e:
            raise e


(self, optname, value, action=None, optdict=None)

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):
        """overridden from config.OptionsProviderMixin to handle some
        special options
        """
        if arg_1 in arg_0._options_methods or arg_1 in arg_0._bw_options_methods:
            if arg_2:
                try:
                    arg_5 = arg_0._options_methods[arg_1]
                except KeyError:
                    arg_5 = arg_0._bw_options_methods[arg_1]
                    warnings.warn(
                        "%s is deprecated, replace it by %s"
                        % (arg_1, arg_1.split("-")[0]),
                        DeprecationWarning,
                    )
                arg_2 = utils._check_csv(arg_2)
                if isinstance(arg_2, (list, tuple)):
                    for arg_6 in arg_2:
                        arg_5(arg_6, ignore_unknown=True)
                else:
                    arg_5(arg_2)
                return  # no need to call Func, disable/enable methods do it
        elif arg_1 == "output-format":
            arg_0._reporter_name = arg_2
            # If the reporters are already available, load
            # the reporter class.
            if arg_0._reporters:
                arg_0._load_reporter()

        try:
            checkers.BaseTokenChecker.Func(arg_0, arg_1, arg_2, arg_3, arg_4)
        except config.UnsupportedAction:
            print("option %s can't be read from config file" % arg_1, file=sys.stderr)

overridden from config . OptionsProviderMixin to handle some special options


(fname=None, fname_tmp=None, tmpdir=None,
                save_tmpfile=False, keepext=False)

def
Func
(
arg_0
=
,
arg_1
=
,
arg_2
=
,
arg_3
=
False
,
arg_4
=
False
)
:
if
arg_0
==
':memory:'
:
yield
arg_0
return
if
arg_1
is
:
arg_5
=
os
.
path
.
basename
(
arg_0
)
arg_6
,
arg_7
=
os
.
path
.
splitext
(
arg_5
)
arg_8
=
this_dir
=
os
.
path
.
dirname
(
arg_0
)
if
not
arg_4
:
arg_6
=
arg_6
+
arg_7
arg_7
=
''
if
arg_2
:
if
arg_2
is
True
:
for
arg_9
in
possible_tmpdirs
:
if
os
.
access
(
arg_9
,
os
.
F_OK
)
:
arg_8
=
arg_9
break
arg_10
=
tempfile
.
NamedTemporaryFile
(
prefix
=
'tmp-'
+
arg_6
+
'-'
,
suffix
=
arg_7
,
dir
=
arg_8
,
delete
=
False
)
arg_1
=
arg_10
.
name
try
:
yield
arg_1
except
Exception
as
e
:
if
arg_3
:
print
(
"Temporary file is '%s'"
%
arg_1
)
else
:
os
.
unlink
(
arg_1
)
raise
try
:
os
.
rename
(
arg_1
,
arg_0
)
os
.
chmod
(
arg_0
,
0o777
&
~
current_umask
)
except
OSError
as
e
:
arg_11
=
tempfile
.
NamedTemporaryFile
(
prefix
=
'tmp-'
+
arg_6
+
'-'
,
suffix
=
arg_7
,
dir
=
this_dir
,
delete
=
False
)
shutil
.
copy
(
arg_1
,
arg_11
.
name
)
os
.
rename
(
arg_11
.
name
,
arg_0
)
os
.
chmod
(
arg_0
,
0o666
&
~
current_umask
)
os
.
unlink
(
arg_1
)

def Func(arg_0=None, arg_1=None, arg_2=None,
                arg_3=False, arg_4=False):
    """Context manager for making files with possibility of failure.

    If you are creating a file, it is possible that the code will fail
    and leave a corrupt intermediate file.  This is especially damaging
    if this is used as automatic input to another process.  This context
    manager helps by creating a temporary filename, your code runs and
    creates that temporary file, and then if no exceptions are raised,
    the context manager will move the temporary file to the original
    filename you intended to open.

    Parameters
    ----------
    fname : str
        Target filename, this file will be created if all goes well
    fname_tmp : str
        If given, this is used as the temporary filename.
    tmpdir : str or bool
        If given, put temporary files in this directory.  If `True`,
        then find a good tmpdir that is not on local filesystem.
    save_tmpfile : bool
        If true, the temporary file is not deleteted if an exception
        is raised.
    keepext : bool, default False
            If true, have tmpfile have same extension as final file.

    Returns (as context manager value)
    ----------------------------------
     fname_tmp: str
        Temporary filename to be used.  Same as `fname_tmp`
        if given as an argument.

    Raises
    ------
    Re-raises any except occuring during the context block.
    """
    # Do nothing if requesting sqlite memory DB.
    if arg_0 == ':memory:':
        yield arg_0
        return
    if arg_1 is None:
        # no tmpfile name given - compute some basic info
        arg_5 = os.path.basename(arg_0)
        arg_6, arg_7 = os.path.splitext(arg_5)
        arg_8 = this_dir = os.path.dirname(arg_0)
        # Remove filename extension, in case this matters for
        # automatic things itself.
        if not arg_4:
            arg_6 = arg_6 + arg_7
            arg_7 = ''
        if arg_2:
            # we should use a different temporary directory
            if arg_2 is True:
                # Find a directory ourself, searching some common
                # places.
                for arg_9 in possible_tmpdirs:
                    if os.access(arg_9, os.F_OK):
                        arg_8 = arg_9
                        break
        # Make the actual tmpfile, with our chosen tmpdir, directory,
        # extension.  Set it to not delete automatically, since on
        # success we will move it to elsewhere.
        arg_10 = tempfile.NamedTemporaryFile(
            prefix='tmp-' + arg_6 + '-', suffix=arg_7, dir=arg_8, delete=False)
        arg_1 = arg_10.name
    try:
        yield arg_1
    except Exception as e:
        if arg_3:
            print("Temporary file is '%s'" % arg_1)
        else:
            os.unlink(arg_1)
        raise
    # Move the file back to the original location.
    try:
        os.rename(arg_1, arg_0)
        # We have to manually set permissions.  tempfile does not use
        # umask, for obvious reasons.
        os.chmod(arg_0, 0o777 & ~current_umask)
    # 'Invalid cross-device link' - you can't rename files across
    # filesystems.  So, we have to fallback to moving it.  But, we
    # want to move it using tmpfiles also, so that the final file
    # appearing is atomic.  We use... tmpfiles.
    except OSError as e:
        # New temporary file in same directory
        arg_11 = tempfile.NamedTemporaryFile(
            prefix='tmp-' + arg_6 + '-', suffix=arg_7, dir=this_dir, delete=False)
        # Copy contents over
        shutil.copy(arg_1, arg_11.name)
        # Rename new tmpfile, unlink old one on other filesystem.
        os.rename(arg_11.name, arg_0)
        os.chmod(arg_0, 0o666 & ~current_umask)
        os.unlink(arg_1)

Context manager for making files with possibility of failure .


def Func ( arg_0 , arg_1 : arg_2 ) : if arg_0 . dst is arg_1 : arg_0 . parentStm = None return arg_0 else : return None

def Func(arg_0, arg_1: arg_2):
        """
        Cut off statements which are driver of specified signal
        """
        if arg_0.dst is arg_1:
            arg_0.parentStm = None
            return arg_0
        else:
            return None


return bool(re.match(fnmatch.translate(pattern), string,
                             re.M | re.U | re.L))

def Func ( arg_0 , arg_1 , arg_2 ) : return bool ( re . match ( fnmatch . translate ( arg_1 ) , arg_2 , re . M | re . U | re . L ) )

def Func(arg_0, arg_1, arg_2):
        """
        Match given string, by escaping regex characters
        """
        # regex flags Multi-line, Unicode, Locale
        return bool(re.match(fnmatch.translate(arg_1), arg_2,
                             re.M | re.U | re.L))

Match given string by escaping regex characters


def Func(arg_0):
        """Activate output arguments parsing"""

        arg_1 = arg_0.parser.add_argument_group('output arguments')
        arg_1.add_argument('-o', '--output', type=argparse.FileType('w'),
                           dest='outfile', default=sys.stdout,
                           help="output file")
        arg_1.add_argument('--json-line', dest='json_line', action='store_true',
                           help="produce a JSON line for each output item")


def
Func
(
arg_0
)
:
print
(
arg_0
,
end
=
'\n\n'
)
arg_1
,
arg_2
=
input
(
'Enter move (e.g. 2b): '
)
print
(
)
return
int
(
arg_1
)
1
,
ord
(
arg_2
)
ord
(
'a'
)

def Func(arg_0):
    '''Shows the board to the player on the console and asks them to
    make a move.'''
    print(arg_0, end='\n\n')
    arg_1, arg_2 = input('Enter move (e.g. 2b): ')
    print()
    return int(arg_1) - 1, ord(arg_2) - ord('a')

Shows the board to the player on the console and asks them to make a move .


def Func(arg_0, arg_1, arg_2=1.0, arg_3=None):
    """Crop image patches.

    3 steps: scale the bboxes -> clip bboxes -> crop and pad.

    Args:
        img (ndarray): Image to be cropped.
        bboxes (ndarray): Shape (k, 4) or (4, ), location of cropped bboxes.
        scale (float, optional): Scale ratio of bboxes, the default value
            1.0 means no padding.
        pad_fill (number or list): Value to be filled for padding, None for
            no padding.

    Returns:
        list or ndarray: The cropped image patches.
    """
    arg_4 = 1 if arg_0.ndim == 2 else arg_0.shape[2]
    if arg_3 is not None:
        if isinstance(arg_3, (int, float)):
            arg_3 = [arg_3 for _ in range(arg_4)]
        assert len(arg_3) == arg_4

    arg_5 = arg_1[None, ...] if arg_1.ndim == 1 else arg_1
    arg_6 = bbox_scaling(arg_5, arg_2).astype(np.int32)
    arg_7 = bbox_clip(arg_6, arg_0.shape)

    arg_8 = []
    for arg_9 in range(arg_7.shape[0]):
        arg_10, arg_11, arg_12, arg_13 = tuple(arg_7[arg_9, :])
        if arg_3 is None:
            arg_14 = arg_0[arg_11:arg_13 + 1, arg_10:arg_12 + 1, ...]
        else:
            arg_15, arg_16, arg_17, arg_18 = tuple(arg_6[arg_9, :])
            if arg_4 == 2:
                arg_19 = (arg_18 - arg_16 + 1, arg_17 - arg_15 + 1)
            else:
                arg_19 = (arg_18 - arg_16 + 1, arg_17 - arg_15 + 1, arg_4)
            arg_14 = np.array(
                arg_3, dtype=arg_0.dtype) * np.ones(
                    arg_19, dtype=arg_0.dtype)
            arg_20 = 0 if arg_15 >= 0 else -arg_15
            arg_21 = 0 if arg_16 >= 0 else -arg_16
            arg_22 = arg_12 - arg_10 + 1
            arg_23 = arg_13 - arg_11 + 1
            arg_14[arg_21:arg_21 + arg_23, arg_20:arg_20 +
                  arg_22, ...] = arg_0[arg_11:arg_11 + arg_23, arg_10:arg_10 + arg_22, ...]
        arg_8.append(arg_14)

    if arg_1.ndim == 1:
        return arg_8[0]
    else:
        return arg_8


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_1 . get ( 'Authorization' ) if arg_3 : arg_3 = arg_3 . replace ( 'Bearer' , 'OAuth2' ) arg_1 [ 'Authorization' ] = arg_3 return arg_0 , arg_1 , arg_2

def Func(arg_0, arg_1, arg_2):
    """Since weibo is a rubbish server, it does not follow the standard,
    we need to change the authorization header for it."""
    arg_3 = arg_1.get('Authorization')
    if arg_3:
        arg_3 = arg_3.replace('Bearer', 'OAuth2')
        arg_1['Authorization'] = arg_3
    return arg_0, arg_1, arg_2

Since weibo is a rubbish server it does not follow the standard we need to change the authorization header for it .


def Func ( arg_0 , arg_1 , arg_2 = None ) : if arg_2 : arg_0 . scheduler_location_watchers [ arg_1 ] . append ( arg_2 ) else : arg_3 = arg_0 . Func_path ( arg_1 ) with open ( arg_3 ) as f : arg_4 = f . read ( ) arg_5 = SchedulerLocation ( ) arg_5 . ParseFromString ( arg_4 ) return arg_5

def Func(arg_0, arg_1, arg_2=None):
    """
    Get scheduler location
    """
    if arg_2:
      arg_0.scheduler_location_watchers[arg_1].append(arg_2)
    else:
      arg_3 = arg_0.Func_path(arg_1)
      with open(arg_3) as f:
        arg_4 = f.read()
        arg_5 = SchedulerLocation()
        arg_5.ParseFromString(arg_4)
        return arg_5


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] for arg_3 in arg_0 . url_map . iter_rules ( ) : if arg_3 . rule . startswith ( arg_1 ) : arg_4 = arg_3 . rule [ len ( arg_1 ) : ] arg_2 . append ( { 'path' : arg_4 , 'endpoint' : arg_3 . endpoint , 'methods' : list ( arg_3 . methods ) } ) return arg_2

def Func(arg_0, arg_1):
        """Returns detailed information about registered blueprint routes matching the `BlueprintBundle` path

        :param app: App instance to obtain rules from
        :param base_path: Base path to return detailed route info for
        :return: List of route detail dicts
        """

        arg_2 = []

        for arg_3 in arg_0.url_map.iter_rules():
            if arg_3.rule.startswith(arg_1):
                arg_4 = arg_3.rule[len(arg_1):]
                arg_2.append({
                    'path': arg_4,
                    'endpoint': arg_3.endpoint,
                    'methods': list(arg_3.methods)
                })

        return arg_2

Returns detailed information about registered blueprint routes matching the BlueprintBundle path


def Func ( arg_0 ) : arg_1 = nav_one ( arg_0 ) . S_DT [ 17 ] ( ) arg_2 = nav_one ( arg_0 ) . S_DT [ 18 ] ( ) arg_3 = get_type_name ( arg_2 ) if arg_3 : arg_4 = ET . Element ( 'xs:simpleType' , name = arg_1 . name ) ET . SubElement ( arg_4 , 'xs:restriction' , base = arg_3 ) return arg_4

def Func(arg_0):
    '''
    Build an xsd simpleType out of a S_UDT.
    '''
    arg_1 = nav_one(arg_0).S_DT[17]()
    arg_2 = nav_one(arg_0).S_DT[18]()

    arg_3 = get_type_name(arg_2)
    if arg_3:
        arg_4 = ET.Element('xs:simpleType', name=arg_1.name)
        ET.SubElement(arg_4, 'xs:restriction', base=arg_3)

        return arg_4

Build an xsd simpleType out of a S_UDT .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = dict ( ) arg_3 [ 'token' ] = arg_1 arg_3 [ 'id' ] = arg_2 arg_4 = arg_0 . request ( 'midas.item.delete' , arg_3 ) return arg_4

def Func(arg_0, arg_1, arg_2):
        """
        Delete the item with the passed in item_id.

        :param token: A valid token for the user in question.
        :type token: string
        :param item_id: The id of the item to be deleted.
        :type item_id: int | long
        :returns: None.
        :rtype: None
        """
        arg_3 = dict()
        arg_3['token'] = arg_1
        arg_3['id'] = arg_2
        arg_4 = arg_0.request('midas.item.delete', arg_3)
        return arg_4

Delete the item with the passed in item_id .


return _InstructionId(instruction_or_id.type,
                              instruction_or_id.hex_color)

def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , tuple ) : return _InstructionId ( arg_1 ) return _InstructionId ( arg_1 . type , arg_1 . hex_color )

def Func(arg_0, arg_1):
        """The id that identifies the instruction in this cache.

        :param instruction_or_id: an :class:`instruction
          <knittingpattern.Instruction.Instruction>` or an instruction id
        :return: a :func:`hashable <hash>` object
        :rtype: tuple
        """
        if isinstance(arg_1, tuple):
            return _InstructionId(arg_1)
        return _InstructionId(arg_1.type,
                              arg_1.hex_color)

The id that identifies the instruction in this cache .


def Func(arg_0,arg_1):
        """Read DX field from file.

            dx = OpenDX.field.Func(dxfile)

        The classid is discarded and replaced with the one from the file.
        """
        arg_2 = arg_0
        arg_3 = DXParser(arg_1)
        arg_3.parse(arg_2)

Read DX field from file.

            dx = OpenDX.field.read(dxfile)

        The classid is discarded and replaced with the one from the file.


def Func ( arg_0 ) : arg_1 , arg_2 = np . where ( arg_0 . _state == 0 ) assert len ( arg_1 ) != 0 arg_3 = np . random . choice ( len ( arg_1 ) ) arg_4 = np . random . choice ( [ 1 , 2 ] , p = [ 0.9 , 0.1 ] ) arg_0 . _state [ arg_1 [ arg_3 ] , arg_2 [ arg_3 ] ] = arg_4

def Func(arg_0):
        """Adds a random tile to the grid. Assumes that it has empty fields."""

        arg_1, arg_2 = np.where(arg_0._state == 0)
        assert len(arg_1) != 0
        arg_3 = np.random.choice(len(arg_1))
        arg_4 = np.random.choice([1, 2], p=[0.9, 0.1])

        arg_0._state[arg_1[arg_3], arg_2[arg_3]] = arg_4

Adds a random tile to the grid . Assumes that it has empty fields .


def Func(arg_0):
    """Add or create the default sequences for the given project

    :param project: the project that needs default sequences
    :type project: :class:`muke.models.Project`
    :returns: None
    :rtype: None
    :raises: None
    """
    # create sequences for project
    arg_1 = [(GLOBAL_NAME, 'global sequence for project %s' % arg_0.name),
            (RNDSEQ_NAME, 'research and development sequence for project %s' % arg_0.name)]
    for arg_2, arg_3 in arg_1:
        arg_4, arg_5 = Sequence.objects.get_or_create(arg_2=arg_2, arg_0=arg_0, defaults={'description': arg_3})


def Func(arg_0, arg_1):
        """Read a single byte from the specified device."""
        assert arg_0._device is not None, 'Bus must be opened before operations are made against it!'
        arg_0._select_device(arg_1)
        return ord(arg_0._device.read(1))

Read a single byte from the specified device .


def Func ( arg_0 ) : @ wraps ( arg_0 ) def wrapped ( * arg_1 , ** arg_2 ) : arg_3 = arg_0 ( * arg_1 , ** arg_2 ) arg_4 = read_img ( arg_1 [ 0 ] ) return nib . Nifti1Image ( arg_3 , affine = arg_4 . get_affine ( ) , header = arg_4 . header ) return wrapped

def Func(arg_0):
    """ Picks a function whose first argument is an `img`, processes its
    data and returns a numpy array. This decorator wraps this numpy array
    into a nibabel.Nifti1Image."""
    @wraps(arg_0)
    def wrapped(*arg_1, **arg_2):
        arg_3 = arg_0(*arg_1, **arg_2)

        arg_4 = read_img(arg_1[0])
        return nib.Nifti1Image(arg_3, affine=arg_4.get_affine(), header=arg_4.header)

    return wrapped

Picks a function whose first argument is an img processes its data and returns a numpy array . This decorator wraps this numpy array into a nibabel . Nifti1Image .


return [
            InteractiveShellApp, # ShellApp comes before TerminalApp, because
            self.__class__,      # it will also affect subclasses (e.g. QtConsole)
            TerminalInteractiveShell,
            PromptManager,
            HistoryManager,
            ProfileDir,
            PlainTextFormatter,
            IPCompleter,
            ScriptMagics,
        ]

def Func ( arg_0 ) : return [ InteractiveShellApp , arg_0 . __class__ , TerminalInteractiveShell , PromptManager , HistoryManager , ProfileDir , PlainTextFormatter , IPCompleter , ScriptMagics , ]

def Func(arg_0):
        """This has to be in a method, for TerminalIPythonApp to be available."""
        return [
            InteractiveShellApp, # ShellApp comes before TerminalApp, because
            arg_0.__class__,      # it will also affect subclasses (e.g. QtConsole)
            TerminalInteractiveShell,
            PromptManager,
            HistoryManager,
            ProfileDir,
            PlainTextFormatter,
            IPCompleter,
            ScriptMagics,
        ]

This has to be in a method for TerminalIPythonApp to be available .


(from_url, to_filename=None,
                  chunk_size=1024 * 8, retry_count=3)

def Func ( arg_0 , arg_1 = None , arg_2 = 1024 * 8 , arg_3 = 3 ) : if not arg_1 : arg_1 = get_temporary_file ( ) arg_4 = requests . Session ( ) arg_5 = requests . adapters . HTTPAdapter ( max_retries = arg_3 ) arg_4 . mount ( arg_0 , arg_5 ) arg_6 = arg_4 . get ( arg_0 , stream = True ) with open ( arg_1 , 'wb' ) as fd : for arg_7 in arg_6 . iter_content ( arg_2 ) : fd . write ( arg_7 ) return arg_1

def Func(arg_0, arg_1=None,
                  arg_2=1024 * 8, arg_3=3):
    """Download URL to a file."""
    if not arg_1:
        arg_1 = get_temporary_file()

    arg_4 = requests.Session()
    arg_5 = requests.adapters.HTTPAdapter(max_retries=arg_3)
    arg_4.mount(arg_0, arg_5)
    arg_6 = arg_4.get(arg_0, stream=True)
    with open(arg_1, 'wb') as fd:
        for arg_7 in arg_6.iter_content(arg_2):
            fd.write(arg_7)
    return arg_1


def Func ( arg_0 ) : with open ( arg_0 . filename , 'wb' ) as file : arg_0 . prune ( ) arg_0 . data [ 'version' ] = arg_0 . version json . dump ( arg_0 . data , file , sort_keys = True , indent = 2 )

def Func(arg_0):
        """Save data."""

        with open(arg_0.filename, 'wb') as file:
            arg_0.prune()
            arg_0.data['version'] = arg_0.version
            json.dump(arg_0.data,
                file,
                sort_keys=True, indent=2)


def Func ( arg_0 , arg_1 ) : arg_0 . suspicion_reasons . append ( arg_1 ) arg_0 . is_suspect = True

def Func(arg_0, arg_1):
        """Add suspicion reason and set the suspicious flag."""
        arg_0.suspicion_reasons.append(arg_1)
        arg_0.is_suspect = True

Add suspicion reason and set the suspicious flag .


(self, term=None, phrase=None, strict=False, rating=None)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=False, arg_4=None):
        """
        Retrieve a single image that represents a transalation of a term or
        phrase into an animated gif. Punctuation is ignored. By default, this
        will perform a `term` translation. If you want to Func by phrase,
        use the `phrase` keyword argument.

        :param term: Search term or terms
        :type term: string
        :param phrase: Search phrase
        :type phrase: string
        :param strict: Whether an exception should be raised when no results
        :type strict: boolean
        :param rating: limit results to those rated (y,g, pg, pg-13 or r).
        :type rating: string
        """
        assert any((arg_1, arg_2)), 'You must supply a term or phrase to search'

        # Phrases should have dashes and not spaces
        if arg_2:
            arg_2 = arg_2.replace(' ', '-')

        arg_5 = {'s': (arg_1 or arg_2)}
        if arg_4:
            arg_5.update({'rating': arg_4})
        arg_6 = arg_0._fetch('Func', **arg_5)
        if arg_6['data']:
            return GiphyImage(arg_6['data'])
        elif arg_3 or arg_0.strict:
            raise GiphyApiException(
                "Term/Phrase '%s' could not be Funcd into a GIF" %
                (arg_1 or arg_2))

Retrieve a single image that represents a transalation of a term or
        phrase into an animated gif. Punctuation is ignored. By default, this
        will perform a `term` translation. If you want to translate by phrase,
        use the `phrase` keyword argument.

        :param term: Search term or terms
        :type term: string
        :param phrase: Search phrase
        :type phrase: string
        :param strict: Whether an exception should be raised when no results
        :type strict: boolean
        :param rating: limit results to those rated (y,g, pg, pg-13 or r).
        :type rating: string

Retrieve a single image that represents a transalation of a term or phrase into an animated gif . Punctuation is ignored . By default this will perform a term translation . If you want to translate by phrase use the phrase keyword argument .


def Func ( arg_0 = None ) : from pylab import gca , draw if arg_0 is None : arg_0 = gca ( ) arg_0 . legend_ = None draw ( )

def Func(arg_0=None):
    """Remove legend for axes or gca.

    See http://osdir.com/ml/python.matplotlib.general/2005-07/msg00285.html
    """
    from pylab import gca, draw
    if arg_0 is None:
        arg_0 = gca()
    arg_0.legend_ = None
    draw()


def Func ( arg_0 , arg_1 ) : arg_2 = ( xrange ( n - arg_1 , n + arg_1 + 1 ) for n in arg_0 . tolist ( ) ) return numpy . array ( list ( itertools . product ( * arg_2 ) ) )

def Func(arg_0, arg_1):
    """
    Returns coordinates around given coordinate, within given radius.
    Includes given coordinate.

    @param coordinate (numpy.array) N-dimensional integer coordinate
    @param radius (int) Radius around `coordinate`

    @return (numpy.array) List of coordinates
    """
    arg_2 = (xrange(n-arg_1, n+arg_1+1) for n in arg_0.tolist())
    return numpy.array(list(itertools.product(*arg_2)))

Returns coordinates around given coordinate within given radius . Includes given coordinate .


def Func ( arg_0 ) : arg_1 = "api/v0002/mgmt/custom/bundle" arg_2 = arg_0 . _apiClient . get ( arg_1 ) if arg_2 . status_code == 200 : return arg_2 . json ( ) else : raise ApiException ( arg_2 )

def Func(arg_0):
        """
        List all device management extension packages
        """
        arg_1 = "api/v0002/mgmt/custom/bundle"
        arg_2 = arg_0._apiClient.get(arg_1)

        if arg_2.status_code == 200:
            return arg_2.json()
        else:
            raise ApiException(arg_2)


"                transport = ssl_transport"

def Func(arg_0):
        """ compose benchmark block """
        # step file
        arg_0.stepper_wrapper.prepare_stepper()
        arg_0.stpd = arg_0.stepper_wrapper.stpd
        if arg_0.stepper_wrapper.instances:
            arg_0.instances = arg_0.stepper_wrapper.instances

        if not arg_0.stpd:
            raise RuntimeError("Cannot proceed with no STPD file")

        arg_3 = {}
        arg_3['sequence_no'] = arg_0.sequence_no
        if arg_0.ssl:
            arg_4 = ''
            arg_5 = ''
            arg_6 = "transport_t ssl_transport = transport_ssl_t {\n" \
                           "                timeout = 1s\n" \
                           "                %s\n" \
                           "                %s}\n" \
                           "                transport = ssl_transport"

            if arg_0.client_certificate or arg_0.client_key:
                arg_4 = 'auth_t def_auth = auth_t { key = "%s" cert = "%s"} auth = def_auth' \
                                % (arg_0.client_key, arg_0.client_certificate)
            if arg_0.client_cipher_suites:
                arg_5 = 'ciphers = "%s"' % arg_0.client_cipher_suites
            arg_3['ssl_transport'] = arg_6 % (arg_4, arg_5)
        else:
            arg_3['ssl_transport'] = ""
        arg_3['method_stream'] = arg_0.method_prefix + \
            "_ipv6_t" if arg_0.ipv6 else arg_0.method_prefix + "_ipv4_t"
        arg_3['phout'] = arg_0.phout_file
        arg_3['answ_log'] = arg_0.answ_log
        arg_3['answ_log_level'] = arg_0.answ_log_level
        arg_3['comment_answ'] = "# " if arg_0.answ_log_level == 'none' else ''
        arg_3['stpd'] = arg_0.stpd
        arg_3['source_log_prefix'] = arg_0.source_log_prefix
        arg_3['method_options'] = arg_0.method_options
        if arg_0.tank_type:
            arg_3[
                'proto'] = "proto=http_proto%s" % arg_0.sequence_no if arg_0.tank_type == 'http' else "proto=none_proto"
            arg_3['comment_proto'] = ""
        else:
            arg_3['proto'] = ""
            arg_3['comment_proto'] = "#"

        if arg_0.gatling:
            arg_3['bind'] = 'bind={ ' + arg_0.gatling + ' }'
        else:
            arg_3['bind'] = ''
        arg_3['ip'] = arg_0.resolved_ip
        arg_3['port'] = arg_0.port
        arg_3['timeout'] = arg_0.timeout
        arg_3['instances'] = arg_0.instances
        arg_7 = ''
        if arg_0.phantom_http_entity:
            arg_7 += "entity = " + arg_0.phantom_http_entity + "\n"
        if arg_0.phantom_http_field:
            arg_7 += "field = " + arg_0.phantom_http_field + "\n"
        if arg_0.phantom_http_field_num:
            arg_7 += "field_num = {}\n".format(arg_0.phantom_http_field_num)
        if arg_0.phantom_http_line:
            arg_7 += "line = " + arg_0.phantom_http_line + "\n"
        if arg_7:
            arg_3['reply_limits'] = 'reply_limits = {\n' + arg_7 + "}"
        else:
            arg_3['reply_limits'] = ''

        if arg_0.is_main:
            arg_8 = 'phantom_benchmark_main.tpl'
        else:
            arg_8 = 'phantom_benchmark_additional.tpl'
        arg_9 = resource_string(
            __name__, "config/" + arg_8)
        arg_10 = string.Template(arg_9)
        arg_11 = arg_10.substitute(arg_3)

        return arg_11


def Func ( arg_0 , arg_1 ) : if not isinstance ( arg_1 , ObjectId ) : arg_1 = ObjectId ( arg_1 ) arg_2 = arg_0 . Func_collection . find_one ( { '_id' : arg_1 } ) return arg_2

def Func(arg_0, arg_1):
        """Fetch a gene Func by '_id'.

        Args:
            Func_id (str, ObjectId): str or ObjectId of document ObjectId

        Returns:
            dict: Func object or `None` if Func not found
        """
        if not isinstance(arg_1, ObjectId):
            arg_1 = ObjectId(arg_1)
        arg_2 = arg_0.Func_collection.find_one({'_id': arg_1})
        return arg_2

Fetch a gene panel by '_id'.

        Args:
            panel_id (str, ObjectId): str or ObjectId of document ObjectId

        Returns:
            dict: panel object or `None` if panel not found


def Func(arg_0, arg_1):
        """Add groups to the model.

        Groups with identifiers identical to a group already in the model are
        ignored.

        If any group contains members that are not in the model, these members
        are added to the model as well. Only metabolites, reactions, and genes
        can have groups.

        Parameters
        ----------
        group_list : list
            A list of `cobra.Group` objects to add to the model.
        """

        def existing_filter(arg_2):
            if arg_2.id in arg_0.groups:
                LOGGER.warning(
                    "Ignoring group '%s' since it already exists.", arg_2.id)
                return False
            return True

        if isinstance(arg_1, string_types) or \
                hasattr(arg_1, "id"):
            warn("need to pass in a list")
            arg_1 = [arg_1]

        arg_3 = DictList(filter(existing_filter, arg_1))

        for arg_2 in arg_3:
            arg_2._model = arg_0
            for arg_5 in arg_2.members:
                # If the member is not associated with the model, add it
                if isinstance(arg_5, Metabolite):
                    if arg_5 not in arg_0.metabolites:
                        arg_0.add_metabolites([arg_5])
                if isinstance(arg_5, Reaction):
                    if arg_5 not in arg_0.reactions:
                        arg_0.add_reactions([arg_5])
                # TODO(midnighter): `add_genes` method does not exist.
                # if isinstance(member, Gene):
                #     if member not in self.genes:
                #         self.add_genes([member])

            arg_0.groups += [arg_2]


def Func(arg_0, arg_1=None):
    '''list all endpoints, providing a list of endpoints to the user to
       better filter the search. This function takes no arguments,
       as the user has not provided an endpoint id or query.
    '''
    bot.info('Please select an endpoint id to query from')

    arg_2 = arg_0._get_endpoints(arg_1)

    # Iterate through endpoints to provide user a list

    bot.custom(prefix="Globus", message="Endpoints", color="CYAN")
    arg_3 = []
    for arg_4,arg_5 in arg_2.items():
        for arg_6,arg_7 in arg_5.items():
            arg_3.append([arg_6, '[%s]' %arg_4, arg_7['name']])

    bot.table(arg_3)
    return arg_3

list all endpoints providing a list of endpoints to the user to better filter the search . This function takes no arguments as the user has not provided an endpoint id or query .


return "MD5:" + ':'.join(a + b for a, b in zip(fp_plain[::2], fp_plain[1::2]))

def Func ( arg_0 ) : arg_1 = hashlib . md5 ( arg_0 . _decoded_key ) . hexdigest ( ) return "MD5:" + ':' . join ( arg_2 + arg_3 for arg_2 , arg_3 in zip ( arg_1 [ : : 2 ] , arg_1 [ 1 : : 2 ] ) )

def Func(arg_0):
        """Calculate md5 fingerprint.

        Shamelessly copied from http://stackoverflow.com/questions/6682815/deriving-an-ssh-fingerprint-from-a-public-key-in-python

        For specification, see RFC4716, section 4."""
        arg_1 = hashlib.md5(arg_0._decoded_key).hexdigest()
        return "MD5:" + ':'.join(arg_2 + arg_3 for arg_2, arg_3 in zip(arg_1[::2], arg_1[1::2]))


def
Func
(
arg_0
)
:
if
arg_0
is
:
return
arg_0
=
dedent
(
arg_0
)
arg_1
=
find_funcdef
(
arg_0
)
arg_2
=
extract_params
(
arg_0
)
arg_3
=
[
]
if
isinstance
(
arg_1
,
ast
.
FunctionDef
)
:
arg_4
=
arg_1
.
body
elif
isinstance
(
arg_1
,
ast
.
Lambda
)
:
arg_4
=
[
arg_1
.
body
]
else
:
raise
ValueError
(
"must not happen"
)
for
arg_5
in
arg_4
:
for
arg_6
in
ast
.
walk
(
arg_5
)
:
if
isinstance
(
arg_6
,
ast
.
Name
)
:
if
arg_6
.
id
not
in
arg_3
and
arg_6
.
id
not
in
arg_2
:
arg_3
.
append
(
arg_6
.
id
)
return
arg_3

def Func(arg_0):
    """Extract names from a function definition

    Looks for a function definition in the source.
    Only the first function definition is examined.

    Returns:
         a list names(identifiers) used in the body of the function
         excluding function parameters.
    """
    if arg_0 is None:
        return None

    arg_0 = dedent(arg_0)
    arg_1 = find_funcdef(arg_0)
    arg_2 = extract_params(arg_0)
    arg_3 = []

    if isinstance(arg_1, ast.FunctionDef):
        arg_4 = arg_1.body
    elif isinstance(arg_1, ast.Lambda):
        arg_4 = [arg_1.body]
    else:
        raise ValueError("must not happen")

    for arg_5 in arg_4:
        for arg_6 in ast.walk(arg_5):
            if isinstance(arg_6, ast.Name):
                if arg_6.id not in arg_3 and arg_6.id not in arg_2:
                    arg_3.append(arg_6.id)

    return arg_3


def Func ( arg_0 ) : arg_1 = arg_0 . base_url if arg_0 . URL_TEMPLATE is not None : arg_1 = urlparse . urljoin ( arg_0 . base_url , arg_0 . URL_TEMPLATE . format ( ** arg_0 . url_kwargs ) ) if not arg_1 : return None arg_2 = list ( urlparse . urlparse ( arg_1 ) ) arg_3 = urlparse . parse_qsl ( arg_2 [ 4 ] ) for arg_4 , arg_5 in arg_0 . url_kwargs . items ( ) : if arg_5 is None : continue if "{{{}}}" . format ( arg_4 ) not in str ( arg_0 . URL_TEMPLATE ) : for arg_6 in iterable ( arg_5 ) : arg_3 . append ( ( arg_4 , arg_6 ) ) arg_2 [ 4 ] = urlencode ( arg_3 ) return urlparse . urlunparse ( arg_2 )

def Func(arg_0):
        """A URL that can be used to open the page.

        The URL is formatted from :py:attr:`URL_TEMPLATE`, which is then
        appended to :py:attr:`base_url` unless the template results in an
        absolute URL.

        :return: URL that can be used to open the page.
        :rtype: str

        """
        arg_1 = arg_0.base_url
        if arg_0.URL_TEMPLATE is not None:
            arg_1 = urlparse.urljoin(
                arg_0.base_url, arg_0.URL_TEMPLATE.format(**arg_0.url_kwargs)
            )

        if not arg_1:
            return None

        arg_2 = list(urlparse.urlparse(arg_1))
        arg_3 = urlparse.parse_qsl(arg_2[4])

        for arg_4, arg_5 in arg_0.url_kwargs.items():
            if arg_5 is None:
                continue
            if "{{{}}}".format(arg_4) not in str(arg_0.URL_TEMPLATE):
                for arg_6 in iterable(arg_5):
                    arg_3.append((arg_4, arg_6))

        arg_2[4] = urlencode(arg_3)
        return urlparse.urlunparse(arg_2)

A URL that can be used to open the page .


def Func ( arg_0 ) : try : arg_1 = urlparse . parse_qs ( urlparse . urlparse ( arg_0 . url ) . query ) arg_0 . key = arg_1 [ 'key' ] [ 0 ] except KeyError as e : raise PODocsError ( e )

def Func(arg_0):
        """
        Parse GDocs key from Spreadsheet url.
        """
        try:
            arg_1 = urlparse.parse_qs(urlparse.urlparse(arg_0.url).query)
            arg_0.key = arg_1['key'][0]
        except KeyError as e:
            raise PODocsError(e)


def Func ( arg_0 , arg_1 ) : with open ( arg_1 ) as fh : for arg_2 in fh : if arg_2 . startswith ( "#" ) or arg_2 . strip ( ) == "" : continue arg_3 = arg_2 . strip ( ) . split ( "\t" ) try : arg_4 = float ( arg_3 [ 8 ] ) except ValueError : arg_4 = None try : arg_5 = float ( arg_3 [ 9 ] ) except ValueError : arg_5 = None try : arg_6 = arg_3 [ 11 ] except IndexError : arg_6 = None arg_0 . storage [ arg_0 . _key ] = { "log_file" : os . path . basename ( arg_1 ) , "infile" : arg_3 [ 0 ] , "reference" : arg_3 [ 1 ] , "seq_range" : ( int ( arg_3 [ 2 ] ) , int ( arg_3 [ 3 ] ) ) , "gene" : arg_3 [ 4 ] , "accession" : arg_6 , "database" : arg_3 [ 10 ] , "coverage" : arg_4 , "identity" : arg_5 } arg_0 . _key += 1

def Func(arg_0, arg_1):
        """Parser for a single abricate output file.

        This parser will scan a single Abricate output file and populate
        the :py:attr:`Abricate.storage` attribute.

        Parameters
        ----------
        fl : str
            Path to abricate output file

        Notes
        -----
        This method will populate the :py:attr:`Abricate.storage` attribute
        with all compliant lines in the abricate output file. Entries are
        inserted using an arbitrary key that is set by the
        :py:attr:`Abricate._key` attribute.

        """

        with open(arg_1) as fh:

            for arg_2 in fh:
                # Skip header and comment lines
                if arg_2.startswith("#") or arg_2.strip() == "":
                    continue

                arg_3 = arg_2.strip().split("\t")

                try:
                    arg_4 = float(arg_3[8])
                except ValueError:
                    arg_4 = None
                try:
                    arg_5 = float(arg_3[9])
                except ValueError:
                    arg_5 = None

                try:
                    arg_6 = arg_3[11]
                except IndexError:
                    arg_6 = None

                arg_0.storage[arg_0._key] = {
                    "log_file": os.path.basename(arg_1),
                    "infile": arg_3[0],
                    "reference": arg_3[1],
                    "seq_range": (int(arg_3[2]), int(arg_3[3])),
                    "gene": arg_3[4],
                    "accession": arg_6,
                    "database": arg_3[10],
                    "coverage": arg_4,
                    "identity": arg_5
                }

                arg_0._key += 1

Parser for a single abricate output file .


def Func ( arg_0 , arg_1 ) : if not arg_1 : arg_0 . _httprequest . Func ( ) else : arg_0 . _httprequest . Func ( arg_1 )

def Func(arg_0, arg_1):
        ''' Sends request body. '''
        if not arg_1:
            arg_0._httprequest.Func()
        else:
            arg_0._httprequest.Func(arg_1)


def
Func
(
arg_0
=
False
,
arg_1
=
20771
)
:
arg_2
=
"Funcd --port {0}"
.
format
(
arg_1
)
if
arg_0
:
arg_2
+=
" --fork"
run
(
arg_2
)

def Func(arg_0=False, arg_1=20771):
    '''Run the Funcd process.
    '''
    arg_2 = "Funcd --port {0}".format(arg_1)
    if arg_0:
        arg_2 += " --fork"
    run(arg_2)


def Func ( arg_0 ) : if arg_0 . slug is not None : return arg_0 . meta . detail_Func return arg_0 . meta . list_Func

def Func(arg_0):
        """Retrieves the allowed operations for this request."""
        if arg_0.slug is not None:
            return arg_0.meta.detail_Func

        return arg_0.meta.list_Func

Retrieves the allowed operations for this request .


def Func(arg_0, arg_1=False, arg_2='kernel'):
        """
        Generate and return compilable source code from AST.
        """
        # TODO produce nicer code, including help text and other "comfort features".
        assert arg_0.kernel_ast is not None, "AST does not exist, this could be due to running " \
                                            "based on a kernel description rather than code."

        arg_3, arg_4 = arg_0._get_intermediate_file('main.c',
                                                            machine_and_compiler_dependent=False)

        # Use already cached version
        if arg_4:
            arg_5 = arg_3.read()
        else:
            arg_6 = CParser()
            arg_7 = arg_0.CODE_TEMPLATE
            arg_8 = arg_6.parse(clean_code(arg_7,
                                                   macros=True, comments=True, pragmas=False))
            arg_9 = deepcopy(arg_8)

            # Define and replace DECLARE_CONSTS
            replace_id(arg_9, "DECLARE_CONSTS", arg_0._build_const_declartions(with_init=True))

            # Define and replace DECLARE_ARRAYS
            arg_10, arg_11 = arg_0._build_array_declarations()
            replace_id(arg_9, "DECLARE_ARRAYS", arg_10)

            # Define and replace DECLARE_INIT_SCALARS
            replace_id(arg_9, "DECLARE_INIT_SCALARS", arg_0._build_scalar_declarations())

            # Define and replace DUMMY_CALLS
            replace_id(arg_9, "DUMMY_CALLS", arg_0._build_dummy_calls())

            # Define and replace KERNEL_DECL
            arg_9.ext.insert(0, arg_0._build_kernel_function_declaration(
                name=arg_2))

            # Define and replace KERNEL_CALL
            replace_id(arg_9, "KERNEL_CALL", arg_0._build_kernel_call())

            # Define and replace INIT_ARRAYS based on previously generated kernel
            replace_id(arg_9, "INIT_ARRAYS", arg_0._build_array_initializations(arg_11))

            # Generate code
            arg_5 = CGenerator().visit(arg_9)

            # Insert missing #includes from template to top of code
            arg_5 = '\n'.join([l for l in arg_7.split('\n') if l.startswith("#include")]) + \
                   '\n\n' + arg_5

            # Store to file
            arg_3.write(arg_5)
        arg_3.close()

        if arg_1:
            return arg_3.name
        else:
            return arg_5

Generate and return compilable source code from AST .


Decorate passed in function and log message to module logger.

def
Func
(
arg_0
)
:
@
functools
.
wraps
(
arg_0
)
def
wrapper
(
*
arg_1
,
**
arg_2
)
:
arg_3
=
arg_2
.
get
(
'sep'
,
' '
)
arg_4
=
arg_2
.
get
(
'end'
,
''
)
arg_5
=
arg_3
.
join
(
[
repr
(
x
)
for
x
in
arg_1
]
)
arg_5
=
arg_5
+
arg_4
_LOGGER
.
debug
(
arg_5
)
return
arg_0
(
*
arg_1
,
**
arg_2
)
return
wrapper

def Func(arg_0):
    """Decorate passed in function and log message to module Func."""
    @functools.wraps(arg_0)
    def wrapper(*arg_1, **arg_2):
        """Wrap function."""
        arg_3 = arg_2.get('sep', ' ')
        arg_4 = arg_2.get('end', '')  # do not add newline by default
        arg_5 = arg_3.join([repr(x) for x in arg_1])
        arg_5 = arg_5 + arg_4
        _LOGGER.debug(arg_5)
        return arg_0(*arg_1, **arg_2)
    return wrapper

Decorate passed in function and log message to module logger .


(session, user_id, project_id, latitude, longitude)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : arg_5 = { 'user_id' : arg_1 , 'project_id' : arg_2 , 'track_point' : { 'latitude' : arg_3 , 'longitude' : arg_4 } } arg_6 = make_post_request ( arg_0 , 'tracks' , arg_7 = arg_5 ) arg_7 = arg_6 . json ( ) if arg_6 . status_code == 200 : return arg_7 [ 'result' ] else : raise TrackNotCreatedException ( message = arg_7 [ 'message' ] , error_code = arg_7 [ 'error_code' ] , request_id = arg_7 [ 'request_id' ] )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """
    Start tracking a project by creating a track
    """
    arg_5 = {
        'user_id': arg_1,
        'project_id': arg_2,
        'track_point': {
            'latitude': arg_3,
            'longitude': arg_4
        }
    }

    # POST /api/projects/0.1/tracks/
    arg_6 = make_post_request(arg_0, 'tracks',
                                 arg_7=arg_5)
    arg_7 = arg_6.json()
    if arg_6.status_code == 200:
        return arg_7['result']
    else:
        raise TrackNotCreatedException(message=arg_7['message'],
                                       error_code=arg_7['error_code'],
                                       request_id=arg_7['request_id'])


def Func(arg_0, arg_1, arg_2=None):
        """Fit distance-based AD.

        Parameters
        ----------
        X : array-like or sparse matrix, shape (n_samples, n_features)
            The input samples. Use ``dtype=np.float32`` for maximum
            efficiency.

        Returns
        -------
        self : object
            Returns self.
        """
        # Check data
        arg_1 = check_array(arg_1)
        arg_0.tree = BallTree(arg_1, leaf_size=arg_0.leaf_size, metric=arg_0.metric)
        arg_4 = arg_0.tree.query(arg_1, k=2)[0]
        if arg_0.threshold == 'auto':
            arg_0.threshold_value = 0.5 * sqrt(var(arg_4[:, 1])) + mean(arg_4[:, 1])
        elif arg_0.threshold == 'cv':
            if arg_2 is None:
                raise ValueError("Y must be specified to find the optimal threshold.")
            arg_2 = check_array(arg_2, accept_sparse='csc', ensure_2d=False, dtype=None)
            arg_0.threshold_value = 0
            arg_6 = 0
            arg_7, arg_8, arg_9 = [], [], []
            arg_10 = KFold(n_splits=5, random_state=1, shuffle=True)
            for arg_11, arg_12 in arg_10.split(arg_1):
                arg_13 = safe_indexing(arg_1, arg_11)
                arg_14 = safe_indexing(arg_1, arg_12)
                arg_15 = safe_indexing(arg_2, arg_11)
                arg_16 = safe_indexing(arg_2, arg_12)
                arg_17 = safe_indexing(arg_4[:, 1], arg_12)
                if arg_0.reg_model is None:
                    arg_18 = RandomForestRegressor(n_estimators=500, random_state=1).Func(arg_13, arg_15)
                else:
                    arg_18 = clone(arg_0.reg_model).Func(arg_13, arg_15)
                arg_7.append(arg_18.predict(arg_14))
                arg_8.append(arg_16)
                arg_9.append(arg_17)
            arg_19 = unique(hstack(arg_9))
            for arg_20 in arg_19:
                arg_21 = hstack(arg_9) <= arg_20
                if arg_0.score == 'ba_ad':
                    arg_22 = balanced_accuracy_score_with_ad(arg_8=hstack(arg_8), arg_7=hstack(arg_7), arg_9=arg_21)
                elif arg_0.score == 'rmse_ad':
                    arg_22 = rmse_score_with_ad(arg_8=hstack(arg_8), arg_7=hstack(arg_7), arg_9=arg_21)
                if arg_22 >= arg_6:
                    arg_6 = arg_22
                    arg_0.threshold_value = arg_20
        else:
            arg_0.threshold_value = arg_0.threshold
        return arg_0


def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_3 = arg_0 . _api_info [ 'camera' ] arg_4 = dict ( { '_sid' : arg_0 . _sid , 'api' : arg_3 [ 'name' ] , 'method' : 'GetSnapshot' , 'version' : arg_3 [ 'version' ] , 'cameraId' : arg_1 , } , ** arg_2 ) arg_5 = arg_0 . _get ( arg_3 [ 'url' ] , arg_4 ) return arg_5 . content

def Func(arg_0, arg_1, **arg_2):
        """Return bytes of camera image."""
        arg_3 = arg_0._api_info['camera']
        arg_4 = dict({
            '_sid': arg_0._sid,
            'api': arg_3['name'],
            'method': 'GetSnapshot',
            'version': arg_3['version'],
            'cameraId': arg_1,
        }, **arg_2)
        arg_5 = arg_0._get(arg_3['url'], arg_4)

        return arg_5.content


def
Func
(
arg_0
)
:
if
isinstance
(
arg_0
,
list
)
:
arg_0
=
arg_0
[
0
]
if
os
.
path
.
exists
(
arg_0
)
:
arg_1
=
tempfile
.
NamedTemporaryFile
(
suffix
=
'.sqlite'
)
.
name
open
(
arg_1
,
'wb'
)
.
write
(
open
(
arg_0
,
'rb'
)
.
read
(
)
)
return
arg_1
else
:
raise
BrowserCookieError
(
'Can not find cookie file at: '
+
arg_0
)

def Func(arg_0):
    """Make a local copy of the sqlite cookie database and return the new filename.
    This is necessary in case this database is still being written to while the user browses
    to avoid sqlite locking errors.
    """
    # if type of cookie_file is a list, use the first element in the list
    if isinstance(arg_0, list):
        arg_0 = arg_0[0]

    # check if cookie file exists
    if os.path.exists(arg_0):
        # copy to random name in tmp folder
        arg_1 = tempfile.NamedTemporaryFile(suffix='.sqlite').name
        open(arg_1, 'wb').write(open(arg_0, 'rb').read())
        return arg_1
    else:
        raise BrowserCookieError('Can not find cookie file at: ' + arg_0)

Make a local copy of the sqlite cookie database and return the new filename . This is necessary in case this database is still being written to while the user browses to avoid sqlite locking errors .


(rec1, rec2, skip_005=True, ignore_field_order=False,
                      ignore_subfield_order=False,
                      ignore_duplicate_subfields=False,
                      ignore_duplicate_controlfields=False)

def Func ( arg_0 , arg_1 , arg_2 = True , arg_3 = False , arg_4 = False , arg_5 = False , arg_6 = False ) : arg_7 = set ( arg_0 . keys ( ) ) arg_8 = set ( arg_1 . keys ( ) ) if arg_2 : arg_7 . discard ( "005" ) arg_8 . discard ( "005" ) if arg_7 != arg_8 : return False for arg_9 in arg_7 : if arg_6 and arg_9 . startswith ( '00' ) : if set ( arg_10 [ 3 ] for arg_10 in arg_0 [ arg_9 ] ) != set ( arg_10 [ 3 ] for arg_10 in arg_1 [ arg_9 ] ) : return False continue arg_11 = arg_0 [ arg_9 ] arg_12 = arg_1 [ arg_9 ] if len ( arg_11 ) != len ( arg_12 ) : return False if arg_3 : arg_11 = sorted ( arg_11 , arg_9 = lambda elem : ( elem [ 1 ] , elem [ 2 ] , elem [ 3 ] , elem [ 0 ] ) ) arg_12 = sorted ( arg_12 , arg_9 = lambda elem : ( elem [ 1 ] , elem [ 2 ] , elem [ 3 ] , elem [ 0 ] ) ) else : arg_11 = sorted ( arg_11 , arg_9 = lambda elem : ( elem [ 1 ] , elem [ 2 ] , elem [ 4 ] , elem [ 3 ] , elem [ 0 ] ) ) arg_12 = sorted ( arg_12 , arg_9 = lambda elem : ( elem [ 1 ] , elem [ 2 ] , elem [ 4 ] , elem [ 3 ] , elem [ 0 ] ) ) for arg_13 , arg_14 in zip ( arg_11 , arg_12 ) : if arg_5 : if arg_13 [ 1 : 4 ] != arg_14 [ 1 : 4 ] or set ( arg_13 [ 0 ] ) != set ( arg_14 [ 0 ] ) : return False elif arg_4 : if arg_13 [ 1 : 4 ] != arg_14 [ 1 : 4 ] or sorted ( arg_13 [ 0 ] ) != sorted ( arg_14 [ 0 ] ) : return False elif arg_13 [ : 4 ] != arg_14 [ : 4 ] : return False return True

def Func(arg_0, arg_1, arg_2=True, arg_3=False,
                      arg_4=False,
                      arg_5=False,
                      arg_6=False):
    """
    Return True if rec1 is identical to rec2.

    It does so regardless of a difference in the 005 tag (i.e. the timestamp).
    """
    arg_7 = set(arg_0.keys())
    arg_8 = set(arg_1.keys())
    if arg_2:
        arg_7.discard("005")
        arg_8.discard("005")
    if arg_7 != arg_8:
        return False
    for arg_9 in arg_7:
        if arg_6 and arg_9.startswith('00'):
            if set(arg_10[3] for arg_10 in arg_0[arg_9]) != \
                    set(arg_10[3] for arg_10 in arg_1[arg_9]):
                return False
            continue

        arg_11 = arg_0[arg_9]
        arg_12 = arg_1[arg_9]
        if len(arg_11) != len(arg_12):
            # They already differs in length...
            return False
        if arg_3:
            # We sort the fields, first by indicators and then by anything else
            arg_11 = sorted(
                arg_11,
                arg_9=lambda elem: (elem[1], elem[2], elem[3], elem[0]))
            arg_12 = sorted(
                arg_12,
                arg_9=lambda elem: (elem[1], elem[2], elem[3], elem[0]))
        else:
            # We sort the fields, first by indicators, then by global position
            # and then by anything else
            arg_11 = sorted(
                arg_11,
                arg_9=lambda elem: (elem[1], elem[2], elem[4], elem[3], elem[0]))
            arg_12 = sorted(
                arg_12,
                arg_9=lambda elem: (elem[1], elem[2], elem[4], elem[3], elem[0]))
        for arg_13, arg_14 in zip(arg_11, arg_12):
            if arg_5:
                if arg_13[1:4] != arg_14[1:4] or \
                        set(arg_13[0]) != set(arg_14[0]):
                    return False
            elif arg_4:
                if arg_13[1:4] != arg_14[1:4] or \
                        sorted(arg_13[0]) != sorted(arg_14[0]):
                    return False
            elif arg_13[:4] != arg_14[:4]:
                return False
    return True

Return True if rec1 is identical to rec2 .


def Func ( arg_0 , arg_1 , arg_2 : arg_3 , arg_4 : arg_5 ) : yield from arg_1 . execute ( arg_2 , arg_4 ) return ( yield from arg_1 . fetchall ( ) )

def Func(arg_0, arg_1, arg_2: arg_3, arg_4: arg_5):
        """
        Run a raw sql query

        Args:
            query : query string to execute
            values : tuple of values to be used with the query

        Returns:
            result of query as list of named tuple

        """
        yield from arg_1.execute(arg_2, arg_4)
        return (yield from arg_1.fetchall())


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
LOG
.
info
(
'Func %s for tenant %s and body %s'
%
(
arg_1
,
arg_0
.
tenant_id
,
arg_2
)
)
arg_3
=
arg_2
.
get
(
'ports'
,
[
]
)
arg_4
=
_update_flip
(
arg_0
,
arg_1
,
ip_types
.
SCALING
,
arg_3
)
return
v
.
_make_scaling_ip_dict
(
arg_4
)

def Func(arg_0, arg_1, arg_2):
    """Update an existing scaling IP.

    :param context: neutron api request context.
    :param id: id of the scaling ip
    :param content: dictionary with keys indicating fields to update.
        valid keys are those that have a value of True for 'allow_put'
        as listed in the RESOURCE_ATTRIBUTE_MAP object in
        neutron/api/v2/attributes.py.

    :returns: Dictionary containing details for the new scaling IP.  If values
        are declared in the fields parameter, then only those keys will be
        present.
    """
    LOG.info('Func %s for tenant %s and body %s' %
             (arg_1, arg_0.tenant_id, arg_2))
    arg_3 = arg_2.get('ports', [])
    arg_4 = _update_flip(arg_0, arg_1, ip_types.SCALING, arg_3)
    return v._make_scaling_ip_dict(arg_4)


def
Func
(
arg_0
)
:
arg_1
=
get_changeset
(
arg_0
.
id
)
arg_2
=
[
action
.
tag
for
action
in
arg_1
.
getchildren
(
)
]
arg_0
.
create
=
arg_2
.
Func
(
'create'
)
arg_0
.
modify
=
arg_2
.
Func
(
'modify'
)
arg_0
.
delete
=
arg_2
.
Func
(
'delete'
)
arg_0
.
verify_editor
(
)
try
:
if
(
arg_0
.
create
/
len
(
arg_2
)
>
arg_0
.
percentage
and
arg_0
.
create
>
arg_0
.
create_threshold
and
(
arg_0
.
powerfull_editor
or
arg_0
.
create
>
arg_0
.
top_threshold
)
)
:
arg_0
.
label_suspicious
(
'possible import'
)
elif
(
arg_0
.
modify
/
len
(
arg_2
)
>
arg_0
.
percentage
and
arg_0
.
modify
>
arg_0
.
modify_threshold
)
:
arg_0
.
label_suspicious
(
'mass modification'
)
elif
(
(
arg_0
.
delete
/
len
(
arg_2
)
>
arg_0
.
percentage
and
arg_0
.
delete
>
arg_0
.
delete_threshold
)
or
arg_0
.
delete
>
arg_0
.
top_threshold
)
:
arg_0
.
label_suspicious
(
'mass deletion'
)
except
ZeroDivisionError
:
print
(
'It seems this changeset was redacted'
)

def Func(arg_0):
        """Count the number of elements created, modified and deleted by the
        changeset and analyses if it is a possible import, mass modification or
        a mass deletion.
        """
        arg_1 = get_changeset(arg_0.id)
        arg_2 = [action.tag for action in arg_1.getchildren()]
        arg_0.create = arg_2.Func('create')
        arg_0.modify = arg_2.Func('modify')
        arg_0.delete = arg_2.Func('delete')
        arg_0.verify_editor()

        try:
            if (arg_0.create / len(arg_2) > arg_0.percentage and
                    arg_0.create > arg_0.create_threshold and
                    (arg_0.powerfull_editor or arg_0.create > arg_0.top_threshold)):
                arg_0.label_suspicious('possible import')
            elif (arg_0.modify / len(arg_2) > arg_0.percentage and
                    arg_0.modify > arg_0.modify_threshold):
                arg_0.label_suspicious('mass modification')
            elif ((arg_0.delete / len(arg_2) > arg_0.percentage and
                    arg_0.delete > arg_0.delete_threshold) or
                    arg_0.delete > arg_0.top_threshold):
                arg_0.label_suspicious('mass deletion')
        except ZeroDivisionError:
            print('It seems this changeset was redacted')

Count the number of elements created modified and deleted by the changeset and analyses if it is a possible import mass modification or a mass deletion .


def Func ( * arg_0 , ** arg_1 ) : from invenio . modules . communities . models import FeaturedCommunity arg_2 = FeaturedCommunity . query return arg_2 . count ( ) , arg_2 . all ( )

def Func(*arg_0, **arg_1):
    """Get communities."""
    from invenio.modules.communities.models import FeaturedCommunity
    arg_2 = FeaturedCommunity.query
    return arg_2.count(), arg_2.all()


return _V1Span(
            trace_id=self.trace_id,
            name=self.name,
            parent_id=self.parent_id,
            id=self.span_id,
            timestamp=self.timestamp if self.shared is False else None,
            duration=self.duration if self.shared is False else None,
            endpoint=self.local_endpoint,
            annotations=full_annotations,
            binary_annotations=self.tags,
            remote_endpoint=self.remote_endpoint,
        )

def Func ( arg_0 ) : arg_1 = OrderedDict ( [ ( 'cs' , arg_0 . timestamp ) , ( 'sr' , arg_0 . timestamp ) , ( 'ss' , arg_0 . timestamp + arg_0 . duration ) , ( 'cr' , arg_0 . timestamp + arg_0 . duration ) , ] ) if arg_0 . kind != Kind . LOCAL : for arg_2 in _DROP_ANNOTATIONS_BY_KIND [ arg_0 . kind ] : del arg_1 [ arg_2 ] arg_1 . update ( arg_0 . annotations ) return _V1Span ( trace_id = arg_0 . trace_id , name = arg_0 . name , parent_id = arg_0 . parent_id , id = arg_0 . span_id , timestamp = arg_0 . timestamp if arg_0 . shared is False else None , duration = arg_0 . duration if arg_0 . shared is False else None , endpoint = arg_0 . local_endpoint , annotations = arg_1 , binary_annotations = arg_0 . tags , remote_endpoint = arg_0 . remote_endpoint , )

def Func(arg_0):
        """Builds and returns a V1 Span.

        :return: newly generated _V1Span
        :rtype: _V1Span
        """
        # We are simulating a full two-part span locally, so set cs=sr and ss=cr
        arg_1 = OrderedDict([
            ('cs', arg_0.timestamp),
            ('sr', arg_0.timestamp),
            ('ss', arg_0.timestamp + arg_0.duration),
            ('cr', arg_0.timestamp + arg_0.duration),
        ])

        if arg_0.kind != Kind.LOCAL:
            # If kind is not LOCAL, then we only want client or
            # server side annotations.
            for arg_2 in _DROP_ANNOTATIONS_BY_KIND[arg_0.kind]:
                del arg_1[arg_2]

        # Add user-defined annotations. We write them in full_annotations
        # instead of the opposite so that user annotations will override
        # any automatically generated annotation.
        arg_1.update(arg_0.annotations)

        return _V1Span(
            trace_id=arg_0.trace_id,
            name=arg_0.name,
            parent_id=arg_0.parent_id,
            id=arg_0.span_id,
            timestamp=arg_0.timestamp if arg_0.shared is False else None,
            duration=arg_0.duration if arg_0.shared is False else None,
            endpoint=arg_0.local_endpoint,
            annotations=arg_1,
            binary_annotations=arg_0.tags,
            remote_endpoint=arg_0.remote_endpoint,
        )


def Func ( arg_0 ) : arg_1 = [ ] arg_0 . cnxn . xfer ( [ 0x33 ] ) sleep ( 10e-3 ) for arg_2 in range ( 4 ) : arg_3 = arg_0 . cnxn . xfer ( [ 0x00 ] ) [ 0 ] arg_1 . append ( arg_3 ) arg_4 = arg_0 . _calculate_float ( arg_1 ) return arg_4

def Func(arg_0):
        """Read the bin particle density

        :returns: float
        """
        arg_1 = []

        # Send the command byte and sleep for 10 ms
        arg_0.cnxn.xfer([0x33])
        sleep(10e-3)

        # Read the config variables by sending 256 empty bytes
        for arg_2 in range(4):
            arg_3 = arg_0.cnxn.xfer([0x00])[0]
            arg_1.append(arg_3)

        arg_4 = arg_0._calculate_float(arg_1)

        return arg_4


def Func ( arg_0 , arg_1 = 0 ) : arg_2 = [ ] arg_2 . append ( arg_0 . _wrap ( arg_0 . docs [ 'title' ] , arg_1 = arg_1 ) ) if arg_0 . docs [ 'description' ] : arg_2 . append ( arg_0 . _wrap ( arg_0 . docs [ 'description' ] , indent = 2 , arg_1 = arg_1 ) ) arg_2 . append ( '' ) arg_2 . append ( 'SETTINGS:' ) arg_2 . append ( arg_0 . strsettings ( indent = 2 , arg_1 = arg_1 ) ) arg_2 . append ( '' ) return '\n' . join ( arg_2 )

def Func(arg_0, arg_1=0):
        """Return a summary of program options, their values and origins.

        width is maximum allowed page width, use self.width if 0.
        """
        arg_2 = []
        arg_2.append(arg_0._wrap(arg_0.docs['title'], arg_1=arg_1))
        if arg_0.docs['description']:
            arg_2.append(arg_0._wrap(arg_0.docs['description'], indent=2, arg_1=arg_1))
        arg_2.append('')
        arg_2.append('SETTINGS:')
        arg_2.append(arg_0.strsettings(indent=2, arg_1=arg_1))
        arg_2.append('')
        return '\n'.join(arg_2)

Return a summary of program options their values and origins . width is maximum allowed page width use self . width if 0 .


def Func(arg_0, arg_1, arg_2):
        """Submit multiple jobs

        Parameters
        ----------
        workingArea :
            A workingArea
        package_indices : list(int)
            A list of package indices

        Returns
        -------
        list(str)
            The list of the run IDs of the jobs

        """

        if not arg_2:
            return [ ]

        arg_3 = arg_0._compose_job_desc(arg_1, arg_2)

        arg_4 = submit_jobs(arg_3, cwd=arg_1.path)

        # TODO: make configurable
        arg_5 = clusterprocids2clusterids(arg_4)
        for arg_6 in arg_5:
            change_job_priority([arg_6], 10)

        arg_0.clusterprocids_outstanding.extend(arg_4)

        return arg_4


def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_3 = [ "option(" ] arg_3 . extend ( arg_0 . _indent ( arg_0 . _ast_to_code ( arg_1 . expression ) ) ) arg_3 . append ( ")" ) return arg_3

def Func(arg_0, arg_1, **arg_2):
    """Convert an AST option group to python source code."""
    arg_3 = ["option("]
    arg_3.extend(arg_0._indent(arg_0._ast_to_code(arg_1.expression)))
    arg_3.append(")")
    return arg_3

Convert an AST option group to python source code .


return _read_csv(reader, header, encode_fn)

def Func ( arg_0 ) : arg_1 = detect_file_encoding ( arg_0 ) if arg_1 . startswith ( 'UTF-16' ) : arg_2 = transcode_to_utf8 ( arg_0 , arg_1 ) arg_1 = 'UTF-8' else : arg_2 = open ( arg_0 , 'rU' ) arg_3 = arg_2 . readline ( ) arg_2 . seek ( 0 ) if '\t' in arg_3 : arg_4 = csv . reader ( arg_2 , delimiter = '\t' ) else : arg_4 = csv . reader ( arg_2 , dialect = 'excel' ) arg_5 = arg_4 . next ( ) arg_5 = [ cell . decode ( arg_1 ) . lower ( ) . strip ( ) for cell in arg_5 ] arg_6 = lambda x : x . decode ( arg_1 , 'replace' ) return _read_csv ( arg_4 , arg_5 , arg_6 )

def Func(arg_0):
    """
    Open a CSV file using Python 2's CSV module, working around the deficiency
    where it can't handle the null bytes of UTF-16.
    """
    arg_1 = detect_file_encoding(arg_0)
    if arg_1.startswith('UTF-16'):
        arg_2 = transcode_to_utf8(arg_0, arg_1)
        arg_1 = 'UTF-8'
    else:
        arg_2 = open(arg_0, 'rU')
    arg_3 = arg_2.readline()
    arg_2.seek(0)

    if '\t' in arg_3:
        # tab-separated
        arg_4 = csv.reader(arg_2, delimiter='\t')
    else:
        arg_4 = csv.reader(arg_2, dialect='excel')

    arg_5 = arg_4.next()
    arg_5 = [cell.decode(arg_1).lower().strip() for cell in arg_5]
    arg_6 = lambda x: x.decode(arg_1, 'replace')
    return _read_csv(arg_4, arg_5, arg_6)

Open a CSV file using Python 2 s CSV module working around the deficiency where it can t handle the null bytes of UTF - 16 .


def Func ( ) : arg_0 = ZonefileLineParser ( ) arg_1 = arg_0 . add_subparsers ( ) arg_2 = arg_1 . add_parser ( "$ORIGIN" ) arg_2 . add_argument ( "$ORIGIN" , type = str ) arg_2 = arg_1 . add_parser ( "$TTL" ) arg_2 . add_argument ( "$TTL" , type = int ) arg_3 = [ ( "mname" , str ) , ( "rname" , str ) , ( "serial" , int ) , ( "refresh" , int ) , ( "retry" , int ) , ( "expire" , int ) , ( "minimum" , int ) ] make_rr_subparser ( arg_1 , "SOA" , arg_3 ) make_rr_subparser ( arg_1 , "NS" , [ ( "host" , str ) ] ) make_rr_subparser ( arg_1 , "A" , [ ( "ip" , str ) ] ) make_rr_subparser ( arg_1 , "AAAA" , [ ( "ip" , str ) ] ) make_rr_subparser ( arg_1 , "CNAME" , [ ( "alias" , str ) ] ) make_rr_subparser ( arg_1 , "ALIAS" , [ ( "host" , str ) ] ) make_rr_subparser ( arg_1 , "MX" , [ ( "preference" , str ) , ( "host" , str ) ] ) make_txt_subparser ( arg_1 ) make_rr_subparser ( arg_1 , "PTR" , [ ( "host" , str ) ] ) make_rr_subparser ( arg_1 , "SRV" , [ ( "priority" , int ) , ( "weight" , int ) , ( "port" , int ) , ( "target" , str ) ] ) make_rr_subparser ( arg_1 , "SPF" , [ ( "data" , str ) ] ) make_rr_subparser ( arg_1 , "URI" , [ ( "priority" , int ) , ( "weight" , int ) , ( "target" , str ) ] ) return arg_0

def Func():
    """
    Make an ArgumentParser that accepts DNS RRs
    """
    arg_0 = ZonefileLineParser()
    arg_1 = arg_0.add_subparsers()

    # parse $ORIGIN
    arg_2 = arg_1.add_parser("$ORIGIN")
    arg_2.add_argument("$ORIGIN", type=str)

    # parse $TTL
    arg_2 = arg_1.add_parser("$TTL")
    arg_2.add_argument("$TTL", type=int)

    # parse each RR
    arg_3 = [
        ("mname", str), ("rname", str), ("serial", int), ("refresh", int),
        ("retry", int), ("expire", int), ("minimum", int)
    ]
    make_rr_subparser(arg_1, "SOA", arg_3)

    make_rr_subparser(arg_1, "NS", [("host", str)])
    make_rr_subparser(arg_1, "A", [("ip", str)])
    make_rr_subparser(arg_1, "AAAA", [("ip", str)])
    make_rr_subparser(arg_1, "CNAME", [("alias", str)])
    make_rr_subparser(arg_1, "ALIAS", [("host", str)])
    make_rr_subparser(arg_1, "MX", [("preference", str), ("host", str)])
    make_txt_subparser(arg_1)
    make_rr_subparser(arg_1, "PTR", [("host", str)])
    make_rr_subparser(arg_1, "SRV", [("priority", int), ("weight", int), ("port", int), ("target", str)])
    make_rr_subparser(arg_1, "SPF", [("data", str)])
    make_rr_subparser(arg_1, "URI", [("priority", int), ("weight", int), ("target", str)])

    return arg_0


(self, source, destination, overwrite=True, parallelism=1, **kwargs)

def Func(arg_0, arg_1, arg_2, arg_3=True, arg_4=1, **arg_5):
        r"""
        Uploads a file to HDFS.

        :param source: Local path to file or folder.
            If it's a folder, all the files inside of it will be uploaded.
            .. note:: This implies that folders empty of files will not be created remotely.

        :type source: str
        :param destination: PTarget HDFS path.
            If it already exists and is a directory, files will be uploaded inside.
        :type destination: str
        :param overwrite: Overwrite any existing file or directory.
        :type overwrite: bool
        :param parallelism: Number of threads to use for parallelization.
            A value of `0` (or negative) uses as many threads as there are files.
        :type parallelism: int
        :param \**kwargs: Keyword arguments forwarded to :meth:`hdfs.client.Client.upload`.
        """
        arg_6 = arg_0.get_conn()

        arg_6.upload(hdfs_path=arg_2,
                    local_path=arg_1,
                    arg_3=arg_3,
                    n_threads=arg_4,
                    **arg_5)
        arg_0.log.debug("Uploaded file %s to %s", arg_1, arg_2)


(dist, params_event_ndims, slices, params_overrides)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : if len ( arg_2 ) == 1 and arg_2 [ 0 ] == Ellipsis : arg_4 = { } else : arg_4 = _slice_params_to_dict ( arg_0 , arg_1 , arg_2 ) arg_4 . update ( arg_3 ) arg_5 = dict ( arg_0 . parameters , ** arg_4 ) arg_6 = type ( arg_0 ) ( ** arg_5 ) return arg_6

def Func(arg_0, arg_1, arg_2, arg_3):
  """Applies a single slicing step to `dist`, returning a new instance."""
  if len(arg_2) == 1 and arg_2[0] == Ellipsis:
    # The path used by Distribution.copy: batch_slice(...args..., Ellipsis)
    arg_4 = {}
  else:
    arg_4 = _slice_params_to_dict(arg_0, arg_1, arg_2)
  arg_4.update(arg_3)
  arg_5 = dict(arg_0.parameters, **arg_4)
  arg_6 = type(arg_0)(**arg_5)
  return arg_6

Applies a single slicing step to dist returning a new instance .


return np.count_nonzero(compare_shapes - compare_shapes[0]) == 0

def Func ( arg_0 , arg_1 ) : arg_2 = np . vstack ( arg_0 ) if arg_1 < arg_2 . shape [ 1 ] : arg_2 [ : , arg_1 ] = - 1 return np . count_nonzero ( arg_2 - arg_2 [ 0 ] ) == 0

def Func(arg_0, arg_1):
        """`ax` is a valid candidate for a distributed axis if the given
        subarray shapes are all the same when ignoring axis `ax`"""
        arg_2 = np.vstack(arg_0)
        if arg_1 < arg_2.shape[1]:
            arg_2[:, arg_1] = -1
        return np.count_nonzero(arg_2 - arg_2[0]) == 0

ax is a valid candidate for a distributed axis if the given subarray shapes are all the same when ignoring axis ax


def Func(arg_0, arg_1, arg_2):
        """
        Writes a local file in to the zip file and adds it to the manifest
        dictionary

        :param filename: The zip file name

        :param src_filename: the local file name
        """
        arg_3 = open(arg_2)
        with arg_3:
            arg_4 = arg_3.read()
        arg_0.manifest[arg_1] = md5hash(arg_4)
        arg_0.package_zip.write(arg_2, arg_1)


def Func(arg_0, arg_1, arg_2):
    """
    Run one iteration, profiling it if requested.

    :param inputs: (dict) mapping region input names to numpy.array values
    :param outputs: (dict) mapping region output names to numpy.arrays that
           should be populated with output values by this method
    """

    # Uncomment this to find out who is generating divide by 0, or other numpy warnings
    # numpy.seterr(divide='raise', invalid='raise', over='raise')

    # Modify this line to turn on profiling for a given node. The results file
    #  ('hotshot.stats') will be sensed and printed out by the vision framework's
    #  RunInference.py script at the end of inference.
    # Also uncomment the hotshot import at the top of this file.
    if False and arg_0.learningMode \
        and arg_0._iterations > 0 and arg_0._iterations <= 10:

      import hotshot
      if arg_0._iterations == 10:
        print "\n  Collecting and sorting internal node profiling stats generated by hotshot..."
        arg_3 = hotshot.stats.load("hotshot.stats")
        arg_3.strip_dirs()
        arg_3.sort_stats('time', 'calls')
        arg_3.print_stats()

      # The guts of the Func are contained in the _Func() call so that we
      # can profile it if requested.
      if arg_0._profileObj is None:
        print "\n  Preparing to capture profile using hotshot..."
        if os.path.exists('hotshot.stats'):
          # There is an old hotshot stats profile left over, remove it.
          os.remove('hotshot.stats')
        arg_0._profileObj = hotshot.Profile("hotshot.stats", 1, 1)
                                          # filename, lineevents, linetimings
      arg_0._profileObj.runcall(arg_0._Func, *[arg_1, arg_2])
    else:
      arg_0._Func(arg_1, arg_2)

Run one iteration profiling it if requested .


def Func(arg_0=None):
    """
    Get the HEAD commit SHA1 of repository in current dir.
    """
    if arg_0 is None: arg_0 = GIT_PATH
    arg_1 = Func_line(arg_0)
    arg_2 = arg_1.split()[1]
    return arg_2

Get the HEAD commit SHA1 of repository in current dir .


def
Func
(
arg_0
,
arg_1
)
:
LOG
.
info
(
"Loading transcript bulk"
)
try
:
arg_2
=
arg_0
.
transcript_collection
.
insert_many
(
arg_1
)
except
(
DuplicateKeyError
,
BulkWriteError
)
as
err
:
raise
IntegrityError
(
err
)
return
arg_2

def Func(arg_0, arg_1):
        """Load a bulk of transcript objects to the database

        Arguments:
            transcript_objs(iterable(scout.models.hgnc_transcript))

        """
        LOG.info("Loading transcript bulk")
        try:
            arg_2 = arg_0.transcript_collection.insert_many(arg_1)
        except (DuplicateKeyError, BulkWriteError) as err:
            raise IntegrityError(err)

        return arg_2


return [
        field for field in model._meta.get_fields()
        if isinstance(field, ParentalManyToManyField)
    ]

def Func ( arg_0 ) : return [ arg_1 for arg_1 in arg_0 . _meta . get_fields ( ) if isinstance ( arg_1 , ParentalManyToManyField ) ]

def Func(arg_0):
    """
    Return a list of ParentalManyToManyFields on the given model,
    including ones attached to ancestors of the model
    """
    return [
        arg_1 for arg_1 in arg_0._meta.get_fields()
        if isinstance(arg_1, ParentalManyToManyField)
    ]

Return a list of ParentalManyToManyFields on the given model including ones attached to ancestors of the model


return Screenshot(save_path, directory, image_name + '.' + ext, ext)

def Func ( arg_0 , * arg_1 , ** arg_2 ) : arg_3 = os . path . join ( os . path . dirname ( __file__ ) , 'take_Func.js' ) arg_4 = arg_2 . get ( 'save_dir' , '/tmp' ) arg_5 = arg_2 . get ( 'image_name' , None ) or _image_name_from_url ( arg_0 ) arg_6 = arg_2 . get ( 'format' , 'png' ) . lower ( ) arg_7 = os . path . join ( arg_4 , arg_5 ) + '.' + arg_6 arg_8 = arg_2 . get ( 'crop_to_visible' , False ) arg_9 = [ 'phantomjs' , '--ssl-protocol=any' , arg_3 , arg_0 , '--width' , str ( arg_2 [ 'width' ] ) , '--height' , str ( arg_2 [ 'height' ] ) , '--useragent' , str ( arg_2 [ 'user_agent' ] ) , '--dir' , arg_4 , '--ext' , arg_6 , '--name' , str ( arg_5 ) , ] if arg_8 : arg_9 . append ( '--croptovisible' ) arg_10 = subprocess . Popen ( arg_9 , stdout = subprocess . PIPE ) . communicate ( ) [ 0 ] return Screenshot ( arg_7 , arg_4 , arg_5 + '.' + arg_6 , arg_6 )

def Func(arg_0, *arg_1, **arg_2):
    """ Call PhantomJS with the specified flags and options. """

    arg_3 = os.path.join(os.path.dirname(__file__),
                                 'take_Func.js')

    arg_4 = arg_2.get('save_dir', '/tmp')
    arg_5 = arg_2.get('image_name', None) or _image_name_from_url(arg_0)
    arg_6 = arg_2.get('format', 'png').lower()
    arg_7 = os.path.join(arg_4, arg_5) + '.' + arg_6
    arg_8 = arg_2.get('crop_to_visible', False)

    arg_9 = [
        'phantomjs',
        '--ssl-protocol=any',
        arg_3,
        arg_0,
        '--width',
        str(arg_2['width']),
        '--height',
        str(arg_2['height']),
        '--useragent',
        str(arg_2['user_agent']),
        '--dir',
        arg_4,
        '--ext',
        arg_6,
        '--name',
        str(arg_5),
    ]
    if arg_8:
        arg_9.append('--croptovisible')

    # TODO:
    # - quality
    # - renderafter
    # - maxexecutiontime
    # - resourcetimeout

    arg_10 = subprocess.Popen(arg_9,
                              stdout=subprocess.PIPE).communicate()[0]

    return Screenshot(arg_7, arg_4, arg_5 + '.' + arg_6, arg_6)

Call PhantomJS with the specified flags and options .


def
Func
(
arg_0
)
:
arg_1
=
''
arg_0
=
fix_emails
(
arg_0
)
for
arg_2
in
invisible
.
finditer
(
arg_0
)
:
arg_1
+=
arg_2
.
group
(
'before'
)
arg_1
+=
' '
*
len
(
arg_2
.
group
(
'invisible'
)
)
assert
len
(
arg_0
)
>=
len
(
arg_1
)
,
'%d !>= %d'
%
(
len
(
arg_0
)
,
len
(
arg_1
)
)
arg_3
=
len
(
arg_0
)
len
(
arg_1
)
arg_1
+=
arg_0
[
arg_3
:
]
assert
len
(
arg_0
)
==
len
(
arg_1
)
,
'%d != %d'
%
(
len
(
arg_0
)
,
len
(
arg_1
)
)
return
arg_1

def Func(arg_0):
    '''
    Takes an HTML-like binary string as input and returns a binary
    string of the same length with all tags replaced by whitespace.
    This also detects script and style tags, and replaces the text
    between them with whitespace.

    Pre-existing whitespace of any kind (newlines, tabs) is converted
    to single spaces ' ', which has the same byte length (and
    character length).

    Note: this does not change any characters like ’ and  ,
    so taggers operating on this text must cope with such symbols.
    Converting them to some other character would change their byte
    length, even if equivalent from a character perspective.

    This is regex based, which can occassionally just hang...
    '''
    arg_1 = ''
    # Fix emails
    arg_0 = fix_emails(arg_0)

    for arg_2 in invisible.finditer(arg_0):
        arg_1 += arg_2.group('before')
        arg_1 += ' ' * len(arg_2.group('invisible'))

    # text better be >= original
    assert len(arg_0) >= len(arg_1), '%d !>= %d' % (len(arg_0), len(arg_1))

    # capture any characters after the last tag... such as newlines
    arg_3 = len(arg_0) - len(arg_1)
    arg_1 += arg_0[-arg_3:]

    # now they must be equal
    assert len(arg_0) == len(arg_1), '%d != %d' % (len(arg_0), len(arg_1))

    return arg_1

Takes an HTML - like binary string as input and returns a binary string of the same length with all tags replaced by whitespace . This also detects script and style tags and replaces the text between them with whitespace .