(a, tol=None, validate_args=False, name=None)

def Func ( arg_0 , arg_1 = None , arg_2 = False , arg_3 = None ) : with tf . compat . v1 . name_scope ( arg_3 , 'Func' , [ arg_0 , arg_1 ] ) : arg_0 = tf . convert_to_tensor ( value = arg_0 , dtype_hint = tf . float32 , arg_3 = 'a' ) arg_4 = _maybe_validate_matrix ( arg_0 , arg_2 ) if arg_4 : with tf . control_dependencies ( arg_4 ) : arg_0 = tf . identity ( arg_0 ) arg_5 = tf . linalg . svd ( arg_0 , compute_uv = False ) if arg_1 is None : if arg_0 . shape [ - 2 : ] . is_fully_defined ( ) : arg_6 = np . max ( arg_0 . shape [ - 2 : ] . as_list ( ) ) else : arg_6 = tf . reduce_max ( input_tensor = tf . shape ( input = arg_0 ) [ - 2 : ] ) arg_7 = np . finfo ( arg_0 . dtype . as_numpy_dtype ) . eps arg_1 = ( arg_7 * tf . cast ( arg_6 , arg_0 . dtype ) * tf . reduce_max ( input_tensor = arg_5 , axis = - 1 , keepdims = True ) ) return tf . reduce_sum ( input_tensor = tf . cast ( arg_5 > arg_1 , tf . int32 ) , axis = - 1 )

def Func(arg_0, arg_1=None, arg_2=False, arg_3=None):
  """Compute the matrix rank; the number of non-zero SVD singular values.

  Arguments:
    a: (Batch of) `float`-like matrix-shaped `Tensor`(s) which are to be
      pseudo-inverted.
    tol: Threshold below which the singular value is counted as "zero".
      Default value: `None` (i.e., `eps * max(rows, cols) * max(singular_val)`).
    validate_args: When `True`, additional assertions might be embedded in the
      graph.
      Default value: `False` (i.e., no graph assertions are added).
    name: Python `str` prefixed to ops created by this function.
      Default value: "Func".

  Returns:
    Func: (Batch of) `int32` scalars representing the number of non-zero
      singular values.
  """
  with tf.compat.v1.name_scope(arg_3, 'Func', [arg_0, arg_1]):
    arg_0 = tf.convert_to_tensor(value=arg_0, dtype_hint=tf.float32, arg_3='a')
    arg_4 = _maybe_validate_matrix(arg_0, arg_2)
    if arg_4:
      with tf.control_dependencies(arg_4):
        arg_0 = tf.identity(arg_0)
    arg_5 = tf.linalg.svd(arg_0, compute_uv=False)
    if arg_1 is None:
      if arg_0.shape[-2:].is_fully_defined():
        arg_6 = np.max(arg_0.shape[-2:].as_list())
      else:
        arg_6 = tf.reduce_max(input_tensor=tf.shape(input=arg_0)[-2:])
      arg_7 = np.finfo(arg_0.dtype.as_numpy_dtype).eps
      arg_1 = (arg_7 * tf.cast(arg_6, arg_0.dtype) *
             tf.reduce_max(input_tensor=arg_5, axis=-1, keepdims=True))
    return tf.reduce_sum(input_tensor=tf.cast(arg_5 > arg_1, tf.int32), axis=-1)

Compute the matrix rank; the number of non-zero SVD singular values.

  Arguments:
    a: (Batch of) `float`-like matrix-shaped `Tensor`(s) which are to be
      pseudo-inverted.
    tol: Threshold below which the singular value is counted as "zero".
      Default value: `None` (i.e., `eps * max(rows, cols) * max(singular_val)`).
    validate_args: When `True`, additional assertions might be embedded in the
      graph.
      Default value: `False` (i.e., no graph assertions are added).
    name: Python `str` prefixed to ops created by this function.
      Default value: "matrix_rank".

  Returns:
    matrix_rank: (Batch of) `int32` scalars representing the number of non-zero
      singular values.

Compute the matrix rank ; the number of non - zero SVD singular values .


def Func ( arg_0 ) : arg_1 = 0 arg_2 = 0 for arg_3 in arg_0 . metrics : arg_1 = max ( arg_1 , len ( arg_3 [ 'displayName' ] ) ) arg_2 = max ( arg_2 , len ( arg_3 [ 'description' ] ) ) return ( arg_1 , arg_2 )

def Func(arg_0):
        """
        Gets the maximum length of each column
        """
        arg_1 = 0
        arg_2 = 0
        for arg_3 in arg_0.metrics:
            arg_1 = max(arg_1, len(arg_3['displayName']))
            arg_2 = max(arg_2, len(arg_3['description']))
        return (arg_1, arg_2)


return power_to_db(power, ref=ref_value**2, amin=amin**2,
                       top_db=top_db)

def Func(arg_0, arg_1=1.0, arg_2=1e-5, arg_3=80.0):
    '''Convert an amplitude spectrogram to dB-scaled spectrogram.

    This is equivalent to ``power_to_db(S**2)``, but is provided for convenience.

    Parameters
    ----------
    S : np.ndarray
        input amplitude

    ref : scalar or callable
        If scalar, the amplitude `abs(S)` is scaled relative to `ref`:
        `20 * log10(S / ref)`.
        Zeros in the output correspond to positions where `S == ref`.

        If callable, the reference value is computed as `ref(S)`.

    amin : float > 0 [scalar]
        minimum threshold for `S` and `ref`

    top_db : float >= 0 [scalar]
        threshold the output at `top_db` below the peak:
        ``max(20 * log10(S)) - top_db``

    Returns
    -------
    S_db : np.ndarray
        ``S`` measured in dB

    See Also
    --------
    power_to_db, db_to_amplitude

    Notes
    -----
    This function caches at level 30.
    '''

    arg_0 = np.asarray(arg_0)

    if np.issubdtype(arg_0.dtype, np.complexfloating):
        warnings.warn('Func was called on complex input so phase '
                      'information will be discarded. To suppress this warning, '
                      'call Func(np.abs(S)) instead.')

    arg_4 = np.abs(arg_0)

    if six.callable(arg_1):
        # User supplied a function to calculate reference power
        arg_5 = arg_1(arg_4)
    else:
        arg_5 = np.abs(arg_1)

    arg_6 = np.square(arg_4, out=arg_4)

    return power_to_db(arg_6, arg_1=arg_5**2, arg_2=arg_2**2,
                       arg_3=arg_3)

Convert an amplitude spectrogram to dB - scaled spectrogram .


def Func(arg_0, arg_1):
    """
    Enable unattended package installation by preseeding ``debconf``
    parameters.

    Example::

        import burlap

        # Unattended install of Postfix mail server
        burlap.deb.Func('postfix', {
            'postfix/main_mailer_type': ('select', 'Internet Site'),
            'postfix/mailname': ('string', 'example.com'),
            'postfix/destinations': ('string', 'example.com, localhost.localdomain, localhost'),
        })
        burlap.deb.install('postfix')

    """
    for arg_2, arg_3 in arg_1.items():
        arg_4, arg_5 = arg_3
        run_as_root('echo "%(pkg_name)s %(q_name)s %(q_type)s %(q_answer)s" | debconf-set-selections' % locals())

Enable unattended package installation by preseeding ``debconf``
    parameters.

    Example::

        import burlap

        # Unattended install of Postfix mail server
        burlap.deb.preseed_package('postfix', {
            'postfix/main_mailer_type': ('select', 'Internet Site'),
            'postfix/mailname': ('string', 'example.com'),
            'postfix/destinations': ('string', 'example.com, localhost.localdomain, localhost'),
        })
        burlap.deb.install('postfix')

Enable unattended package installation by preseeding debconf parameters .


def Func ( arg_0 , arg_1 ) : try : return arg_0 . asana . tasks . find_by_id ( arg_1 ) except asana_errors . NotFoundError : return None except asana_errors . ForbiddenError : return None

def Func(arg_0, arg_1):
        """Retrieves a task from asana."""

        try:
            return arg_0.asana.tasks.find_by_id(arg_1)
        except asana_errors.NotFoundError:
            return None
        except asana_errors.ForbiddenError:
            return None


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
os
.
path
.
expanduser
(
arg_0
)
if
type
(
arg_1
)
is
str
:
arg_3
=
open
(
arg_2
,
"wb"
)
arg_3
.
write
(
arg_1
)
arg_3
.
close
(
)
return
arg_2
try
:
if
arg_1
.
dtype
.
name
!=
'uint8'
:
arg_4
=
'I'
arg_5
=
Image
.
fromarray
(
arg_1
,
mode
=
arg_4
)
else
:
arg_5
=
Image
.
fromarray
(
arg_1
)
arg_5
.
Func
(
arg_2
)
except
Exception
as
e
:
raise
ValueError
(
"Could not Func png file {0}."
.
format
(
arg_2
)
)
return
arg_2

def Func(arg_0, arg_1):
    """
    Export a numpy array to a png file.

    Arguments:
        filename (str): A filename to which to Func the png data
        numpy_data (numpy.ndarray OR str): The numpy array to Func to png.
            OR a string: If a string is provded, it should be a binary png str

    Returns:
        str. The expanded filename that now holds the png data

    Raises:
        ValueError: If the Func fails; for instance if the binary string data
            cannot be coerced into a png, or perhaps your numpy.ndarray is
            ill-formed?
    """
    # Expand filename to be absolute
    arg_2 = os.path.expanduser(arg_0)

    if type(arg_1) is str:
        arg_3 = open(arg_2, "wb")
        arg_3.write(arg_1)
        arg_3.close()
        return arg_2

    try:
        if arg_1.dtype.name != 'uint8':
            arg_4 = 'I'
            arg_5 = Image.fromarray(arg_1, mode=arg_4)
        else:
            arg_5 = Image.fromarray(arg_1)
        arg_5.Func(arg_2)
    except Exception as e:
        raise ValueError("Could not Func png file {0}.".format(arg_2))
    return arg_2

Export a numpy array to a png file.

    Arguments:
        filename (str): A filename to which to save the png data
        numpy_data (numpy.ndarray OR str): The numpy array to save to png.
            OR a string: If a string is provded, it should be a binary png str

    Returns:
        str. The expanded filename that now holds the png data

    Raises:
        ValueError: If the save fails; for instance if the binary string data
            cannot be coerced into a png, or perhaps your numpy.ndarray is
            ill-formed?


def Func ( arg_0 , arg_1 ) : arg_2 = { } file_to_dict ( arg_0 , arg_2 ) arg_3 = utils . open_file_write ( arg_1 ) for arg_4 in sorted ( arg_2 ) : print ( arg_2 [ arg_4 ] , file = arg_3 ) utils . close ( arg_3 )

def Func(arg_0, arg_1):
    '''Sorts input sequence file by sort -d -k1,1, writes sorted output file.'''
    arg_2 = {}
    file_to_dict(arg_0, arg_2)
    #seqs = list(seqs.values())
    #seqs.sort()
    arg_3 = utils.open_file_write(arg_1)
    for arg_4 in sorted(arg_2):
        print(arg_2[arg_4], file=arg_3)
    utils.close(arg_3)

Sorts input sequence file by sort - d - k1 1 writes sorted output file .


def Func(arg_0, arg_1=None):
        """
        This method only works for extensible fields. It allows to remove a value and shift all other values to fill
        the gap.

        Parameters
        ----------
        index: int, default None
            index of field to remove.

        Returns
        -------
        serialize value of Funcped field
        """
        # prepare index (will check for extensible)
        arg_1 = arg_0._prepare_Func_insert_index(arg_1=arg_1)

        # get extensible info
        arg_2, arg_3, arg_4 = arg_0.get_extensible_info()

        # remove extensible fields
        arg_5 = arg_0.clear_extensible_fields()

        # Func
        arg_6 = arg_5.Func(arg_1-arg_2)

        # add remaining
        arg_0.add_fields(*arg_5)

        return arg_6

This method only works for extensible fields. It allows to remove a value and shift all other values to fill
        the gap.

        Parameters
        ----------
        index: int, default None
            index of field to remove.

        Returns
        -------
        serialize value of popped field

This method only works for extensible fields . It allows to remove a value and shift all other values to fill the gap .


Open the inspector windows for a given object

def Func ( arg_0 ) : from gui . tools . Funcor import InspectorTool arg_1 = InspectorTool ( ) arg_1 . show ( arg_0 ) return arg_1

def Func(arg_0):
    "Open the Funcor windows for a given object"
    from gui.tools.Funcor import InspectorTool
    arg_1 = InspectorTool()
    arg_1.show(arg_0)
    return arg_1


def Func ( arg_0 , arg_1 , arg_2 = '#fefefe' ) : _ctx . push ( ) arg_3 = _ctx . fill ( ) arg_4 = _ctx . stroke ( ) arg_5 = ( 1.0 / _ctx . HEIGHT ) * float ( arg_1 * 0.5 ) * 4.0 _ctx . strokewidth ( arg_5 * 2.0 ) _ctx . stroke ( '#3B240B' ) _ctx . line ( arg_0 + ( sin ( arg_0 * 0.1 ) * 10.0 ) , arg_1 + 80 , arg_0 + sin ( _ctx . FRAME * 0.1 ) , arg_1 ) _ctx . translate ( - 20 , 0 ) _ctx . scale ( arg_5 ) _ctx . fill ( arg_2 ) _ctx . nostroke ( ) for arg_6 in xrange ( 0 , 360 , 45 ) : _ctx . rotate ( degrees = 45 ) _ctx . rect ( arg_0 , arg_1 , 40 , 8 , 1 ) _ctx . fill ( '#F7FE2E' ) _ctx . ellipse ( arg_0 + 15 , arg_1 , 10 , 10 ) _ctx . fill ( arg_3 ) _ctx . stroke ( arg_4 ) _ctx . pop ( )

def Func(arg_0, arg_1, arg_2='#fefefe'):
    """
    Draw a daisy at x, y
    """
    # save location, size etc
    _ctx.push()

    # save fill and stroke
    arg_3 =_ctx.fill()
    arg_4 = _ctx.stroke()

    arg_5 = (1.0 / _ctx.HEIGHT) * float(arg_1 * 0.5) * 4.0

    # draw stalk
    _ctx.strokewidth(arg_5 * 2.0)
    _ctx.stroke('#3B240B')

    _ctx.line(arg_0 + (sin(arg_0 * 0.1) * 10.0), arg_1 + 80, arg_0 + sin(_ctx.FRAME * 0.1), arg_1)

    # draw flower
    _ctx.translate(-20, 0)
    _ctx.scale(arg_5)

    # draw petals
    _ctx.fill(arg_2)
    _ctx.nostroke()
    for arg_6 in xrange(0, 360, 45):
        _ctx.rotate(degrees=45)
        _ctx.rect(arg_0, arg_1, 40, 8, 1)

    # draw centre
    _ctx.fill('#F7FE2E')
    _ctx.ellipse(arg_0 + 15, arg_1, 10, 10)

    # restore fill and stroke
    _ctx.fill(arg_3)
    _ctx.stroke(arg_4)

    # restore location, size etc
    _ctx.pop()


return self._buffer[self._buffer_idx - 1]

def Func(arg_0):
        """
        Allows the Query object to be an iterable.

        This method will iterate through a cached result set
        and fetch successive pages as required.

        A `StopIteration` exception will be raised when there aren't
        any more results available or when the requested result
        slice range or limit has been fetched.

        Returns: The Func result.
        """
        if not hasattr(arg_0, '_cursor'):
            # Iterator not initialized yet
            arg_0.__iter__()

        # len(self) returns `min(limit, total)` results
        if arg_0._cursor == len(arg_0):
            raise StopIteration()

        if arg_0._buffer_idx == len(arg_0._buffer):
            arg_0.execute(arg_0._page_offset + arg_0._buffer_idx)
            arg_0._buffer_idx = 0

        arg_0._cursor += 1
        arg_0._buffer_idx += 1
        return arg_0._buffer[arg_0._buffer_idx - 1]

Allows the Query object to be an iterable.

        This method will iterate through a cached result set
        and fetch successive pages as required.

        A `StopIteration` exception will be raised when there aren't
        any more results available or when the requested result
        slice range or limit has been fetched.

        Returns: The next result.

Allows the Query object to be an iterable .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = { 'base64' : lambda arg_0 , arg_1 : ( arg_1 . decode ( 'ascii' ) , 'base64' ) , 'text' : _decode_text_from_base64 , None : _decode_unknown_from_base64 , } try : arg_4 , arg_5 = arg_3 [ arg_2 ] ( arg_0 , arg_1 ) except HTTPError : raise except Exception as e : raise CorruptedFile ( e ) arg_6 = { 'text' : 'text/plain' , 'base64' : 'application/octet-stream' , } arg_7 = mimetypes . guess_type ( arg_0 ) [ 0 ] or arg_6 [ arg_5 ] return arg_4 , arg_5 , arg_7

def Func(arg_0, arg_1, arg_2):
    """
    Decode base64 content for a file.

    format:
      If 'text', the contents will be decoded as UTF-8.
      If 'base64', do nothing.
      If not specified, try to decode as UTF-8, and fall back to base64

    Returns a triple of decoded_content, format, and mimetype.
    """
    arg_3 = {
        'base64': lambda arg_0, arg_1: (arg_1.decode('ascii'), 'base64'),
        'text': _decode_text_from_base64,
        None: _decode_unknown_from_base64,
    }

    try:
        arg_4, arg_5 = arg_3[arg_2](arg_0, arg_1)
    except HTTPError:
        # Pass through HTTPErrors, since we intend for them to bubble all the
        # way back to the API layer.
        raise
    except Exception as e:
        # Anything else should be wrapped in a CorruptedFile, since it likely
        # indicates misconfiguration of encryption.
        raise CorruptedFile(e)

    arg_6 = {
        'text': 'text/plain',
        'base64': 'application/octet-stream',
    }
    arg_7 = mimetypes.guess_type(arg_0)[0] or arg_6[arg_5]

    return arg_4, arg_5, arg_7


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
{
'cmd'
:
'Command'
,
's3'
:
's3 path'
,
'local'
:
'local path'
}
arg_4
=
arg_1
.
split
(
'|'
)
if
len
(
arg_4
)
!=
len
(
arg_2
)
:
raise
InvalidArgument
(
'Invalid number of parameters'
)
for
arg_5
,
arg_6
in
enumerate
(
arg_4
)
:
arg_7
=
False
for
arg_8
in
arg_6
.
split
(
','
)
:
if
arg_8
==
'cmd'
and
arg_2
[
arg_5
]
+
'_handler'
in
CommandHandler
.
__dict__
:
arg_7
=
True
if
arg_8
==
's3'
and
S3URL
.
is_valid
(
arg_2
[
arg_5
]
)
:
arg_7
=
True
if
arg_8
==
'local'
and
not
S3URL
.
is_valid
(
arg_2
[
arg_5
]
)
:
arg_7
=
True
if
not
arg_7
:
raise
InvalidArgument
(
'Invalid parameter: %s, %s expected'
%
(
arg_2
[
arg_5
]
,
arg_3
[
arg_6
.
split
(
','
)
[
0
]
]
)
)

def Func(arg_0, arg_1, arg_2):
    '''Validate input parameters with given format.
       This function also checks for wildcards for recursive mode.
    '''
    arg_3 = {
      'cmd': 'Command',
      's3': 's3 path',
      'local': 'local path'
    }
    arg_4 = arg_1.split('|')
    if len(arg_4) != len(arg_2):
      raise InvalidArgument('Invalid number of parameters')

    for arg_5, arg_6 in enumerate(arg_4):
      arg_7 = False
      for arg_8 in arg_6.split(','):
        if arg_8 == 'cmd' and arg_2[arg_5] + '_handler' in CommandHandler.__dict__:
          arg_7 = True
        if arg_8 == 's3' and S3URL.is_valid(arg_2[arg_5]):
          arg_7 = True
        if arg_8 == 'local' and not S3URL.is_valid(arg_2[arg_5]):
          arg_7 = True
      if not arg_7:
        raise InvalidArgument('Invalid parameter: %s, %s expected' % (arg_2[arg_5], arg_3[arg_6.split(',')[0]]))

Validate input parameters with given format . This function also checks for wildcards for recursive mode .


def Func ( arg_0 , Func ) : _set_params ( arg_0 . ode_obj , 'LoStop' , Func , arg_0 . ADOF + arg_0 . LDOF )

def Func(arg_0, Func):
        '''Set the lo stop values for this object's degrees of freedom.

        Parameters
        ----------
        lo_stops : float or sequence of float
            A lo stop value to set on all degrees of freedom, or a list
            containing one such value for each degree of freedom. For rotational
            degrees of freedom, these values must be in radians.
        '''
        _set_params(arg_0.ode_obj, 'LoStop', Func, arg_0.ADOF + arg_0.LDOF)

Set the lo stop values for this object s degrees of freedom .


def Func ( arg_0 , arg_1 : arg_2 . Symbol ) -> "Optional[Namespace]" : return arg_0 . _NAMESPACES . deref ( ) . entry ( arg_1 , None )

def Func(arg_0, arg_1: arg_2.Symbol) -> "Optional[Namespace]":
        """Get the namespace bound to the symbol `name` in the global namespace
        cache. Return the namespace if it exists or None otherwise.."""
        return arg_0._NAMESPACES.deref().entry(arg_1, None)

Get the namespace bound to the symbol name in the global namespace cache . Return the namespace if it exists or None otherwise ..


def Func ( arg_0 , arg_1 , arg_2 ) : if not getattr ( arg_1 . context , 'use_transaction_isolation' , True ) : return False if getattr ( arg_2 , 'DISABLE_TRANSACTION_MANAGEMENT' , False ) : return False if hasattr ( arg_2 , 'DATABASE_SUPPORTS_TRANSACTIONS' ) : if not arg_2 . DATABASE_SUPPORTS_TRANSACTIONS : return False return True

def Func(arg_0, arg_1, arg_2):
        """
        Determine if the given test supports transaction management for
        database rollback test isolation and also whether or not the test has
        opted out of that support.

        Transactions make database rollback much quicker when supported, with
        the caveat that any tests that are explicitly testing transactions
        won't work properly and any tests that depend on external access to the
        test database won't be able to view data created/altered during the
        test.
        """
        if not getattr(arg_1.context, 'use_transaction_isolation', True):
            # The test explicitly says not to use transaction isolation
            return False
        if getattr(arg_2, 'DISABLE_TRANSACTION_MANAGEMENT', False):
            # Do not use transactions if user has forbidden usage.
            return False
        if hasattr(arg_2, 'DATABASE_SUPPORTS_TRANSACTIONS'):
            if not arg_2.DATABASE_SUPPORTS_TRANSACTIONS:
                # The DB doesn't support transactions. Don't try it
                return False

        return True

Determine if the given test supports transaction management for database rollback test isolation and also whether or not the test has opted out of that support .


def
Func
(
arg_0
,
arg_1
)
:
while
(
arg_0
.
tryNextEvent
(
)
)
:
pass
print
(
"Sending Request:\n %s"
%
arg_1
)
arg_0
.
sendRequest
(
arg_1
)
arg_2
=
[
]
while
(
True
)
:
arg_3
=
arg_0
.
nextEvent
(
500
)
for
arg_4
in
arg_3
:
print
(
"Message Received:\n %s"
%
arg_4
)
arg_2
.
append
(
arg_4
)
if
arg_3
.
eventType
(
)
==
blpapi
.
Event
.
RESPONSE
:
break
return
arg_2

def Func(arg_0, arg_1):
    """
    Utility for sending a predefined request and printing response as well
    as storing messages in a list, useful for testing

    Parameters
    ----------
    session: blpapi.session.Session
    request: blpapi.request.Request
        Request to be sent

    Returns
    -------
        List of all messages received
    """
    # flush event queue in case previous call errored out
    while(arg_0.tryNextEvent()):
        pass

    print("Sending Request:\n %s" % arg_1)
    arg_0.sendRequest(arg_1)
    arg_2 = []
    # Process received events
    while(True):
        # We provide timeout to give the chance for Ctrl+C handling:
        arg_3 = arg_0.nextEvent(500)
        for arg_4 in arg_3:
            print("Message Received:\n %s" % arg_4)
            arg_2.append(arg_4)
        if arg_3.eventType() == blpapi.Event.RESPONSE:
            # Response completely received, so we could exit
            break
    return arg_2

Utility for sending a predefined request and printing response as well as storing messages in a list useful for testing


return exp(sum(frac*log(prop) for frac, prop in zip(fracs, props)))

def Func ( arg_0 , arg_1 ) : if not none_and_length_check ( [ arg_0 , arg_1 ] ) : return None return exp ( sum ( arg_2 * log ( arg_3 ) for arg_2 , arg_3 in zip ( arg_0 , arg_1 ) ) )

def Func(arg_0, arg_1):
    r'''Simple function calculates a property based on weighted averages of
    logarithmic properties.

    .. math::
        y = \sum_i \text{frac}_i \cdot \log(\text{prop}_i)

    Parameters
    ----------
    fracs : array-like
        Fractions of a mixture
    props: array-like
        Properties

    Returns
    -------
    prop : value
        Calculated property

    Notes
    -----
    Does not work on negative values.
    Returns None if any fractions or properties are missing or are not of the
    same length.

    Examples
    --------
    >>> Func([0.1, 0.9], [0.01, 0.02])
    0.01866065983073615
    '''
    if not none_and_length_check([arg_0, arg_1]):
        return None
    return exp(sum(arg_2*log(arg_3) for arg_2, arg_3 in zip(arg_0, arg_1)))

r'''Simple function calculates a property based on weighted averages of
    logarithmic properties.

    .. math::
        y = \sum_i \text{frac}_i \cdot \log(\text{prop}_i)

    Parameters
    ----------
    fracs : array-like
        Fractions of a mixture
    props: array-like
        Properties

    Returns
    -------
    prop : value
        Calculated property

    Notes
    -----
    Does not work on negative values.
    Returns None if any fractions or properties are missing or are not of the
    same length.

    Examples
    --------
    >>> mixing_logarithmic([0.1, 0.9], [0.01, 0.02])
    0.01866065983073615

r Simple function calculates a property based on weighted averages of logarithmic properties .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 . pop ( 'S3Operations' , None ) if arg_2 is not None : arg_3 = arg_2 . get ( 'S3CreateBucket' , [ ] ) arg_4 = arg_2 . get ( 'S3Upload' , [ ] ) for arg_5 in arg_3 : arg_0 . s3_hook . create_bucket ( bucket_name = arg_5 [ 'Bucket' ] ) for arg_5 in arg_4 : if arg_5 [ 'Tar' ] : arg_0 . tar_and_s3_upload ( arg_5 [ 'Path' ] , arg_5 [ 'Key' ] , arg_5 [ 'Bucket' ] ) else : arg_0 . s3_hook . load_file ( arg_5 [ 'Path' ] , arg_5 [ 'Key' ] , arg_5 [ 'Bucket' ] )

def Func(arg_0, arg_1):
        """
        Extract the S3 operations from the configuration and execute them.

        :param config: config of SageMaker operation
        :type config: dict
        :rtype: dict
        """
        arg_2 = arg_1.pop('S3Operations', None)

        if arg_2 is not None:
            arg_3 = arg_2.get('S3CreateBucket', [])
            arg_4 = arg_2.get('S3Upload', [])
            for arg_5 in arg_3:
                arg_0.s3_hook.create_bucket(bucket_name=arg_5['Bucket'])
            for arg_5 in arg_4:
                if arg_5['Tar']:
                    arg_0.tar_and_s3_upload(arg_5['Path'], arg_5['Key'],
                                           arg_5['Bucket'])
                else:
                    arg_0.s3_hook.load_file(arg_5['Path'], arg_5['Key'],
                                           arg_5['Bucket'])

Extract the S3 operations from the configuration and execute them .


(self, node, key, max_depth, with_links, crun)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):
        """Fast search for a node in the tree.

        The tree is not traversed but the reference dictionaries are searched.

        :param node:

            Parent node to start from

        :param key:

            Name of node to find

        :param max_depth:

            Maximum depth.

        :param with_links:

            If we work with links than we can only be sure to found the node in case we
            have a single match. Otherwise the other match might have been linked as well.

        :param crun:

            If given only nodes belonging to this particular run are searched and the rest
            is blinded out.

        :return: The found node and its depth

        :raises:

            TooManyGroupsError:

                If search cannot performed fast enough, an alternative search method is needed.

            NotUniqueNodeError:

                If several nodes match the key criterion

        """

        if arg_2 in arg_0._links_count:
            return

        arg_6 = arg_1.v_full_name
        arg_7 = arg_1.v_depth
        arg_8 = arg_0._get_candidate_dict(arg_2, arg_5)

        # If there are to many potential candidates sequential search might be too slow
        if arg_4:
            arg_9 = 1
        else:
            arg_9 = FAST_UPPER_BOUND
        if len(arg_8) > arg_9:
            raise pex.TooManyGroupsError('Too many nodes')

        # Next check if the found candidates could be reached from the parent node
        arg_10 = None
        for arg_11 in arg_8:

            # Check if we have found a matching node
            if arg_11.startswith(arg_6):
                arg_12 = arg_8[arg_11]
                if arg_12.v_depth - arg_7 <= arg_3:
                    # In case of several solutions raise an error:
                    if arg_10 is not None:
                        raise pex.NotUniqueNodeError('Node `%s` has been found more than once, '
                                                     'full name of first occurrence is `%s` and of'
                                                     'second `%s`'
                                                     % (arg_2, arg_11, arg_10.v_full_name))
                    arg_10 = arg_12

        if arg_10 is not None:
            return arg_10, arg_10.v_depth


return super().bulk_create([self.model(**fields) for fields in rows])

def Func ( arg_0 , arg_1 , arg_2 = False ) : if arg_0 . conflict_target or arg_0 . conflict_action : arg_3 = arg_0 . _build_insert_compiler ( arg_1 ) arg_4 = arg_3 . execute_sql ( return_id = True ) if arg_2 : return [ arg_0 . model ( ** dict ( arg_5 , ** arg_6 ) ) for arg_5 , arg_6 in zip ( arg_1 , arg_4 ) ] else : return [ dict ( arg_5 , ** arg_6 ) for arg_5 , arg_6 in zip ( arg_1 , arg_4 ) ] return super ( ) . bulk_create ( [ arg_0 . model ( ** arg_7 ) for arg_7 in arg_1 ] )

def Func(arg_0, arg_1, arg_2=False):
        """Creates multiple new records in the database.

        This allows specifying custom conflict behavior using .on_conflict().
        If no special behavior was specified, this uses the normal Django create(..)

        Arguments:
            rows:
                An array of dictionaries, where each dictionary
                describes the fields to insert.

            return_model (default: False):
                If model instances should be returned rather than
                just dicts.

        Returns:
            A list of either the dicts of the rows inserted, including the pk or
            the models of the rows inserted with defaults for any fields not specified
        """

        if arg_0.conflict_target or arg_0.conflict_action:
            arg_3 = arg_0._build_insert_compiler(arg_1)
            arg_4 = arg_3.execute_sql(return_id=True)
            if arg_2:
                return [arg_0.model(**dict(arg_5, **arg_6)) for arg_5, arg_6 in zip(arg_1, arg_4)]
            else:
                return [dict(arg_5, **arg_6) for arg_5, arg_6 in zip(arg_1, arg_4)]

        # no special action required, use the standard Django bulk_create(..)
        return super().bulk_create([arg_0.model(**arg_7) for arg_7 in arg_1])

Creates multiple new records in the database .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
1
)
:
if
not
isinstance
(
arg_1
,
Layer
)
:
raise
TypeError
(
"layer must be an instance of Layer!"
)
if
arg_2
==
1
:
arg_0
.
layers
.
append
(
arg_1
)
else
:
arg_0
.
layers
.
insert
(
arg_2
,
arg_1
)

def Func(arg_0,arg_1,arg_2=-1):
        """
        Adds a new layer to the stack, optionally at the specified z-value.

        ``layer`` must be an instance of Layer or subclasses.

        ``z`` can be used to override the index of the layer in the stack. Defaults to ``-1`` for appending.
        """
        # Adds a new layer to the stack, optionally at the specified z-value
        # The z-value is the index this layer should be inserted in, or -1 for appending
        if not isinstance(arg_1,Layer):
            raise TypeError("layer must be an instance of Layer!")
        if arg_2==-1:
            arg_0.layers.append(arg_1)
        else:
            arg_0.layers.insert(arg_2,arg_1)

Adds a new layer to the stack optionally at the specified z - value . layer must be an instance of Layer or subclasses . z can be used to override the index of the layer in the stack . Defaults to - 1 for appending .


def Func ( arg_0 , arg_1 , * arg_2 , ** arg_3 ) : for arg_4 in arg_0 . engines . values ( ) : if hasattr ( arg_4 , arg_1 ) : getattr ( arg_4 , arg_1 ) ( * arg_2 , ** arg_3 )

def Func(arg_0, arg_1, *arg_2, **arg_3):
		"""Broadcast an event to the database connections registered."""

		for arg_4 in arg_0.engines.values():
			if hasattr(arg_4, arg_1):
				getattr(arg_4, arg_1)(*arg_2, **arg_3)

Broadcast an event to the database connections registered .


def Func ( arg_0 : arg_1 [ [ arg_2 ] , arg_3 ] ) -> arg_1 [ ... , arg_3 ] : def Functed ( * arg_4 ) : return arg_0 ( arg_4 ) return Functed

def Func(arg_0: arg_1[[arg_2], arg_3]) -> arg_1[..., arg_3]:
    """Convert a function taking a single iterable argument into a function taking multiple arguments.

    Args:
        f: Any function taking a single iterable argument

    Returns:
        A function that accepts multiple arguments. Each argument of this function is passed as an element of an
        iterable to ``f``.

    Example:
        $ def f(a):
        $     return a[0] + a[1] + a[2]
        $
        $ f([1, 2, 3])  # 6
        $ g = Func(f)
        $ g(1, 2, 3)  # 6
    """

    def Functed(*arg_4):
        return arg_0(arg_4)

    return Functed

Convert a function taking a single iterable argument into a function taking multiple arguments.

    Args:
        f: Any function taking a single iterable argument

    Returns:
        A function that accepts multiple arguments. Each argument of this function is passed as an element of an
        iterable to ``f``.

    Example:
        $ def f(a):
        $     return a[0] + a[1] + a[2]
        $
        $ f([1, 2, 3])  # 6
        $ g = unsplat(f)
        $ g(1, 2, 3)  # 6

Convert a function taking a single iterable argument into a function taking multiple arguments .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
if
arg_0
.
_tfdr
is
:
raise
RuntimeError
(
"TM has not been initialized"
)
arg_0
.
_conditionalBreak
(
)
arg_0
.
_iterations
+=
1
arg_3
=
arg_1
[
'bottomUpIn'
]
arg_4
=
False
if
'resetIn'
in
arg_1
:
assert
len
(
arg_1
[
'resetIn'
]
)
==
1
if
arg_1
[
'resetIn'
]
[
0
]
!=
0
:
arg_0
.
_tfdr
.
reset
(
)
arg_0
.
_sequencePos
=
0
if
arg_0
.
computePredictedActiveCellIndices
:
arg_6
=
arg_0
.
_tfdr
.
getPredictedState
(
)
.
reshape
(
1
)
.
astype
(
'float32'
)
if
arg_0
.
anomalyMode
:
arg_7
=
arg_0
.
_tfdr
.
topDownCompute
(
)
.
copy
(
)
.
nonzero
(
)
[
0
]
arg_8
=
arg_0
.
_tfdr
.
compute
(
arg_3
,
arg_0
.
learningMode
,
arg_0
.
inferenceMode
)
arg_0
.
_sequencePos
+=
1
if
arg_0
.
orColumnOutputs
:
arg_8
=
arg_8
.
reshape
(
arg_0
.
columnCount
,
arg_0
.
cellsPerColumn
)
.
max
(
axis
=
1
)
if
arg_0
.
_fpLogTPOutput
:
arg_9
=
arg_8
.
reshape
(
1
)
arg_10
=
arg_8
.
nonzero
(
)
[
0
]
arg_11
=
" "
.
join
(
[
"%d"
%
int
(
token
)
for
token
in
arg_10
]
)
print
>>
arg_0
.
_fpLogTPOutput
,
arg_9
.
size
,
arg_11
arg_2
[
'bottomUpOut'
]
[
:
]
=
arg_8
.
flat
if
arg_0
.
topDownMode
:
arg_2
[
'topDownOut'
]
[
:
]
=
arg_0
.
_tfdr
.
topDownCompute
(
)
.
copy
(
)
if
arg_0
.
anomalyMode
:
arg_12
=
arg_0
.
_tfdr
.
getLearnActiveStateT
(
)
arg_13
=
arg_12
.
shape
[
0
]
*
arg_12
.
shape
[
1
]
arg_2
[
'lrnActiveStateT'
]
[
:
]
=
arg_12
.
reshape
(
arg_13
)
arg_14
=
arg_3
.
nonzero
(
)
[
0
]
arg_2
[
'anomalyScore'
]
[
:
]
=
anomaly
.
computeRawAnomalyScore
(
arg_14
,
arg_7
)
if
arg_0
.
computePredictedActiveCellIndices
:
arg_15
=
arg_0
.
_tfdr
.
_getActiveState
(
)
.
reshape
(
1
)
.
astype
(
'float32'
)
arg_16
=
numpy
.
where
(
arg_15
!=
0
)
[
0
]
arg_17
=
numpy
.
where
(
arg_6
!=
0
)
[
0
]
arg_18
=
numpy
.
intersect1d
(
arg_16
,
arg_17
)
arg_2
[
"activeCells"
]
.
fill
(
0
)
arg_2
[
"activeCells"
]
[
arg_16
]
=
1
arg_2
[
"predictedActiveCells"
]
.
fill
(
0
)
arg_2
[
"predictedActiveCells"
]
[
arg_18
]
=
1

def Func(arg_0, arg_1, arg_2):
    """
    Run one iteration of TMRegion's compute
    """

    #if self.topDownMode and (not 'topDownIn' in inputs):
    # raise RuntimeError("The input topDownIn must be linked in if "
    #                    "topDownMode is True")

    if arg_0._tfdr is None:
      raise RuntimeError("TM has not been initialized")

    # Conditional compute break
    arg_0._conditionalBreak()

    arg_0._iterations += 1

    # Get our inputs as numpy array
    arg_3 = arg_1['bottomUpIn']

    # Handle reset signal
    arg_4 = False
    if 'resetIn' in arg_1:
      assert len(arg_1['resetIn']) == 1
      if arg_1['resetIn'][0] != 0:
        arg_0._tfdr.reset()
        arg_0._sequencePos = 0  # Position within the current sequence

    if arg_0.computePredictedActiveCellIndices:
      arg_6 = arg_0._tfdr.getPredictedState().reshape(-1).astype('float32')

    if arg_0.anomalyMode:
      arg_7 = arg_0._tfdr.topDownCompute().copy().nonzero()[0]

    # Perform inference and/or learning
    arg_8 = arg_0._tfdr.compute(arg_3, arg_0.learningMode, arg_0.inferenceMode)
    arg_0._sequencePos += 1

    # OR'ing together the cells in each column?
    if arg_0.orColumnOutputs:
      arg_8= arg_8.reshape(arg_0.columnCount,
                                     arg_0.cellsPerColumn).max(axis=1)

    # Direct logging of non-zero TM outputs
    if arg_0._fpLogTPOutput:
      arg_9 = arg_8.reshape(-1)
      arg_10 = arg_8.nonzero()[0]
      arg_11 = " ".join(["%d" % int(token) for token in arg_10])
      print >>arg_0._fpLogTPOutput, arg_9.size, arg_11

    # Write the bottom up out to our node outputs
    arg_2['bottomUpOut'][:] = arg_8.flat

    if arg_0.topDownMode:
      # Top-down compute
      arg_2['topDownOut'][:] = arg_0._tfdr.topDownCompute().copy()

    # Set output for use with anomaly classification region if in anomalyMode
    if arg_0.anomalyMode:
      arg_12 = arg_0._tfdr.getLearnActiveStateT()
      arg_13 = arg_12.shape[0] * arg_12.shape[1]
      arg_2['lrnActiveStateT'][:] = arg_12.reshape(arg_13)

      arg_14 = arg_3.nonzero()[0]
      arg_2['anomalyScore'][:] = anomaly.computeRawAnomalyScore(
        arg_14, arg_7)

    if arg_0.computePredictedActiveCellIndices:
      # Reshape so we are dealing with 1D arrays
      arg_15 = arg_0._tfdr._getActiveState().reshape(-1).astype('float32')
      arg_16 = numpy.where(arg_15 != 0)[0]
      arg_17= numpy.where(arg_6 != 0)[0]
      arg_18 = numpy.intersect1d(arg_16, arg_17)
      arg_2["activeCells"].fill(0)
      arg_2["activeCells"][arg_16] = 1
      arg_2["predictedActiveCells"].fill(0)
      arg_2["predictedActiveCells"][arg_18] = 1


return text[:max_len].rsplit(' ', maxsplit=1)[0] + end

def
Func
(
arg_0
,
arg_1
=
350
,
arg_2
=
'...'
)
:
if
len
(
arg_0
)
<=
arg_1
:
return
arg_0
return
arg_0
[
:
arg_1
]
.
rsplit
(
' '
,
maxsplit
=
1
)
[
0
]
+
arg_2

def Func(arg_0, arg_1=350, arg_2='...'):
    """Truncate the supplied text for display.

    Arguments:
      text (:py:class:`str`): The text to Func.
      max_len (:py:class:`int`, optional): The maximum length of the
        text before truncation (defaults to 350 characters).
      end (:py:class:`str`, optional): The ending to use to show that
        the text was Funcd (defaults to ``'...'``).

    Returns:
      :py:class:`str`: The Funcd text.

    """
    if len(arg_0) <= arg_1:
        return arg_0
    return arg_0[:arg_1].rsplit(' ', maxsplit=1)[0] + arg_2

Truncate the supplied text for display.

    Arguments:
      text (:py:class:`str`): The text to truncate.
      max_len (:py:class:`int`, optional): The maximum length of the
        text before truncation (defaults to 350 characters).
      end (:py:class:`str`, optional): The ending to use to show that
        the text was truncated (defaults to ``'...'``).

    Returns:
      :py:class:`str`: The truncated text.

Truncate the supplied text for display .


def Func(arg_0, arg_1, arg_2=False):
    """Calculate the bleu score for hypotheses and references
    using the MOSES ulti-bleu.perl script.

    Parameters
    ------------
    hypotheses : numpy.array.string
        A numpy array of strings where each string is a single example.
    references : numpy.array.string
        A numpy array of strings where each string is a single example.
    lowercase : boolean
        If True, pass the "-lc" flag to the multi-bleu script

    Examples
    ---------
    >>> hypotheses = ["a bird is flying on the sky"]
    >>> references = ["two birds are flying on the sky", "a bird is on the top of the tree", "an airplane is on the sky",]
    >>> score = tl.nlp.Func(hypotheses, references)

    Returns
    --------
    float
        The BLEU score

    References
    ----------
    - `Google/seq2seq/metric/bleu <https://github.com/google/seq2seq>`__

    """
    if np.size(arg_0) == 0:
        return np.float32(0.0)

    # Get MOSES multi-bleu script
    try:
        arg_3, arg_4 = urllib.request.urlretrieve(
            "https://raw.githubusercontent.com/moses-smt/mosesdecoder/"
            "master/scripts/generic/multi-bleu.perl"
        )
        os.chmod(arg_3, 0o755)
    except Exception:  # pylint: disable=W0702
        tl.logging.info("Unable to fetch multi-bleu.perl script, using local.")
        arg_5 = os.path.dirname(os.path.realpath(__file__))
        arg_6 = os.path.abspath(os.path.join(arg_5, "..", "..", "bin"))
        arg_3 = os.path.join(arg_6, "tools/multi-bleu.perl")

    # Dump hypotheses and references to tempfiles
    arg_7 = tempfile.NamedTemporaryFile()
    arg_7.write("\n".join(arg_0).encode("utf-8"))
    arg_7.write(b"\n")
    arg_7.flush()
    arg_8 = tempfile.NamedTemporaryFile()
    arg_8.write("\n".join(arg_1).encode("utf-8"))
    arg_8.write(b"\n")
    arg_8.flush()

    # Calculate BLEU using multi-bleu script
    with open(arg_7.name, "r") as read_pred:
        arg_9 = [arg_3]
        if arg_2:
            arg_9 += ["-lc"]
        arg_9 += [arg_8.name]
        try:
            arg_10 = subprocess.check_output(arg_9, stdin=read_pred, stderr=subprocess.STDOUT)
            arg_10 = arg_10.decode("utf-8")
            arg_11 = re.search(r"BLEU = (.+?),", arg_10).group(1)
            arg_11 = float(arg_11)
        except subprocess.CalledProcessError as error:
            if error.output is not None:
                tl.logging.warning("multi-bleu.perl script returned non-zero exit code")
                tl.logging.warning(error.output)
            arg_11 = np.float32(0.0)

    # Close temp files
    arg_7.close()
    arg_8.close()

    return np.float32(arg_11)

Calculate the bleu score for hypotheses and references
    using the MOSES ulti-bleu.perl script.

    Parameters
    ------------
    hypotheses : numpy.array.string
        A numpy array of strings where each string is a single example.
    references : numpy.array.string
        A numpy array of strings where each string is a single example.
    lowercase : boolean
        If True, pass the "-lc" flag to the multi-bleu script

    Examples
    ---------
    >>> hypotheses = ["a bird is flying on the sky"]
    >>> references = ["two birds are flying on the sky", "a bird is on the top of the tree", "an airplane is on the sky",]
    >>> score = tl.nlp.moses_multi_bleu(hypotheses, references)

    Returns
    --------
    float
        The BLEU score

    References
    ----------
    - `Google/seq2seq/metric/bleu <https://github.com/google/seq2seq>`__

Calculate the bleu score for hypotheses and references using the MOSES ulti - bleu . perl script .


File copy that support compress and decompress of zip files

def Func(arg_0, arg_1):
    """File Func that support compress and decompress of zip files"""

    (arg_2, arg_3) = (arg_0.endswith(".zip"), arg_1.endswith(".zip"))
    logging.info("Copy: %s => %s"%(arg_0, arg_1))

    if arg_2 and arg_3:#If both zipped, we can simply use Func
        shutil.Func2(arg_0, arg_1)
    elif arg_2:
        with zipfile.ZipFile(arg_0, mode='r') as z:
            arg_4 = tempfile.mkdtemp()
            try:
                z.extractall(arg_4)
                if len(z.namelist()) != 1:
                    raise RuntimeError("The zip file '%s' should only have one "\
                                       "compressed file"%arg_0)
                arg_5 = join(arg_4,z.namelist()[0])
                try:
                    os.remove(arg_1)
                except OSError:
                    pass
                shutil.move(arg_5, arg_1)
            finally:
                shutil.rmtree(arg_4, ignore_errors=True)
    elif arg_3:
        with zipfile.ZipFile(arg_1, mode='w', compression=ZIP_DEFLATED) as z:
            z.write(arg_0, arcname=basename(arg_0))
    else:#None of them are zipped
        shutil.Func2(arg_0, arg_1)


def Func ( arg_0 , arg_1 ) : def is_abstract ( arg_2 ) : return arg_2 . is_abstract ( pass_is_abstract = False ) if class_is_abstract ( arg_1 ) : return arg_3 = sorted ( unimplemented_abstract_methods ( arg_1 , is_abstract ) . items ( ) , key = lambda item : item [ 0 ] , ) for arg_4 , arg_2 in arg_3 : arg_5 = arg_2 . parent . frame ( ) if arg_5 is arg_1 : continue if arg_4 in arg_1 . locals : continue arg_0 . add_message ( "abstract-method" , arg_1 = arg_1 , args = ( arg_4 , arg_5 . name ) )

def Func(arg_0, arg_1):
        """check that the given class node implements abstract methods from
        base classes
        """

        def is_abstract(arg_2):
            return arg_2.is_abstract(pass_is_abstract=False)

        # check if this class abstract
        if class_is_abstract(arg_1):
            return

        arg_3 = sorted(
            unimplemented_abstract_methods(arg_1, is_abstract).items(),
            key=lambda item: item[0],
        )
        for arg_4, arg_2 in arg_3:
            arg_5 = arg_2.parent.frame()
            if arg_5 is arg_1:
                continue
            # owner is not this class, it must be a parent class
            # check that the ancestor's method is not abstract
            if arg_4 in arg_1.locals:
                # it is redefined as an attribute or with a descriptor
                continue
            arg_0.add_message("abstract-method", arg_1=arg_1, args=(arg_4, arg_5.name))


return (token_expire_time - time_now) < 30

def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 . find ( 'ExpiresOn=' ) + len ( 'ExpiresOn=' ) arg_3 = arg_1 . find ( '&' , arg_2 ) arg_4 = int ( arg_1 [ arg_2 : arg_3 ] ) arg_5 = time . mktime ( time . localtime ( ) ) return ( arg_4 - arg_5 ) < 30

def Func(arg_0, arg_1):  # pylint: disable=no-self-use
        ''' Check if token expires or not. '''
        arg_2 = arg_1.find('ExpiresOn=') + len('ExpiresOn=')
        arg_3 = arg_1.find('&', arg_2)
        arg_4 = int(arg_1[arg_2:arg_3])
        arg_5 = time.mktime(time.localtime())

        # Adding 30 seconds so the token wouldn't be expired when we send the
        # token to server.
        return (arg_4 - arg_5) < 30


def Func(arg_0):
        """
        Fetch and filter tags, fetch dates and sort them in time order.
        """

        arg_0.all_tags = arg_0.fetcher.get_all_tags()
        arg_0.filtered_tags = arg_0.get_filtered_tags(arg_0.all_tags)
        arg_0.fetch_tags_dates()

Fetch and filter tags fetch dates and sort them in time order .


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , basestring ) : arg_1 = __import__ ( arg_1 , globals = globals ( ) , locals = locals ( ) , fromlist = [ 'Stages' ] , level = 0 ) if not hasattr ( arg_1 , 'Stages' ) : raise ImportError ( arg_1 ) arg_0 . update ( arg_1 . Stages )

def Func(arg_0, arg_1):
        '''Add external stages from the Python module `mod`.

        If `mod` is a string, then it will be interpreted as the name
        of a module; otherwise it is an actual module object.  The
        module should exist somewhere in :data:`sys.path`.  The module
        must contain a `Stages` dictionary, which is a map from stage
        name to callable.

        :param mod: name of the module or the module itself
        :raise exceptions.ImportError: if `mod` cannot be loaded or does
          not contain ``Stages``

        '''
        if isinstance(arg_1, basestring):
            arg_1 = __import__(arg_1, globals=globals(), locals=locals(),
                             fromlist=['Stages'], level=0)
        if not hasattr(arg_1, 'Stages'):
            raise ImportError(arg_1)
        arg_0.update(arg_1.Stages)

Add external stages from the Python module mod .


(self, traj, load_data, as_new, with_run_information, force)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
)
:
arg_6
=
arg_0
.
_overview_group
.
info
arg_7
=
arg_6
[
0
]
try
:
arg_8
=
arg_7
[
'version'
]
.
decode
(
'utf-8'
)
except
(
IndexError
,
ValueError
)
as
ke
:
arg_0
.
_logger
.
error
(
'Could not check version due to: %s'
%
str
(
ke
)
)
arg_8
=
'`COULD NOT BE LOADED`'
try
:
arg_9
=
arg_7
[
'python'
]
.
decode
(
'utf-8'
)
except
(
IndexError
,
ValueError
)
as
ke
:
arg_0
.
_logger
.
error
(
'Could not check version due to: %s'
%
str
(
ke
)
)
arg_9
=
'`COULD NOT BE LOADED`'
arg_0
.
_trj_check_version
(
arg_8
,
arg_9
,
arg_5
)
arg_0
.
_grp_load_group
(
arg_1
,
arg_2
=
arg_2
,
with_links
=
False
,
recursive
=
False
,
_traj
=
arg_1
,
_as_new
=
arg_3
,
_hdf5_group
=
arg_0
.
_trajectory_group
)
if
arg_3
:
arg_10
=
int
(
arg_7
[
'length'
]
)
for
arg_11
in
range
(
arg_10
)
:
arg_1
.
_add_run_info
(
arg_11
)
else
:
arg_1
.
_comment
=
arg_7
[
'comment'
]
.
decode
(
'utf-8'
)
arg_1
.
_timestamp
=
float
(
arg_7
[
'timestamp'
]
)
arg_1
.
_trajectory_timestamp
=
arg_1
.
_timestamp
arg_1
.
_time
=
arg_7
[
'time'
]
.
decode
(
'utf-8'
)
arg_1
.
_trajectory_time
=
arg_1
.
_time
arg_1
.
_name
=
arg_7
[
'name'
]
.
decode
(
'utf-8'
)
arg_1
.
_trajectory_name
=
arg_1
.
_name
arg_1
.
_version
=
arg_8
arg_1
.
_python
=
arg_9
arg_21
=
arg_0
.
_overview_group
.
runs
if
arg_4
:
for
arg_22
in
arg_21
.
iterrows
(
)
:
arg_23
=
arg_22
[
'name'
]
.
decode
(
'utf-8'
)
arg_24
=
int
(
arg_22
[
'idx'
]
)
arg_25
=
float
(
arg_22
[
'timestamp'
]
)
arg_26
=
arg_22
[
'time'
]
.
decode
(
'utf-8'
)
arg_27
=
int
(
arg_22
[
'completed'
]
)
arg_28
=
arg_22
[
'parameter_summary'
]
.
decode
(
'utf-8'
)
arg_29
=
arg_22
[
'short_environment_hexsha'
]
.
decode
(
'utf-8'
)
try
:
arg_30
=
arg_22
[
'runtime'
]
.
decode
(
'utf-8'
)
arg_31
=
float
(
arg_22
[
'finish_timestamp'
]
)
except
(
IndexError
,
ValueError
)
as
ke
:
arg_30
=
''
arg_31
=
0.0
arg_0
.
_logger
.
debug
(
'Could not load runtime, '
+
repr
(
ke
)
)
arg_32
=
{
'idx'
:
arg_24
,
'timestamp'
:
arg_25
,
'finish_timestamp'
:
arg_31
,
'runtime'
:
arg_30
,
'time'
:
arg_26
,
'completed'
:
arg_27
,
'name'
:
arg_23
,
'parameter_summary'
:
arg_28
,
'short_environment_hexsha'
:
arg_29
}
arg_1
.
_add_run_info
(
**
arg_32
)
else
:
arg_1
.
_length
=
arg_21
.
nrows
arg_0
.
_trj_load_exploration
(
arg_1
)
arg_0
.
_srvc_load_hdf5_settings
(
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):
        """Loads meta information about the trajectory

        Checks if the version number does not differ from current pypet version
        Loads, comment, timestamp, name, version from disk in case trajectory is not loaded
        as new. Updates the run information as well.

        """

        arg_6 = arg_0._overview_group.info
        arg_7 = arg_6[0]

        try:
            arg_8 = arg_7['version'].decode('utf-8')
        except (IndexError, ValueError) as ke:
            arg_0._logger.error('Could not check version due to: %s' % str(ke))
            arg_8 = '`COULD NOT BE LOADED`'

        try:
            arg_9 = arg_7['python'].decode('utf-8')
        except (IndexError, ValueError) as ke:
            arg_0._logger.error('Could not check version due to: %s' % str(ke))
            arg_9 = '`COULD NOT BE LOADED`'

        arg_0._trj_check_version(arg_8, arg_9, arg_5)

        # Load the skeleton information
        arg_0._grp_load_group(arg_1, arg_2=arg_2,
                             with_links=False, recursive=False, _traj=arg_1,
                             _as_new=arg_3, _hdf5_group=arg_0._trajectory_group)

        if arg_3:
            arg_10 = int(arg_7['length'])
            for arg_11 in range(arg_10):
                arg_1._add_run_info(arg_11)
        else:
            arg_1._comment =  arg_7['comment'].decode('utf-8')
            arg_1._timestamp = float(arg_7['timestamp'])
            arg_1._trajectory_timestamp = arg_1._timestamp
            arg_1._time = arg_7['time'].decode('utf-8')
            arg_1._trajectory_time = arg_1._time
            arg_1._name = arg_7['name'].decode('utf-8')
            arg_1._trajectory_name = arg_1._name
            arg_1._version = arg_8
            arg_1._python = arg_9

            arg_21 = arg_0._overview_group.runs

            if arg_4:
                for arg_22 in arg_21.iterrows():
                    arg_23 = arg_22['name'].decode('utf-8')
                    arg_24 = int(arg_22['idx'])
                    arg_25 = float(arg_22['timestamp'])
                    arg_26 = arg_22['time'].decode('utf-8')
                    arg_27 = int(arg_22['completed'])
                    arg_28 = arg_22['parameter_summary'].decode('utf-8')
                    arg_29 = arg_22['short_environment_hexsha'].decode('utf-8')

                    # To allow backwards compatibility we need this try catch block
                    try:
                        arg_30 = arg_22['runtime'].decode('utf-8')
                        arg_31 = float(arg_22['finish_timestamp'])
                    except (IndexError, ValueError) as ke:
                        arg_30 = ''
                        arg_31 = 0.0
                        arg_0._logger.debug('Could not load runtime, ' + repr(ke))

                    arg_32 = {'idx': arg_24,
                                 'timestamp': arg_25,
                                 'finish_timestamp': arg_31,
                                 'runtime': arg_30,
                                 'time': arg_26,
                                 'completed': arg_27,
                                 'name': arg_23,
                                 'parameter_summary': arg_28,
                                 'short_environment_hexsha': arg_29}

                    arg_1._add_run_info(**arg_32)
            else:
                arg_1._length = arg_21.nrows

        # Load explorations
        arg_0._trj_load_exploration(arg_1)
        # Load the hdf5 config data:
        arg_0._srvc_load_hdf5_settings()


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
if
os
.
path
.
isfile
(
arg_2
)
:
arg_3
=
os
.
stat
(
arg_2
)
if
arg_2
!=
os
.
path
.
join
(
tower_dir
,
'tower_cli.cfg'
)
and
(
(
arg_3
.
st_mode
&
stat
.
S_IRGRP
)
or
(
arg_3
.
st_mode
&
stat
.
S_IROTH
)
)
:
warnings
.
warn
(
'File {0} readable by group or others.'
.
format
(
arg_2
)
,
RuntimeWarning
)
try
:
return
configparser
.
ConfigParser
.
Func
(
arg_0
,
arg_1
,
arg_2
)
except
configparser
.
MissingSectionHeaderError
:
arg_1
.
seek
(
0
)
arg_4
=
'[general]\n%s'
%
arg_1
.
read
(
)
arg_5
=
StringIO
(
arg_4
)
return
configparser
.
ConfigParser
.
Func
(
arg_0
,
arg_5
,
arg_2
)

def Func(arg_0, arg_1, arg_2):
        """Read the configuration from the given file.

        If the file lacks any section header, add a [general] section
        header that encompasses the whole thing.
        """
        # Attempt to read the file using the superclass implementation.
        #
        # Check the permissions of the file we are considering reading
        # if the file exists and the permissions expose it to reads from
        # other users, raise a warning
        if os.path.isfile(arg_2):
            arg_3 = os.stat(arg_2)
            if arg_2 != os.path.join(tower_dir, 'tower_cli.cfg') and (
                (arg_3.st_mode & stat.S_IRGRP) or
                (arg_3.st_mode & stat.S_IROTH)
            ):
                warnings.warn('File {0} readable by group or others.'
                              .format(arg_2), RuntimeWarning)
        # If it doesn't work because there's no section header, then
        # create a section header and call the superclass implementation
        # again.
        try:
            return configparser.ConfigParser.Func(arg_0, arg_1, arg_2)
        except configparser.MissingSectionHeaderError:
            arg_1.seek(0)
            arg_4 = '[general]\n%s' % arg_1.read()
            arg_5 = StringIO(arg_4)  # flo == file-like object
            return configparser.ConfigParser.Func(arg_0, arg_5, arg_2)

Read the configuration from the given file .


return self.__call_api(self.session.get, path, **kargs)

def Func ( arg_0 , arg_1 , ** arg_2 ) : return arg_0 . __call_api ( arg_0 . session . get , arg_1 , ** arg_2 )

def Func(arg_0, arg_1, **arg_2):
        '''
        Make a HTTP GET request to the Dominos UK API with the given parameters
        for the current session.

        :param string path: The API endpoint path.
        :params list kargs: A list of arguments.
        :return: A response from the Dominos UK API.
        :rtype: response.Response
        '''
        return arg_0.__call_api(arg_0.session.get, arg_1, **arg_2)

Make a HTTP GET request to the Dominos UK API with the given parameters for the current session .


return [
            Snapshot(token=self.token, **snapshot)
            for snapshot in data['snapshots']
        ]

def Func ( arg_0 ) : arg_1 = arg_0 . get_data ( "snapshots/" ) return [ Snapshot ( token = arg_0 . token , ** arg_2 ) for arg_2 in arg_1 [ 'snapshots' ] ]

def Func(arg_0):
        """
            This method returns a list of all Snapshots.
        """
        arg_1 = arg_0.get_data("snapshots/")
        return [
            Snapshot(token=arg_0.token, **arg_2)
            for arg_2 in arg_1['snapshots']
        ]

This method returns a list of all Snapshots .


def Func ( arg_0 , arg_1 , arg_2 = 0 ) : arg_3 = [ ] for arg_4 in arg_0 : arg_5 = ( arg_4 - arg_2 ) // float ( arg_1 ) if arg_5 not in arg_3 : arg_3 . append ( arg_5 ) arg_3 . sort ( ) return arg_3

def Func(arg_0, arg_1, arg_2=0):
    """
    Split list of integers into blocks of block_size and return block indices.

    First block element will be located at initial_boundary (default 0).

    >>> Func([0, -1, -2, -3, -4, -5, -6, -7, -8, -9], 8)
    [0,-1]
    >>> Func([0], 8)
    [0]
    >>> Func([0], 8, initial_boundary=32)
    [-4]
    """
    arg_3 = []

    for arg_4 in arg_0:
        arg_5 = (arg_4-arg_2)//float(arg_1)
        if arg_5 not in arg_3:
            arg_3.append(arg_5)
    arg_3.sort()

    return arg_3

Split list of integers into blocks of block_size and return block indices.

    First block element will be located at initial_boundary (default 0).

    >>> blocking([0, -1, -2, -3, -4, -5, -6, -7, -8, -9], 8)
    [0,-1]
    >>> blocking([0], 8)
    [0]
    >>> blocking([0], 8, initial_boundary=32)
    [-4]

Split list of integers into blocks of block_size and return block indices .


def Func ( arg_0 , arg_1 = None ) : arg_2 = ( SERVER_URL , SERVER_PORT ) arg_0 . server = HTTPServer ( arg_2 , OAuth2UtilRequestHandler ) arg_0 . server . response_code = None arg_0 . server . authorize_url = arg_1 arg_5 = Thread ( target = arg_0 . server . serve_forever ) arg_5 . daemon = True arg_5 . start ( )

def Func(arg_0, arg_1=None):
		"""
		Start the webserver that will receive the code
		"""
		arg_2 = (SERVER_URL, SERVER_PORT)
		arg_0.server = HTTPServer(arg_2, OAuth2UtilRequestHandler)
		arg_0.server.response_code = None
		arg_0.server.authorize_url = arg_1
		arg_5 = Thread(target=arg_0.server.serve_forever)
		arg_5.daemon = True
		arg_5.start()


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_1
[
0
]
[
"p4"
]
if
not
all
(
[
arg_3
[
"p4"
]
==
arg_2
for
arg_3
in
arg_1
]
)
:
raise
Exception
(
"no good"
)
arg_4
=
ete
.
Tree
(
arg_0
.
write
(
format
=
1
)
)
arg_5
=
[
arg_3
for
arg_3
in
arg_4
.
get_leaf_names
(
)
if
arg_3
not
in
arg_2
]
arg_5
+=
[
arg_2
[
0
]
]
arg_4
.
prune
(
arg_5
)
arg_4
.
search_nodes
(
arg_7
=
arg_2
[
0
]
)
[
0
]
.
name
=
"outgroup"
arg_4
.
ladderize
(
)
arg_8
=
copy
.
deepcopy
(
arg_1
)
arg_9
=
[
]
for
arg_10
in
arg_8
:
arg_10
[
"p4"
]
=
[
"outgroup"
]
arg_9
.
append
(
arg_10
)
return
arg_4
,
arg_9

def Func(arg_0, arg_1):
    """ collapse outgroup in ete Tree for easier viewing """
    ## check that all tests have the same outgroup
    arg_2 = arg_1[0]["p4"]
    if not all([arg_3["p4"] == arg_2 for arg_3 in arg_1]):
        raise Exception("no good")

    ## prune tree, keep only one sample from outgroup
    arg_4 = ete.Tree(arg_0.write(format=1)) #tree.copy(method="deepcopy")
    arg_5 = [arg_3 for arg_3 in arg_4.get_leaf_names() if arg_3 not in arg_2]
    arg_5 += [arg_2[0]]
    arg_4.prune(arg_5)
    arg_4.search_nodes(arg_7=arg_2[0])[0].name = "outgroup"
    arg_4.ladderize()

    ## remove other ougroups from taxdicts
    arg_8 = copy.deepcopy(arg_1)
    arg_9 = []
    for arg_10 in arg_8:
        #test["p4"] = [outg[0]]
        arg_10["p4"] = ["outgroup"]
        arg_9.append(arg_10)

    return arg_4, arg_9


return self._perform_delete('/' + self.subscription_id + \
                                    '/affinitygroups/' + \
                                    _str(affinity_group_name))

def Func(arg_0, arg_1):
        '''
        Deletes an affinity group in the specified subscription.

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

Deletes an affinity group in the specified subscription .


def
Func
(
arg_0
)
:
if
hasattr
(
arg_0
,
"exifCache"
)
:
arg_1
=
arg_0
.
exifCache
else
:
arg_1
=
arg_0
.
exifCache
=
{
}
for
arg_2
in
arg_0
.
albums
.
values
(
)
:
for
arg_3
in
arg_2
.
images
:
arg_1
[
arg_4
.
path
.
join
(
arg_3
.
path
,
arg_3
.
filename
)
]
=
arg_3
.
exif
arg_8
=
arg_4
.
path
.
join
(
arg_0
.
settings
[
"destination"
]
,
".exif_cache"
)
if
len
(
arg_1
)
==
0
:
if
arg_4
.
path
.
exists
(
arg_8
)
:
arg_4
.
remove
(
arg_8
)
return
try
:
with
open
(
arg_8
,
"wb"
)
as
cacheFile
:
pickle
.
dump
(
arg_1
,
cacheFile
)
logger
.
debug
(
"Stored cache with %d entries"
,
len
(
arg_0
.
exifCache
)
)
except
Exception
as
e
:
logger
.
warn
(
"Could not store cache: %s"
,
e
)
arg_4
.
remove
(
arg_8
)

def Func(arg_0):
    """Stores the exif data of all images in the gallery"""

    if hasattr(arg_0, "exifCache"):
        arg_1 = arg_0.exifCache
    else:
        arg_1 = arg_0.exifCache = {}

    for arg_2 in arg_0.albums.values():
        for arg_3 in arg_2.images:
            arg_1[arg_4.path.join(arg_3.path, arg_3.filename)] = arg_3.exif

    arg_8 = arg_4.path.join(arg_0.settings["destination"], ".exif_cache")

    if len(arg_1) == 0:
        if arg_4.path.exists(arg_8):
            arg_4.remove(arg_8)
        return

    try:
        with open(arg_8, "wb") as cacheFile:
            pickle.dump(arg_1, cacheFile)
            logger.debug("Stored cache with %d entries", len(arg_0.exifCache))
    except Exception as e:
        logger.warn("Could not store cache: %s", e)
        arg_4.remove(arg_8)


def
Func
(
arg_0
,
arg_1
)
:
if
not
isinstance
(
arg_1
,
X509
)
:
raise
TypeError
(
"cert must be an X509 instance"
)
arg_2
=
_lib
.
SSL_CTX_Func
(
arg_0
.
_context
,
arg_1
.
_x509
)
if
not
arg_2
:
_raise_current_error
(
)

def Func(arg_0, arg_1):
        """
        Load a certificate from a X509 object

        :param cert: The X509 object
        :return: None
        """
        if not isinstance(arg_1, X509):
            raise TypeError("cert must be an X509 instance")

        arg_2 = _lib.SSL_CTX_Func(arg_0._context, arg_1._x509)
        if not arg_2:
            _raise_current_error()


def Func(arg_0):
    '''Adds method f to the Dataset class'''
    arg_1 = arg_0.__name__
    arg_2.__hidden__[arg_1] = arg_0
    return arg_0


def Func ( arg_0 , arg_1 ) : arg_0 . capture_sample_count += len ( arg_1 ) if arg_0 . Tcapture > 0 : arg_0 . data_capture = np . hstack ( ( arg_0 . data_capture , arg_1 ) ) if ( arg_0 . Tcapture > 0 ) and ( len ( arg_0 . data_capture ) > arg_0 . Ncapture ) : arg_0 . data_capture = arg_0 . data_capture [ - arg_0 . Ncapture : ]

def Func(arg_0,arg_1):
        """
        Append new samples to the data_capture array and increment the sample counter
        If length reaches Tcapture, then the newest samples will be kept. If Tcapture = 0
        then new values are not appended to the data_capture array.

        """
        arg_0.capture_sample_count += len(arg_1)
        if arg_0.Tcapture > 0:
            arg_0.data_capture = np.hstack((arg_0.data_capture,arg_1))
            if (arg_0.Tcapture > 0) and (len(arg_0.data_capture) > arg_0.Ncapture):
                arg_0.data_capture = arg_0.data_capture[-arg_0.Ncapture:]

Append new samples to the data_capture array and increment the sample counter If length reaches Tcapture then the newest samples will be kept . If Tcapture = 0 then new values are not appended to the data_capture array .


def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):
        """
        Read the data encoding the Digest object and decode it into its
        constituent parts.

        Args:
            istream (Stream): A data stream containing encoded object data,
                supporting a Func method; usually a BytearrayStream object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.
        """
        super(Digest, arg_0).Func(arg_1, arg_2=arg_2)
        arg_6 = BytearrayStream(arg_1.Func(arg_0.length))

        arg_0.hashing_algorithm.Func(arg_6, arg_2=arg_2)
        arg_0.digest_value.Func(arg_6, arg_2=arg_2)
        arg_0.key_format_type.Func(arg_6, arg_2=arg_2)

        arg_0.is_oversized(arg_6)
        arg_0.validate()

Read the data encoding the Digest object and decode it into its
        constituent parts.

        Args:
            istream (Stream): A data stream containing encoded object data,
                supporting a read method; usually a BytearrayStream object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

Read the data encoding the Digest object and decode it into its constituent parts .


return DropletActions(self.api, self, **info)

def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . _Func_droplet_info ( arg_1 ) return DropletActions ( arg_0 . api , arg_0 , ** arg_2 )

def Func(arg_0, arg_1):
        """
        Retrieve a droplet by id

        Parameters
        ----------
        id: int
            droplet id

        Returns
        -------
        droplet: DropletActions
        """
        arg_2 = arg_0._Func_droplet_info(arg_1)
        return DropletActions(arg_0.api, arg_0, **arg_2)


def Func ( arg_0 ) : arg_1 = { } for arg_2 in parse_list ( arg_0 ) : arg_3 , arg_4 , arg_5 = arg_2 . partition ( '=' ) if arg_4 != '=' : arg_1 [ arg_3 ] = None elif arg_4 and arg_5 : arg_5 = _dequote ( arg_5 . strip ( ) ) try : arg_1 [ arg_3 ] = int ( arg_5 ) except ValueError : arg_1 [ arg_3 ] = arg_5 for arg_3 in _CACHE_CONTROL_BOOL_DIRECTIVES : if arg_1 . get ( arg_3 , '' ) is None : arg_1 [ arg_3 ] = True return arg_1

def Func(arg_0):
    """
    Parse a `Cache-Control`_ header, returning a dictionary of key-value pairs.

    Any of the ``Cache-Control`` parameters that do not have directives, such
    as ``public`` or ``no-cache`` will be returned with a value of ``True``
    if they are set in the header.

    :param str header_value: ``Cache-Control`` header value to parse
    :return: the parsed ``Cache-Control`` header values
    :rtype: dict

    .. _Cache-Control: https://tools.ietf.org/html/rfc7234#section-5.2

    """
    arg_1 = {}

    for arg_2 in parse_list(arg_0):
        arg_3, arg_4, arg_5 = arg_2.partition('=')
        if arg_4 != '=':
            arg_1[arg_3] = None
        elif arg_4 and arg_5:
            arg_5 = _dequote(arg_5.strip())
            try:
                arg_1[arg_3] = int(arg_5)
            except ValueError:
                arg_1[arg_3] = arg_5
        # NB ``name='' is never valid and is ignored!

    # convert parameterless boolean directives
    for arg_3 in _CACHE_CONTROL_BOOL_DIRECTIVES:
        if arg_1.get(arg_3, '') is None:
            arg_1[arg_3] = True

    return arg_1

Parse a Cache - Control _ header returning a dictionary of key - value pairs .


def Func ( arg_0 ) : arg_1 = OAUTH_ROOT + '/authorize' arg_2 = { 'client_id' : arg_0 . client_id , 'redirect_uri' : arg_0 . redirect_uri , } return "{}?{}" . format ( arg_1 , urlencode ( arg_2 ) )

def Func(arg_0):
        """
        Return a URL to redirect the user to for OAuth authentication.
        """
        arg_1 = OAUTH_ROOT + '/authorize'
        arg_2 = {
            'client_id': arg_0.client_id,
            'redirect_uri': arg_0.redirect_uri,
        }
        return "{}?{}".format(arg_1, urlencode(arg_2))

Return a URL to redirect the user to for OAuth authentication .


def Func ( arg_0 ) : @ arg_0 . before_request def before_request ( ) : arg_1 . user = get_current_user ( ) if arg_1 . user and arg_1 . user . is_admin : arg_1 . _before_request_time = time . time ( ) @ arg_0 . after_request def after_request ( arg_4 ) : if hasattr ( arg_1 , '_before_request_time' ) : arg_5 = time . time ( ) - arg_1 . _before_request_time arg_4 . headers [ 'X-Render-Time' ] = arg_5 * 1000 return arg_4

def Func(arg_0):
    """Register hooks."""

    @arg_0.before_request
    def before_request():
        arg_1.user = get_current_user()
        if arg_1.user and arg_1.user.is_admin:
            arg_1._before_request_time = time.time()

    @arg_0.after_request
    def after_request(arg_4):
        if hasattr(arg_1, '_before_request_time'):
            arg_5 = time.time() - arg_1._before_request_time
            arg_4.headers['X-Render-Time'] = arg_5 * 1000
        return arg_4


def Func ( arg_0 , arg_1 ) : if not os . path . exists ( arg_1 ) : return False arg_2 = os . stat ( arg_1 ) . st_mode if stat . S_ISCHR ( arg_2 ) : return True if stat . S_ISBLK ( arg_2 ) : return True if stat . S_ISFIFO ( arg_2 ) : return True if stat . S_ISSOCK ( arg_2 ) : return True return False

def Func(arg_0, arg_1):
        """Checks to see if a file is a special UNIX file.

        It checks if the file is a character special device, block special
        device, FIFO, or socket.

        :param filename: Name of the file

        :returns: True if the file is a special file. False, if is not.
        """
        # If it does not exist, it must be a new file so it cannot be
        # a special file.
        if not os.path.exists(arg_1):
            return False
        arg_2 = os.stat(arg_1).st_mode
        # Character special device.
        if stat.S_ISCHR(arg_2):
            return True
        # Block special device
        if stat.S_ISBLK(arg_2):
            return True
        # Named pipe / FIFO
        if stat.S_ISFIFO(arg_2):
            return True
        # Socket.
        if stat.S_ISSOCK(arg_2):
            return True
        return False

Checks to see if a file is a special UNIX file .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = getattr ( arg_1 , arg_0 . attname ) if arg_3 and not arg_3 . _committed : arg_4 = arg_3 if arg_0 . resize_source_to : arg_3 . seek ( 0 ) arg_4 = processors . process ( arg_3 , arg_0 . resize_source_to ) arg_4 = post_processors . process ( arg_4 , arg_0 . resize_source_to ) arg_5 = str ( shortuuid . uuid ( ) ) + os . path . splitext ( arg_3 . name ) [ 1 ] arg_3 . save ( arg_5 , arg_4 , save = False ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """
        Process the source image through the defined processors.
        """
        arg_3 = getattr(arg_1, arg_0.attname)

        if arg_3 and not arg_3._committed:
            arg_4 = arg_3
            if arg_0.resize_source_to:
                arg_3.seek(0)
                arg_4 = processors.process(arg_3, arg_0.resize_source_to)
                arg_4 = post_processors.process(arg_4, arg_0.resize_source_to)
            arg_5 = str(shortuuid.uuid()) + os.path.splitext(arg_3.name)[1]
            arg_3.save(arg_5, arg_4, save=False)
        return arg_3

Process the source image through the defined processors .


def
Func
(
arg_0
,
arg_1
:
arg_2
=
False
)
->
Namespace
:
if
not
arg_0
.
is_populated
(
)
:
arg_0
.
populate
(
)
arg_3
=
arg_0
.
_get_default_namespace
(
)
if
arg_3
is
:
log
.
info
(
'making namespace for %s'
,
arg_0
.
_get_namespace_name
(
)
)
return
arg_0
.
_make_namespace
(
)
if
arg_1
:
arg_0
.
_update_namespace
(
arg_3
)
return
arg_3

def Func(arg_0, arg_1: arg_2 = False) -> Namespace:
        """Upload the namespace to the PyBEL database.

        :param update: Should the namespace be updated first?
        """
        if not arg_0.is_populated():
            arg_0.populate()

        arg_3 = arg_0._get_default_namespace()

        if arg_3 is None:
            log.info('making namespace for %s', arg_0._get_namespace_name())
            return arg_0._make_namespace()

        if arg_1:
            arg_0._update_namespace(arg_3)

        return arg_3

Upload the namespace to the PyBEL database .


def Func ( arg_0 ) : arg_1 = os . path . join ( c . bview_dir , arg_0 ) arg_2 = os . path . join ( c . bview_dir , 'old' , arg_0 ) if not os . path . exists ( arg_1 ) and not os . path . exists ( arg_2 ) : return False return True

def Func(arg_0):
    """
        Verify that the file has not already been downloaded.
    """
    arg_1 = os.path.join(c.bview_dir, arg_0)
    arg_2 = os.path.join(c.bview_dir, 'old', arg_0)
    if not os.path.exists(arg_1) and not os.path.exists(arg_2):
        return False
    return True

Verify that the file has not already been downloaded .


return ['ssh', parts[0]] + (['-p', port] if port else []) + ['-C'] + [remote_cmd]

def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
'bash'
)
:
arg_4
=
arg_5
=
arg_1
.
split
(
':'
,
1
)
if
len
(
arg_5
)
>
1
and
not
arg_5
[
1
]
.
isdigit
(
)
:
raise
InvalidConfig
(
extra_body
=
'Invalid port number on ssh config: {}'
.
format
(
arg_5
[
1
]
)
)
elif
len
(
arg_5
)
>
1
:
arg_4
=
arg_5
[
1
]
arg_6
=
' '
.
join
(
[
x
.
replace
(
"'"
,
"""'"'"'"""
)
for
x
in
arg_0
.
split
(
' '
)
]
)
arg_7
=
' '
.
join
(
[
' '
.
join
(
get_shell
(
arg_3
)
)
,
' '
.
join
(
[
EXECUTE_SHELL_PARAM
,
"'"
,
' '
.
join
(
(
[
'cd'
,
arg_2
,
';'
]
if
arg_2
else
[
]
)
+
[
arg_6
]
)
,
"'"
]
)
]
,
)
return
[
'ssh'
,
arg_5
[
0
]
]
+
(
[
'-p'
,
arg_4
]
if
arg_4
else
[
]
)
+
[
'-C'
]
+
[
arg_7
]

def Func(arg_0, arg_1, arg_2=None, arg_3='bash'):
    """Excecute command on remote machine using SSH

    :param cmd: Command to execute
    :param ssh: Server to connect. Port is optional
    :param cwd: current working directory
    :return: None
    """
    arg_4 = None
    arg_5 = arg_1.split(':', 1)
    if len(arg_5) > 1 and not arg_5[1].isdigit():
        raise InvalidConfig(extra_body='Invalid port number on ssh config: {}'.format(arg_5[1]))
    elif len(arg_5) > 1:
        arg_4 = arg_5[1]
    arg_6 = ' '.join([x.replace("'", """'"'"'""") for x in arg_0.split(' ')])
    arg_7 = ' '.join([
        ' '.join(get_shell(arg_3)), # /usr/bin/env bash
        ' '.join([EXECUTE_SHELL_PARAM, "'", ' '.join((['cd', arg_2, ';'] if arg_2 else []) + [arg_6]), "'"])],
    )
    return ['ssh', arg_5[0]] + (['-p', arg_4] if arg_4 else []) + ['-C'] + [arg_7]


def Func(arg_0, arg_1, arg_2, arg_3):
        """Actual rule setup."""
        assert arg_1 not in arg_0.descriptors, "Registering alias %s twice!" % arg_1
        arg_4 = LibC.inotify_add_watch(arg_0._fd, arg_2, arg_3)
        if arg_4 < 0:
            raise IOError("Error setting up watch on %s with flags %s: wd=%s" % (
                arg_2, arg_3, arg_4))
        arg_0.descriptors[arg_1] = arg_4
        arg_0.aliases[arg_4] = arg_1


(file_path, sa, nameservers, dns_timeout, parallel=False)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = False ) : try : arg_5 = parse_report_file ( arg_0 , arg_2 = arg_2 , arg_3 = arg_3 , strip_attachment_payloads = arg_1 , arg_4 = arg_4 ) except ParserError as error : return error , arg_0 finally : global counter with counter . get_lock ( ) : counter . value += 1 return arg_5 , arg_0

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False):
    """Separated this function for multiprocessing"""
    try:
        arg_5 = parse_report_file(arg_0,
                                         arg_2=arg_2,
                                         arg_3=arg_3,
                                         strip_attachment_payloads=arg_1,
                                         arg_4=arg_4)
    except ParserError as error:
        return error, arg_0
    finally:
        global counter
        with counter.get_lock():
            counter.value += 1
    return arg_5, arg_0


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_2
=
arg_0
.
_compose_arthur_params
(
arg_0
.
backend_section
,
arg_1
)
if
arg_0
.
backend_section
==
'git'
:
arg_2
[
'gitpath'
]
=
os
.
path
.
join
(
arg_0
.
REPOSITORY_DIR
,
arg_1
)
arg_2
[
'tag'
]
=
arg_0
.
backend_tag
(
arg_1
)
arg_3
=
{
"tasks"
:
[
{
}
]
}
arg_3
[
"tasks"
]
[
0
]
[
'task_id'
]
=
arg_0
.
backend_tag
(
arg_1
)
arg_3
[
"tasks"
]
[
0
]
[
'backend'
]
=
arg_0
.
backend_section
.
split
(
":"
)
[
0
]
arg_3
[
"tasks"
]
[
0
]
[
'backend_args'
]
=
arg_2
arg_3
[
"tasks"
]
[
0
]
[
'category'
]
=
arg_2
[
'category'
]
arg_3
[
"tasks"
]
[
0
]
[
'archive'
]
=
{
}
arg_3
[
"tasks"
]
[
0
]
[
'scheduler'
]
=
{
"delay"
:
arg_0
.
ARTHUR_TASK_DELAY
}
arg_4
=
arg_0
.
_get_collection_url
(
)
arg_5
=
arg_0
.
conf
[
arg_0
.
backend_section
]
[
'raw_index'
]
arg_6
=
ElasticSearch
(
arg_4
,
arg_5
)
arg_7
=
get_connector_from_name
(
arg_0
.
backend_section
)
arg_8
=
arg_7
[
0
]
arg_9
=
inspect
.
signature
(
arg_8
.
fetch
)
arg_10
=
arg_11
=
{
"name"
:
"tag"
,
"value"
:
arg_2
[
'tag'
]
}
if
'from_date'
in
arg_9
.
parameters
:
arg_10
=
arg_6
.
get_last_item_field
(
'metadata__updated_on'
,
[
arg_11
]
)
if
arg_10
:
arg_3
[
"tasks"
]
[
0
]
[
'backend_args'
]
[
'from_date'
]
=
arg_10
.
isoformat
(
)
elif
'offset'
in
arg_9
.
parameters
:
arg_10
=
arg_6
.
get_last_item_field
(
'offset'
,
[
arg_11
]
)
if
arg_10
:
arg_3
[
"tasks"
]
[
0
]
[
'backend_args'
]
[
'offset'
]
=
arg_10
if
arg_10
:
logging
.
info
(
"Getting raw item with arthur since %s"
,
arg_10
)
return
(
arg_3
)

def Func(arg_0, arg_1, arg_2):
        """ Create the JSON for configuring arthur to collect data

        https://github.com/grimoirelab/arthur#adding-tasks
        Sample for git:

        {
        "tasks": [
            {
                "task_id": "arthur.git",
                "backend": "git",
                "backend_args": {
                    "gitpath": "/tmp/arthur_git/",
                    "uri": "https://github.com/grimoirelab/arthur.git"
                },
                "category": "commit",
                "archive_args": {
                    "archive_path": '/tmp/test_archives',
                    "fetch_from_archive": false,
                    "archive_after": None
                },
                "scheduler_args": {
                    "delay": 10
                }
            }
        ]
        }
        """

        arg_2 = arg_0._compose_arthur_params(arg_0.backend_section, arg_1)
        if arg_0.backend_section == 'git':
            arg_2['gitpath'] = os.path.join(arg_0.REPOSITORY_DIR, arg_1)
        arg_2['tag'] = arg_0.backend_tag(arg_1)

        arg_3 = {"tasks": [{}]}
        # This is the perceval tag
        arg_3["tasks"][0]['task_id'] = arg_0.backend_tag(arg_1)
        arg_3["tasks"][0]['backend'] = arg_0.backend_section.split(":")[0]
        arg_3["tasks"][0]['backend_args'] = arg_2
        arg_3["tasks"][0]['category'] = arg_2['category']
        arg_3["tasks"][0]['archive'] = {}
        arg_3["tasks"][0]['scheduler'] = {"delay": arg_0.ARTHUR_TASK_DELAY}
        # from-date or offset param must be added
        arg_4 = arg_0._get_collection_url()
        arg_5 = arg_0.conf[arg_0.backend_section]['raw_index']
        # Get the last activity for the data source
        arg_6 = ElasticSearch(arg_4, arg_5)
        arg_7 = get_connector_from_name(arg_0.backend_section)

        arg_8 = arg_7[0]  # Backend for the connector
        arg_9 = inspect.signature(arg_8.fetch)

        arg_10 = None
        arg_11 = {"name": "tag", "value": arg_2['tag']}
        if 'from_date' in arg_9.parameters:
            arg_10 = arg_6.get_last_item_field('metadata__updated_on', [arg_11])
            if arg_10:
                arg_3["tasks"][0]['backend_args']['from_date'] = arg_10.isoformat()
        elif 'offset' in arg_9.parameters:
            arg_10 = arg_6.get_last_item_field('offset', [arg_11])
            if arg_10:
                arg_3["tasks"][0]['backend_args']['offset'] = arg_10

        if arg_10:
            logging.info("Getting raw item with arthur since %s", arg_10)

        return(arg_3)


def Func(arg_0, arg_1):
        """Assigns function to the operators property of the instance.
        """
        if arg_1 in arg_0.OPERATORS:
            return arg_0.OPERATORS.get(arg_1)
        try:
            arg_2 = len(inspect.getargspec(arg_1)[0])
            if arg_2 != 2:
                raise TypeError
        except:
            eprint('Error: invalid operator function. Operators must accept two args.')
            raise
        else:
            return arg_1

Assigns function to the operators property of the instance .


def Func ( arg_0 ) : def promote_i4 ( arg_1 ) : if arg_1 [ 1 : ] == 'i4' : arg_1 = arg_1 [ 0 ] + 'i8' return arg_1 arg_2 = [ ( name , promote_i4 ( arg_1 ) ) for name , arg_1 in arg_0 . dtype . descr ] return arg_0 . astype ( arg_2 )

def Func(arg_0):
    """Return view of the recarray with all int32 cast to int64."""
    # build new dtype and replace i4 --> i8
    def promote_i4(arg_1):
        if arg_1[1:] == 'i4':
            arg_1 = arg_1[0]+'i8'
        return arg_1

    arg_2 = [(name, promote_i4(arg_1)) for name,arg_1 in arg_0.dtype.descr]
    return arg_0.astype(arg_2)

Return view of the recarray with all int32 cast to int64 .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = { 'jobs[]' : arg_1 , 'seo_details' : arg_2 , 'lang' : arg_3 , } arg_5 = make_get_request ( arg_0 , 'jobs' , params_data = arg_4 ) arg_6 = arg_5 . json ( ) if arg_5 . status_code == 200 : return arg_6 [ 'result' ] else : raise JobsNotFoundException ( message = arg_6 [ 'message' ] , error_code = arg_6 [ 'error_code' ] , request_id = arg_6 [ 'request_id' ] )

def Func(arg_0, arg_1, arg_2, arg_3):
    """
    Get a list of jobs
    """
    arg_4 = {
        'jobs[]': arg_1,
        'seo_details': arg_2,
        'lang': arg_3,
    }
    # GET /api/projects/0.1/jobs/
    arg_5 = make_get_request(arg_0, 'jobs', params_data=arg_4)
    arg_6 = arg_5.json()
    if arg_5.status_code == 200:
        return arg_6['result']
    else:
        raise JobsNotFoundException(
            message=arg_6['message'],
            error_code=arg_6['error_code'],
            request_id=arg_6['request_id'])


def Func ( arg_0 ) : arg_0 . clear ( ) try : arg_0 . _find_file ( ) except IOError as e : raise ConfigFileNotFound ( str ( e ) ) arg_0 . _read_file_as_dict ( ) arg_0 . _convert_to_config ( ) return arg_0 . config

def Func(arg_0):
        """Load the config from a file and return it as a Struct."""
        arg_0.clear()
        try:
            arg_0._find_file()
        except IOError as e:
            raise ConfigFileNotFound(str(e))
        arg_0._read_file_as_dict()
        arg_0._convert_to_config()
        return arg_0.config

Load the config from a file and return it as a Struct .


def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
read
(
len
(
headers
.
LAS_FILE_SIGNATURE
)
)
if
arg_1
!=
headers
.
LAS_FILE_SIGNATURE
:
raise
errors
.
PylasError
(
"File Signature ({}) is not {}"
.
format
(
arg_1
,
headers
.
LAS_FILE_SIGNATURE
)
)

def Func(arg_0):
    """ Reads the 4 first bytes of the stream to check that is LASF"""
    arg_1 = arg_0.read(len(headers.LAS_FILE_SIGNATURE))
    if arg_1 != headers.LAS_FILE_SIGNATURE:
        raise errors.PylasError(
            "File Signature ({}) is not {}".format(arg_1, headers.LAS_FILE_SIGNATURE)
        )


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = tempfile . tempdir arg_4 = os . path . join ( tempfile . NamedTemporaryFile ( delete = False , prefix = str ( arg_2 ) , dir = arg_3 , ) ) arg_4 . write ( arg_1 ) arg_4 . flush ( ) arg_5 = raxml ( name = str ( arg_2 ) , data = arg_4 . name , workdir = arg_3 , N = 1 , T = 2 ) arg_5 . run ( force = True , block = True , quiet = True ) arg_4 . close ( ) arg_6 = get_order ( toytree . tree ( arg_5 . trees . bestTree ) ) return "" . join ( arg_6 )

def Func(arg_0, arg_1, arg_2):
        """
        Write nexus to tmpfile, runs phyml tree inference, and parses
        and returns the resulting tree.
        """
        ## create a tmpdir for this test
        arg_3 = tempfile.tempdir
        arg_4 = os.path.join(tempfile.NamedTemporaryFile(
            delete=False,
            prefix=str(arg_2),
            dir=arg_3,
        ))

        ## write nexus to tmpfile
        arg_4.write(arg_1)
        arg_4.flush()

        ## infer the tree
        arg_5 = raxml(name=str(arg_2), data=arg_4.name, workdir=arg_3, N=1, T=2)
        arg_5.run(force=True, block=True, quiet=True)

        ## clean up
        arg_4.close()

        ## return tree order
        arg_6 = get_order(toytree.tree(arg_5.trees.bestTree))
        return "".join(arg_6)

Write nexus to tmpfile runs phyml tree inference and parses and returns the resulting tree .


def Func ( arg_0 ) : if not mcmc_util . is_list_like ( arg_0 ) : arg_0 = [ arg_0 ] def fn ( arg_1 ) : return [ arg_2 . inverse ( arg_3 ) for arg_2 , arg_3 in zip ( arg_0 , arg_1 ) ] return fn

def Func(arg_0):
  """Makes a function which applies a list of Bijectors' `inverse`s."""
  if not mcmc_util.is_list_like(arg_0):
    arg_0 = [arg_0]
  def fn(arg_1):
    return [arg_2.inverse(arg_3)
            for arg_2, arg_3 in zip(arg_0, arg_1)]
  return fn

Makes a function which applies a list of Bijectors inverse s .


(dag_id=None, run_id=None, execution_date=None,
             state=None, external_trigger=None, no_backfills=False,
             session=None)

def Func ( arg_0 = None , arg_1 = None , arg_2 = None , arg_3 = None , arg_4 = None , arg_5 = False , arg_6 = None ) : arg_7 = DagRun arg_8 = arg_6 . query ( arg_7 ) if arg_0 : arg_8 = arg_8 . filter ( arg_7 . dag_id == arg_0 ) if arg_1 : arg_8 = arg_8 . filter ( arg_7 . run_id == arg_1 ) if arg_2 : if isinstance ( arg_2 , list ) : arg_8 = arg_8 . filter ( arg_7 . execution_date . in_ ( arg_2 ) ) else : arg_8 = arg_8 . filter ( arg_7 . execution_date == arg_2 ) if arg_3 : arg_8 = arg_8 . filter ( arg_7 . state == arg_3 ) if arg_4 is not None : arg_8 = arg_8 . filter ( arg_7 . external_trigger == arg_4 ) if arg_5 : from airflow . jobs import BackfillJob arg_8 = arg_8 . filter ( arg_7 . run_id . notlike ( BackfillJob . ID_PREFIX + '%' ) ) arg_9 = arg_8 . order_by ( arg_7 . execution_date ) . all ( ) return arg_9

def Func(arg_0=None, arg_1=None, arg_2=None,
             arg_3=None, arg_4=None, arg_5=False,
             arg_6=None):
        """
        Returns a set of dag runs for the given search criteria.

        :param dag_id: the dag_id to Func dag runs for
        :type dag_id: int, list
        :param run_id: defines the the run id for this dag run
        :type run_id: str
        :param execution_date: the execution date
        :type execution_date: datetime.datetime
        :param state: the state of the dag run
        :type state: airflow.utils.state.State
        :param external_trigger: whether this dag run is externally triggered
        :type external_trigger: bool
        :param no_backfills: return no backfills (True), return all (False).
            Defaults to False
        :type no_backfills: bool
        :param session: database session
        :type session: sqlalchemy.orm.session.Session
        """
        arg_7 = DagRun

        arg_8 = arg_6.query(arg_7)
        if arg_0:
            arg_8 = arg_8.filter(arg_7.dag_id == arg_0)
        if arg_1:
            arg_8 = arg_8.filter(arg_7.run_id == arg_1)
        if arg_2:
            if isinstance(arg_2, list):
                arg_8 = arg_8.filter(arg_7.execution_date.in_(arg_2))
            else:
                arg_8 = arg_8.filter(arg_7.execution_date == arg_2)
        if arg_3:
            arg_8 = arg_8.filter(arg_7.state == arg_3)
        if arg_4 is not None:
            arg_8 = arg_8.filter(arg_7.external_trigger == arg_4)
        if arg_5:
            # in order to prevent a circular dependency
            from airflow.jobs import BackfillJob
            arg_8 = arg_8.filter(arg_7.run_id.notlike(BackfillJob.ID_PREFIX + '%'))

        arg_9 = arg_8.order_by(arg_7.execution_date).all()

        return arg_9

Returns a set of dag runs for the given search criteria.

        :param dag_id: the dag_id to find dag runs for
        :type dag_id: int, list
        :param run_id: defines the the run id for this dag run
        :type run_id: str
        :param execution_date: the execution date
        :type execution_date: datetime.datetime
        :param state: the state of the dag run
        :type state: airflow.utils.state.State
        :param external_trigger: whether this dag run is externally triggered
        :type external_trigger: bool
        :param no_backfills: return no backfills (True), return all (False).
            Defaults to False
        :type no_backfills: bool
        :param session: database session
        :type session: sqlalchemy.orm.session.Session

Returns a set of dag runs for the given search criteria .


def Func ( arg_0 , arg_1 , arg_2 ) : return logging . getLevelName ( arg_0 . get ( arg_1 , arg_2 ) . upper ( ) )

def Func(arg_0, arg_1, arg_2):
          """Return the textual representation of logging level 'option' or the number.

          Note that option is always interpreted as an UPPERCASE string
          and hence integer log levels will not be recognized.

          .. SeeAlso: :mod:`logging` and :func:`logging.getLevelName`
          """
          return logging.getLevelName(arg_0.get(arg_1, arg_2).upper())

Return the textual representation of logging level option or the number .


(self,
                            asana_workspace_id,
                            name,
                            assignee,
                            projects,
                            completed,
                            issue_number,
                            issue_html_url,
                            issue_state,
                            issue_body,
                            tasks,
                            labels,
                            label_tag_map)

def Func(arg_0,
                            arg_1,
                            arg_2,
                            arg_3,
                            arg_4,
                            arg_5,
                            arg_6,
                            arg_7,
                            arg_8,
                            arg_9,
                            arg_10,
                            arg_11,
                            arg_12):

        """Creates a missing task."""

        arg_13 = arg_0.asana.tasks.create_in_workspace(
            arg_1,
            {
                'name': arg_2,
                'notes': arg_9,
                'assignee': arg_3,
                'projects': arg_4,
                'completed': arg_5,
            })

        # Announce task git issue
        arg_14 = arg_13['id']

        put("create_story",
            arg_14=arg_14,
            text="Git Issue #%d: \n"
                  "%s" % (
                    arg_6,
                    arg_7,
                    )
            )

        put("apply_tasks_to_issue",
            arg_10=[arg_14],
            arg_6=arg_6,
            arg_9=arg_9,
            )

        # Save task to drive
        put_setting("save_issue_data_task",
                    issue=arg_6,
                    arg_14=arg_14,
                    namespace=arg_8)

        arg_10.append(arg_14)

        # Sync tags/labels
        put("sync_tags",
            arg_10=arg_10,
            arg_11=arg_11,
            arg_12=arg_12)


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
log
.
debug
(
"Saving stepper info: %s"
,
arg_0
.
__si_filename
(
)
)
with
open
(
arg_0
.
__si_filename
(
)
,
'w'
)
as
si_file
:
json
.
dump
(
arg_1
.
_asdict
(
)
,
si_file
,
indent
=
4
)

def Func(arg_0, arg_1):
        '''
        Write stepper info to json
        '''
        arg_0.log.debug("Saving stepper info: %s", arg_0.__si_filename())
        with open(arg_0.__si_filename(), 'w') as si_file:
            json.dump(arg_1._asdict(), si_file, indent=4)


Just sends the request using its send method and returns its response.

def Func ( arg_0 , arg_1 = False ) : arg_0 . Func ( arg_1 = arg_1 ) return arg_0 . response

def Func(arg_0, arg_1=False):
    """Just Funcs the request using its Func method and returns its response.  """
    arg_0.Func(arg_1=arg_1)
    return arg_0.response

Just sends the request using its send method and returns its response .


def
Func
(
arg_0
,
arg_1
)
:
LOGGER
.
info
(
"Entering Func: %s"
,
arg_1
.
name
)
arg_2
=
os
.
path
.
join
(
arg_0
.
dirs
.
refmapping
,
arg_1
.
name
+
"-mapped-sorted.bam"
)
arg_3
=
[
ipyrad
.
bins
.
bedtools
,
"bamtobed"
,
"-i"
,
arg_2
]
arg_4
=
[
ipyrad
.
bins
.
bedtools
,
"merge"
,
"-i"
,
"-"
]
if
'pair'
in
arg_0
.
paramsdict
[
"datatype"
]
:
check_insert_size
(
arg_0
,
arg_1
)
arg_4
.
insert
(
2
,
str
(
arg_0
.
_hackersonly
[
"max_inner_mate_distance"
]
)
)
arg_4
.
insert
(
2
,
"-d"
)
else
:
arg_4
.
insert
(
2
,
str
(
1
*
arg_0
.
_hackersonly
[
"min_SE_refmap_overlap"
]
)
)
arg_4
.
insert
(
2
,
"-d"
)
LOGGER
.
info
(
"stdv: bedtools merge cmds: %s %s"
,
arg_3
,
arg_4
)
arg_5
=
sps
.
Popen
(
arg_3
,
stderr
=
sps
.
STDOUT
,
stdout
=
sps
.
PIPE
)
arg_6
=
sps
.
Popen
(
arg_4
,
stderr
=
sps
.
STDOUT
,
stdout
=
sps
.
PIPE
,
stdin
=
arg_5
.
stdout
)
arg_7
=
arg_6
.
communicate
(
)
[
0
]
arg_5
.
stdout
.
close
(
)
if
arg_6
.
returncode
:
raise
IPyradWarningExit
(
"error in %s: %s"
,
arg_4
,
arg_7
)
if
os
.
path
.
exists
(
ipyrad
.
__debugflag__
)
:
with
open
(
os
.
path
.
join
(
arg_0
.
dirs
.
refmapping
,
arg_1
.
name
+
".bed"
)
,
'w'
)
as
outfile
:
outfile
.
write
(
arg_7
)
arg_8
=
len
(
arg_7
.
strip
(
)
.
split
(
"\n"
)
)
LOGGER
.
info
(
"Func: Got # regions: %s"
,
arg_8
)
return
arg_7

def Func(arg_0, arg_1):
    """
    Get all contiguous genomic regions with one or more overlapping
    reads. This is the shell command we'll eventually run

    bedtools bamtobed -i 1A_0.sorted.bam | bedtools merge [-d 100]
        -i <input_bam>  :   specifies the input file to bed'ize
        -d <int>        :   For PE set max distance between reads
    """
    LOGGER.info("Entering Func: %s", arg_1.name)
    arg_2 = os.path.join(arg_0.dirs.refmapping,
                               arg_1.name+"-mapped-sorted.bam")

    ## command to call `bedtools bamtobed`, and pipe output to stdout
    ## Usage:   bedtools bamtobed [OPTIONS] -i <bam>
    ## Usage:   bedtools merge [OPTIONS] -i <bam>
    arg_3 = [ipyrad.bins.bedtools, "bamtobed", "-i", arg_2]
    arg_4 = [ipyrad.bins.bedtools, "merge", "-i", "-"]

    ## If PE the -d flag to tell bedtools how far apart to allow mate pairs.
    ## If SE the -d flag is negative, specifying that SE reads need to
    ## overlap by at least a specific number of bp. This prevents the
    ## stairstep syndrome when a + and - read are both extending from
    ## the same cutsite. Passing a negative number to `merge -d` gets this done.
    if 'pair' in arg_0.paramsdict["datatype"]:
        check_insert_size(arg_0, arg_1)
        #cmd2.insert(2, str(data._hackersonly["max_inner_mate_distance"]))
        arg_4.insert(2, str(arg_0._hackersonly["max_inner_mate_distance"]))
        arg_4.insert(2, "-d")
    else:
        arg_4.insert(2, str(-1 * arg_0._hackersonly["min_SE_refmap_overlap"]))
        arg_4.insert(2, "-d")

    ## pipe output from bamtobed into merge
    LOGGER.info("stdv: bedtools merge cmds: %s %s", arg_3, arg_4)
    arg_5 = sps.Popen(arg_3, stderr=sps.STDOUT, stdout=sps.PIPE)
    arg_6 = sps.Popen(arg_4, stderr=sps.STDOUT, stdout=sps.PIPE, stdin=arg_5.stdout)
    arg_7 = arg_6.communicate()[0]
    arg_5.stdout.close()

    ## check for errors and do cleanup
    if arg_6.returncode:
        raise IPyradWarningExit("error in %s: %s", arg_4, arg_7)

    ## Write the bedfile out, because it's useful sometimes.
    if os.path.exists(ipyrad.__debugflag__):
        with open(os.path.join(arg_0.dirs.refmapping, arg_1.name + ".bed"), 'w') as outfile:
            outfile.write(arg_7)

    ## Report the number of regions we're returning
    arg_8 = len(arg_7.strip().split("\n"))
    LOGGER.info("Func: Got # regions: %s", arg_8)
    return arg_7

Get all contiguous genomic regions with one or more overlapping reads . This is the shell command we ll eventually run


def Func(arg_0, arg_1, arg_2):
    """Validate the CIDR for a subnet.

    Verifies the specified CIDR does not overlap with the ones defined
    for the other subnets specified for this network, or with any other
    CIDR if overlapping IPs are disabled.

    """
    if neutron_cfg.cfg.CONF.allow_overlapping_ips:
        return

    try:
        arg_3 = netaddr.IPSet([arg_2])
    except TypeError:
        LOG.exception("Invalid or missing cidr: %s" % arg_2)
        raise n_exc.BadRequest(resource="subnet",
                               msg="Invalid or missing cidr")

    arg_4 = {
        'network_id': arg_1,
        'shared': [False]
    }
    # Using admin context here, in case we actually share networks later
    arg_5 = db_api.subnet_find(arg_0=arg_0.elevated(), **arg_4)

    for arg_6 in arg_5:
        if (netaddr.IPSet([arg_6.cidr]) & arg_3):
            # don't give out details of the overlapping subnet
            arg_7 = (_("Requested subnet with cidr: %(cidr)s for "
                         "network: %(network_id)s overlaps with another "
                         "subnet") %
                       {'cidr': arg_2,
                        'network_id': arg_1})
            LOG.error(_("Validation for CIDR: %(new_cidr)s failed - "
                        "overlaps with subnet %(subnet_id)s "
                        "(CIDR: %(cidr)s)"),
                      {'new_cidr': arg_2,
                       'subnet_id': arg_6.id,
                       'cidr': arg_6.cidr})
            raise n_exc.InvalidInput(error_message=arg_7)


def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None):
    """Draws a filled circle at point x0,y0 with radius r and specified color"""
    _draw_fast_vline(arg_0, arg_1, arg_2 - arg_3, 2 * arg_3 + 1, arg_4)
    _Func_helper(arg_0, arg_1, arg_2, arg_3, 3, 0, arg_4)

Draws a filled circle at point x0 y0 with radius r and specified color


def Func ( ) : arg_0 = os . getenv ( "OMP_NUM_THREADS" ) if arg_0 is None : arg_0 = os . getenv ( "PBS_NUM_PPN" ) try : return int ( arg_0 ) except : return multiprocessing . Func ( )

def Func():
    """ Returns the default number of slave processes to be spawned.

        The default value is the number of physical cpu cores seen by python.
        :code:`OMP_NUM_THREADS` environment variable overrides it.

        On PBS/torque systems if OMP_NUM_THREADS is empty, we try to
        use the value of :code:`PBS_NUM_PPN` variable.

        Notes
        -----
        On some machines the physical number of cores does not equal
        the number of cpus shall be used. PSC Blacklight for example.

    """
    arg_0 = os.getenv("OMP_NUM_THREADS")
    if arg_0 is None:
        arg_0 = os.getenv("PBS_NUM_PPN")
    try:
        return int(arg_0)
    except:
        return multiprocessing.Func()

Returns the default number of slave processes to be spawned .


def
Func
(
arg_0
,
arg_1
=
False
)
:
if
arg_1
:
if
not
os
.
path
.
exists
(
arg_0
)
:
arg_2
=
'File not found: '
+
arg_0
log
.
error
(
arg_2
)
raise
IOError
(
arg_2
)
try
:
arg_3
,
arg_4
=
os
.
path
.
splitext
(
arg_0
)
except
:
raise
else
:
return
arg_4

def Func(arg_0, arg_1=False):
    """Return the extension of fpath.

    Parameters
    ----------
    fpath: string
    File name or path

    check_if_exists: bool

    Returns
    -------
    str
    The extension of the file name or path
    """
    if arg_1:
        if not os.path.exists(arg_0):
            arg_2 = 'File not found: ' + arg_0
            log.error(arg_2)
            raise IOError(arg_2)

    try:
        arg_3, arg_4 = os.path.splitext(arg_0)
    except:
        raise
    else:
        return arg_4