def Func(arg_0, arg_1, arg_2, arg_3):
    """Autoregressive and moving average estimators.

    This function provides an estimate of the autoregressive
    parameters, the moving average parameters, and the driving
    white noise variance of  an ARMA(P,Q) for a complex or real data sequence.

    The parameters are estimated using three steps:

        * Estimate the AR parameters from the original data based on a least
          squares modified Yule-Walker technique,
        * Produce a residual time sequence by filtering the original data
          with a filter based on the AR parameters,
        * Estimate the MA parameters from the residual time sequence.

    :param array X: Array of data samples (length N)
    :param int P: Desired number of AR parameters
    :param int Q: Desired number of MA parameters
    :param int lag: Maximum lag to use for autocorrelation estimates

    :return:
        * A     - Array of complex P AR parameter estimates
        * B     - Array of complex Q MA parameter estimates
        * RHO   - White noise variance estimate

    .. note::
      *  lag must be >= Q (MA order)

    **dependencies**:
        * :meth:`spectrum.correlation.CORRELATION`
        * :meth:`spectrum.covar.arcovar`
        * :meth:`spectrum.arma.ma`

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

        from spectrum import Func, arma2psd, marple_data
        import pylab

        a,b, rho = Func(marple_data, 15, 15, 30)
        psd = arma2psd(A=a, B=b, rho=rho, sides='centerdc', norm=True)
        pylab.plot(10 * pylab.log10(psd))
        pylab.ylim([-50,0])

    :reference: [Marple]_
    """
    arg_4 = CORRELATION(arg_0, maxlags=arg_3, norm='unbiased')
    arg_5 = arg_4[0]
    #C   Estimate the AR parameters (no error weighting is used).
    #C   Number of equation errors is M-Q .
    arg_6 = arg_3 - arg_2 + arg_1

    arg_7 = len(arg_0)
    arg_8 = np.zeros(arg_7-arg_1, dtype=complex)

    for arg_9 in range(0, arg_6):
        arg_10 = arg_9 + arg_2 - arg_1+1
        if arg_10 < 0:
            arg_8[arg_9] = arg_4[-arg_10].conjugate()
        if arg_10 == 0:
            arg_8[arg_9] = arg_5
        if arg_10 > 0:
            arg_8[arg_9] = arg_4[arg_10]

    # The resize is very important for the normalissation.
    arg_8.resize(arg_3)
    if arg_1 <= 4:
        arg_11 = arcovar_marple(arg_8.copy(), arg_1)    #! Eq. (10.12)
        arg_12 = arg_11[0]
    else:
        arg_11 = arcovar(arg_8.copy(), arg_1)    #! Eq. (10.12)
        arg_12 = arg_11[0]

    # the .copy is used to prevent a reference somewhere. this is a bug
    # to be tracked down.
    arg_8.resize(arg_7-arg_1)

    #C   Filter the original time series
    for arg_13 in range(arg_1, arg_7):
        arg_14 = arg_0[arg_13]
        #SUM += sum([ar_params[j]*X[k-j-1] for j in range(0,P)])
        for arg_15 in range(0, arg_1):
            arg_14 = arg_14 + arg_12[arg_15] * arg_0[arg_13-arg_15-1]   #! Eq. (10.17)
        arg_8[arg_13-arg_1] = arg_14

    #  Estimate the MA parameters (a "long" AR of order at least 2*IQ
    #C   is suggested)
    #Y.resize(N-P)
    arg_16, arg_17 = ma(arg_8, arg_2, 2*arg_2)     #! Eq. (10.3)

    return arg_12, arg_16, arg_17

Autoregressive and moving average estimators.

    This function provides an estimate of the autoregressive
    parameters, the moving average parameters, and the driving
    white noise variance of  an ARMA(P,Q) for a complex or real data sequence.

    The parameters are estimated using three steps:

        * Estimate the AR parameters from the original data based on a least
          squares modified Yule-Walker technique,
        * Produce a residual time sequence by filtering the original data
          with a filter based on the AR parameters,
        * Estimate the MA parameters from the residual time sequence.

    :param array X: Array of data samples (length N)
    :param int P: Desired number of AR parameters
    :param int Q: Desired number of MA parameters
    :param int lag: Maximum lag to use for autocorrelation estimates

    :return:
        * A     - Array of complex P AR parameter estimates
        * B     - Array of complex Q MA parameter estimates
        * RHO   - White noise variance estimate

    .. note::
      *  lag must be >= Q (MA order)

    **dependencies**:
        * :meth:`spectrum.correlation.CORRELATION`
        * :meth:`spectrum.covar.arcovar`
        * :meth:`spectrum.arma.ma`

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

        from spectrum import arma_estimate, arma2psd, marple_data
        import pylab

        a,b, rho = arma_estimate(marple_data, 15, 15, 30)
        psd = arma2psd(A=a, B=b, rho=rho, sides='centerdc', norm=True)
        pylab.plot(10 * pylab.log10(psd))
        pylab.ylim([-50,0])

    :reference: [Marple]_

Autoregressive and moving average estimators .


def Func ( arg_0 , arg_1 ) : arg_0 . object = arg_1 . save ( commit = False ) arg_3 = arg_0 . pre_save ( arg_0 . object ) if arg_3 : return arg_3 arg_0 . object . save ( ) arg_1 . save_m2m ( ) arg_0 . post_save ( arg_0 . object ) return HttpResponseRedirect ( arg_0 . get_success_url ( ) )

def Func(arg_0, arg_1):
        """
        Calls pre and post save hooks.
        """
        arg_0.object = arg_1.save(commit=False)

        # Invoke pre_save hook, and allow it to abort the saving
        # process and do a redirect.
        arg_3 = arg_0.pre_save(arg_0.object)
        if arg_3:
            return arg_3

        arg_0.object.save()
        arg_1.save_m2m()
        arg_0.post_save(arg_0.object)

        return HttpResponseRedirect(arg_0.get_success_url())


def
Func
(
arg_0
)
:
def
arg_3
(
arg_1
,
arg_2
)
:
if
arg_1
.
trusted
:
arg_0
(
arg_1
,
arg_2
)
else
:
print
(
"Sorry cannot do %s here."
%
arg_0
.
__name__
[
3
:
]
)
global
Funcs
Funcs
.
add
(
arg_0
.
__name__
)
arg_3
.
__doc__
=
arg_0
.
__doc__
return
arg_3

def Func(arg_0):
    """
    Trusted commands cannot be run remotely

    :param f:
    :return:
    """
    def arg_3(arg_1, arg_2):
        if arg_1.trusted:
            arg_0(arg_1, arg_2)
        else:
            print("Sorry cannot do %s here." % arg_0.__name__[3:])

    global Funcs
    Funcs.add(arg_0.__name__)
    arg_3.__doc__ = arg_0.__doc__
    return arg_3


def Func ( arg_0 ) : arg_1 = { arg_0 . key_name : arg_0 . key_value } arg_2 = arg_0 . model_class . objects . filter ( ** arg_1 ) if len ( arg_2 ) > 0 : arg_3 = getattr ( arg_2 [ 0 ] , arg_0 . property_name ) if getattr ( arg_3 , 'set_store' , None ) is not None : arg_3 . set_store ( arg_0 ) return arg_3 else : return None

def Func(arg_0):
        """Retrieve stored credential from the Django ORM.

        Returns:
            oauth2client.Credentials retrieved from the Django ORM, associated
             with the ``model``, ``key_value``->``key_name`` pair used to query
             for the model, and ``property_name`` identifying the
             ``CredentialsProperty`` field, all of which are defined in the
             constructor for this Storage object.

        """
        arg_1 = {arg_0.key_name: arg_0.key_value}
        arg_2 = arg_0.model_class.objects.filter(**arg_1)
        if len(arg_2) > 0:
            arg_3 = getattr(arg_2[0], arg_0.property_name)
            if getattr(arg_3, 'set_store', None) is not None:
                arg_3.set_store(arg_0)
            return arg_3
        else:
            return None

Retrieve stored credential from the Django ORM .


def Func ( arg_0 ) : arg_1 = [ "COMPLETED" , "CACHED" ] for arg_2 , arg_3 in arg_0 . trace_info . items ( ) : arg_3 = arg_0 . _update_tag_status ( arg_2 , arg_3 ) arg_0 . _update_process_resources ( arg_2 , arg_3 ) arg_0 . process_stats [ arg_2 ] = { } arg_5 = arg_0 . process_stats [ arg_2 ] arg_5 [ "completed" ] = "{}" . format ( len ( [ x for x in arg_3 if x [ "status" ] in arg_1 ] ) ) try : arg_6 = [ arg_0 . _hms ( x [ "realtime" ] ) for x in arg_3 ] arg_7 = round ( sum ( arg_6 ) / len ( arg_6 ) , 1 ) arg_8 = strftime ( '%H:%M:%S' , gmtime ( arg_7 ) ) arg_5 [ "realtime" ] = arg_8 except KeyError : arg_5 [ "realtime" ] = "-" try : arg_9 = [ arg_0 . _cpu_load_parser ( x [ "cpus" ] , x [ "%cpu" ] , x [ "realtime" ] ) for x in arg_3 ] arg_5 [ "cpuhour" ] = round ( sum ( arg_9 ) , 2 ) except KeyError : arg_5 [ "cpuhour" ] = "-" arg_5 [ "cpu_warnings" ] , arg_5 [ "mem_warnings" ] = arg_0 . _assess_resource_warnings ( arg_2 , arg_3 ) try : arg_10 = [ arg_0 . _size_coverter ( x [ "rss" ] ) for x in arg_3 if x [ "rss" ] != "-" ] if arg_10 : arg_11 = round ( max ( arg_10 ) ) arg_12 = arg_0 . _size_compress ( arg_11 ) else : arg_12 = "-" arg_5 [ "maxmem" ] = arg_12 except KeyError : arg_5 [ "maxmem" ] = "-" try : arg_13 = [ arg_0 . _size_coverter ( x [ "rchar" ] ) for x in arg_3 if x [ "rchar" ] != "-" ] if arg_13 : arg_14 = round ( sum ( arg_13 ) / len ( arg_13 ) ) arg_15 = arg_0 . _size_compress ( arg_14 ) else : arg_15 = "-" except KeyError : arg_15 = "-" arg_5 [ "avgread" ] = arg_15 try : arg_16 = [ arg_0 . _size_coverter ( x [ "wchar" ] ) for x in arg_3 if x [ "wchar" ] != "-" ] if arg_16 : arg_17 = round ( sum ( arg_16 ) / len ( arg_16 ) ) arg_18 = arg_0 . _size_compress ( arg_17 ) else : arg_18 = "-" except KeyError : arg_18 = "-" arg_5 [ "avgwrite" ] = arg_18

def Func(arg_0):
        """Updates the process stats with the information from the processes

        This method is called at the end of each static parsing of the nextflow
        trace file. It re-populates the :attr:`process_stats` dictionary
        with the new stat metrics.
        """

        arg_1 = ["COMPLETED", "CACHED"]

        for arg_2, arg_3 in arg_0.trace_info.items():

            # Update submission status of tags for each process
            arg_3 = arg_0._update_tag_status(arg_2, arg_3)

            # Update process resources
            arg_0._update_process_resources(arg_2, arg_3)

            arg_0.process_stats[arg_2] = {}

            arg_5 = arg_0.process_stats[arg_2]

            # Get number of completed samples
            arg_5["completed"] = "{}".format(
                len([x for x in arg_3 if x["status"] in arg_1]))

            # Get average time
            try:
                arg_6 = [arg_0._hms(x["realtime"]) for x in arg_3]
                arg_7 = round(sum(arg_6) / len(arg_6), 1)
                arg_8 = strftime('%H:%M:%S', gmtime(arg_7))
                arg_5["realtime"] = arg_8
            # When the realtime column is not present
            except KeyError:
                arg_5["realtime"] = "-"

            # Get cumulative cpu/hours
            try:
                arg_9 = [arg_0._cpu_load_parser(
                    x["cpus"], x["%cpu"], x["realtime"]) for x in arg_3]
                arg_5["cpuhour"] = round(sum(arg_9), 2)
            # When the realtime, cpus or %cpus column are not present
            except KeyError:
                arg_5["cpuhour"] = "-"

            # Assess resource warnings
            arg_5["cpu_warnings"], arg_5["mem_warnings"] = \
                arg_0._assess_resource_warnings(arg_2, arg_3)

            # Get maximum memory
            try:
                arg_10 = [arg_0._size_coverter(x["rss"]) for x in arg_3
                              if x["rss"] != "-"]
                if arg_10:
                    arg_11 = round(max(arg_10))
                    arg_12 = arg_0._size_compress(arg_11)
                else:
                    arg_12 = "-"
                arg_5["maxmem"] = arg_12
            except KeyError:
                arg_5["maxmem"] = "-"

            # Get read size
            try:
                arg_13 = [arg_0._size_coverter(x["rchar"]) for x in arg_3
                                if x["rchar"] != "-"]
                if arg_13:
                    arg_14 = round(sum(arg_13) / len(arg_13))
                    arg_15 = arg_0._size_compress(arg_14)
                else:
                    arg_15 = "-"
            except KeyError:
                arg_15 = "-"
            arg_5["avgread"] = arg_15

            # Get write size
            try:
                arg_16 = [arg_0._size_coverter(x["wchar"]) for x in arg_3
                                if x["wchar"] != "-"]
                if arg_16:
                    arg_17 = round(sum(arg_16) / len(arg_16))
                    arg_18 = arg_0._size_compress(arg_17)
                else:
                    arg_18 = "-"
            except KeyError:
                arg_18 = "-"
            arg_5["avgwrite"] = arg_18


return mat_left, mat_right, tens_in, tens_out

def Func(arg_0, arg_1):
    """Return the index string for Numpy.eignsum matrix multiplication.

    The returned indices are to perform a matrix multiplication A.v where
    the matrix A is an M-qubit matrix, matrix v is an N-qubit vector, and
    M <= N, and identity matrices are implied on the subsystems where A has no
    support on v.

    Args:
        gate_indices (list[int]): the indices of the right matrix subsystems
                                   to contract with the left matrix.
        number_of_qubits (int): the total number of qubits for the right matrix.

    Returns:
        tuple: (mat_left, mat_right, tens_in, tens_out) of index strings for
        that may be combined into a Numpy.einsum function string.

    Raises:
        QiskitError: if the total number of qubits plus the number of
        contracted indices is greater than 26.
    """

    # Since we use ASCII alphabet for einsum index labels we are limited
    # to 26 total free left (lowercase) and 26 right (uppercase) indexes.
    # The rank of the contracted tensor reduces this as we need to use that
    # many characters for the contracted indices
    if len(arg_0) + arg_1 > 26:
        raise QiskitError("Total number of free indexes limited to 26")

    # Indicies for N-qubit input tensor
    arg_2 = ascii_lowercase[:arg_1]

    # Indices for the N-qubit output tensor
    arg_3 = list(arg_2)

    # Left and right indices for the M-qubit multiplying tensor
    arg_4 = ""
    arg_5 = ""

    # Update left indices for mat and output
    for arg_6, arg_7 in enumerate(reversed(arg_0)):
        arg_4 += ascii_lowercase[-1 - arg_6]
        arg_5 += arg_2[-1 - arg_7]
        arg_3[-1 - arg_7] = ascii_lowercase[-1 - arg_6]
    arg_3 = "".join(arg_3)

    # Combine indices into matrix multiplication string format
    # for numpy.einsum function
    return arg_4, arg_5, arg_2, arg_3

Return the index string for Numpy . eignsum matrix multiplication .


def Func ( arg_0 , arg_1 , arg_2 = 1 ) : from six . moves import queue from threading import Thread def enqueue_output ( arg_0 , arg_1 , arg_3 ) : while arg_0 . poll ( ) is None : arg_4 = arg_1 . readline ( ) arg_3 . put ( arg_4 ) for arg_4 in _textio_iterlines ( arg_1 ) : arg_3 . put ( arg_4 ) arg_3 . put ( None ) arg_3 = queue . Queue ( maxsize = arg_2 ) arg_5 = Thread ( target = enqueue_output , args = ( arg_0 , arg_1 , arg_3 ) ) arg_5 . daemon = True arg_5 . start ( ) return arg_3

def Func(arg_0, arg_1, arg_2=1):
    """
    Reads output from a process in a separate thread
    """
    from six.moves import queue
    from threading import Thread
    def enqueue_output(arg_0, arg_1, arg_3):
        while arg_0.poll() is None:
            arg_4 = arg_1.readline()
            # print('ENQUEUE LIVE {!r} {!r}'.format(stream, line))
            arg_3.put(arg_4)

        for arg_4 in _textio_iterlines(arg_1):
            # print('ENQUEUE FINAL {!r} {!r}'.format(stream, line))
            arg_3.put(arg_4)

        # print("STREAM IS DONE {!r}".format(stream))
        arg_3.put(None)  # signal that the stream is finished
        # stream.close()
    arg_3 = queue.Queue(maxsize=arg_2)
    arg_5 = Thread(target=enqueue_output, args=(arg_0, arg_1, arg_3))
    arg_5.daemon = True  # thread dies with the program
    arg_5.start()
    return arg_3


def Func(arg_0):
    """
    Generate a normalized rectangle to be extract from the standard quokka image.

    Parameters
    ----------
    extract : 'square' or tuple of number or imgaug.BoundingBox or imgaug.BoundingBoxesOnImage
        Unnormalized representation of the image subarea to be extracted.

            * If string ``square``, then a squared area ``(x: 0 to max 643, y: 0 to max 643)``
              will be extracted from the image.
            * If a tuple, then expected to contain four numbers denoting ``x1``, ``y1``, ``x2``
              and ``y2``.
            * If a BoundingBox, then that bounding box's area will be extracted from the image.
            * If a BoundingBoxesOnImage, then expected to contain exactly one bounding box
              and a shape matching the full image dimensions (i.e. (643, 960, *)). Then the
              one bounding box will be used similar to BoundingBox.

    Returns
    -------
    bb : imgaug.BoundingBox
        Normalized representation of the area to extract from the standard quokka image.

    """
    # TODO get rid of this deferred import
    from imgaug.augmentables.bbs import BoundingBox, BoundingBoxesOnImage

    if arg_0 == "square":
        arg_1 = BoundingBox(x1=0, y1=0, x2=643, y2=643)
    elif isinstance(arg_0, tuple) and len(arg_0) == 4:
        arg_1 = BoundingBox(x1=arg_0[0], y1=arg_0[1], x2=arg_0[2], y2=arg_0[3])
    elif isinstance(arg_0, BoundingBox):
        arg_1 = arg_0
    elif isinstance(arg_0, BoundingBoxesOnImage):
        do_assert(len(arg_0.bounding_boxes) == 1)
        do_assert(arg_0.shape[0:2] == (643, 960))
        arg_1 = arg_0.bounding_boxes[0]
    else:
        raise Exception(
            "Expected 'square' or tuple of four entries or BoundingBox or BoundingBoxesOnImage "
            + "for parameter 'extract', got %s." % (type(arg_0),)
        )
    return arg_1

Generate a normalized rectangle to be extract from the standard quokka image .


def Func(arg_0, arg_1, arg_2=0, arg_3=0, arg_4=b''):
        """
        Sends an APDU to the device, and waits for a response.
        """
        if arg_4 is None:
            arg_4 = b''
        elif isinstance(arg_4, int):
            arg_4 = int2byte(arg_4)

        arg_5 = len(arg_4)
        arg_6 = arg_5 >> 16 & 0xff
        arg_7 = arg_5 >> 8 & 0xff
        arg_8 = arg_5 & 0xff
        arg_9 = struct.pack('B B B B B B B %is B B' % arg_5,
                                0, arg_1, arg_2, arg_3, arg_6, arg_7, arg_8, arg_4, 0x00, 0x00)
        try:
            arg_10 = arg_0._do_Func(arg_9)
        except Exception as e:
            # TODO Use six.reraise if/when Six becomes an agreed dependency.
            raise exc.DeviceError(e)
        arg_11 = struct.unpack('>H', arg_10[-2:])[0]
        arg_4 = arg_10[:-2]
        if arg_11 != APDU_OK:
            raise exc.APDUError(arg_11)
        return arg_4

Sends an APDU to the device and waits for a response .


def Func(arg_0):
    """
    Import a TIFF file into a numpy array.

    Arguments:
        tiff_filename:  A string filename of a TIFF datafile

    Returns:
        A numpy array with data from the TIFF file
    """
    # Expand filename to be absolute
    arg_0 = os.path.expanduser(arg_0)

    try:
        arg_1 = tiff.imread(arg_0)
    except Exception as e:
        raise ValueError("Could not Func file {0} for conversion."
                         .format(arg_0))
        raise

    return numpy.array(arg_1)


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
if
not
arg_0
.
case_sensitive
:
arg_1
=
arg_1
.
lower
(
)
if
arg_1
not
in
arg_0
.
names
:
return
arg_0
.
unknown_value
elif
not
arg_2
:
def
arg_5
(
arg_3
)
:
arg_3
=
map
(
ord
,
arg_3
.
replace
(
" "
,
""
)
)
return
(
len
(
arg_3
)
,
sum
(
map
(
lambda
c
:
c
>
64
and
c
55
or
c
48
,
arg_3
)
)
)
return
arg_0
.
_most_popular_gender
(
arg_1
,
arg_5
)
elif
arg_2
in
arg_0
.
__class__
.
COUNTRIES
:
arg_4
=
arg_0
.
__class__
.
COUNTRIES
.
index
(
arg_2
)
arg_5
=
lambda
e
:
(
ord
(
e
[
arg_4
]
)
32
,
0
)
return
arg_0
.
_most_popular_gender
(
arg_1
,
arg_5
)
else
:
raise
NoCountryError
(
"No such country: %s"
%
arg_2
)

def Func(arg_0, arg_1, arg_2=None):
        """Returns best gender for the given name and country pair"""
        if not arg_0.case_sensitive:
            arg_1 = arg_1.lower()

        if arg_1 not in arg_0.names:
            return arg_0.unknown_value
        elif not arg_2:
            def arg_5(arg_3):
                arg_3 = map(ord, arg_3.replace(" ", ""))
                return (len(arg_3),
                        sum(map(lambda c: c > 64 and c-55 or c-48, arg_3)))
            return arg_0._most_popular_gender(arg_1, arg_5)
        elif arg_2 in arg_0.__class__.COUNTRIES:
            arg_4 = arg_0.__class__.COUNTRIES.index(arg_2)
            arg_5 = lambda e: (ord(e[arg_4])-32, 0)
            return arg_0._most_popular_gender(arg_1, arg_5)
        else:
            raise NoCountryError("No such country: %s" % arg_2)


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
,
arg_4
=
arg_0
.
span
(
arg_1
)
Func
=
arg_3
+
(
arg_2
or
0
)
if
Func
>
arg_4
:
raise
ValueError
(
'value: extra out of range'
)
return
Func

def Func(arg_0, arg_1, arg_2):
        """Override if you don't define value0 and extraTable
        """
        arg_3, arg_4 = arg_0.span(arg_1)
        Func = arg_3+(arg_2 or 0)
        if Func>arg_4:
            raise ValueError('value: extra out of range')
        return Func

Override if you don t define value0 and extraTable


def Func ( arg_0 , arg_1 ) : arg_0 . _partitionIdMap = { } for arg_3 , arg_4 in enumerate ( arg_1 ) : arg_5 = arg_0 . _partitionIdMap . get ( arg_4 , [ ] ) arg_5 . append ( arg_3 ) arg_0 . _partitionIdMap [ arg_4 ] = arg_5

def Func(arg_0, arg_1):
    """
    Rebuilds the partition Id map using the given partitionIdList
    """
    arg_0._partitionIdMap = {}
    for arg_3, arg_4 in enumerate(arg_1):
      arg_5 = arg_0._partitionIdMap.get(arg_4, [])
      arg_5.append(arg_3)
      arg_0._partitionIdMap[arg_4] = arg_5


def Func ( arg_0 , arg_1 ) : if arg_1 in arg_0 . _process_stats : arg_0 . _process_stats [ arg_1 ] . stop ( ) return 1

def Func(arg_0, arg_1):
        """
        Stop memory and CPU monitoring

        @param process_name: Process name, ex: firefox-bin.
        @type process_name: string

        @return: 1 on success
        @rtype: integer
        """
        if arg_1 in arg_0._process_stats:
            # Stop monitoring process
            arg_0._process_stats[arg_1].stop()
        return 1


def Func ( ) : for arg_0 in list ( sys . modules . values ( ) ) : if arg_0 is None : continue arg_1 = getattr ( arg_0 , '__file__' , None ) if arg_1 : arg_2 = None while not os . path . isfile ( arg_1 ) : arg_2 = arg_1 arg_1 = os . path . dirname ( arg_1 ) if arg_1 == arg_2 : break else : if arg_1 [ - 4 : ] in ( '.pyc' , '.pyo' ) : arg_1 = arg_1 [ : - 1 ] yield arg_1

def Func():
    """This iterates over all relevant Python files.  It goes through all
    loaded files from modules, all files in folders of already loaded modules
    as well as all files reachable through a package.
    """
    # The list call is necessary on Python 3 in case the module
    # dictionary modifies during iteration.
    for arg_0 in list(sys.modules.values()):
        if arg_0 is None:
            continue
        arg_1 = getattr(arg_0, '__file__', None)
        if arg_1:
            arg_2 = None
            while not os.path.isfile(arg_1):
                arg_2 = arg_1
                arg_1 = os.path.dirname(arg_1)
                if arg_1 == arg_2:
                    break
            else:
                if arg_1[-4:] in ('.pyc', '.pyo'):
                    arg_1 = arg_1[:-1]
                yield arg_1

This iterates over all relevant Python files . It goes through all loaded files from modules all files in folders of already loaded modules as well as all files reachable through a package .


return lowercase(string[0]) + re.sub(r"[\-_\.\s]([a-z])", lambda matched: uppercase(matched.group(1)), string[1:])

def Func ( arg_0 ) : arg_0 = re . sub ( r"^[\-_\.]" , '' , str ( arg_0 ) ) if not arg_0 : return arg_0 return lowercase ( arg_0 [ 0 ] ) + re . sub ( r"[\-_\.\s]([a-z])" , lambda matched : uppercase ( matched . group ( 1 ) ) , arg_0 [ 1 : ] )

def Func(arg_0):
    """ Convert string into camel case.

    Args:
        string: String to convert.

    Returns:
        string: Camel case string.

    """

    arg_0 = re.sub(r"^[\-_\.]", '', str(arg_0))
    if not arg_0:
        return arg_0
    return lowercase(arg_0[0]) + re.sub(r"[\-_\.\s]([a-z])", lambda matched: uppercase(matched.group(1)), arg_0[1:])


def Func ( arg_0 , arg_1 = 0 ) : arg_2 = os . path . dirname ( os . path . dirname ( arg_0 ) ) arg_3 = os . path . join ( arg_2 , ds_config . references_dir , os . path . basename ( arg_0 ) [ : - 4 ] + ds_config . references_ext ) arg_4 = jams . load ( arg_3 , validate = False ) arg_5 = arg_4 . search ( namespace = 'segment_.*' ) [ arg_1 ] arg_6 , arg_7 = arg_5 . to_interval_values ( ) arg_8 = utils . intervals_to_times ( arg_6 ) return arg_8 , arg_7

def Func(arg_0, arg_1=0):
    """Reads the boundary times and the labels.

    Parameters
    ----------
    audio_path : str
        Path to the audio file

    Returns
    -------
    ref_times : list
        List of boundary times
    ref_labels : list
        List of labels

    Raises
    ------
    IOError: if `audio_path` doesn't exist.
    """
    # Dataset path
    arg_2 = os.path.dirname(os.path.dirname(arg_0))

    # Read references
    arg_3 = os.path.join(arg_2, ds_config.references_dir,
                            os.path.basename(arg_0)[:-4] +
                            ds_config.references_ext)

    arg_4 = jams.load(arg_3, validate=False)
    arg_5 = arg_4.search(namespace='segment_.*')[arg_1]
    arg_6, arg_7 = arg_5.to_interval_values()

    # Intervals to times
    arg_8 = utils.intervals_to_times(arg_6)

    return arg_8, arg_7

Reads the boundary times and the labels .


(cb_ticksize, cb_fraction, cb_pad, cb_tick_values, cb_tick_labels)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """Setup the colorbar of the figure, specifically its ticksize and the size is appears relative to the figure.

    Parameters
    -----------
    cb_ticksize : int
        The size of the tick labels on the colorbar.
    cb_fraction : float
        The fraction of the figure that the colorbar takes up, which resizes the colorbar relative to the figure.
    cb_pad : float
        Pads the color bar in the figure, which resizes the colorbar relative to the figure.
    cb_tick_values : [float]
        Manually specified values of where the colorbar tick labels appear on the colorbar.
    cb_tick_labels : [float]
        Manually specified labels of the color bar tick labels, which appear where specified by cb_tick_values.
    """

    if arg_3 is None and arg_4 is None:
        arg_5 = plt.colorbar(fraction=arg_1, pad=arg_2)
    elif arg_3 is not None and arg_4 is not None:
        arg_5 = plt.colorbar(fraction=arg_1, pad=arg_2, ticks=arg_3)
        arg_5.ax.set_yticklabels(arg_4)
    else:
        raise exc.PlottingException('Only 1 entry of cb_tick_values or cb_tick_labels was input. You must either supply'
                                    'both the values and labels, or neither.')

    arg_5.ax.tick_params(labelsize=arg_0)

Setup the colorbar of the figure specifically its ticksize and the size is appears relative to the figure .


def Func ( ) : arg_0 = os . path . dirname ( globals ( ) [ '__file__' ] ) return os . path . dirname ( os . path . dirname ( arg_0 ) )

def Func():
    """Get the absolute path to the root of the demosys package"""
    arg_0 = os.path.dirname(globals()['__file__'])
    return os.path.dirname(os.path.dirname(arg_0))


def Func(arg_0, arg_1, **arg_2):
        """
        Send a completion status call to the integrated channel using the client.

        Args:
            payload: The learner completion data payload to send to the integrated channel.
            kwargs: Contains integrated channel-specific information for customized transmission variables.
                - app_label: The app label of the integrated channel for whom to store learner data records for.
                - model_name: The name of the specific learner data record model to use.
                - remote_user_id: The remote ID field name of the learner on the audit model.
        """
        arg_3 = apps.get_model(  # pylint: disable=invalid-name
            app_label=arg_2.get('app_label', 'integrated_channel'),
            model_name=arg_2.get('model_name', 'LearnerDataTransmissionAudit'),
        )
        # Since we have started sending courses to integrated channels instead of course runs,
        # we need to attempt to send transmissions with course keys and course run ids in order to
        # ensure that we account for whether courses or course runs exist in the integrated channel.
        # The exporters have been changed to return multiple transmission records to attempt,
        # one by course key and one by course run id.
        # If the transmission with the course key succeeds, the next one will get skipped.
        # If it fails, the one with the course run id will be attempted and (presumably) succeed.
        for arg_4 in arg_1.export():
            arg_5 = arg_4.serialize(enterprise_configuration=arg_0.enterprise_configuration)
            LOGGER.debug('Attempting to Func serialized payload: %s', arg_5)

            arg_6 = arg_4.enterprise_course_enrollment_id
            if arg_4.completed_timestamp is None:
                # The user has not completed the course, so we shouldn't send a completion status call
                LOGGER.info('Skipping in-progress enterprise enrollment {}'.format(arg_6))
                continue

            arg_7 = arg_3.objects.filter(
                enterprise_course_enrollment_id=arg_6,
                arg_11=''
            )
            if arg_7.exists():
                # We've already sent a completion status call for this enrollment
                LOGGER.info('Skipping previously sent enterprise enrollment {}'.format(arg_6))
                continue

            try:
                arg_8, arg_9 = arg_0.client.create_course_completion(
                    getattr(arg_4, arg_2.get('remote_user_id')),
                    arg_5
                )
                LOGGER.info(
                    'Successfully sent completion status call for enterprise enrollment {}'.format(
                        arg_6,
                    )
                )
            except RequestException as request_exception:
                arg_8 = 500
                arg_9 = str(request_exception)
                arg_0.handle_transmission_error(arg_4, request_exception)

            arg_4.status = str(arg_8)
            arg_4.error_message = arg_9 if arg_8 >= 400 else ''
            arg_4.save()

Send a completion status call to the integrated channel using the client .


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , six . string_types ) : return len ( arg_0 . findall ( arg_1 ) ) > 0 elif isinstance ( arg_1 , dict ) : return Func ( arg_0 , arg_1 . values ( ) ) elif hasattr ( arg_1 , '__iter__' ) : return any ( Func ( arg_0 , arg_2 ) for arg_2 in arg_1 if isinstance ( arg_2 , six . string_types ) ) else : return False

def Func(arg_0, arg_1):
    """
    Returns true if the regex matches the object, or a string in the object
    if it is some sort of container.

    :param regex: A regex.
    :type regex: ``regex``
    :param obj: An arbitrary object.
    :type object: ``object``

    :rtype: ``bool``
    """
    if isinstance(arg_1, six.string_types):
        return len(arg_0.findall(arg_1)) > 0
    elif isinstance(arg_1, dict):
        return Func(arg_0, arg_1.values())
    elif hasattr(arg_1, '__iter__'):
        # Object is a list or some other iterable.
        return any(Func(arg_0, arg_2)
                   for arg_2 in arg_1 if isinstance(arg_2, six.string_types))
    else:
        return False

Returns true if the regex matches the object or a string in the object if it is some sort of container .


def
Func
(
arg_0
)
:
arg_1
=
re
.
compile
(
r'^=+$\s^([\w\s-]+)^=+$'
,
flags
=
re
.
M
)
arg_0
=
re
.
sub
(
arg_1
,
r'# \1'
,
arg_0
)
arg_2
=
re
.
compile
(
r'^\.\. math::((?:.+)?(?:\n+^  .+)*)'
,
flags
=
re
.
M
)
arg_0
=
re
.
sub
(
arg_2
,
lambda
match
:
r'$${0}$$'
.
format
(
match
.
group
(
1
)
.
strip
(
)
)
,
arg_0
)
arg_3
=
re
.
compile
(
r':math:`(.+)`'
)
arg_0
=
re
.
sub
(
arg_3
,
r'$\1$'
,
arg_0
)
return
arg_0

def Func(arg_0):
    """Converts the RST text from the examples docstrigs and comments
    into markdown text for the IPython notebooks"""

    arg_1 = re.compile(r'^=+$\s^([\w\s-]+)^=+$', flags=re.M)
    arg_0 = re.sub(arg_1, r'# \1', arg_0)

    arg_2 = re.compile(r'^\.\. math::((?:.+)?(?:\n+^  .+)*)', flags=re.M)
    arg_0 = re.sub(arg_2,
                  lambda match: r'$${0}$$'.format(match.group(1).strip()),
                  arg_0)
    arg_3 = re.compile(r':math:`(.+)`')
    arg_0 = re.sub(arg_3, r'$\1$', arg_0)

    return arg_0


return self._perform_get(
            '/' + self.subscription_id + '/affinitygroups/' +
            _str(affinity_group_name) + '',
            AffinityGroup)

def Func ( arg_0 , arg_1 ) : _validate_not_none ( 'affinity_group_name' , arg_1 ) return arg_0 . _perform_get ( '/' + arg_0 . subscription_id + '/affinitygroups/' + _str ( arg_1 ) + '' , AffinityGroup )

def Func(arg_0, arg_1):
        '''
        Returns the system properties associated with the specified affinity
        group.

        affinity_group_name:
            The name of the affinity group.
        '''
        _validate_not_none('affinity_group_name', arg_1)
        return arg_0._perform_get(
            '/' + arg_0.subscription_id + '/affinitygroups/' +
            _str(arg_1) + '',
            AffinityGroup)

Returns the system properties associated with the specified affinity group .


(path, method, args=None, classArgs = None)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
)
:
arg_4
=
{
}
if
arg_2
is
:
arg_2
=
{
}
if
arg_3
is
:
arg_3
=
{
}
sys
.
path
.
append
(
arg_0
)
arg_5
=
[
"__init__.py"
,
"base.py"
]
for
arg_6
in
AtomShieldsScanner
.
_getFiles
(
arg_0
,
"*.py"
,
arg_5
=
arg_5
)
:
try
:
arg_7
=
AtomShieldsScanner
.
_getClassInstance
(
arg_0
=
arg_6
,
arg_2
=
arg_3
)
if
arg_7
is
not
:
if
callable
(
arg_1
)
:
arg_2
[
"instance"
]
=
arg_7
arg_8
=
arg_1
(
**
arg_2
)
arg_4
[
arg_7
.
__class__
.
NAME
]
=
arg_8
else
:
if
hasattr
(
arg_7
,
arg_1
)
:
arg_8
=
getattr
(
arg_7
,
arg_1
)
(
**
arg_2
)
arg_4
[
arg_7
.
__class__
.
NAME
]
=
arg_8
else
:
continue
except
Exception
as
e
:
AtomShieldsScanner
.
_debug
(
"[!] %s"
%
e
)
sys
.
path
.
remove
(
arg_0
)
return
arg_4

def Func(arg_0, arg_1, arg_2=None, arg_3 = None):
		"""
		Execute an specific method for each class instance located in path

		Args:
			path (str): Absolute path which contains the .py files
			method (str): Method to execute into class instance

		Returns:
			dict: Dictionary which contains the response for every class instance.
				  The dictionary keys are the value of 'NAME' class variable.
		"""
		arg_4 = {}

		if arg_2 is None:
			arg_2 = {}

		if arg_3 is None:
			arg_3 = {}

		sys.path.append(arg_0)
		arg_5 = ["__init__.py", "base.py"]
		for arg_6 in AtomShieldsScanner._getFiles(arg_0, "*.py", arg_5=arg_5):
			try:
				arg_7 = AtomShieldsScanner._getClassInstance(arg_0 = arg_6, arg_2 = arg_3)
				if arg_7 is not None:
					if callable(arg_1):
						arg_2["instance"] = arg_7
						arg_8 = arg_1(**arg_2)
						arg_4[arg_7.__class__.NAME] = arg_8
					else:
						if hasattr(arg_7, arg_1):
							arg_8 = getattr(arg_7, arg_1)(**arg_2)
							arg_4[arg_7.__class__.NAME] = arg_8
						else:
							continue

			except Exception as e:
				AtomShieldsScanner._debug("[!] %s" % e)
		sys.path.remove(arg_0)
		return arg_4


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . getLocalProtocol ( arg_1 ) arg_3 . transport . write ( arg_2 ) return { }

def Func(arg_0, arg_1, arg_2):
        """Some data was received from the remote end. Find the matching
        protocol and replay it.

        """
        arg_3 = arg_0.getLocalProtocol(arg_1)
        arg_3.transport.write(arg_2)
        return {}

Some data was received from the remote end . Find the matching protocol and replay it .


def Func ( arg_0 ) : arg_0 . f = _rsky . _getf ( arg_0 . t_supersample , arg_0 . t0 , arg_0 . per , arg_0 . a , arg_0 . inc * pi / 180. , arg_0 . ecc , arg_0 . w * pi / 180. , arg_0 . transittype , arg_0 . nthreads ) return arg_0 . f

def Func(arg_0):
		"""
		Return the true anomaly at each time
		"""
		arg_0.f = _rsky._getf(arg_0.t_supersample, arg_0.t0, arg_0.per, arg_0.a,
							  arg_0.inc*pi/180., arg_0.ecc, arg_0.w*pi/180.,
							  arg_0.transittype, arg_0.nthreads)
		return arg_0.f


def Func(arg_0):
        """
        Seek previous line relative to the current file position.

        :return: Position of the line or -1 if previous line was not found.
        """
        arg_1 = arg_0.file.tell()
        arg_2 = 0

        while True:
            if arg_2 == arg_1:
                break

            arg_3 = arg_0.read_size if arg_0.read_size <= arg_1 else arg_1
            arg_0.file.seek(arg_1 - arg_2 - arg_3, SEEK_SET)
            arg_4, arg_5 = arg_0.read(arg_3)

            # Consider the following example: Foo\r | \nBar where " | " denotes current position,
            # '\nBar' is the read part and 'Foo\r' is the remaining part.
            # We should completely consume terminator "\r\n" by reading one extra byte.
            if b'\r\n' in arg_0.LINE_TERMINATORS and arg_5[0] == b'\n'[0]:
                arg_6 = arg_0.file.tell()
                if arg_6 > arg_4 + 1:
                    arg_0.file.seek(arg_1 - arg_2 - arg_4 - 1, SEEK_SET)
                    arg_7, arg_8 = arg_0.read(1)

                    if arg_8[0] == b'\r'[0]:
                        arg_4 += 1
                        arg_5 = b'\r' + arg_5

                    arg_0.file.seek(arg_6)

            arg_9 = arg_4

            while arg_9 > 0:
                arg_10 = arg_0.suffix_line_terminator(arg_5[:arg_9])
                if arg_10 and arg_2 == 0 and arg_9 == arg_4:
                    # The last character is a line terminator that finishes current line. Ignore it.
                    arg_9 -= len(arg_10)
                elif arg_10:
                    arg_0.file.seek(arg_1 - arg_2 - (arg_4 - arg_9))
                    return arg_0.file.tell()
                else:
                    arg_9 -= 1

            arg_2 += arg_4

        if arg_1 == 0:
            # Nothing more to read.
            return -1
        else:
            # Very first line.
            arg_0.file.seek(0)
            return 0

Seek previous line relative to the current file position .


return self._redirect(request, super(TreeItemAdmin, self).response_change(request, obj))

def Func ( arg_0 , arg_1 , arg_2 , ** arg_3 ) : return arg_0 . _redirect ( arg_1 , super ( TreeItemAdmin , arg_0 ) . Func ( arg_1 , arg_2 ) )

def Func(arg_0, arg_1, arg_2, **arg_3):
        """Redirects to the appropriate items' 'add' page on item change.

        As we administer tree items within tree itself, we
        should make some changes to redirection process.

        """
        return arg_0._redirect(arg_1, super(TreeItemAdmin, arg_0).Func(arg_1, arg_2))

Redirects to the appropriate items add page on item change .


def Func ( arg_0 = None , arg_1 = None ) : from imgaug . augmentables . polys import Polygon , PolygonsOnImage arg_2 , arg_3 = 0 , 0 if arg_1 is not None : arg_4 = _quokka_normalize_extract ( arg_1 ) arg_2 = arg_4 . x1 arg_3 = arg_4 . y1 with open ( QUOKKA_ANNOTATIONS_FP , "r" ) as f : arg_5 = json . load ( f ) arg_6 = [ ] for arg_7 in arg_5 [ "polygons" ] : arg_6 . append ( Polygon ( [ ( arg_8 [ "x" ] - arg_2 , arg_8 [ "y" ] - arg_3 ) for arg_8 in arg_7 [ "keypoints" ] ] ) ) if arg_1 is not None : arg_9 = ( arg_4 . height , arg_4 . width , 3 ) else : arg_9 = ( 643 , 960 , 3 ) arg_10 = PolygonsOnImage ( arg_6 , arg_9 = arg_9 ) if arg_0 is not None : arg_11 = _compute_resized_shape ( arg_9 , arg_0 ) arg_10 = arg_10 . on ( arg_11 ) return arg_10

def Func(arg_0=None, arg_1=None):
    """
    Returns example polygons on the standard example quokke image.

    The result contains one polygon, covering the quokka's outline.

    Parameters
    ----------
    size : None or float or tuple of int or tuple of float, optional
        Size of the output image on which the polygons are placed. If None,
        then the polygons are not projected to any new size (positions on the
        original image are used). Floats lead to relative size changes, ints
        to absolute sizes in pixels.

    extract : None or 'square' or tuple of number or imgaug.BoundingBox or \
              imgaug.BoundingBoxesOnImage
        Subarea to extract from the image. See :func:`imgaug.quokka`.

    Returns
    -------
    psoi : imgaug.PolygonsOnImage
        Example polygons on the quokka image.

    """
    # TODO get rid of this deferred import
    from imgaug.augmentables.polys import Polygon, PolygonsOnImage

    arg_2, arg_3 = 0, 0
    if arg_1 is not None:
        arg_4 = _quokka_normalize_extract(arg_1)
        arg_2 = arg_4.x1
        arg_3 = arg_4.y1
    with open(QUOKKA_ANNOTATIONS_FP, "r") as f:
        arg_5 = json.load(f)
    arg_6 = []
    for arg_7 in arg_5["polygons"]:
        arg_6.append(
            Polygon([(arg_8["x"] - arg_2, arg_8["y"] - arg_3)
                    for arg_8 in arg_7["keypoints"]])
        )
    if arg_1 is not None:
        arg_9 = (arg_4.height, arg_4.width, 3)
    else:
        arg_9 = (643, 960, 3)
    arg_10 = PolygonsOnImage(arg_6, arg_9=arg_9)
    if arg_0 is not None:
        arg_11 = _compute_resized_shape(arg_9, arg_0)
        arg_10 = arg_10.on(arg_11)
    return arg_10

Returns example polygons on the standard example quokke image .


def Func ( arg_0 , arg_1 ) : arg_2 = BB_SQUARES [ arg_1 ] arg_3 = int ( bool ( arg_0 . occupied [ WHITE ] & arg_2 ) ) arg_4 = arg_0 . piece_type_at ( arg_1 ) if arg_4 : return Piece ( arg_4 , arg_3 )

def Func(arg_0, arg_1):
        '''Gets the piece at the given square.'''
        arg_2 = BB_SQUARES[arg_1]
        arg_3 = int(bool(arg_0.occupied[WHITE] & arg_2))

        arg_4 = arg_0.piece_type_at(arg_1)
        if arg_4:
            return Piece(arg_4, arg_3)


def Func ( arg_0 , arg_1 ) : try : arg_1 [ arg_2 ( arg_1 ) ] . append ( arg_0 ) except KeyError : arg_1 [ arg_2 ( arg_1 ) ] = [ arg_0 ]

def Func(arg_0, arg_1):
    """Keeps a reference to the object x in the memo.

    Because we remember objects by their id, we have
    to assure that possibly temporary objects are kept
    alive by referencing them.
    We store a reference at the id of the memo, which should
    normally not be used unless someone tries to deepcopy
    the memo itself...
    """
    try:
        arg_1[arg_2(arg_1)].append(arg_0)
    except KeyError:
        # aha, this is the first one :-)
        arg_1[arg_2(arg_1)]=[arg_0]

Keeps a reference to the object x in the memo .


def Func(arg_0=None, arg_1=True):
    '''Generate a Func with a given prefix

    linux/osx: [prefix] user@host cwd $
          win: [prefix] cwd:
    '''

    if platform == 'win':
        return '[{0}] $P$G'.format(arg_0)
    else:
        if arg_1:
            return (
                '[{0}] '  # White prefix
                '\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\] '  # Green user@host
                '\\[\\033[01;34m\\]\\w $ \\[\\033[00m\\]'  # Blue cwd $
            ).format(arg_0)
        return '[{0}] \\u@\\h \\w $ '.format(arg_0)

Generate a prompt with a given prefix

    linux/osx: [prefix] user@host cwd $
          win: [prefix] cwd:


return self._json_request('delete', url, params=params)

def Func ( arg_0 , arg_1 = '' , ** arg_2 ) : arg_2 = jsonify_parameters ( arg_2 ) arg_3 = ensure_trailing_slash ( arg_0 . url + arg_1 . lstrip ( '/' ) ) return arg_0 . _json_request ( 'Func' , arg_3 , arg_2 = arg_2 )

def Func(arg_0, arg_1='', **arg_2):
        """
        Make a DELETE request to the given path, and return the JSON-decoded
        result.

        Keyword parameters will be converted to URL parameters.

        DELETE requests ask to Func the object represented by this URL.
        """
        arg_2 = jsonify_parameters(arg_2)
        arg_3 = ensure_trailing_slash(arg_0.url + arg_1.lstrip('/'))
        return arg_0._json_request('Func', arg_3, arg_2=arg_2)

Make a DELETE request to the given path, and return the JSON-decoded
        result.

        Keyword parameters will be converted to URL parameters.

        DELETE requests ask to delete the object represented by this URL.

Make a DELETE request to the given path and return the JSON - decoded result .


def Func(arg_0):
    """A decorator to declare that only the first N arguments my be Func.

    This decorator makes it easy to support Python 3 style keyword-only
    parameters. For example, in Python 3 it is possible to write::

        def fn(pos1, *, kwonly1=None, kwonly1=None):
            ...

    All named parameters after ``*`` must be a keyword::

        fn(10, 'kw1', 'kw2')  # Raises exception.
        fn(10, kwonly1='kw1')  # Ok.

    Example
    ^^^^^^^

    To define a function like above, do::

        @Func(1)
        def fn(pos1, kwonly1=None, kwonly2=None):
            ...

    If no default value is provided to a keyword argument, it becomes a
    required keyword argument::

        @Func(0)
        def fn(required_kw):
            ...

    This must be called with the keyword parameter::

        fn()  # Raises exception.
        fn(10)  # Raises exception.
        fn(required_kw=10)  # Ok.

    When defining instance or class methods always remember to account for
    ``self`` and ``cls``::

        class MyClass(object):

            @Func(2)
            def my_method(self, pos1, kwonly1=None):
                ...

            @classmethod
            @Func(2)
            def my_method(cls, pos1, kwonly1=None):
                ...

    The Func decorator behavior is controlled by
    ``_helpers.Func_parameters_enforcement``, which may be set to
    ``POSITIONAL_EXCEPTION``, ``POSITIONAL_WARNING`` or
    ``POSITIONAL_IGNORE`` to raise an exception, log a warning, or do
    nothing, respectively, if a declaration is violated.

    Args:
        max_Func_arguments: Maximum number of Func arguments. All
                                  parameters after the this index must be
                                  keyword only.

    Returns:
        A decorator that prevents using arguments after max_Func_args
        from being used as Func parameters.

    Raises:
        TypeError: if a key-word only argument is provided as a Func
                   parameter, but only if
                   _helpers.Func_parameters_enforcement is set to
                   POSITIONAL_EXCEPTION.
    """

    def Func_decorator(arg_1):
        @functools.wraps(arg_1)
        def Func_wrapper(*arg_2, **arg_3):
            if len(arg_2) > arg_0:
                arg_4 = ''
                if arg_0 != 1:
                    arg_4 = 's'
                arg_5 = ('{function}() takes at most {args_max} Func '
                           'argument{plural} ({args_given} given)'.format(
                               function=arg_1.__name__,
                               args_max=arg_0,
                               args_given=len(arg_2),
                               plural=arg_4))
                if Func_parameters_enforcement == POSITIONAL_EXCEPTION:
                    raise TypeError(arg_5)
                elif Func_parameters_enforcement == POSITIONAL_WARNING:
                    logger.warning(arg_5)
            return arg_1(*arg_2, **arg_3)
        return Func_wrapper

    if isinstance(arg_0, six.integer_types):
        return Func_decorator
    else:
        arg_2, arg_6, arg_6, arg_7 = inspect.getargspec(arg_0)
        return Func(len(arg_2) - len(arg_7))(arg_0)

A decorator to declare that only the first N arguments my be positional.

    This decorator makes it easy to support Python 3 style keyword-only
    parameters. For example, in Python 3 it is possible to write::

        def fn(pos1, *, kwonly1=None, kwonly1=None):
            ...

    All named parameters after ``*`` must be a keyword::

        fn(10, 'kw1', 'kw2')  # Raises exception.
        fn(10, kwonly1='kw1')  # Ok.

    Example
    ^^^^^^^

    To define a function like above, do::

        @positional(1)
        def fn(pos1, kwonly1=None, kwonly2=None):
            ...

    If no default value is provided to a keyword argument, it becomes a
    required keyword argument::

        @positional(0)
        def fn(required_kw):
            ...

    This must be called with the keyword parameter::

        fn()  # Raises exception.
        fn(10)  # Raises exception.
        fn(required_kw=10)  # Ok.

    When defining instance or class methods always remember to account for
    ``self`` and ``cls``::

        class MyClass(object):

            @positional(2)
            def my_method(self, pos1, kwonly1=None):
                ...

            @classmethod
            @positional(2)
            def my_method(cls, pos1, kwonly1=None):
                ...

    The positional decorator behavior is controlled by
    ``_helpers.positional_parameters_enforcement``, which may be set to
    ``POSITIONAL_EXCEPTION``, ``POSITIONAL_WARNING`` or
    ``POSITIONAL_IGNORE`` to raise an exception, log a warning, or do
    nothing, respectively, if a declaration is violated.

    Args:
        max_positional_arguments: Maximum number of positional arguments. All
                                  parameters after the this index must be
                                  keyword only.

    Returns:
        A decorator that prevents using arguments after max_positional_args
        from being used as positional parameters.

    Raises:
        TypeError: if a key-word only argument is provided as a positional
                   parameter, but only if
                   _helpers.positional_parameters_enforcement is set to
                   POSITIONAL_EXCEPTION.

A decorator to declare that only the first N arguments my be positional .


def Func ( arg_0 = None ) : import matplotlib if arg_0 and arg_0 != 'auto' : arg_1 = backends [ arg_0 ] else : arg_1 = matplotlib . rcParams [ 'backend' ] arg_0 = backend2gui . get ( arg_1 , None ) return arg_0 , arg_1

def Func(arg_0=None):
    """Given a gui string return the gui and mpl backend.

    Parameters
    ----------
    gui : str
        Can be one of ('tk','gtk','wx','qt','qt4','inline').

    Returns
    -------
    A tuple of (gui, backend) where backend is one of ('TkAgg','GTKAgg',
    'WXAgg','Qt4Agg','module://IPython.zmq.pylab.backend_inline').
    """

    import matplotlib

    if arg_0 and arg_0 != 'auto':
        # select backend based on requested gui
        arg_1 = backends[arg_0]
    else:
        arg_1 = matplotlib.rcParams['backend']
        # In this case, we need to find what the appropriate gui selection call
        # should be for IPython, so we can activate inputhook accordingly
        arg_0 = backend2gui.get(arg_1, None)
    return arg_0, arg_1

Given a gui string return the gui and mpl backend .


def Func ( arg_0 , arg_1 , arg_2 = True ) : del ( arg_0 . tiers [ arg_1 ] ) if arg_2 : arg_0 . clean_time_slots ( )

def Func(arg_0, arg_1, arg_2=True):
        """Remove a tier.

        :param str id_tier: Name of the tier.
        :param bool clean: Flag to also clean the timeslots.
        :raises KeyError: If tier is non existent.
        """
        del(arg_0.tiers[arg_1])
        if arg_2:
            arg_0.clean_time_slots()


def
Func
(
)
:
print
"We got a call Func notification\n"
if
request
.
method
==
'POST'
:
print
request
.
form
else
:
print
request
.
args
return
"OK"

def Func():
    """Call Heartbeat URL"""
    print "We got a call Func notification\n"

    if request.method == 'POST':
        print request.form
    else:
        print request.args

    return "OK"


def Func ( arg_0 ) : with _AST_CACHE_LOCK : if arg_0 not in arg_2 : arg_1 = read_file ( arg_0 ) arg_2 [ arg_0 ] = ast . parse ( arg_1 , filename = arg_0 ) return arg_2 [ arg_0 ]

def Func(arg_0):
    """
    Retrieves the AST of the specified file.

    This function performs simple caching so that the same file isn't read or
    parsed more than once per process.

    :param filepath: the file to parse
    :type filepath: str
    :returns: ast.AST
    """

    with _AST_CACHE_LOCK:
        if arg_0 not in arg_2:
            arg_1 = read_file(arg_0)
            arg_2[arg_0] = ast.parse(arg_1, filename=arg_0)
    return arg_2[arg_0]

Retrieves the AST of the specified file .


def Func ( ) : import os import ctypes try : return os . geteuid ( ) == 0 except AttributeError : return ctypes . windll . shell32 . IsUserAnAdmin ( ) != 0 return False

def Func():
    """Checks if the user is rooted."""
    import os
    import ctypes
    try:
        return os.geteuid() == 0
    except AttributeError:
        return ctypes.windll.shell32.IsUserAnAdmin() != 0
    return False


def Func(arg_0, arg_1):
        """Gets the filesize of a remote file """
        try:
            arg_2 = urllib.request.urlopen(arg_1)
            return int(arg_2.getheader('Content-Length').strip())
        except urllib.error.HTTPError as error:
            logger.error('Error retrieving size of the remote file %s' % error)
            print('Error retrieving size of the remote file %s' % error)
            arg_0.connect_earthexplorer()
            arg_0.Func(arg_1)


(
        self,
        value: str,
        type_: typing.Type[typing.Any] = str,
        subtype: typing.Type[typing.Any] = str,
    )

def
Func
(
arg_0
,
arg_1
:
arg_2
,
arg_3
:
arg_4
.
Type
[
arg_4
.
Any
]
=
arg_2
,
arg_7
:
arg_4
.
Type
[
arg_4
.
Any
]
=
arg_2
,
)
->
arg_4
.
Any
:
if
arg_3
is
bool
:
return
arg_3
(
arg_1
.
lower
(
)
in
arg_0
.
TRUE_STRINGS
)
try
:
if
isinstance
(
arg_3
,
type
)
and
issubclass
(
arg_3
,
(
list
,
tuple
,
set
,
frozenset
)
)
:
return
arg_3
(
arg_0
.
Func
(
arg_8
.
strip
(
" "
)
,
arg_7
)
for
arg_8
in
arg_1
.
split
(
","
)
if
arg_1
.
strip
(
" "
)
)
return
arg_3
(
arg_1
)
except
ValueError
as
e
:
raise
ConfigError
(
*
e
.
args
)

def Func(
        arg_0,
        arg_1: arg_2,
        arg_3: arg_4.Type[arg_4.Any] = arg_2,
        arg_7: arg_4.Type[arg_4.Any] = arg_2,
    ) -> arg_4.Any:
        """
        Parse value from string.

        Convert :code:`value` to

        .. code-block:: python

           >>> Funcr = Config()
           >>> Funcr.Func('12345', type_=int)
           <<< 12345
           >>>
           >>> Funcr.Func('1,2,3,4', type_=list, subtype=int)
           <<< [1, 2, 3, 4]

        :param value: string
        :param type\\_: the type to return
        :param subtype: subtype for iterator types
        :return: the Funcd config value

        """
        if arg_3 is bool:
            return arg_3(arg_1.lower() in arg_0.TRUE_STRINGS)

        try:
            if isinstance(arg_3, type) and issubclass(
                arg_3, (list, tuple, set, frozenset)
            ):
                return arg_3(
                    arg_0.Func(arg_8.strip(" "), arg_7)
                    for arg_8 in arg_1.split(",")
                    if arg_1.strip(" ")
                )

            return arg_3(arg_1)
        except ValueError as e:
            raise ConfigError(*e.args)

Parse value from string.

        Convert :code:`value` to

        .. code-block:: python

           >>> parser = Config()
           >>> parser.parse('12345', type_=int)
           <<< 12345
           >>>
           >>> parser.parse('1,2,3,4', type_=list, subtype=int)
           <<< [1, 2, 3, 4]

        :param value: string
        :param type\\_: the type to return
        :param subtype: subtype for iterator types
        :return: the parsed config value


def Func ( ) : arg_0 = subprocess . Popen ( [ 'sysctl' , '-n' , 'hw.ncpu' ] , stdout = subprocess . PIPE ) return arg_0 . stdout . read ( )

def Func():
    """Return the number of active CPUs on a Darwin system."""
    arg_0 = subprocess.Popen(['sysctl','-n','hw.ncpu'],stdout=subprocess.PIPE)
    return arg_0.stdout.read()

Return the number of active CPUs on a Darwin system .


Wrap a generator function in a decorator to supply line and column
    information to the returned Python AST node. Dependency nodes will not
    be hydrated, functions whose returns need dependency nodes to be
    hydrated should use `_with_ast_loc_deps` below.

def Func(arg_0):
    """Wrap a generator function in a decorator to supply line and column
    information to the returned Python AST node. Dependency nodes will not
    be hydrated, functions whose returns need dependency nodes to be
    hydrated should use `Func_deps` below."""

    @wraps(arg_0)
    def with_lineno_and_col(
        arg_1: arg_2, arg_3: arg_4, *arg_5, **arg_6
    ) -> GeneratedPyAST:
        arg_7 = arg_0(arg_1, arg_3, *arg_5, **arg_6)
        return _ast_with_loc(arg_7, arg_3.env)

    return with_lineno_and_col

Wrap a generator function in a decorator to supply line and column information to the returned Python AST node . Dependency nodes will not be hydrated functions whose returns need dependency nodes to be hydrated should use _with_ast_loc_deps below .


def Func ( arg_0 ) : arg_1 = open ( arg_0 ) arg_2 = json . load ( arg_1 ) [ "bounds" ] arg_3 = [ ] for arg_4 in arg_2 : arg_3 . append ( arg_4 [ "start" ] ) arg_1 . close ( ) return np . asarray ( arg_3 )

def Func(arg_0):
    """Extracts the boundaries from a bounds json file and puts them into
        an np array."""
    arg_1 = open(arg_0)
    arg_2 = json.load(arg_1)["bounds"]
    arg_3 = []
    for arg_4 in arg_2:
        arg_3.append(arg_4["start"])
    arg_1.close()
    return np.asarray(arg_3)

Extracts the boundaries from a bounds json file and puts them into an np array .


def Func ( ) : arg_0 = system ( ) . lower ( ) arg_1 = 'unknown' if 'cygwin' in arg_0 : arg_1 = 'cygwin' elif 'darwin' in arg_0 : arg_1 = 'mac' elif 'linux' in arg_0 : arg_1 = 'linux' try : with open ( '/proc/version' , 'r' ) as f : if 'microsoft' in f . read ( ) . lower ( ) : arg_1 = 'wsl' except : pass elif 'windows' in arg_0 : arg_1 = 'windows' elif 'bsd' in arg_0 : arg_1 = 'bsd' return arg_1

def Func():
    """Detect operating system.
    """

    # Inspired by:
    # https://github.com/scivision/pybashutils/blob/78b7f2b339cb03b1c37df94015098bbe462f8526/pybashutils/windows_linux_detect.py

    arg_0 = system().lower()
    arg_1 = 'unknown'

    if 'cygwin' in arg_0:
        arg_1 = 'cygwin'
    elif 'darwin' in arg_0:
        arg_1 = 'mac'
    elif 'linux' in arg_0:
        arg_1 = 'linux'
        # detect WSL https://github.com/Microsoft/BashOnWindows/issues/423
        try:
            with open('/proc/version', 'r') as f:
                if 'microsoft' in f.read().lower():
                    arg_1 = 'wsl'
        except: pass
    elif 'windows' in arg_0:
        arg_1 = 'windows'
    elif 'bsd' in arg_0:
        arg_1 = 'bsd'

    return arg_1


def Func ( arg_0 , arg_1 ) : arg_2 = one ( arg_1 ) . O_BATTR [ 107 ] . O_ATTR [ 106 ] ( ) arg_3 = one ( arg_2 ) . O_OBJ [ 102 ] ( ) arg_4 = arg_1 . Action_Semantics_internal arg_5 = '%s::%s' % ( arg_3 . Name , arg_2 . Name ) arg_6 = functools . partial ( interpret . run_derived_attribute , arg_0 , arg_5 , arg_4 , arg_2 . Name ) return property ( arg_6 )

def Func(arg_0, arg_1):
    '''
    Create a python property that interprets that action of a BridgePoint derived
    attribute.
    '''
    arg_2 = one(arg_1).O_BATTR[107].O_ATTR[106]()
    arg_3 = one(arg_2).O_OBJ[102]()
    arg_4 = arg_1.Action_Semantics_internal
    arg_5 = '%s::%s' % (arg_3.Name, arg_2.Name)
    arg_6 = functools.partial(interpret.run_derived_attribute, arg_0,
                             arg_5, arg_4, arg_2.Name)
    return property(arg_6)

Create a python property that interprets that action of a BridgePoint derived attribute .


def Func():
    """Scan for devices and print results."""

    arg_0 = argparser().parse_args(sys.argv[1:])
    arg_1 = os.environ.get('PYNETGEAR_PASSWORD') or arg_0.password

    arg_2 = Netgear(arg_1, arg_0.host, arg_0.user, arg_0.port, arg_0.ssl, arg_0.url, arg_0.force_login_v2)

    arg_3 = run_subcommand(arg_2, arg_0)
    arg_4 = make_formatter(arg_0.format)

    if arg_3 is None:
        print("Error communicating with the Netgear router")

    else:
        arg_4(arg_3)


def Func(arg_0, arg_1, arg_2):
        """
        Serializes a list, where the values are objects of type
        str, Attrib, or PathAttrib.

        Example::

            <value>text</value>
            <value><attribute>foobar</attribute></value>
            <value><path>foobar</path></value>
        """
        for arg_3 in arg_2:
            arg_4 = SubElement(arg_1, 'value')
            arg_0.serialize_value(arg_4, arg_3)
        return arg_1

Serializes a list where the values are objects of type str Attrib or PathAttrib .


def
Func
(
arg_0
,
arg_1
)
:
if
not
isinstance
(
arg_1
,
ClassicalRegister
)
:
raise
DAGCircuitError
(
"not a ClassicalRegister instance."
)
if
arg_1
.
name
in
arg_0
.
cregs
:
raise
DAGCircuitError
(
"duplicate register %s"
%
arg_1
.
name
)
arg_0
.
cregs
[
arg_1
.
name
]
=
arg_1
for
arg_4
in
range
(
arg_1
.
size
)
:
arg_0
.
_add_wire
(
(
arg_1
,
arg_4
)
)

def Func(arg_0, arg_1):
        """Add all wires in a classical register."""
        if not isinstance(arg_1, ClassicalRegister):
            raise DAGCircuitError("not a ClassicalRegister instance.")
        if arg_1.name in arg_0.cregs:
            raise DAGCircuitError("duplicate register %s" % arg_1.name)
        arg_0.cregs[arg_1.name] = arg_1
        for arg_4 in range(arg_1.size):
            arg_0._add_wire((arg_1, arg_4))


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
is
:
raise
AirflowBadRequest
(
"Database name cannot be None."
)
arg_2
=
list
(
arg_0
.
get_conn
(
)
.
QueryDatabases
(
{
"query"
:
"SELECT * FROM r WHERE r.id=@id"
,
"parameters"
:
[
{
"name"
:
"@id"
,
"value"
:
arg_1
}
]
}
)
)
if
len
(
arg_2
)
==
0
:
arg_0
.
get_conn
(
)
.
CreateDatabase
(
{
"id"
:
arg_1
}
)

def Func(arg_0, arg_1):
        """
        Creates a new database in CosmosDB.
        """
        if arg_1 is None:
            raise AirflowBadRequest("Database name cannot be None.")

        # We need to check to see if this database already exists so we don't try
        # to create it twice
        arg_2 = list(arg_0.get_conn().QueryDatabases({
            "query": "SELECT * FROM r WHERE r.id=@id",
            "parameters": [
                {"name": "@id", "value": arg_1}
            ]
        }))

        # Only create if we did not find it already existing
        if len(arg_2) == 0:
            arg_0.get_conn().CreateDatabase({"id": arg_1})


def Func ( arg_0 , arg_1 ) : if not arg_0 : arg_0 = arg_1 . default_val arg_0 = arg_0 . upper ( ) return logging . _checkLevel ( arg_0 )

def Func(arg_0, arg_1):
    """
    Convert an evar value into a Python logging level constant.

    :param str config_val: The env var value.
    :param EnvironmentVariable evar: The EVar object we are validating
        a value for.
    :return: A validated string.
    :raises: ValueError if the log level is invalid.
    """
    if not arg_0:
        arg_0 = arg_1.default_val
    arg_0 = arg_0.upper()
    # noinspection PyProtectedMember
    return logging._checkLevel(arg_0)

Convert an evar value into a Python logging level constant .


def Func ( arg_0 , arg_1 ) : for arg_2 , arg_3 in arg_0 . s3handler ( ) . size ( arg_1 [ 1 : ] ) : message ( '%s\t%s' % ( arg_3 , arg_2 ) )

def Func(arg_0, arg_1):
    '''Handler for size command'''
    for arg_2, arg_3 in arg_0.s3handler().size(arg_1[1:]):
      message('%s\t%s' % (arg_3, arg_2))


(model, reaction, flux_coefficient_cutoff=0.001, solver=None)

def Func(arg_0, arg_1, arg_2=0.001, arg_3=None):
    """Assesses production capacity.

    Assesses the capacity of the model to produce the precursors for the
    reaction and absorb the production of the reaction while the reaction is
    operating at, or above, the specified cutoff.

    Parameters
    ----------
    model : cobra.Model
        The cobra model to Func production capacity for

    reaction : reaction identifier or cobra.Reaction
        The reaction to Func

    flux_coefficient_cutoff :  float
        The minimum flux that reaction must carry to be considered active.

    solver : basestring
        Solver name. If None, the default solver will be used.

    Returns
    -------
    bool or dict
        True if the model can produce the precursors and absorb the products
        for the reaction operating at, or above, flux_coefficient_cutoff.
        Otherwise, a dictionary of {'precursor': Status, 'product': Status}.
        Where Status is the results from Func_precursors and
        Func_products, respectively.

    """
    arg_1 = arg_0.reactions.get_by_any(arg_1)[0]
    with arg_0 as arg_4:
        arg_4.objective = arg_1
        if _optimize_or_value(arg_4, arg_3=arg_3) >= arg_2:
            return True
        else:
            arg_6 = dict()
            arg_6['precursors'] = Func_component(
                arg_0, arg_1, 'reactants', arg_2)
            arg_6['products'] = Func_component(
                arg_0, arg_1, 'products', arg_2)
            return arg_6

Assesses production capacity.

    Assesses the capacity of the model to produce the precursors for the
    reaction and absorb the production of the reaction while the reaction is
    operating at, or above, the specified cutoff.

    Parameters
    ----------
    model : cobra.Model
        The cobra model to assess production capacity for

    reaction : reaction identifier or cobra.Reaction
        The reaction to assess

    flux_coefficient_cutoff :  float
        The minimum flux that reaction must carry to be considered active.

    solver : basestring
        Solver name. If None, the default solver will be used.

    Returns
    -------
    bool or dict
        True if the model can produce the precursors and absorb the products
        for the reaction operating at, or above, flux_coefficient_cutoff.
        Otherwise, a dictionary of {'precursor': Status, 'product': Status}.
        Where Status is the results from assess_precursors and
        assess_products, respectively.


return amount * (unit_factor_from / unit_factor_to)

def
Func
(
arg_0
,
arg_1
=
'i'
)
:
try
:
arg_2
=
arg_0
.
split
(
)
arg_3
=
float
(
arg_2
[
0
]
)
except
(
ValueError
,
IndexError
,
AttributeError
)
:
raise
with_context
(
ValueError
(
'Value to convert is not valid.'
)
,
context
=
{
'value'
:
arg_0
,
}
,
)
try
:
arg_4
=
arg_2
[
1
]
arg_5
=
float
(
STANDARD_UNITS
[
arg_4
]
)
arg_6
=
float
(
STANDARD_UNITS
[
arg_1
]
)
except
(
KeyError
,
IndexError
)
:
raise
with_context
(
ValueError
(
'Invalid IOTA unit.'
)
,
context
=
{
'value'
:
arg_0
,
'symbol'
:
arg_1
,
}
,
)
return
arg_3
*
(
arg_5
/
arg_6
)

def Func(arg_0, arg_1='i'):
    # type: (Text, Text) -> float
    """
    Converts between any two standard units of iota.

    :param value:
        Value (affixed) to convert. For example: '1.618 Mi'.

    :param symbol:
        Unit symbol of iota to convert to. For example: 'Gi'.

    :return:
        Float as units of given symbol to convert to.
    """
    try:
        # Get input value
        arg_2 = arg_0.split()
        arg_3 = float(arg_2[0])
    except (ValueError, IndexError, AttributeError):
        raise with_context(
            ValueError('Value to convert is not valid.'),

            context={
                'value': arg_0,
            },
        )

    try:
        # Set unit symbols and find factor/multiplier.
        arg_4 = arg_2[1]
        arg_5 = float(STANDARD_UNITS[arg_4])
        arg_6 = float(STANDARD_UNITS[arg_1])
    except (KeyError, IndexError):
        # Invalid symbol or no factor
        raise with_context(
            ValueError('Invalid IOTA unit.'),

            context={
                'value': arg_0,
                'symbol': arg_1,
            },
        )

    return arg_3 * (arg_5 / arg_6)

Converts between any two standard units of iota .


def Func ( arg_0 ) : with open ( arg_0 , 'r' ) as insort : arg_1 = [ "cut" , "-f" , "2" ] arg_2 = [ "uniq" ] arg_3 = [ "wc" ] arg_4 = sps . Popen ( arg_1 , stdin = insort , stdout = sps . PIPE , close_fds = True ) arg_5 = sps . Popen ( arg_2 , stdin = arg_4 . stdout , stdout = sps . PIPE , close_fds = True ) arg_6 = sps . Popen ( arg_3 , stdin = arg_5 . stdout , stdout = sps . PIPE , close_fds = True ) arg_7 = arg_6 . communicate ( ) arg_8 = int ( arg_7 [ 0 ] . split ( ) [ 0 ] ) arg_4 . stdout . close ( ) arg_5 . stdout . close ( ) arg_6 . stdout . close ( ) return arg_8

def Func(arg_0):
    """
    uses bash commands to quickly count N seeds from utemp file
    """
    with open(arg_0, 'r') as insort:
        arg_1 = ["cut", "-f", "2"]
        arg_2 = ["uniq"]
        arg_3 = ["wc"]
        arg_4 = sps.Popen(arg_1, stdin=insort, stdout=sps.PIPE, close_fds=True)
        arg_5 = sps.Popen(arg_2, stdin=arg_4.stdout, stdout=sps.PIPE, close_fds=True)
        arg_6 = sps.Popen(arg_3, stdin=arg_5.stdout, stdout=sps.PIPE, close_fds=True)
        arg_7 = arg_6.communicate()
        arg_8 = int(arg_7[0].split()[0])
        arg_4.stdout.close()
        arg_5.stdout.close()
        arg_6.stdout.close()
    return arg_8


(self, institute_obj, case_obj, user_obj, link, variant_obj, acmg_str)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_6
)
:
arg_0
.
create_event
(
institute
=
arg_1
,
case
=
arg_2
,
user
=
arg_3
,
arg_4
=
arg_4
,
category
=
'variant'
,
verb
=
'acmg'
,
variant
=
arg_5
,
subject
=
arg_5
[
'display_name'
]
,
)
LOG
.
info
(
"Setting ACMG to {} for: {}"
.
format
(
arg_6
,
arg_5
[
'display_name'
]
)
)
if
arg_6
is
:
arg_7
=
arg_0
.
variant_collection
.
find_one_and_update
(
{
'_id'
:
arg_5
[
'_id'
]
}
,
{
'$unset'
:
{
'acmg_classification'
:
1
}
}
,
return_document
=
pymongo
.
ReturnDocument
.
AFTER
)
else
:
arg_7
=
arg_0
.
variant_collection
.
find_one_and_update
(
{
'_id'
:
arg_5
[
'_id'
]
}
,
{
'$set'
:
{
'acmg_classification'
:
REV_ACMG_MAP
[
arg_6
]
}
}
,
return_document
=
pymongo
.
ReturnDocument
.
AFTER
)
LOG
.
debug
(
"Variant updated"
)
return
arg_7

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):
        """Create an event for updating the ACMG classification of a variant.

        Arguments:
            institute_obj (dict): A Institute object
            case_obj (dict): Case object
            user_obj (dict): A User object
            link (str): The url to be used in the event
            variant_obj (dict): A variant object
            acmg_str (str): The new ACMG classification string

        Returns:
            updated_variant
        """
        arg_0.create_event(
            institute=arg_1,
            case=arg_2,
            user=arg_3,
            arg_4=arg_4,
            category='variant',
            verb='acmg',
            variant=arg_5,
            subject=arg_5['display_name'],
        )
        LOG.info("Setting ACMG to {} for: {}".format(arg_6, arg_5['display_name']))

        if arg_6 is None:
            arg_7 = arg_0.variant_collection.find_one_and_update(
                {'_id': arg_5['_id']},
                {'$unset': {'acmg_classification': 1}},
                return_document=pymongo.ReturnDocument.AFTER
            )
        else:
            arg_7 = arg_0.variant_collection.find_one_and_update(
                {'_id': arg_5['_id']},
                {'$set': {'acmg_classification': REV_ACMG_MAP[arg_6]}},
                return_document=pymongo.ReturnDocument.AFTER
            )

        LOG.debug("Variant updated")
        return arg_7

Create an event for updating the ACMG classification of a variant .


def Func ( arg_0 , arg_1 , arg_2 = 1 ) : print >> sys . stderr , arg_1 sys . exit ( arg_2 )

def Func(arg_0, arg_1, arg_2=1):
        """
        Print Func and stop command
        """
        print >>sys.stderr, arg_1
        sys.exit(arg_2)


def Func(arg_0, arg_1, arg_2=None):
        """
        Update an existing login for a user in the given account.

        https://canvas.instructure.com/doc/api/logins.html#method.pseudonyms.update
        """
        if arg_2 is None:
            arg_2 = arg_0._canvas_account_id
            if arg_2 is None:
                raise MissingAccountID

        arg_3 = arg_1.login_id
        arg_4 = ACCOUNTS_API.format(arg_2) + "/logins/{}".format(arg_3)

        arg_5 = arg_0._put_resource(arg_4, arg_1.put_data())
        return Login(arg_5=arg_5)

Update an existing login for a user in the given account .


def Func ( arg_0 , arg_1 ) : while arg_0 != arg_1 . weekday ( ) : arg_1 += timedelta ( days = 1 ) return arg_1

def Func(arg_0, arg_1):
    """
    Given a weekday and a date, will increment the date until it's
    weekday matches that of the given weekday, then that date is returned.
    """
    while arg_0 != arg_1.weekday():
        arg_1 += timedelta(days=1)
    return arg_1

Given a weekday and a date will increment the date until it s weekday matches that of the given weekday then that date is returned .


def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
token
if
len
(
arg_1
)
<
1
or
arg_1
[
0
]
not
in
_QUOTES
:
raise
arg_0
.
_ParseError
(
'Expected string but found: %r'
%
(
arg_1
,
)
)
if
len
(
arg_1
)
<
2
or
arg_1
[
1
]
!=
arg_1
[
0
]
:
raise
arg_0
.
_ParseError
(
'String missing ending quote: %r'
%
(
arg_1
,
)
)
try
:
arg_2
=
text_encoding
.
CUnescape
(
arg_1
[
1
:
1
]
)
except
ValueError
as
e
:
raise
arg_0
.
_ParseError
(
str
(
e
)
)
arg_0
.
NextToken
(
)
return
arg_2

def Func(arg_0):
    """Consume one token of a string literal.

    String literals (whether bytes or text) can come in multiple adjacent
    tokens which are automatically concatenated, like in C or Python.  This
    method only consumes one token.

    Returns:
      The token parsed.
    Raises:
      ParseError: When the wrong format data is found.
    """
    arg_1 = arg_0.token
    if len(arg_1) < 1 or arg_1[0] not in _QUOTES:
      raise arg_0._ParseError('Expected string but found: %r' % (arg_1,))

    if len(arg_1) < 2 or arg_1[-1] != arg_1[0]:
      raise arg_0._ParseError('String missing ending quote: %r' % (arg_1,))

    try:
      arg_2 = text_encoding.CUnescape(arg_1[1:-1])
    except ValueError as e:
      raise arg_0._ParseError(str(e))
    arg_0.NextToken()
    return arg_2


(self, stream, offset=0, length=float("inf"))

def Func ( arg_0 , arg_1 , arg_2 = 0 , arg_3 = arg_4 ( "inf" ) ) : arg_5 = [ ord ( arg_8 ) for arg_8 in list ( arg_1 ) ] arg_6 = min ( arg_3 , len ( arg_5 ) , arg_0 . m_size ) arg_7 = cast ( arg_0 . m_buf , POINTER ( c_uint8 ) ) for arg_8 in range ( arg_6 ) : arg_7 [ arg_2 + arg_8 ] = arg_5 [ arg_8 ]

def Func(arg_0, arg_1, arg_2=0, arg_3=arg_4("inf")):
        """Copy stream to buffer"""
        arg_5 = [ord(arg_8) for arg_8 in list(arg_1)]
        arg_6 = min(arg_3, len(arg_5), arg_0.m_size)
        arg_7 = cast(arg_0.m_buf, POINTER(c_uint8))
        for arg_8 in range(arg_6):
            arg_7[arg_2 + arg_8] = arg_5[arg_8]


def Func(arg_0, arg_1):
  """Convert possibly negatively indexed axis to non-negative list of ints.

  Args:
    axis:  Integer Tensor.
    ndims:  Number of dimensions into which axis indexes.

  Returns:
    A list of non-negative Python integers.

  Raises:
    ValueError: If `axis` is not statically defined.
  """
  arg_0 = distribution_util.make_non_negative_axis(arg_0, arg_1)

  arg_2 = tf.get_static_value(arg_0)
  if arg_2 is None:
    raise ValueError(
        'Expected argument `axis` to be statically available.  Found: %s' %
        arg_0)

  # Make at least 1-D.
  arg_0 = arg_2 + np.zeros([1], dtype=arg_2.dtype)

  return list(int(arg_3) for arg_3 in arg_0)

Convert possibly negatively indexed axis to non - negative list of ints .


def
Func
(
arg_0
)
:
arg_1
=
check_img
(
arg_0
[
0
]
)
arg_2
=
np
.
zeros_like
(
arg_1
.
get_data
(
)
)
try
:
for
arg_3
in
arg_0
:
arg_4
=
check_img
(
arg_3
)
check_img_compatibility
(
arg_1
,
arg_4
)
arg_2
+=
get_img_data
(
arg_4
)
except
Exception
as
exc
:
raise
ValueError
(
'Error joining mask {} and {}.'
.
format
(
repr_imgs
(
arg_1
)
,
repr_imgs
(
arg_3
)
)
)
from
exc
else
:
return
as_ndarray
(
arg_2
>
0
,
dtype
=
bool
)

def Func(arg_0):
    """
    Creates a binarised mask with the union of the files in filelist.

    Parameters
    ----------
    filelist: list of img-like object or boyle.nifti.NeuroImage or str
        List of paths to the volume files containing the ROIs.
        Can either be:
        - a file path to a Nifti image
        - any object with get_data() and get_affine() methods, e.g., nibabel.Nifti1Image.
        If niimg is a string, consider it as a path to Nifti image and
        call nibabel.load on it. If it is an object, check if get_data()
        and get_affine() methods are present, raise TypeError otherwise.

    Returns
    -------
    ndarray of bools
        Mask volume

    Raises
    ------
    ValueError
    """
    arg_1 = check_img(arg_0[0])
    arg_2     = np.zeros_like(arg_1.get_data())

    # create space for all features and read from subjects
    try:
        for arg_3 in arg_0:
            arg_4 = check_img(arg_3)
            check_img_compatibility(arg_1, arg_4)
            arg_2  += get_img_data(arg_4)
    except Exception as exc:
        raise ValueError('Error joining mask {} and {}.'.format(repr_imgs(arg_1), repr_imgs(arg_3))) from exc
    else:
        return as_ndarray(arg_2 > 0, dtype=bool)

Creates a binarised mask with the union of the files in filelist .


def Func ( arg_0 ) : arg_1 , arg_2 = arg_0 . rsplit ( '.' , 1 ) arg_3 = __import__ ( arg_1 , fromlist = [ arg_2 ] ) return getattr ( arg_3 , arg_2 )

def Func(arg_0):
    """
    Load a class by a fully qualified class_path,
    eg. myapp.models.ModelName
    """

    arg_1, arg_2 = arg_0.rsplit('.', 1)
    arg_3 = __import__(arg_1, fromlist=[arg_2])
    return getattr(arg_3, arg_2)

Load a class by a fully qualified class_path eg . myapp . models . ModelName


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
try
:
arg_4
=
Notification
(
arg_3
,
arg_0
.
_messageCodecs
)
except
InvalidEventException
as
e
:
arg_0
.
logger
.
critical
(
str
(
e
)
)
else
:
arg_0
.
logger
.
debug
(
"Received Notification"
)
if
arg_0
.
notificationCallback
:
arg_0
.
notificationCallback
(
arg_4
)

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Internal callback for gateway notification messages, parses source device from topic string and
        passes the information on to the registered device command callback
        """
        try:
            arg_4 = Notification(arg_3, arg_0._messageCodecs)
        except InvalidEventException as e:
            arg_0.logger.critical(str(e))
        else:
            arg_0.logger.debug("Received Notification")
            if arg_0.notificationCallback:
                arg_0.notificationCallback(arg_4)

Internal callback for gateway notification messages parses source device from topic string and passes the information on to the registered device command callback


async def Func ( arg_0 , arg_1 : arg_2 ) -> Track : arg_3 = await arg_0 . http . track ( to_id ( arg_1 ) ) return Track ( arg_0 , arg_3 )

async def Func(arg_0, arg_1: arg_2) -> Track:
        """Retrive an track with a spotify ID.

        Parameters
        ----------
        spotify_id : str
            The ID to search for.

        Returns
        -------
        track : Track
            The track from the ID
        """
        arg_3 = await arg_0.http.track(to_id(arg_1))
        return Track(arg_0, arg_3)


def Func ( arg_0 , arg_1 ) : check_rdd ( arg_1 , ( np . ndarray , sp . spmatrix ) ) if hasattr ( arg_0 , '_mllib_model' ) : if isinstance ( arg_1 , ArrayRDD ) : arg_1 = arg_1 . unblock ( ) return arg_1 . map ( lambda x : arg_0 . _mllib_model . Func ( x ) ) else : arg_2 = arg_1 . map ( lambda arg_1 : super ( SparkKMeans , arg_0 ) . Func ( arg_1 ) ) return ArrayRDD ( arg_2 )

def Func(arg_0, arg_1):
        """Predict the closest cluster each sample in X belongs to.

        In the vector quantization literature, `cluster_centers_` is called
        the code book and each value returned by `Func` is the index of
        the closest code in the code book.

        Parameters
        ----------
        X : ArrayRDD containing array-like, sparse matrix
            New data to Func.

        Returns
        -------
        labels : ArrayRDD with Funcions
            Index of the cluster each sample belongs to.

        """
        check_rdd(arg_1, (np.ndarray, sp.spmatrix))
        if hasattr(arg_0, '_mllib_model'):
            if isinstance(arg_1, ArrayRDD):
                arg_1 = arg_1.unblock()
            return arg_1.map(lambda x: arg_0._mllib_model.Func(x))
        else:
            arg_2 = arg_1.map(lambda arg_1: super(SparkKMeans, arg_0).Func(arg_1))
            return ArrayRDD(arg_2)

Predict the closest cluster each sample in X belongs to.

        In the vector quantization literature, `cluster_centers_` is called
        the code book and each value returned by `predict` is the index of
        the closest code in the code book.

        Parameters
        ----------
        X : ArrayRDD containing array-like, sparse matrix
            New data to predict.

        Returns
        -------
        labels : ArrayRDD with predictions
            Index of the cluster each sample belongs to.

Predict the closest cluster each sample in X belongs to .


(
        t, parent, remove_bold, remove_italics, meta_data)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : if arg_0 is None or arg_0 . text is None : return '' arg_5 = cgi . escape ( arg_0 . text ) arg_6 = not arg_2 and ( is_bold ( arg_1 ) or is_underlined ( arg_1 ) ) arg_7 = not arg_3 and is_italics ( arg_1 ) if arg_6 : arg_5 = '%s' % arg_5 if arg_7 : arg_5 = '%s' % arg_5 return arg_5

def Func(
        arg_0, arg_1, arg_2, arg_3, arg_4):
    """
    Generate the string data that for this particular t tag.
    """
    if arg_0 is None or arg_0.text is None:
        return ''

    # Need to escape the text so that we do not accidentally put in text
    # that is not valid XML.
    # cgi will replace things like & < > with & < >
    arg_5 = cgi.escape(arg_0.text)

    # Wrap the text with any modifiers it might have (bold, italics or
    # underline)
    arg_6 = not arg_2 and (
        is_bold(arg_1) or
        is_underlined(arg_1)
    )
    arg_7 = not arg_3 and is_italics(arg_1)
    if arg_6:
        arg_5 = '%s' % arg_5
    if arg_7:
        arg_5 = '%s' % arg_5
    return arg_5

Generate the string data that for this particular t tag .


def Func(arg_0, arg_1):  # , smooth_mm=None, remove_nans=True):
    """Read a Nifti file nii_file and a mask Nifti file.
    Extract the signals in nii_file that are within the mask, the mask indices
    and the mask shape.

    Parameters
    ----------
    image: img-like object or boyle.nifti.NeuroImage or str
        Can either be:
        - a file path to a Nifti image
        - any object with get_data() and get_affine() methods, e.g., nibabel.Nifti1Image.
        If niimg is a string, consider it as a path to Nifti image and
        call nibabel.load on it. If it is an object, check if get_data()
        and get_affine() methods are present, raise TypeError otherwise.

    mask_img: img-like object or boyle.nifti.NeuroImage or str
        3D mask array: True where a voxel should be used.
        See img description.

    smooth_mm: float #TBD
        (optional) The size in mm of the FWHM Gaussian kernel to smooth the signal.
        If True, remove_nans is True.

    remove_nans: bool #TBD
        If remove_nans is True (default), the non-finite values (NaNs and
        infs) found in the images will be replaced by zeros.

    Returns
    -------
    session_series, mask_data

    session_series: numpy.ndarray
        2D array of series with shape (voxel number, image number)

    Note
    ----
    nii_file and mask_file must have the same shape.

    Raises
    ------
    FileNotFound, NiftiFilesNotCompatible
    """
    arg_2  = check_img(arg_0)
    arg_3 = check_img(arg_1)
    check_img_compatibility(arg_2, arg_3, only_check_3d=True)

    arg_4 = get_data(arg_2)
    arg_5, arg_6 = _apply_mask_to_4d_data(arg_4, arg_3)
    return arg_5, arg_6

Read a Nifti file nii_file and a mask Nifti file . Extract the signals in nii_file that are within the mask the mask indices and the mask shape .


def Func ( arg_0 , arg_1 , * arg_2 , ** arg_3 ) : arg_4 = Task ( uuid4 ( ) . hex , arg_1 , arg_2 , arg_3 ) arg_0 . storage . put_task ( arg_4 ) return arg_0 . Func_task ( arg_4 )

def Func(arg_0, arg_1, *arg_2, **arg_3):
        """Enqueues a function for the task queue to execute."""
        arg_4 = Task(uuid4().hex, arg_1, arg_2, arg_3)
        arg_0.storage.put_task(arg_4)
        return arg_0.Func_task(arg_4)

Enqueues a function for the task queue to execute .


def Func ( arg_0 , arg_1 = arg_2 ) : return get_provider ( ) . Func ( service_uuids = arg_0 . ADVERTISED , arg_1 = arg_1 )

def Func(arg_0, arg_1=arg_2):
        """Find the first available device that supports this service and return
        it, or None if no device is found.  Will wait for up to timeout_sec
        seconds to find the device.
        """
        return get_provider().Func(service_uuids=arg_0.ADVERTISED, arg_1=arg_1)

Find the first available device that supports this service and return it or None if no device is found . Will wait for up to timeout_sec seconds to find the device .


(self, format='plain', mathjax=False,
                       smart=True, extra_args=None)

def Func(arg_0, arg_1='plain', arg_2=False,
                       arg_3=True, arg_4=None):
        """Get the document content in the specified markup format.

        Parameters
        ----------
        format : `str`, optional
            Output format (such as ``'html5'`` or ``'plain'``).
        mathjax : `bool`, optional
            Allow pandoc to use MathJax math markup.
        smart : `True`, optional
            Allow pandoc to create "smart" unicode punctuation.
        extra_args : `list`, optional
            Additional command line flags to pass to Pandoc. See
            `lsstprojectmeta.pandoc.convert.convert_text`.

        Returns
        -------
        output_text : `str`
            Converted content.
        """
        arg_5 = convert_lsstdoc_tex(
            arg_0._tex, arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4)
        return arg_5

Get the document content in the specified markup format .


def Func ( arg_0 ) : try : if not arg_0 . _last_message_id : arg_1 = arg_0 . _connection . get ( "room/%s/recent" % arg_0 . _room_id , key = "messages" , parameters = { "limit" : 1 } ) arg_0 . _last_message_id = arg_1 [ - 1 ] [ "id" ] arg_1 = arg_0 . _connection . get ( "room/%s/recent" % arg_0 . _room_id , key = "messages" , parameters = { "since_message_id" : arg_0 . _last_message_id } ) except : arg_1 = [ ] if arg_1 : arg_0 . _last_message_id = arg_1 [ - 1 ] [ "id" ] arg_0 . received ( arg_1 )

def Func(arg_0):
        """ Fetch new messages. """
        try:
            if not arg_0._last_message_id:
                arg_1 = arg_0._connection.get("room/%s/recent" % arg_0._room_id, key="messages", parameters={
                    "limit": 1
                })
                arg_0._last_message_id = arg_1[-1]["id"]

            arg_1 = arg_0._connection.get("room/%s/recent" % arg_0._room_id, key="messages", parameters={
                "since_message_id": arg_0._last_message_id
            })
        except:
            arg_1 = []

        if arg_1:
            arg_0._last_message_id = arg_1[-1]["id"]

        arg_0.received(arg_1)


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
os
.
path
.
join
(
os
.
path
.
dirname
(
arg_1
)
,
'thumb'
)
create_dirs
(
arg_2
)
arg_3
=
os
.
path
.
join
(
arg_2
,
'%s_thumb.png'
%
arg_0
.
reference
)
if
os
.
path
.
exists
(
arg_1
)
:
logger
.
info
(
'Scaling %s to thumbnail %s'
,
arg_1
,
arg_3
)
arg_0
.
scale_image
(
arg_1
,
arg_3
,
400
,
280
)
arg_0
.
thumb_file
=
arg_3

def Func(arg_0, arg_1):
        """Save the thumbnail image"""
        arg_2 = os.path.join(os.path.dirname(arg_1), 'thumb')
        create_dirs(arg_2)

        arg_3 = os.path.join(arg_2,
                                  '%s_thumb.png' % arg_0.reference)
        if os.path.exists(arg_1):
            logger.info('Scaling %s to thumbnail %s', arg_1, arg_3)
            arg_0.scale_image(arg_1, arg_3, 400, 280)
        arg_0.thumb_file = arg_3


def Func(arg_0, arg_1, arg_2):
        """Send metric and its snapshot."""
        arg_3 = SERIALIZER_CONFIG[class_name(arg_2)]

        mmap(
            arg_0._buffered_Func,
            arg_0.serialize_metric(
                arg_2,
                arg_1,
                arg_3['keys'],
                arg_3['serialized_type']
            )
        )

        if hasattr(arg_2, 'snapshot') and arg_3.get('snapshot_keys'):
            mmap(
                arg_0._buffered_Func,
                arg_0.serialize_metric(
                    arg_2.snapshot,
                    arg_1,
                    arg_3['snapshot_keys'],
                    arg_3['serialized_type']
                )
            )


def Func ( arg_0 ) : arg_1 = open ( arg_0 , "r" ) arg_2 = json . load ( arg_1 ) arg_3 = [ ] for arg_4 in arg_2 [ "beats" ] : arg_3 . append ( arg_4 [ "start" ] ) arg_1 . close ( ) return np . asarray ( arg_3 )

def Func(arg_0):
    """Extracts the beats from the beats_json_file and puts them into
        an np array."""
    arg_1 = open(arg_0, "r")
    arg_2 = json.load(arg_1)
    arg_3 = []
    for arg_4 in arg_2["beats"]:
        arg_3.append(arg_4["start"])
    arg_1.close()
    return np.asarray(arg_3)

Extracts the beats from the beats_json_file and puts them into an np array .


def Func ( arg_0 , arg_1 ) : if arg_1 not in arg_0 . _acl : return False del arg_0 . _acl [ arg_1 ] return True

def Func(arg_0, arg_1):
        """Delete an acl."""
        if arg_1 not in arg_0._acl:
            return False

        del arg_0._acl[arg_1]
        return True


(master_ip, default_parameters, memory, arguments, override_parameters)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """
    Makes a Spark Submit style job submission line.

    :param masterIP: The Spark leader IP address.
    :param default_parameters: Application specific Spark configuration parameters.
    :param memory: The memory to allocate to each Spark driver and executor.
    :param arguments: Arguments to pass to the submitted job.
    :param override_parameters: Parameters passed by the user, that override our defaults.

    :type masterIP: MasterAddress
    :type default_parameters: list of string
    :type arguments: list of string
    :type memory: int or None
    :type override_parameters: list of string or None
    """

    # python doesn't support logical xor?
    # anywho, exactly one of memory or override_parameters must be defined
    require((arg_4 is not None or arg_2 is not None) and
            (arg_4 is None or arg_2 is None),
            "Either the memory setting must be defined or you must provide Spark configuration parameters.")

    # if the user hasn't provided overrides, set our defaults
    arg_5 = []
    if arg_2 is not None:
        arg_5 = ["--master", "spark://%s:%s" % (arg_0, SPARK_MASTER_PORT),
                      "--conf", "spark.driver.memory=%sg" % arg_2,
                      "--conf", "spark.executor.memory=%sg" % arg_2,
                      "--conf", ("spark.hadoop.fs.default.name=hdfs://%s:%s" % (arg_0, HDFS_MASTER_PORT))]
    else:
        arg_5.extend(arg_4)

    # add the tool specific spark parameters
    arg_5.extend(arg_1)

    # spark submit expects a '--' to split the spark conf arguments from tool arguments
    arg_5.append('--')

    # now add the tool arguments and return
    arg_5.extend(arg_3)

    return arg_5

Makes a Spark Submit style job submission line .


(params, gparams, learning_rate = 0.01, eps= 1e-6, rho=0.95, method="ADADELTA",
                        beta=0.0, gsum_regularization = 0.0001)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
0.01
,
arg_3
=
1e-6
,
arg_4
=
0.95
,
arg_5
=
"ADADELTA"
,
arg_6
=
0.0
,
arg_7
=
0.0001
)
:
arg_8
,
arg_8
,
arg_8
,
arg_9
=
inspect
.
getargvalues
(
inspect
.
currentframe
(
)
)
logging
.
info
(
"Func: %s"
%
str
(
arg_9
.
items
(
)
)
)
arg_10
=
[
]
if
arg_5
==
"FINETUNING_ADAGRAD"
:
arg_5
=
"ADAGRAD"
arg_7
=
0
arg_11
=
1
arg_6
arg_12
=
[
theano
.
shared
(
np
.
zeros_like
(
arg_17
.
get_value
(
borrow
=
True
)
,
dtype
=
FLOATX
)
,
name
=
"gsum_%s"
%
arg_17
.
name
)
if
(
arg_5
==
'ADADELTA'
or
arg_5
==
'ADAGRAD'
)
else
for
arg_17
in
arg_0
]
arg_13
=
[
theano
.
shared
(
np
.
zeros_like
(
arg_17
.
get_value
(
borrow
=
True
)
,
dtype
=
FLOATX
)
,
name
=
"xsum_%s"
%
arg_17
.
name
)
if
arg_5
==
'ADADELTA'
else
for
arg_17
in
arg_0
]
if
arg_5
==
'ADAGRAD'
:
for
arg_14
in
arg_12
:
arg_14
.
set_value
(
arg_14
.
get_value
(
)
**
0
)
arg_15
=
OrderedDict
(
)
for
arg_16
,
arg_17
,
arg_14
,
arg_18
in
zip
(
arg_1
,
arg_0
,
arg_12
,
arg_13
)
:
if
arg_5
==
'ADADELTA'
:
arg_15
[
arg_14
]
=
arg_4
*
arg_14
+
(
1.
arg_4
)
*
(
arg_16
**
2
)
arg_19
=
T
.
sqrt
(
(
arg_18
+
arg_3
)
/
(
arg_15
[
arg_14
]
+
arg_3
)
)
*
arg_16
arg_15
[
arg_18
]
=
arg_4
*
arg_18
+
(
1.
arg_4
)
*
(
arg_19
**
2
)
arg_15
[
arg_17
]
=
arg_17
*
arg_11
+
arg_19
elif
arg_5
==
'ADAGRAD'
:
arg_15
[
arg_14
]
=
arg_14
+
(
arg_16
**
2
)
arg_7
*
arg_14
arg_15
[
arg_17
]
=
arg_17
*
arg_11
arg_2
*
(
arg_16
/
(
T
.
sqrt
(
arg_15
[
arg_14
]
+
arg_3
)
)
)
else
:
arg_15
[
arg_17
]
=
arg_17
*
arg_11
arg_16
*
arg_2
if
arg_5
==
'ADADELTA'
:
arg_10
.
extend
(
arg_12
+
arg_13
)
elif
arg_5
==
'ADAGRAD'
:
arg_10
.
extend
(
arg_12
)
for
arg_20
in
arg_15
:
if
arg_15
[
arg_20
]
.
dtype
!=
FLOATX
:
arg_15
[
arg_20
]
=
arg_15
[
arg_20
]
.
astype
(
FLOATX
)
return
arg_15
.
items
(
)
,
arg_10

def Func(arg_0, arg_1, arg_2 = 0.01, arg_3= 1e-6, arg_4=0.95, arg_5="ADADELTA",
                        arg_6=0.0, arg_7 = 0.0001):
    """
    Optimize by SGD, AdaGrad, or AdaDelta.
    """

    arg_8, arg_8, arg_8, arg_9 = inspect.getargvalues(inspect.currentframe())
    logging.info("Func: %s" % str(arg_9.items()))
    arg_10 = []

    if arg_5 == "FINETUNING_ADAGRAD":
        arg_5 = "ADAGRAD"
        arg_7 = 0

    arg_11 = 1 - arg_6

    arg_12   = [theano.shared(np.zeros_like(arg_17.get_value(borrow=True), dtype=FLOATX), name="gsum_%s" % arg_17.name) if (arg_5 == 'ADADELTA' or arg_5 == 'ADAGRAD') else None for arg_17 in arg_0]
    arg_13   = [theano.shared(np.zeros_like(arg_17.get_value(borrow=True), dtype=FLOATX), name="xsum_%s" % arg_17.name) if arg_5 == 'ADADELTA' else None for arg_17 in arg_0]

    # Fix for AdaGrad, init gsum to 1
    if arg_5 == 'ADAGRAD':
        for arg_14 in arg_12:
            arg_14.set_value(arg_14.get_value() ** 0)

    arg_15 = OrderedDict()
    # Updates
    for arg_16, arg_17, arg_14, arg_18 in zip(arg_1, arg_0, arg_12, arg_13):

        if arg_5 == 'ADADELTA':
            arg_15[arg_14] = arg_4 * arg_14 + (1. - arg_4) * (arg_16 **2)
            arg_19 = -T.sqrt((arg_18 + arg_3) / (arg_15[arg_14] + arg_3)) * arg_16
            arg_15[arg_18] =arg_4 * arg_18 + (1. - arg_4) * (arg_19 **2)
            arg_15[arg_17] = arg_17 * arg_11 + arg_19
        elif arg_5 == 'ADAGRAD':
            arg_15[arg_14] = arg_14 + (arg_16 **2) - arg_7 * arg_14
            arg_15[arg_17] =  arg_17 * arg_11 - arg_2 * (arg_16 / (T.sqrt(arg_15[arg_14] + arg_3)))

        else:
            arg_15[arg_17] = arg_17 * arg_11 - arg_16 * arg_2
    # Add free parameters
    if arg_5 == 'ADADELTA':
        arg_10.extend(arg_12 + arg_13)
    elif arg_5 == 'ADAGRAD':
        arg_10.extend(arg_12)
    # Check dtype
    for arg_20 in arg_15:
        if arg_15[arg_20].dtype != FLOATX:
            arg_15[arg_20] = arg_15[arg_20].astype(FLOATX)
    return arg_15.items(), arg_10


def Func(arg_0):
    """Load credentials from the given file handle.

    The file is expected to be in this format:

        {
            "file_version": 2,
            "credentials": {
                "key": "base64 encoded json representation of credentials."
            }
        }

    This function will warn and return empty credentials instead of raising
    exceptions.

    Args:
        credentials_file: An open file handle.

    Returns:
        A dictionary mapping user-defined keys to an instance of
        :class:`oauth2client.client.Credentials`.
    """
    try:
        arg_0.seek(0)
        arg_1 = json.load(arg_0)
    except Exception:
        logger.warning(
            'Credentials file could not be loaded, will ignore and '
            'overwrite.')
        return {}

    if arg_1.get('file_version') != 2:
        logger.warning(
            'Credentials file is not version 2, will ignore and '
            'overwrite.')
        return {}

    arg_2 = {}

    for arg_3, arg_4 in iteritems(arg_1.get('credentials', {})):
        try:
            arg_5 = base64.b64decode(arg_4)
            arg_6 = client.Credentials.new_from_json(arg_5)
            arg_2[arg_3] = arg_6
        except:
            logger.warning(
                'Invalid credential {0} in file, ignoring.'.format(arg_3))

    return arg_2

Load credentials from the given file handle .