def Func ( arg_0 , arg_1 ) : try : arg_2 = SerialBlock ( ) arg_2 [ arg_3 . Meter_Address ] = arg_0 . getMeterAddress ( ) for arg_5 in arg_1 : arg_6 = arg_5 . upper ( ) if not "RESERVED" in arg_6 and not "CRC" in arg_6 : arg_2 [ arg_7 ( arg_5 ) ] = arg_1 [ arg_5 ] [ MeterData . StringValue ] except : ekm_log ( traceback . format_exc ( sys . exc_info ( ) ) ) return "" return json . dumps ( arg_2 , indent = 4 )

def Func(arg_0, arg_1):
        """ Translate the passed serial block into string only JSON.

        Args:
            def_buf (SerialBlock): Any :class:`~ekmmeters.SerialBlock` object.

        Returns:
            str: JSON rendering of meter record.
        """
        try:
            arg_2 = SerialBlock()
            arg_2[arg_3.Meter_Address] = arg_0.getMeterAddress()
            for arg_5 in arg_1:
                arg_6 = arg_5.upper()
                if not "RESERVED" in arg_6 and not "CRC" in arg_6:
                    arg_2[arg_7(arg_5)] = arg_1[arg_5][MeterData.StringValue]
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))
            return ""
        return json.dumps(arg_2, indent=4)

Translate the passed serial block into string only JSON .


def Func ( arg_0 : arg_1 [ arg_2 , arg_3 ] ) -> arg_1 [ arg_2 , arg_1 [ arg_2 , float ] ] : arg_4 : Dict [ arg_2 , Dict [ arg_2 , float ] ] = defaultdict ( dict ) for arg_5 , arg_6 in itt . combinations ( arg_0 , 2 ) : arg_4 [ arg_5 ] [ arg_6 ] = arg_4 [ arg_6 ] [ arg_5 ] = tanimoto_set_similarity ( arg_0 [ arg_5 ] , arg_0 [ arg_6 ] ) for arg_5 in arg_0 : arg_4 [ arg_5 ] [ arg_5 ] = 1.0 return dict ( arg_4 )

def Func(arg_0: arg_1[arg_2, arg_3]) -> arg_1[arg_2, arg_1[arg_2, float]]:
    """Return a distance matrix keyed by the keys in the given dict.

    Distances are calculated based on pairwise tanimoto similarity of the sets contained.

    :param dict_of_sets: A dict of {x: set of y}
    :return: A similarity matrix based on the set overlap (tanimoto) score between each x as a dict of dicts
    """
    arg_4: Dict[arg_2, Dict[arg_2, float]] = defaultdict(dict)

    for arg_5, arg_6 in itt.combinations(arg_0, 2):
        arg_4[arg_5][arg_6] = arg_4[arg_6][arg_5] = tanimoto_set_similarity(arg_0[arg_5], arg_0[arg_6])

    for arg_5 in arg_0:
        arg_4[arg_5][arg_5] = 1.0

    return dict(arg_4)

Return a distance matrix keyed by the keys in the given dict .


def Func(arg_0, arg_1, arg_2):

        '''Construct and configure a stage from known stages.

        `name` must be the name of one of the stages in this.  `config`
        is the configuration dictionary of the containing object, and its `name`
        member will be passed into the stage constructor.

        :param str name: name of the stage
        :param dict config: parent object configuration
        :return: callable stage
        :raise exceptions.KeyError: if `name` is not a known stage

        '''
        arg_3 = arg_2.get(arg_1, {})
        arg_4 = arg_0[arg_1]
        return arg_4(arg_3)

Construct and configure a stage from known stages .


def Func(arg_0, arg_1):
    """Delete all Func in the database"""
    LOG.info("Running scout delete Func")
    arg_2 = arg_0.obj['adapter']

    if arg_1:
        LOG.info("Dropping Func collection for build: %s", arg_1)
    else:
        LOG.info("Dropping Func collection")
        arg_2.drop_Func()


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . _control . document ( ) arg_3 = str ( arg_1 . cacheKey ( ) ) arg_2 . addResource ( QtGui . QTextDocument . ImageResource , QtCore . QUrl ( arg_3 ) , arg_1 ) arg_4 = QtGui . QTextImageFormat ( ) arg_4 . setName ( arg_3 ) return arg_4

def Func(arg_0, arg_1):
        """ Adds the specified QImage to the document and returns a
            QTextImageFormat that references it.
        """
        arg_2 = arg_0._control.document()
        arg_3 = str(arg_1.cacheKey())
        arg_2.addResource(QtGui.QTextDocument.ImageResource,
                             QtCore.QUrl(arg_3), arg_1)
        arg_4 = QtGui.QTextImageFormat()
        arg_4.setName(arg_3)
        return arg_4

Adds the specified QImage to the document and returns a QTextImageFormat that references it .


def Func(arg_0, arg_1):
        """Parse a row."""
        arg_2 = arg_0._to_id(arg_1[ID])
        arg_3 = arg_0._spec.newFunc(arg_2, arg_1, arg_0)
        if SAME_AS in arg_1:
            arg_0._delay_inheritance(arg_3, arg_0._to_id(arg_1[SAME_AS]))
        arg_0._delay_instructions(arg_3)
        arg_0._id_cache[arg_2] = arg_3
        return arg_3


(members: Iterable[T], meta: Optional[IPersistentMap] = None)

def Func ( arg_0 : arg_1 [ arg_2 ] , arg_3 : arg_4 [ arg_5 ] = None ) -> Vector [ arg_2 ] : return Vector ( pFunc ( arg_0 ) , arg_3 = arg_3 )

def Func(arg_0: arg_1[arg_2], arg_3: arg_4[arg_5] = None) -> Vector[arg_2]:
    """Creates a new Func."""
    return Vector(pFunc(arg_0), arg_3=arg_3)


def Func ( arg_0 , arg_1 = None ) : arg_2 = datetime . now ( ) while arg_0 . get_is_sim_running ( ) : sleep ( 0.5 ) if arg_1 is not None : if ( datetime . now ( ) - arg_2 ) . seconds >= arg_1 : arg_3 = None break else : arg_3 = arg_0 . simulation_info ( ) return arg_3

def Func(arg_0, arg_1=None):
        """Block until the simulation is done or timeout seconds exceeded.

        If the simulation stops before timeout, siminfo is returned.
        """
        arg_2 = datetime.now()
        while arg_0.get_is_sim_running():
            sleep(0.5)
            if arg_1 is not None:
                if (datetime.now() - arg_2).seconds >= arg_1:
                    arg_3 = None
                    break
        else:
            arg_3 = arg_0.simulation_info()
        return arg_3

Block until the simulation is done or timeout seconds exceeded .


(store, institute_obj, case_obj, variant_obj, update=False, genome_build='37',
                  get_compounds = True)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = False , arg_5 = '37' , arg_6 = True ) : arg_7 = False arg_8 = arg_3 . get ( 'compounds' , [ ] ) if arg_8 and arg_6 : if 'not_loaded' not in arg_8 [ 0 ] : arg_9 = arg_0 . update_variant_compounds ( arg_3 ) arg_3 [ 'compounds' ] = arg_9 arg_7 = True arg_3 [ 'compounds' ] = sorted ( arg_3 [ 'compounds' ] , key = lambda compound : - compound [ 'combined_score' ] ) arg_10 = arg_3 . get ( 'genes' ) if arg_10 is not None : for arg_11 in arg_10 : if not arg_11 [ 'hgnc_id' ] : continue if arg_11 . get ( 'hgnc_symbol' ) is None : arg_12 = arg_0 . hgnc_gene ( arg_11 [ 'hgnc_id' ] , build = arg_5 ) if not arg_12 : continue arg_7 = True arg_11 [ 'hgnc_symbol' ] = arg_12 [ 'hgnc_symbol' ] if arg_4 and arg_7 : arg_3 = arg_0 . update_variant ( arg_3 ) arg_3 [ 'comments' ] = arg_0 . events ( arg_1 , case = arg_2 , variant_id = arg_3 [ 'variant_id' ] , comments = True ) if arg_10 : arg_3 . update ( get_predictions ( arg_10 ) ) if arg_3 . get ( 'category' ) == 'cancer' : arg_3 . update ( get_variant_info ( arg_10 ) ) for arg_13 in arg_8 : arg_13 . update ( get_predictions ( arg_13 . get ( 'genes' , [ ] ) ) ) if isinstance ( arg_3 . get ( 'acmg_classification' ) , int ) : arg_14 = ACMG_MAP [ arg_3 [ 'acmg_classification' ] ] arg_3 [ 'acmg_classification' ] = ACMG_COMPLETE_MAP [ arg_14 ] arg_15 = arg_3 . get ( 'length' ) arg_3 [ 'length' ] = { 100000000000 : 'inf' , - 1 : 'n.d.' } . get ( arg_15 , arg_15 ) if not 'end_chrom' in arg_3 : arg_3 [ 'end_chrom' ] = arg_3 [ 'chromosome' ] return arg_3

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False, arg_5='37',
                  arg_6 = True):
    """Parse information about variants.

    - Adds information about compounds
    - Updates the information about compounds if necessary and 'update=True'

    Args:
        store(scout.adapter.MongoAdapter)
        institute_obj(scout.models.Institute)
        case_obj(scout.models.Case)
        variant_obj(scout.models.Variant)
        update(bool): If variant should be updated in database
        genome_build(str)

    """
    arg_7 = False
    arg_8 = arg_3.get('compounds', [])
    if arg_8 and arg_6:
        # Check if we need to add compound information
        # If it is the first time the case is viewed we fill in some compound information
        if 'not_loaded' not in arg_8[0]:
            arg_9 = arg_0.update_variant_compounds(arg_3)
            arg_3['compounds'] = arg_9
            arg_7 = True

        # sort compounds on combined rank score
        arg_3['compounds'] = sorted(arg_3['compounds'],
                                          key=lambda compound: -compound['combined_score'])

    # Update the hgnc symbols if they are incorrect
    arg_10 = arg_3.get('genes')
    if arg_10 is not None:
        for arg_11 in arg_10:
            # If there is no hgnc id there is nothin we can do
            if not arg_11['hgnc_id']:
                continue
            # Else we collect the gene object and check the id
            if arg_11.get('hgnc_symbol') is None:
                arg_12 = arg_0.hgnc_gene(arg_11['hgnc_id'], build=arg_5)
                if not arg_12:
                    continue
                arg_7 = True
                arg_11['hgnc_symbol'] = arg_12['hgnc_symbol']

    # We update the variant if some information was missing from loading
    # Or if symbold in reference genes have changed
    if arg_4 and arg_7:
        arg_3 = arg_0.update_variant(arg_3)

    arg_3['comments'] = arg_0.events(arg_1, case=arg_2,
                                           variant_id=arg_3['variant_id'], comments=True)

    if arg_10:
        arg_3.update(get_predictions(arg_10))
        if arg_3.get('category') == 'cancer':
            arg_3.update(get_variant_info(arg_10))

    for arg_13 in arg_8:
        arg_13.update(get_predictions(arg_13.get('genes', [])))

    if isinstance(arg_3.get('acmg_classification'), int):
        arg_14 = ACMG_MAP[arg_3['acmg_classification']]
        arg_3['acmg_classification'] = ACMG_COMPLETE_MAP[arg_14]

    # convert length for SV variants
    arg_15 = arg_3.get('length')
    arg_3['length'] = {100000000000: 'inf', -1: 'n.d.'}.get(arg_15, arg_15)
    if not 'end_chrom' in arg_3:
        arg_3['end_chrom'] = arg_3['chromosome']

    return arg_3


def Func ( arg_0 ) : arg_1 = { "up" : PyFunceble . INTERN [ "counter" ] [ "number" ] [ "up" ] , "down" : PyFunceble . INTERN [ "counter" ] [ "number" ] [ "down" ] , "invalid" : PyFunceble . INTERN [ "counter" ] [ "number" ] [ "invalid" ] , } for arg_2 in arg_1 : arg_3 = ( arg_1 [ arg_2 ] * 100 // PyFunceble . INTERN [ "counter" ] [ "number" ] [ "tested" ] ) PyFunceble . INTERN [ "counter" ] [ "percentage" ] . update ( { arg_2 : arg_3 } )

def Func(arg_0):
        """
        Calculate the percentage of each status.
        """

        # We map the current state/counters of the different status.
        arg_1 = {
            "up": PyFunceble.INTERN["counter"]["number"]["up"],
            "down": PyFunceble.INTERN["counter"]["number"]["down"],
            "invalid": PyFunceble.INTERN["counter"]["number"]["invalid"],
        }

        for arg_2 in arg_1:
            # We loop through our map index.

            # We calculate the percentage.
            arg_3 = (
                arg_1[arg_2]
                * 100
                // PyFunceble.INTERN["counter"]["number"]["tested"]
            )

            # And we update the percentage counter of the actual status.
            PyFunceble.INTERN["counter"]["percentage"].update({arg_2: arg_3})

Calculate the percentage of each status .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = dict ( ) arg_3 [ 'name' ] = arg_1 if arg_2 : arg_3 [ 'token' ] = arg_2 arg_4 = arg_0 . request ( 'midas.item.searchbyname' , arg_3 ) return arg_4 [ 'items' ]

def Func(arg_0, arg_1, arg_2=None):
        """
        Return all items.

        :param name: The name of the item to search by.
        :type name: string
        :param token: (optional) A valid token for the user in question.
        :type token: None | string
        :returns: A list of all items with the given name.
        :rtype: list[dict]
        """
        arg_3 = dict()
        arg_3['name'] = arg_1
        if arg_2:
            arg_3['token'] = arg_2
        arg_4 = arg_0.request('midas.item.searchbyname', arg_3)
        return arg_4['items']


def Func(arg_0, arg_1):
    """Expand the rank of x up to static_event_rank times for broadcasting.

    The static event rank was checked to not be None at construction time.

    Args:
      x: A tensor to expand.
    Returns:
      The expanded tensor.
    """
    arg_2 = arg_1
    for arg_3 in range(tensorshape_util.rank(arg_0.event_shape)):
      arg_2 = tf.expand_dims(arg_2, -1)
    return arg_2

Expand the rank of x up to static_event_rank times for broadcasting .


def Func ( arg_0 , Func ) : arg_2 = PATHS [ 'UPDATE_SCHEDULES' ] % arg_0 . id arg_3 = "schedules[0][%s][]=%s&" arg_4 = "" for arg_5 , arg_6 in Func . iteritems ( ) : for arg_7 in arg_6 : arg_4 += arg_3 % ( arg_5 , arg_7 ) arg_0 . api . post ( arg_2 = arg_2 , data = arg_4 )

def Func(arg_0, Func):
    '''
      Set the posting schedules for the specified social media profile.
    '''

    arg_2 = PATHS['UPDATE_SCHEDULES'] % arg_0.id

    arg_3 = "schedules[0][%s][]=%s&"
    arg_4 = ""

    for arg_5, arg_6 in Func.iteritems():
      for arg_7 in arg_6:
        arg_4 += arg_3 % (arg_5, arg_7)

    arg_0.api.post(arg_2=arg_2, data=arg_4)

Set the posting schedules for the specified social media profile .


(
    state,
    name,
    index=0,
    missing_msg=None,
    params_not_matched_msg=None,
    expand_msg=None,
    signature=True,
)

def Func(
    arg_0,
    arg_1,
    arg_2=0,
    arg_3=None,
    arg_4=None,
    arg_5=None,
    arg_6=True,
):
    """Check whether a particular function is called.

    ``Func()`` is typically followed by:

    - ``check_args()`` to check whether the arguments were specified.
      In turn, ``check_args()`` can be followed by ``has_equal_value()`` or ``has_equal_ast()``
      to assert that the arguments were correctly specified.
    - ``has_equal_value()`` to check whether rerunning the function call coded by the student
      gives the same result as calling the function call as in the solution.

    Checking function calls is a tricky topic. Please visit the
    `dedicated article <articles/checking_function_calls.html>`_ for more explanation,
    edge cases and best practices.

    Args:
        name (str): the name of the function to be tested. When checking functions in packages, always
            use the 'full path' of the function.
        index (int): index of the function call to be checked. Defaults to 0.
        missing_msg (str): If specified, this overrides an automatically generated feedback message in case
            the student did not call the function correctly.
        params_not_matched_msg (str): If specified, this overrides an automatically generated feedback message
            in case the function parameters were not successfully matched.
        expand_msg (str): If specified, this overrides any messages that are prepended by previous SCT chains.
        signature (Signature): Normally, Func() can figure out what the function signature is,
            but it might be necessary to use ``sig_from_params()`` to manually build a signature and pass this along.
        state (State): State object that is passed from the SCT Chain (don't specify this).

    :Examples:

        Student code and solution code::

            import numpy as np
            arr = np.array([1, 2, 3, 4, 5])
            np.mean(arr)

        SCT::

            # Verify whether arr was correctly set in np.mean
            Ex().Func('numpy.mean').check_args('a').has_equal_value()

            # Verify whether np.mean(arr) produced the same result
            Ex().Func('numpy.mean').has_equal_value()
    """

    arg_7 = arg_3 is None
    arg_8 = arg_4 is None
    if arg_3 is None:
        arg_3 = MISSING_MSG
    if arg_5 is None:
        arg_5 = PREPEND_MSG
    if arg_4 is None:
        arg_4 = SIG_ISSUE_MSG

    arg_9 = arg_0.ast_dispatcher("function_calls", arg_0.student_ast)
    arg_10 = arg_0.ast_dispatcher("function_calls", arg_0.solution_ast)

    arg_11 = arg_0.ast_dispatcher("mappings", arg_0.student_ast)

    arg_12 = {
        "times": get_times(arg_2 + 1),
        "ord": get_ord(arg_2 + 1),
        "index": arg_2,
        "mapped_name": get_mapped_name(arg_1, arg_11),
    }

    # Get Parts ----
    # Copy, otherwise signature binding overwrites sol_out[name][index]['args']
    try:
        arg_13 = {**arg_10[arg_1][arg_2]}
    except KeyError:
        raise InstructorError(
            "`Func()` couldn't find a call of `%s()` in the solution code. Make sure you get the mapping right!"
            % arg_1
        )
    except IndexError:
        raise InstructorError(
            "`Func()` couldn't find %s calls of `%s()` in your solution code."
            % (arg_2 + 1, arg_1)
        )

    try:
        # Copy, otherwise signature binding overwrites stu_out[name][index]['args']
        arg_14 = {**arg_9[arg_1][arg_2]}
    except (KeyError, IndexError):
        arg_15 = arg_0.build_message(arg_3, arg_12, append=arg_7)
        arg_0.report(Feedback(arg_15, arg_0))

    # Signatures -----
    if arg_6:
        arg_6 = None if isinstance(arg_6, bool) else arg_6
        arg_16 = partial(
            getSignatureInProcess,
            arg_1=arg_1,
            arg_6=arg_6,
            manual_sigs=arg_0.get_manual_sigs(),
        )

        try:
            arg_17 = arg_16(
                mapped_name=arg_13["name"], process=arg_0.solution_process
            )
            arg_13["args"] = bind_args(arg_17, arg_13["args"])
        except Exception as e:
            raise InstructorError(
                "`Func()` couldn't match the %s call of `%s` to its signature:\n%s "
                % (get_ord(arg_2 + 1), arg_1, e)
            )

        try:
            arg_18 = arg_16(
                mapped_name=arg_14["name"], process=arg_0.student_process
            )
            arg_14["args"] = bind_args(arg_18, arg_14["args"])
        except Exception:
            arg_15 = arg_0.build_message(
                arg_4, arg_12, append=arg_8
            )
            arg_0.report(
                Feedback(
                    arg_15, StubState(arg_14["node"], arg_0.highlighting_disabled)
                )
            )

    # three types of parts: pos_args, keywords, args (e.g. these are bound to sig)
    arg_19 = {"msg": arg_5, "kwargs": arg_12}
    arg_20 = part_to_child(
        arg_14, arg_13, arg_19, arg_0, node_name="function_calls"
    )
    return arg_20

Check whether a particular function is called.

    ``check_function()`` is typically followed by:

    - ``check_args()`` to check whether the arguments were specified.
      In turn, ``check_args()`` can be followed by ``has_equal_value()`` or ``has_equal_ast()``
      to assert that the arguments were correctly specified.
    - ``has_equal_value()`` to check whether rerunning the function call coded by the student
      gives the same result as calling the function call as in the solution.

    Checking function calls is a tricky topic. Please visit the
    `dedicated article <articles/checking_function_calls.html>`_ for more explanation,
    edge cases and best practices.

    Args:
        name (str): the name of the function to be tested. When checking functions in packages, always
            use the 'full path' of the function.
        index (int): index of the function call to be checked. Defaults to 0.
        missing_msg (str): If specified, this overrides an automatically generated feedback message in case
            the student did not call the function correctly.
        params_not_matched_msg (str): If specified, this overrides an automatically generated feedback message
            in case the function parameters were not successfully matched.
        expand_msg (str): If specified, this overrides any messages that are prepended by previous SCT chains.
        signature (Signature): Normally, check_function() can figure out what the function signature is,
            but it might be necessary to use ``sig_from_params()`` to manually build a signature and pass this along.
        state (State): State object that is passed from the SCT Chain (don't specify this).

    :Examples:

        Student code and solution code::

            import numpy as np
            arr = np.array([1, 2, 3, 4, 5])
            np.mean(arr)

        SCT::

            # Verify whether arr was correctly set in np.mean
            Ex().check_function('numpy.mean').check_args('a').has_equal_value()

            # Verify whether np.mean(arr) produced the same result
            Ex().check_function('numpy.mean').has_equal_value()

Check whether a particular function is called .


def Func():
    """Verify IPMI Funcironment"""

    arg_0 = cij.Func_to_dict(PREFIX, REQUIRED)

    if arg_0 is None:
        arg_0["USER"] = "admin"
        arg_0["PASS"] = "admin"
        arg_0["HOST"] = "localhost"
        arg_0["PORT"] = "623"
        cij.info("ipmi.Func: USER: %s, PASS: %s, HOST: %s, PORT: %s" % (
            arg_0["USER"], arg_0["PASS"], arg_0["HOST"], arg_0["PORT"]
        ))

    cij.Func_export(PREFIX, EXPORTED, arg_0)

    return 0


def
Func
(
arg_0
,
arg_1
)
:
if
isnak
(
arg_1
)
:
logger
.
info
(
'DHCPNAK of %s from %s'
,
arg_0
.
client
.
client_ip
,
arg_0
.
client
.
server_ip
)
return
True
return
False

def Func(arg_0, arg_1):
        """Process a received NAK packet."""
        if isnak(arg_1):
            logger.info('DHCPNAK of %s from %s',
                        arg_0.client.client_ip, arg_0.client.server_ip)
            return True
        return False


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_1 == "rtmpdump" : arg_1 = "rtmp-rtmpdump" elif arg_1 == "rtmpdump-proxy" : arg_1 = "rtmp-proxy" elif arg_1 == "errorlog" : arg_1 = "subprocess-errorlog" elif arg_1 == "errorlog-path" : arg_1 = "subprocess-errorlog-path" if arg_1 == "http-proxy" : arg_0 . http . proxies [ "http" ] = update_scheme ( "http://" , arg_2 ) elif arg_1 == "https-proxy" : arg_0 . http . proxies [ "https" ] = update_scheme ( "https://" , arg_2 ) elif arg_1 == "http-cookies" : if isinstance ( arg_2 , dict ) : arg_0 . http . cookies . update ( arg_2 ) else : arg_0 . http . parse_cookies ( arg_2 ) elif arg_1 == "http-headers" : if isinstance ( arg_2 , dict ) : arg_0 . http . headers . update ( arg_2 ) else : arg_0 . http . parse_headers ( arg_2 ) elif arg_1 == "http-query-params" : if isinstance ( arg_2 , dict ) : arg_0 . http . params . update ( arg_2 ) else : arg_0 . http . parse_query_params ( arg_2 ) elif arg_1 == "http-trust-env" : arg_0 . http . trust_env = arg_2 elif arg_1 == "http-ssl-verify" : arg_0 . http . verify = arg_2 elif arg_1 == "http-disable-dh" : if arg_2 : arg_7 . packages . urllib3 . util . ssl_ . DEFAULT_CIPHERS += ':!DH' try : arg_7 . packages . urllib3 . contrib . pyopenssl . DEFAULT_SSL_CIPHER_LIST = arg_7 . packages . urllib3 . util . ssl_ . DEFAULT_CIPHERS . encode ( "ascii" ) except AttributeError : pass elif arg_1 == "http-ssl-cert" : arg_0 . http . cert = arg_2 elif arg_1 == "http-timeout" : arg_0 . http . timeout = arg_2 else : arg_0 . options . set ( arg_1 , arg_2 )

def Func(arg_0, arg_1, arg_2):
        """Sets general options used by plugins and streams originating
        from this session object.

        :param key: key of the option
        :param value: value to set the option to

        **Available options**:

        ======================== =========================================
        hds-live-edge            ( float) Specify the time live HDS
                                 streams will start from the edge of
                                 stream, default: ``10.0``

        hds-segment-attempts     (int) How many attempts should be done
                                 to download each HDS segment, default: ``3``

        hds-segment-threads      (int) The size of the thread pool used
                                 to download segments, default: ``1``

        hds-segment-timeout      (float) HDS segment connect and read
                                 timeout, default: ``10.0``

        hds-timeout              (float) Timeout for reading data from
                                 HDS streams, default: ``60.0``

        hls-live-edge            (int) How many segments from the end
                                 to start live streams on, default: ``3``

        hls-segment-attempts     (int) How many attempts should be done
                                 to download each HLS segment, default: ``3``

        hls-segment-threads      (int) The size of the thread pool used
                                 to download segments, default: ``1``

        hls-segment-timeout      (float) HLS segment connect and read
                                 timeout, default: ``10.0``

        hls-timeout              (float) Timeout for reading data from
                                 HLS streams, default: ``60.0``

        http-proxy               (str) Specify a HTTP proxy to use for
                                 all HTTP requests

        https-proxy              (str) Specify a HTTPS proxy to use for
                                 all HTTPS requests

        http-cookies             (dict or str) A dict or a semi-colon (;)
                                 delimited str of cookies to add to each
                                 HTTP request, e.g. ``foo=bar;baz=qux``

        http-headers             (dict or str) A dict or semi-colon (;)
                                 delimited str of headers to add to each
                                 HTTP request, e.g. ``foo=bar;baz=qux``

        http-query-params        (dict or str) A dict or a ampersand (&)
                                 delimited string of query parameters to
                                 add to each HTTP request,
                                 e.g. ``foo=bar&baz=qux``

        http-trust-env           (bool) Trust HTTP settings set in the
                                 environment, such as environment
                                 variables (HTTP_PROXY, etc) and
                                 ~/.netrc authentication

        http-ssl-verify          (bool) Verify SSL certificates,
                                 default: ``True``

        http-ssl-cert            (str or tuple) SSL certificate to use,
                                 can be either a .pem file (str) or a
                                 .crt/.key pair (tuple)

        http-timeout             (float) General timeout used by all HTTP
                                 requests except the ones covered by
                                 other options, default: ``20.0``

        http-stream-timeout      (float) Timeout for reading data from
                                 HTTP streams, default: ``60.0``

        subprocess-errorlog      (bool) Log errors from subprocesses to
                                 a file located in the temp directory

        subprocess-errorlog-path (str) Log errors from subprocesses to
                                 a specific file

        ringbuffer-size          (int) The size of the internal ring
                                 buffer used by most stream types,
                                 default: ``16777216`` (16MB)

        rtmp-proxy               (str) Specify a proxy (SOCKS) that RTMP
                                 streams will use

        rtmp-rtmpdump            (str) Specify the location of the
                                 rtmpdump executable used by RTMP streams,
                                 e.g. ``/usr/local/bin/rtmpdump``

        rtmp-timeout             (float) Timeout for reading data from
                                 RTMP streams, default: ``60.0``

        ffmpeg-ffmpeg            (str) Specify the location of the
                                 ffmpeg executable use by Muxing streams
                                 e.g. ``/usr/local/bin/ffmpeg``

        ffmpeg-verbose           (bool) Log stderr from ffmpeg to the
                                 console

        ffmpeg-verbose-path      (str) Specify the location of the
                                 ffmpeg stderr log file

        ffmpeg-video-transcode   (str) The codec to use if transcoding
                                 video when muxing with ffmpeg
                                 e.g. ``h264``

        ffmpeg-audio-transcode   (str) The codec to use if transcoding
                                 audio when muxing with ffmpeg
                                 e.g. ``aac``

        stream-segment-attempts  (int) How many attempts should be done
                                 to download each segment, default: ``3``.
                                 General option used by streams not
                                 covered by other options.

        stream-segment-threads   (int) The size of the thread pool used
                                 to download segments, default: ``1``.
                                 General option used by streams not
                                 covered by other options.

        stream-segment-timeout   (float) Segment connect and read
                                 timeout, default: ``10.0``.
                                 General option used by streams not
                                 covered by other options.

        stream-timeout           (float) Timeout for reading data from
                                 stream, default: ``60.0``.
                                 General option used by streams not
                                 covered by other options.

        locale                   (str) Locale setting, in the RFC 1766 format
                                 eg. en_US or es_ES
                                 default: ``system locale``.

        user-input-requester     (UserInputRequester) instance of UserInputRequester
                                 to collect input from the user at runtime. Must be
                                 set before the plugins are loaded.
                                 default: ``UserInputRequester``.
        ======================== =========================================

        """

        # Backwards compatibility
        if arg_1 == "rtmpdump":
            arg_1 = "rtmp-rtmpdump"
        elif arg_1 == "rtmpdump-proxy":
            arg_1 = "rtmp-proxy"
        elif arg_1 == "errorlog":
            arg_1 = "subprocess-errorlog"
        elif arg_1 == "errorlog-path":
            arg_1 = "subprocess-errorlog-path"

        if arg_1 == "http-proxy":
            arg_0.http.proxies["http"] = update_scheme("http://", arg_2)
        elif arg_1 == "https-proxy":
            arg_0.http.proxies["https"] = update_scheme("https://", arg_2)
        elif arg_1 == "http-cookies":
            if isinstance(arg_2, dict):
                arg_0.http.cookies.update(arg_2)
            else:
                arg_0.http.parse_cookies(arg_2)
        elif arg_1 == "http-headers":
            if isinstance(arg_2, dict):
                arg_0.http.headers.update(arg_2)
            else:
                arg_0.http.parse_headers(arg_2)
        elif arg_1 == "http-query-params":
            if isinstance(arg_2, dict):
                arg_0.http.params.update(arg_2)
            else:
                arg_0.http.parse_query_params(arg_2)
        elif arg_1 == "http-trust-env":
            arg_0.http.trust_env = arg_2
        elif arg_1 == "http-ssl-verify":
            arg_0.http.verify = arg_2
        elif arg_1 == "http-disable-dh":
            if arg_2:
                arg_7.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':!DH'
                try:
                    arg_7.packages.urllib3.contrib.pyopenssl.DEFAULT_SSL_CIPHER_LIST = \
                        arg_7.packages.urllib3.util.ssl_.DEFAULT_CIPHERS.encode("ascii")
                except AttributeError:
                    # no ssl to disable the cipher on
                    pass
        elif arg_1 == "http-ssl-cert":
            arg_0.http.cert = arg_2
        elif arg_1 == "http-timeout":
            arg_0.http.timeout = arg_2
        else:
            arg_0.options.set(arg_1, arg_2)

Sets general options used by plugins and streams originating from this session object .


return [self.create(stage, config) for stage in config[name]]

def Func ( arg_0 , arg_1 , arg_2 ) : if arg_2 not in arg_1 : return [ ] return [ arg_0 . create ( arg_3 , arg_1 ) for arg_3 in arg_1 [ arg_2 ] ]

def Func(arg_0, arg_1, arg_2):
        '''Create a list of indirect stages.

        `name` should be the name of a config item that holds a list
        of names of stages, for instance, ``writers``.  This looks up
        the names of those stages, then creates and returns the
        corresponding list of stage objects.  For instance, if the
        config says

        .. code-block:: yaml

            incremental_transforms: [clean_html, clean_visible]

        then calling ``self.Func(scp_config,
        'incremental_transforms')`` will return a list of the two
        named stage instances.

        :param dict config: `streamcorpus_pipeline` configuration block
        :param str name: name of the stage name list entry
        :return: list of new stage instances

        '''
        if arg_2 not in arg_1:
            return []
        return [arg_0.create(arg_3, arg_1) for arg_3 in arg_1[arg_2]]

Create a list of indirect stages.

        `name` should be the name of a config item that holds a list
        of names of stages, for instance, ``writers``.  This looks up
        the names of those stages, then creates and returns the
        corresponding list of stage objects.  For instance, if the
        config says

        .. code-block:: yaml

            incremental_transforms: [clean_html, clean_visible]

        then calling ``self._init_stages(scp_config,
        'incremental_transforms')`` will return a list of the two
        named stage instances.

        :param dict config: `streamcorpus_pipeline` configuration block
        :param str name: name of the stage name list entry
        :return: list of new stage instances


def Func ( arg_0 , arg_1 ) : arg_2 = { 'Content-Type' : TYPES . get ( arg_1 , arg_1 ) } arg_0 . _request . headers = arg_2 arg_0 . add_matcher ( matcher ( 'HeadersMatcher' , arg_2 ) )

def Func(arg_0, arg_1):
        """
        Defines the ``Content-Type`` outgoing header value to match.

        You can pass one of the following type aliases instead of the full
        MIME type representation:

        - ``json`` = ``application/json``
        - ``xml`` = ``application/xml``
        - ``html`` = ``text/html``
        - ``text`` = ``text/plain``
        - ``urlencoded`` = ``application/x-www-form-urlencoded``
        - ``form`` = ``application/x-www-form-urlencoded``
        - ``form-data`` = ``application/x-www-form-urlencoded``

        Arguments:
            value (str): type alias or header value to match.

        Returns:
            self: current Mock instance.
        """
        arg_2 = {'Content-Type': TYPES.get(arg_1, arg_1)}
        arg_0._request.headers = arg_2
        arg_0.add_matcher(matcher('HeadersMatcher', arg_2))

Defines the Content - Type outgoing header value to match .


(self, zone, resource_id, project_id=None)

def Func(arg_0, arg_1, arg_2, arg_3=None):
        """
        Starts an existing instance defined by project_id, zone and resource_id.
        Must be called with keyword arguments rather than positional.

        :param zone: Google Cloud Platform zone where the instance exists
        :type zone: str
        :param resource_id: Name of the Compute Engine instance resource
        :type resource_id: str
        :param project_id: Optional, Google Cloud Platform project ID where the
            Compute Engine Instance exists. If set to None or missing,
            the default project_id from the GCP connection is used.
        :type project_id: str
        :return: None
        """
        arg_4 = arg_0.get_conn().instances().start(
            project=arg_3,
            arg_1=arg_1,
            instance=arg_2
        ).execute(num_retries=arg_0.num_retries)
        try:
            arg_5 = arg_4["name"]
        except KeyError:
            raise AirflowException(
                "Wrong response '{}' returned - it should contain "
                "'name' field".format(arg_4))
        arg_0._wait_for_operation_to_complete(arg_3=arg_3,
                                             arg_5=arg_5,
                                             arg_1=arg_1)

Starts an existing instance defined by project_id zone and resource_id . Must be called with keyword arguments rather than positional .


def Func(arg_0, arg_1):
    """Find the index of the closing braces for the opening braces
    at the start of the query string. Note that first character
    of input string must be an opening braces."""
    if arg_1[0] != '(':
      raise Exception("Trying to find closing braces for no opening braces")
    arg_2 = 0
    for arg_3 in range(len(arg_1)):
      arg_4 = arg_1[arg_3]
      if arg_4 == '(':
        arg_2 += 1
      elif arg_4 == ')':
        arg_2 -= 1
      if arg_2 == 0:
        return arg_3
    raise Exception("No closing braces found")

Find the index of the closing braces for the opening braces at the start of the query string . Note that first character of input string must be an opening braces .


(arr, aspect_ratio, mode="constant", cval=0, return_pad_amounts=False)

def Func(arg_0, arg_1, arg_2="constant", arg_3=0, arg_4=False):
    """
    Pad an image-like array on its sides so that it matches a target aspect ratio.

    Depending on which dimension is smaller (height or width), only the corresponding
    sides (left/right or top/bottom) will be padded. In each case, both of the sides will
    be padded equally.

    dtype support::

        See :func:`imgaug.imgaug.pad`.

    Parameters
    ----------
    arr : (H,W) ndarray or (H,W,C) ndarray
        Image-like array to pad.

    aspect_ratio : float
        Target aspect ratio, given as width/height. E.g. 2.0 denotes the image having twice
        as much width as height.

    mode : str, optional
        Padding mode to use. See :func:`numpy.pad` for details.

    cval : number, optional
        Value to use for padding if `mode` is ``constant``. See :func:`numpy.pad` for details.

    return_pad_amounts : bool, optional
        If False, then only the padded image will be returned. If True, a tuple with two
        entries will be returned, where the first entry is the padded image and the second
        entry are the amounts by which each image side was padded. These amounts are again a
        tuple of the form (top, right, bottom, left), with each value being an integer.

    Returns
    -------
    arr_padded : (H',W') ndarray or (H',W',C) ndarray
        Padded image as (H',W') or (H',W',C) ndarray, fulfulling the given aspect_ratio.

    tuple of int
        Amounts by which the image was padded on each side, given as a tuple ``(top, right, bottom, left)``.
        This tuple is only returned if `return_pad_amounts` was set to True.
        Otherwise only ``arr_padded`` is returned.

    """
    arg_5, arg_6, arg_7, arg_8 = compute_paddings_for_aspect_ratio(arg_0, arg_1)
    arg_9 = pad(
        arg_0,
        top=arg_5,
        right=arg_6,
        bottom=arg_7,
        left=arg_8,
        arg_2=arg_2,
        arg_3=arg_3
    )

    if arg_4:
        return arg_9, (arg_5, arg_6, arg_7, arg_8)
    else:
        return arg_9

Pad an image - like array on its sides so that it matches a target aspect ratio .


def Func ( arg_0 , ** arg_1 ) : arg_2 = arg_0 . pop ( 'security_group_rules' , [ ] ) for arg_3 in arg_2 : arg_3 [ 'ip_protocol' ] = arg_3 . pop ( 'protocol' ) arg_3 [ 'from_port' ] = arg_3 . pop ( 'port_range_max' ) arg_3 [ 'to_port' ] = arg_3 . pop ( 'port_range_min' ) arg_3 [ 'cidr_ip' ] = arg_3 . pop ( 'remote_ip_prefix' ) arg_3 [ 'rule_type' ] = arg_3 . pop ( 'direction' ) arg_0 [ 'rules' ] = sorted ( arg_2 ) return arg_0

def Func(arg_0, **arg_1):
    """ format the rule fields to match AWS to support auditor reuse,
        will need to remap back if we want to orchestrate from our stored items """
    arg_2 = arg_0.pop('security_group_rules',[])
    for arg_3 in arg_2:
        arg_3['ip_protocol'] = arg_3.pop('protocol')
        arg_3['from_port'] = arg_3.pop('port_range_max')
        arg_3['to_port'] = arg_3.pop('port_range_min')
        arg_3['cidr_ip'] = arg_3.pop('remote_ip_prefix')
        arg_3['rule_type'] = arg_3.pop('direction')
    arg_0['rules'] = sorted(arg_2)
    return arg_0

format the rule fields to match AWS to support auditor reuse will need to remap back if we want to orchestrate from our stored items


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
in
arg_0
.
cursors
:
arg_0
.
cursors
[
arg_1
]
.
close
(
)
else
:
raise
KeyError
(
'cursor with handle %s was not found'
%
arg_1
)

def Func(arg_0, arg_1):
        '''
        Closes the cursor specified and removes it from the `self.cursors`
        dictionary.

        '''

        if arg_1 in arg_0.cursors:
            arg_0.cursors[arg_1].close()
        else:
            raise KeyError('cursor with handle %s was not found' % arg_1)

Closes the cursor specified and removes it from the self . cursors dictionary .


Force reloading the data from the file.
        All data in the in-memory dictionary is discarded.
        This method is called automatically by the constructor, normally you
        don't need to call it.

def
Func
(
arg_0
)
:
arg_0
.
_check_open
(
)
try
:
arg_1
=
json
.
Func
(
arg_0
.
file
,
**
arg_0
.
Func_args
)
except
ValueError
:
arg_1
=
{
}
if
not
isinstance
(
arg_1
,
dict
)
:
raise
ValueError
(
'Root JSON type must be dictionary'
)
arg_0
.
clear
(
)
arg_0
.
update
(
arg_1
)

def Func(arg_0):
        """
        Force reFuncing the data from the file.
        All data in the in-memory dictionary is discarded.
        This method is called automatically by the constructor, normally you
        don't need to call it.
        """
        arg_0._check_open()
        try:
            arg_1 = json.Func(arg_0.file, **arg_0.Func_args)
        except ValueError:
            arg_1 = {}
        if not isinstance(arg_1, dict):
            raise ValueError('Root JSON type must be dictionary')
        arg_0.clear()
        arg_0.update(arg_1)

Force reloading the data from the file . All data in the in - memory dictionary is discarded . This method is called automatically by the constructor normally you don t need to call it .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
def
_expand
(
arg_3
)
:
if
arg_2
and
compat
.
is_basestring
(
arg_3
)
and
arg_3
.
lower
(
)
in
arg_2
:
return
arg_2
[
arg_3
]
return
arg_3
try
:
arg_4
=
dynamic_import_class
(
arg_0
)
arg_5
=
if
type
(
arg_1
)
in
(
tuple
,
list
)
:
arg_1
=
tuple
(
map
(
_expand
,
arg_1
)
)
arg_5
=
arg_4
(
*
arg_1
)
else
:
assert
type
(
arg_1
)
is
dict
arg_1
=
{
k
:
_expand
(
arg_3
)
for
k
,
arg_3
in
arg_1
.
items
(
)
}
arg_5
=
arg_4
(
**
arg_1
)
_logger
.
debug
(
"Instantiate {}({}) => {}"
.
format
(
arg_0
,
arg_1
,
arg_5
)
)
except
Exception
:
_logger
.
exception
(
"ERROR: Instantiate {}({}) => {}"
.
format
(
arg_0
,
arg_1
,
arg_5
)
)
return
arg_5

def Func(arg_0, arg_1, arg_2=None):
    """Import a class and instantiate with custom args.

    Example:
        name = "my.module.Foo"
        args_dict = {
            "bar": 42,
            "baz": "qux"
            }
        =>
        from my.module import Foo
        return Foo(bar=42, baz="qux")
    """

    def _expand(arg_3):
        """Replace some string templates with defined values."""
        if arg_2 and compat.is_basestring(arg_3) and arg_3.lower() in arg_2:
            return arg_2[arg_3]
        return arg_3

    try:
        arg_4 = dynamic_import_class(arg_0)
        arg_5 = None
        if type(arg_1) in (tuple, list):
            arg_1 = tuple(map(_expand, arg_1))
            arg_5 = arg_4(*arg_1)
        else:
            assert type(arg_1) is dict
            arg_1 = {k: _expand(arg_3) for k, arg_3 in arg_1.items()}
            arg_5 = arg_4(**arg_1)

        _logger.debug("Instantiate {}({}) => {}".format(arg_0, arg_1, arg_5))
    except Exception:
        _logger.exception("ERROR: Instantiate {}({}) => {}".format(arg_0, arg_1, arg_5))

    return arg_5

Import a class and instantiate with custom args .


def Func ( arg_0 , arg_1 ) : arg_2 = np . empty ( arg_0 ) for arg_3 in xrange ( arg_0 ) : arg_4 = GOE ( arg_1 ) arg_2 [ arg_3 ] = center_eigenvalue_diff ( arg_4 ) return arg_2

def Func(arg_0, arg_1):
    """Return num eigenvalue diffs for the NxN GOE ensemble."""
    arg_2 = np.empty(arg_0)
    for arg_3 in xrange(arg_0):
        arg_4 = GOE(arg_1)
        arg_2[arg_3] = center_eigenvalue_diff(arg_4)
    return arg_2

Return num eigenvalue diffs for the NxN GOE ensemble .


return types.FunctionType(
        code,
        six.get_function_globals(func),
        func.__name__,
        closure=six.get_function_closure(func))

def Func ( arg_0 ) : arg_1 = six . get_function_code ( arg_0 ) arg_2 = arg_1 . co_varnames [ arg_1 . co_argcount - 2 : arg_1 . co_argcount ] if arg_2 == ( 'this' , 'arguments' ) or arg_2 == ( 'arguments' , 'var' ) : return arg_0 arg_3 = append_arguments ( six . get_function_code ( arg_0 ) , ( 'this' , 'arguments' ) ) return types . FunctionType ( arg_3 , six . get_function_globals ( arg_0 ) , arg_0 . __name__ , closure = six . get_function_closure ( arg_0 ) )

def Func(arg_0):
    '''Use this function when unsure whether func takes this and arguments as its last 2 args.
       It will append 2 args if it does not.'''
    arg_1 = six.get_function_code(arg_0)
    arg_2 = arg_1.co_varnames[arg_1.co_argcount - 2:arg_1.co_argcount]
    if arg_2 == ('this', 'arguments') or arg_2 == ('arguments', 'var'):
        return arg_0
    arg_3 = append_arguments(six.get_function_code(arg_0), ('this', 'arguments'))

    return types.FunctionType(
        arg_3,
        six.get_function_globals(arg_0),
        arg_0.__name__,
        closure=six.get_function_closure(arg_0))

Use this function when unsure whether func takes this and arguments as its last 2 args . It will append 2 args if it does not .


def
Func
(
arg_0
)
:
logger
.
debug
(
'In state: Func'
)
logger
.
info
(
'(%s) state changed %s -> bound'
,
arg_0
.
client
.
iface
,
STATES2NAMES
[
arg_0
.
current_state
]
)
arg_0
.
current_state
=
STATE_Func
arg_0
.
client
.
lease
.
info_lease
(
)
if
arg_0
.
script
is
not
:
arg_0
.
script
.
script_init
(
arg_0
.
client
.
lease
,
arg_0
.
current_state
)
arg_0
.
script
.
script_go
(
)
else
:
try
:
set_net
(
arg_0
.
client
.
lease
)
except
Exception
as
e
:
logger
.
error
(
'Can not set IP'
,
exc_info
=
True
)

def Func(arg_0):
        """Func state."""
        logger.debug('In state: Func')
        logger.info('(%s) state changed %s -> bound', arg_0.client.iface,
                    STATES2NAMES[arg_0.current_state])
        arg_0.current_state = STATE_Func
        arg_0.client.lease.info_lease()
        if arg_0.script is not None:
            arg_0.script.script_init(arg_0.client.lease, arg_0.current_state)
            arg_0.script.script_go()
        else:
            try:
                set_net(arg_0.client.lease)
            except Exception as e:
                logger.error('Can not set IP', exc_info=True)


(self, client_key, redirect_uri, request)

return redirect_uri in request.client.redirect_uris

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
log
.
debug
(
'Validate redirect_uri %r for %r'
,
arg_2
,
arg_1
)
if
not
arg_3
.
client
:
arg_3
.
client
=
arg_0
.
_clientgetter
(
arg_1
=
arg_1
)
if
not
arg_3
.
client
:
return
False
if
not
arg_3
.
client
.
redirect_uris
and
arg_2
is
:
return
True
arg_3
.
redirect_uri
=
arg_2
return
arg_2
in
arg_3
.
client
.
redirect_uris

def Func(arg_0, arg_1, arg_2, arg_3):
        """Validate if the redirect_uri is allowed by the client."""
        log.debug('Validate redirect_uri %r for %r', arg_2, arg_1)
        if not arg_3.client:
            arg_3.client = arg_0._clientgetter(arg_1=arg_1)
        if not arg_3.client:
            return False
        if not arg_3.client.redirect_uris and arg_2 is None:
            return True
        arg_3.redirect_uri = arg_2
        return arg_2 in arg_3.client.redirect_uris

Validate if the redirect_uri is allowed by the client .


def Func(arg_0, arg_1=None):
    """Import any string-keys in a type mapping."""
    #log = get_logger()
    #log.debug("Importing canning map")
    for arg_2, arg_3 in list(arg_0.items()):
        if isinstance(arg_2, string_types):
            try:
                arg_4 = import_item(arg_2)
            except Exception:
                if arg_1 and arg_2 not in arg_1:
                    # only message on user-added classes
                    # log.error("canning class not importable: %r", key, exc_info=True)
                    print("ERROR: canning class not importable: %r", arg_2, exc_info=True)
                arg_0.pop(arg_2)
            else:
                arg_0[arg_4] = arg_0.pop(arg_2)

Import any string - keys in a type mapping .


def Func ( arg_0 , arg_1 = None ) : def _returns ( arg_2 ) : annotated ( arg_2 ) arg_2 . metadata . typed_returnvalue ( arg_0 , arg_1 ) return arg_2 return _returns

def Func(arg_0, arg_1=None):
    """Specify that this function returns a typed value.

    Args:
        type_name (str): A type name known to the global typedargs type system
        formatter (str): An optional name of a formatting function specified
            for the type given in type_name.
    """

    def _returns(arg_2):
        annotated(arg_2)
        arg_2.metadata.typed_returnvalue(arg_0, arg_1)
        return arg_2

    return _returns

Specify that this function returns a typed value .


def Func():
    """
    Add new java messages to ignore from user text file.  It first reads in the new java ignored messages
    from the user text file and generate a dict structure to out of the new java ignored messages.  This
    is achieved by function extract_message_to_dict.  Next, new java messages will be added to the original
    ignored java messages dict g_ok_java_messages.  Again, this is achieved by function update_message_dict.

    :return: none
    """
    global g_new_messages_to_exclude    # filename containing text file from user containing new java ignored messages
    global arg_1               # True if new ignored java messages are added.

    arg_0 = extract_message_to_dict(g_new_messages_to_exclude)

    if arg_0:
        arg_1 = True
        update_message_dict(arg_0,1)

Add new java messages to ignore from user text file . It first reads in the new java ignored messages from the user text file and generate a dict structure to out of the new java ignored messages . This is achieved by function extract_message_to_dict . Next new java messages will be added to the original ignored java messages dict g_ok_java_messages . Again this is achieved by function update_message_dict .


def Func ( ) : arg_0 = tf . ConfigProto ( ) arg_0 . gpu_options . allow_growth = True arg_0 . gpu_options . visible_device_list = '0' return tf . Session ( arg_0 = arg_0 )

def Func():
        """
        Configure session for particular device

        Returns:
            tensorflow.Session
        """
        arg_0 = tf.ConfigProto()
        arg_0.gpu_options.allow_growth = True
        arg_0.gpu_options.visible_device_list = '0'
        return tf.Session(arg_0=arg_0)


return ['sudo', '-s', '--set-home', '-u', user] + to_execute

def Func ( arg_0 , arg_1 , arg_2 = 'bash' ) : arg_3 = get_shell ( arg_2 ) + [ EXECUTE_SHELL_PARAM , arg_0 ] if arg_1 == 'root' : return arg_3 return [ 'sudo' , '-s' , '--set-home' , '-u' , arg_1 ] + arg_3

def Func(arg_0, arg_1, arg_2='bash'):
    """Get the arguments to execute a command as a user

    :param str cmd: command to execute
    :param user: User for use
    :param shell: Bash, zsh, etc.
    :return: arguments
    :rtype: list
    """
    arg_3 = get_shell(arg_2) + [EXECUTE_SHELL_PARAM, arg_0]
    if arg_1 == 'root':
        return arg_3
    return ['sudo', '-s', '--set-home', '-u', arg_1] + arg_3


return self.apply(func, pure, state).unwrap()

def Func(arg_0, arg_1, arg_2):
        # type: (S, B) -> T
        '''Sets all the foci within `state` to `value`.

        Requires kind Setter. This method will raise TypeError when the
        optic has no way to Func foci.
        '''
        if not arg_0._is_kind(Setter):
            raise TypeError('Must be an instance of Setter to .Func()')

        arg_3 = lambda a: Identity(a)
        arg_4 = lambda a: Identity(arg_2)
        return arg_0.apply(arg_4, arg_3, arg_1).unwrap()

Sets all the foci within `state` to `value`.

        Requires kind Setter. This method will raise TypeError when the
        optic has no way to set foci.

Sets all the foci within state to value .


def Func(arg_0, arg_1, arg_2):
    """Get required attribute from SBase.

    Parameters
    ----------
    sbase : libsbml.SBase
    value : existing value
    attribute: name of attribute

    Returns
    -------
    attribute value (or value if already set)
    """

    if (arg_1 is None) or (arg_1 == ""):
        arg_3 = "Required attribute '%s' cannot be found or parsed in '%s'" % \
              (arg_2, arg_0)
        if hasattr(arg_0, "getId") and arg_0.getId():
            arg_3 += " with id '%s'" % arg_0.getId()
        elif hasattr(arg_0, "getName") and arg_0.getName():
            arg_3 += " with name '%s'" % arg_0.getName()
        elif hasattr(arg_0, "getMetaId") and arg_0.getMetaId():
            arg_3 += " with metaId '%s'" % arg_0.getName()
        raise CobraSBMLError(arg_3)
    return arg_1


def Func ( arg_0 , arg_1 = None ) : arg_2 = [ ] if arg_1 is None : arg_1 = arg_0 . params . keys ( ) for arg_3 in arg_1 : arg_4 = arg_0 . params [ arg_3 ] if isinstance ( arg_4 , Parameter ) : arg_2 . append ( arg_4 ) return arg_2

def Func(arg_0, arg_1=None):
        """ Return a list of Parameter objects

        Parameters
        ----------

        pname : list or None
           If a list get the Parameter objects with those names

           If none, get all the Parameter objects

        Returns
        -------

        params : list
            list of Parameters

        """
        arg_2 = []
        if arg_1 is None:
            arg_1 = arg_0.params.keys()
        for arg_3 in arg_1:
            arg_4 = arg_0.params[arg_3]
            if isinstance(arg_4, Parameter):
                arg_2.append(arg_4)
        return arg_2


def Func(arg_0, arg_1=1):
        """
        Given an Ethernet frame, determine the appropriate sub-protocol;
        If layers is greater than zerol determine the type of the payload
        and load the appropriate type of network packet. It is expected
        that the payload be a hexified string. The layers argument determines
        how many layers to descend while parsing the packet.
        """
        if arg_1:
            arg_2 = payload_type(arg_0.type)[0]
            if arg_2:
                arg_2 = arg_2
                arg_3 = arg_0.payload
                arg_0.payload = arg_2(arg_3, arg_1 - 1)
            else:
                # if no type is found, do not touch the packet.
                pass

Given an Ethernet frame determine the appropriate sub - protocol ; If layers is greater than zerol determine the type of the payload and load the appropriate type of network packet . It is expected that the payload be a hexified string . The layers argument determines how many layers to descend while parsing the packet .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = arg_0 . label if arg_4 [ : 1 ] != '=' : arg_1 . on_trait_change ( arg_2 , arg_4 , arg_3 = arg_3 , dispatch = 'ui' )

def Func ( arg_0, arg_1, arg_2, arg_3 ):
        """ Sets up or removes a listener for the label being changed on a
            specified object.
        """
        arg_4 = arg_0.label
        if arg_4[:1] != '=':
            arg_1.on_trait_change( arg_2, arg_4, arg_3 = arg_3,
                                    dispatch = 'ui' )

Sets up or removes a listener for the label being changed on a specified object .


Create and connect to socket for TCP communication with hub.

def
Func
(
arg_0
)
:
try
:
arg_0
.
_socket
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
arg_0
.
_socket
.
settimeout
(
TIMEOUT_SECONDS
)
arg_0
.
_socket
.
Func
(
(
arg_0
.
_ip
,
arg_0
.
_port
)
)
_LOGGER
.
debug
(
"Successfully created Hub at %s:%s :)"
,
arg_0
.
_ip
,
arg_0
.
_port
)
except
socket
.
error
as
error
:
_LOGGER
.
error
(
"Error creating Hub: %s :("
,
error
)
arg_0
.
_socket
.
close
(
)

def Func(arg_0):
        """Create and Func to socket for TCP communication with hub."""
        try:
            arg_0._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            arg_0._socket.settimeout(TIMEOUT_SECONDS)
            arg_0._socket.Func((arg_0._ip, arg_0._port))
            _LOGGER.debug("Successfully created Hub at %s:%s :)", arg_0._ip,
                          arg_0._port)
        except socket.error as error:
            _LOGGER.error("Error creating Hub: %s :(", error)
            arg_0._socket.close()

Create and connect to socket for TCP communication with hub .


def Func ( ) : import ctypes arg_0 = 0 arg_1 = ( 'libcuda.so' , 'libcuda.dylib' , 'cuda.dll' ) for arg_2 in arg_1 : try : cuda = ctypes . CDLL ( arg_2 ) except OSError : continue else : break else : return 0 arg_3 = ctypes . c_int ( ) arg_4 = ctypes . c_char_p ( ) arg_5 = cuda . cuInit ( 0 ) if arg_5 != arg_0 : cuda . cuGetErrorString ( arg_5 , ctypes . byref ( arg_4 ) ) return 0 arg_5 = cuda . cuDeviceGetCount ( ctypes . byref ( arg_3 ) ) if arg_5 != arg_0 : cuda . cuGetErrorString ( arg_5 , ctypes . byref ( arg_4 ) ) return 0 return arg_3 . value

def Func():
    """Output some information on CUDA-enabled devices on your computer,
    including current memory usage. Modified to only get number of devices.

    It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1
    from C to Python with ctypes, so it can run without compiling
    anything. Note that this is a direct translation with no attempt to
    make the code Pythonic. It's meant as a general demonstration on how
    to obtain CUDA device information from Python without resorting to
    nvidia-smi or a compiled Python extension.

    .. note:: Author: Jan Schlüter, https://gist.github.com/63a664160d016a491b2cbea15913d549.git
    """
    import ctypes

    # Some constants taken from cuda.h
    arg_0 = 0

    arg_1 = ('libcuda.so', 'libcuda.dylib', 'cuda.dll')
    for arg_2 in arg_1:
        try:
            cuda = ctypes.CDLL(arg_2)
        except OSError:
            continue
        else:
            break
    else:
        # raise OSError("could not load any of: " + ' '.join(libnames))
        return 0

    arg_3 = ctypes.c_int()
    arg_4 = ctypes.c_char_p()

    arg_5 = cuda.cuInit(0)
    if arg_5 != arg_0:
        cuda.cuGetErrorString(arg_5, ctypes.byref(arg_4))
        # print("cuInit failed with error code %d: %s" % (result, error_str.value.decode()))
        return 0
    arg_5 = cuda.cuDeviceGetCount(ctypes.byref(arg_3))
    if arg_5 != arg_0:
        cuda.cuGetErrorString(arg_5, ctypes.byref(arg_4))
        # print("cuDeviceGetCount failed with error code %d: %s" % (result, error_str.value.decode()))
        return 0
    # print("Found %d device(s)." % nGpus.value)
    return arg_3.value

Output some information on CUDA - enabled devices on your computer including current memory usage . Modified to only get number of devices .


return self.config.output.extract_subset(
            input_data_tiles=[
                (output_tile, self.config.output.read(output_tile))
                for output_tile in output_tiles
            ],
            out_tile=self.tile,
        )

def Func ( arg_0 , ** arg_1 ) : if arg_0 . tile . pixelbuffer > arg_0 . config . output . pixelbuffer : arg_2 = list ( arg_0 . config . output_pyramid . tiles_from_bounds ( arg_0 . tile . bounds , arg_0 . tile . zoom ) ) else : arg_2 = arg_0 . config . output_pyramid . intersecting ( arg_0 . tile ) return arg_0 . config . output . extract_subset ( input_data_tiles = [ ( arg_3 , arg_0 . config . output . Func ( arg_3 ) ) for arg_3 in arg_2 ] , out_tile = arg_0 . tile , )

def Func(arg_0, **arg_1):
        """
        Read existing output data from a previous run.

        Returns
        -------
        process output : NumPy array (raster) or feature iterator (vector)
        """
        if arg_0.tile.pixelbuffer > arg_0.config.output.pixelbuffer:
            arg_2 = list(arg_0.config.output_pyramid.tiles_from_bounds(
                arg_0.tile.bounds, arg_0.tile.zoom
            ))
        else:
            arg_2 = arg_0.config.output_pyramid.intersecting(arg_0.tile)
        return arg_0.config.output.extract_subset(
            input_data_tiles=[
                (arg_3, arg_0.config.output.Func(arg_3))
                for arg_3 in arg_2
            ],
            out_tile=arg_0.tile,
        )

Read existing output data from a previous run .


def Func():
    """Build the parser that will have all available commands and options."""
    arg_0 = (
        'HTTPony (pronounced aych-tee-tee-pony) is a simple HTTP '
        'server that pretty prints HTTP requests to a terminal. It '
        'is a useful aide for developing clients that send HTTP '
        'requests. HTTPony acts as a sink for a client so that a '
        'developer can understand what the client is sending.')
    arg_1 = argparse.ArgumentParser(arg_0=arg_0)
    arg_1.add_argument(
        '-l', '--listen', help='set the IP address or hostname',
        default='localhost')
    arg_1.add_argument(
        '-p', '--port', help='set the port', default=8000, type=int)

    return arg_1

Build the parser that will have all available commands and options .


(self, service_name, deployment_name, role_name,
                    os_virtual_hard_disk=None, network_config=None,
                    availability_set_name=None, data_virtual_hard_disks=None,
                    role_size=None, role_type='PersistentVMRole',
                    resource_extension_references=None,
                    provision_guest_agent=None)

return self._perform_put(
            self._get_role_path(service_name, deployment_name, role_name),
            _XmlSerializer.update_role_to_xml(
                role_name,
                os_virtual_hard_disk,
                role_type,
                network_config,
                availability_set_name,
                data_virtual_hard_disks,
                role_size,
                resource_extension_references,
                provision_guest_agent),
            as_async=True)

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='PersistentVMRole',
                    arg_10=None,
                    arg_11=None):
        '''
        Updates the specified virtual machine.

        service_name:
            The name of the service.
        deployment_name:
            The name of the deployment.
        role_name:
            The name of the role.
        os_virtual_hard_disk:
            Contains the parameters Windows Azure uses to create the operating
            system disk for the virtual machine.
        network_config:
            Encapsulates the metadata required to create the virtual network
            configuration for a virtual machine. If you do not include a
            network configuration set you will not be able to access the VM
            through VIPs over the internet. If your virtual machine belongs to
            a virtual network you can not specify which subnet address space
            it resides under.
        availability_set_name:
            Specifies the name of an availability set to which to add the
            virtual machine. This value controls the virtual machine allocation
            in the Windows Azure environment. Virtual machines specified in the
            same availability set are allocated to different nodes to maximize
            availability.
        data_virtual_hard_disks:
            Contains the parameters Windows Azure uses to create a data disk
            for a virtual machine.
        role_size:
            The size of the virtual machine to allocate. The default value is
            Small. Possible values are: ExtraSmall, Small, Medium, Large,
            ExtraLarge. The specified value must be compatible with the disk
            selected in the OSVirtualHardDisk values.
        role_type:
            The type of the role for the virtual machine. The only supported
            value is PersistentVMRole.
        resource_extension_references:
            Optional. Contains a collection of resource extensions that are to
            be installed on the Virtual Machine. This element is used if
            provision_guest_agent is set to True.
        provision_guest_agent:
            Optional. Indicates whether the VM Agent is installed on the
            Virtual Machine. To run a resource extension in a Virtual Machine,
            this service must be installed.
        '''
        _validate_not_none('service_name', arg_1)
        _validate_not_none('deployment_name', arg_2)
        _validate_not_none('role_name', arg_3)
        return arg_0._perform_put(
            arg_0._get_role_path(arg_1, arg_2, arg_3),
            _XmlSerializer.Func_to_xml(
                arg_3,
                arg_4,
                arg_9,
                arg_5,
                arg_6,
                arg_7,
                arg_8,
                arg_10,
                arg_11),
            as_async=True)


def Func ( arg_0 , arg_1 ) : arg_1 = pass_white ( arg_0 , arg_1 ) if not arg_1 < len ( arg_0 ) : return None , arg_1 if any ( startswith_keyword ( arg_0 [ arg_1 : ] , arg_2 ) for arg_2 in { 'case' , 'default' } ) : return None , arg_1 arg_3 = arg_0 [ arg_1 : ] for arg_4 , arg_5 in KEYWORD_METHODS . iteritems ( ) : if arg_3 . startswith ( arg_4 ) : if len ( arg_4 ) == len ( arg_3 ) or arg_3 [ len ( arg_4 ) ] not in IDENTIFIER_PART : return arg_5 ( arg_0 , arg_1 ) if arg_3 [ 0 ] == '{' : return do_block ( arg_0 , arg_1 ) arg_6 = parse_identifier ( arg_0 , arg_1 , False ) if arg_6 is not None : arg_7 , arg_8 = arg_6 arg_8 = pass_white ( arg_0 , arg_8 ) if arg_0 [ arg_8 ] == ':' : return do_label ( arg_0 , arg_1 ) return do_expression ( arg_0 , arg_1 )

def Func(arg_0, arg_1):
    """returns none if not found other functions that begin with 'do_' raise
    also this do_ type function passes white space"""
    arg_1 = pass_white(arg_0, arg_1)
    # start is the fist position after initial start that is not a white space or \n
    if not arg_1 < len(arg_0):  #if finished parsing return None
        return None, arg_1
    if any(startswith_keyword(arg_0[arg_1:], arg_2) for arg_2 in {'case', 'default'}):
        return None, arg_1
    arg_3 = arg_0[arg_1:]
    for arg_4, arg_5 in KEYWORD_METHODS.iteritems(
    ):  # check for statements that are uniquely defined by their keywords
        if arg_3.startswith(arg_4):
            # has to startwith this keyword and the next letter after keyword must be either EOF or not in IDENTIFIER_PART
            if len(arg_4) == len(arg_3) or arg_3[len(arg_4)] not in IDENTIFIER_PART:
                return arg_5(arg_0, arg_1)
    if arg_3[0] == '{':  #Block
        return do_block(arg_0, arg_1)
    # Now only label and expression left
    arg_6 = parse_identifier(arg_0, arg_1, False)
    if arg_6 is not None:  # it can mean that its a label
        arg_7, arg_8 = arg_6
        arg_8 = pass_white(arg_0, arg_8)
        if arg_0[arg_8] == ':':
            return do_label(arg_0, arg_1)
    return do_expression(arg_0, arg_1)

returns none if not found other functions that begin with do_ raise also this do_ type function passes white space


def Func(arg_0, arg_1):
    """
    Makes the python dict corresponding to the
    JSON that needs to be sent for a failed
    response. Message is the message that is
    sent as the reason for failure.
    """
    arg_2 = arg_0.make_response(arg_3.RESPONSE_STATUS_FAILURE)
    arg_2[arg_3.RESPONSE_KEY_MESSAGE] = arg_1
    return arg_2

Makes the python dict corresponding to the JSON that needs to be sent for a failed response . Message is the message that is sent as the reason for failure .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_0 . assert_package_exists ( ) if not arg_0 . package_desc_set : arg_0 . package_desc_set = True if validations . validate_pkg_desc ( arg_2 ) : arg_1 . package . description = str_from_text ( arg_2 ) else : raise SPDXValueError ( 'Package::Description' ) else : raise CardinalityError ( 'Package::Description' )

def Func(arg_0, arg_1, arg_2):
        """Set's the package's description.
        Raises SPDXValueError if text is not free form text.
        Raises CardinalityError if description already set.
        Raises OrderError if no package previously defined.
        """
        arg_0.assert_package_exists()
        if not arg_0.package_desc_set:
            arg_0.package_desc_set = True
            if validations.validate_pkg_desc(arg_2):
                arg_1.package.description = str_from_text(arg_2)
            else:
                raise SPDXValueError('Package::Description')
        else:
            raise CardinalityError('Package::Description')

Set s the package s description . Raises SPDXValueError if text is not free form text . Raises CardinalityError if description already set . Raises OrderError if no package previously defined .


def Func(arg_0, arg_1, arg_2, arg_3):
        r'''Method to perform interpolation on a given tabular data set
        previously added via `set_tabular_data_P`. This method will create the
        interpolators the first time it is used on a property set, and store
        them for quick future use.

        Interpolation is cubic-spline based if 5 or more points are available,
        and linearly interpolated if not. Extrapolation is always performed
        linearly. This function uses the transforms `interpolation_T`,
        `interpolation_P`,
        `interpolation_property`, and `interpolation_property_inv` if set. If
        any of these are changed after the interpolators were first created,
        new interpolators are created with the new transforms.
        All interpolation is performed via the `interp2d` function.

        Parameters
        ----------
        T : float
            Temperature at which to interpolate the property, [K]
        T : float
            Pressure at which to interpolate the property, [Pa]
        name : str
            The name assigned to the tabular data set

        Returns
        -------
        prop : float
            Calculated property, [`units`]
        '''
        arg_4 = (arg_3, arg_0.interpolation_T, arg_0.interpolation_P, arg_0.interpolation_property, arg_0.interpolation_property_inv)

        # If the interpolator and extrapolator has already been created, load it
        if arg_4 in arg_0.tabular_data_interpolators:
            arg_5, arg_6 = arg_0.tabular_data_interpolators[arg_4]
        else:
            arg_7, arg_8, arg_9 = arg_0.tabular_data[arg_3]

            if arg_0.interpolation_T:  # Transform ths Ts with interpolation_T if set
                arg_10 = [arg_0.interpolation_T(T2) for T2 in arg_7]
            else:
                arg_10 = arg_7
            if arg_0.interpolation_P:  # Transform ths Ts with interpolation_T if set
                arg_11 = [arg_0.interpolation_P(P2) for P2 in arg_8]
            else:
                arg_11 = arg_8
            if arg_0.interpolation_property:  # Transform ths props with interpolation_property if set
                arg_12 = [arg_0.interpolation_property(p) for p in arg_9]
            else:
                arg_12 = arg_9
            # Only allow linear extrapolation, but with whatever transforms are specified
            arg_5 = interp2d(arg_10, arg_11, arg_12)  # interpolation if fill value is missing
            # If more than 5 property points, create a spline interpolation
            if len(arg_9) >= 5:
                arg_6 = interp2d(arg_10, arg_11, arg_12, kind='cubic')
            else:
                arg_6 = None
            arg_0.tabular_data_interpolators[arg_4] = (arg_5, arg_6)

        # Load the stores values, tor checking which interpolation strategy to
        # use.
        arg_7, arg_8, arg_9 = arg_0.tabular_data[arg_3]

        if arg_1 < arg_7[0] or arg_1 > arg_7[-1] or not arg_6 or arg_2 < arg_8[0] or arg_2 > arg_8[-1]:
            arg_14 = arg_5
        else:
            arg_14 = arg_6

        if arg_0.interpolation_T:
            arg_1 = arg_0.interpolation_T(arg_1)
        if arg_0.interpolation_P:
            arg_2 = arg_0.interpolation_T(arg_2)
        arg_15 = arg_14(arg_1, arg_2)  # either spline, or linear interpolation

        if arg_0.interpolation_property:
            arg_15 = arg_0.interpolation_property_inv(arg_15)

        return float(arg_15)

r Method to perform interpolation on a given tabular data set previously added via set_tabular_data_P . This method will create the interpolators the first time it is used on a property set and store them for quick future use .


def Func(arg_0, arg_1):
        """Check if the given message has the mandatory fields"""

        # This check is "case insensitive" because we're
        # using 'CaseInsensitiveDict' from requests.structures
        # module to store the contents of a message.
        if arg_0.MESSAGE_ID_FIELD not in arg_1:
            logger.warning("Field 'Message-ID' not found in message %s; ignoring",
                           arg_1['unixfrom'])
            return False

        if not arg_1[arg_0.MESSAGE_ID_FIELD]:
            logger.warning("Field 'Message-ID' is empty in message %s; ignoring",
                           arg_1['unixfrom'])
            return False

        if arg_0.DATE_FIELD not in arg_1:
            logger.warning("Field 'Date' not found in message %s; ignoring",
                           arg_1['unixfrom'])
            return False

        if not arg_1[arg_0.DATE_FIELD]:
            logger.warning("Field 'Date' is empty in message %s; ignoring",
                           arg_1['unixfrom'])
            return False

        try:
            str_to_datetime(arg_1[arg_0.DATE_FIELD])
        except InvalidDateError:
            logger.warning("Invalid date %s in message %s; ignoring",
                           arg_1[arg_0.DATE_FIELD], arg_1['unixfrom'])
            return False

        return True


def Func ( arg_0 , arg_1 ) : if arg_0 . _data is not None : for arg_2 in arg_0 . _data [ "disks" ] : if arg_2 [ "id" ] == arg_1 : return arg_2

def Func(arg_0, arg_1):
        """Returns a specific disk"""
        if arg_0._data is not None:
            for arg_2 in arg_0._data["disks"]:
                if arg_2["id"] == arg_1:
                    return arg_2


def Func(arg_0, arg_1=True):
        "Force appearance of the button next to the item"
        # This is useful to allow the user to expand the items which don't have
        # any children now, but instead adding them only when needed, thus
        # minimizing memory usage and loading time.
        arg_0._tree_model._tree_view.wx_obj.SetItemHasChildren(arg_0.wx_item,
                                                              arg_1)


def Func(arg_0):
        """Retrieve Credential from datastore.

        Returns:
            oauth2client.Credentials
        """
        arg_1 = None
        if arg_0._cache:
            arg_2 = arg_0._cache.get(arg_0._key_name)
            if arg_2:
                arg_1 = client.Credentials.new_from_json(arg_2)
        if arg_1 is None:
            arg_3 = arg_0._get_entity()
            if arg_3 is not None:
                arg_1 = getattr(arg_3, arg_0._property_name)
                if arg_0._cache:
                    arg_0._cache.set(arg_0._key_name, arg_1.to_json())

        if arg_1 and hasattr(arg_1, 'set_store'):
            arg_1.set_store(arg_0)
        return arg_1


def Func ( arg_0 ) : for arg_1 in ( "'" , '"' ) : if arg_0 . startswith ( arg_1 ) and arg_0 . endswith ( arg_1 ) and arg_0 . count ( arg_1 ) == 2 : arg_0 = arg_0 . strip ( arg_1 ) for arg_2 , arg_3 in _renames : arg_0 = arg_0 . replace ( arg_2 , arg_3 ) return arg_0

def Func(arg_0):
    """make a single string id SBML compliant"""
    for arg_1 in ("'", '"'):
        if arg_0.startswith(arg_1) and arg_0.endswith(arg_1) \
                and arg_0.count(arg_1) == 2:
            arg_0 = arg_0.strip(arg_1)
    for arg_2, arg_3 in _renames:
        arg_0 = arg_0.replace(arg_2, arg_3)
    return arg_0


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
for
arg_3
in
arg_2
:
try
:
arg_1
.
addHandler
(
arg_0
.
config
[
'handlers'
]
[
arg_3
]
)
except
StandardError
as
e
:
raise
ValueError
(
'Unable to add handler %r: %s'
%
(
arg_3
,
e
)
)

def Func(arg_0, arg_1, arg_2):
        """Add handlers to a logger from a list of names."""
        for arg_3 in arg_2:
            try:
                arg_1.addHandler(arg_0.config['handlers'][arg_3])
            except StandardError as e:
                raise ValueError('Unable to add handler %r: %s' % (arg_3, e))

Add handlers to a logger from a list of names .


def Func ( ) : arg_0 = getattr ( django . conf . settings , 'GOOGLE_OAUTH2_STORAGE_MODEL' , None ) if arg_0 is not None : return ( arg_0 [ 'model' ] , arg_0 [ 'user_property' ] , arg_0 [ 'credentials_property' ] ) else : return None , None , None

def Func():
    """This configures whether the credentials will be stored in the session
    or the Django ORM based on the settings. By default, the credentials
    will be stored in the session, unless `GOOGLE_OAUTH2_STORAGE_MODEL`
    is found in the settings. Usually, the ORM storage is used to integrate
    credentials into an existing Django user system.

    Returns:
        A tuple containing three strings, or None. If
        ``GOOGLE_OAUTH2_STORAGE_MODEL`` is configured, the tuple
        will contain the fully qualifed path of the `django.db.model`,
        the name of the ``django.contrib.auth.models.User`` field on the
        model, and the name of the
        :class:`oauth2client.contrib.django_util.models.CredentialsField`
        field on the model. If Django ORM storage is not configured,
        this function returns None.
    """
    arg_0 = getattr(django.conf.settings,
                                     'GOOGLE_OAUTH2_STORAGE_MODEL', None)
    if arg_0 is not None:
        return (arg_0['model'],
                arg_0['user_property'],
                arg_0['credentials_property'])
    else:
        return None, None, None

This configures whether the credentials will be stored in the session or the Django ORM based on the settings . By default the credentials will be stored in the session unless GOOGLE_OAUTH2_STORAGE_MODEL is found in the settings . Usually the ORM storage is used to integrate credentials into an existing Django user system .


def Func ( arg_0 , arg_1 = None ) : arg_2 , arg_3 , arg_2 = select . select ( [ ] , [ arg_0 . _socket ] , [ ] , arg_1 ) return len ( arg_3 ) > 0

def Func(arg_0, arg_1=None):
        """
        Blocks until the socket is ready to be written to, or the timeout is hit

        :param timeout:
            A float - the period of time to wait for the socket to be ready to
            written to. None for no time limit.

        :return:
            A boolean - if the socket is ready for writing. Will only be False
            if timeout is not None.
        """

        arg_2, arg_3, arg_2 = select.select([], [arg_0._socket], [], arg_1)
        return len(arg_3) > 0

Blocks until the socket is ready to be written to or the timeout is hit


def Func(arg_0, arg_1=0):
        """
        Join two bolt arrays together, at least one of which is in spark.

        Parameters
        ----------
        arrays : tuple
            A pair of arrays. At least one must be a spark array,
            the other can be a local bolt array, a local numpy array,
            or an array-like.

        axis : int, optional, default=0
            The axis along which the arrays will be joined.

        Returns
        -------
        BoltArraySpark
        """
        if not isinstance(arg_0, tuple):
            raise ValueError("data type not understood")
        if not len(arg_0) == 2:
            raise NotImplementedError("spark concatenation only supports two arrays")

        arg_2, arg_3 = arg_0
        if isinstance(arg_2, BoltArraySpark):
            return arg_2.Func(arg_3, arg_1)
        elif isinstance(arg_3, BoltArraySpark):
            arg_2 = ConstructSpark.array(arg_2, arg_3._rdd.context)
            return arg_2.Func(arg_3, arg_1)
        else:
            raise ValueError("at least one array must be a spark bolt array")

Join two bolt arrays together at least one of which is in spark .


def Func ( arg_0 ) : arg_1 = arg_0 . xml_attributes . copy ( ) return element ( arg_0 . xml_name , arg_1 = arg_1 )

def Func(arg_0):
        """Return a shallow copy of the current node i.e. a node with the same
        name and attributes but with no parent or child nodes
        """
        arg_1 = arg_0.xml_attributes.copy()
        return element(arg_0.xml_name, arg_1=arg_1)

Return a shallow copy of the current node i . e . a node with the same name and attributes but with no parent or child nodes


(self, states, internals, reward, update, reference=None)

return tf.nn.l2_loss(t=(prediction - reward))

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None):
        """
        Creates the TensorFlow operations for calculating the L2 loss between predicted
        state values and actual rewards.

        Args:
            states: Dict of state tensors.
            internals: List of prior internal state tensors.
            reward: Reward tensor.
            update: Boolean tensor indicating whether this call happens during an update.
            reference: Optional reference tensor(s), in case of a comparative loss.

        Returns:
            Loss tensor
        """
        arg_6 = arg_0.predict(arg_1=arg_1, arg_2=arg_2, arg_4=arg_4)
        return tf.nn.l2_loss(t=(arg_6 - arg_3))

Creates the TensorFlow operations for calculating the L2 loss between predicted state values and actual rewards .


def Func ( arg_0 ) : arg_1 = six . text_type , bytes , collections . abc . Mapping return more_itertools . Func ( arg_0 , base_type = arg_1 )

def Func(arg_0):
	"""
	Given an object, always return an iterable. If the item is not
	already iterable, return a tuple containing only the item. If item is
	None, an empty iterable is returned.

	>>> Func([1,2,3])
	<list_iterator...>
	>>> Func('foo')
	<tuple_iterator...>
	>>> Func(None)
	<tuple_iterator...>
	>>> Func(range(10))
	<range_iterator...>
	>>> def _test_func(): yield "I'm iterable"
	>>> print(next(Func(_test_func())))
	I'm iterable

	Although mappings are iterable, treat each like a singleton, as
	it's more like an object than a sequence.

	>>> next(Func(dict(a=1)))
	{'a': 1}
	"""
	arg_1 = six.text_type, bytes, collections.abc.Mapping
	return more_itertools.Func(arg_0, base_type=arg_1)

Given an object, always return an iterable. If the item is not
	already iterable, return a tuple containing only the item. If item is
	None, an empty iterable is returned.

	>>> always_iterable([1,2,3])
	<list_iterator...>
	>>> always_iterable('foo')
	<tuple_iterator...>
	>>> always_iterable(None)
	<tuple_iterator...>
	>>> always_iterable(range(10))
	<range_iterator...>
	>>> def _test_func(): yield "I'm iterable"
	>>> print(next(always_iterable(_test_func())))
	I'm iterable

	Although mappings are iterable, treat each like a singleton, as
	it's more like an object than a sequence.

	>>> next(always_iterable(dict(a=1)))
	{'a': 1}

Given an object always return an iterable . If the item is not already iterable return a tuple containing only the item . If item is None an empty iterable is returned .


def Func ( ) : with io . open ( 'pgmagick/_Func.py' ) as input_file : for arg_0 in input_file : if arg_0 . startswith ( '__Func__' ) : return ast . parse ( arg_0 ) . body [ 0 ] . value . s

def Func():
    """Return Func string."""
    with io.open('pgmagick/_Func.py') as input_file:
        for arg_0 in input_file:
            if arg_0.startswith('__Func__'):
                return ast.parse(arg_0).body[0].value.s


def Func(arg_0):
        """Returns opened file object for writing dialog logs.

        Returns:
            log_file: opened Python file object.
        """
        arg_1: Path = Path(arg_0.config['log_path']).expanduser().resolve() / arg_0.agent_name
        arg_1.mkdir(parents=True, exist_ok=True)
        arg_2 = Path(arg_1, f'{self._get_timestamp_utc_str()}_{self.agent_name}.log')
        arg_3 = open(arg_2, 'a', buffering=1, encoding='utf8')
        return arg_3

Returns opened file object for writing dialog logs .


def Func ( arg_0 , arg_1 ) : arg_0 . set ( arg_1 = arg_1 , netmask = arg_0 . _nm )

def Func(arg_0, arg_1):
        """Change the current IP."""
        arg_0.set(arg_1=arg_1, netmask=arg_0._nm)


def
Func
(
arg_0
,
arg_1
,
**
arg_2
)
:
arg_3
=
get_tempfile
(
suffix
=
'.svg'
)
arg_0
.
save_content
(
arg_3
.
name
)
arg_4
=
arg_2
.
get
(
'file_type'
,
'pdf'
)
arg_5
=
arg_2
.
get
(
'dpi'
,
150
)
arg_6
=
arg_2
.
get
(
'support_unicode'
,
False
)
try
:
if
arg_4
==
'svg'
:
shutil
.
copyfile
(
arg_3
.
name
,
arg_1
)
elif
arg_4
==
'png'
:
svg2png
(
arg_3
.
name
,
arg_1
,
arg_5
=
arg_5
)
elif
arg_4
==
'pdf'
:
svg2pdf
(
arg_3
.
name
,
arg_1
,
arg_5
=
arg_5
,
arg_6
=
arg_6
)
except
:
log
.
exception
(
'Error exporting file {} to {}'
.
format
(
arg_1
,
arg_4
)
)
raise

def Func(arg_0, arg_1, **arg_2):
        """ Save the content of the .svg file in the chosen Funced format.

        Parameters
        ----------
        file_path: str
            Path to the output file.

        Kwargs
        ------
        file_type: str
            Choices: 'png', 'pdf', 'svg'
            Default: 'pdf'

        dpi: int
            Dots-per-inch for the png and pdf.
            Default: 150

        support_unicode: bool
            Whether to allow unicode to be encoded in the PDF.
            Default: False
        """
        arg_3 = get_tempfile(suffix='.svg')
        arg_0.save_content(arg_3.name)

        arg_4 = arg_2.get('file_type', 'pdf')
        arg_5 = arg_2.get('dpi', 150)
        arg_6 = arg_2.get('support_unicode', False)
        try:
            if arg_4 == 'svg':
                shutil.copyfile(arg_3.name, arg_1)
            elif arg_4 == 'png':
                svg2png(arg_3.name, arg_1, arg_5=arg_5)
            elif arg_4 == 'pdf':
                svg2pdf(arg_3.name, arg_1, arg_5=arg_5, arg_6=arg_6)
        except:
            log.exception(
                'Error exporting file {} to {}'.format(arg_1, arg_4)
            )
            raise

Save the content of the .svg file in the chosen rendered format.

        Parameters
        ----------
        file_path: str
            Path to the output file.

        Kwargs
        ------
        file_type: str
            Choices: 'png', 'pdf', 'svg'
            Default: 'pdf'

        dpi: int
            Dots-per-inch for the png and pdf.
            Default: 150

        support_unicode: bool
            Whether to allow unicode to be encoded in the PDF.
            Default: False

Save the content of the . svg file in the chosen rendered format .


return {
        exc.namespace
        for _, exc, _ in graph.warnings
        if isinstance(exc, (MissingNamespaceNameWarning, MissingNamespaceRegexWarning))
    }

def Func ( arg_0 : arg_1 ) -> Set [ str ] : return { arg_3 . namespace for arg_2 , arg_3 , arg_2 in arg_0 . warnings if isinstance ( arg_3 , ( MissingNamespaceNameWarning , MissingNamespaceRegexWarning ) ) }

def Func(arg_0: arg_1) -> Set[str]:
    """Return the set of all namespaces with incorrect names in the graph."""
    return {
        arg_3.namespace
        for arg_2, arg_3, arg_2 in arg_0.warnings
        if isinstance(arg_3, (MissingNamespaceNameWarning, MissingNamespaceRegexWarning))
    }

Return the set of all namespaces with incorrect names in the graph .


def Func(arg_0):
    """Unpack `\\uNNNN` escapes in 's' and encode the result as UTF-8

    This method takes the output of the JSONEncoder and expands any \\uNNNN
    escapes it finds (except for \\u0000 to \\u001F, which are converted to
    \\xNN escapes).

    For performance, it assumes that the input is valid JSON, and performs few
    sanity checks.
    """

    # make the fast path fast: if there are no matches in the string, the
    # whole thing is ascii. On python 2, that means we're done. On python 3,
    # we have to turn it into a bytes, which is quickest with encode('utf-8')
    arg_1 = _U_ESCAPE.search(arg_0)
    if not arg_1:
        return arg_0 if PY2 else arg_0.encode('utf-8')

    # appending to a string (or a bytes) is slooow, so we accumulate sections
    # of string result in 'chunks', and join them all together later.
    # (It doesn't seem to make much difference whether we accumulate
    # utf8-encoded bytes, or strings which we utf-8 encode after rejoining)
    #
    arg_2 = []

    # 'pos' tracks the index in 's' that we have processed into 'chunks' so
    # far.
    arg_3 = 0

    while arg_1:
        arg_4 = arg_1.start()
        arg_5 = arg_1.end()

        arg_6 = arg_1.group(1)

        if arg_6 is None:
            # escaped backslash: pass it through along with anything before the
            # match
            arg_2.append(arg_0[arg_3:arg_5])
        else:
            # \uNNNN, but we have to watch out for surrogate pairs.
            #
            # On python 2, str.encode("utf-8") will decode utf-16 surrogates
            # before re-encoding, so it's fine for us to pass the surrogates
            # through. (Indeed we must, to deal with UCS-2 python builds, per
            # https://github.com/matrix-org/python-canonicaljson/issues/12).
            #
            # On python 3, str.encode("utf-8") complains about surrogates, so
            # we have to unpack them.
            arg_7 = int(arg_6, 16)

            if arg_7 < 0x20:
                # leave as a \uNNNN escape
                arg_2.append(arg_0[arg_3:arg_5])
            else:
                if PY3:   # pragma nocover
                    if arg_7 & 0xfc00 == 0xd800 and arg_0[arg_5:arg_5 + 2] == '\\u':
                        arg_8 = arg_0[arg_5 + 2:arg_5 + 6]
                        arg_9 = int(arg_8, 16)
                        if arg_9 & 0xfc00 == 0xdc00:
                            arg_7 = 0x10000 + (((arg_7 - 0xd800) << 10) |
                                           (arg_9 - 0xdc00))
                            arg_5 += 6

                arg_2.append(arg_0[arg_3:arg_4])
                arg_2.append(unichr(arg_7))

        arg_3 = arg_5
        arg_1 = _U_ESCAPE.search(arg_0, arg_3)

    # pass through anything after the last match
    arg_2.append(arg_0[arg_3:])

    return (''.join(arg_2)).encode("utf-8")

Unpack \\ uNNNN escapes in s and encode the result as UTF - 8


def Func ( arg_0 , ** arg_1 ) : arg_2 = describe_subnets ( Filters = [ { "Name" : "vpc-id" , "Values" : [ arg_0 [ "id" ] ] } ] , ** arg_1 ) arg_3 = [ ] for arg_4 in arg_2 : arg_3 . append ( arg_4 [ "SubnetId" ] ) return arg_3

def Func(arg_0, **arg_1):
    """Gets the VPC Subnets"""
    arg_2 = describe_subnets(Filters=[{"Name": "vpc-id", "Values": [arg_0["id"]]}], **arg_1)

    arg_3 = []
    for arg_4 in arg_2:
        arg_3.append(arg_4["SubnetId"])

    return arg_3


return [ os.path.basename(filename[0:-3]) for filename in py_files ]

def Func ( arg_0 , arg_1 = 2 ) : arg_2 = os . path . dirname ( arg_0 ) glob ( os . path . join ( arg_2 , '[a-zA-Z]*.py' ) ) arg_3 = glob ( os . path . join ( arg_2 , '[a-zA-Z]*.py' ) ) return [ os . path . basename ( arg_4 [ 0 : - 3 ] ) for arg_4 in arg_3 ]

def Func(arg_0, arg_1=2):
    "All python files caller's dir without the path and trailing .py"
    arg_2 = os.path.dirname(arg_0)
    # Get the name of our directory.
    # A glob pattern that will get all *.py files but not __init__.py
    glob(os.path.join(arg_2, '[a-zA-Z]*.py'))
    arg_3 = glob(os.path.join(arg_2, '[a-zA-Z]*.py'))
    return [ os.path.basename(arg_4[0:-3]) for arg_4 in arg_3 ]

All python files caller s dir without the path and trailing . py


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . shell . user_ns . get ( arg_1 . ifun , None ) if isinstance ( arg_2 , IPyAutocall ) : arg_2 . set_ip ( arg_0 . shell ) return arg_0 . prefilter_manager . get_handler_by_name ( 'auto' ) else : return None

def Func(arg_0, arg_1):
        "Instances of IPyAutocall in user_ns get autocalled immediately"
        arg_2 = arg_0.shell.user_ns.get(arg_1.ifun, None)
        if isinstance(arg_2, IPyAutocall):
            arg_2.set_ip(arg_0.shell)
            return arg_0.prefilter_manager.get_handler_by_name('auto')
        else:
            return None


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in arg_0 : arg_1 . extend ( arg_2 ) return np . array ( arg_1 )

def Func(arg_0):
    '''Given a sequence of sequences, return a flat numpy array.

    Parameters
    ----------
    iterables : sequence of sequence of number
        A sequence of tuples or lists containing numbers. Typically these come
        from something that represents each joint in a skeleton, like angle.

    Returns
    -------
    ndarray :
        An array of flattened data from each of the source iterables.
    '''
    arg_1 = []
    for arg_2 in arg_0:
        arg_1.extend(arg_2)
    return np.array(arg_1)

Given a sequence of sequences return a flat numpy array .


def Func(arg_0, arg_1):
        """Check if a name is declared in this or an outer scope."""
        if arg_1 in arg_0.declared_locally or arg_1 in arg_0.declared_parameter:
            return True
        return arg_1 in arg_0.declared

Check if a name is declared in this or an outer scope .


def Func(arg_0, arg_1):
    """
    Descend a path to return a folder id starting from the given folder id.

    :param parsed_path: a list of folders from top to bottom of a hierarchy
    :type parsed_path: list[string]
    :param folder_id: The id of the folder from which to start the descent
    :type folder_id: int | long
    :returns: The id of the found folder or -1
    :rtype: int | long
    """
    if len(arg_0) == 0:
        return arg_1

    arg_2.token = verify_credentials()

    arg_4 = arg_2.communicator.folder_get(arg_2.token,
                                                  arg_1)
    arg_5 = -1
    for arg_6 in arg_0:
        arg_5 = arg_4['folder_id']
        arg_7 = arg_2.communicator.folder_children(
            arg_2.token, arg_5)
        for arg_8 in arg_7['folders']:
            if arg_8['name'] == arg_6:
                arg_4 = arg_2.communicator.folder_get(
                    arg_2.token, arg_8['folder_id'])
                arg_5 = arg_4['folder_id']
                break
        else:
            return -1
    return arg_5

Descend a path to return a folder id starting from the given folder id .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = super ( ) . Func ( arg_1 , arg_2 ) arg_4 = arg_1 . get_status ( ) arg_5 = arg_1 . return_value if arg_4 == 'finished' else None arg_6 = { 'job_id' : arg_1 . id , 'status' : arg_4 , 'result' : arg_5 } arg_7 = pickle . dumps ( arg_6 ) arg_0 . connection . publish ( arg_0 . pubsub_channel , arg_7 ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """Custom method to execute a job and notify of its result

        :param job: Job object
        :param queue: the queue containing the object
        """

        arg_3 = super().Func(arg_1, arg_2)

        arg_4 = arg_1.get_status()
        arg_5 = arg_1.return_value if arg_4 == 'finished' else None

        arg_6 = {
            'job_id': arg_1.id,
            'status': arg_4,
            'result': arg_5
        }

        arg_7 = pickle.dumps(arg_6)
        arg_0.connection.publish(arg_0.pubsub_channel, arg_7)

        return arg_3


def Func ( arg_0 , arg_1 ) : arg_2 = dict ( ) for arg_3 in arg_0 . key_map . values ( ) : if _is_null ( arg_1 , arg_3 ) : return None if arg_3 in arg_1 . __dict__ : arg_2 [ arg_3 ] = arg_1 . __dict__ [ arg_3 ] else : arg_2 [ arg_3 ] = getattr ( arg_1 , arg_3 ) return frozenset ( tuple ( arg_2 . items ( ) ) )

def Func(arg_0, arg_1):
        '''
        Compute the index key that can be used to identify an instance
        on the link.
        '''
        arg_2 = dict()
        for arg_3 in arg_0.key_map.values():
            if _is_null(arg_1, arg_3):
                return None

            if arg_3 in arg_1.__dict__:
                arg_2[arg_3] = arg_1.__dict__[arg_3]
            else:
                arg_2[arg_3] = getattr(arg_1, arg_3)

        return frozenset(tuple(arg_2.items()))

Compute the index key that can be used to identify an instance on the link .


def Func ( arg_0 ) : if isinstance ( arg_0 , gp . GPServer ) : IPython . Func . Func ( GPAuthWidget ( arg_0 ) ) elif isinstance ( arg_0 , gp . GPTask ) : IPython . Func . Func ( GPTaskWidget ( arg_0 ) ) elif isinstance ( arg_0 , gp . GPJob ) : IPython . Func . Func ( GPJobWidget ( arg_0 ) ) else : IPython . Func . Func ( arg_0 )

def Func(arg_0):
    """
    Display a widget, text or other media in a notebook without the need to import IPython at the top level.

    Also handles wrapping GenePattern Python Library content in widgets.
    :param content:
    :return:
    """
    if isinstance(arg_0, gp.GPServer):
        IPython.Func.Func(GPAuthWidget(arg_0))
    elif isinstance(arg_0, gp.GPTask):
        IPython.Func.Func(GPTaskWidget(arg_0))
    elif isinstance(arg_0, gp.GPJob):
        IPython.Func.Func(GPJobWidget(arg_0))
    else:
        IPython.Func.Func(arg_0)

Display a widget text or other media in a notebook without the need to import IPython at the top level .