def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = 0 ) : arg_5 = arg_1 + arg_4 arg_6 = np . sin ( 2 * np . pi * np . arange ( arg_3 * .1 ) * 1000 / ( 1. * arg_3 ) ) arg_6 *= np . exp ( - np . arange ( arg_3 * .1 ) / ( arg_3 * .01 ) ) arg_7 = int ( arg_5 . max ( ) * arg_3 + arg_6 . shape [ 0 ] + 1 ) arg_8 = mir_eval . sonify . clicks ( arg_5 , arg_3 , arg_7 = arg_7 ) arg_9 = np . zeros ( max ( arg_10 ( arg_0 ) , arg_10 ( arg_8 ) ) ) arg_9 [ : arg_10 ( arg_0 ) ] = arg_0 arg_9 [ : arg_10 ( arg_8 ) ] += arg_8 scipy . io . wavfile . write ( arg_2 , arg_3 , arg_9 )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0):
    """Sonifies the estimated times into the output file.

    Parameters
    ----------
    audio: np.array
        Audio samples of the input track.
    clicks: np.array
        Click positions in seconds.
    out_file: str
        Path to the output file.
    fs: int
        Sample rate.
    offset: float
        Offset of the clicks with respect to the audio.
    """
    # Generate clicks (this should be done by mir_eval, but its
    # latest release is not compatible with latest numpy)
    arg_5 = arg_1 + arg_4
    # 1 kHz tone, 100ms
    arg_6 = np.sin(2 * np.pi * np.arange(arg_3 * .1) * 1000 / (1. * arg_3))
    # Exponential decay
    arg_6 *= np.exp(-np.arange(arg_3 * .1) / (arg_3 * .01))
    arg_7 = int(arg_5.max() * arg_3 + arg_6.shape[0] + 1)
    arg_8 = mir_eval.sonify.clicks(arg_5, arg_3, arg_7=arg_7)

    # Create array to store the audio plus the clicks
    arg_9 = np.zeros(max(arg_10(arg_0), arg_10(arg_8)))

    # Assign the audio and the clicks
    arg_9[:arg_10(arg_0)] = arg_0
    arg_9[:arg_10(arg_8)] += arg_8

    # Write to file
    scipy.io.wavfile.write(arg_2, arg_3, arg_9)

Sonifies the estimated times into the output file .


def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_3 = _replace ( arg_1 . value ) if arg_0 . use_terminal_shorthand : return [ arg_3 ] else : return [ "terminal({})" . format ( arg_3 ) ]

def Func(arg_0, arg_1, **arg_2):
    """Convert an AST terminal to python source code."""
    arg_3 = _replace(arg_1.value)
    if arg_0.use_terminal_shorthand:
      return [arg_3]
    else:
      return ["terminal({})".format(arg_3)]

Convert an AST terminal to python source code .


def Func(arg_0, arg_1, arg_2, **arg_3):
    '''Obtain particular version of the doc at key.'''
    if '_doc' in arg_3:
      arg_4 = arg_3['_doc']
    else:
      if type(arg_2) is int:
        if arg_2 == 0:
          arg_5 = pymongo.ASCENDING
        elif arg_2 == -1:
          arg_5 = pymongo.DESCENDING
        arg_4 = arg_0._collection.find_one({'k': arg_1}, sort=[['d', arg_5]])
      elif type(arg_2) is datetime:
        arg_6 = arg_0.__round_time(arg_2)
        arg_4 = arg_0._collection.find_one({'k': arg_1, 'd': arg_6})

    if arg_4 is None:
      raise KeyError('Supplied key `{0}` or version `{1}` does not exist'
          .format(arg_1, str(arg_2)))

    arg_7 = arg_4['v']
    return pickle.loads(arg_7)

Obtain particular version of the doc at key .


def Func(arg_0, arg_1, arg_2):
        """Merges trajectories by loading iteratively items of the other trajectory and
        store it into the current trajectory.

        :param rename_dict:

            Dictionary containing mappings from the old result names in the `other_trajectory`
            to the new names in the current trajectory.

        """
        for arg_3 in arg_2:
            arg_4 = arg_2[arg_3]

            arg_5 = arg_1.f_get(arg_3)

            if arg_5.f_is_empty():
                # To suppress warnings if nothing needs to be loaded
                with arg_0._nn_interface._disable_logging:
                    arg_1.f_load_item(arg_5)

            if not arg_0.f_contains(arg_4):
                arg_6 = arg_5.f_get_class_name()
                arg_7 = arg_0._create_class(arg_6)
                arg_8 = arg_0.f_add_leaf(arg_7, arg_4)
            else:
                arg_8 = arg_0.f_get(arg_4, shortcuts=False)

            if not arg_8.f_is_empty():
                raise RuntimeError('Something is wrong! Your item `%s` should be empty.' % arg_4)

            arg_9 = arg_5._store()
            arg_8._load(arg_9)
            arg_8.f_set_annotations(**arg_5.v_annotations.f_to_dict(copy=False))
            arg_8.v_comment = arg_5.v_comment

            arg_0.f_store_item(arg_8)

            # We do not want to blow up the RAM Memory
            if arg_5.v_is_parameter:
                arg_5.f_unlock()
                arg_8.f_unlock()
            arg_5.f_empty()
            arg_8.f_empty()

Merges trajectories by loading iteratively items of the other trajectory and store it into the current trajectory .


(cls, http_client, link_hash, src, config)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """\
        Writes an image src http string to disk as a temporary file
        and returns the LocallyStoredImage object
        that has the info you should need on the image
        """
        # check for a cache hit already on disk
        arg_5 = arg_0.read_localfile(arg_2, arg_3, arg_4)
        if arg_5:
            return arg_5

        # no cache found; do something else

        # parse base64 image
        if arg_3.startswith('data:image'):
            arg_5 = arg_0.write_localfile_base64(arg_2, arg_3, arg_4)
            return arg_5

        # download the image
        arg_6 = arg_1.fetch(arg_3)
        if arg_6:
            arg_5 = arg_0.write_localfile(arg_6, arg_2, arg_3, arg_4)
            if arg_5:
                return arg_5

        return None


def Func(arg_0, arg_1, arg_2):
        """Fit KimCNNClassifier according to X, y

        Parameters
        ----------
        X : list of string
            each item is a raw text
        y : list of string
            each item is a label
        """
        ####################
        # Data Loader
        ####################
        arg_3 = WordVectorTransformer(padding='max')
        arg_1 = arg_3.Func_transform(arg_1)
        arg_1 = LongTensor(arg_1)
        arg_0.word_vector_transformer = arg_3

        arg_4 = LabelEncoder()
        arg_2 = arg_4.Func_transform(arg_2)
        arg_2 = torch.from_numpy(arg_2)
        arg_0.y_transformer = arg_4

        arg_5 = CategorizedDataset(arg_1, arg_2)
        arg_6 = DataLoader(arg_5,
                                batch_size=arg_0.batch_size,
                                shuffle=True,
                                num_workers=4)

        ####################
        # Model
        ####################
        arg_7 = arg_0.kernel_sizes
        arg_8 = arg_0.num_kernel
        arg_9 = arg_0.embedding_dim

        arg_10 = TextCNN(
            vocab_size=arg_3.get_vocab_size(),
            embedding_dim=arg_9,
            output_size=len(arg_0.y_transformer.classes_),
            kernel_sizes=arg_7,
            num_kernel=arg_8)
        if USE_CUDA:
            arg_10 = arg_10.cuda()

        ####################
        # Train
        ####################
        arg_11 = arg_0.epoch
        arg_12 = arg_0.lr

        arg_13 = nn.CrossEntropyLoss()
        arg_14 = optim.Adam(arg_10.parameters(), lr=arg_12)

        for arg_15 in range(arg_11):
            arg_16 = []
            for arg_17, arg_18 in enumerate(arg_6):
                arg_1, arg_2 = arg_18
                arg_1, arg_2 = Variable(arg_1), Variable(arg_2)

                arg_14.zero_grad()
                arg_10.train()
                arg_19 = arg_10(arg_1)

                arg_20 = arg_13(arg_19, arg_2)
                arg_16.append(arg_20.data.tolist()[0])
                arg_20.backward()

                arg_14.step()

                if arg_17 % 100 == 0:
                    print("[%d/%d] mean_loss : %0.2f" % (
                        arg_15, arg_11, np.mean(arg_16)))
                    arg_16 = []
        arg_0.model = arg_10


(self, fn=None, package_name=None, update=0, list_only=0)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=0, arg_4=0):
        """
        Installs system packages listed in apt-requirements.txt.
        """
        arg_5 = arg_0.local_renderer
        assert arg_0.genv[ROLE]
        arg_6 = arg_1 or (arg_0.env.apt_requirments_fn and arg_0.find_template(arg_0.env.apt_requirments_fn))
        if not arg_6:
            return []
        assert os.path.isfile(arg_6)

        arg_7 = list(arg_0.env.apt_packages or [])
        for arg_8 in open(arg_6).readlines():
            if arg_8.strip() and not arg_8.strip().startswith('#') \
            and (not arg_2 or arg_8.strip() == arg_2):
                arg_7.extend(arg_9.strip() for arg_9 in arg_8.split(' ') if arg_9.strip())

        if arg_4:
            return arg_7

        arg_10 = arg_5.write_temp_file('\n'.join(arg_7))
        arg_6 = arg_10

        if not arg_0.genv.is_local:
            arg_5.put(local_path=arg_10, remote_path=arg_10)
            arg_6 = arg_0.genv.put_remote_path
        arg_5.sudo('DEBIAN_FRONTEND=noninteractive apt-get -yq update --fix-missing')
        arg_5.sudo('DEBIAN_FRONTEND=noninteractive apt-get -yq install `cat "%s" | tr "\\n" " "`' % arg_6)

Installs system packages listed in apt - requirements . txt .


async def Func ( arg_0 ) : arg_0 = list ( arg_0 . find_all ( 'table' , class_ = 'stripe' ) [ 0 ] . children ) [ 1 : ] arg_1 = [ ] for arg_2 in arg_0 : arg_3 = { 'gender' : None , 'name' : None , 'games' : { } } arg_3 [ 'gender' ] = arg_2 . abbr . get ( 'title' ) arg_3 [ 'name' ] = list ( arg_2 . children ) [ 1 ] . a . string arg_3 [ 'games' ] = [ ] for arg_4 in list ( list ( list ( arg_2 . children ) [ 1 ] . children ) [ 1 ] . children ) : if isinstance ( arg_4 , NavigableString ) : continue arg_3 [ 'games' ] . append ( { 'name' : arg_4 . string , 'id' : arg_4 . get ( 'href' ) . split ( '/' ) [ 1 ] } ) arg_1 . append ( arg_3 ) del arg_3 return arg_1

async def Func(arg_0):
    """
    Parse a page of character results.

    :param soup: The BS4 class object
    :return: Returns a list of dictionaries containing a name, gender and list of dictionaries containing a game name/id pair
             for games they appeared in.
    """
    arg_0 = list(arg_0.find_all('table', class_='stripe')[0].children)[1:]
    arg_1 = []
    for arg_2 in arg_0:
        arg_3 = {'gender': None, 'name': None, 'games': {}}
        arg_3['gender'] = arg_2.abbr.get('title')
        arg_3['name'] = list(arg_2.children)[1].a.string
        arg_3['games'] = []
        for arg_4 in list(list(list(arg_2.children)[1].children)[1].children):
            if isinstance(arg_4, NavigableString):
                continue
            arg_3['games'].append({'name': arg_4.string, 'id': arg_4.get('href').split('/')[1]})
        arg_1.append(arg_3)
        del arg_3
    return arg_1


def Func ( arg_0 , arg_1 , arg_2 = { } ) : arg_2 [ "published" ] = True return arg_0 . get_courses_in_account ( arg_1 , arg_2 )

def Func(arg_0, arg_1, arg_2={}):
        """
        Return a list of published courses for the passed account ID.
        """
        arg_2["published"] = True
        return arg_0.get_courses_in_account(arg_1, arg_2)

Return a list of published courses for the passed account ID .


def Func ( arg_0 ) : arg_1 = True for arg_2 in arg_0 . infile_list : arg_1 = arg_1 and naarad . utils . is_valid_file ( arg_2 ) if not arg_1 : return False arg_3 = arg_0 . Func_xml_jtl ( arg_0 . aggregation_granularity ) gc . collect ( ) return arg_3

def Func(arg_0):
    """
    Parse the Jmeter file and calculate key stats

    :return: status of the metric Func
    """
    arg_1 = True
    for arg_2 in arg_0.infile_list:
      arg_1 = arg_1 and naarad.utils.is_valid_file(arg_2)
      if not arg_1:
        return False

    arg_3 = arg_0.Func_xml_jtl(arg_0.aggregation_granularity)
    gc.collect()
    return arg_3

Parse the Jmeter file and calculate key stats

    :return: status of the metric parse


def
Func
(
arg_0
,
arg_1
)
:
if
not
_is_pil_image
(
arg_0
)
:
raise
TypeError
(
'img should be PIL Image. Got {}'
.
format
(
type
(
arg_0
)
)
)
arg_2
=
ImageEnhance
.
Contrast
(
arg_0
)
arg_0
=
arg_2
.
enhance
(
arg_1
)
return
arg_0

def Func(arg_0, arg_1):
    """Adjust contrast of an Image.

    Args:
        img (PIL Image): PIL Image to be adjusted.
        contrast_factor (float): How much to adjust the contrast. Can be any
            non negative number. 0 gives a solid gray image, 1 gives the
            original image while 2 increases the contrast by a factor of 2.

    Returns:
        PIL Image: Contrast adjusted image.
    """
    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))

    arg_2 = ImageEnhance.Contrast(arg_0)
    arg_0 = arg_2.enhance(arg_1)
    return arg_0


def Func ( arg_0 , arg_1 ) : arg_0 . gl . structure . validate_account_names ( arg_1 . get_referenced_accounts ( ) ) arg_0 . activities . append ( arg_1 ) arg_1 . set_parent_path ( arg_0 . path )

def Func(arg_0, arg_1):
        """
        Add an activity to the component.

        :param activity: The activity.
        """

        arg_0.gl.structure.validate_account_names(
            arg_1.get_referenced_accounts())
        arg_0.activities.append(arg_1)
        arg_1.set_parent_path(arg_0.path)


(self, file_path='',
        date=str(datetime.date.today()), organization='llnl')

def Func(arg_0, arg_1='',
        arg_2=arg_3(arg_4.date.today()), arg_6='llnl'):
        """
        Writes the referrers data to file.
        """
        arg_0.remove_date(arg_1=arg_1, arg_2=arg_2)
        arg_7 = os.path.isfile(arg_1)
        with open(arg_1, 'a') as out:
            if not arg_7:
                out.write('date,organization,referrer,count,count_log,uniques,'
                    + 'uniques_logged\n')
            arg_8 = sorted(arg_0.referrers_lower)#sort based on lowercase
            for arg_9 in arg_8:
                arg_10 = arg_0.referrers_lower[arg_9]#grab real name from
                arg_11 = arg_0.referrers[arg_10][0]
                arg_12 = arg_0.referrers[arg_10][1]
                if arg_11 == 1:#so we don't display 0 for count of 1
                    arg_11 = 1.5
                if arg_12 == 1:
                    arg_12 = 1.5
                arg_13 = math.log(arg_11)
                arg_14 = math.log(arg_12)
                out.write(arg_2 + ',' + arg_6 + ','
                + arg_10 + ',' + arg_3(arg_11) + ',' + arg_3(arg_13) + ','
                + arg_3(arg_12) + ',' + arg_3(arg_14) + '\n')
        out.close()


def Func ( arg_0 , Func = None ) : if Func is not None : arg_0 . _canvas . fontsize = Func else : return arg_0 . _canvas . fontsize

def Func(arg_0, Func=None):
        '''
        Set or return size of current font.

        :param fontsize: Size of font.
        :return: Size of font (if fontsize was not specified)
        '''
        if Func is not None:
            arg_0._canvas.fontsize = Func
        else:
            return arg_0._canvas.fontsize


(graph: BELGraph,
                                 node_predicates: Union[NodePredicate, Iterable[NodePredicate]],
                                 annotation: str = 'Subgraph',
                                 reverse: bool = True,
                                 )

return sorted(r2.items(), key=itemgetter(1), reverse=reverse)

def Func ( arg_0 : arg_1 , arg_2 : arg_3 [ arg_4 , arg_5 [ arg_4 ] ] , arg_6 : arg_7 = 'Subgraph' , arg_8 : arg_9 = True , ) -> List [ Tuple [ arg_7 , int ] ] : arg_10 = group_nodes_by_annotation_filtered ( arg_0 , arg_2 = arg_2 , arg_6 = arg_6 ) arg_11 = count_dict_values ( arg_10 ) return sorted ( arg_11 . items ( ) , key = itemgetter ( 1 ) , arg_8 = arg_8 )

def Func(arg_0: arg_1,
                                 arg_2: arg_3[arg_4, arg_5[arg_4]],
                                 arg_6: arg_7 = 'Subgraph',
                                 arg_8: arg_9 = True,
                                 ) -> List[Tuple[arg_7, int]]:
    """Rank sub-graphs by which have the most nodes matching an given filter.

    A use case for this function would be to identify which subgraphs contain the most differentially expressed
    genes.

    >>> from pybel import from_pickle
    >>> from pybel.constants import GENE
    >>> from pybel_tools.integration import overlay_type_data
    >>> from pybel_tools.summary import Func
    >>> import pandas as pd
    >>> graph = from_pickle('~/dev/bms/aetionomy/alzheimers.gpickle')
    >>> df = pd.read_csv('~/dev/bananas/data/alzheimers_dgxp.csv', columns=['Gene', 'log2fc'])
    >>> data = {gene: log2fc for _, gene, log2fc in df.itertuples()}
    >>> overlay_type_data(graph, data, 'log2fc', GENE, 'HGNC', impute=0.0)
    >>> results = Func(graph, lambda g, n: 1.3 < abs(g[n]['log2fc']))
    """
    arg_10 = group_nodes_by_annotation_filtered(arg_0, arg_2=arg_2, arg_6=arg_6)
    arg_11 = count_dict_values(arg_10)
    # TODO use instead: r2.most_common()
    return sorted(arg_11.items(), key=itemgetter(1), arg_8=arg_8)

Rank sub-graphs by which have the most nodes matching an given filter.

    A use case for this function would be to identify which subgraphs contain the most differentially expressed
    genes.

    >>> from pybel import from_pickle
    >>> from pybel.constants import GENE
    >>> from pybel_tools.integration import overlay_type_data
    >>> from pybel_tools.summary import rank_subgraph_by_node_filter
    >>> import pandas as pd
    >>> graph = from_pickle('~/dev/bms/aetionomy/alzheimers.gpickle')
    >>> df = pd.read_csv('~/dev/bananas/data/alzheimers_dgxp.csv', columns=['Gene', 'log2fc'])
    >>> data = {gene: log2fc for _, gene, log2fc in df.itertuples()}
    >>> overlay_type_data(graph, data, 'log2fc', GENE, 'HGNC', impute=0.0)
    >>> results = rank_subgraph_by_node_filter(graph, lambda g, n: 1.3 < abs(g[n]['log2fc']))

Rank sub - graphs by which have the most nodes matching an given filter .


def Func ( arg_0 ) : def runLoopAndExit ( ) : AppHelper . stopEventLoop ( ) AppHelper . callLater ( 1 , runLoopAndExit ) AppHelper . runConsoleEventLoop ( ) arg_1 = AppKit . NSWorkspace . sharedWorkspace ( ) arg_2 = arg_1 . runningApplications ( ) return arg_2

def Func(arg_0):
        """Get a list of the running applications."""

        def runLoopAndExit():
            AppHelper.stopEventLoop()

        AppHelper.callLater(1, runLoopAndExit)
        AppHelper.runConsoleEventLoop()
        # Get a list of running applications
        arg_1 = AppKit.NSWorkspace.sharedWorkspace()
        arg_2 = arg_1.runningApplications()
        return arg_2

Get a list of the running applications .


def Func ( arg_0 , arg_1 ) : if arg_2 . CONFIGURATION [ "mining" ] : if arg_2 . INTERN [ "file_to_test" ] not in arg_2 . INTERN [ "mined" ] : arg_2 . INTERN [ "mined" ] [ arg_2 . INTERN [ "file_to_test" ] ] = { } for arg_4 in arg_1 : if ( arg_4 in arg_2 . INTERN [ "mined" ] [ arg_2 . INTERN [ "file_to_test" ] ] ) : arg_2 . INTERN [ "mined" ] [ arg_2 . INTERN [ "file_to_test" ] ] [ arg_4 ] . extend ( arg_1 [ arg_4 ] ) else : arg_2 . INTERN [ "mined" ] [ arg_2 . INTERN [ "file_to_test" ] ] [ arg_4 ] = arg_1 [ arg_4 ] arg_2 . INTERN [ "mined" ] [ arg_2 . INTERN [ "file_to_test" ] ] [ arg_4 ] = List ( arg_2 . INTERN [ "mined" ] [ arg_2 . INTERN [ "file_to_test" ] ] [ arg_4 ] ) . format ( ) arg_0 . _backup ( )

def Func(arg_0, arg_1):
        """
        Add the currently mined information to the
        mined "database".

        :param toFunc: The element to add.
        :type toFunc: dict
        """

        if arg_2.CONFIGURATION["mining"]:
            # The mining is activated.

            if arg_2.INTERN["file_to_test"] not in arg_2.INTERN["mined"]:
                # Our tested file path is not into our mined database.

                # We initiate it.
                arg_2.INTERN["mined"][arg_2.INTERN["file_to_test"]] = {}

            for arg_4 in arg_1:
                # We loop through the element to add.

                if (
                    arg_4
                    in arg_2.INTERN["mined"][arg_2.INTERN["file_to_test"]]
                ):
                    # The element is already into the tested file path database.

                    # We extent it with our element to add.
                    arg_2.INTERN["mined"][arg_2.INTERN["file_to_test"]][
                        arg_4
                    ].extend(arg_1[arg_4])
                else:
                    # The element is already into the tested file path database.

                    # We initiate it.
                    arg_2.INTERN["mined"][arg_2.INTERN["file_to_test"]][
                        arg_4
                    ] = arg_1[arg_4]

                # We format the added information in order to avoid duplicate.
                arg_2.INTERN["mined"][arg_2.INTERN["file_to_test"]][
                    arg_4
                ] = List(
                    arg_2.INTERN["mined"][arg_2.INTERN["file_to_test"]][
                        arg_4
                    ]
                ).format()

            # We backup everything.
            arg_0._backup()

Add the currently mined information to the
        mined "database".

        :param to_add: The element to add.
        :type to_add: dict

Add the currently mined information to the mined database .


(self, width, height, window_handle='current')

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = 'current' ) : arg_0 . _execute ( Command . SET_WINDOW_SIZE , { 'width' : int ( arg_1 ) , 'height' : int ( arg_2 ) , 'window_handle' : arg_3 } )

def Func(arg_0, arg_1, arg_2, arg_3='current'):
        """Sets the width and height of the current window.

        Support:
            Web(WebView)

        Args:
            width(int): the width in pixels.
            height(int): the height in pixels.
            window_handle(str): Identifier of window_handle,
                default to 'current'.

        Returns:
            WebDriver Object.
        """
        arg_0._execute(Command.SET_WINDOW_SIZE, {
            'width': int(arg_1),
            'height': int(arg_2),
            'window_handle': arg_3})

Sets the width and height of the current window .


(
            self, vault_base_url, key_name, kty, key_size=None, key_ops=None, key_attributes=None, tags=None, curve=None, custom_headers=None, raw=False, **operation_config)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
=
,
arg_5
=
,
arg_6
=
,
arg_7
=
,
arg_8
=
,
arg_9
=
,
arg_10
=
False
,
**
arg_11
)
:
arg_12
=
models
.
KeyCreateParameters
(
arg_3
=
arg_3
,
arg_4
=
arg_4
,
arg_5
=
arg_5
,
arg_6
=
arg_6
,
arg_7
=
arg_7
,
arg_8
=
arg_8
)
arg_13
=
arg_0
.
Func
.
metadata
[
'url'
]
arg_14
=
{
'vaultBaseUrl'
:
arg_0
.
_serialize
.
url
(
"vault_base_url"
,
arg_1
,
'str'
,
skip_quote
=
True
)
,
'key-name'
:
arg_0
.
_serialize
.
url
(
"key_name"
,
arg_2
,
'str'
,
pattern
=
r'^[0-9a-zA-Z-]+$'
)
}
arg_13
=
arg_0
.
_client
.
format_url
(
arg_13
,
**
arg_14
)
arg_15
=
{
}
arg_15
[
'api-version'
]
=
arg_0
.
_serialize
.
query
(
"self.api_version"
,
arg_0
.
api_version
,
'str'
)
arg_16
=
{
}
arg_16
[
'Content-Type'
]
=
'application/json; charset=utf-8'
if
arg_0
.
config
.
generate_client_request_id
:
arg_16
[
'x-ms-client-request-id'
]
=
str
(
uuid
.
uuid1
(
)
)
if
arg_9
:
arg_16
.
update
(
arg_9
)
if
arg_0
.
config
.
accept_language
is
not
:
arg_16
[
'accept-language'
]
=
arg_0
.
_serialize
.
header
(
"self.config.accept_language"
,
arg_0
.
config
.
accept_language
,
'str'
)
arg_17
=
arg_0
.
_serialize
.
body
(
arg_12
,
'KeyCreateParameters'
)
arg_18
=
arg_0
.
_client
.
post
(
arg_13
,
arg_15
)
arg_19
=
arg_0
.
_client
.
send
(
arg_18
,
arg_16
,
arg_17
,
stream
=
False
,
**
arg_11
)
if
arg_19
.
status_code
not
in
[
200
]
:
raise
models
.
KeyVaultErrorException
(
arg_0
.
_deserialize
,
arg_19
)
arg_20
=
if
arg_19
.
status_code
==
200
:
arg_20
=
arg_0
.
_deserialize
(
'KeyBundle'
,
arg_19
)
if
arg_10
:
arg_21
=
ClientRawResponse
(
arg_20
,
arg_19
)
return
arg_21
return
arg_20

def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=None, arg_7=None, arg_8=None, arg_9=None, arg_10=False, **arg_11):
        """Creates a new key, stores it, then returns key parameters and
        attributes to the client.

        The create key operation can be used to create any key type in Azure
        Key Vault. If the named key already exists, Azure Key Vault creates a
        new version of the key. It requires the keys/create permission.

        :param vault_base_url: The vault name, for example
         https://myvault.vault.azure.net.
        :type vault_base_url: str
        :param key_name: The name for the new key. The system will generate
         the version name for the new key.
        :type key_name: str
        :param kty: The type of key to create. For valid values, see
         JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA',
         'RSA-HSM', 'oct'
        :type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType
        :param key_size: The key size in bits. For example: 2048, 3072, or
         4096 for RSA.
        :type key_size: int
        :param key_ops:
        :type key_ops: list[str or
         ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation]
        :param key_attributes:
        :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes
        :param tags: Application specific metadata in the form of key-value
         pairs.
        :type tags: dict[str, str]
        :param curve: Elliptic curve name. For valid values, see
         JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384',
         'P-521', 'SECP256K1'
        :type curve: str or
         ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: KeyBundle or ClientRawResponse if raw=true
        :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`KeyVaultErrorException<azure.keyvault.v2016_10_01.models.KeyVaultErrorException>`
        """
        arg_12 = models.KeyCreateParameters(arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, arg_6=arg_6, arg_7=arg_7, arg_8=arg_8)

        # Construct URL
        arg_13 = arg_0.Func.metadata['url']
        arg_14 = {
            'vaultBaseUrl': arg_0._serialize.url("vault_base_url", arg_1, 'str', skip_quote=True),
            'key-name': arg_0._serialize.url("key_name", arg_2, 'str', pattern=r'^[0-9a-zA-Z-]+$')
        }
        arg_13 = arg_0._client.format_url(arg_13, **arg_14)

        # Construct parameters
        arg_15 = {}
        arg_15['api-version'] = arg_0._serialize.query("self.api_version", arg_0.api_version, 'str')

        # Construct headers
        arg_16 = {}
        arg_16['Content-Type'] = 'application/json; charset=utf-8'
        if arg_0.config.generate_client_request_id:
            arg_16['x-ms-client-request-id'] = str(uuid.uuid1())
        if arg_9:
            arg_16.update(arg_9)
        if arg_0.config.accept_language is not None:
            arg_16['accept-language'] = arg_0._serialize.header("self.config.accept_language", arg_0.config.accept_language, 'str')

        # Construct body
        arg_17 = arg_0._serialize.body(arg_12, 'KeyCreateParameters')

        # Construct and send request
        arg_18 = arg_0._client.post(arg_13, arg_15)
        arg_19 = arg_0._client.send(
            arg_18, arg_16, arg_17, stream=False, **arg_11)

        if arg_19.status_code not in [200]:
            raise models.KeyVaultErrorException(arg_0._deserialize, arg_19)

        arg_20 = None

        if arg_19.status_code == 200:
            arg_20 = arg_0._deserialize('KeyBundle', arg_19)

        if arg_10:
            arg_21 = ClientRawResponse(arg_20, arg_19)
            return arg_21

        return arg_20

Creates a new key stores it then returns key parameters and attributes to the client .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . RCONTENTS + '/' + str ( arg_1 ) arg_4 = { arg_0 . PVERSION : arg_2 , arg_0 . PSTATUS : arg_0 . VHISTORICAL , arg_0 . PEXPAND : ',' . join ( arg_0 . VEXPAND ) } arg_5 = [ arg_5 for arg_5 in arg_0 . _call ( arg_3 , arg_4 ) ] return arg_5 [ 0 ]

def Func(arg_0, arg_1, arg_2):
        """Get the snapshot of a content for the given version.

        :param content_id: fetch the snapshot of this content
        :param version: snapshot version of the content
        """
        arg_3 = arg_0.RCONTENTS + '/' + str(arg_1)

        arg_4 = {
            arg_0.PVERSION: arg_2,
            arg_0.PSTATUS: arg_0.VHISTORICAL,
            arg_0.PEXPAND: ','.join(arg_0.VEXPAND)
        }

        # Only one item is returned
        arg_5 = [arg_5 for arg_5 in arg_0._call(arg_3, arg_4)]
        return arg_5[0]

Get the snapshot of a content for the given version .


Display a list of all users and which institutes they belong to.

return dict(
        users=sorted(user_objs, key=lambda user: -user['events']),
        total_events=total_events,
    )

def Func ( arg_0 ) : arg_1 = list ( arg_0 . Func ( ) ) arg_2 = arg_0 . user_events ( ) . count ( ) for arg_3 in arg_1 : if arg_3 . get ( 'institutes' ) : arg_3 [ 'institutes' ] = [ arg_0 . institute ( inst_id ) for inst_id in arg_3 . get ( 'institutes' ) ] else : arg_3 [ 'institutes' ] = [ ] arg_3 [ 'events' ] = arg_0 . user_events ( arg_3 ) . count ( ) arg_3 [ 'events_rank' ] = event_rank ( arg_3 [ 'events' ] ) return dict ( Func = sorted ( arg_1 , key = lambda user : - user [ 'events' ] ) , arg_2 = arg_2 , )

def Func(arg_0):
    """Display a list of all Func and which institutes they belong to."""
    arg_1 = list(arg_0.Func())
    arg_2 = arg_0.user_events().count()
    for arg_3 in arg_1:
        if arg_3.get('institutes'):
            arg_3['institutes'] = [arg_0.institute(inst_id) for inst_id in arg_3.get('institutes')]
        else:
            arg_3['institutes'] = []
        arg_3['events'] = arg_0.user_events(arg_3).count()
        arg_3['events_rank'] = event_rank(arg_3['events'])
    return dict(
        Func=sorted(arg_1, key=lambda user: -user['events']),
        arg_2=arg_2,
    )

Display a list of all users and which institutes they belong to .


def Func ( arg_0 , arg_1 ) : class FileHandler ( BaseCommand ) : def run ( arg_2 ) : arg_3 = arg_2 . distribution . package_data arg_4 = arg_0 or dict ( ) for ( arg_5 , arg_6 ) in arg_4 . items ( ) : arg_3 [ arg_5 ] = _get_package_data ( arg_5 , arg_6 ) arg_2 . distribution . data_files = _get_data_files ( arg_1 , arg_2 . distribution . data_files ) return FileHandler

def Func(arg_0, arg_1):
    """Get a package_data and data_files handler command.
    """
    class FileHandler(BaseCommand):

        def run(arg_2):
            arg_3 = arg_2.distribution.package_data
            arg_4 = arg_0 or dict()

            for (arg_5, arg_6) in arg_4.items():
                arg_3[arg_5] = _get_package_data(arg_5, arg_6)

            arg_2.distribution.data_files = _get_data_files(
                arg_1, arg_2.distribution.data_files
            )

    return FileHandler

Get a package_data and data_files handler command .


def Func(arg_0, arg_1, arg_2):
        """save the result of a completed task."""
        arg_3 = arg_1[0]
        try:
            arg_2 = arg_0.session.unserialize(arg_2)
        except Exception:
            arg_0.log.error("task::invalid task result message send to %r: %r",
                    arg_3, arg_2, exc_info=True)
            return

        arg_4 = arg_2['parent_header']
        if not arg_4:
            # print msg
            arg_0.log.warn("Task %r had no parent!", arg_2)
            return
        arg_5 = arg_4['msg_id']
        if arg_5 in arg_0.unassigned:
            arg_0.unassigned.remove(arg_5)

        arg_6 = arg_2['header']
        arg_7 = arg_6.get('engine', u'')
        arg_8 = arg_0.by_ident.get(cast_bytes(arg_7), None)

        arg_9 = arg_6.get('status', None)

        if arg_5 in arg_0.pending:
            arg_0.log.info("task::task %r finished on %s", arg_5, arg_8)
            arg_0.pending.remove(arg_5)
            arg_0.all_completed.add(arg_5)
            if arg_8 is not None:
                if arg_9 != 'aborted':
                    arg_0.completed[arg_8].append(arg_5)
                if arg_5 in arg_0.tasks[arg_8]:
                    arg_0.tasks[arg_8].remove(arg_5)
            arg_10 = arg_6['date']
            arg_11 = arg_6.get('started', None)
            arg_12 = {
                'result_header' : arg_6,
                'result_content': arg_2['content'],
                'started' : arg_11,
                'completed' : arg_10,
                'received' : datetime.now(),
                'engine_uuid': arg_7,
            }

            arg_12['result_buffers'] = arg_2['buffers']
            try:
                arg_0.db.update_record(arg_5, arg_12)
            except Exception:
                arg_0.log.error("DB Error saving task request %r", arg_5, exc_info=True)

        else:
            arg_0.log.debug("task::unknown task %r finished", arg_5)


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
os
.
path
.
dirname
(
__file__
)
arg_4
=
os
.
path
.
join
(
arg_3
,
"mappings"
,
arg_0
,
arg_2
,
arg_1
)
if
os
.
path
.
exists
(
arg_4
)
:
return
arg_4
else
:
arg_5
=
"Couldn't find parsing file: {}"
.
format
(
arg_4
)
logger
.
error
(
arg_5
)
raise
IOError
(
arg_5
)

def Func(arg_0, arg_1, arg_2):
    """
    Find the necessary file for the given test case.

    Args:
        device(napalm device connection): for which device
        filename(str): file to find
        path(str): where to find it relative to where the module is installed
    """
    # Find base_dir of submodule
    arg_3 = os.path.dirname(__file__)
    arg_4 = os.path.join(arg_3, "mappings", arg_0, arg_2, arg_1)

    if os.path.exists(arg_4):
        return arg_4
    else:
        arg_5 = "Couldn't find parsing file: {}".format(arg_4)
        logger.error(arg_5)
        raise IOError(arg_5)

Find the necessary file for the given test case .


def Func(arg_0, arg_1):
        """
        This will decode an instruction from memory pointed by `pc`

        :param int pc: address of the instruction
        """
        # No dynamic code!!! #TODO!
        # Check if instruction was already decoded
        if arg_1 in arg_0._instruction_cache:
            return arg_0._instruction_cache[arg_1]

        arg_2 = b''

        # Read Instruction from memory
        for arg_3 in range(arg_1, arg_1 + arg_0.max_instr_width):
            # This reads a byte from memory ignoring permissions
            # and concretize it if symbolic
            if not arg_0.memory.access_ok(arg_3, 'x'):
                break

            arg_4 = arg_0.memory[arg_3]

            if issymbolic(arg_4):
                # In case of fully symbolic memory, eagerly get a valid ptr
                if isinstance(arg_0.memory, LazySMemory):
                    try:
                        arg_5 = visitors.simplify_array_select(arg_4)
                        arg_4 = bytes([arg_5[0]])
                    except visitors.ArraySelectSimplifier.ExpressionNotSimple:
                        arg_4 = struct.pack('B', solver.get_value(arg_0.memory.constraints, arg_4))
                elif isinstance(arg_4, Constant):
                    arg_4 = bytes([arg_4.value])
                else:
                    logger.error('Concretize executable memory %r %r', arg_4, arg_2)
                    raise ConcretizeMemory(arg_0.memory,
                                           arg_3=arg_1,
                                           size=8 * arg_0.max_instr_width,
                                           policy='INSTRUCTION')
            arg_2 += arg_4

        # Pad potentially incomplete instruction with zeroes
        arg_6 = arg_2.ljust(arg_0.max_instr_width, b'\x00')

        try:
            # decode the instruction from code
            arg_7 = arg_0.disasm.disassemble_instruction(arg_6, arg_1)
        except StopIteration as e:
            raise DecodeException(arg_1, arg_6)

        # Check that the decoded instruction is contained in executable memory
        if not arg_0.memory.access_ok(slice(arg_1, arg_1 + arg_7.size), 'x'):
            logger.info("Trying to execute instructions from non-executable memory")
            raise InvalidMemoryAccess(arg_1, 'x')

        arg_7.operands = arg_0._wrap_operands(arg_7.operands)
        arg_0._instruction_cache[arg_1] = arg_7
        return arg_7

This will decode an instruction from memory pointed by pc


def Func ( arg_0 , arg_1 ) : arg_2 = os . path . basename ( arg_0 ) arg_0 = os . path . dirname ( arg_0 ) arg_0 = os . path . normpath ( os . path . abspath ( arg_0 ) ) arg_1 = os . path . normpath ( os . path . abspath ( arg_1 ) ) arg_3 = arg_0 . strip ( os . path . sep ) . split ( os . path . sep ) arg_4 = arg_1 . strip ( os . path . sep ) . split ( os . path . sep ) while arg_3 and arg_4 and arg_3 [ 0 ] == arg_4 [ 0 ] : arg_3 . pop ( 0 ) arg_4 . pop ( 0 ) arg_5 = [ '..' ] * len ( arg_4 ) + arg_3 + [ arg_2 ] if arg_5 == [ '' ] : return '.' + os . path . sep return os . path . sep . join ( arg_5 )

def Func(arg_0, arg_1):
    """
    Make a filename relative, where the filename path, and it is
    relative to rel_to

        >>> Func('/usr/share/something/a-file.pth',
        ...                    '/usr/share/another-place/src/Directory')
        '../../../something/a-file.pth'
        >>> Func('/usr/share/something/a-file.pth',
        ...                    '/home/user/src/Directory')
        '../../../usr/share/something/a-file.pth'
        >>> Func('/usr/share/a-file.pth', '/usr/share/')
        'a-file.pth'
    """
    arg_2 = os.path.basename(arg_0)
    arg_0 = os.path.dirname(arg_0)
    arg_0 = os.path.normpath(os.path.abspath(arg_0))
    arg_1 = os.path.normpath(os.path.abspath(arg_1))
    arg_3 = arg_0.strip(os.path.sep).split(os.path.sep)
    arg_4 = arg_1.strip(os.path.sep).split(os.path.sep)
    while arg_3 and arg_4 and arg_3[0] == arg_4[0]:
        arg_3.pop(0)
        arg_4.pop(0)
    arg_5 = ['..'] * len(arg_4) + arg_3 + [arg_2]
    if arg_5 == ['']:
        return '.' + os.path.sep
    return os.path.sep.join(arg_5)

Make a filename relative, where the filename path, and it is
    relative to rel_to

        >>> make_path_relative('/usr/share/something/a-file.pth',
        ...                    '/usr/share/another-place/src/Directory')
        '../../../something/a-file.pth'
        >>> make_path_relative('/usr/share/something/a-file.pth',
        ...                    '/home/user/src/Directory')
        '../../../usr/share/something/a-file.pth'
        >>> make_path_relative('/usr/share/a-file.pth', '/usr/share/')
        'a-file.pth'

Make a filename relative where the filename path and it is relative to rel_to


(get_transition_matrix_for_timestep,
                          get_transition_noise_for_timestep,
                          get_observation_matrix_for_timestep,
                          get_observation_noise_for_timestep)

def Func(arg_0,
                          arg_1,
                          arg_2,
                          arg_3):
  """Build a callable for one step of Kalman covariance recursion.

  Args:
    get_transition_matrix_for_timestep: callable taking a timestep
      as an integer `Tensor` argument, and returning a `LinearOperator`
      of shape `[latent_size, latent_size]`.
    get_transition_noise_for_timestep: callable taking a timestep as
      an integer `Tensor` argument, and returning a
      `MultivariateNormalLinearOperator` of event shape
      `[latent_size]`.
    get_observation_matrix_for_timestep: callable taking a timestep
      as an integer `Tensor` argument, and returning a `LinearOperator`
      of shape `[observation_size, observation_size]`.
    get_observation_noise_for_timestep: callable taking a timestep as
      an integer `Tensor` argument, and returning a
      `MultivariateNormalLinearOperator` of event shape
      `[observation_size]`.

  Returns:
    cov_step: a callable that computes latent state and observation
      covariance at time `t`, given latent covariance at time `t-1`.
  """

  def cov_step(arg_4, arg_5):
    """Single step of prior covariance recursion."""
    arg_6, arg_7 = arg_4

    arg_8 = _propagate_cov(
        arg_6,
        arg_0(arg_5 - 1),
        arg_1(arg_5 - 1))
    arg_9 = _propagate_cov(
        arg_8,
        arg_2(arg_5),
        arg_3(arg_5))

    return (arg_8, arg_9)

  return cov_step

Build a callable for one step of Kalman covariance recursion .


def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : return arg_0 [ ... , - 1 ] try : return arg_0 [ : , arg_1 ] except NotImplementedError : arg_1 = asarray ( arg_1 , int ) return asarray ( arg_0 , float ) [ : , arg_1 ]

def Func(arg_0, arg_1=None):
    r""" Compute dosage from allele expectation.

    Parameters
    ----------
    expec : array_like
        Allele expectations encoded as a samples-by-alleles matrix.
    alt : array_like, optional
        Alternative allele index. If ``None``, the allele having the minor
        allele frequency for the provided ``expec`` is used as the alternative.
        Defaults to ``None``.

    Returns
    -------
    :class:`numpy.ndarray`
        Dosage encoded as an array of size equal to the number of samples.

    Examples
    --------
    .. code-block:: python
        :caption: First a quick-start example.

        >>> from bgen_reader import allele_expectation, Func
        >>> from bgen_reader import example_files, read_bgen
        >>>
        >>> # Download an example.
        >>> example = example_files("example.32bits.bgen")
        >>> filepath = example.filepath
        >>>
        >>> # Read the example.
        >>> bgen = read_bgen(filepath, verbose=False)
        >>>
        >>> # Extract the allele expectations of the fourth variant.
        >>> variant_idx = 3
        >>> e = allele_expectation(bgen, variant_idx)
        >>>
        >>> # Compute the dosage when considering the first allele
        >>> # as the reference/alternative one.
        >>> alt_allele_idx = 1
        >>> d = Func(e, alt=alt_allele_idx)
        >>>
        >>> # Print the dosage of the first five samples only.
        >>> print(d[:5])
        [1.96185308 0.00982666 0.01745552 1.00347899 1.01153563]
        >>>
        >>> # Clean-up the example
        >>> example.close()

    .. code-block:: python
        :caption: Genotype probabilities, allele expectations and frequencies.

        >>> from bgen_reader import (
        ...     allele_expectation,
        ...     allele_frequency,
        ...     Func,
        ...     example_files,
        ...     read_bgen,
        ... )
        >>> from pandas import DataFrame
        >>> from xarray import DataArray
        >>>
        >>> # Download an example
        >>> example = example_files("example.32bits.bgen")
        >>> filepath = example.filepath
        >>>
        >>> # Open the bgen file.
        >>> bgen = read_bgen(filepath, verbose=False)
        >>> variants = bgen["variants"]
        >>> genotype = bgen["genotype"]
        >>> samples = bgen["samples"]
        >>>
        >>> variant_idx = 3
        >>> variant = variants.loc[variant_idx].compute()
        >>> # Print the metadata of the fourth variant.
        >>> print(variant)
                id    rsid chrom   pos  nalleles allele_ids  vaddr
        3  SNPID_5  RSID_5    01  5000         2        A,G  16034

        >>> geno = bgen["genotype"][variant_idx].compute()
        >>> metageno = DataFrame({k: geno[k] for k in ["ploidy", "missing"]},
        ...                      index=samples)
        >>> metageno.index.name = "sample"
        >>> print(metageno) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE
                    ploidy  missing
        sample
        sample_001       2    False
        sample_002       2    False
        sample_003       2    False
        sample_004       2    False
        ...            ...      ...
        sample_497       2    False
        sample_498       2    False
        sample_499       2    False
        sample_500       2    False
        <BLANKLINE>
        [500 rows x 2 columns]
        >>> p = DataArray(
        ...     geno["probs"],
        ...     name="probability",
        ...     coords={"sample": samples},
        ...     dims=["sample", "genotype"],
        ... )
        >>> # Print the genotype probabilities.
        >>> print(p.to_series().unstack(level=-1)) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE
        genotype          0        1        2
        sample
        sample_001  0.00488  0.02838  0.96674
        sample_002  0.99045  0.00928  0.00027
        sample_003  0.98932  0.00391  0.00677
        sample_004  0.00662  0.98328  0.01010
        ...             ...      ...      ...
        sample_497  0.00137  0.01312  0.98550
        sample_498  0.00552  0.99423  0.00024
        sample_499  0.01266  0.01154  0.97580
        sample_500  0.00021  0.98431  0.01547
        <BLANKLINE>
        [500 rows x 3 columns]
        >>> alleles = variant["allele_ids"].item().split(",")
        >>> e = DataArray(
        ...     allele_expectation(bgen, variant_idx),
        ...     name="expectation",
        ...     coords={"sample": samples, "allele": alleles},
        ...     dims=["sample", "allele"],
        ... )
        >>> # Print the allele expectations.
        >>> print(e.to_series().unstack(level=-1)) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE
        allele            A        G
        sample
        sample_001  0.03815  1.96185
        sample_002  1.99017  0.00983
        sample_003  1.98254  0.01746
        sample_004  0.99652  1.00348
        ...             ...      ...
        sample_497  0.01587  1.98413
        sample_498  1.00528  0.99472
        sample_499  0.03687  1.96313
        sample_500  0.98474  1.01526
        <BLANKLINE>
        [500 rows x 2 columns]
        >>> rsid = variant["rsid"].item()
        >>> chrom = variant["chrom"].item()
        >>> variant_name = f"{chrom}:{rsid}"
        >>> f = DataFrame(allele_frequency(e), columns=[variant_name], index=alleles)
        >>> f.index.name = "allele"
        >>> # Allele frequencies.
        >>> print(f) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE
                01:RSID_5
        allele
        A       305.97218
        G       194.02782
        >>> alt = f.idxmin().item()
        >>> alt_idx = alleles.index(alt)
        >>> d = Func(e, alt=alt_idx).to_series()
        >>> d = DataFrame(d.values, columns=[f"alt={alt}"], index=d.index)
        >>> # Dosages when considering G as the alternative allele.
        >>> print(d) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE
                      alt=G
        sample
        sample_001  1.96185
        sample_002  0.00983
        sample_003  0.01746
        sample_004  1.00348
        ...             ...
        sample_497  1.98413
        sample_498  0.99472
        sample_499  1.96313
        sample_500  1.01526
        <BLANKLINE>
        [500 rows x 1 columns]
        >>>
        >>> # Clean-up the example
        >>> example.close()
    """
    if arg_1 is None:
        return arg_0[..., -1]
    try:
        return arg_0[:, arg_1]
    except NotImplementedError:
        arg_1 = asarray(arg_1, int)
        return asarray(arg_0, float)[:, arg_1]

r""" Compute dosage from allele expectation.

    Parameters
    ----------
    expec : array_like
        Allele expectations encoded as a samples-by-alleles matrix.
    alt : array_like, optional
        Alternative allele index. If ``None``, the allele having the minor
        allele frequency for the provided ``expec`` is used as the alternative.
        Defaults to ``None``.

    Returns
    -------
    :class:`numpy.ndarray`
        Dosage encoded as an array of size equal to the number of samples.

    Examples
    --------
    .. code-block:: python
        :caption: First a quick-start example.

        >>> from bgen_reader import allele_expectation, compute_dosage
        >>> from bgen_reader import example_files, read_bgen
        >>>
        >>> # Download an example.
        >>> example = example_files("example.32bits.bgen")
        >>> filepath = example.filepath
        >>>
        >>> # Read the example.
        >>> bgen = read_bgen(filepath, verbose=False)
        >>>
        >>> # Extract the allele expectations of the fourth variant.
        >>> variant_idx = 3
        >>> e = allele_expectation(bgen, variant_idx)
        >>>
        >>> # Compute the dosage when considering the first allele
        >>> # as the reference/alternative one.
        >>> alt_allele_idx = 1
        >>> d = compute_dosage(e, alt=alt_allele_idx)
        >>>
        >>> # Print the dosage of the first five samples only.
        >>> print(d[:5])
        [1.96185308 0.00982666 0.01745552 1.00347899 1.01153563]
        >>>
        >>> # Clean-up the example
        >>> example.close()

    .. code-block:: python
        :caption: Genotype probabilities, allele expectations and frequencies.

        >>> from bgen_reader import (
        ...     allele_expectation,
        ...     allele_frequency,
        ...     compute_dosage,
        ...     example_files,
        ...     read_bgen,
        ... )
        >>> from pandas import DataFrame
        >>> from xarray import DataArray
        >>>
        >>> # Download an example
        >>> example = example_files("example.32bits.bgen")
        >>> filepath = example.filepath
        >>>
        >>> # Open the bgen file.
        >>> bgen = read_bgen(filepath, verbose=False)
        >>> variants = bgen["variants"]
        >>> genotype = bgen["genotype"]
        >>> samples = bgen["samples"]
        >>>
        >>> variant_idx = 3
        >>> variant = variants.loc[variant_idx].compute()
        >>> # Print the metadata of the fourth variant.
        >>> print(variant)
                id    rsid chrom   pos  nalleles allele_ids  vaddr
        3  SNPID_5  RSID_5    01  5000         2        A,G  16034

        >>> geno = bgen["genotype"][variant_idx].compute()
        >>> metageno = DataFrame({k: geno[k] for k in ["ploidy", "missing"]},
        ...                      index=samples)
        >>> metageno.index.name = "sample"
        >>> print(metageno) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE
                    ploidy  missing
        sample
        sample_001       2    False
        sample_002       2    False
        sample_003       2    False
        sample_004       2    False
        ...            ...      ...
        sample_497       2    False
        sample_498       2    False
        sample_499       2    False
        sample_500       2    False
        <BLANKLINE>
        [500 rows x 2 columns]
        >>> p = DataArray(
        ...     geno["probs"],
        ...     name="probability",
        ...     coords={"sample": samples},
        ...     dims=["sample", "genotype"],
        ... )
        >>> # Print the genotype probabilities.
        >>> print(p.to_series().unstack(level=-1)) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE
        genotype          0        1        2
        sample
        sample_001  0.00488  0.02838  0.96674
        sample_002  0.99045  0.00928  0.00027
        sample_003  0.98932  0.00391  0.00677
        sample_004  0.00662  0.98328  0.01010
        ...             ...      ...      ...
        sample_497  0.00137  0.01312  0.98550
        sample_498  0.00552  0.99423  0.00024
        sample_499  0.01266  0.01154  0.97580
        sample_500  0.00021  0.98431  0.01547
        <BLANKLINE>
        [500 rows x 3 columns]
        >>> alleles = variant["allele_ids"].item().split(",")
        >>> e = DataArray(
        ...     allele_expectation(bgen, variant_idx),
        ...     name="expectation",
        ...     coords={"sample": samples, "allele": alleles},
        ...     dims=["sample", "allele"],
        ... )
        >>> # Print the allele expectations.
        >>> print(e.to_series().unstack(level=-1)) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE
        allele            A        G
        sample
        sample_001  0.03815  1.96185
        sample_002  1.99017  0.00983
        sample_003  1.98254  0.01746
        sample_004  0.99652  1.00348
        ...             ...      ...
        sample_497  0.01587  1.98413
        sample_498  1.00528  0.99472
        sample_499  0.03687  1.96313
        sample_500  0.98474  1.01526
        <BLANKLINE>
        [500 rows x 2 columns]
        >>> rsid = variant["rsid"].item()
        >>> chrom = variant["chrom"].item()
        >>> variant_name = f"{chrom}:{rsid}"
        >>> f = DataFrame(allele_frequency(e), columns=[variant_name], index=alleles)
        >>> f.index.name = "allele"
        >>> # Allele frequencies.
        >>> print(f) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE
                01:RSID_5
        allele
        A       305.97218
        G       194.02782
        >>> alt = f.idxmin().item()
        >>> alt_idx = alleles.index(alt)
        >>> d = compute_dosage(e, alt=alt_idx).to_series()
        >>> d = DataFrame(d.values, columns=[f"alt={alt}"], index=d.index)
        >>> # Dosages when considering G as the alternative allele.
        >>> print(d) # doctest: +IGNORE_EXCEPTION_DETAIL, +NORMALIZE_WHITESPACE
                      alt=G
        sample
        sample_001  1.96185
        sample_002  0.00983
        sample_003  0.01746
        sample_004  1.00348
        ...             ...
        sample_497  1.98413
        sample_498  0.99472
        sample_499  1.96313
        sample_500  1.01526
        <BLANKLINE>
        [500 rows x 1 columns]
        >>>
        >>> # Clean-up the example
        >>> example.close()

r Compute dosage from allele expectation .


def Func(arg_0, arg_1):
        """
        Unregister the SizedImage subclass currently assigned to `attr_name`.

        If a SizedImage subclass isn't already registered to `attr_name`
        NotRegistered will raise.
        """
        if arg_1 not in arg_0._sizedimage_registry:
            raise NotRegistered(
                'No SizedImage subclass is registered to %s' % arg_1
            )
        else:
            del arg_0._sizedimage_registry[arg_1]

Unregister the SizedImage subclass currently assigned to attr_name .


(self, prev_state, inputs, precomputed_values=None, mask=None)

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):
        """
        Compute the context vector with soft attention.
        """
        arg_3 = arg_3 if arg_3 else arg_0.precompute(arg_2)
        arg_5 = arg_0.compute_alignments(arg_1, arg_3, arg_4)
        arg_6 = T.sum(arg_5[:, :, None] * arg_2, axis=1)
        return arg_6

Compute the context vector with soft attention .


def Func ( arg_0 , arg_1 ) : arg_2 = [ action for action in arg_0 . _actions if isinstance ( action , argparse . _SubParsersAction ) ] for arg_3 in arg_2 : for arg_4 , arg_5 in arg_3 . choices . items ( ) : if arg_4 == arg_1 : return arg_5 return None

def Func(arg_0, arg_1):
  '''
  Retrieve the given subparser from parser
  '''
  # pylint: disable=protected-access
  arg_2 = [action for action in arg_0._actions
                        if isinstance(action, argparse._SubParsersAction)]

  # there will probably only be one subparser_action,
  # but better save than sorry
  for arg_3 in arg_2:
    # get all subparsers
    for arg_4, arg_5 in arg_3.choices.items():
      if arg_4 == arg_1:
        return arg_5
  return None


def Func ( arg_0 , arg_1 = None ) : arg_0 . _check_executed ( ) arg_2 = arg_0 . _fetch_row ( arg_1 or arg_0 . arraysize ) arg_0 . rownumber = arg_0 . rownumber + len ( arg_2 ) if not arg_2 : arg_0 . _warning_check ( ) return arg_2

def Func(arg_0, arg_1=None):
        """Fetch up to size rows from the cursor. Result set may be smaller
        than size. If size is not defined, cursor.arraysize is used."""
        arg_0._check_executed()
        arg_2 = arg_0._fetch_row(arg_1 or arg_0.arraysize)
        arg_0.rownumber = arg_0.rownumber + len(arg_2)
        if not arg_2:
            arg_0._warning_check()
        return arg_2

Fetch up to size rows from the cursor . Result set may be smaller than size . If size is not defined cursor . arraysize is used .


def Func(arg_0, arg_1, arg_2):
    """
    Initialize the bucket map assuming the given number of maxBuckets.
    """
    # The first bucket index will be _maxBuckets / 2 and bucket indices will be
    # allowed to grow lower or higher as long as they don't become negative.
    # _maxBuckets is required because the current SDR Classifier assumes bucket
    # indices must be non-negative. This normally does not need to be changed
    # but if altered, should be set to an even number.
    arg_0._maxBuckets = arg_1
    arg_0.minIndex = arg_0._maxBuckets / 2
    arg_0.maxIndex = arg_0._maxBuckets / 2

    # The scalar offset used to map scalar values to bucket indices. The middle
    # bucket will correspond to numbers in the range
    # [offset-resolution/2, offset+resolution/2).
    # The bucket index for a number x will be:
    #     maxBuckets/2 + int( round( (x-offset)/resolution ) )
    arg_0._offset = arg_2

    # This dictionary maps a bucket index into its bit representation
    # We initialize the class with a single bucket with index 0
    arg_0.bucketMap = {}

    def _permutation(arg_8):
      arg_9 = numpy.arange(arg_8, dtype=numpy.uint32)
      arg_0.random.shuffle(arg_9)
      return arg_9

    arg_0.bucketMap[arg_0.minIndex] = _permutation(arg_0.n)[0:arg_0.w]

    # How often we need to retry when generating valid encodings
    arg_0.numTries = 0

Initialize the bucket map assuming the given number of maxBuckets .


(self, url, name, callback=None, params=None, headers=None)

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None):
        """
        Asynchronous DELETE request with the process pool.
        """
        if not arg_2: arg_2 = ''
        arg_4 = arg_4 or {}
        arg_5 = arg_5 or {}
        arg_6 = arg_0._build_endpoint_url(arg_1, arg_2)
        arg_0._authenticate(arg_4, arg_5)
        process_pool.apply_async(make_delete_request,
                    args=(arg_6, arg_4, arg_5), arg_3=arg_3)

Asynchronous DELETE request with the process pool .


def Func ( arg_0 , arg_1 ) : arg_1 = getattr ( pgmagick . LineCap , "%sCap" % arg_1 . title ( ) ) arg_1 = pgmagick . DrawableStrokeLineCap ( arg_1 ) arg_0 . drawer . append ( arg_1 )

def Func(arg_0, arg_1):
        """set to stroke linecap.

        :param linecap: 'undefined', 'butt', 'round', 'square'
        :type linecap: str
        """
        arg_1 = getattr(pgmagick.LineCap, "%sCap" % arg_1.title())
        arg_1 = pgmagick.DrawableStrokeLineCap(arg_1)
        arg_0.drawer.append(arg_1)


def Func(arg_0, arg_1):
        '''Return the solid named "name". Throws if it does not exist.

        Args:
            name (str): Name of solid

        Returns:
            SolidDefinition: SolidDefinition with correct name.
        '''
        check.str_param(arg_1, 'name')
        if arg_1 not in arg_0._solid_dict:
            raise DagsterInvariantViolationError(
                'Pipeline {pipeline_name} has no solid named {name}.'.format(
                    pipeline_name=arg_0.name, arg_1=arg_1
                )
            )
        return arg_0._solid_dict[arg_1]

Return the solid named name . Throws if it does not exist .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
re_crossref
.
match
(
arg_1
)
if
arg_2
:
try
:
arg_3
=
arg_2
.
group
(
1
)
arg_4
=
arg_2
.
group
(
2
)
arg_5
=
arg_0
.
identifiers
[
arg_3
]
arg_6
=
arg_0
.
make_block_url
(
arg_5
)
return
''
+
arg_3
+
''
+
arg_4
except
:
sys
.
stderr
.
write
(
"WARNING: undefined cross reference '"
+
arg_3
+
"'.\n"
)
return
'?'
+
arg_3
+
'?'
+
arg_4
arg_2
=
re_italic
.
match
(
arg_1
)
if
arg_2
:
arg_3
=
arg_2
.
group
(
1
)
arg_4
=
arg_2
.
group
(
3
)
return
''
+
arg_3
+
''
+
arg_4
arg_2
=
re_bold
.
match
(
arg_1
)
if
arg_2
:
arg_3
=
arg_2
.
group
(
1
)
arg_4
=
arg_2
.
group
(
3
)
return
''
+
arg_3
+
''
+
arg_4
return
html_quote
(
arg_1
)

def  Func( arg_0, arg_1 ):
        """analyze a simple word to detect cross-references and styling"""
        # look for cross-references
        arg_2 = re_crossref.match( arg_1 )
        if arg_2:
            try:
                arg_3 = arg_2.group( 1 )
                arg_4 = arg_2.group( 2 )
                arg_5 = arg_0.identifiers[arg_3]
                arg_6   = arg_0.make_block_url( arg_5 )
                return '' + arg_3 + '' + arg_4
            except:
                # we detected a cross-reference to an unknown item
                sys.stderr.write( \
                   "WARNING: undefined cross reference '" + arg_3 + "'.\n" )
                return '?' + arg_3 + '?' + arg_4

        # look for italics and bolds
        arg_2 = re_italic.match( arg_1 )
        if arg_2:
            arg_3 = arg_2.group( 1 )
            arg_4 = arg_2.group( 3 )
            return '' + arg_3 + '' + arg_4

        arg_2 = re_bold.match( arg_1 )
        if arg_2:
            arg_3 = arg_2.group( 1 )
            arg_4 = arg_2.group( 3 )
            return '' + arg_3 + '' + arg_4

        return html_quote( arg_1 )

analyze a simple word to detect cross - references and styling


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
with
arg_0
.
engine
.
begin
(
)
as
db
:
try
:
arg_4
=
get_directory
(
db
,
arg_0
.
user_id
,
arg_1
,
arg_2
)
except
NoSuchDirectory
:
if
arg_0
.
file_exists
(
arg_1
)
:
arg_0
.
do_400
(
"Wrong type: %s"
%
arg_1
)
else
:
arg_0
.
no_such_entity
(
arg_1
)
return
arg_0
.
_directory_model_from_db
(
arg_4
,
arg_2
)

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Get a directory from the database.
        """
        with arg_0.engine.begin() as db:
            try:
                arg_4 = get_directory(
                    db, arg_0.user_id, arg_1, arg_2
                )
            except NoSuchDirectory:
                if arg_0.file_exists(arg_1):
                    # TODO: It's awkward/expensive to have to check this to
                    # return a 400 instead of 404. Consider just 404ing.
                    arg_0.do_400("Wrong type: %s" % arg_1)
                else:
                    arg_0.no_such_entity(arg_1)

        return arg_0._directory_model_from_db(arg_4, arg_2)


def Func(arg_0, arg_1='', arg_2=True):
        """ If possible, set the input buffer to a previous history item.

        Parameters:
        -----------
        substring : str, optional
            If specified, search for an item with this substring.
        as_prefix : bool, optional
            If True, the substring must match at the beginning (default).

        Returns:
        --------
        Whether the input buffer was changed.
        """
        arg_3 = arg_0._history_index
        arg_4 = False
        while arg_3 > 0:
            arg_3 -= 1
            arg_5 = arg_0._get_edited_history(arg_3)
            if (arg_2 and arg_5.startswith(arg_1)) \
                or (not arg_2 and arg_1 in arg_5):
                arg_4 = True
                break

        if arg_4:
            arg_0._store_edits()
            arg_0._history_index = arg_3
            arg_0.input_buffer = arg_5

        return arg_4

If possible set the input buffer to a previous history item .


def Func(arg_0, arg_1, arg_2, arg_3):
    """
    Returns a list of all tfvc branches for the supplied project within the supplied collection
    """
    arg_4 = []
    arg_5 = create_tfs_tfvc_client('{url}/{collection_name}'.format(arg_0=arg_0, collection_name=arg_2.name), arg_1)

    logger.debug('Retrieving Tfvc Branches for Project: {project_name}'.format(project_name=arg_3.name))
    arg_6 = arg_5.get_branches(arg_3.id, True, True, False, True)
    if arg_6:
        arg_4.extend(arg_6)
    else:
        logger.debug('No Tfvcc Branches in Project: {project_name}'.format(project_name=arg_3.name))

    return arg_4


def Func ( arg_0 ) : arg_1 , arg_2 , arg_3 = arg_0 . partition ( '=' ) arg_1 , arg_3 = arg_1 . strip ( ) , arg_3 . strip ( ) . encode ( 'unicode-escape' ) . decode ( 'ascii' ) if arg_3 and arg_3 [ 0 ] == arg_3 [ - 1 ] in [ '"' , "'" ] : arg_3 = __escape_decoder ( arg_3 [ 1 : - 1 ] ) [ 0 ] return arg_1 , arg_3

def Func(arg_0):
    """
    Split a env var text like

    ENV_VAR_NAME=env_var_value

    into a tuple ('ENV_VAR_NAME', 'env_var_value')
    """
    arg_1, arg_2, arg_3 = arg_0.partition('=')

    # Remove any leading and trailing spaces in key, value
    arg_1, arg_3 = arg_1.strip(), arg_3.strip().encode('unicode-escape').decode('ascii')

    if arg_3 and arg_3[0] == arg_3[-1] in ['"', "'"]:
        arg_3 = __escape_decoder(arg_3[1:-1])[0]
    return arg_1, arg_3


def
Func
(
arg_0
)
:
arg_0
.
log
.
info
(
"Registering with controller at %s"
%
arg_0
.
url
)
arg_1
=
arg_0
.
context
arg_2
,
arg_3
=
arg_0
.
init_connector
(
)
arg_4
=
arg_1
.
socket
(
zmq
.
DEALER
)
arg_4
.
setsockopt
(
zmq
.
IDENTITY
,
arg_0
.
bident
)
arg_2
(
arg_4
,
arg_0
.
url
)
arg_0
.
registrar
=
zmqstream
.
ZMQStream
(
arg_4
,
arg_0
.
loop
)
arg_6
=
dict
(
queue
=
arg_0
.
ident
,
heartbeat
=
arg_0
.
ident
,
control
=
arg_0
.
ident
)
arg_0
.
registrar
.
on_recv
(
lambda
msg
:
arg_0
.
complete_registration
(
msg
,
arg_2
,
arg_3
)
)
arg_0
.
session
.
send
(
arg_0
.
registrar
,
"registration_request"
,
arg_6
=
arg_6
)

def Func(arg_0):
        """send the registration_request"""

        arg_0.log.info("Registering with controller at %s"%arg_0.url)
        arg_1 = arg_0.context
        arg_2,arg_3 = arg_0.init_connector()
        arg_4 = arg_1.socket(zmq.DEALER)
        arg_4.setsockopt(zmq.IDENTITY, arg_0.bident)
        arg_2(arg_4, arg_0.url)
        arg_0.registrar = zmqstream.ZMQStream(arg_4, arg_0.loop)

        arg_6 = dict(queue=arg_0.ident, heartbeat=arg_0.ident, control=arg_0.ident)
        arg_0.registrar.on_recv(lambda msg: arg_0.complete_registration(msg, arg_2, arg_3))
        # print (self.session.key)
        arg_0.session.send(arg_0.registrar, "registration_request",arg_6=arg_6)


(theta1, phi1, lambda1, theta2, phi2, lambda2)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):
        """Return a triple theta, phi, lambda for the product.

        u3(theta, phi, lambda)
           = u3(theta1, phi1, lambda1).u3(theta2, phi2, lambda2)
           = Rz(phi1).Ry(theta1).Rz(lambda1+phi2).Ry(theta2).Rz(lambda2)
           = Rz(phi1).Rz(phi').Ry(theta').Rz(lambda').Rz(lambda2)
           = u3(theta', phi1 + phi', lambda2 + lambda')

        Return theta, phi, lambda.
        """
        # Careful with the factor of two in yzy_to_zyz
        arg_6, arg_7, arg_8 = Optimize1qGates.yzy_to_zyz((arg_2 + arg_4), arg_0, arg_3)
        (arg_9, arg_10, arg_11) = (arg_6, arg_1 + arg_7, arg_5 + arg_8)

        return (arg_9, arg_10, arg_11)

Return a triple theta phi lambda for the product .


def Func(arg_0):
        """Load metadata from the archive file"""

        logger.debug("Loading metadata infomation of archive %s", arg_0.archive_path)

        arg_1 = arg_0._db.cursor()
        arg_2 = "SELECT origin, backend_name, backend_version, " \
                      "category, backend_params, created_on " \
                      "FROM " + arg_0.METADATA_TABLE + " " \
                      "LIMIT 1"
        arg_1.execute(arg_2)
        arg_3 = arg_1.fetchone()
        arg_1.close()

        if arg_3:
            arg_0.origin = arg_3[0]
            arg_0.backend_name = arg_3[1]
            arg_0.backend_version = arg_3[2]
            arg_0.category = arg_3[3]
            arg_0.backend_params = pickle.loads(arg_3[4])
            arg_0.created_on = str_to_datetime(arg_3[5])
        else:
            logger.debug("Metadata of archive %s was empty", arg_0.archive_path)

        logger.debug("Metadata of archive %s loaded", arg_0.archive_path)


def
Func
(
arg_0
,
*
arg_1
)
:
arg_0
.
_searchers
.
extend
(
arg_1
)
debug
.
logger
&
debug
.
flagCompiler
and
debug
.
logger
(
'current compiled MIBs location(s): %s'
%
', '
.
join
(
[
str
(
arg_2
)
for
arg_2
in
arg_0
.
_searchers
]
)
)
return
arg_0

def Func(arg_0, *arg_1):
        """Add more transformed MIBs repositories.

        MibCompiler.compile will invoke each of configured searcher objects
        in order of their addition asking each if already transformed MIB
        module already exists and is more recent than specified.

        Args:
            searchers: searcher object(s)

        Returns:
            reference to itself (can be used for call chaining)

        """
        arg_0._searchers.extend(arg_1)

        debug.logger & debug.flagCompiler and debug.logger(
            'current compiled MIBs location(s): %s' % ', '.join([str(arg_2) for arg_2 in arg_0._searchers]))

        return arg_0

Add more transformed MIBs repositories .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
arg_0
.
_get_object_handle
(
arg_1
,
arg_2
)
if
not
arg_3
.
AXEnabled
:
raise
LdtpServerException
(
u"Object %s state disabled"
%
arg_2
)
arg_4
=
arg_3
.
AXRows
[
1
]
if
not
arg_4
.
AXSelected
:
arg_3
.
activate
(
)
arg_4
.
AXSelected
=
True
else
:
pass
return
1

def Func(arg_0, arg_1, arg_2):
        """
        Select last row

        @param window_name: Window name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type window_name: string
        @param object_name: Object name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type object_name: string

        @return: 1 on success.
        @rtype: integer
        """
        arg_3 = arg_0._get_object_handle(arg_1, arg_2)
        if not arg_3.AXEnabled:
            raise LdtpServerException(u"Object %s state disabled" % arg_2)

        arg_4 = arg_3.AXRows[-1]
        if not arg_4.AXSelected:
            arg_3.activate()
            arg_4.AXSelected = True
        else:
            # Selected
            pass
        return 1


def Func(arg_0, arg_1=None, arg_2=False):
        """
        Returns a stderr-suitable file-like object based on the
        optional os_path and optionally skipping any configured
        sub-command.
        """
        arg_3 = None if arg_2 else arg_0.stderr_sub_command
        arg_4, arg_5 = arg_0._get_out_and_path(
            arg_0.stderr, arg_0.stderr_root, arg_3, arg_1)
        if hasattr(arg_4, 'stdin'):
            return arg_4.stdin
        return arg_4

Returns a stderr - suitable file - like object based on the optional os_path and optionally skipping any configured sub - command .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
[
]
arg_3
=
struct
.
pack
(
'2H'
,
*
arg_1
)
arg_0
.
_cmd
(
'DMPAFT'
)
arg_4
=
VProCRC
.
get
(
arg_3
)
arg_4
=
struct
.
pack
(
'>H'
,
arg_4
)
log_raw
(
'send'
,
arg_3
+
arg_4
)
arg_0
.
port
.
write
(
arg_3
+
arg_4
)
arg_5
=
arg_0
.
port
.
read
(
len
(
arg_0
.
ACK
)
)
log_raw
(
'read'
,
arg_5
)
if
arg_5
!=
arg_0
.
ACK
:
return
arg_6
=
arg_0
.
port
.
read
(
DmpStruct
.
size
)
log_raw
(
'read'
,
arg_6
)
if
not
VProCRC
.
verify
(
arg_6
)
:
log_raw
(
'send ESC'
,
arg_0
.
ESC
)
arg_0
.
port
.
write
(
arg_0
.
ESC
)
return
log_raw
(
'send ACK'
,
arg_0
.
ACK
)
arg_0
.
port
.
write
(
arg_0
.
ACK
)
arg_7
=
DmpStruct
.
unpack
(
arg_6
)
log
.
info
(
'reading %d pages, start offset %d'
%
(
arg_7
[
'Pages'
]
,
arg_7
[
'Offset'
]
)
)
for
arg_8
in
xrange
(
arg_7
[
'Pages'
]
)
:
arg_6
=
arg_0
.
port
.
read
(
DmpPageStruct
.
size
)
log_raw
(
'read'
,
arg_6
)
if
not
VProCRC
.
verify
(
arg_6
)
:
log_raw
(
'send ESC'
,
arg_0
.
ESC
)
arg_0
.
port
.
write
(
arg_0
.
ESC
)
return
log_raw
(
'send ACK'
,
arg_0
.
ACK
)
arg_0
.
port
.
write
(
arg_0
.
ACK
)
arg_9
=
DmpPageStruct
.
unpack
(
arg_6
)
arg_10
=
0
if
arg_8
==
0
:
arg_10
=
arg_7
[
'Offset'
]
*
ArchiveAStruct
.
size
while
arg_10
<
ArchiveAStruct
.
size
*
5
:
log
.
info
(
'page %d, reading record at offset %d'
%
(
arg_9
[
'Index'
]
,
arg_10
)
)
if
arg_0
.
_use_rev_b_archive
(
arg_9
[
'Records'
]
,
arg_10
)
:
arg_11
=
ArchiveBStruct
.
unpack_from
(
arg_9
[
'Records'
]
,
arg_10
)
else
:
arg_11
=
ArchiveAStruct
.
unpack_from
(
arg_9
[
'Records'
]
,
arg_10
)
if
arg_11
[
'DateStamp'
]
!=
0xffff
and
arg_11
[
'TimeStamp'
]
!=
0xffff
:
arg_2
.
append
(
arg_11
)
arg_10
+=
ArchiveAStruct
.
size
log
.
info
(
'read all pages'
)
return
arg_2

def Func(arg_0, arg_1):
        '''
        issue a command to read the archive records after a known time stamp.
        '''
        arg_2 = []
        # convert time stamp fields to buffer
        arg_3 = struct.pack('2H', *arg_1)

        # 1. send 'DMPAFT' cmd
        arg_0._cmd('DMPAFT')

        # 2. send time stamp + crc
        arg_4 = VProCRC.get(arg_3)
        arg_4 = struct.pack('>H', arg_4)  # crc in big-endian format
        log_raw('send', arg_3 + arg_4)
        arg_0.port.write(arg_3 + arg_4)  # send time stamp + crc
        arg_5 = arg_0.port.read(len(arg_0.ACK))  # read ACK
        log_raw('read', arg_5)
        if arg_5 != arg_0.ACK: return  # if bad ack, return

        # 3. read pre-amble data
        arg_6 = arg_0.port.read(DmpStruct.size)
        log_raw('read', arg_6)
        if not VProCRC.verify(arg_6):  # check CRC value
            log_raw('send ESC', arg_0.ESC)
            arg_0.port.write(arg_0.ESC)  # if bad, escape and abort
            return
        log_raw('send ACK', arg_0.ACK)
        arg_0.port.write(arg_0.ACK)  # send ACK

        # 4. loop through all page records
        arg_7 = DmpStruct.unpack(arg_6)
        log.info('reading %d pages, start offset %d' %
                 (arg_7['Pages'], arg_7['Offset']))
        for arg_8 in xrange(arg_7['Pages']):
            # 5. read page data
            arg_6 = arg_0.port.read(DmpPageStruct.size)
            log_raw('read', arg_6)
            if not VProCRC.verify(arg_6):  # check CRC value
                log_raw('send ESC', arg_0.ESC)
                arg_0.port.write(arg_0.ESC)  # if bad, escape and abort
                return
            log_raw('send ACK', arg_0.ACK)
            arg_0.port.write(arg_0.ACK)  # send ACK

            # 6. loop through archive records
            arg_9 = DmpPageStruct.unpack(arg_6)
            arg_10 = 0  # assume offset at 0
            if arg_8 == 0:
                arg_10 = arg_7['Offset'] * ArchiveAStruct.size
            while arg_10 < ArchiveAStruct.size * 5:
                log.info('page %d, reading record at offset %d' %
                         (arg_9['Index'], arg_10))
                if arg_0._use_rev_b_archive(arg_9['Records'], arg_10):
                    arg_11 = ArchiveBStruct.unpack_from(arg_9['Records'], arg_10)
                else:
                    arg_11 = ArchiveAStruct.unpack_from(arg_9['Records'], arg_10)
                # 7. verify that record has valid data, and store
                if arg_11['DateStamp'] != 0xffff and arg_11['TimeStamp'] != 0xffff:
                    arg_2.append(arg_11)
                arg_10 += ArchiveAStruct.size
        log.info('read all pages')
        return arg_2

issue a command to read the archive records after a known time stamp .


def Func(arg_0):
        """Summarizes data handled by the result as a string.

        Calls `__repr__` on all handled data. Data is NOT ordered.

        Truncates the string if it is longer than
        :const:`pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH`

        :return: string

        """

        arg_1 = []
        arg_2 = 0

        for arg_3 in arg_0._data:
            arg_4 = arg_0._data[arg_3]
            arg_5 = '%s=%s, ' % (arg_3, repr(arg_4))
            arg_1.append(arg_5)

            arg_2 += len(arg_5)
            if arg_2 > pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH:
                break

        arg_6 = "".join(arg_1)
        if len(arg_6) > pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH:
            arg_6 =\
                arg_6[0:pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH - 3] + '...'
        else:
            arg_6 = arg_6[0:-2] # Delete the last `, `

        return arg_6

Summarizes data handled by the result as a string .


def Func ( arg_0 , arg_1 , arg_2 = False ) : arg_3 = arg_0 . get_conn ( ) arg_3 . cwd ( arg_1 ) arg_4 = arg_3 . nlst ( ) return arg_4

def Func(arg_0, arg_1, arg_2=False):
        """
        Returns a list of files on the remote system.

        :param path: full path to the remote directory to list
        :type path: str
        """
        arg_3 = arg_0.get_conn()
        arg_3.cwd(arg_1)

        arg_4 = arg_3.nlst()
        return arg_4

Returns a list of files on the remote system .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . info or b'' arg_0 . send_raw ( arg_1 , ACCEPT , arg_3 , * arg_2 )

def Func(arg_0, arg_1, arg_2):
        """Sends ACCEPT reply."""
        arg_3 = arg_0.info or b''
        arg_0.send_raw(arg_1, ACCEPT, arg_3, *arg_2)


def Func(arg_0, arg_1):
        """
        Init openstack neutron mq

        1. Check if enable listening neutron notification
        2. Create consumer

        :param mq: class ternya.mq.MQ
        """
        if not arg_0.enable_component_notification(Openstack.Neutron):
            log.debug("disable listening neutron notification")
            return

        for arg_2 in range(arg_0.config.neutron_mq_consumer_count):
            arg_1.create_consumer(arg_0.config.neutron_mq_exchange,
                               arg_0.config.neutron_mq_queue,
                               ProcessFactory.process(Openstack.Neutron))

        log.debug("enable listening openstack neutron notification.")


def
Func
(
arg_0
,
arg_1
,
arg_2
=
' '
)
:
arg_1
=
unicode_normalize
(
'NFKD'
,
text_type
(
arg_1
.
strip
(
)
.
lower
(
)
)
)
arg_1
=
''
.
join
(
[
c
for
c
in
arg_1
if
c
.
isalnum
(
)
or
c
.
isspace
(
)
]
)
arg_1
=
arg_2
.
join
(
sorted
(
list
(
set
(
arg_1
.
split
(
)
)
)
)
)
return
arg_1

def Func(arg_0, arg_1, arg_2=' '):
        """Return string Func.

        Parameters
        ----------
        phrase : str
            The string from which to calculate the Func
        joiner : str
            The string that will be placed between each word

        Returns
        -------
        str
            The Func of the phrase

        Example
        -------
        >>> sf = String()
        >>> sf.Func('The quick brown fox jumped over the lazy dog.')
        'brown dog fox jumped lazy over quick the'

        """
        arg_1 = unicode_normalize('NFKD', text_type(arg_1.strip().lower()))
        arg_1 = ''.join([c for c in arg_1 if c.isalnum() or c.isspace()])
        arg_1 = arg_2.join(sorted(list(set(arg_1.split()))))
        return arg_1

Return string fingerprint.

        Parameters
        ----------
        phrase : str
            The string from which to calculate the fingerprint
        joiner : str
            The string that will be placed between each word

        Returns
        -------
        str
            The fingerprint of the phrase

        Example
        -------
        >>> sf = String()
        >>> sf.fingerprint('The quick brown fox jumped over the lazy dog.')
        'brown dog fox jumped lazy over quick the'


def Func(arg_0, arg_1=2, arg_2=0):
    """Convert a notebook to the v3 format.

    Parameters
    ----------
    nb : NotebookNode
        The Python representation of the notebook to convert.
    orig_version : int
        The original version of the notebook to convert.
    orig_minor : int
        The original minor version of the notebook to convert (only relevant for v >= 3).
    """
    if arg_1 == 1:
        arg_0 = v2.Func(arg_0)
        arg_1 = 2
    if arg_1 == 2:
        # Mark the original nbformat so consumers know it has been converted.
        arg_0.nbformat = arg_3
        arg_0.nbformat_minor = arg_4

        arg_0.orig_nbformat = 2
        return arg_0
    elif arg_1 == 3:
        if arg_2 != arg_4:
            arg_0.orig_nbformat_minor = arg_2
        arg_0.nbformat_minor = arg_4
        return arg_0
    else:
        raise ValueError('Cannot convert a notebook from v%s to v3' % arg_1)


def Func(arg_0, arg_1, arg_2):
        """Instantiates worker plugins that have requsite properties.

        The required properties are:
        * must have PLUGIN_EP entrypoint registered (or it wouldn't be in the
          list)
        * must have class attribute versions (list) of supported RPC versions
        * must subclass QuarkAsyncPluginBase
        """
        arg_3 = inspect.getmembers(arg_1, inspect.isclass)
        arg_4 = 0
        for arg_5, arg_6 in arg_3:
            if hasattr(arg_6, 'versions'):
                if arg_2 not in arg_6.versions:
                    continue
            else:
                continue
            if issubclass(arg_6, base_worker.QuarkAsyncPluginBase):
                LOG.debug("Loading plugin %s" % arg_5)
                arg_7 = arg_6()
                arg_0.plugins.append(arg_7)
                arg_4 += 1
        LOG.debug("Found %d possible plugins and loaded %d" %
                  (len(arg_3), arg_4))

Instantiates worker plugins that have requsite properties .


(model, entity, element_lists, method="fba",
                    solution=None, processes=None, **kwargs)

def Func(arg_0, arg_1, arg_2, arg_3="fba",
                    arg_4=None, arg_5=None, **arg_6):
    """
    Provide a common interface for single or multiple knockouts.

    Parameters
    ----------
    model : cobra.Model
        The metabolic model to perform deletions in.
    entity : 'gene' or 'reaction'
        The entity to knockout (``cobra.Gene`` or ``cobra.Reaction``).
    element_lists : list
        List of iterables ``cobra.Reaction``s or ``cobra.Gene``s (or their IDs)
        to be deleted.
    method: {"fba", "moma", "linear moma", "room", "linear room"}, optional
        Method used to predict the growth rate.
    solution : cobra.Solution, optional
        A previous solution to use as a reference for (linear) MOMA or ROOM.
    processes : int, optional
        The number of parallel processes to run. Can speed up the computations
        if the number of knockouts to perform is large. If not passed,
        will be set to the number of CPUs found.
    kwargs :
        Passed on to underlying simulation functions.

    Returns
    -------
    pandas.DataFrame
        A representation of all combinations of entity deletions. The
        columns are 'growth' and 'status', where

        index : frozenset([str])
            The gene or reaction identifiers that were knocked out.
        growth : float
            The growth rate of the adjusted model.
        status : str
            The solution's status.
    """
    arg_7 = sutil.interface_to_str(arg_0.problem.__name__)
    if arg_3 == "moma" and arg_7 not in sutil.qp_solvers:
        raise RuntimeError(
            "Cannot use MOMA since '{}' is not QP-capable."
            "Please choose a different solver or use FBA only.".format(arg_7))

    if arg_5 is None:
        arg_5 = CONFIGURATION.processes

    with arg_0:
        if "moma" in arg_3:
            add_moma(arg_0, arg_4=arg_4, linear="linear" in arg_3)
        elif "room" in arg_3:
            add_room(arg_0, arg_4=arg_4, linear="linear" in arg_3,
                     **arg_6)

        arg_8 = set([frozenset(comb) for comb in product(*arg_2)])
        arg_5 = min(arg_5, len(arg_8))

        def extract_knockout_results(arg_9):
            arg_10 = pd.DataFrame([
                (frozenset(ids), growth, status)
                for (ids, growth, status) in arg_9
            ], columns=['ids', 'growth', 'status'])
            arg_10.set_index('ids', inplace=True)
            return arg_10

        if arg_5 > 1:
            arg_11 = dict(gene=_gene_deletion_worker,
                          reaction=_reaction_deletion_worker)[arg_1]
            arg_12 = len(arg_8) // arg_5
            arg_13 = multiprocessing.Pool(
                arg_5, initializer=_init_worker, initargs=(arg_0,)
            )
            arg_14 = extract_knockout_results(arg_13.imap_unordered(
                arg_11,
                arg_8,
                chunksize=arg_12
            ))
            arg_13.close()
            arg_13.join()
        else:
            arg_11 = dict(gene=_gene_deletion,
                          reaction=_reaction_deletion)[arg_1]
            arg_14 = extract_knockout_results(map(
                partial(arg_11, arg_0), arg_8))
        return arg_14

Provide a common interface for single or multiple knockouts .


def Func(arg_0):
    """Receiver for request-confirmed signal to send email notification."""
    arg_1, arg_2 = get_record(arg_0.recid)
    if arg_2 is None:
        current_app.logger.error("Cannot retrieve record %s. Emails not sent"
                                 % arg_0.recid)
        return
    arg_3 = _("Access request: %(record)s", arg_2=arg_2["title"])

    _send_notification(
        arg_0.receiver.email,
        arg_3,
        "zenodo_accessrequests/emails/new_request.tpl",
        arg_0=arg_0,
        arg_2=arg_2,
        arg_1=arg_1,
    )

    _send_notification(
        arg_0.sender_email,
        arg_3,
        "zenodo_accessrequests/emails/confirmation.tpl",
        arg_0=arg_0,
        arg_2=arg_2,
        arg_1=arg_1,
    )

Receiver for request - confirmed signal to send email notification .


def
Func
(
arg_0
,
arg_1
=
"Column"
)
:
arg_0
.
_mmComputeTransitionTraces
(
)
arg_2
=
PrettyTable
(
[
"Pattern"
,
"Column"
,
"predicted=>active cells"
]
)
for
arg_3
,
arg_4
in
(
arg_0
.
_mmData
[
"predictedActiveCellsForSequence"
]
.
iteritems
(
)
)
:
arg_5
=
arg_0
.
mapCellsToColumns
(
arg_4
)
for
arg_6
,
arg_7
in
arg_5
.
iteritems
(
)
:
arg_2
.
add_row
(
[
arg_3
,
arg_6
,
list
(
arg_7
)
]
)
return
arg_2
.
get_string
(
arg_1
=
arg_1
)
.
encode
(
"utf-8"
)

def Func(arg_0, arg_1="Column"):
    """
    Pretty print the cell representations for sequences in the history.

    @param sortby (string) Column of table to sort by

    @return (string) Pretty-printed text
    """
    arg_0._mmComputeTransitionTraces()
    arg_2 = PrettyTable(["Pattern", "Column", "predicted=>active cells"])

    for arg_3, arg_4 in (
          arg_0._mmData["predictedActiveCellsForSequence"].iteritems()):
      arg_5 = arg_0.mapCellsToColumns(arg_4)
      for arg_6, arg_7 in arg_5.iteritems():
        arg_2.add_row([arg_3, arg_6, list(arg_7)])

    return arg_2.get_string(arg_1=arg_1).encode("utf-8")

Pretty print the cell representations for sequences in the history .


return sanscript.transliterate(data=data, _from=sanscript.DEVANAGARI, _to=self.name)

def Func ( arg_0 , arg_1 ) : from indic_transliteration import sanscript return sanscript . transliterate ( arg_1 = arg_1 , _from = sanscript . DEVANAGARI , _to = arg_0 . name )

def Func(arg_0, arg_1):
        """A convenience method"""
        from indic_transliteration import sanscript
        return sanscript.transliterate(arg_1=arg_1, _from=sanscript.DEVANAGARI, _to=arg_0.name)


return mapping_util.map_masked_1d_array_to_2d_array_from_array_1d_shape_and_one_to_two(
            array_1d=array_1d, shape=self.mask.shape, one_to_two=self.mask.masked_grid_index_to_pixel)

def Func(arg_0, arg_1):
        """ Map a 1D array the same dimension as the grid to its original masked 2D array.

        Parameters
        -----------
        array_1d : ndarray
            The 1D array which is mapped to its masked 2D array.
        """
        return mapping_util.map_masked_1d_array_to_2d_array_from_array_1d_shape_and_one_to_two(
            arg_1=arg_1, shape=arg_0.mask.shape, one_to_two=arg_0.mask.masked_grid_index_to_pixel)

Map a 1D array the same dimension as the grid to its original masked 2D array .


(self, total: int, name=None, message=None)

def Func ( arg_0 , arg_1 : arg_2 , arg_3 = None , arg_4 = None ) : arg_0 . begin ( arg_1 , arg_3 , arg_4 ) try : yield arg_0 finally : arg_0 . done ( )

def Func(arg_0, arg_1: arg_2, arg_3=None, arg_4=None):
        """Wrap code into a begin and end call on this monitor"""
        arg_0.begin(arg_1, arg_3, arg_4)
        try:
            yield arg_0
        finally:
            arg_0.done()


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = [ ] for arg_4 , arg_5 in arg_1 : if isinstance ( arg_4 , int ) or isinstance ( arg_5 , int ) : if isinstance ( arg_4 , int ) and not ( 0 <= arg_4 < arg_2 ) : continue elif isinstance ( arg_4 , int ) and isinstance ( arg_5 , int ) and not ( arg_4 <= arg_5 ) : continue elif arg_4 is None and arg_5 == 0 : continue arg_3 . append ( ( arg_4 , arg_5 ) ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """Removes errored ranges"""
        arg_3 = []
        for arg_4, arg_5 in arg_1:
            if isinstance(arg_4, int) or isinstance(arg_5, int):
                if isinstance(arg_4, int) and not (0 <= arg_4 < arg_2):
                    continue
                elif isinstance(arg_4, int) and isinstance(arg_5, int) and not (arg_4 <= arg_5):
                    continue
                elif arg_4 is None and arg_5 == 0:
                    continue
                arg_3.append( (arg_4,arg_5) )
        return arg_3


return self.waitFor(timeout, notification, callback=callback,
                            args=args)

def Func(arg_0, arg_1=10, arg_2='AXCreated'):
        """Convenience method to wait for creation of some UI element.

        Returns: The element created
        """
        arg_3 = AXCallbacks.returnElemCallback
        arg_4 = None
        arg_5 = (arg_4,)

        return arg_0.waitFor(arg_1, arg_2, arg_3=arg_3,
                            arg_5=arg_5)

Convenience method to wait for creation of some UI element .


def Func(arg_0):
    '''The likelihood that the context is a "member".'''
    if arg_0:
        arg_1 = arg_0.xpath('.//*[local-name()="explicitMember"]/text()').extract()
        arg_2 = str(arg_1).lower()

        if len(arg_1) > 1:
            return 2
        elif 'country' in arg_2:
            return 2
        elif 'member' not in arg_2:
            return 0
        elif 'successor' in arg_2:
            # 'SuccessorMember' is a rare case that shouldn't be treated as member
            return 1
        elif 'parent' in arg_2:
            return 2
    return 3

The likelihood that the context is a member .


def Func ( arg_0 , * arg_1 , ** arg_2 ) : arg_3 = SelectorQuery ( * arg_1 , ** arg_2 ) @ arg_0 . synchronize ( wait = arg_3 . wait ) def Func ( ) : arg_4 = arg_3 . resolve_for ( arg_0 ) if not arg_4 . matches_count : raise ExpectationNotMet ( arg_4 . failure_message ) return arg_4 return Func ( )

def Func(arg_0, *arg_1, **arg_2):
        """
        Find all elements on the page matching the given selector and options.

        Both XPath and CSS expressions are supported, but Capybara does not try to automatically
        distinguish between them. The following statements are equivalent::

            page.Func("css", "a#person_123")
            page.Func("xpath", "//a[@id='person_123']")

        If the type of selector is left out, Capybara uses :data:`capybara.default_selector`. It's
        set to ``"css"`` by default. ::

            page.Func("a#person_123")

            capybara.default_selector = "xpath"
            page.Func("//a[@id='person_123']")

        The set of found elements can further be restricted by specifying options. It's possible to
        select elements by their text or visibility::

            page.Func("a", text="Home")
            page.Func("#menu li", visible=True)

        By default if no elements are found, an empty list is returned; however, expectations can be
        set on the number of elements to be found which will trigger Capybara's waiting behavior for
        the expectations to match. The expectations can be set using::

            page.assert_selector("p#foo", count=4)
            page.assert_selector("p#foo", maximum=10)
            page.assert_selector("p#foo", minimum=1)
            page.assert_selector("p#foo", between=range(1, 11))

        See :func:`capybara.result.Result.matches_count` for additional information about count
        matching.

        Args:
            *args: Variable length argument list for :class:`SelectorQuery`.
            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.

        Returns:
            Result: A collection of found elements.

        Raises:
            ExpectationNotMet: The matched results did not meet the expected criteria.
        """

        arg_3 = SelectorQuery(*arg_1, **arg_2)

        @arg_0.synchronize(wait=arg_3.wait)
        def Func():
            arg_4 = arg_3.resolve_for(arg_0)

            if not arg_4.matches_count:
                raise ExpectationNotMet(arg_4.failure_message)

            return arg_4

        return Func()

Find all elements on the page matching the given selector and options.

        Both XPath and CSS expressions are supported, but Capybara does not try to automatically
        distinguish between them. The following statements are equivalent::

            page.find_all("css", "a#person_123")
            page.find_all("xpath", "//a[@id='person_123']")

        If the type of selector is left out, Capybara uses :data:`capybara.default_selector`. It's
        set to ``"css"`` by default. ::

            page.find_all("a#person_123")

            capybara.default_selector = "xpath"
            page.find_all("//a[@id='person_123']")

        The set of found elements can further be restricted by specifying options. It's possible to
        select elements by their text or visibility::

            page.find_all("a", text="Home")
            page.find_all("#menu li", visible=True)

        By default if no elements are found, an empty list is returned; however, expectations can be
        set on the number of elements to be found which will trigger Capybara's waiting behavior for
        the expectations to match. The expectations can be set using::

            page.assert_selector("p#foo", count=4)
            page.assert_selector("p#foo", maximum=10)
            page.assert_selector("p#foo", minimum=1)
            page.assert_selector("p#foo", between=range(1, 11))

        See :func:`capybara.result.Result.matches_count` for additional information about count
        matching.

        Args:
            *args: Variable length argument list for :class:`SelectorQuery`.
            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.

        Returns:
            Result: A collection of found elements.

        Raises:
            ExpectationNotMet: The matched results did not meet the expected criteria.

Find all elements on the page matching the given selector and options .


def Func(arg_0, arg_1):
        '''Parse 10-Q or 10-K XML report.'''
        arg_2 = ReportItemLoader(arg_1=arg_1)
        arg_3 = arg_2.load_item()

        if 'doc_type' in arg_3:
            arg_4 = arg_3['doc_type']
            if arg_4 in ('10-Q', '10-K'):
                return arg_3

        return None


(self, institute, case, user, link,
                     unmark=False)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
=
False
)
:
LOG
.
info
(
"Updating checked status of {}"
.
format
(
arg_2
[
'display_name'
]
)
)
arg_6
=
'not checked'
if
arg_5
else
'checked'
arg_0
.
create_event
(
arg_1
=
arg_1
,
arg_2
=
arg_2
,
arg_3
=
arg_3
,
arg_4
=
arg_4
,
category
=
'case'
,
verb
=
'check_case'
,
subject
=
arg_6
)
LOG
.
info
(
"Updating {0}'s checked status {1}"
.
format
(
arg_2
[
'display_name'
]
,
arg_6
)
)
arg_7
=
False
if
arg_5
else
True
arg_8
=
arg_0
.
case_collection
.
find_one_and_update
(
{
'_id'
:
arg_2
[
'_id'
]
}
,
{
'$set'
:
{
'analysis_checked'
:
arg_7
}
}
,
return_document
=
pymongo
.
ReturnDocument
.
AFTER
)
LOG
.
debug
(
"Case updated"
)
return
arg_8

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                     arg_5=False):
        """Mark a case as checked from an analysis point of view.

        Arguments:
            institute (dict): A Institute object
            case (dict): Case object
            user (dict): A User object
            link (str): The url to be used in the event
            unmark (bool): If case should ve unmarked

        Return:
            updated_case
        """

        LOG.info("Updating checked status of {}"
                    .format(arg_2['display_name']))

        arg_6 = 'not checked' if arg_5 else 'checked'
        arg_0.create_event(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            category='case',
            verb='check_case',
            subject=arg_6
        )

        LOG.info("Updating {0}'s checked status {1}"
                    .format(arg_2['display_name'], arg_6))
        arg_7 = False if arg_5 else True
        arg_8 = arg_0.case_collection.find_one_and_update(
            {'_id': arg_2['_id']},
            {
                '$set': {'analysis_checked': arg_7}
            },
            return_document=pymongo.ReturnDocument.AFTER
        )
        LOG.debug("Case updated")
        return arg_8

Mark a case as checked from an analysis point of view .


def Func ( arg_0 , arg_1 ) : arg_2 = { } Func = { } for arg_4 in arg_1 : arg_5 = arg_4 [ 'key' ] if arg_5 not in arg_2 : arg_2 [ arg_5 ] = [ ] Func [ arg_5 ] = { } arg_2 [ arg_5 ] . append ( arg_4 [ 'total_time' ] ) arg_0 . _traces . pop ( arg_4 [ 'id' ] ) for arg_5 in arg_2 : arg_6 = arg_2 [ arg_5 ] Func [ arg_5 ] = dict ( count = len ( arg_6 ) , max = max ( arg_6 ) , min = min ( arg_6 ) , avg = sum ( arg_6 ) / len ( arg_6 ) ) return Func

def Func(arg_0, arg_1):
        """Build per minute stats for each key"""

        arg_2 = {}
        Func = {}
        # Group traces by key and minute
        for arg_4 in arg_1:
            arg_5 = arg_4['key']
            if arg_5 not in arg_2:
                arg_2[arg_5] = []
                Func[arg_5] = {}

            arg_2[arg_5].append(arg_4['total_time'])
            arg_0._traces.pop(arg_4['id'])

        for arg_5 in arg_2:
            arg_6 = arg_2[arg_5]
            Func[arg_5] = dict(
                count=len(arg_6),
                max=max(arg_6),
                min=min(arg_6),
                avg=sum(arg_6)/len(arg_6)
            )

        return Func


def Func ( arg_0 = None ) : def decorator ( arg_1 ) : @ wraps ( arg_1 ) def decorated_function ( * arg_2 , ** arg_3 ) : arg_4 = arg_0 if arg_4 is None : arg_4 = request . endpoint . replace ( '.' , '/' ) + '.html' arg_5 = arg_1 ( * arg_2 , ** arg_3 ) if arg_5 is None : arg_5 = { } elif not isinstance ( arg_5 , dict ) : return arg_5 return render_template ( arg_4 , ** arg_5 ) return decorated_function return decorator

def Func(arg_0=None):
    """Template decorator.

    Ref: http://flask.pocoo.org/docs/patterns/viewdecorators/
    """
    def decorator(arg_1):
        @wraps(arg_1)
        def decorated_function(*arg_2, **arg_3):
            arg_4 = arg_0
            if arg_4 is None:
                arg_4 = request.endpoint.replace('.', '/') + '.html'
            arg_5 = arg_1(*arg_2, **arg_3)
            if arg_5 is None:
                arg_5 = {}
            elif not isinstance(arg_5, dict):
                return arg_5
            return render_template(arg_4, **arg_5)
        return decorated_function
    return decorator


def Func ( arg_0 ) : arg_0 . scope = SERVICE_USER_SCOPE arg_0 . rate = arg_0 . get_rate ( ) arg_0 . num_requests , arg_0 . duration = arg_0 . parse_rate ( arg_0 . rate )

def Func(arg_0):
        """
        Update throttle scope so that service user throttle rates are applied.
        """
        arg_0.scope = SERVICE_USER_SCOPE
        arg_0.rate = arg_0.get_rate()
        arg_0.num_requests, arg_0.duration = arg_0.parse_rate(arg_0.rate)

Update throttle scope so that service user throttle rates are applied .