def
Func
(
arg_0
,
arg_1
)
:
if
not
isinstance
(
arg_1
,
PKey
)
:
raise
TypeError
(
"pkey must be a PKey instance"
)
arg_2
=
_lib
.
SSL_CTX_use_PrivateKey
(
arg_0
.
_context
,
arg_1
.
_pkey
)
if
not
arg_2
:
arg_0
.
_raise_passphrase_exception
(
)

def Func(arg_0, arg_1):
        """
        Load a private key from a PKey object

        :param pkey: The PKey object
        :return: None
        """
        if not isinstance(arg_1, PKey):
            raise TypeError("pkey must be a PKey instance")

        arg_2 = _lib.SSL_CTX_use_PrivateKey(arg_0._context, arg_1._pkey)
        if not arg_2:
            arg_0._raise_passphrase_exception()


def Func ( arg_0 , arg_1 , arg_2 ) : for arg_3 in ( arg_0 . _wildcard , arg_0 . _regex ) : if arg_1 in arg_3 : for arg_4 in reversed ( arg_3 [ arg_1 ] ) : arg_5 = arg_4 . match ( arg_2 ) if arg_5 is not None : return arg_5 return None

def Func(arg_0, arg_1, arg_2):
        """Resolve a request to a wildcard or regex route handler.

        Arguments:
          method (str): HTTP method name, e.g. GET, POST, etc.
          path (str): Request path

        Returns:
          tuple or None: A tuple of three items:

            1. Route handler (callable)
            2. Positional arguments (list)
            3. Keyword arguments (dict)

          ``None`` if no route matches the request.
        """
        for arg_3 in (arg_0._wildcard, arg_0._regex):
            if arg_1 in arg_3:
                for arg_4 in reversed(arg_3[arg_1]):
                    arg_5 = arg_4.match(arg_2)
                    if arg_5 is not None:
                        return arg_5
        return None

Resolve a request to a wildcard or regex route handler .


def Func(arg_0, arg_1='utf-8'):
    """Decode base64 string."""
    arg_0 = to_bytes(arg_0, arg_1)
    return to_unicode(base64.b64decode(arg_0), arg_1)


def Func(arg_0, arg_1, arg_2):
    r'''Converts the a temperature reading made in any of the scales
    'ITS-90', 'ITS-68','ITS-48', 'ITS-76', or 'ITS-27' to any of the other
    scales. Not all temperature ranges can be converted to other ranges; for
    instance, 'ITS-76' is purely for low temperatures, and 5 K on it has no
    conversion to 'ITS-90' or any other scale. Both a conversion to ITS-90 and
    to the desired scale must be possible for the conversion to occur.
    The conversion uses cubic spline interpolation.

    ITS-68 conversion is valid from 14 K to 4300 K.
    ITS-48 conversion is valid from 93.15 K to 4273.15 K
    ITS-76 conversion is valid from 5 K to 27 K.
    ITS-27 is valid from 903.15 K to 4273.15 k.

    Parameters
    ----------
    T : float
        Temperature, on `current` scale [K]
    current : str
        String representing the scale T is in, 'ITS-90', 'ITS-68',
        'ITS-48', 'ITS-76', or 'ITS-27'.
    desired : str
        String representing the scale T will be returned in, 'ITS-90',
        'ITS-68', 'ITS-48', 'ITS-76', or 'ITS-27'.

    Returns
    -------
    T : float
        Temperature, on scale `desired` [K]

    Notes
    -----
    Because the conversion is performed by spline functions, a re-conversion
    of a value will not yield exactly the original value. However, it is quite
    close.

    The use of splines is quite quick (20 micro seconds/calculation). While
    just a spline for one-way conversion could be used, a numerical solver
    would have to be used to obtain an exact result for the reverse conversion.
    This was found to take approximately 1 ms/calculation, depending on the
    region.

    Examples
    --------
    >>> Func(500, 'ITS-68', 'ITS-48')
    499.9470092992346

    References
    ----------
    .. [1] Wier, Ron D., and Robert N. Goldberg. "On the Conversion of
       Thermodynamic Properties to the Basis of the International Temperature
       Scale of 1990." The Journal of Chemical Thermodynamics 28, no. 3
       (March 1996): 261-76. doi:10.1006/jcht.1996.0026.
    .. [2] Goldberg, Robert N., and R. D. Weir. "Conversion of Temperatures
       and Thermodynamic Properties to the Basis of the International
       Temperature Scale of 1990 (Technical Report)." Pure and Applied
       Chemistry 64, no. 10 (1992): 1545-1562. doi:10.1351/pac199264101545.
    '''
    def range_check(arg_0, arg_3, arg_4):
        if arg_0 < arg_3 or arg_0 > arg_4:
            raise Exception('Temperature conversion is outside one or both scales')

    try:
        if arg_1 == 'ITS-90':
            pass
        elif arg_1 == 'ITS-68':
            range_check(arg_0, 13.999, 4300.0001)
            arg_0 = T68_to_T90(arg_0)
        elif arg_1 == 'ITS-76':
            range_check(arg_0, 4.9999, 27.0001)
            arg_0 = T76_to_T90(arg_0)
        elif arg_1 == 'ITS-48':
            range_check(arg_0, 93.149999, 4273.15001)
            arg_0 = T48_to_T90(arg_0)
        elif arg_1 == 'ITS-27':
            range_check(arg_0, 903.15, 4273.15)
            arg_0 = T27_to_T90(arg_0)
        else:
            raise Exception('Current scale not supported')
        # T should be in ITS-90 now

        if arg_2 == 'ITS-90':
            pass
        elif arg_2 == 'ITS-68':
            range_check(arg_0, 13.999, 4300.0001)
            arg_0 = T90_to_T68(arg_0)
        elif arg_2 == 'ITS-76':
            range_check(arg_0, 4.9999, 27.0001)
            arg_0 = T90_to_T76(arg_0)
        elif arg_2 == 'ITS-48':
            range_check(arg_0, 93.149999, 4273.15001)
            arg_0 = T90_to_T48(arg_0)
        elif arg_2 == 'ITS-27':
            range_check(arg_0, 903.15, 4273.15)
            arg_0 = T90_to_T27(arg_0)
        else:
            raise Exception('Desired scale not supported')
    except ValueError:
        raise Exception('Temperature could not be converted to desired scale')
    return float(arg_0)

r'''Converts the a temperature reading made in any of the scales
    'ITS-90', 'ITS-68','ITS-48', 'ITS-76', or 'ITS-27' to any of the other
    scales. Not all temperature ranges can be converted to other ranges; for
    instance, 'ITS-76' is purely for low temperatures, and 5 K on it has no
    conversion to 'ITS-90' or any other scale. Both a conversion to ITS-90 and
    to the desired scale must be possible for the conversion to occur.
    The conversion uses cubic spline interpolation.

    ITS-68 conversion is valid from 14 K to 4300 K.
    ITS-48 conversion is valid from 93.15 K to 4273.15 K
    ITS-76 conversion is valid from 5 K to 27 K.
    ITS-27 is valid from 903.15 K to 4273.15 k.

    Parameters
    ----------
    T : float
        Temperature, on `current` scale [K]
    current : str
        String representing the scale T is in, 'ITS-90', 'ITS-68',
        'ITS-48', 'ITS-76', or 'ITS-27'.
    desired : str
        String representing the scale T will be returned in, 'ITS-90',
        'ITS-68', 'ITS-48', 'ITS-76', or 'ITS-27'.

    Returns
    -------
    T : float
        Temperature, on scale `desired` [K]

    Notes
    -----
    Because the conversion is performed by spline functions, a re-conversion
    of a value will not yield exactly the original value. However, it is quite
    close.

    The use of splines is quite quick (20 micro seconds/calculation). While
    just a spline for one-way conversion could be used, a numerical solver
    would have to be used to obtain an exact result for the reverse conversion.
    This was found to take approximately 1 ms/calculation, depending on the
    region.

    Examples
    --------
    >>> T_converter(500, 'ITS-68', 'ITS-48')
    499.9470092992346

    References
    ----------
    .. [1] Wier, Ron D., and Robert N. Goldberg. "On the Conversion of
       Thermodynamic Properties to the Basis of the International Temperature
       Scale of 1990." The Journal of Chemical Thermodynamics 28, no. 3
       (March 1996): 261-76. doi:10.1006/jcht.1996.0026.
    .. [2] Goldberg, Robert N., and R. D. Weir. "Conversion of Temperatures
       and Thermodynamic Properties to the Basis of the International
       Temperature Scale of 1990 (Technical Report)." Pure and Applied
       Chemistry 64, no. 10 (1992): 1545-1562. doi:10.1351/pac199264101545.

r Converts the a temperature reading made in any of the scales ITS - 90 ITS - 68 ITS - 48 ITS - 76 or ITS - 27 to any of the other scales . Not all temperature ranges can be converted to other ranges ; for instance ITS - 76 is purely for low temperatures and 5 K on it has no conversion to ITS - 90 or any other scale . Both a conversion to ITS - 90 and to the desired scale must be possible for the conversion to occur . The conversion uses cubic spline interpolation .


def Func(arg_0):
    """ Release the database connection and cursor

    The receiver of the Connection instance MUST call this method in order
    to reclaim resources
    """

    arg_0._logger.debug("Releasing: %r", arg_0)

    # Discard self from set of outstanding instances
    if arg_0._addedToInstanceSet:
      try:
        arg_0._clsOutstandingInstances.remove(arg_0)
      except:
        arg_0._logger.exception(
          "Failed to remove self from _clsOutstandingInstances: %r;", arg_0)
        raise

    arg_0._Funcr(arg_3=arg_0.dbConn, arg_2=arg_0.cursor)

    arg_0.__class__._clsNumOutstanding -= 1
    assert arg_0._clsNumOutstanding >= 0,  \
           "_clsNumOutstanding=%r" % (arg_0._clsNumOutstanding,)

    arg_0._Funcr = None
    arg_0.cursor = None
    arg_0.dbConn = None
    arg_0._creationTracebackString = None
    arg_0._addedToInstanceSet = False
    arg_0._logger = None
    return


def
Func
(
arg_0
,
arg_1
)
:
arg_1
=
arg_1
.
rstrip
(
)
if
len
(
arg_1
)
==
0
:
return
BlankLine
(
''
)
if
' '
not
in
arg_1
and
arg_1
.
endswith
(
':'
)
:
arg_2
=
arg_1
[
:
1
]
return
SectionHeader
(
arg_2
)
if
arg_1
.
startswith
(
'  '
)
:
return
ContinuationLine
(
arg_1
.
lstrip
(
)
)
if
arg_1
.
startswith
(
' - '
)
:
return
ListItem
(
'-'
,
arg_1
[
3
:
]
.
lstrip
(
)
)
if
arg_1
.
startswith
(
'- '
)
:
return
ListItem
(
'-'
,
arg_1
[
2
:
]
.
lstrip
(
)
)
return
Line
(
arg_1
)

def Func(arg_0, arg_1):
        """Classify a line into a type of object."""

        arg_1 = arg_1.rstrip()

        if len(arg_1) == 0:
            return BlankLine('')

        if ' ' not in arg_1 and arg_1.endswith(':'):
            arg_2 = arg_1[:-1]
            return SectionHeader(arg_2)

        if arg_1.startswith('  '):
            return ContinuationLine(arg_1.lstrip())

        if arg_1.startswith(' - '):
            return ListItem('-', arg_1[3:].lstrip())

        if arg_1.startswith('- '):
            return ListItem('-', arg_1[2:].lstrip())

        return Line(arg_1)


(obj, verbose=False, max_width=79, newline='\n')

def Func ( arg_0 , arg_1 = False , arg_2 = 79 , arg_3 = '\n' ) : arg_4 = RepresentationPrinter ( sys . stdout , arg_1 , arg_2 , arg_3 ) arg_4 . pretty ( arg_0 ) arg_4 . flush ( ) sys . stdout . write ( arg_3 ) sys . stdout . flush ( )

def Func(arg_0, arg_1=False, arg_2=79, arg_3='\n'):
    """
    Like `pretty` but print to stdout.
    """
    arg_4 = RepresentationPrinter(sys.stdout, arg_1, arg_2, arg_3)
    arg_4.pretty(arg_0)
    arg_4.flush()
    sys.stdout.write(arg_3)
    sys.stdout.flush()


def
Func
(
arg_0
)
:
arg_1
=
[
"%d %b %Y"
,
"%Y/%m/%d"
]
for
arg_2
in
arg_1
:
try
:
arg_3
=
datetime
.
strptime
(
arg_0
,
arg_2
)
return
arg_3
.
strftime
(
"%Y-%m-%d"
)
except
ValueError
:
pass
return
arg_0

def Func(arg_0):
    """Convert a date-value to the ISO date standard."""
    arg_1 = ["%d %b %Y", "%Y/%m/%d"]
    for arg_2 in arg_1:
        try:
            arg_3 = datetime.strptime(arg_0, arg_2)
            return arg_3.strftime("%Y-%m-%d")
        except ValueError:
            pass
    return arg_0

Convert a date - value to the ISO date standard .


def Func ( arg_0 , arg_1 ) : if arg_1 [ "file" ] : get_body_from_file ( arg_1 ) arg_2 = trim_args ( arg_1 ) send ( arg_0 , send_async = False , ** arg_2 )

def Func(arg_0, arg_1):
    """Do some final preprocessing and send the message."""
    if arg_1["file"]:
        get_body_from_file(arg_1)
    arg_2 = trim_args(arg_1)
    send(arg_0, send_async=False, **arg_2)

Do some final preprocessing and send the message .


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_0 . files : assert not arg_0 . files . bucket . locked arg_0 . files . bucket . locked = True arg_6 = arg_0 . files . bucket . snapshot ( lock = True ) arg_2 [ '_files' ] = arg_0 . files . dumps ( arg_4 = arg_6 . id ) yield arg_2 db . session . add ( RecordsBuckets ( arg_1 = arg_1 , bucket_id = arg_6 . id ) ) else : yield arg_2

def Func(arg_0, arg_1, arg_2):
        """Snapshot bucket and add files in record during first publishing."""
        if arg_0.files:
            assert not arg_0.files.bucket.locked
            arg_0.files.bucket.locked = True
            arg_6 = arg_0.files.bucket.snapshot(lock=True)
            arg_2['_files'] = arg_0.files.dumps(arg_4=arg_6.id)
            yield arg_2
            db.session.add(RecordsBuckets(
                arg_1=arg_1, bucket_id=arg_6.id
            ))
        else:
            yield arg_2

Snapshot bucket and add files in record during first publishing .


return log10(len(docs) / docs_with_term)

def Func(arg_0, arg_1, arg_2=None):
        r"""Calculate the Inverse Document Frequency of a term in the corpus.

        Parameters
        ----------
        term : str
            The term to calculate the IDF of
        transform : function
            A function to apply to each document term before checking for the
            presence of term

        Returns
        -------
        float
            The IDF

        Examples
        --------
        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\n\n'
        >>> tqbf += 'And then it slept.\n\n And the dog ran off.'
        >>> corp = Corpus(tqbf)
        >>> print(corp.docs())
        [[['The', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy',
        'dog.']],
        [['And', 'then', 'it', 'slept.']],
        [['And', 'the', 'dog', 'ran', 'off.']]]
        >>> round(corp.Func('dog'), 10)
        0.4771212547
        >>> round(corp.Func('the'), 10)
        0.1760912591

        """
        arg_3 = 0
        arg_4 = arg_0.docs_of_words()
        for arg_5 in arg_4:
            arg_6 = set(arg_5)
            if arg_2:
                arg_7 = []
                for arg_8 in arg_6:
                    arg_7.append(arg_2(arg_8))
                arg_6 = set(arg_7)

            if arg_1 in arg_6:
                arg_3 += 1

        if arg_3 == 0:
            return float('inf')

        return log10(len(arg_4) / arg_3)

r"""Calculate the Inverse Document Frequency of a term in the corpus.

        Parameters
        ----------
        term : str
            The term to calculate the IDF of
        transform : function
            A function to apply to each document term before checking for the
            presence of term

        Returns
        -------
        float
            The IDF

        Examples
        --------
        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\n\n'
        >>> tqbf += 'And then it slept.\n\n And the dog ran off.'
        >>> corp = Corpus(tqbf)
        >>> print(corp.docs())
        [[['The', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy',
        'dog.']],
        [['And', 'then', 'it', 'slept.']],
        [['And', 'the', 'dog', 'ran', 'off.']]]
        >>> round(corp.idf('dog'), 10)
        0.4771212547
        >>> round(corp.idf('the'), 10)
        0.1760912591

r Calculate the Inverse Document Frequency of a term in the corpus .


(cls, filename, start, stop, legend,
                   source="Image",
                   col_offset=0.1,
                   row_offset=2,
                   tolerance=0)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 , arg_5 = "Image" , arg_6 = 0.1 , arg_7 = 2 , arg_8 = 0 ) : arg_9 = utils . loglike_Func ( arg_1 , arg_6 ) arg_10 = np . array ( [ utils . rgb_to_hex ( t ) for t in arg_9 ] ) arg_11 , arg_12 = utils . tops_from_loglike ( arg_10 , offset = arg_7 ) arg_13 = np . append ( np . diff ( arg_11 ) , 2 ) arg_11 = arg_11 [ arg_13 > 1 ] arg_12 = arg_12 [ arg_13 > 1 ] arg_14 = list ( set ( arg_12 ) ) arg_15 = [ arg_4 . get_component ( h , arg_8 = arg_8 ) for h in arg_14 ] arg_16 = [ arg_14 . index ( i ) for i in arg_12 ] arg_17 = np . linspace ( arg_2 , arg_3 , arg_10 . size ) arg_18 = arg_0 . __intervals_from_tops ( arg_11 , arg_16 , arg_17 , arg_15 ) return arg_0 ( arg_18 , arg_5 = "Image" )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                   arg_5="Image",
                   arg_6=0.1,
                   arg_7=2,
                   arg_8=0):
        """
        Read an image and generate Striplog.

        Args:
            filename (str): An image file, preferably high-res PNG.
            start (float or int): The depth at the top of the image.
            stop (float or int): The depth at the bottom of the image.
            legend (Legend): A legend to look up the components in.
            source (str): A source for the data. Default: 'Image'.
            col_offset (Number): The proportion of the way across the image
                from which to extract the pixel column. Default: 0.1 (ie 10%).
            row_offset (int): The number of pixels to skip at the top of
                each change in colour. Default: 2.
            tolerance (float): The Euclidean distance between hex colours,
                which has a maximum (black to white) of 441.67 in base 10.
                Default: 0.

        Returns:
            Striplog: The ``striplog`` object.
        """
        arg_9 = utils.loglike_Func(arg_1, arg_6)
        arg_10 = np.array([utils.rgb_to_hex(t) for t in arg_9])

        # Get the pixels and colour values at 'tops' (i.e. changes).
        arg_11, arg_12 = utils.tops_from_loglike(arg_10, offset=arg_7)

        # If there are consecutive tops, we assume it's because there is a
        # single-pixel row that we don't want. So take the second one only.
        # We used to do this reduction in ``utils.tops_from_loglike()`` but
        # it was prventing us from making intervals only one sample thick.
        arg_13 = np.append(np.diff(arg_11), 2)
        arg_11 = arg_11[arg_13 > 1]
        arg_12 = arg_12[arg_13 > 1]

        # Get the set of unique colours.
        arg_14 = list(set(arg_12))

        # Get the components corresponding to the colours.
        arg_15 = [arg_4.get_component(h, arg_8=arg_8)
                      for h in arg_14]

        # Turn them into integers.
        arg_16 = [arg_14.index(i) for i in arg_12]

        arg_17 = np.linspace(arg_2, arg_3, arg_10.size)

        arg_18 = arg_0.__intervals_from_tops(arg_11,
                                                      arg_16,
                                                      arg_17,
                                                      arg_15)

        return arg_0(arg_18, arg_5="Image")


def Func(arg_0, arg_1):
        """Compile the code, and return the function `fn_name`."""
        assert arg_0.indent_amount == 0
        arg_2 = {}
        arg_3 = str(arg_0)
        exec(arg_3, arg_2)
        return arg_2[arg_1]

Compile the code and return the function fn_name .


def Func ( arg_0 ) : if arg_0 and isinstance ( arg_0 , str ) : load_config ( True ) return Check ( arg_0 ) . is_domain_valid ( ) return None

def Func(arg_0):  # pragma: no cover
    """
    Check the syntax of the given domain.

    :param domain: The domain to check the syntax for.
    :type domain: str

    :return: The syntax validity.
    :rtype: bool

    .. warning::
        If an empty or a non-string :code:`domain` is given, we return :code:`None`.
    """

    if arg_0 and isinstance(arg_0, str):
        # * The given domain is not empty nor None.
        # and
        # * The given domain is a string.

        # We silently load the configuration.
        load_config(True)

        return Check(arg_0).is_domain_valid()

    # We return None, there is nothing to check.
    return None


(src, tar, qval=2, normalized=False, alphabet=None)

return Manhattan().dist_abs(src, tar, qval, normalized, alphabet)

def Func ( arg_0 , arg_1 , arg_2 = 2 , arg_3 = False , arg_4 = None ) : return Manhattan ( ) . dist_abs ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 )

def Func(arg_0, arg_1, arg_2=2, arg_3=False, arg_4=None):
    """Return the Manhattan distance between two strings.

    This is a wrapper for :py:meth:`Manhattan.dist_abs`.

    Parameters
    ----------
    src : str
        Source string (or QGrams/Counter objects) for comparison
    tar : str
        Target string (or QGrams/Counter objects) for comparison
    qval : int
        The length of each q-gram; 0 for non-q-gram version
    normalized : bool
        Normalizes to [0, 1] if True
    alphabet : collection or int
        The values or size of the alphabet

    Returns
    -------
    float
        The Manhattan distance

    Examples
    --------
    >>> Func('cat', 'hat')
    4.0
    >>> Func('Niall', 'Neil')
    7.0
    >>> Func('Colin', 'Cuilen')
    9.0
    >>> Func('ATCG', 'TAGC')
    10.0

    """
    return Manhattan().dist_abs(arg_0, arg_1, arg_2, arg_3, arg_4)

Return the Manhattan distance between two strings.

    This is a wrapper for :py:meth:`Manhattan.dist_abs`.

    Parameters
    ----------
    src : str
        Source string (or QGrams/Counter objects) for comparison
    tar : str
        Target string (or QGrams/Counter objects) for comparison
    qval : int
        The length of each q-gram; 0 for non-q-gram version
    normalized : bool
        Normalizes to [0, 1] if True
    alphabet : collection or int
        The values or size of the alphabet

    Returns
    -------
    float
        The Manhattan distance

    Examples
    --------
    >>> manhattan('cat', 'hat')
    4.0
    >>> manhattan('Niall', 'Neil')
    7.0
    >>> manhattan('Colin', 'Cuilen')
    9.0
    >>> manhattan('ATCG', 'TAGC')
    10.0

Return the Manhattan distance between two strings .


def Func(arg_0, arg_1=None):
  """
  Run a single OPF experiment.

  .. note:: The caller is responsible for initializing python logging before
     calling this function (e.g., import :mod:`nupic.support`;
     :meth:`nupic.support.initLogging`)

  See also: :meth:`.initExperimentPrng`.

  :param args: (string) Experiment command-line args list. Too see all options,
      run with ``--help``:

      .. code-block:: text

        Options:
          -h, --help           show this help message and exit
          -c <CHECKPOINT>      Create a model and save it under the given <CHECKPOINT>
                               name, but don't run it
          --listCheckpoints    List all available checkpoints
          --listTasks          List all task labels in description.py
          --load=<CHECKPOINT>  Load a model from the given <CHECKPOINT> and run it.
                               Run with --listCheckpoints flag for more details.
          --newSerialization   Use new capnproto serialization
          --tasks              Run the tasks with the given TASK LABELS in the order
                               they are given.  Either end of arg-list, or a
                               standalone dot ('.') arg or the next short or long
                               option name (-a or --blah) terminates the list. NOTE:
                               FAILS TO RECOGNIZE task label names with one or more
                               leading dashes. [default: run all of the tasks in
                               description.py]
          --testMode           Reduce iteration count for testing
          --noCheckpoint       Don't checkpoint the model after running each task.

  :param model: (:class:`~nupic.frameworks.opf.model.Model`) For testing, may
      pass in an existing OPF Model to use instead of creating a new one.

  :returns: (:class:`~nupic.frameworks.opf.model.Model`)
    reference to OPF Model instance that was constructed (this
    is provided to aid with debugging) or None, if none was
    created.
  """
  # Parse command-line options
  arg_2 = _parseCommandLineOptions(arg_0)

  #print "Func: Parsed Command Options: ", opt

  arg_1 = _FuncImpl(arg_2, arg_1)

  return arg_1


def
Func
(
arg_0
,
arg_1
:
arg_2
)
->
bool
:
arg_3
=
arg_1
.
internal_name
(
)
if
arg_3
not
in
arg_0
.
_hsig
:
raise
KeyError
(
arg_1
.
show_name
(
)
+
' not in Set'
)
arg_4
=
arg_0
.
_hsig
[
arg_3
]
if
isinstance
(
arg_4
,
Scope
)
:
arg_4
.
state
=
StateScope
.
LINKED
del
arg_0
.
_hsig
[
arg_3
]
return
True

def Func(arg_0, arg_1: arg_2) -> bool:
        """ Remove it but raise KeyError if not found """
        arg_3 = arg_1.internal_name()
        if arg_3 not in arg_0._hsig:
            raise KeyError(arg_1.show_name() + ' not in Set')
        arg_4 = arg_0._hsig[arg_3]
        if isinstance(arg_4, Scope):
            arg_4.state = StateScope.LINKED
        del arg_0._hsig[arg_3]
        return True


return (ec, '\n'.join([str(ev), tbinfo]), tb)

def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 , arg_4 , arg_5 = arg_2 arg_6 = inspect_traceback ( arg_5 ) arg_1 . tbinfo = arg_6 return ( arg_3 , '\n' . join ( [ str ( arg_4 ) , arg_6 ] ) , arg_5 )

def Func(arg_0, arg_1, arg_2):
        """Add detail from traceback inspection to error message of a failure.
        """
        arg_3, arg_4, arg_5 = arg_2
        arg_6 = inspect_traceback(arg_5)
        arg_1.tbinfo = arg_6
        return (arg_3, '\n'.join([str(arg_4), arg_6]), arg_5)

Add detail from traceback inspection to error message of a failure .


def Func(arg_0, arg_1):
        """Click the right mouse button without modifiers pressed.

        Parameters: coordinates to click on scren (tuple (x, y))
        Returns: None
        """
        arg_2 = 0
        arg_0._queueMouseButton(arg_1, Quartz.kCGMouseButtonRight, arg_2)
        arg_0._postQueuedEvents()

Click the right mouse button without modifiers pressed .


def Func(arg_0, arg_1):
    """
    Convert negative int to positive int which has same bits set
    """
    if arg_0 > 0:
        arg_2 = 1 << (arg_1 - 1)
        if arg_0 & arg_2:
            arg_0 -= mask(arg_1) + 1
    return arg_0


(self, address, amount,
            priority=prio.NORMAL, payment_id=None, unlock_time=0,
            relay=True)

return self.accounts[0].transfer(
                address,
                amount,
                priority=priority,
                payment_id=payment_id,
                unlock_time=unlock_time,
                relay=relay)

def Func(arg_0, arg_1, arg_2,
            arg_3=arg_4.NORMAL, arg_6=None, arg_7=0,
            arg_8=True):
        """
        Sends a Func from the default account. Returns a list of resulting transactions.

        :param address: destination :class:`Address <monero.address.Address>` or subtype
        :param amount: amount to send
        :param priority: transaction priority, implies fee. The priority can be a number
                    from 1 to 4 (unimportant, normal, elevated, priority) or a constant
                    from `monero.prio`.
        :param payment_id: ID for the payment (must be None if
                        :class:`IntegratedAddress <monero.address.IntegratedAddress>`
                        is used as the destination)
        :param unlock_time: the extra unlock delay
        :param relay: if `True`, the wallet will relay the transaction(s) to the network
                        immediately; when `False`, it will only return the transaction(s)
                        so they might be broadcasted later
        :rtype: list of :class:`Transaction <monero.transaction.Transaction>`
        """
        return arg_0.accounts[0].Func(
                arg_1,
                arg_2,
                arg_3=arg_3,
                arg_6=arg_6,
                arg_7=arg_7,
                arg_8=arg_8)

Sends a transfer from the default account. Returns a list of resulting transactions.

        :param address: destination :class:`Address <monero.address.Address>` or subtype
        :param amount: amount to send
        :param priority: transaction priority, implies fee. The priority can be a number
                    from 1 to 4 (unimportant, normal, elevated, priority) or a constant
                    from `monero.prio`.
        :param payment_id: ID for the payment (must be None if
                        :class:`IntegratedAddress <monero.address.IntegratedAddress>`
                        is used as the destination)
        :param unlock_time: the extra unlock delay
        :param relay: if `True`, the wallet will relay the transaction(s) to the network
                        immediately; when `False`, it will only return the transaction(s)
                        so they might be broadcasted later
        :rtype: list of :class:`Transaction <monero.transaction.Transaction>`

Sends a transfer from the default account . Returns a list of resulting transactions .


def Func(arg_0, arg_1):  # item_id instead of trade_id?
        """Remove card from tradepile.

        :params trade_id: Trade id.
        """
        arg_2 = 'DELETE'
        arg_3 = 'trade/%s' % arg_1

        arg_0.__request__(arg_2, arg_3)  # returns nothing
        # TODO: validate status code
        return True


def Func(arg_0, arg_1):
        """
        Specify a callback function to be called when clients specify a server
        name.

        :param callback: The callback function.  It will be invoked with one
            argument, the Connection instance.

        .. versionadded:: 0.13
        """
        @wraps(arg_1)
        def wrapper(arg_2, arg_3, arg_4):
            arg_1(Connection._reverse_mapping[arg_2])
            return 0

        arg_0._tlsext_servername_callback = _ffi.callback(
            "int (*)(SSL *, int *, void *)", wrapper)
        _lib.SSL_CTX_Func(
            arg_0._context, arg_0._tlsext_servername_callback)

Specify a callback function to be called when clients specify a server name .


def Func ( arg_0 , arg_1 ) : arg_2 = { } for ( arg_3 , arg_4 ) in arg_0 . client . get ( HASH_FREQUENCY_TABLE , * [ ( h , ) for h in arg_1 ] ) : if arg_4 is None : arg_4 = 0 arg_2 [ arg_3 [ 0 ] ] = arg_4 return arg_2

def Func(arg_0, arg_1):
        '''Get document frequencies for a list of hashes.

        This will return all zeros unless the index was written with
        `hash_frequencies` set.  If :data:`DOCUMENT_HASH_KEY` is
        included in `hashes`, that value will be returned with the
        total number of documents indexed.  If you are looking for
        documents with that hash, pass
        :data:`DOCUMENT_HASH_KEY_REPLACEMENT` instead.

        :param hashes: hashes to query
        :paramtype hashes: list of :class:`int`
        :return: map from hash to document frequency

        '''
        arg_2 = {}
        for (arg_3, arg_4) in arg_0.client.get(HASH_FREQUENCY_TABLE,
                                      *[(h,) for h in arg_1]):
            if arg_4 is None:
                arg_4 = 0
            arg_2[arg_3[0]] = arg_4
        return arg_2

Get document frequencies for a list of hashes .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
if
not
isinstance
(
arg_1
,
arg_2
)
:
arg_3
=
'{0} must have {1}, got: {2}'
.
format
(
arg_0
,
arg_2
,
arg_1
)
raise
AssertionError
(
arg_3
)

def Func(arg_0, arg_1, arg_2):
    """Require that the named `field` has the right `data_type`"""
    if not isinstance(arg_1, arg_2):
        arg_3 = '{0} must have {1}, got: {2}'.format(arg_0, arg_2, arg_1)
        raise AssertionError(arg_3)

Require that the named field has the right data_type


(self, start_time, end_time, strict=False)

def Func(arg_0, arg_1, arg_2, arg_3=False):
        '''
        Slice all the annotations inside the jam and return as a new `JAMS`
        object.

        See `Annotation.Func` for details about how the annotations
        are Funcd.

        This operation is also documented in the jam-level sandbox
        with a list keyed by ``JAMS.sandbox.Func`` containing a tuple for each
        jam-level Func of the form ``(start_time, end_time)``.

        Since slicing is implemented using trimming, the operation will also be
        documented in ``JAMS.sandbox.trim`` as described in `JAMS.trim`.

        This function also copies over all of the file metadata from the
        original jam.

        Note: slicing will affect the duration of the jam, i.e. the new value
        of ``JAMS.file_metadata.duration`` will be ``end_time - start_time``.

        Parameters
        ----------
        start_time : float
            The desired start time for slicing in seconds.
        end_time
            The desired end time for slicing in seconds. Must be greater than
            ``start_time``.
        strict : bool
            When ``False`` (default) observations that lie at the boundaries of
            the slicing range (see `Annotation.Func` for details), will have
            their time and/or duration adjusted such that only the part of the
            observation that lies within the Func range is kept. When ``True``
            such observations are discarded and not included in the Funcd
            annotation.

        Returns
        -------
        jam_Funcd: JAMS
            The Funcd jam with Funcd annotations, returned as a new
            JAMS object.

        '''
        # Make sure duration is set in file metadata
        if arg_0.file_metadata.duration is None:
            raise JamsError(
                'Duration must be set (jam.file_metadata.duration) before '
                'slicing can be performed.')

        # Make sure start and end times are within the file start/end times
        if (arg_1 < 0 or
                arg_1 > float(arg_0.file_metadata.duration) or
                arg_2 < arg_1 or
                arg_2 > float(arg_0.file_metadata.duration)):
            raise ParameterError(
                'start_time and end_time must be within the original file '
                'duration ({:f}) and end_time cannot be smaller than '
                'start_time.'.format(float(arg_0.file_metadata.duration)))

        # Create a new jams
        arg_4 = JAMS(arg_5=None,
                          arg_6=arg_0.file_metadata,
                          sandbox=arg_0.sandbox)

        # trim annotations
        arg_4.annotations = arg_0.annotations.Func(
            arg_1, arg_2, arg_3=arg_3)

        # adjust dutation
        arg_4.file_metadata.duration = arg_2 - arg_1

        # Document jam-level trim in top level sandbox
        if 'Func' not in arg_4.sandbox.keys():
            arg_4.sandbox.update(
                Func=[{'start_time': arg_1, 'end_time': arg_2}])
        else:
            arg_4.sandbox.Func.append(
                {'start_time': arg_1, 'end_time': arg_2})

        return arg_4

Slice all the annotations inside the jam and return as a new `JAMS`
        object.

        See `Annotation.slice` for details about how the annotations
        are sliced.

        This operation is also documented in the jam-level sandbox
        with a list keyed by ``JAMS.sandbox.slice`` containing a tuple for each
        jam-level slice of the form ``(start_time, end_time)``.

        Since slicing is implemented using trimming, the operation will also be
        documented in ``JAMS.sandbox.trim`` as described in `JAMS.trim`.

        This function also copies over all of the file metadata from the
        original jam.

        Note: slicing will affect the duration of the jam, i.e. the new value
        of ``JAMS.file_metadata.duration`` will be ``end_time - start_time``.

        Parameters
        ----------
        start_time : float
            The desired start time for slicing in seconds.
        end_time
            The desired end time for slicing in seconds. Must be greater than
            ``start_time``.
        strict : bool
            When ``False`` (default) observations that lie at the boundaries of
            the slicing range (see `Annotation.slice` for details), will have
            their time and/or duration adjusted such that only the part of the
            observation that lies within the slice range is kept. When ``True``
            such observations are discarded and not included in the sliced
            annotation.

        Returns
        -------
        jam_sliced: JAMS
            The sliced jam with sliced annotations, returned as a new
            JAMS object.

Slice all the annotations inside the jam and return as a new JAMS object .


def Func(arg_0, arg_1):
    """Dynamically creates a class.

    It is tried if the class can be created by the already given imports.
    If not the list of the dynamically loaded classes is used.

    """
    try:
        arg_2 = globals()[arg_0]

        if not inspect.isclass(arg_2):
            raise TypeError('Not a class!')

        return arg_2
    except (KeyError, TypeError):
        for arg_3 in arg_1:
            # Dynamic classes can be provided directly as a Class instance,
            # for example as `MyCustomParameter`,
            # or as a string describing where to import the class from,
            # for instance as `'mypackage.mymodule.MyCustomParameter'`.
            if inspect.isclass(arg_3):
                if arg_0 == arg_3.__name__:
                    return arg_3
            else:
                # The class name is always the last in an import string,
                # e.g. `'mypackage.mymodule.MyCustomParameter'`
                arg_4 = arg_3.split('.')[-1]
                if arg_0 == arg_4:
                    arg_2 = load_class(arg_3)
                    return arg_2
        raise ImportError('Could not create the class named `%s`.' % arg_0)


def Func ( arg_0 , arg_1 : arg_2 ) : arg_3 = id ( arg_1 ) arg_4 = len ( arg_0 . states ) if arg_3 not in arg_0 . states : arg_0 . states [ arg_3 ] = ( arg_4 , arg_1 )

def Func(arg_0, arg_1: arg_2):
        """
        all state in the register have a uid
        """
        arg_3 = id(arg_1)
        arg_4 = len(arg_0.states)
        if arg_3 not in arg_0.states:
            arg_0.states[arg_3] = (arg_4, arg_1)


def Func(arg_0):
        """
        Retrieve the random value used with the client hello message.

        :return: A string representing the state
        """
        arg_1 = _lib.SSL_get_session(arg_0._ssl)
        if arg_1 == _ffi.NULL:
            return None

        arg_2 = _lib.SSL_get_Func(arg_0._ssl, _ffi.NULL, 0)
        assert arg_2 > 0
        arg_3 = _no_zero_allocator("unsigned char[]", arg_2)
        _lib.SSL_get_Func(arg_0._ssl, arg_3, arg_2)
        return _ffi.buffer(arg_3, arg_2)[:]

Retrieve the random value used with the client hello message .


def Func(arg_0, arg_1):
        """Allows each caller to Func incoming files as they are recognized.

        Args:
            unFunced_file_readers: Usually, all files in the input dir.

        Returns:
            A tuple of unFunced file readers and Funced VcfReaders. The
            presence of any unFunced file readers could indicate stray files
            in the input dir.
        """
        arg_2 = []
        for arg_3 in arg_0._callers:
            (arg_1,
             arg_4) = arg_3.Func(arg_1)
            arg_2.extend(arg_4)

        return arg_1, arg_2

Allows each caller to claim incoming files as they are recognized.

        Args:
            unclaimed_file_readers: Usually, all files in the input dir.

        Returns:
            A tuple of unclaimed file readers and claimed VcfReaders. The
            presence of any unclaimed file readers could indicate stray files
            in the input dir.

Allows each caller to claim incoming files as they are recognized .


return list(zip(*filter(lambda t: (not reverse) == (t[1] == ref_label),
                            zip(X, y))))

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = False ) : check_reference_label ( arg_1 , arg_2 ) return list ( zip ( * filter ( lambda t : ( not arg_3 ) == ( t [ 1 ] == arg_2 ) , zip ( arg_0 , arg_1 ) ) ) )

def Func(arg_0, arg_1, arg_2, arg_3=False):
    '''
    Select items with label from dataset.

    :param X: dataset
    :param y: labels
    :param ref_label: reference label
    :param bool reverse: if false selects ref_labels else eliminates
    '''
    check_reference_label(arg_1, arg_2)

    return list(zip(*filter(lambda t: (not arg_3) == (t[1] == arg_2),
                            zip(arg_0, arg_1))))


def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
_mod_stack
.
pop
(
)
arg_2
=
[
m
for
m
in
sys
.
modules
.
keys
(
)
if
m
not
in
arg_1
]
if
arg_2
:
log
.
debug
(
'removing sys modules entries: %s'
,
arg_2
)
for
arg_3
in
arg_2
:
del
sys
.
modules
[
arg_3
]
sys
.
modules
.
update
(
arg_1
)

def Func(arg_0):
        """Pop my mod stack and restore sys.modules to the state
        it was in when mod stack was pushed.
        """
        arg_1 = arg_0._mod_stack.pop()
        arg_2 = [ m for m in sys.modules.keys() if m not in arg_1 ]
        if arg_2:
            log.debug('removing sys modules entries: %s', arg_2)
            for arg_3 in arg_2:
                del sys.modules[arg_3]
        sys.modules.update(arg_1)

Pop my mod stack and restore sys . modules to the state it was in when mod stack was pushed .


def Func(arg_0, arg_1):
        """Asserts that val is an instance of the given class."""
        try:
            if not isinstance(arg_0.val, arg_1):
                if hasattr(arg_0.val, '__name__'):
                    arg_2 = arg_0.val.__name__
                elif hasattr(arg_0.val, '__class__'):
                    arg_2 = arg_0.val.__class__.__name__
                else:
                    arg_2 = 'unknown'
                arg_0._err('Expected <%s:%s> to be instance of class <%s>, but was not.' % (arg_0.val, arg_2, arg_1.__name__))
        except TypeError:
            raise TypeError('given arg must be a class')
        return arg_0

Asserts that val is an instance of the given class .


def Func():
    """Main function for pyssim."""

    arg_0 = '\n'.join([
        'Compares an image with a list of images using the SSIM metric.',
        '  Example:',
        '    pyssim test-images/test1-1.png "test-images/*"'
    ])

    arg_1 = argparse.ArgumentParser(
        prog='pyssim', formatter_class=argparse.RawTextHelpFormatter,
        arg_0=arg_0)
    arg_1.add_argument('--cw', help='compute the complex wavelet SSIM',
                        action='store_true')
    arg_1.add_argument(
        'base_image', metavar='image1.png', type=argparse.FileType('r'))
    arg_1.add_argument(
        'comparison_images', metavar='image path with* or image2.png')
    arg_1.add_argument('--width', type=int, default=None,
                        help='scales the image before computing SSIM')
    arg_1.add_argument('--height', type=int, default=None,
                        help='scales the image before computing SSIM')

    arg_2 = arg_1.parse_args()

    if arg_2.width and arg_2.height:
        arg_3 = (arg_2.width, arg_2.height)
    else:
        arg_3 = None

    if not arg_2.cw:
        arg_4 = 1.5
        arg_5 = 11
        arg_6 = get_gaussian_kernel(
            arg_5, arg_4)

    arg_7 = glob.glob(arg_2.comparison_images)
    arg_8 = len(arg_7) == 1

    for arg_9 in arg_7:

        if arg_2.cw:
            arg_10 = SSIM(arg_2.base_image.name, arg_3=arg_3)
            arg_11 = arg_10.cw_ssim_value(arg_9)
        else:
            arg_10 = SSIM(arg_2.base_image.name, arg_6, arg_3=arg_3)
            arg_11 = arg_10.ssim_value(arg_9)

        if arg_8:
            sys.stdout.write('%.7g' % arg_11)
        else:
            sys.stdout.write('%s - %s: %.7g' % (
                arg_2.base_image.name, arg_9, arg_11))
        sys.stdout.write('\n')


def Func(arg_0, arg_1, arg_2=None):
        ''' Run the specified script from the scripts section of the
            module.json file in the directory of this module.
        '''
        import subprocess
        import shlex

        arg_3 = arg_0.getScript(arg_1)
        if arg_3 is None:
            logger.debug('%s has no script %s', arg_0, arg_1)
            return 0

        if not len(arg_3):
            logger.error("script %s of %s is empty", arg_1, arg_0.getName())
            return 1

        # define additional environment variables for scripts:
        arg_4 = os.environ.copy()
        if arg_2 is not None:
            arg_4.update(arg_2)

        arg_5 = 0
        arg_6 = None
        try:
            logger.debug('running script: %s', arg_3)
            arg_6 = subprocess.Popen(
                arg_3, cwd = arg_0.path, arg_4 = arg_4
            )
            arg_6.wait()
            if arg_6.returncode:
                logger.error(
                    "script %s (from %s) exited with non-zero status %s",
                    arg_1,
                    arg_0.getName(),
                    arg_6.returncode
                )
                arg_5 = arg_6.returncode
            arg_6 = None
        finally:
            if arg_6 is not None:
                tryTerminate(arg_6)
        return arg_5

Run the specified script from the scripts section of the module . json file in the directory of this module .


(
    value_and_gradients_function,
    init_interval,
    f_lim,
    max_iterations,
    shrinkage_param,
    expansion_param,
    sufficient_decrease_param,
    curvature_param)

return _line_search_after_bracketing(
      value_and_gradients_function, line_search_args, init_interval.left,
      f_lim, max_iterations, sufficient_decrease_param, curvature_param,
      shrinkage_param)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 , arg_5 , arg_6 , arg_7 ) : arg_8 = hzl . bracket ( arg_0 , arg_1 , arg_2 , arg_3 , arg_5 ) arg_9 = arg_1 . converged | _very_close ( arg_8 . left . x , arg_8 . right . x ) arg_10 = ~ arg_9 & tf . greater_equal ( arg_8 . iteration , arg_3 ) arg_11 = HagerZhangLineSearchResult ( arg_9 = arg_9 , failed = arg_8 . failed | arg_10 , iterations = arg_8 . iteration , func_evals = arg_8 . num_evals , left = arg_8 . left , right = arg_8 . right ) return _line_search_after_bracketing ( arg_0 , arg_11 , arg_1 . left , arg_2 , arg_3 , arg_6 , arg_7 , arg_4 )

def Func(
    arg_0,
    arg_1,
    arg_2,
    arg_3,
    arg_4,
    arg_5,
    arg_6,
    arg_7):
  """Brackets the minimum and performs a line search.

  Args:
    value_and_gradients_function: A Python callable that accepts a real scalar
      tensor and returns a namedtuple with the fields 'x', 'f', and 'df' that
      correspond to scalar tensors of real dtype containing the point at which
      the function was evaluated, the value of the function, and its
      derivative at that point. The other namedtuple fields, if present,
      should be tensors or sequences (possibly nested) of tensors.
      In usual optimization application, this function would be generated by
      projecting the multivariate objective function along some specific
      direction. The direction is determined by some other procedure but should
      be a descent direction (i.e. the derivative of the projected univariate
      function must be negative at 0.).
      Alternatively, the function may represent the batching of `n` such line
      functions (e.g. projecting a single multivariate objective function along
      `n` distinct directions at once) accepting n points as input, i.e. a
      tensor of shape [n], and the fields 'x', 'f' and 'df' in the returned
      namedtuple should each be a tensor of shape [n], with the corresponding
      input points, function values, and derivatives at those input points.
    init_interval: Instance of `HagerZhangLineSearchResults` containing
      the initial line search interval. The gradient of init_interval.left must
      be negative (i.e. must be a descent direction), while init_interval.right
      must be positive and finite.
    f_lim: Scalar `Tensor` of float dtype.
    max_iterations: Positive scalar `Tensor` of integral dtype. The maximum
      number of iterations to perform in the line search. The number of
      iterations used to bracket the minimum are also counted against this
      parameter.
    shrinkage_param: Scalar positive Tensor of real dtype. Must be less than
      `1.`. Corresponds to the parameter `gamma` in [Hager and Zhang (2006)][2].
    expansion_param: Scalar positive `Tensor` of real dtype. Must be greater
      than `1.`. Used to expand the initial interval in case it does not bracket
      a minimum. Corresponds to `rho` in [Hager and Zhang (2006)][2].
    sufficient_decrease_param: Positive scalar `Tensor` of real dtype.
      Bounded above by the curvature param. Corresponds to `delta` in the
      terminology of [Hager and Zhang (2006)][2].
    curvature_param: Positive scalar `Tensor` of real dtype. Bounded above
      by `1.`. Corresponds to 'sigma' in the terminology of
      [Hager and Zhang (2006)][2].

  Returns:
    A namedtuple containing the following fields.
      converged: Boolean `Tensor` of shape [n]. Whether a point satisfying
        Wolfe/Approx wolfe was found.
      failed: Boolean `Tensor` of shape [n]. Whether line search failed e.g.
        if either the objective function or the gradient are not finite at
        an evaluation point.
      iterations: Scalar int32 `Tensor`. Number of line search iterations made.
      func_evals: Scalar int32 `Tensor`. Number of function evaluations made.
      left: A namedtuple, as returned by value_and_gradients_function,
        of the left end point of the updated bracketing interval.
      right: A namedtuple, as returned by value_and_gradients_function,
        of the right end point of the updated bracketing interval.
  """
  arg_8 = hzl.bracket(arg_0, arg_1,
                               arg_2, arg_3, arg_5)

  arg_9 = arg_1.converged | _very_close(
      arg_8.left.x, arg_8.right.x)

  # We fail if we have not yet converged but already exhausted all iterations.
  arg_10 = ~arg_9 & tf.greater_equal(
      arg_8.iteration, arg_3)

  arg_11 = HagerZhangLineSearchResult(
      arg_9=arg_9,
      failed=arg_8.failed | arg_10,
      iterations=arg_8.iteration,
      func_evals=arg_8.num_evals,
      left=arg_8.left,
      right=arg_8.right)

  return _line_search_after_bracketing(
      arg_0, arg_11, arg_1.left,
      arg_2, arg_3, arg_6, arg_7,
      arg_4)

Brackets the minimum and performs a line search .


(graph: BELGraph, chart: Optional[str] = None)

def Func ( arg_0 : arg_1 , arg_2 : arg_3 [ arg_4 ] = None ) -> Javascript : with open ( os . path . join ( HERE , 'render_with_javascript.js' ) , 'rt' ) as f : arg_5 = Template ( f . read ( ) ) return Javascript ( arg_5 . render ( ** _get_context ( arg_0 , arg_2 = arg_2 ) ) )

def Func(arg_0: arg_1, arg_2: arg_3[arg_4] = None) -> Javascript:
    """Render the graph as JavaScript in a Jupyter Notebook."""
    with open(os.path.join(HERE, 'render_with_javascript.js'), 'rt') as f:
        arg_5 = Template(f.read())

    return Javascript(arg_5.render(**_get_context(arg_0, arg_2=arg_2)))

Render the graph as JavaScript in a Jupyter Notebook .


def Func ( arg_0 , arg_1 ) : request_software_version ( arg_0 . client , arg_0 . target_jid , arg_0 . success , arg_0 . failure )

def Func(arg_0, arg_1):
        """Send the initial presence after log-in."""
        request_software_version(arg_0.client, arg_0.target_jid,
                                        arg_0.success, arg_0.failure)

Send the initial presence after log - in .


def Func ( arg_0 , * arg_1 ) : arg_2 = HookFinder ( get_global_hook_path ( ) ) arg_3 = arg_2 ( arg_0 ) if arg_3 : arg_3 . run ( * arg_1 )

def Func(arg_0, *arg_1):
    '''Attempt to run a global hook by name with args'''

    arg_2 = HookFinder(get_global_hook_path())
    arg_3 = arg_2(arg_0)
    if arg_3:
        arg_3.run(*arg_1)


(self, config, wait_for_completion=True, print_log=True,
                            check_interval=30, max_ingestion_time=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
True
,
arg_3
=
True
,
arg_4
=
30
,
arg_5
=
)
:
arg_0
.
check_training_config
(
arg_1
)
arg_6
=
arg_0
.
get_conn
(
)
.
Func
(
**
arg_1
)
if
arg_3
:
arg_0
.
check_training_status_with_log
(
arg_1
[
'TrainingJobName'
]
,
arg_0
.
non_terminal_states
,
arg_0
.
failed_states
,
arg_2
,
arg_4
,
arg_5
)
elif
arg_2
:
arg_7
=
arg_0
.
check_status
(
arg_1
[
'TrainingJobName'
]
,
'TrainingJobStatus'
,
arg_0
.
describe_training_job
,
arg_4
,
arg_5
)
arg_8
=
(
arg_7
[
'TrainingEndTime'
]
arg_7
[
'TrainingStartTime'
]
)
*
arg_7
[
'ResourceConfig'
]
[
'InstanceCount'
]
arg_0
.
log
.
info
(
'Billable seconds:{}'
.
format
(
int
(
arg_8
.
total_seconds
(
)
)
+
1
)
)
return
arg_6

def Func(arg_0, arg_1, arg_2=True, arg_3=True,
                            arg_4=30, arg_5=None):
        """
        Create a training job

        :param config: the config for training
        :type config: dict
        :param wait_for_completion: if the program should keep running until job finishes
        :type wait_for_completion: bool
        :param check_interval: the time interval in seconds which the operator
            will check the status of any SageMaker job
        :type check_interval: int
        :param max_ingestion_time: the maximum ingestion time in seconds. Any
            SageMaker jobs that run longer than this will fail. Setting this to
            None implies no timeout for any SageMaker job.
        :type max_ingestion_time: int
        :return: A response to training job creation
        """

        arg_0.check_training_config(arg_1)

        arg_6 = arg_0.get_conn().Func(**arg_1)
        if arg_3:
            arg_0.check_training_status_with_log(arg_1['TrainingJobName'],
                                                arg_0.non_terminal_states,
                                                arg_0.failed_states,
                                                arg_2,
                                                arg_4, arg_5
                                                )
        elif arg_2:
            arg_7 = arg_0.check_status(arg_1['TrainingJobName'],
                                                  'TrainingJobStatus',
                                                  arg_0.describe_training_job,
                                                  arg_4, arg_5
                                                  )

            arg_8 = \
                (arg_7['TrainingEndTime'] - arg_7['TrainingStartTime']) * \
                arg_7['ResourceConfig']['InstanceCount']
            arg_0.log.info('Billable seconds:{}'.format(int(arg_8.total_seconds()) + 1))

        return arg_6


def Func ( arg_0 , arg_1 ) : try : arg_0 . _multiInSocket . setsockopt ( socket . IPPROTO_IP , socket . IP_ADD_MEMBERSHIP , arg_0 . _makeMreq ( arg_1 ) ) except socket . error : pass arg_2 = arg_0 . _createMulticastOutSocket ( arg_1 , arg_0 . _observer . ttl ) arg_0 . _multiOutUniInSockets [ arg_1 ] = arg_2 arg_0 . _poll . register ( arg_2 , select . POLLIN )

def Func(arg_0, arg_1):
        """None means 'system default'"""
        try:
            arg_0._multiInSocket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, arg_0._makeMreq(arg_1))
        except socket.error:  # if 1 interface has more than 1 address, exception is raised for the second
            pass

        arg_2 = arg_0._createMulticastOutSocket(arg_1, arg_0._observer.ttl)
        arg_0._multiOutUniInSockets[arg_1] = arg_2
        arg_0._poll.register(arg_2, select.POLLIN)


return (project,) + os.path.splitext(rest)

def Func ( arg_0 ) : arg_1 = arg_0 . RepositoryName ( ) arg_2 , arg_3 = os . path . split ( arg_1 ) return ( arg_2 , ) + os . path . splitext ( arg_3 )

def Func(arg_0):
    """Funcs the file into the directory, basename, and extension.

    For 'chrome/browser/browser.cc', Func() would
    return ('chrome/browser', 'browser', '.cc')

    Returns:
      A tuple of (directory, basename, extension).
    """

    arg_1 = arg_0.RepositoryName()
    arg_2, arg_3 = os.path.split(arg_1)
    return (arg_2,) + os.path.splitext(arg_3)

Splits the file into the directory, basename, and extension.

    For 'chrome/browser/browser.cc', Split() would
    return ('chrome/browser', 'browser', '.cc')

    Returns:
      A tuple of (directory, basename, extension).

Splits the file into the directory basename and extension .


def Func ( arg_0 = False ) : _set_config_is_locked ( False ) _CONFIG . clear ( ) _SINGLETONS . clear ( ) if arg_0 : _CONSTANTS . clear ( ) else : arg_1 = _CONSTANTS . copy ( ) _CONSTANTS . clear ( ) for arg_2 , arg_3 in six . iteritems ( arg_1 ) : constant ( arg_2 , arg_3 ) _IMPORTED_MODULES . clear ( ) _OPERATIVE_CONFIG . clear ( )

def Func(arg_0=False):
  """Clears the global configuration.

  This clears any parameter values set by `bind_parameter` or `parse_config`, as
  well as the set of dynamically imported modules. It does not remove any
  configurable functions or classes from the registry of configurables.

  Args:
    clear_constants: Whether to clear constants created by `constant`. Defaults
      to False.
  """
  _set_config_is_locked(False)
  _CONFIG.clear()
  _SINGLETONS.clear()
  if arg_0:
    _CONSTANTS.clear()
  else:
    arg_1 = _CONSTANTS.copy()
    _CONSTANTS.clear()  # Clear then redefine constants (re-adding bindings).
    for arg_2, arg_3 in six.iteritems(arg_1):
      constant(arg_2, arg_3)
  _IMPORTED_MODULES.clear()
  _OPERATIVE_CONFIG.clear()


(xl_path: str, sheetnames=None, add_tab_names=False)

return pd.concat([sheets[tab] for tab in sheets])

def Func ( arg_0 : arg_1 , arg_2 = None , arg_3 = False ) : arg_0 , arg_4 = _check_xl_path ( arg_0 ) if arg_2 is None : arg_2 = get_sheet_list ( arg_0 ) arg_5 = pd . read_excel ( arg_0 , sheetname = arg_2 ) if arg_3 : for arg_6 in arg_5 : arg_5 [ arg_6 ] [ 'Tab' ] = [ arg_6 ] * len ( arg_5 [ arg_6 ] ) return pd . concat ( [ arg_5 [ arg_6 ] for arg_6 in arg_5 ] )

def Func(arg_0: arg_1, arg_2=None, arg_3=False):
    """ Return a pandas DataFrame with the concat'ed
    content of the `sheetnames` from the Excel file in
    `xl_path`.

    Parameters
    ----------
    xl_path: str
        Path to the Excel file

    sheetnames: list of str
        List of existing sheet names of `xl_path`.
        If None, will use all sheets from `xl_path`.

    add_tab_names: bool
        If True will add a 'Tab' column which says from which
        tab the row comes from.

    Returns
    -------
    df: pandas.DataFrame
    """
    arg_0, arg_4 = _check_xl_path(arg_0)

    if arg_2 is None:
        arg_2 = get_sheet_list(arg_0)

    arg_5 = pd.read_excel(arg_0, sheetname=arg_2)

    if arg_3:
        for arg_6 in arg_5:
            arg_5[arg_6]['Tab'] = [arg_6] * len(arg_5[arg_6])

    return pd.concat([arg_5[arg_6] for arg_6 in arg_5])

Return a pandas DataFrame with the concat ed content of the sheetnames from the Excel file in xl_path .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . _get_version_info ( arg_2 [ 'version' ] ) arg_4 = arg_2 [ 'flags' ] arg_5 = dict ( ( i , str ( int ( j ) ) ) for i , j in arg_2 [ 'flags' ] . iteritems ( ) ) arg_5 = '' . join ( arg_3 [ 'flags' ] ( ** arg_5 ) ) arg_5 = int ( arg_5 , 2 ) arg_2 [ 'flags' ] = arg_5 arg_6 = arg_3 [ 'header' ] arg_6 = arg_6 ( ** arg_2 ) arg_6 = pack ( arg_3 [ 'header_format' ] , * arg_6 ) if 'timestamp' in arg_4 and arg_4 [ 'timestamp' ] : arg_7 = long ( time ( ) ) arg_7 = pack ( arg_3 [ 'timestamp_format' ] , arg_7 ) arg_6 = arg_6 + arg_7 return arg_6 + arg_1

def Func(arg_0, arg_1, arg_2):
        '''Add header to data'''

        # pylint: disable=W0142

        arg_3 = arg_0._get_version_info(arg_2['version'])

        arg_4 = arg_2['flags']

        arg_5 = dict(
            (i, str(int(j))) for i, j in arg_2['flags'].iteritems())
        arg_5 = ''.join(arg_3['flags'](**arg_5))
        arg_5 = int(arg_5, 2)
        arg_2['flags'] = arg_5

        arg_6 = arg_3['header']
        arg_6 = arg_6(**arg_2)
        arg_6 = pack(arg_3['header_format'], *arg_6)

        if 'timestamp' in arg_4 and arg_4['timestamp']:
            arg_7 = long(time())
            arg_7 = pack(arg_3['timestamp_format'], arg_7)
            arg_6 = arg_6 + arg_7

        return arg_6 + arg_1


def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
u'json'
)
:
if
arg_3
not
in
arg_0
.
allowed_formats
:
raise
web
.
HTTPError
(
415
,
u'Invalid notebook format: %s'
%
arg_3
)
try
:
arg_4
=
current
.
reads
(
arg_1
.
decode
(
'utf-8'
)
,
arg_3
)
except
:
raise
web
.
HTTPError
(
400
,
u'Invalid JSON data'
)
if
arg_2
is
:
try
:
arg_2
=
arg_4
.
metadata
.
name
except
AttributeError
:
raise
web
.
HTTPError
(
400
,
u'Missing notebook name'
)
arg_4
.
metadata
.
name
=
arg_2
arg_6
=
arg_0
.
new_notebook_id
(
arg_2
)
arg_0
.
save_notebook_object
(
arg_6
,
arg_4
)
return
arg_6

def Func(arg_0, arg_1, arg_2=None, arg_3=u'json'):
        """Save a new notebook and return its notebook_id.

        If a name is passed in, it overrides any values in the notebook data
        and the value in the data is updated to use that value.
        """
        if arg_3 not in arg_0.allowed_formats:
            raise web.HTTPError(415, u'Invalid notebook format: %s' % arg_3)

        try:
            arg_4 = current.reads(arg_1.decode('utf-8'), arg_3)
        except:
            raise web.HTTPError(400, u'Invalid JSON data')

        if arg_2 is None:
            try:
                arg_2 = arg_4.metadata.name
            except AttributeError:
                raise web.HTTPError(400, u'Missing notebook name')
        arg_4.metadata.name = arg_2

        arg_6 = arg_0.new_notebook_id(arg_2)
        arg_0.save_notebook_object(arg_6, arg_4)
        return arg_6

Save a new notebook and return its notebook_id .


def
Func
(
)
:
arg_0
=
[
]
for
arg_1
in
TASKS
:
try
:
arg_2
,
arg_3
=
arg_1
.
rsplit
(
'.'
,
1
)
except
ValueError
:
raise
ImproperlyConfigured
(
'%s isn\'t a task module'
%
arg_1
)
try
:
arg_4
=
import_module
(
arg_2
)
except
ImportError
as
e
:
raise
ImproperlyConfigured
(
'Error importing task %s: "%s"'
%
(
arg_2
,
e
)
)
try
:
arg_5
=
getattr
(
arg_4
,
arg_3
)
except
AttributeError
:
raise
ImproperlyConfigured
(
'Task module "%s" does not define a '
'"%s" class'
%
(
arg_2
,
arg_3
)
)
arg_0
.
append
(
arg_5
)
return
arg_0

def Func():
    """Get the imported task classes for each task that will be run"""
    arg_0 = []
    for arg_1 in TASKS:
        try:
            arg_2, arg_3 = arg_1.rsplit('.', 1)
        except ValueError:
            raise ImproperlyConfigured('%s isn\'t a task module' % arg_1)
        try:
            arg_4 = import_module(arg_2)
        except ImportError as e:
            raise ImproperlyConfigured('Error importing task %s: "%s"'
                                       % (arg_2, e))
        try:
            arg_5 = getattr(arg_4, arg_3)
        except AttributeError:
            raise ImproperlyConfigured('Task module "%s" does not define a '
                                       '"%s" class' % (arg_2, arg_3))
        arg_0.append(arg_5)
    return arg_0


def Func(arg_0, arg_1, arg_2="00000000"):
        """ Serial Call to set meter password.  USE WITH CAUTION.

        Args:
            new_pwd (str): 8 digit numeric password to set
            pwd (str): Old 8 digit numeric password.

        Returns:
            bool: True on completion with ACK.
        """
        arg_3 = False
        arg_0.setContext("Func")
        try:
            if len(arg_1) != 8 or len(arg_2) != 8:
                arg_0.writeCmdMsg("Passwords must be exactly eight characters.")
                arg_0.setContext("")
                return arg_3

            if not arg_0.request(False):
                arg_0.writeCmdMsg("Pre command read failed: check serial line.")
            else:
                if not arg_0.serialCmdPwdAuth(arg_2):
                    arg_0.writeCmdMsg("Password failure")
                else:
                    arg_4 = binascii.hexlify(arg_1.zfill(8))
                    arg_5 = "015731023030323028" + arg_4 + "2903"
                    arg_5 += arg_0.calc_crc16(arg_5[2:].decode("hex"))
                    arg_0.m_serial_port.write(arg_5.decode("hex"))
                    if arg_0.m_serial_port.getResponse(arg_0.getContext()).encode("hex") == "06":
                        arg_0.writeCmdMsg("Success(Func): 06 returned.")
                        arg_3 = True
            arg_0.serialPostEnd()
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        arg_0.setContext("")
        return arg_3

Serial Call to set meter password . USE WITH CAUTION .


(self, types=None, scopes=None, timeout=3)

return self._filterServices(list(self._remoteServices.values()), types, scopes)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
,
arg_3
=
3
)
:
if
not
arg_0
.
_serverStarted
:
raise
Exception
(
"Server not started"
)
arg_0
.
_sendProbe
(
arg_1
,
arg_2
)
time
.
sleep
(
arg_3
)
return
arg_0
.
_filterServices
(
list
(
arg_0
.
_remoteServices
.
values
(
)
)
,
arg_1
,
arg_2
)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=3):
        'search for services given the TYPES and SCOPES in a given TIMEOUT'

        if not arg_0._serverStarted:
            raise Exception("Server not started")

        arg_0._sendProbe(arg_1, arg_2)

        time.sleep(arg_3)

        return arg_0._filterServices(list(arg_0._remoteServices.values()), arg_1, arg_2)


return hmac.new(secret, digestmod=hashlib.sha256,
                    msg=payload).hexdigest()

def Func ( arg_0 , arg_1 ) : arg_0 = _encode ( arg_0 ) arg_1 = _encode ( arg_1 ) return hmac . new ( arg_1 , digestmod = hashlib . sha256 , msg = arg_0 ) . hexdigest ( )

def Func(arg_0, arg_1):
    '''use an endpoint specific payload and client secret to generate
    a signature for the request'''
    arg_0 = _encode(arg_0)
    arg_1 = _encode(arg_1)
    return hmac.new(arg_1, digestmod=hashlib.sha256,
                    msg=arg_0).hexdigest()


(http, path, root=METADATA_ROOT, recursive=None)

def Func(arg_0, arg_1, arg_2=arg_3, arg_4=None):
    """Fetch a resource from the metadata server.

    Args:
        http: an object to be used to make HTTP requests.
        path: A string indicating the resource to retrieve. For example,
            'instance/service-accounts/default'
        root: A string indicating the full path to the metadata server root.
        recursive: A boolean indicating whether to do a recursive query of
            metadata. See
            https://cloud.google.com/compute/docs/metadata#aggcontents

    Returns:
        A dictionary if the metadata server returns JSON, otherwise a string.

    Raises:
        http_client.HTTPException if an error corrured while
        retrieving metadata.
    """
    arg_5 = urlparse.urljoin(arg_2, arg_1)
    arg_5 = _helpers._add_query_parameter(arg_5, 'recursive', arg_4)

    arg_6, arg_7 = transport.request(
        arg_0, arg_5, headers=METADATA_HEADERS)

    if arg_6.status == http_client.OK:
        arg_8 = _helpers._from_bytes(arg_7)
        if arg_6['content-type'] == 'application/json':
            return json.loads(arg_8)
        else:
            return arg_8
    else:
        raise http_client.HTTPException(
            'Failed to retrieve {0} from the Google Compute Engine'
            'metadata service. Response:\n{1}'.format(arg_5, arg_6))

Fetch a resource from the metadata server .


def Func ( arg_0 ) : arg_1 = arg_0 . maparr arg_2 = np . zeros ( arg_1 . shape [ 0 ] , dtype = np . uint64 ) for arg_3 in xrange ( arg_1 . shape [ 0 ] ) : arg_2 [ arg_3 ] = np . random . randint ( arg_1 [ arg_3 , 0 ] , arg_1 [ arg_3 , 1 ] , 1 ) return arg_2

def Func(arg_0):
        """ returns a subsample of unlinked snp sites """
        arg_1 = arg_0.maparr
        arg_2 = np.zeros(arg_1.shape[0], dtype=np.uint64)
        for arg_3 in xrange(arg_1.shape[0]):
            arg_2[arg_3] = np.random.randint(arg_1[arg_3, 0], arg_1[arg_3, 1], 1)
        return arg_2


def Func(arg_0, arg_1):
        """
        Receives a message, and either sets it immediately, or puts it on the
        edit queue if there is one.

        """
        if arg_0.edit_queue:
            arg_0.edit_queue.put_edit(arg_0._set, arg_1)
        else:
            arg_0._set(arg_1)

Receives a message and either sets it immediately or puts it on the edit queue if there is one .


return merged[..., 0].astype(np.uint8), (yoffset, xoffset)

def
Func
(
arg_0
)
:
if
type
(
arg_0
)
!=
ImageCollection
:
arg_0
=
ImageCollection
(
arg_0
)
calc_translations_parallel
(
arg_0
)
_translation_warn
(
arg_0
)
arg_1
,
arg_2
=
arg_0
.
median_translation
(
)
if
arg_2
!=
arg_1
:
warn
(
'yoffset != xoffset: %s != %s'
%
(
arg_1
,
arg_2
)
)
arg_3
,
arg_4
=
imread
(
arg_0
[
0
]
.
path
)
.
shape
arg_5
=
arg_3
*
len
(
arg_0
.
rows
)
+
arg_1
*
(
len
(
arg_0
.
rows
)
1
)
arg_6
=
arg_4
*
len
(
arg_0
.
cols
)
+
arg_2
*
(
len
(
arg_0
.
cols
)
1
)
arg_7
=
np
.
zeros
(
(
arg_5
,
arg_6
,
2
)
,
dtype
=
np
.
int
)
for
arg_8
in
arg_0
:
arg_9
,
arg_10
=
arg_8
.
row
,
arg_8
.
col
arg_11
=
_merge_slice
(
arg_9
,
arg_10
,
arg_3
,
arg_4
,
arg_1
,
arg_2
)
arg_12
=
_add_ones_dim
(
imread
(
arg_8
.
path
)
)
arg_7
[
arg_11
]
+=
arg_12
arg_7
[
...
,
0
]
/=
arg_7
[
...
,
1
]
return
arg_7
[
...
,
0
]
.
astype
(
np
.
uint8
)
,
(
arg_1
,
arg_2
)

def Func(arg_0):
    """Stitch regular spaced images.

    Parameters
    ----------
    images : ImageCollection or list of tuple(path, row, column)
        Each image-tuple should contain path, row and column. Row 0,
        column 0 is top left image.

        Example:
        >>> images = [('1.png', 0, 0), ('2.png', 0, 1)]

    Returns
    -------
    tuple (Funced, offset)
        Stitched image and registered offset (y, x).
    """
    if type(arg_0) != ImageCollection:
        arg_0 = ImageCollection(arg_0)
    calc_translations_parallel(arg_0)
    _translation_warn(arg_0)

    arg_1, arg_2 = arg_0.median_translation()

    if arg_2 != arg_1:
        warn('yoffset != xoffset: %s != %s' % (arg_1, arg_2))

    # assume all images have the same shape
    arg_3, arg_4 = imread(arg_0[0].path).shape
    arg_5 = arg_3*len(arg_0.rows) + arg_1*(len(arg_0.rows)-1)
    arg_6 = arg_4*len(arg_0.cols) + arg_2*(len(arg_0.cols)-1)

    # last dimension is number of images on top of each other
    arg_7 = np.zeros((arg_5, arg_6, 2), dtype=np.int)
    for arg_8 in arg_0:
        arg_9, arg_10 = arg_8.row, arg_8.col
        arg_11 = _merge_slice(arg_9, arg_10, arg_3, arg_4, arg_1, arg_2)
        # last dim is used for averaging the seam
        arg_12 = _add_ones_dim(imread(arg_8.path))
        arg_7[arg_11] += arg_12

    # average seam, possible improvement: use gradient
    arg_7[..., 0] /= arg_7[..., 1]

    return arg_7[..., 0].astype(np.uint8), (arg_1, arg_2)

Stitch regular spaced images.

    Parameters
    ----------
    images : ImageCollection or list of tuple(path, row, column)
        Each image-tuple should contain path, row and column. Row 0,
        column 0 is top left image.

        Example:
        >>> images = [('1.png', 0, 0), ('2.png', 0, 1)]

    Returns
    -------
    tuple (stitched, offset)
        Stitched image and registered offset (y, x).


def Func ( arg_0 , arg_1 , arg_2 , ** arg_3 ) : if arg_2 is None : return HttpResponse ( status = 204 ) arg_4 = arg_0 . render_to_standalone_html ( arg_1 , arg_2 , ** arg_3 ) return HttpResponse ( arg_4 )

def Func(arg_0, arg_1, arg_2, **arg_3):  # pylint: disable=unused-argument
        """
        Renders a standalone page as a response for the specified fragment.
        """
        if arg_2 is None:
            return HttpResponse(status=204)

        arg_4 = arg_0.render_to_standalone_html(arg_1, arg_2, **arg_3)
        return HttpResponse(arg_4)

Renders a standalone page as a response for the specified fragment .


(in_path, boundaries_id=msaf.config.default_bound_id,
            labels_id=msaf.config.default_label_id, annot_beats=False,
            framesync=False, feature="pcp", hier=False, save=False,
            out_file=None, n_jobs=4, annotator_id=0, config=None)

def Func(arg_0, arg_1=arg_2.config.default_bound_id,
            arg_5=arg_2.config.default_label_id, arg_7=False,
            arg_8=False, arg_9="pcp", arg_10=False, arg_11=False,
            arg_12=None, arg_13=4, arg_14=0, arg_3=None):
    """Main Func to evaluate algorithms' results.

    Parameters
    ----------
    in_path : str
        Path to the dataset root folder.
    boundaries_id : str
        Boundaries algorithm identifier (e.g. siplca, cnmf)
    labels_id : str
        Labels algorithm identifier (e.g. siplca, cnmf)
    ds_name : str
        Name of the dataset to be evaluated (e.g. SALAMI). * stands for all.
    annot_beats : boolean
        Whether to use the annotated beats or not.
    framesync: str
        Whether to use framesync features or not (default: False -> beatsync)
    feature: str
        String representing the feature to be used (e.g. pcp, mfcc, tonnetz)
    hier : bool
        Whether to compute a hierarchical or flat segmentation.
    save: boolean
        Whether to save the results into the `out_file` csv file.
    out_file: str
        Path to the csv file to save the results (if `None` and `save = True`
        it will save the results in the default file name obtained by
        calling `get_results_file_name`).
    n_jobs: int
        Number of Funces to run in parallel. Only available in collection
        mode.
    annotator_id : int
        Number identifiying the annotator.
    config: dict
        Dictionary containing custom configuration parameters for the
        algorithms.  If None, the default parameters are used.

    Return
    ------
    results : pd.DataFrame
        DataFrame containing the evaluations for each file.
    """

    # Set up configuration based on algorithms parameters
    if arg_3 is None:
        arg_3 = io.get_configuration(arg_9, arg_7, arg_8,
                                      arg_1, arg_5)

    # Hierarchical segmentation
    arg_3["hier"] = arg_10

    # Remove actual features
    arg_3.pop("features", None)

    # Get out file in case we want to save results
    if arg_12 is None:
        arg_12 = get_results_file_name(arg_1, arg_5, arg_3,
                                         arg_14)

    # If out_file already exists, read and return them
    if os.path.exists(arg_12):
        logging.warning("Results already exists, reading from file %s" %
                        arg_12)
        arg_15 = pd.read_csv(arg_12)
        print_results(arg_15)
        return arg_15

    # Perform actual evaluations
    if os.path.isfile(arg_0):
        # Single File mode
        arg_16 = [Func_track(arg_0, arg_1, arg_5, arg_3,
                               arg_14=arg_14)]
    else:
        # Collection mode
        # Get files
        arg_17 = io.get_dataset_files(arg_0)

        # Evaluate in parallel
        logging.info("Evaluating %d tracks..." % len(arg_17))
        arg_16 = Parallel(arg_13=arg_13)(delayed(Func_track)(
            file_struct, arg_1, arg_5, arg_3,
            arg_14=arg_14) for file_struct in arg_17[:])

    # Aggregate evaluations in pandas format
    arg_15 = pd.DataFrame()
    for arg_18 in arg_16:
        if arg_18 != []:
            arg_15 = arg_15.append(arg_18, ignore_index=True)
    logging.info("%d tracks analyzed" % len(arg_15))

    # Print results
    print_results(arg_15)

    # Save all results
    if arg_11:
        logging.info("Writing results in %s" % arg_12)
        arg_15.to_csv(arg_12)

    return arg_15

Main process to evaluate algorithms' results.

    Parameters
    ----------
    in_path : str
        Path to the dataset root folder.
    boundaries_id : str
        Boundaries algorithm identifier (e.g. siplca, cnmf)
    labels_id : str
        Labels algorithm identifier (e.g. siplca, cnmf)
    ds_name : str
        Name of the dataset to be evaluated (e.g. SALAMI). * stands for all.
    annot_beats : boolean
        Whether to use the annotated beats or not.
    framesync: str
        Whether to use framesync features or not (default: False -> beatsync)
    feature: str
        String representing the feature to be used (e.g. pcp, mfcc, tonnetz)
    hier : bool
        Whether to compute a hierarchical or flat segmentation.
    save: boolean
        Whether to save the results into the `out_file` csv file.
    out_file: str
        Path to the csv file to save the results (if `None` and `save = True`
        it will save the results in the default file name obtained by
        calling `get_results_file_name`).
    n_jobs: int
        Number of processes to run in parallel. Only available in collection
        mode.
    annotator_id : int
        Number identifiying the annotator.
    config: dict
        Dictionary containing custom configuration parameters for the
        algorithms.  If None, the default parameters are used.

    Return
    ------
    results : pd.DataFrame
        DataFrame containing the evaluations for each file.

Main process to evaluate algorithms results .


def Func ( arg_0 , arg_1 ) : if type ( arg_1 ) is str : if arg_1 . lower ( ) == 'true' : arg_1 = True elif arg_1 . lower ( ) == 'false' : arg_1 = False return ( arg_0 , arg_1 )

def Func(arg_0,arg_1):
    '''
    Converts string values to booleans when appropriate
    '''
    if type(arg_1) is str:
        if arg_1.lower() == 'true':
            arg_1=True
        elif arg_1.lower() == 'false':
            arg_1=False
    return (arg_0,arg_1)


def Func ( arg_0 ) : arg_1 = H2OFrame . _expr ( expr = ExprNode ( "Func" , arg_0 ) ) arg_1 . _ex . _cache . nrows = arg_0 . nrow arg_1 . _ex . _cache . ncol = arg_0 . ncol return arg_1

def Func(arg_0):
        """
        For each string compute its Shannon Func, if the string is empty the Func is 0.

        :returns: an H2OFrame of Shannon entropies.
        """
        arg_1 = H2OFrame._expr(expr=ExprNode("Func", arg_0))
        arg_1._ex._cache.nrows = arg_0.nrow
        arg_1._ex._cache.ncol = arg_0.ncol
        return arg_1

For each string compute its Shannon entropy, if the string is empty the entropy is 0.

        :returns: an H2OFrame of Shannon entropies.

For each string compute its Shannon entropy if the string is empty the entropy is 0 .


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in range ( 0 , len ( arg_0 ) , MAXBINSIZE ) : arg_3 = arg_0 [ arg_2 : arg_2 + MAXBINSIZE ] arg_1 . append ( binascii . b2a_base64 ( arg_3 ) ) return "" . join ( arg_1 )

def Func(arg_0):
    """Encode a string into multiple lines of base-64 data."""
    arg_1 = []
    for arg_2 in range(0, len(arg_0), MAXBINSIZE):
        arg_3 = arg_0[arg_2 : arg_2 + MAXBINSIZE]
        arg_1.append(binascii.b2a_base64(arg_3))
    return "".join(arg_1)

Encode a string into multiple lines of base - 64 data .


def Func ( arg_0 , arg_1 ) : for arg_2 in arg_0 . dirs : if arg_1 . startswith ( arg_2 ) : if arg_1 == arg_2 : return True if arg_1 [ len ( arg_2 ) ] == os . sep : return True return False

def Func(arg_0, arg_1):
        """Does `fpath` indicate a file in one of our trees?"""
        for arg_2 in arg_0.dirs:
            if arg_1.startswith(arg_2):
                if arg_1 == arg_2:
                    # This is the same file!
                    return True
                if arg_1[len(arg_2)] == os.sep:
                    # This is a file in the directory
                    return True
        return False

Does fpath indicate a file in one of our trees?


Yield successive chunks of a given size from a list of items

def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
<=
0
:
raise
ValueError
(
'Chunk size must be a positive integer'
)
for
arg_2
in
range
(
0
,
len
(
arg_0
)
,
arg_1
)
:
yield
arg_0
[
arg_2
:
arg_2
+
arg_1
]

def Func(arg_0, arg_1):
    """
    Yield successive Func of a given size from a list of items
    """
    if arg_1 <= 0:
        raise ValueError('Chunk size must be a positive integer')
    for arg_2 in range(0, len(arg_0), arg_1):
        yield arg_0[arg_2:arg_2 + arg_1]


def Func ( arg_0 ) : arg_1 = { 'source' , 'source_ref' , 'source:ref' , 'history' , 'attribution' , 'created_by' , 'tiger:tlid' , 'tiger:upload_uuid' , } arg_2 = { 'id' : arg_0 [ 'id' ] , 'lat' : arg_0 [ 'lat' ] , 'lon' : arg_0 [ 'lon' ] } if 'tags' in arg_0 : for arg_3 , arg_4 in list ( arg_0 [ 'tags' ] . items ( ) ) : if arg_3 not in arg_1 : arg_2 [ arg_3 ] = arg_4 return arg_2

def Func(arg_0):
    """
    Process a node element entry into a dict suitable for going into
    a Pandas DataFrame.

    Parameters
    ----------
    e : dict
    Returns
    -------
    node : dict
    """

    arg_1 = {
        'source',
        'source_ref',
        'source:ref',
        'history',
        'attribution',
        'created_by',
        'tiger:tlid',
        'tiger:upload_uuid',
    }

    arg_2 = {
        'id': arg_0['id'],
        'lat': arg_0['lat'],
        'lon': arg_0['lon']
    }

    if 'tags' in arg_0:
        for arg_3, arg_4 in list(arg_0['tags'].items()):
            if arg_3 not in arg_1:
                arg_2[arg_3] = arg_4

    return arg_2

Process a node element entry into a dict suitable for going into a Pandas DataFrame .


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : arg_3 = copy . copy ( arg_0 ) _bound_waveform ( arg_3 , arg_1 , arg_2 ) arg_4 = np . diff ( arg_3 . _indep_vector ) arg_5 = np . diff ( arg_3 . _dep_vector ) arg_4 = np . concatenate ( ( np . array ( [ arg_4 [ 0 ] ] ) , arg_4 ) ) arg_5 = np . concatenate ( ( np . array ( [ arg_5 [ 0 ] ] ) , arg_5 ) ) arg_3 . _dep_vector = np . divide ( arg_5 , arg_4 ) arg_3 . dep_name = "Func({0})" . format ( arg_3 . _dep_name ) arg_3 . dep_units = _build_units ( arg_3 . indep_units , arg_3 . dep_units , "/" ) return arg_3

def Func(arg_0, arg_1=None, arg_2=None):
    r"""
    Return the numerical Func of a waveform's dependent variable vector.

    The method used is the `backwards differences
    <https://en.wikipedia.org/wiki/
    Finite_difference#Forward.2C_backward.2C_and_central_differences>`_ method

    :param wave: Waveform
    :type  wave: :py:class:`peng.eng.Waveform`

    :param indep_min: Independent vector start point of computation
    :type  indep_min: integer or float

    :param indep_max: Independent vector stop point of computation
    :type  indep_max: integer or float

    :rtype: float

    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]
    .. Auto-generated exceptions documentation for
    .. peng.wave_functions.Func

    :raises:
     * RuntimeError (Argument \`indep_max\` is not valid)

     * RuntimeError (Argument \`indep_min\` is not valid)

     * RuntimeError (Argument \`wave\` is not valid)

     * RuntimeError (Incongruent \`indep_min\` and \`indep_max\`
       arguments)

    .. [[[end]]]
    """
    arg_3 = copy.copy(arg_0)
    _bound_waveform(arg_3, arg_1, arg_2)
    arg_4 = np.diff(arg_3._indep_vector)
    arg_5 = np.diff(arg_3._dep_vector)
    arg_4 = np.concatenate((np.array([arg_4[0]]), arg_4))
    arg_5 = np.concatenate((np.array([arg_5[0]]), arg_5))
    arg_3._dep_vector = np.divide(arg_5, arg_4)
    arg_3.dep_name = "Func({0})".format(arg_3._dep_name)
    arg_3.dep_units = _build_units(arg_3.indep_units, arg_3.dep_units, "/")
    return arg_3

r"""
    Return the numerical derivative of a waveform's dependent variable vector.

    The method used is the `backwards differences
    <https://en.wikipedia.org/wiki/
    Finite_difference#Forward.2C_backward.2C_and_central_differences>`_ method

    :param wave: Waveform
    :type  wave: :py:class:`peng.eng.Waveform`

    :param indep_min: Independent vector start point of computation
    :type  indep_min: integer or float

    :param indep_max: Independent vector stop point of computation
    :type  indep_max: integer or float

    :rtype: float

    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]
    .. Auto-generated exceptions documentation for
    .. peng.wave_functions.derivative

    :raises:
     * RuntimeError (Argument \`indep_max\` is not valid)

     * RuntimeError (Argument \`indep_min\` is not valid)

     * RuntimeError (Argument \`wave\` is not valid)

     * RuntimeError (Incongruent \`indep_min\` and \`indep_max\`
       arguments)

    .. [[[end]]]

r Return the numerical derivative of a waveform s dependent variable vector .


def Func(arg_0, arg_1):
  """Creates `dist_fn_wrapped` which calls `dist_fn` with all prev nodes.

  Args:
    i: Python `int` corresponding to position in topologically sorted DAG.
    dist_fn: Python `callable` which takes a subset of previously constructed
      distributions (in reverse order) and produces a new distribution instance.

  Returns:
    dist_fn_wrapped: Python `callable` which takes all previous distributions
      (in non reverse order) and produces a  new distribution instance.
    args: `tuple` of `str` representing the arg names of `dist_fn` (and in non
      wrapped, "natural" order). `None` is returned only if the input is not a
      `callable`.
  """
  if distribution_util.is_distribution_instance(arg_1):
    return (lambda *_: arg_1), None

  if not callable(arg_1):
    raise TypeError('{} must be either `tfd.Distribution`-like or '
                    '`callable`.'.format(arg_1))

  arg_2 = _get_required_args(arg_1)
  if not arg_2:
    return (lambda *_: arg_1()), ()

  @functools.wraps(arg_1)
  def dist_fn_wrapped(*arg_3):
    """Calls `dist_fn` with reversed and truncated args."""
    if arg_0 != len(arg_3):
      raise ValueError(
          'Internal Error: Unexpected number of inputs provided to {}-th '
          'distribution maker (dist_fn: {}, expected: {}, saw: {}).'.format(
              arg_0, arg_1, arg_0, len(arg_3)))
    if len(arg_3) < len(arg_2):
      raise ValueError(
          'Internal Error: Too few inputs provided to {}-th distribution maker '
          '(dist_fn: {}, expected: {}, saw: {}).'.format(
              arg_0, arg_1, len(arg_2), len(arg_3)))
    return arg_1(*reversed(arg_3[-len(arg_2):]))
  return dist_fn_wrapped, arg_2

Creates dist_fn_wrapped which calls dist_fn with all prev nodes .


def Func ( arg_0 , arg_1 ) : if ( arg_1 , RDF . type , arg_0 . spdx_namespace [ 'ExtractedLicensingInfo' ] ) in arg_0 . graph : return arg_0 . parse_only_extr_license ( arg_1 ) arg_2 = arg_1 . rfind ( '/' ) + 1 if arg_2 == 0 : arg_3 = arg_0 . to_special_value ( arg_1 ) if arg_3 == arg_1 : if arg_0 . LICS_REF_REGEX . match ( arg_1 ) : return document . License . from_identifier ( arg_1 ) else : raise SPDXValueError ( 'License' ) else : return arg_3 else : return document . License . from_identifier ( arg_1 [ arg_2 : ] )

def Func(arg_0, arg_1):
        """
        Return a License from a `lics` license resource.
        """
        # Handle extracted licensing info type.
        if (arg_1, RDF.type, arg_0.spdx_namespace['ExtractedLicensingInfo']) in arg_0.graph:
            return arg_0.parse_only_extr_license(arg_1)

        # Assume resource, hence the path separator
        arg_2 = arg_1.rfind('/') + 1
        if arg_2 == 0:
            # special values such as spdx:noassertion
            arg_3 = arg_0.to_special_value(arg_1)
            if arg_3 == arg_1:
                if arg_0.LICS_REF_REGEX.match(arg_1):
                    # Is a license ref i.e LicenseRef-1
                    return document.License.from_identifier(arg_1)
                else:
                    # Not a known license form
                    raise SPDXValueError('License')
            else:
                # is a special value
                return arg_3
        else:
            # license url
            return document.License.from_identifier(arg_1[arg_2:])

Return a License from a lics license resource .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 = False ) : arg_4 = arg_0 . trim ( arg_1 , arg_2 , arg_3 = arg_3 ) arg_5 = arg_4 . pop_data ( ) for arg_6 in arg_5 : arg_7 = max ( 0 , arg_6 . time - arg_1 ) arg_4 . append ( arg_11 = arg_7 , duration = arg_6 . duration , value = arg_6 . value , confidence = arg_6 . confidence ) arg_8 = arg_4 . time arg_9 = arg_8 arg_10 = arg_8 + arg_4 . duration if 'Func' not in arg_4 . sandbox . keys ( ) : arg_4 . sandbox . update ( Func = [ { 'start_time' : arg_1 , 'end_time' : arg_2 , 'Func_start' : arg_9 , 'Func_end' : arg_10 } ] ) else : arg_4 . sandbox . Func . append ( { 'start_time' : arg_1 , 'end_time' : arg_2 , 'Func_start' : arg_9 , 'Func_end' : arg_10 } ) arg_4 . time = max ( 0 , arg_8 - arg_1 ) return arg_4

def Func(arg_0, arg_1, arg_2, arg_3=False):
        '''
        Slice the annotation and return as a new `Annotation` object.

        Slicing has the same effect as trimming (see `Annotation.trim`) except
        that while trimming does not modify the start time of the annotation or
        the observations it contains, slicing will set the new annotation's
        start time to ``max(0, trimmed_annotation.time - start_time)`` and the
        start time of its observations will be set with respect to this new
        reference start time.

        This function documents the Func operation by adding a list of tuples
        to the annotation's sandbox keyed by ``Annotation.sandbox.Func`` which
        documents each Func operation with a tuple
        ``(start_time, end_time, Func_start, Func_end)``, where
        ``Func_start`` and ``Func_end`` are given by ``trim_start`` and
        ``trim_end`` (see `Annotation.trim`).

        Since slicing is implemented  using trimming, the trimming operation
        will also be documented in ``Annotation.sandbox.trim`` as described in
        `Annotation.trim`.

        This function is useful for example when trimming an audio file,
        allowing the user to trim the annotation while ensuring all time
        information matches the new trimmed audio file.

        Parameters
        ----------
        start_time : float
            The desired start time for slicing in seconds.
        end_time
            The desired end time for slicing in seconds. Must be greater than
            ``start_time``.
        strict : bool
            When ``False`` (default) observations that lie at the boundaries of
            the Func (see `Annotation.trim` for details) will have their time
            and/or duration adjusted such that only the part of the observation
            that lies within the Func range is kept. When ``True`` such
            observations are discarded and not included in the Funcd
            annotation.

        Returns
        -------
        Funcd_ann : Annotation
            The Funcd annotation.

        See Also
        --------
        Annotation.trim

        Examples
        --------
        >>> ann = jams.Annotation(namespace='tag_open', time=2, duration=8)
        >>> ann.append(time=2, duration=2, value='one')
        >>> ann.append(time=4, duration=2, value='two')
        >>> ann.append(time=6, duration=2, value='three')
        >>> ann.append(time=7, duration=2, value='four')
        >>> ann.append(time=8, duration=2, value='five')
        >>> ann_Func = ann.Func(5, 8, strict=False)
        >>> print(ann_Func.time, ann_Func.duration)
        (0, 3)
        >>> ann_Func.to_dataframe()
           time  duration  value confidence
        0   0.0       1.0    two       None
        1   1.0       2.0  three       None
        2   2.0       1.0   four       None
        >>> ann_Func_strict = ann.Func(5, 8, strict=True)
        >>> print(ann_Func_strict.time, ann_Func_strict.duration)
        (0, 3)
        >>> ann_Func_strict.to_dataframe()
           time  duration  value confidence
        0   1.0       2.0  three       None
        '''
        # start by trimming the annotation
        arg_4 = arg_0.trim(arg_1, arg_2, arg_3=arg_3)
        arg_5 = arg_4.pop_data()

        # now adjust the start time of the annotation and the observations it
        # contains.

        for arg_6 in arg_5:
            arg_7 = max(0, arg_6.time - arg_1)
            # if obs.time > start_time,
            #   duration doesn't change
            # if obs.time < start_time,
            #   duration shrinks by start_time - obs.time
            arg_4.append(arg_11=arg_7,
                              duration=arg_6.duration,
                              value=arg_6.value,
                              confidence=arg_6.confidence)

        arg_8 = arg_4.time
        arg_9 = arg_8
        arg_10 = arg_8 + arg_4.duration

        if 'Func' not in arg_4.sandbox.keys():
            arg_4.sandbox.update(
                Func=[{'start_time': arg_1, 'end_time': arg_2,
                        'Func_start': arg_9, 'Func_end': arg_10}])
        else:
            arg_4.sandbox.Func.append(
                {'start_time': arg_1, 'end_time': arg_2,
                 'Func_start': arg_9, 'Func_end': arg_10})

        # Update the timing for the Funcd annotation
        arg_4.time = max(0, arg_8 - arg_1)

        return arg_4

Slice the annotation and return as a new `Annotation` object.

        Slicing has the same effect as trimming (see `Annotation.trim`) except
        that while trimming does not modify the start time of the annotation or
        the observations it contains, slicing will set the new annotation's
        start time to ``max(0, trimmed_annotation.time - start_time)`` and the
        start time of its observations will be set with respect to this new
        reference start time.

        This function documents the slice operation by adding a list of tuples
        to the annotation's sandbox keyed by ``Annotation.sandbox.slice`` which
        documents each slice operation with a tuple
        ``(start_time, end_time, slice_start, slice_end)``, where
        ``slice_start`` and ``slice_end`` are given by ``trim_start`` and
        ``trim_end`` (see `Annotation.trim`).

        Since slicing is implemented  using trimming, the trimming operation
        will also be documented in ``Annotation.sandbox.trim`` as described in
        `Annotation.trim`.

        This function is useful for example when trimming an audio file,
        allowing the user to trim the annotation while ensuring all time
        information matches the new trimmed audio file.

        Parameters
        ----------
        start_time : float
            The desired start time for slicing in seconds.
        end_time
            The desired end time for slicing in seconds. Must be greater than
            ``start_time``.
        strict : bool
            When ``False`` (default) observations that lie at the boundaries of
            the slice (see `Annotation.trim` for details) will have their time
            and/or duration adjusted such that only the part of the observation
            that lies within the slice range is kept. When ``True`` such
            observations are discarded and not included in the sliced
            annotation.

        Returns
        -------
        sliced_ann : Annotation
            The sliced annotation.

        See Also
        --------
        Annotation.trim

        Examples
        --------
        >>> ann = jams.Annotation(namespace='tag_open', time=2, duration=8)
        >>> ann.append(time=2, duration=2, value='one')
        >>> ann.append(time=4, duration=2, value='two')
        >>> ann.append(time=6, duration=2, value='three')
        >>> ann.append(time=7, duration=2, value='four')
        >>> ann.append(time=8, duration=2, value='five')
        >>> ann_slice = ann.slice(5, 8, strict=False)
        >>> print(ann_slice.time, ann_slice.duration)
        (0, 3)
        >>> ann_slice.to_dataframe()
           time  duration  value confidence
        0   0.0       1.0    two       None
        1   1.0       2.0  three       None
        2   2.0       1.0   four       None
        >>> ann_slice_strict = ann.slice(5, 8, strict=True)
        >>> print(ann_slice_strict.time, ann_slice_strict.duration)
        (0, 3)
        >>> ann_slice_strict.to_dataframe()
           time  duration  value confidence
        0   1.0       2.0  three       None

Slice the annotation and return as a new Annotation object .


return [os.path.join(d, _pathify(app_name)) for d in paths]

def
Func
(
arg_0
,
arg_1
,
arg_2
=
True
)
:
if
WIN
:
arg_3
=
os
.
environ
.
get
(
'PROGRAMDATA'
)
return
[
os
.
path
.
join
(
arg_3
,
arg_1
,
arg_0
)
]
if
MAC
and
not
arg_2
:
return
[
os
.
path
.
join
(
'/Library/Application Support'
,
arg_0
)
]
arg_4
=
os
.
environ
.
get
(
'XDG_CONFIG_DIRS'
,
'/etc/xdg'
)
arg_5
=
[
os
.
path
.
expanduser
(
x
)
for
x
in
arg_4
.
split
(
os
.
pathsep
)
]
return
[
os
.
path
.
join
(
arg_6
,
_pathify
(
arg_0
)
)
for
arg_6
in
arg_5
]

def Func(arg_0, arg_1, arg_2=True):
    r"""Returns a list of system-wide config folders for the application.

    For an example application called ``"My App"`` by ``"Acme"``,
    something like the following folders could be returned:

    macOS (non-XDG):
      ``['/Library/Application Support/My App']``
    Mac OS X (XDG):
      ``['/etc/xdg/my-app']``
    Unix:
      ``['/etc/xdg/my-app']``
    Windows 7:
      ``['C:\ProgramData\Acme\My App']``

    :param app_name: the application name. This should be properly capitalized
                     and can contain whitespace.
    :param app_author: The app author's name (or company). This should be
                       properly capitalized and can contain whitespace.
    :param force_xdg: if this is set to `True`, then on macOS the XDG Base
                      Directory Specification will be followed. Has no effect
                      on non-macOS systems.

    """
    if WIN:
        arg_3 = os.environ.get('PROGRAMDATA')
        return [os.path.join(arg_3, arg_1, arg_0)]
    if MAC and not arg_2:
        return [os.path.join('/Library/Application Support', arg_0)]
    arg_4 = os.environ.get('XDG_CONFIG_DIRS', '/etc/xdg')
    arg_5 = [os.path.expanduser(x) for x in arg_4.split(os.pathsep)]
    return [os.path.join(arg_6, _pathify(arg_0)) for arg_6 in arg_5]

r Returns a list of system - wide config folders for the application .