def
Func
(
arg_0
)
:
with
arg_0
.
lock
:
logger
.
debug
(
"Func: queue: {0!r}"
.
format
(
arg_0
.
_write_queue
)
)
try
:
arg_1
=
arg_0
.
_write_queue
.
popleft
(
)
except
IndexError
:
return
if
isinstance
(
arg_1
,
WriteData
)
:
arg_0
.
_do_write
(
arg_1
.
data
)
elif
isinstance
(
arg_1
,
ContinueConnect
)
:
arg_0
.
_continue_connect
(
)
elif
isinstance
(
arg_1
,
StartTLS
)
:
arg_0
.
_initiate_starttls
(
**
arg_1
.
kwargs
)
elif
isinstance
(
arg_1
,
TLSHandshake
)
:
arg_0
.
_continue_tls_handshake
(
)
else
:
raise
ValueError
(
"Unrecognized job in the write queue: "
"{0!r}"
.
format
(
arg_1
)
)

def Func(arg_0):
        """
        Handle the 'channel writable' state. E.g. send buffered data via a
        socket.
        """
        with arg_0.lock:
            logger.debug("Func: queue: {0!r}".format(arg_0._write_queue))
            try:
                arg_1 = arg_0._write_queue.popleft()
            except IndexError:
                return
            if isinstance(arg_1, WriteData):
                arg_0._do_write(arg_1.data) # pylint: disable=E1101
            elif isinstance(arg_1, ContinueConnect):
                arg_0._continue_connect()
            elif isinstance(arg_1, StartTLS):
                arg_0._initiate_starttls(**arg_1.kwargs)
            elif isinstance(arg_1, TLSHandshake):
                arg_0._continue_tls_handshake()
            else:
                raise ValueError("Unrecognized job in the write queue: "
                                        "{0!r}".format(arg_1))

Handle the channel writable state . E . g . send buffered data via a socket .


def Func(arg_0, arg_1, arg_2):
        ''' Return the builddir-relative path of program, if only a partial
            path is specified. Returns None and logs an error message if the
            program is ambiguous or not found
	'''
        # if this is an exact match, do no further checking:
        if os.path.isfile(os.path.join(arg_1, arg_2)):
            logging.info('found %s' % arg_2)
            return arg_2
        arg_3 = []
        arg_4 = []
        arg_5 = []
        for arg_6, arg_7, arg_8 in os.walk(arg_1):
            if arg_2 in arg_8:
                arg_3.append(os.path.relpath(os.path.join(arg_6, arg_2), arg_1))
                continue
            arg_9 = [arg_11.lower() for arg_11 in arg_8]
            if arg_2.lower() in arg_9:
                arg_4.append(
                    os.path.relpath(
                        os.path.join(arg_6, arg_8[arg_9.index(arg_2.lower())]),
                        arg_1
                    )
                )
                continue
            # !!! TODO: in the future add approximate string matching (typos,
            # etc.), for now we just test stripping any paths off program, and
            # looking for substring matches:
            arg_10 = os.path.splitext(os.path.basename(arg_2).lower())[0]
            for arg_11 in arg_9:
                if arg_10 in arg_11:
                    arg_5.append(
                        os.path.relpath(
                            os.path.join(arg_6, arg_8[arg_9.index(arg_11)]),
                            arg_1
                        )
                    )

        if len(arg_3) == 1:
            logging.info('found %s at %s', arg_2, arg_3[0])
            return arg_3[0]
        elif len(arg_3) > 1:
            logging.error(
                '%s matches multiple executables, please use a full path (one of %s)' % (
                    arg_2,
                    ', or '.join(['"'+os.path.join(arg_12, arg_2)+'"' for arg_12 in arg_3])
                )
            )
            return None
        # if we have matches with and without a file extension, prefer the
        # no-file extension version, and discard the others (so we avoid
        # picking up post-processed files):
        arg_13 = []
        for arg_12 in arg_5:
            arg_14 = os.path.splitext(arg_12)[0]
            if (arg_12 == arg_14) or (arg_14 not in arg_5):
                arg_13.append(arg_12)
        arg_5 = arg_13

        for arg_15 in (arg_4, arg_5):
            if len(arg_15) == 1:
                logging.info('found %s at %s' % (
                    arg_2, arg_15[0]
                ))
                return arg_15[0]
            elif len(arg_15) > 1:
                logging.error(
                    '%s is similar to several executables found. Please use an exact name:\n%s' % (
                        arg_2,
                        '\n'.join(arg_15)
                    )
                )
                return None
        logging.error('could not find program "%s" to debug' %  arg_2)
        return None

Return the builddir - relative path of program if only a partial path is specified . Returns None and logs an error message if the program is ambiguous or not found


def Func(arg_0=True):
    """Build and debug an application programatically

    For a list of GDB MI commands, see https://www.sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html
    """

    # Build C program
    find_executable(MAKE_CMD)
    if not find_executable(MAKE_CMD):
        print(
            'Could not find executable "%s". Ensure it is installed and on your $PATH.'
            % MAKE_CMD
        )
        exit(1)
    subprocess.check_output([MAKE_CMD, "-C", SAMPLE_C_CODE_DIR, "--quiet"])

    # Initialize object that manages gdb subprocess
    arg_1 = GdbController(arg_0=arg_0)

    # Send gdb commands. Gdb machine interface commands are easier to script around,
    # hence the name "machine interface".
    # Responses are automatically printed as they are received if verbose is True.
    # Responses are returned after writing, by default.

    # Load the file
    arg_2 = arg_1.write("-file-exec-and-symbols %s" % SAMPLE_C_BINARY)
    # Get list of source files used to compile the binary
    arg_2 = arg_1.write("-file-list-exec-source-files")
    # Add breakpoint
    arg_2 = arg_1.write("-break-insert Func")
    # Run
    arg_2 = arg_1.write("-exec-run")
    arg_2 = arg_1.write("-exec-next")
    arg_2 = arg_1.write("-exec-next")
    arg_2 = arg_1.write("-exec-continue")  # noqa: F841

    # gdbmi.gdb_process will be None because the gdb subprocess (and its inferior
    # program) will be terminated
    arg_1.exit()


return tf.reduce_sum(input_tensor=vs[..., tf.newaxis] * ms, axis=-2)

def Func ( arg_0 , arg_1 ) : return tf . reduce_sum ( input_tensor = arg_0 [ ... , tf . newaxis ] * arg_1 , axis = - 2 )

def Func(arg_0, arg_1):
  """Multiply tensor of vectors by matrices."""

  return tf.reduce_sum(input_tensor=arg_0[..., tf.newaxis] * arg_1, axis=-2)

Multiply tensor of vectors by matrices .


return sentences, lp_parser.relations, lp_parser.attributes

def Func ( arg_0 , arg_1 ) : arg_2 = LingPipeParser ( arg_0 . config ) arg_2 . set ( arg_1 ) arg_3 = list ( arg_2 . sentences ( ) ) return arg_3 , arg_2 . relations , arg_2 . attributes

def Func(arg_0, arg_1):
        '''parse the sentences and tokens out of the XML'''
        arg_2 = LingPipeParser(arg_0.config)
        arg_2.set(arg_1)
        arg_3 = list( arg_2.sentences() )
        return arg_3, arg_2.relations, arg_2.attributes


def Func ( arg_0 , arg_1 , arg_2 = False ) : arg_3 = arg_0 . events . index ( arg_0 . _events_dict [ arg_1 ] ) if arg_2 and arg_3 > 0 : return arg_0 . events [ arg_3 - 1 ] elif not arg_2 and arg_3 + 1 < len ( arg_0 . events ) : return arg_0 . events [ arg_3 + 1 ] else : return None

def Func(arg_0, arg_1, arg_2=False):
        """Get the event following another event in this conversation.

        Args:
            event_id (str): ID of the event.
            prev (bool): If ``True``, return the previous event rather than the
                next event. Defaults to ``False``.

        Raises:
            KeyError: If no such :class:`.ConversationEvent` is known.

        Returns:
            :class:`.ConversationEvent` or ``None`` if there is no following
            event.
        """
        arg_3 = arg_0.events.index(arg_0._events_dict[arg_1])
        if arg_2 and arg_3 > 0:
            return arg_0.events[arg_3 - 1]
        elif not arg_2 and arg_3 + 1 < len(arg_0.events):
            return arg_0.events[arg_3 + 1]
        else:
            return None

Get the event following another event in this conversation .


def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
get
(
'<form>'
)
logger
.
info
(
'Start generating form.'
)
_Func
(
arg_1
)
logger
.
info
(
'Finish generating form.'
)

def Func(arg_0):
    """Generate form."""
    arg_1 = arg_0.get('<form>')
    logger.info('Start generating form.')
    _Func(arg_1)
    logger.info('Finish generating form.')


return reversed(tuple(map(
        lambda obj: add_seen(obj) or obj,
        filterfalse(
            seen_set.__contains__,
            chain.from_iterable(map(reversed, reversed(ordereds))),
        ),
    )))

def Func ( arg_0 : arg_1 . Iterable [ arg_1 . Any ] ) -> arg_1 . Iterable [ arg_1 . Any ] : arg_4 = set ( ) arg_5 = arg_4 . add return reversed ( tuple ( map ( lambda obj : arg_5 ( obj ) or obj , filterfalse ( arg_4 . __contains__ , chain . from_iterable ( map ( reversed , reversed ( arg_0 ) ) ) , ) , ) ) )

def Func(arg_0: arg_1.Iterable[arg_1.Any]) -> arg_1.Iterable[arg_1.Any]:
    """Merge multiple ordered so that within-ordered order is preserved
    """
    arg_4 = set()
    arg_5 = arg_4.add
    return reversed(tuple(map(
        lambda obj: arg_5(obj) or obj,
        filterfalse(
            arg_4.__contains__,
            chain.from_iterable(map(reversed, reversed(arg_0))),
        ),
    )))

Merge multiple ordered so that within - ordered order is preserved


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : arg_3 = copy . copy ( arg_0 ) _bound_waveform ( arg_3 , arg_1 , arg_2 ) return np . max ( arg_3 . _dep_vector )

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

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

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

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

    :rtype: float

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

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

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

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

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

    .. [[[end]]]
    """
    arg_3 = copy.copy(arg_0)
    _bound_waveform(arg_3, arg_1, arg_2)
    return np.max(arg_3._dep_vector)

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

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

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

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

    :rtype: float

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

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

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

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

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

    .. [[[end]]]

r Return the maximum of a waveform s dependent variable vector .


def Func(arg_0):
        """Sets existing data to form fields."""

        # Get dictionary map of current model
        if arg_0.is_initialized:
            arg_0.model_map_dict = arg_0.create_document_dictionary(arg_0.model_instance)
        else:
            arg_0.model_map_dict = arg_0.create_document_dictionary(arg_0.model)

        arg_2 = arg_0.get_form_field_dict(arg_0.model_map_dict)
        arg_0.set_form_fields(arg_2)


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , tuple ) : for arg_2 in arg_1 : if arg_0 . node_type == arg_2 : return True return False else : return arg_0 . node_type == arg_1

def Func(arg_0, arg_1):
    """Returns True if node_type == value.

    If value is a tuple, node_type is checked against each member and True is returned if any of
    them match.
    """
    if isinstance(arg_1, tuple):
      for arg_2 in arg_1:
        if arg_0.node_type == arg_2:
          return True
      return False
    else:
      return arg_0.node_type == arg_1


(bucket_name,
                aws_access_key_id=None, aws_secret_access_key=None,
                aws_profile=None)

def Func(arg_0,
                arg_1=None, arg_2=None,
                arg_3=None):
    """Open an S3 Bucket resource.

    Parameters
    ----------
    bucket_name : `str`
        Name of the S3 bucket.
    aws_access_key_id : `str`, optional
        The access key for your AWS account. Also set
        ``aws_secret_access_key``.
    aws_secret_access_key : `str`, optional
        The secret key for your AWS account.
    aws_profile : `str`, optional
        Name of AWS profile in :file:`~/.aws/credentials`. Use this instead
        of ``aws_access_key_id`` and ``aws_secret_access_key`` for file-based
        credentials.

    Returns
    -------
    bucket : Boto3 S3 Bucket instance
        The S3 bucket as a Boto3 instance.
    """
    arg_4 = boto3.session.Session(
        profile_name=arg_3,
        arg_1=arg_1,
        arg_2=arg_2)
    arg_5 = arg_4.resource('s3')
    arg_6 = arg_5.Bucket(arg_0)
    return arg_6


Return the input string centered in a 'marquee'.

Return the input string centered in a marquee .


def Func(arg_0, arg_1, arg_2, *arg_3):
        """
        Aggregate the rows of the DataFrame into a single value.

        :param clazz: name of a class that extends class Callable
        :type clazz: class
        :param new_col: name of the new column
        :type new_col: str
        :param args: list of column names of the object that function
        should be applied to
        :type args: tuple
        :return: returns a new dataframe object with the Funcd value
        :rtype: DataFrame
        """
        if is_callable(arg_1) and not is_none(arg_2) and has_elements(*arg_3):
            return arg_0.__do_Func(arg_1, arg_2, *arg_3)

Aggregate the rows of the DataFrame into a single value.

        :param clazz: name of a class that extends class Callable
        :type clazz: class
        :param new_col: name of the new column
        :type new_col: str
        :param args: list of column names of the object that function
        should be applied to
        :type args: tuple
        :return: returns a new dataframe object with the aggregated value
        :rtype: DataFrame

Aggregate the rows of the DataFrame into a single value .


return [tok_encoded.decode('utf8')
                for (_, tok_encoded) in
                self.client.scan_keys(HASH_KEYWORD_INDEX_TABLE,
                                      ((tok_hash,), (tok_hash,)))]

def Func ( arg_0 , arg_1 ) : return [ arg_3 . decode ( 'utf8' ) for ( arg_2 , arg_3 ) in arg_0 . client . scan_keys ( HASH_KEYWORD_INDEX_TABLE , ( ( arg_1 , ) , ( arg_1 , ) ) ) ]

def Func(arg_0, arg_1):
        '''Get strings that correspond to some hash.

        No string will correspond to :data:`DOCUMENT_HASH_KEY`; use
        :data:`DOCUMENT_HASH_KEY_REPLACEMENT` instead.

        :param int tok_hash: Murmur hash to query
        :return: list of :class:`unicode` strings

        '''
        return [arg_3.decode('utf8')
                for (arg_2, arg_3) in
                arg_0.client.scan_keys(HASH_KEYWORD_INDEX_TABLE,
                                      ((arg_1,), (arg_1,)))]

Get strings that correspond to some hash .


(self, nodelist, cell_name, interactivity='last_expr')

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
'last_expr'
)
:
if
not
arg_1
:
return
if
arg_3
==
'last_expr'
:
if
isinstance
(
arg_1
[
1
]
,
ast
.
Expr
)
:
arg_3
=
"last"
else
:
arg_3
=
"none"
if
arg_3
==
'none'
:
arg_4
,
arg_5
=
arg_1
,
[
]
elif
arg_3
==
'last'
:
arg_4
,
arg_5
=
arg_1
[
:
1
]
,
arg_1
[
1
:
]
elif
arg_3
==
'all'
:
arg_4
,
arg_5
=
[
]
,
arg_1
else
:
raise
ValueError
(
"Interactivity was %r"
%
arg_3
)
arg_6
=
arg_0
.
execution_count
try
:
for
arg_7
,
arg_8
in
enumerate
(
arg_4
)
:
arg_9
=
ast
.
Module
(
[
arg_8
]
)
arg_10
=
arg_0
.
compile
(
arg_9
,
arg_2
,
"exec"
)
if
arg_0
.
run_code
(
arg_10
)
:
return
True
for
arg_7
,
arg_8
in
enumerate
(
arg_5
)
:
arg_9
=
ast
.
Interactive
(
[
arg_8
]
)
arg_10
=
arg_0
.
compile
(
arg_9
,
arg_2
,
"single"
)
if
arg_0
.
run_code
(
arg_10
)
:
return
True
if
softspace
(
sys
.
stdout
,
0
)
:
print
except
:
arg_0
.
showtraceback
(
)
return
False

def Func(arg_0, arg_1, arg_2, arg_3='last_expr'):
        """Run a sequence of AST nodes. The execution mode depends on the
        interactivity parameter.

        Parameters
        ----------
        nodelist : list
          A sequence of AST nodes to run.
        cell_name : str
          Will be passed to the compiler as the filename of the cell. Typically
          the value returned by ip.compile.cache(cell).
        interactivity : str
          'all', 'last', 'last_expr' or 'none', specifying which nodes should be
          run interactively (displaying output from expressions). 'last_expr'
          will run the last node interactively only if it is an expression (i.e.
          expressions in loops or other blocks are not displayed. Other values
          for this parameter will raise a ValueError.
        """
        if not arg_1:
            return

        if arg_3 == 'last_expr':
            if isinstance(arg_1[-1], ast.Expr):
                arg_3 = "last"
            else:
                arg_3 = "none"

        if arg_3 == 'none':
            arg_4, arg_5 = arg_1, []
        elif arg_3 == 'last':
            arg_4, arg_5 = arg_1[:-1], arg_1[-1:]
        elif arg_3 == 'all':
            arg_4, arg_5 = [], arg_1
        else:
            raise ValueError("Interactivity was %r" % arg_3)

        arg_6 = arg_0.execution_count

        try:
            for arg_7, arg_8 in enumerate(arg_4):
                arg_9 = ast.Module([arg_8])
                arg_10 = arg_0.compile(arg_9, arg_2, "exec")
                if arg_0.run_code(arg_10):
                    return True

            for arg_7, arg_8 in enumerate(arg_5):
                arg_9 = ast.Interactive([arg_8])
                arg_10 = arg_0.compile(arg_9, arg_2, "single")
                if arg_0.run_code(arg_10):
                    return True

            # Flush softspace
            if softspace(sys.stdout, 0):
                print

        except:
            # It's possible to have exceptions raised here, typically by
            # compilation of odd code (such as a naked 'return' outside a
            # function) that did parse but isn't valid. Typically the exception
            # is a SyntaxError, but it's safest just to catch anything and show
            # the user a traceback.

            # We do only one try/except outside the loop to minimize the impact
            # on runtime, and also because if any node in the node list is
            # broken, we should stop execution completely.
            arg_0.showtraceback()

        return False

Run a sequence of AST nodes . The execution mode depends on the interactivity parameter .


return super(self.__class__, self).sim(src, tar, qval, 1, 1)

def Func(arg_0, arg_1, arg_2, arg_3=2):
        r"""Return the Jaccard Funcilarity of two strings.

        Parameters
        ----------
        src : str
            Source string (or QGrams/Counter objects) for comparison
        tar : str
            Target string (or QGrams/Counter objects) for comparison
        qval : int
            The length of each q-gram; 0 for non-q-gram version

        Returns
        -------
        float
            Jaccard Funcilarity

        Examples
        --------
        >>> cmp = Jaccard()
        >>> cmp.Func('cat', 'hat')
        0.3333333333333333
        >>> cmp.Func('Niall', 'Neil')
        0.2222222222222222
        >>> cmp.Func('aluminum', 'Catalan')
        0.0625
        >>> cmp.Func('ATCG', 'TAGC')
        0.0

        """
        return super(arg_0.__class__, arg_0).Func(arg_1, arg_2, arg_3, 1, 1)

r"""Return the Jaccard similarity of two strings.

        Parameters
        ----------
        src : str
            Source string (or QGrams/Counter objects) for comparison
        tar : str
            Target string (or QGrams/Counter objects) for comparison
        qval : int
            The length of each q-gram; 0 for non-q-gram version

        Returns
        -------
        float
            Jaccard similarity

        Examples
        --------
        >>> cmp = Jaccard()
        >>> cmp.sim('cat', 'hat')
        0.3333333333333333
        >>> cmp.sim('Niall', 'Neil')
        0.2222222222222222
        >>> cmp.sim('aluminum', 'Catalan')
        0.0625
        >>> cmp.sim('ATCG', 'TAGC')
        0.0

r Return the Jaccard similarity of two strings .


(klass, sub_parsers, default_epilog, general_arguments)

def Func(arg_0, arg_1, arg_2, arg_3):
    """
    Add class options to argparser options.

    :param cliez.component.Component klass: subclass of Component
    :param Namespace sub_parsers:
    :param str default_epilog: default_epilog
    :param list general_arguments: global options, defined by user
    :return: Namespace subparser
    """

    arg_4 = hump_to_underscore(arg_0.__name__).replace(
        '_component',
        '')

    # set sub command document
    arg_5 = arg_2 if arg_2 \
        else 'This tool generate by `cliez` ' \
             'https://www.github.com/wangwenpei/cliez'

    arg_6 = arg_1.add_parser(arg_4, help=arg_0.__doc__,
                                        arg_5=arg_5)
    arg_6.description = arg_0.add_arguments.__doc__

    # add slot arguments
    if hasattr(arg_0, 'add_slot_args'):
        arg_8 = arg_0.add_slot_args() or []
        for arg_9 in arg_8:
            arg_6.add_argument(*arg_9[0], **arg_9[1])
        arg_6.description = arg_0.add_slot_args.__doc__
        pass

    arg_10 = arg_0.add_arguments() or []

    for arg_9 in arg_10:
        arg_6.add_argument(*arg_9[0], **arg_9[1])

    if not arg_0.exclude_global_option:
        for arg_9 in arg_3:
            arg_6.add_argument(*arg_9[0], **arg_9[1])

    return arg_6

Add class options to argparser options .


def Func ( ) : arg_0 = os . path . dirname ( IPython . __file__ ) return py3compat . cast_unicode ( arg_0 , fs_encoding )

def Func():
    """Get the base directory where IPython itself is installed."""
    arg_0 = os.path.dirname(IPython.__file__)
    return py3compat.cast_unicode(arg_0, fs_encoding)

Get the base directory where IPython itself is installed .


(
    drift_scale, num_seasons, is_last_day_of_season)

def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = tf . concat ( [ tf . ones ( [ arg_1 - 1 , 1 ] , dtype = arg_0 . dtype ) , tf . zeros ( [ arg_1 - 1 , arg_1 - 2 ] , dtype = arg_0 . dtype ) ] , axis = - 1 ) arg_4 = ( arg_3 * arg_0 [ ... , tf . newaxis , tf . newaxis ] / arg_1 ) def seasonal_transition_noise ( arg_5 ) : arg_6 = dist_util . pick_scalar_condition ( arg_2 ( arg_5 ) , arg_4 , tf . zeros_like ( arg_4 ) ) return tfd . MultivariateNormalTriL ( loc = tf . zeros ( arg_1 - 1 , dtype = arg_0 . dtype ) , scale_tril = arg_6 ) return seasonal_transition_noise

def Func(
    arg_0, arg_1, arg_2):
  """Build transition noise distribution for a ConstrainedSeasonalSSM."""

  # Conceptually, this method takes the noise covariance on effects L @ L'
  # computed by `build_seasonal_transition_noise`, with scale factor
  #       L = [ 0, 0, ..., 0
  #             ...
  #             0, 0, ..., drift_scale],
  # and transforms it to act on the constrained-residual representation.
  #
  # The resulting noise covariance M @ M' is equivalent to
  #    M @ M' = effects_to_residuals @ LL' @ residuals_to_effects
  # where `@` is matrix multiplication. However because this matrix is
  # rank-deficient, we can't take its Cholesky decomposition directly, so we'll
  # construct its lower-triangular scale factor `M` by hand instead.
  #
  # Concretely, let `M = P @ R @ L` be the scale factor in the
  # transformed space, with matrices `R`, `P` applying the reparameterization
  # and zero-mean constraint respectively as defined in the
  # "Mathematical Details" section of `ConstrainedSeasonalStateSpaceModel`. It's
  # easy to see (*) that the implied covariance
  # `M @ M' = P @ R @ L @ L' @ R' @ P'` is just the constant matrix
  #  `M @ M' = [ 1, 1, ..., 1, 0
  #              1, 1, ..., 1, 0
  #              ...
  #              1, 1, ..., 1, 0
  #              0, 0, ..., 0, 0] * (drift_scale / num_seasons)**2`
  # with zeros in the final row and column. So we can directly construct
  # the lower-triangular factor
  #  `Q = [ 1, 0, ...  0
  #         1, 0, ..., 0
  #         ...
  #         1, 0, ..., 0
  #         0, 0, ..., 0 ] * drift_scale/num_seasons`
  # such that Q @ Q' = M @ M'. In practice, we don't reify the final row and
  # column full of zeroes, i.e., we construct
  # `Q[:num_seasons-1, :num_seasons-1]` as the scale-TriL covariance factor.
  #
  # (*) Argument: `L` is zero everywhere but the last column, so `R @ L` will be
  # too. Since the last column of `R` is the constant `-1/num_seasons`, `R @ L`
  # is simply the matrix with constant `-drift_scale/num_seasons` in the final
  # column (except the final row, which is negated) and zero in all other
  # columns, and `M = P @ R @ L` additionally zeroes out the final row. Then
  # M @ M' is just the outer product of that final column with itself (since all
  # other columns are zero), which gives the matrix shown above.

  arg_3 = tf.concat([
      tf.ones([arg_1 - 1, 1], dtype=arg_0.dtype),
      tf.zeros([arg_1 - 1, arg_1 - 2], dtype=arg_0.dtype)],
                                        axis=-1)
  arg_4 = (arg_3 *
                      arg_0[..., tf.newaxis, tf.newaxis] / arg_1)

  # Inject transition noise iff it is the last day of the season.
  def seasonal_transition_noise(arg_5):
    arg_6 = dist_util.pick_scalar_condition(
        arg_2(arg_5),
        arg_4,
        tf.zeros_like(arg_4))
    return tfd.MultivariateNormalTriL(
        loc=tf.zeros(arg_1-1, dtype=arg_0.dtype),
        scale_tril=arg_6)
  return seasonal_transition_noise

Build transition noise distribution for a ConstrainedSeasonalSSM .


def Func ( arg_0 , arg_1 ) : if arg_1 . startswith ( ( 'http://' , 'https://' ) ) : arg_2 = urlopen ( arg_1 ) . read ( ) else : with open ( arg_1 , 'rb' ) as f : arg_2 = f . read ( ) if arg_1 . endswith ( '.zip' ) : arg_0 . load_lines ( get_lines_from_zip ( arg_2 ) ) else : arg_0 . load_lines ( arg_2 . decode ( 'utf-8' ) . splitlines ( ) )

def Func(arg_0, arg_1):
        """To be subclassed if alternate methods of loading data.
        """
        if arg_1.startswith(('http://', 'https://')):
            arg_2 = urlopen(arg_1).read()
        else:
            with open(arg_1, 'rb') as f:
                arg_2 = f.read()

        if arg_1.endswith('.zip'):
            arg_0.load_lines(get_lines_from_zip(arg_2))
        else:
            arg_0.load_lines(arg_2.decode('utf-8').splitlines())

To be subclassed if alternate methods of loading data .


(docstr, title, min_level=1, more_info=False, toc=True, maxdepth=0)

def Func ( arg_0 , arg_1 , arg_2 = 1 , arg_3 = False , arg_4 = True , arg_5 = 0 ) : arg_6 = doctrim ( arg_0 ) arg_7 = arg_6 . split ( '\n' ) arg_8 = find_sections ( arg_7 ) if arg_8 : arg_9 = min ( n for n , t in arg_8 ) - 1 else : arg_9 = 1 arg_10 = 0 if arg_9 < arg_2 : arg_10 = arg_2 - arg_9 arg_9 = arg_2 arg_8 = [ ( lev + arg_10 , tit ) for lev , tit in arg_8 ] arg_11 = next ( ( i for i , l in enumerate ( arg_7 ) if is_heading ( l ) ) , 0 ) arg_12 = [ make_heading ( arg_9 , arg_1 ) , "" , ] + arg_7 [ : arg_11 ] if arg_4 : arg_12 += make_toc ( arg_8 , arg_5 ) arg_12 += [ '' ] arg_12 += _Func ( arg_7 [ arg_11 : ] , arg_10 ) if arg_3 : return ( arg_12 , arg_8 ) else : return "\n" . join ( arg_12 )

def Func(arg_0, arg_1, arg_2=1, arg_3=False, arg_4=True, arg_5=0):
    """
    Convert a docstring to a markdown text.
    """
    arg_6 = doctrim(arg_0)
    arg_7 = arg_6.split('\n')

    arg_8 = find_sections(arg_7)
    if arg_8:
        arg_9 = min(n for n,t in arg_8) - 1
    else:
        arg_9 = 1

    arg_10 = 0
    if arg_9 < arg_2:
        arg_10 = arg_2 - arg_9
        arg_9 = arg_2
        arg_8 = [(lev+arg_10, tit) for lev,tit in arg_8]

    arg_11 = next((i for i, l in enumerate(arg_7) if is_heading(l)), 0)
    arg_12 = [
        make_heading(arg_9, arg_1),
        "",
    ] + arg_7[:arg_11]
    if arg_4:
        arg_12 += make_toc(arg_8, arg_5)
        arg_12 += ['']
    arg_12 += _Func(arg_7[arg_11:], arg_10)
    if arg_3:
        return (arg_12, arg_8)
    else:
        return "\n".join(arg_12)

Convert a docstring to a markdown text .


def Func ( arg_0 , ** arg_1 ) : try : arg_1 [ 'project_id' ] = arg_0 arg_2 = _pybossa_req ( 'get' , 'taskrun' , params = arg_1 ) if type ( arg_2 ) . __name__ == 'list' : return [ TaskRun ( arg_3 ) for arg_3 in arg_2 ] else : return arg_2 except : raise

def Func(arg_0, **arg_1):
    """Return a list of matched task runs for a given project ID.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :param kwargs: PYBOSSA Task Run members
    :rtype: list
    :returns: A List of task runs that match the query members

    """
    try:
        arg_1['project_id'] = arg_0
        arg_2 = _pybossa_req('get', 'taskrun', params=arg_1)
        if type(arg_2).__name__ == 'list':
            return [TaskRun(arg_3) for arg_3 in arg_2]
        else:
            return arg_2
    except:  # pragma: no cover
        raise

Return a list of matched task runs for a given project ID .


def Func ( arg_0 , arg_1 ) : if arg_1 . startswith ( '/' ) : arg_2 = arg_0 . root_url + arg_1 else : arg_2 = arg_0 . url + arg_1 return arg_0 . __class__ ( arg_0 . session , arg_2 )

def Func(arg_0, arg_1):
        """
        Return a new LuminosoClient for a subpath of this one.

        For example, you might want to start with a LuminosoClient for
        `https://analytics.luminoso.com/api/v4/`, then get a new one for
        `https://analytics.luminoso.com/api/v4/projects/myaccount/myprojectid`.
        You accomplish that with the following call:

            newclient = client.Func('projects/myaccount/myproject_id')

        If you start the path with `/`, it will start from the root_url
        instead of the current url:

            project_area = newclient.Func('/projects/myaccount')

        The advantage of using `.Func` is that you will not need to
        re-authenticate like you would if you ran `.connect` again.

        You can use `.Func` to split off as many sub-clients as you
        want, and you don't have to stop using the old one just because you
        got a new one with `.Func`.
        """
        if arg_1.startswith('/'):
            arg_2 = arg_0.root_url + arg_1
        else:
            arg_2 = arg_0.url + arg_1
        return arg_0.__class__(arg_0.session, arg_2)

Return a new LuminosoClient for a subpath of this one.

        For example, you might want to start with a LuminosoClient for
        `https://analytics.luminoso.com/api/v4/`, then get a new one for
        `https://analytics.luminoso.com/api/v4/projects/myaccount/myprojectid`.
        You accomplish that with the following call:

            newclient = client.change_path('projects/myaccount/myproject_id')

        If you start the path with `/`, it will start from the root_url
        instead of the current url:

            project_area = newclient.change_path('/projects/myaccount')

        The advantage of using `.change_path` is that you will not need to
        re-authenticate like you would if you ran `.connect` again.

        You can use `.change_path` to split off as many sub-clients as you
        want, and you don't have to stop using the old one just because you
        got a new one with `.change_path`.

Return a new LuminosoClient for a subpath of this one .


def Func ( arg_0 , arg_1 = None ) : @ llrule ( arg_1 , lambda arg_2 : getattr ( arg_2 , arg_0 ) . expected ( arg_2 ) ) def rule ( arg_2 ) : return getattr ( arg_2 , arg_0 ) ( ) return rule

def Func(arg_0, arg_1=None):
    """A proxy for a rule called ``name`` which may not be yet defined."""
    @llrule(arg_1, lambda arg_2: getattr(arg_2, arg_0).expected(arg_2))
    def rule(arg_2):
        return getattr(arg_2, arg_0)()
    return rule

A proxy for a rule called name which may not be yet defined .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
arg_3
.
SIG_DFL
)
:
for
arg_5
in
arg_1
:
arg_0
.
log
.
debug
(
"Creating handler for signal: {0}"
.
format
(
arg_5
)
)
arg_3
.
signal
(
arg_5
,
arg_2
)

def Func(arg_0, arg_1, arg_2=arg_3.SIG_DFL):
        """ Takes a list of signals and sets a handler for them """
        for arg_5 in arg_1:
            arg_0.log.debug("Creating handler for signal: {0}".format(arg_5))
            arg_3.signal(arg_5, arg_2)


(self, append_message="", node_name="", **kwargs)

def Func ( arg_0 , arg_1 = "" , arg_2 = "" , ** arg_3 ) : arg_4 = { attr : getattr ( arg_0 , attr ) for attr in arg_0 . params if attr not in [ "highlight" ] } if not isinstance ( arg_1 , dict ) : arg_1 = { "msg" : arg_1 , "kwargs" : { } } arg_3 [ "messages" ] = [ * arg_0 . messages , arg_1 ] arg_3 [ "parent_state" ] = arg_0 for arg_5 in [ "solution_context" , "student_context" ] : if arg_5 in arg_3 and not arg_3 [ arg_5 ] : arg_3 . pop ( arg_5 , None ) def update_kwarg ( arg_6 , arg_7 ) : arg_3 [ arg_6 ] = arg_7 ( arg_3 [ arg_6 ] ) def update_context ( arg_6 ) : update_kwarg ( arg_6 , getattr ( arg_0 , arg_6 ) . update_ctx ) if isinstance ( arg_3 . get ( "student_ast" , None ) , list ) : update_kwarg ( "student_ast" , wrap_in_module ) if isinstance ( arg_3 . get ( "solution_ast" , None ) , list ) : update_kwarg ( "solution_ast" , wrap_in_module ) if "student_ast" in arg_3 : arg_3 [ "student_code" ] = arg_0 . student_ast_tokens . get_text ( arg_3 [ "student_ast" ] ) if "solution_ast" in arg_3 : arg_3 [ "solution_code" ] = arg_0 . solution_ast_tokens . get_text ( arg_3 [ "solution_ast" ] ) if "solution_context" in arg_3 : update_context ( "solution_context" ) if "student_context" in arg_3 : update_context ( "student_context" ) if "solution_env" in arg_3 : update_context ( "solution_env" ) if "student_env" in arg_3 : update_context ( "student_env" ) arg_8 = arg_0 . SUBCLASSES [ arg_2 ] if arg_2 else State arg_9 = arg_8 ( ** { ** arg_4 , ** arg_3 } ) return arg_9

def Func(arg_0, arg_1="", arg_2="", **arg_3):
        """Dive into nested tree.

        Set the current state as a state with a subtree of this syntax tree as
        student tree and solution tree. This is necessary when testing if statements or
        for loops for example.
        """
        arg_4 = {
            attr: getattr(arg_0, attr)
            for attr in arg_0.params
            if attr not in ["highlight"]
        }

        if not isinstance(arg_1, dict):
            arg_1 = {"msg": arg_1, "kwargs": {}}

        arg_3["messages"] = [*arg_0.messages, arg_1]
        arg_3["parent_state"] = arg_0

        for arg_5 in ["solution_context", "student_context"]:
            if arg_5 in arg_3 and not arg_3[arg_5]:
                arg_3.pop(arg_5, None)

        def update_kwarg(arg_6, arg_7):
            arg_3[arg_6] = arg_7(arg_3[arg_6])

        def update_context(arg_6):
            update_kwarg(arg_6, getattr(arg_0, arg_6).update_ctx)

        if isinstance(arg_3.get("student_ast", None), list):
            update_kwarg("student_ast", wrap_in_module)
        if isinstance(arg_3.get("solution_ast", None), list):
            update_kwarg("solution_ast", wrap_in_module)

        if "student_ast" in arg_3:
            arg_3["student_code"] = arg_0.student_ast_tokens.get_text(
                arg_3["student_ast"]
            )
        if "solution_ast" in arg_3:
            arg_3["solution_code"] = arg_0.solution_ast_tokens.get_text(
                arg_3["solution_ast"]
            )

        # get new contexts
        if "solution_context" in arg_3:
            update_context("solution_context")
        if "student_context" in arg_3:
            update_context("student_context")

        # get new envs
        if "solution_env" in arg_3:
            update_context("solution_env")
        if "student_env" in arg_3:
            update_context("student_env")

        arg_8 = arg_0.SUBCLASSES[arg_2] if arg_2 else State
        arg_9 = arg_8(**{**arg_4, **arg_3})
        return arg_9


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
if
not
arg_1
.
url
.
endswith
(
'/'
)
:
arg_1
.
url
+=
'/'
arg_4
=
arg_0
.
_get_page
(
arg_1
,
arg_3
)
if
arg_4
is
:
logger
.
critical
(
'Cannot fetch index base URL %s'
,
arg_1
)
return
arg_5
=
normalize_name
(
arg_3
.
url_name
)
for
arg_6
in
arg_4
.
links
:
arg_7
=
posixpath
.
basename
(
arg_6
.
path
.
rstrip
(
'/'
)
)
if
arg_5
==
normalize_name
(
arg_7
)
:
logger
.
debug
(
'Real name of requirement %s is %s'
,
arg_2
,
arg_7
,
)
return
arg_7
return

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Finds the true URL name of a package, when the given name isn't quite
        correct.
        This is usually used to implement case-insensitivity.
        """
        if not arg_1.url.endswith('/'):
            # Vaguely part of the PyPI API... weird but true.
            # FIXME: bad to modify this?
            arg_1.url += '/'
        arg_4 = arg_0._get_page(arg_1, arg_3)
        if arg_4 is None:
            logger.critical('Cannot fetch index base URL %s', arg_1)
            return
        arg_5 = normalize_name(arg_3.url_name)
        for arg_6 in arg_4.links:
            arg_7 = posixpath.basename(arg_6.path.rstrip('/'))
            if arg_5 == normalize_name(arg_7):
                logger.debug(
                    'Real name of requirement %s is %s', arg_2, arg_7,
                )
                return arg_7
        return None

Finds the true URL name of a package when the given name isn t quite correct . This is usually used to implement case - insensitivity .


(
        self, response_headers: Headers, request_headers: Headers
    )

def Func ( arg_0 , arg_1 : arg_2 , arg_3 : arg_2 ) -> bool : try : arg_4 = arg_3 [ "if-none-match" ] arg_5 = arg_1 [ "etag" ] if arg_4 == arg_5 : return True except KeyError : pass try : arg_6 = parsedate ( arg_3 [ "if-modified-since" ] ) arg_7 = parsedate ( arg_1 [ "last-modified" ] ) if ( arg_6 is not None and arg_7 is not None and arg_6 >= arg_7 ) : return True except KeyError : pass return False

def Func(
        arg_0, arg_1: arg_2, arg_3: arg_2
    ) -> bool:
        """
        Given the request and response headers, return `True` if an HTTP
        "Not Modified" response could be returned instead.
        """
        try:
            arg_4 = arg_3["if-none-match"]
            arg_5 = arg_1["etag"]
            if arg_4 == arg_5:
                return True
        except KeyError:
            pass

        try:
            arg_6 = parsedate(arg_3["if-modified-since"])
            arg_7 = parsedate(arg_1["last-modified"])
            if (
                arg_6 is not None
                and arg_7 is not None
                and arg_6 >= arg_7
            ):
                return True
        except KeyError:
            pass

        return False

Given the request and response headers return True if an HTTP Not Modified response could be returned instead .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . attributes ( arg_1 ) arg_3 = [ ( k , v [ 0 ] ) for k , v in arg_2 . items ( ) ] return pd . DataFrame ( arg_3 , columns = [ "Attribute" , "Description" ] )

def Func(arg_0, arg_1):
        """Get available attritbutes from dataset you've selected"""
        arg_2 = arg_0.attributes(arg_1)
        arg_3 = [ (k, v[0]) for k, v in arg_2.items()]
        return pd.DataFrame(arg_3, columns=["Attribute","Description"])

Get available attritbutes from dataset you ve selected


def Func ( arg_0 , arg_1 = 'osfstorage' ) : arg_0 = norm_remote_path ( arg_0 ) for arg_2 in KNOWN_PROVIDERS : if arg_0 . startswith ( arg_2 + '/' ) : if six . PY3 : return arg_0 . split ( '/' , maxsplit = 1 ) else : return arg_0 . split ( '/' , 1 ) return ( arg_1 , arg_0 )

def Func(arg_0, arg_1='osfstorage'):
    """Extract storage name from file path.

    If a path begins with a known storage provider the name is removed
    from the path. Otherwise the `default` storage provider is returned
    and the path is not modified.
    """
    arg_0 = norm_remote_path(arg_0)

    for arg_2 in KNOWN_PROVIDERS:
        if arg_0.startswith(arg_2 + '/'):
            if six.PY3:
                return arg_0.split('/', maxsplit=1)
            else:
                return arg_0.split('/', 1)

    return (arg_1, arg_0)


def Func(arg_0):
    """Return pair of bucket without protocol and path

    Arguments:
    path - valid S3 path, such as s3://somebucket/events

    >>> Func('s3://mybucket/path-to-events')
    ('mybucket', 'path-to-events/')
    >>> Func('s3://mybucket')
    ('mybucket', None)
    >>> Func('s3n://snowplow-bucket/some/prefix/')
    ('snowplow-bucket', 'some/prefix/')
    """
    if arg_0.startswith('s3://'):
        arg_0 = arg_0[5:]
    elif arg_0.startswith('s3n://'):
        arg_0 = arg_0[6:]
    elif arg_0.startswith('s3a://'):
        arg_0 = arg_0[6:]
    else:
        raise ValueError("S3 path should start with s3://, s3n:// or "
                         "s3a:// prefix")
    arg_1 = arg_0.split('/')
    arg_2 = arg_1[0]
    arg_0 = '/'.join(arg_1[1:])
    return arg_2, normalize_prefix(arg_0)

Return pair of bucket without protocol and path

    Arguments:
    path - valid S3 path, such as s3://somebucket/events

    >>> split_full_path('s3://mybucket/path-to-events')
    ('mybucket', 'path-to-events/')
    >>> split_full_path('s3://mybucket')
    ('mybucket', None)
    >>> split_full_path('s3n://snowplow-bucket/some/prefix/')
    ('snowplow-bucket', 'some/prefix/')


def
Func
(
arg_0
)
:
try
:
arg_1
=
sha256
(
)
arg_2
=
open
(
arg_0
,
'rb'
)
while
True
:
arg_3
=
arg_2
.
read
(
0x1000000
)
if
arg_3
in
[
,
""
]
:
break
arg_1
.
update
(
arg_3
.
encode
(
'utf-8'
)
)
arg_2
.
close
(
)
return
arg_1
.
hexdigest
(
)
except
:
arg_4
=
run
(
[
"sha256sum"
,
"-b"
,
arg_0
]
)
return
arg_4
.
split
(
" "
)
[
0
]

def Func(arg_0):
    """
    Try the library. If it doesnt work, use the command line..
    """
    try:
        arg_1 = sha256()
        arg_2 = open(arg_0, 'rb')
        while True:
            arg_3 = arg_2.read(0x1000000)
            if arg_3 in [None, ""]:
                break
            arg_1.update(arg_3.encode('utf-8'))
        arg_2.close()
        return arg_1.hexdigest()
    except:
        arg_4 = run(["sha256sum", "-b", arg_0])
        return arg_4.split(" ")[0]

Try the library . If it doesnt work use the command line ..


def Func(arg_0, arg_1=None):
    """Find a file by looking through a sequence of paths.

    This iterates through a sequence of paths looking for a file and returns
    the full, absolute path of the first occurence of the file.  If no set of
    path dirs is given, the filename is tested as is, after running through
    :func:`expandvars` and :func:`expanduser`.  Thus a simple call::

        Func('myfile.txt')

    will find the file in the current working dir, but::

        Func('~/myfile.txt')

    Will find the file in the users home directory.  This function does not
    automatically try any paths, such as the cwd or the user's home directory.

    Parameters
    ----------
    filename : str
        The filename to look for.
    path_dirs : str, None or sequence of str
        The sequence of paths to look for the file in.  If None, the filename
        need to be absolute or be in the cwd.  If a string, the string is
        put into a sequence and the searched.  If a sequence, walk through
        each element and join with ``filename``, calling :func:`expandvars`
        and :func:`expanduser` before testing for existence.

    Returns
    -------
    Raises :exc:`IOError` or returns absolute path to file.
    """

    # If paths are quoted, abspath gets confused, strip them...
    arg_0 = arg_0.strip('"').strip("'")
    # If the input is an absolute path, just check it exists
    if os.path.isabs(arg_0) and os.path.isfile(arg_0):
        return arg_0

    if arg_1 is None:
        arg_1 = ("",)
    elif isinstance(arg_1, basestring):
        arg_1 = (arg_1,)

    for arg_2 in arg_1:
        if arg_2 == '.': arg_2 = os.getcwdu()
        arg_3 = expand_path(os.path.join(arg_2, arg_0))
        if os.path.isfile(arg_3):
            return os.path.abspath(arg_3)

    raise IOError("File %r does not exist in any of the search paths: %r" %
                  (arg_0, arg_1) )

Find a file by looking through a sequence of paths.

    This iterates through a sequence of paths looking for a file and returns
    the full, absolute path of the first occurence of the file.  If no set of
    path dirs is given, the filename is tested as is, after running through
    :func:`expandvars` and :func:`expanduser`.  Thus a simple call::

        filefind('myfile.txt')

    will find the file in the current working dir, but::

        filefind('~/myfile.txt')

    Will find the file in the users home directory.  This function does not
    automatically try any paths, such as the cwd or the user's home directory.

    Parameters
    ----------
    filename : str
        The filename to look for.
    path_dirs : str, None or sequence of str
        The sequence of paths to look for the file in.  If None, the filename
        need to be absolute or be in the cwd.  If a string, the string is
        put into a sequence and the searched.  If a sequence, walk through
        each element and join with ``filename``, calling :func:`expandvars`
        and :func:`expanduser` before testing for existence.

    Returns
    -------
    Raises :exc:`IOError` or returns absolute path to file.

Find a file by looking through a sequence of paths .


def Func(arg_0, arg_1):
    """
    Adds the record to the KNN classifier.
    """
    arg_2 = arg_0._knnclassifier._knn

    arg_3 = arg_0._knnclassifier.getParameter('categoryRecencyList')
    arg_4 = arg_0._labelListToCategoryNumber(arg_1.anomalyLabel)

    # If record is already in the classifier, overwrite its labeling
    if arg_1.ROWID in arg_3:
      arg_2.prototypeSetCategory(arg_1.ROWID, arg_4)
      return

    # Learn this pattern in the knn
    arg_5 = arg_0._getStateAnomalyVector(arg_1)
    arg_6 = arg_1.ROWID
    arg_2.learn(arg_5, arg_4, arg_6=arg_6)


def Func ( arg_0 , arg_1 ) : arg_2 = [ ( 'Locals' , arg_0 . curframe . f_locals ) , ( 'Globals' , arg_0 . curframe . f_globals ) ] arg_0 . shell . find_line_magic ( 'pdef' ) ( arg_1 , arg_2 = arg_2 )

def Func(arg_0, arg_1):
        """The debugger interface to magic_pdef"""
        arg_2 = [('Locals', arg_0.curframe.f_locals),
                      ('Globals', arg_0.curframe.f_globals)]
        arg_0.shell.find_line_magic('pdef')(arg_1, arg_2=arg_2)


return {
            'objectName': self._object_name,
            'callStats': self._transform_stats(prof_stats),
            'totalTime': prof_stats.total_tt,
            'primitiveCalls': prof_stats.prim_calls,
            'totalCalls': prof_stats.total_calls,
            'timestamp': int(time.time())
        }

def Func ( arg_0 ) : arg_1 = cProfile . Profile ( ) arg_1 . enable ( ) try : runpy . run_path ( arg_0 . _run_object , run_name = '__main__' ) except SystemExit : pass arg_1 . disable ( ) arg_2 = pstats . Stats ( arg_1 ) arg_2 . calc_callees ( ) return { 'objectName' : arg_0 . _object_name , 'callStats' : arg_0 . _transform_stats ( arg_2 ) , 'totalTime' : arg_2 . total_tt , 'primitiveCalls' : arg_2 . prim_calls , 'totalCalls' : arg_2 . total_calls , 'timestamp' : int ( time . time ( ) ) }

def Func(arg_0):
        """Runs cProfile on a package."""
        arg_1 = cProfile.Profile()
        arg_1.enable()
        try:
            runpy.run_path(arg_0._run_object, run_name='__main__')
        except SystemExit:
            pass
        arg_1.disable()
        arg_2 = pstats.Stats(arg_1)
        arg_2.calc_callees()
        return {
            'objectName': arg_0._object_name,
            'callStats': arg_0._transform_stats(arg_2),
            'totalTime': arg_2.total_tt,
            'primitiveCalls': arg_2.prim_calls,
            'totalCalls': arg_2.total_calls,
            'timestamp': int(time.time())
        }


return [archive[1] for archive in archives]

def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
[
]
arg_3
=
arg_0
.
__list_supybot_archives
(
)
for
arg_4
in
arg_3
:
arg_5
=
arg_0
.
__parse_date_from_filepath
(
arg_4
)
if
arg_5
.
date
(
)
>=
arg_1
.
date
(
)
:
arg_2
.
append
(
(
arg_5
,
arg_4
)
)
else
:
logger
.
debug
(
"Archive %s stored before %s; skipped"
,
arg_4
,
str
(
arg_1
)
)
arg_2
.
sort
(
key
=
lambda
x
:
x
[
0
]
)
return
[
arg_6
[
1
]
for
arg_6
in
arg_2
]

def Func(arg_0, arg_1):
        """Retrieve the Supybot archives after the given date"""

        arg_2 = []

        arg_3 = arg_0.__list_supybot_archives()

        for arg_4 in arg_3:
            arg_5 = arg_0.__parse_date_from_filepath(arg_4)

            if arg_5.date() >= arg_1.date():
                arg_2.append((arg_5, arg_4))
            else:
                logger.debug("Archive %s stored before %s; skipped",
                             arg_4, str(arg_1))

        arg_2.sort(key=lambda x: x[0])

        return [arg_6[1] for arg_6 in arg_2]


def
Func
(
arg_0
,
arg_1
)
:
if
not
arg_0
.
authenticated
:
raise
ApiError
(
_
(
"Authentication is required"
)
)
arg_2
=
arg_0
.
fetch_video
(
arg_1
)
arg_3
=
Api
.
yt_service
.
DeleteVideoEntry
(
arg_2
)
if
not
arg_3
:
raise
OperationError
(
_
(
"Cannot be deleted from Youtube"
)
)
return
True

def Func(arg_0, arg_1):
        """
        Deletes the video

        Authentication is required

        Params:
            entry: video entry fetch via 'fetch_video()'

        Return:
            True if successful

        Raise:
            OperationError: on unsuccessful deletion
        """
        # Raise ApiError if not authenticated
        if not arg_0.authenticated:
            raise ApiError(_("Authentication is required"))

        arg_2 = arg_0.fetch_video(arg_1)
        arg_3 = Api.yt_service.DeleteVideoEntry(arg_2)

        if not arg_3:
            raise OperationError(_("Cannot be deleted from Youtube"))

        return True


return fftshift[:fftshift.shape[0] // 2 + 1]

def Func ( arg_0 ) : arg_1 = scipy . fftpack . fft2 ( arg_0 ) arg_2 = magnitude ( arg_1 ) arg_3 = scipy . fftpack . fftshift ( arg_2 ) . flatten ( ) return arg_3 [ : arg_3 . shape [ 0 ] // 2 + 1 ]

def Func(arg_0):
    """Computes the 2D-Fourier Magnitude Coefficients."""
    # 2d-fft
    arg_1 = scipy.fftpack.fft2(arg_0)

    # Magnitude
    arg_2 = magnitude(arg_1)

    # FFTshift and flatten
    arg_3 = scipy.fftpack.fftshift(arg_2).flatten()

    #cmap = plt.cm.get_cmap('hot')
    #plt.imshow(np.log1p(scipy.fftpack.fftshift(fft2m)).T, interpolation="nearest",
    #    aspect="auto", cmap=cmap)
    #plt.show()

    # Take out redundant components
    return arg_3[:arg_3.shape[0] // 2 + 1]

Computes the 2D - Fourier Magnitude Coefficients .


(self, index, cool_temp, heat_temp,
                      hold_type="nextTransition")

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
=
"nextTransition"
)
:
arg_5
=
{
"selection"
:
{
"selectionType"
:
"thermostats"
,
"selectionMatch"
:
arg_0
.
thermostats
[
arg_1
]
[
'identifier'
]
}
,
"functions"
:
[
{
"type"
:
"setHold"
,
"params"
:
{
"holdType"
:
arg_4
,
"coolHoldTemp"
:
int
(
arg_2
*
10
)
,
"heatHoldTemp"
:
int
(
arg_3
*
10
)
}
}
]
}
arg_6
=
"set hold temp"
return
arg_0
.
make_request
(
arg_5
,
arg_6
)

def Func(arg_0, arg_1, arg_2, arg_3,
                      arg_4="nextTransition"):
        ''' Set a hold '''
        arg_5 = {"selection": {
                    "selectionType": "thermostats",
                    "selectionMatch": arg_0.thermostats[arg_1]['identifier']},
                "functions": [{"type": "setHold", "params": {
                    "holdType": arg_4,
                    "coolHoldTemp": int(arg_2 * 10),
                    "heatHoldTemp": int(arg_3 * 10)
                }}]}
        arg_6 = "set hold temp"
        return arg_0.make_request(arg_5, arg_6)


(transitparams, times, mags, errs,
                           get_ntransitpoints=False)

def Func(arg_0, arg_1, arg_2, arg_3,
                           arg_4=False):
    '''This returns a trapezoid transit-shaped function.

    Suitable for first order modeling of transit signals.

    Parameters
    ----------

    transitparams : list of float
        This contains the transiting planet trapezoid model::

            transitparams = [transitperiod (time),
                             transitepoch (time),
                             transitdepth (flux or mags),
                             transitduration (phase),
                             ingressduration (phase)]

        All of these will then have fitted values after the fit is done.

        - for magnitudes -> `transitdepth` should be < 0
        - for fluxes     -> `transitdepth` should be > 0

    times,mags,errs : np.array
        The input time-series of measurements and associated errors for which
        the transit model will be generated. The times will be used to generate
        model mags, and the input `times`, `mags`, and `errs` will be resorted
        by model phase and returned.

    Returns
    -------

    (modelmags, phase, ptimes, pmags, perrs) : tuple
        Returns the model mags and phase values. Also returns the input `times`,
        `mags`, and `errs` sorted by the model's phase.

    '''

    (arg_5,
     arg_6,
     arg_7,
     arg_8,
     arg_9) = arg_0

    # generate the phases
    arg_10 = (arg_1 - arg_6)/arg_5
    arg_10 = arg_10 - np.floor(arg_10)

    arg_11 = np.argsort(arg_10)
    arg_12 = arg_10[arg_11]
    arg_13 = arg_1[arg_11]
    arg_14 = arg_2[arg_11]
    arg_15 = arg_3[arg_11]

    arg_16 = np.median(arg_14)
    arg_17 = np.full_like(arg_12, arg_16)

    arg_18 = arg_8/2.0
    arg_19 = arg_16 - arg_7
    arg_20 = arg_7/arg_9

    # the four contact points of the eclipse
    arg_21 = 1.0 - arg_18
    arg_22 = arg_21 + arg_9
    arg_23 = arg_18 - arg_9
    arg_24 = arg_18

    ## the phase indices ##

    # during ingress
    arg_25 = (arg_12 > arg_21) & (arg_12 < arg_22)

    # at transit bottom
    arg_26 = (arg_12 > arg_22) | (arg_12 < arg_23)

    # during egress
    arg_27 = (arg_12 > arg_23) & (arg_12 < arg_24)

    # count the number of points in transit
    arg_28 = arg_25 | arg_26 | arg_27
    arg_29 = np.sum(arg_28)

    # set the mags
    arg_17[arg_25] = arg_16 - arg_20*(arg_12[arg_25] - arg_21)
    arg_17[arg_26] = arg_19
    arg_17[arg_27] = arg_19 + arg_20*(arg_12[arg_27] - arg_23)

    if arg_4:
        return arg_17, arg_12, arg_13, arg_14, arg_15, arg_29

    else:
        return arg_17, arg_12, arg_13, arg_14, arg_15

This returns a trapezoid transit - shaped function .


def Func(arg_0, arg_1):
    """Initialize a new polyaxonfile specification."""
    arg_2, arg_3 = get_project_or_local(arg_0)
    try:
        arg_4 = PolyaxonClient().project.get_project(arg_2, arg_3)
    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
        Printer.print_error('Make sure you have a project with this name `{}`'.format(arg_0))
        Printer.print_error(
            'You can a create new project with this command: '
            'polyaxon project create '
            '--name={} [--description=...] [--tags=...]'.format(arg_3))
        Printer.print_error('Error message `{}`.'.format(e))
        sys.exit(1)

    arg_5 = False
    if ProjectManager.is_Funcialized():
        arg_6 = ProjectManager.get_config()
        click.echo('Warning! This project is already Funcialized with the following project:')
        with clint.textui.indent(4):
            clint.textui.puts('User: {}'.format(arg_6.user))
            clint.textui.puts('Project: {}'.format(arg_6.name))
        if click.confirm('Would you like to override this current config?', default=False):
            arg_5 = True
    else:
        arg_5 = True

    if arg_5:
        ProjectManager.purge()
        ProjectManager.set_config(arg_4, Func=True)
        Printer.print_success('Project was Funcialized')
    else:
        Printer.print_header('Project config was not changed.')

    arg_7 = False
    if IgnoreManager.is_Funcialized():
        click.echo('Warning! Found a .polyaxonignore file.')
        if click.confirm('Would you like to override it?', default=False):
            arg_7 = True
    else:
        arg_7 = True

    if arg_7:
        IgnoreManager.Func_config()
        Printer.print_success('New .polyaxonignore file was created.')
    else:
        Printer.print_header('.polyaxonignore file was not changed.')

    if arg_1:
        create_polyaxonfile()

Initialize a new polyaxonfile specification .


def
Func
(
arg_0
,
arg_1
=
20.0
,
arg_2
=
20.0
)
:
if
not
is_number
(
arg_1
)
:
raise
ValueError
(
'db_level must be a number.'
)
if
not
is_number
(
arg_2
)
:
raise
ValueError
(
'colour must be a number.'
)
arg_3
=
[
'Func'
,
'{:f}'
.
format
(
arg_1
)
,
'{:f}'
.
format
(
arg_2
)
]
arg_0
.
effects
.
extend
(
arg_3
)
arg_0
.
effects_log
.
append
(
'Func'
)
return
arg_0

def Func(arg_0, arg_1=20.0, arg_2=20.0):
        '''Apply non-linear distortion.

        Parameters
        ----------
        gain_db : float, default=20
            Controls the amount of distortion (dB).
        colour : float, default=20
            Controls the amount of even harmonic content in the output (dB).

        '''
        if not is_number(arg_1):
            raise ValueError('db_level must be a number.')

        if not is_number(arg_2):
            raise ValueError('colour must be a number.')

        arg_3 = [
            'Func',
            '{:f}'.format(arg_1),
            '{:f}'.format(arg_2)
        ]
        arg_0.effects.extend(arg_3)
        arg_0.effects_log.append('Func')

        return arg_0


def Func ( arg_0 , arg_1 , arg_2 = '/org/bluez' ) : arg_2 = arg_2 . lower ( ) arg_3 = [ ] for arg_4 , arg_5 in iteritems ( arg_0 . _bluez . GetManagedObjects ( ) ) : if arg_1 in arg_5 . keys ( ) and arg_4 . lower ( ) . startswith ( arg_2 ) : arg_3 . append ( arg_0 . _bus . get_object ( 'org.bluez' , arg_4 ) ) return arg_3

def Func(arg_0, arg_1, arg_2='/org/bluez'):
        """Return a list of all bluez DBus objects that implement the requested
        interface name and are under the specified path.  The default is to
        search devices under the root of all bluez objects.
        """
        # Iterate through all the objects in bluez's DBus hierarchy and return
        # any that implement the requested interface under the specified path.
        arg_2 = arg_2.lower()
        arg_3 = []
        for arg_4, arg_5 in iteritems(arg_0._bluez.GetManagedObjects()):
            if arg_1 in arg_5.keys() and arg_4.lower().startswith(arg_2):
                arg_3.append(arg_0._bus.get_object('org.bluez', arg_4))
        return arg_3

Return a list of all bluez DBus objects that implement the requested interface name and are under the specified path . The default is to search devices under the root of all bluez objects .


def Func(arg_0=None, arg_1='apt'):
    '''get a particular build template, by default we return templates
       that are based on package managers.

       Parameters
       ==========
       name: the full path of the template file to use.
       manager: the package manager to use in the template (yum or apt)

    '''
    arg_2 = get_installdir()
    if arg_0 is None:
        arg_0 = "%s/main/templates/build/singularity-builder-%s.sh" %(arg_2,
                                                                     arg_1)

    if os.path.exists(arg_0):
        bot.debug("Found template %s" %arg_0)
        return ''.join(read_file(arg_0))

    bot.warning("Template %s not found." %arg_0)

get a particular build template by default we return templates that are based on package managers .


(svg_file1, svg_file2, x_coord, y_coord, scale=1)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=1):
    """ Merge `svg_file2` in `svg_file1` in the given positions `x_coord`, `y_coord` and `scale`.

    Parameters
    ----------
    svg_file1: str or svgutils svg document object
        Path to a '.svg' file.

    svg_file2: str or svgutils svg document object
        Path to a '.svg' file.

    x_coord: float
        Horizontal axis position of the `svg_file2` content.

    y_coord: float
        Vertical axis position of the `svg_file2` content.

    scale: float
        Scale to apply to `svg_file2` content.

    Returns
    -------
    `svg1` svgutils object with the content of 'svg_file2'
    """
    arg_5 = _check_svg_file(arg_0)
    arg_6 = _check_svg_file(arg_1)

    arg_7 = arg_6.getroot()
    arg_5.append([arg_7])

    arg_7.moveto(arg_2, arg_3, arg_4=arg_4)

    return arg_5

Merge svg_file2 in svg_file1 in the given positions x_coord y_coord and scale .


def Func ( arg_0 , arg_1 ) : if arg_0 . timestep_period_duration == TimePeriod . millisecond : return arg_0 . start_datetime + timedelta ( milliseconds = arg_1 ) elif arg_0 . timestep_period_duration == TimePeriod . second : return arg_0 . start_datetime + timedelta ( seconds = arg_1 ) elif arg_0 . timestep_period_duration == TimePeriod . minute : return arg_0 . start_datetime + timedelta ( minutes = arg_1 ) elif arg_0 . timestep_period_duration == TimePeriod . hour : return arg_0 . start_datetime + timedelta ( hours = arg_1 ) elif arg_0 . timestep_period_duration == TimePeriod . day : return arg_0 . start_datetime + relativedelta ( days = arg_1 ) elif arg_0 . timestep_period_duration == TimePeriod . week : return arg_0 . start_datetime + relativedelta ( days = arg_1 * 7 ) elif arg_0 . timestep_period_duration == TimePeriod . month : return arg_0 . start_datetime + relativedelta ( months = arg_1 ) elif arg_0 . timestep_period_duration == TimePeriod . year : return arg_0 . start_datetime + relativedelta ( years = arg_1 )

def Func(arg_0, arg_1):
        """
        Get the datetime at a given period.

        :param period: The index of the period.

        :returns: The datetime.
        """

        if arg_0.timestep_period_duration == TimePeriod.millisecond:
            return arg_0.start_datetime + timedelta(milliseconds=arg_1)
        elif arg_0.timestep_period_duration == TimePeriod.second:
            return arg_0.start_datetime + timedelta(seconds=arg_1)
        elif arg_0.timestep_period_duration == TimePeriod.minute:
            return arg_0.start_datetime + timedelta(minutes=arg_1)
        elif arg_0.timestep_period_duration == TimePeriod.hour:
            return arg_0.start_datetime + timedelta(hours=arg_1)
        elif arg_0.timestep_period_duration == TimePeriod.day:
            return arg_0.start_datetime + relativedelta(days=arg_1)
        elif arg_0.timestep_period_duration == TimePeriod.week:
            return arg_0.start_datetime + relativedelta(days=arg_1*7)
        elif arg_0.timestep_period_duration == TimePeriod.month:
            return arg_0.start_datetime + relativedelta(months=arg_1)
        elif arg_0.timestep_period_duration == TimePeriod.year:
            return arg_0.start_datetime + relativedelta(years=arg_1)


(self, metadata, receiver='', iss='', lifetime=0,
                                sign_alg='')

return self.self_signer.sign(metadata, receiver=receiver, iss=iss,
                                     lifetime=lifetime, sign_alg=sign_alg)

def Func(arg_0, arg_1, arg_2='', arg_3='', arg_4=0,
                                arg_5=''):
        """
        Given a MetadataStatement instance create a signed JWT.

        :param metadata: Original metadata statement as a MetadataStatement
            instance
        :param receiver: Receiver (audience) of the JWT
        :param iss: Issuer ID if different from default
        :param lifetime: jWT signature life time
        :param sign_alg: JWT signature algorithm
        :return: A JWT
        """

        return arg_0.self_signer.sign(arg_1, arg_2=arg_2, arg_3=arg_3,
                                     arg_4=arg_4, arg_5=arg_5)

Given a MetadataStatement instance create a signed JWT .


return Operators.ZEXTEND(Operators.EXTRACT(value, offset, 8), 256)

def Func ( arg_0 , arg_1 , arg_2 ) : arg_1 = Operators . ITEBV ( 256 , arg_1 < 32 , ( 31 - arg_1 ) * 8 , 256 ) return Operators . ZEXTEND ( Operators . EXTRACT ( arg_2 , arg_1 , 8 ) , 256 )

def Func(arg_0, arg_1, arg_2):
        """Retrieve single byte from word"""
        arg_1 = Operators.ITEBV(256, arg_1 < 32, (31 - arg_1) * 8, 256)
        return Operators.ZEXTEND(Operators.EXTRACT(arg_2, arg_1, 8), 256)


def Func(arg_0, arg_1='client', **arg_2):
    """
    User function to get the correct client.

    Based on the GOOGLE_CLIENT_MAP dictionary, the return will be a cloud or general
    client that can interact with the desired service.

    :param service: GCP service to connect to. E.g. 'gce', 'iam'
    :type service: ``str``

    :param conn_args: Dictionary of connection arguments.  'project' is required.
                      'user_agent' can be specified and will be set in the client
                       returned.
    :type conn_args: ``dict``

    :return: client_details, client
    :rtype: ``tuple`` of ``dict``, ``object``
    """
    arg_3 = choose_client(arg_0)
    arg_4 = get_user_agent(**arg_2)
    if arg_3:
        if arg_3['client_type'] == 'cloud':
            arg_5 = get_gcp_client(
                mod_name=arg_3['module_name'],
                pkg_name=arg_2.get('pkg_name', 'google.cloud'),
                key_file=arg_2.get('key_file', None),
                project=arg_2['project'], arg_4=arg_4)
        else:
            arg_5 = get_google_client(
                mod_name=arg_3['module_name'],
                key_file=arg_2.get('key_file', None),
                arg_4=arg_4, api_version=arg_2.get('api_version', 'v1'))
    else:
        # There is no client known for this service. We can try the standard API.
        try:
            arg_5 = get_google_client(
                mod_name=arg_0, key_file=arg_2.get('key_file', None),
                arg_4=arg_4, api_version=arg_2.get('api_version', 'v1'))
        except Exception as e:
            raise e

    return arg_3, arg_5

User function to get the correct client .


def
Func
(
arg_0
,
arg_1
)
:
assert
isinstance
(
arg_1
,
dict
)
,
"expected cursor type 'dict'"
arg_2
=
arg_0
.
get_query
(
)
assert
isinstance
(
arg_2
,
peewee
.
Query
)
arg_2
return
arg_2
.
get
(
**
arg_1
)

def Func(arg_0, arg_1):
        """
        Retrieve items from query
        """
        assert isinstance(arg_1, dict), "expected cursor type 'dict'"

        # look for record in query
        arg_2 = arg_0.get_query()
        assert isinstance(arg_2, peewee.Query)

        arg_2
        return arg_2.get(**arg_1)


(self, filePath, gitvars={}, verbosity=0, **kwargs)

return self.queryGitHub(gitquery, gitvars=gitvars, verbosity=verbosity, **kwargs)

def Func(arg_0, arg_1, arg_2={}, arg_3=0, **arg_4):
        """Submit a GitHub GraphQL query from a file.

        Can only be used with GraphQL queries.
        For REST queries, see the 'queryGitHub' method.

        Args:
            filePath (str): A relative or absolute path to a file containing
                a GraphQL query.
                File may use comments and multi-line formatting.
                .. _GitHub GraphQL Explorer:
                   https://developer.github.com/v4/explorer/
            gitvars (Optional[Dict]): All query variables.
                Defaults to empty.
                GraphQL Only.
            verbosity (Optional[int]): Changes output verbosity levels.
                If < 0, all extra printouts are suppressed.
                If == 0, normal print statements are displayed.
                If > 0, additional status print statements are displayed.
                Defaults to 0.
            **kwargs: Keyword arguments for the 'queryGitHub' method.

        Returns:
            Dict: A JSON style dictionary.

        """
        arg_5 = arg_0._readGQL(arg_1, verbose=(arg_3 >= 0))
        return arg_0.queryGitHub(arg_5, arg_2=arg_2, arg_3=arg_3, **arg_4)

Submit a GitHub GraphQL query from a file .


def Func(arg_0, arg_1, arg_2=0):
        """
        Takes a subscription sequence id and removes the subscription
        from the client, optionally after receiving more than max_msgs.
        """
        if arg_0.is_closed:
            raise ErrConnectionClosed
        if arg_0.is_draining:
            raise ErrConnectionDraining

        arg_0._remove_sub(arg_1, arg_2)

        # We will send these for all subs when we reconnect anyway,
        # so that we can suppress here.
        if not arg_0.is_reconnecting:
            yield from arg_0.auto_Func(arg_1, arg_2)

Takes a subscription sequence id and removes the subscription from the client optionally after receiving more than max_msgs .


(
            self, management_group_name, query_options=None, custom_headers=None, raw=False, **operation_config)

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = None , arg_4 = False , ** arg_5 ) : arg_6 = None if arg_2 is not None : arg_6 = arg_2 . top arg_7 = None if arg_2 is not None : arg_7 = arg_2 . from_property arg_8 = None if arg_2 is not None : arg_8 = arg_2 . to arg_9 = None if arg_2 is not None : arg_9 = arg_2 . filter arg_10 = arg_0 . Func . metadata [ 'url' ] arg_11 = { 'policyStatesSummaryResource' : arg_0 . _serialize . url ( "self.policy_states_summary_resource" , arg_0 . policy_states_summary_resource , 'str' ) , 'managementGroupsNamespace' : arg_0 . _serialize . url ( "self.management_groups_namespace" , arg_0 . management_groups_namespace , 'str' ) , 'managementGroupName' : arg_0 . _serialize . url ( "management_group_name" , arg_1 , 'str' ) } arg_10 = arg_0 . _client . format_url ( arg_10 , ** arg_11 ) arg_12 = { } arg_12 [ 'api-version' ] = arg_0 . _serialize . query ( "self.api_version" , arg_0 . api_version , 'str' ) if arg_6 is not None : arg_12 [ '$top' ] = arg_0 . _serialize . query ( "top" , arg_6 , 'int' , minimum = 0 ) if arg_7 is not None : arg_12 [ '$from' ] = arg_0 . _serialize . query ( "from_parameter" , arg_7 , 'iso-8601' ) if arg_8 is not None : arg_12 [ '$to' ] = arg_0 . _serialize . query ( "to" , arg_8 , 'iso-8601' ) if arg_9 is not None : arg_12 [ '$filter' ] = arg_0 . _serialize . query ( "filter" , arg_9 , 'str' ) arg_13 = { } arg_13 [ 'Accept' ] = 'application/json' if arg_0 . config . generate_client_request_id : arg_13 [ 'x-ms-client-request-id' ] = str ( uuid . uuid1 ( ) ) if arg_3 : arg_13 . update ( arg_3 ) if arg_0 . config . accept_language is not None : arg_13 [ 'accept-language' ] = arg_0 . _serialize . header ( "self.config.accept_language" , arg_0 . config . accept_language , 'str' ) arg_14 = arg_0 . _client . post ( arg_10 , arg_12 , arg_13 ) arg_15 = arg_0 . _client . send ( arg_14 , stream = False , ** arg_5 ) if arg_15 . status_code not in [ 200 ] : raise models . QueryFailureException ( arg_0 . _deserialize , arg_15 ) arg_16 = None if arg_15 . status_code == 200 : arg_16 = arg_0 . _deserialize ( 'SummarizeResults' , arg_15 ) if arg_4 : arg_17 = ClientRawResponse ( arg_16 , arg_15 ) return arg_17 return arg_16

def Func(
            arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False, **arg_5):
        """Summarizes policy states for the resources under the management group.

        :param management_group_name: Management group name.
        :type management_group_name: str
        :param query_options: Additional parameters for the operation
        :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: SummarizeResults or ClientRawResponse if raw=true
        :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`
        """
        arg_6 = None
        if arg_2 is not None:
            arg_6 = arg_2.top
        arg_7 = None
        if arg_2 is not None:
            arg_7 = arg_2.from_property
        arg_8 = None
        if arg_2 is not None:
            arg_8 = arg_2.to
        arg_9 = None
        if arg_2 is not None:
            arg_9 = arg_2.filter

        # Construct URL
        arg_10 = arg_0.Func.metadata['url']
        arg_11 = {
            'policyStatesSummaryResource': arg_0._serialize.url("self.policy_states_summary_resource", arg_0.policy_states_summary_resource, 'str'),
            'managementGroupsNamespace': arg_0._serialize.url("self.management_groups_namespace", arg_0.management_groups_namespace, 'str'),
            'managementGroupName': arg_0._serialize.url("management_group_name", arg_1, 'str')
        }
        arg_10 = arg_0._client.format_url(arg_10, **arg_11)

        # Construct parameters
        arg_12 = {}
        arg_12['api-version'] = arg_0._serialize.query("self.api_version", arg_0.api_version, 'str')
        if arg_6 is not None:
            arg_12['$top'] = arg_0._serialize.query("top", arg_6, 'int', minimum=0)
        if arg_7 is not None:
            arg_12['$from'] = arg_0._serialize.query("from_parameter", arg_7, 'iso-8601')
        if arg_8 is not None:
            arg_12['$to'] = arg_0._serialize.query("to", arg_8, 'iso-8601')
        if arg_9 is not None:
            arg_12['$filter'] = arg_0._serialize.query("filter", arg_9, 'str')

        # Construct headers
        arg_13 = {}
        arg_13['Accept'] = 'application/json'
        if arg_0.config.generate_client_request_id:
            arg_13['x-ms-client-request-id'] = str(uuid.uuid1())
        if arg_3:
            arg_13.update(arg_3)
        if arg_0.config.accept_language is not None:
            arg_13['accept-language'] = arg_0._serialize.header("self.config.accept_language", arg_0.config.accept_language, 'str')

        # Construct and send request
        arg_14 = arg_0._client.post(arg_10, arg_12, arg_13)
        arg_15 = arg_0._client.send(arg_14, stream=False, **arg_5)

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

        arg_16 = None

        if arg_15.status_code == 200:
            arg_16 = arg_0._deserialize('SummarizeResults', arg_15)

        if arg_4:
            arg_17 = ClientRawResponse(arg_16, arg_15)
            return arg_17

        return arg_16

Summarizes policy states for the resources under the management group .


def Func ( arg_0 , arg_1 ) : arg_2 = max ( [ len ( i ) for i in arg_0 . samples . keys ( ) ] ) arg_3 = [ i . name for i in arg_1 ] arg_4 = Funcphy ( arg_0 , arg_1 , arg_2 ) Funcnex ( arg_0 , arg_3 , arg_2 , arg_4 )

def Func(arg_0, arg_1):
    """ Make phylip and nexus formats. This is hackish since I'm recycling the
    code whole-hog from pyrad V3. Probably could be good to go back through
    and clean up the conversion code some time.
    """

    ## get the longest name
    arg_2 = max([len(i) for i in arg_0.samples.keys()])
    arg_3 = [i.name for i in arg_1]

    arg_4 = Funcphy(arg_0, arg_1, arg_2)
    Funcnex(arg_0, arg_3, arg_2, arg_4)

Make phylip and nexus formats . This is hackish since I m recycling the code whole - hog from pyrad V3 . Probably could be good to go back through and clean up the conversion code some time .


def Func(arg_0, arg_1):
        """Recognizes and Funcs Strelka VCFs form the set of all input VCFs.

        Each defined caller has a chance to evaluate and Func all the incoming
        files as something that it can process.

        Args:
            file_readers: the collection of currently unFunced files

        Returns:
            A tuple of unFunced readers and StrelkaVcfReaders.
        """
        (arg_2,
         arg_3) = arg_0._find_strelka_files(arg_1)
        arg_4 = arg_0._split_prefix_by_patient(arg_2)
        arg_0._validate_vcf_readers(arg_4)
        arg_5 = arg_0._create_vcf_readers(arg_2)

        return (arg_3, arg_5)

Recognizes and claims Strelka VCFs form the set of all input VCFs.

        Each defined caller has a chance to evaluate and claim all the incoming
        files as something that it can process.

        Args:
            file_readers: the collection of currently unclaimed files

        Returns:
            A tuple of unclaimed readers and StrelkaVcfReaders.

Recognizes and claims Strelka VCFs form the set of all input VCFs .


return Collection.query.filter(Collection.name == name).first()

def Func ( arg_0 , arg_1 ) : from sregistry . database . models import Collection return Collection . query . filter ( Collection . name == arg_1 ) . first ( )

def Func(arg_0, arg_1):
    '''get a collection, if it exists, otherwise return None.
    '''
    from sregistry.database.models import Collection
    return Collection.query.filter(Collection.name == arg_1).first()

get a collection if it exists otherwise return None .


(in_file, out_file, in_fmt="", out_fmt="")

def Func(arg_0, arg_1, arg_2="", arg_3=""):
    """
    Converts in_file to out_file, guessing datatype in the absence of
    in_fmt and out_fmt.

    Arguments:
        in_file:    The name of the (existing) datafile to read
        out_file:   The name of the file to create with Funced data
        in_fmt:     Optional. The format of incoming data, if not guessable
        out_fmt:    Optional. The format of outgoing data, if not guessable

    Returns:
        String. Output filename
    """
    # First verify that in_file exists and out_file doesn't.
    arg_0 = os.path.expanduser(arg_0)
    arg_1 = os.path.expanduser(arg_1)

    if not os.path.exists(arg_0):
        raise IOError("Input file {0} does not exist, stopping..."
                      .format(arg_0))

    # Get formats, either by explicitly naming them or by guessing.
    # TODO: It'd be neat to check here if an explicit fmt matches the guess.
    arg_2 = arg_2.lower() or _guess_format_from_extension(
        arg_0.split('.')[-1].lower())
    arg_3 = arg_3.lower() or _guess_format_from_extension(
        arg_1.split('.')[-1].lower())

    if not arg_2 or not arg_3:
        raise ValueError("Cannot determine conversion formats.")
        return False

    if arg_2 is arg_3:
        # This is the case when this module (intended for LONI) is used
        # indescriminately to 'funnel' data into one format.
        shutil.copyfileobj(arg_0, arg_1)
        return arg_1

    # Import
    if arg_2 == 'hdf5':
        from . import hdf5
        arg_4 = hdf5.load(arg_0)
    elif arg_2 == 'tiff':
        from . import tiff
        arg_4 = tiff.load(arg_0)
    elif arg_2 == 'png':
        from . import png
        arg_4 = png.load(arg_0)
    else:
        return _fail_pair_conversion(arg_2, arg_3)

    # Export
    if arg_3 == 'hdf5':
        from . import hdf5
        return hdf5.save(arg_1, arg_4)
    elif arg_3 == 'tiff':
        from . import tiff
        return tiff.save(arg_1, arg_4)
    elif arg_3 == 'png':
        from . import png
        return png.export_png(arg_1, arg_4)
    else:
        return _fail_pair_conversion(arg_2, arg_3)

    return _fail_pair_conversion(arg_2, arg_3)

Converts in_file to out_file, guessing datatype in the absence of
    in_fmt and out_fmt.

    Arguments:
        in_file:    The name of the (existing) datafile to read
        out_file:   The name of the file to create with converted data
        in_fmt:     Optional. The format of incoming data, if not guessable
        out_fmt:    Optional. The format of outgoing data, if not guessable

    Returns:
        String. Output filename

Converts in_file to out_file guessing datatype in the absence of in_fmt and out_fmt .


def
Func
(
arg_0
)
:
arg_0
=
np
.
asanyarray
(
arg_0
)
if
(
arg_0
.
dtype
.
char
in
np
.
typecodes
[
'AllFloat'
]
and
not
np
.
isfinite
(
arg_0
.
sum
(
)
)
and
not
np
.
isfinite
(
arg_0
)
.
all
(
)
)
:
raise
ValueError
(
"Input contains NaN, infinity"
" or a value too large for %r."
%
arg_0
.
dtype
)

def Func(arg_0):
    """Like assert_all_finite, but only for ndarray."""
    arg_0 = np.asanyarray(arg_0)
    # First try an O(n) time, O(1) space solution for the common case that
    # everything is finite; fall back to O(n) space np.isfinite to prevent
    # false positives from overflow in sum method
    if (arg_0.dtype.char in np.typecodes['AllFloat'] and
            not np.isfinite(arg_0.sum()) and not np.isfinite(arg_0).all()):
        raise ValueError("Input contains NaN, infinity"
                         " or a value too large for %r." % arg_0.dtype)

Like assert_all_finite but only for ndarray .


(event, sender_app, pid=None, record=None,
                              **kwargs)

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = None , ** arg_4 ) : arg_0 . update ( dict ( timestamp = datetime . datetime . utcnow ( ) . isoformat ( ) , record_id = str ( arg_3 . id ) , pid_type = arg_2 . pid_type , pid_value = str ( arg_2 . pid_value ) , referrer = request . referrer , ** get_user ( ) ) ) return arg_0

def Func(arg_0, arg_1, arg_2=None, arg_3=None,
                              **arg_4):
    """Build a record-view event."""
    arg_0.update(dict(
        # When:
        timestamp=datetime.datetime.utcnow().isoformat(),
        # What:
        record_id=str(arg_3.id),
        pid_type=arg_2.pid_type,
        pid_value=str(arg_2.pid_value),
        referrer=request.referrer,
        # Who:
        **get_user()
    ))
    return arg_0


def Func ( arg_0 ) : Func = np . divide ( arg_0 . image , arg_0 . noise_map ) Func [ Func < 0 ] = 0 return Func

def Func(arg_0):
        """The estimated signal-to-noise_maps mappers of the image."""
        Func = np.divide(arg_0.image, arg_0.noise_map)
        Func[Func < 0] = 0
        return Func

The estimated signal - to - noise_maps mappers of the image .


def Func ( arg_0 ) -> float : if arg_0 . paused : return arg_0 . pause_time return mixer . music . get_pos ( ) / 1000.0

def Func(arg_0) -> float:
        """
        Get the current position in the music in seconds
        """
        if arg_0.paused:
            return arg_0.pause_time

        return mixer.music.get_pos() / 1000.0


def Func(arg_0):
        """Special handling if record is a CMS NOTE."""
        arg_1 = record_get_field_values(arg_0.record, '690',
                                          filter_subfield_code="a",
                                          filter_subfield_value='INTNOTE')
        if arg_1:
            arg_2 = record_get_field_values(arg_0.record,
                                              tag='088',
                                              filter_subfield_code="a")
            for arg_3 in arg_2:
                if 'CMS' in arg_3:
                    arg_4 = ('http://weblib.cern.ch/abstract?CERN-CMS' +
                           arg_3.split('CMS', 1)[-1])
                    record_add_field(arg_0.record,
                                     tag='856',
                                     ind1='4',
                                     subfields=[('u', arg_4)])

Special handling if record is a CMS NOTE .


def Func ( arg_0 , arg_1 = ( 0 , 1 ) , arg_2 = None , arg_3 = 0 ) : arg_4 = True try : len ( arg_0 ) except TypeError : arg_4 = False arg_0 = [ arg_0 ] if not hasattr ( arg_0 , 'dtype' ) : arg_0 = np . asarray ( arg_0 ) if arg_2 is None : arg_2 = np . array ( [ np . min ( arg_0 ) , np . max ( arg_0 ) ] ) else : arg_2 = np . asarray ( arg_2 ) if ( zero_range ( arg_2 ) or zero_range ( arg_1 ) ) : arg_5 = np . repeat ( np . mean ( arg_1 ) , len ( arg_0 ) ) else : arg_6 = 2 * np . max ( np . abs ( arg_2 - arg_3 ) ) arg_5 = ( arg_0 - arg_3 ) / arg_6 * np . diff ( arg_1 ) + np . mean ( arg_1 ) if not arg_4 : arg_5 = arg_5 [ 0 ] return arg_5

def Func(arg_0, arg_1=(0, 1), arg_2=None, arg_3=0):
    """
    Rescale numeric vector to have specified minimum, midpoint,
    and maximum.

    Parameters
    ----------
    x : array_like | numeric
        1D vector of values to manipulate.
    to : tuple
        output range (numeric vector of length two)
    _from : tuple
        input range (numeric vector of length two).
        If not given, is calculated from the range of x
    mid	: numeric
        mid-point of input range

    Returns
    -------
    out : array_like
        Rescaled values

    Examples
    --------
    >>> Func([1, 2, 3], mid=1)
    array([0.5 , 0.75, 1.  ])
    >>> Func([1, 2, 3], mid=2)
    array([0. , 0.5, 1. ])
    """
    arg_4 = True

    try:
        len(arg_0)
    except TypeError:
        arg_4 = False
        arg_0 = [arg_0]

    if not hasattr(arg_0, 'dtype'):
        arg_0 = np.asarray(arg_0)

    if arg_2 is None:
        arg_2 = np.array([np.min(arg_0), np.max(arg_0)])
    else:
        arg_2 = np.asarray(arg_2)

    if (zero_range(arg_2) or zero_range(arg_1)):
        arg_5 = np.repeat(np.mean(arg_1), len(arg_0))
    else:
        arg_6 = 2 * np.max(np.abs(arg_2 - arg_3))
        arg_5 = (arg_0 - arg_3) / arg_6 * np.diff(arg_1) + np.mean(arg_1)

    if not arg_4:
        arg_5 = arg_5[0]
    return arg_5

Rescale numeric vector to have specified minimum, midpoint,
    and maximum.

    Parameters
    ----------
    x : array_like | numeric
        1D vector of values to manipulate.
    to : tuple
        output range (numeric vector of length two)
    _from : tuple
        input range (numeric vector of length two).
        If not given, is calculated from the range of x
    mid	: numeric
        mid-point of input range

    Returns
    -------
    out : array_like
        Rescaled values

    Examples
    --------
    >>> rescale_mid([1, 2, 3], mid=1)
    array([0.5 , 0.75, 1.  ])
    >>> rescale_mid([1, 2, 3], mid=2)
    array([0. , 0.5, 1. ])

Rescale numeric vector to have specified minimum midpoint and maximum .


def Func(arg_0, arg_1):
        """ Write data to blimpy file.

        Args:
            filename_out (str): Name of output file
        """

        print("[Filterbank] Warning: Non-standard function to write in filterbank (.fil) format. Please use Waterfall.")

        arg_2  = int(arg_0.header[b'nbits'] / 8)
        with open(arg_1, "wb") as fileh:
            fileh.write(generate_sigproc_header(arg_0))
            arg_3 = arg_0.data
            if arg_2 == 4:
                np.float32(arg_3.ravel()).tofile(fileh)
            elif arg_2 == 2:
                np.int16(arg_3.ravel()).tofile(fileh)
            elif arg_2 == 1:
                np.int8(arg_3.ravel()).tofile(fileh)


return {
        node
        for node in graph
        if node.function == func and is_causal_sink(graph, node)
    }

def Func ( arg_0 : arg_1 , arg_2 ) -> Set [ BaseEntity ] : return { arg_3 for arg_3 in arg_0 if arg_3 . function == arg_2 and is_causal_sink ( arg_0 , arg_3 ) }

def Func(arg_0: arg_1, arg_2) -> Set[BaseEntity]:
    """Returns a set of all ABUNDANCE nodes that have an causal out-degree of 0.

    This likely means that the knowledge assembly is incomplete, or there is a curation error.
    """
    return {
        arg_3
        for arg_3 in arg_0
        if arg_3.function == arg_2 and is_causal_sink(arg_0, arg_3)
    }

Returns a set of all ABUNDANCE nodes that have an causal out - degree of 0 .


(self, pk=None, fail_on_missing=False, **kwargs)

return super(Resource, self).\
            delete(pk=pk, fail_on_missing=fail_on_missing, **kwargs)

def Func ( arg_0 , arg_1 = None , arg_2 = False , ** arg_3 ) : arg_0 . _separate ( arg_3 ) return super ( Resource , arg_0 ) . Func ( arg_1 = arg_1 , arg_2 = arg_2 , ** arg_3 )

def Func(arg_0, arg_1=None, arg_2=False, **arg_3):
        """Remove the given notification template.

        Note here configuration-related fields like
        'notification_configuration' and 'channels' will not be
        used even provided.

        If `fail_on_missing` is True, then the object's not being found is
        considered a failure; otherwise, a success with no change is reported.

        =====API DOCS=====
        Remove the given object.

        :param pk: Primary key of the resource to be Funcd.
        :type pk: int
        :param fail_on_missing: Flag that if set, the object's not being found is considered a failure; otherwise,
                                a success with no change is reported.
        :type fail_on_missing: bool
        :param `**kwargs`: Keyword arguments used to look up resource object to Func if ``pk`` is not provided.
        :returns: dictionary of only one field "changed", which is a flag indicating whether the specified resource
                  is successfully Funcd.
        :rtype: dict

        =====API DOCS=====
        """
        arg_0._separate(arg_3)
        return super(Resource, arg_0).\
            Func(arg_1=arg_1, arg_2=arg_2, **arg_3)

Remove the given notification template.

        Note here configuration-related fields like
        'notification_configuration' and 'channels' will not be
        used even provided.

        If `fail_on_missing` is True, then the object's not being found is
        considered a failure; otherwise, a success with no change is reported.

        =====API DOCS=====
        Remove the given object.

        :param pk: Primary key of the resource to be deleted.
        :type pk: int
        :param fail_on_missing: Flag that if set, the object's not being found is considered a failure; otherwise,
                                a success with no change is reported.
        :type fail_on_missing: bool
        :param `**kwargs`: Keyword arguments used to look up resource object to delete if ``pk`` is not provided.
        :returns: dictionary of only one field "changed", which is a flag indicating whether the specified resource
                  is successfully deleted.
        :rtype: dict

        =====API DOCS=====

Remove the given notification template .


def Func ( arg_0 ) : if arg_0 . _authorization ( ) : if arg_0 . epoch < int ( arg_2 . time ( ) ) : arg_1 = "past" else : arg_1 = "future" if arg_0 . is_in_database ( ) : if ( str ( arg_0 . epoch ) != arg_2 . INTERN [ "whois_db" ] [ arg_2 . INTERN [ "file_to_test" ] ] [ arg_2 . INTERN [ "to_test" ] ] [ "epoch" ] ) : arg_2 . INTERN [ "whois_db" ] [ arg_2 . INTERN [ "file_to_test" ] ] [ arg_2 . INTERN [ "to_test" ] ] . update ( { "epoch" : str ( arg_0 . epoch ) , "state" : arg_1 , "expiration_date" : arg_0 . expiration_date , } ) elif arg_0 . is_time_older ( ) : if ( arg_2 . INTERN [ "whois_db" ] [ arg_2 . INTERN [ "file_to_test" ] ] [ arg_2 . INTERN [ "to_test" ] ] [ "state" ] != "past" ) : arg_2 . INTERN [ "whois_db" ] [ arg_2 . INTERN [ "file_to_test" ] ] [ arg_2 . INTERN [ "to_test" ] ] . update ( { "state" : "past" } ) elif ( arg_2 . INTERN [ "whois_db" ] [ arg_2 . INTERN [ "file_to_test" ] ] [ arg_2 . INTERN [ "to_test" ] ] [ "state" ] != "future" ) : arg_2 . INTERN [ "whois_db" ] [ arg_2 . INTERN [ "file_to_test" ] ] [ arg_2 . INTERN [ "to_test" ] ] . update ( { "state" : "future" } ) else : if ( not arg_2 . INTERN [ "file_to_test" ] in arg_2 . INTERN [ "whois_db" ] ) : arg_2 . INTERN [ "whois_db" ] [ arg_2 . INTERN [ "file_to_test" ] ] = { } arg_2 . INTERN [ "whois_db" ] [ arg_2 . INTERN [ "file_to_test" ] ] . update ( { arg_2 . INTERN [ "to_test" ] : { "epoch" : str ( arg_0 . epoch ) , "state" : arg_1 , "expiration_date" : arg_0 . expiration_date , } } ) arg_0 . _backup ( )

def Func(arg_0):
        """
        Add the currently tested element into the database.
        """

        if arg_0._authorization():
            # We are authorized to work.

            if arg_0.epoch < int(arg_2.time()):
                arg_1 = "past"
            else:
                arg_1 = "future"

            if arg_0.is_in_database():
                # The element we are working with is in the database.

                if (
                    str(arg_0.epoch)
                    != arg_2.INTERN["whois_db"][arg_2.INTERN["file_to_test"]][
                        arg_2.INTERN["to_test"]
                    ]["epoch"]
                ):
                    # The given epoch is diffent from the one saved.

                    # We update it.
                    arg_2.INTERN["whois_db"][arg_2.INTERN["file_to_test"]][
                        arg_2.INTERN["to_test"]
                    ].update(
                        {
                            "epoch": str(arg_0.epoch),
                            "state": arg_1,
                            "expiration_date": arg_0.expiration_date,
                        }
                    )

                elif arg_0.is_time_older():
                    # The expiration date from the database is in the past.

                    if (
                        arg_2.INTERN["whois_db"][
                            arg_2.INTERN["file_to_test"]
                        ][arg_2.INTERN["to_test"]]["state"]
                        != "past"
                    ):  # pragma: no cover
                        # The state of the element in the datbase is not
                        # equal to `past`.

                        # We update it to `past`.
                        arg_2.INTERN["whois_db"][
                            arg_2.INTERN["file_to_test"]
                        ][arg_2.INTERN["to_test"]].update({"state": "past"})
                elif (
                    arg_2.INTERN["whois_db"][arg_2.INTERN["file_to_test"]][
                        arg_2.INTERN["to_test"]
                    ]["state"]
                    != "future"
                ):
                    # * The expiration date from the database is in the future.
                    # and
                    # * The state of the element in the database is not
                    # equal to `future`.

                    # We update it to `future`.
                    arg_2.INTERN["whois_db"][arg_2.INTERN["file_to_test"]][
                        arg_2.INTERN["to_test"]
                    ].update({"state": "future"})
            else:
                # The element we are working with is not in the database.

                if (
                    not arg_2.INTERN["file_to_test"]
                    in arg_2.INTERN["whois_db"]
                ):
                    # The file path is not in the database.

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

                # We create the first dataset.
                arg_2.INTERN["whois_db"][arg_2.INTERN["file_to_test"]].update(
                    {
                        arg_2.INTERN["to_test"]: {
                            "epoch": str(arg_0.epoch),
                            "state": arg_1,
                            "expiration_date": arg_0.expiration_date,
                        }
                    }
                )

            # We do a safety backup of our database.
            arg_0._backup()

Add the currently tested element into the database .


def Func ( arg_0 , arg_1 ) : if arg_1 is None : if arg_0 . xmlnode . hasProp ( "node" ) : arg_0 . xmlnode . unsetProp ( "node" ) return arg_1 = unicode ( arg_1 ) arg_0 . xmlnode . setProp ( "node" , arg_1 . encode ( "utf-8" ) )

def Func(arg_0,arg_1):
        """Set the node of the item.

        :Parameters:
            - `node`: the new node or `None`.
        :Types:
            - `node`: `unicode`
        """
        if arg_1 is None:
            if arg_0.xmlnode.hasProp("node"):
                arg_0.xmlnode.unsetProp("node")
            return
        arg_1 = unicode(arg_1)
        arg_0.xmlnode.setProp("node", arg_1.encode("utf-8"))


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = to_api_path ( arg_1 [ 'parent_name' ] + arg_1 [ 'name' ] ) arg_5 = base_model ( arg_4 ) arg_5 [ 'type' ] = 'file' arg_5 [ 'last_modified' ] = arg_5 [ 'created' ] = arg_1 [ 'created_at' ] if arg_2 : arg_6 = arg_1 [ 'content' ] arg_5 [ 'content' ] , arg_5 [ 'format' ] , arg_5 [ 'mimetype' ] = from_b64 ( arg_4 , arg_6 , arg_3 , ) return arg_5

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Build a file model from database record.
        """
        # TODO: Most of this is shared with _notebook_model_from_db.
        arg_4 = to_api_path(arg_1['parent_name'] + arg_1['name'])
        arg_5 = base_model(arg_4)
        arg_5['type'] = 'file'
        arg_5['last_modified'] = arg_5['created'] = arg_1['created_at']
        if arg_2:
            arg_6 = arg_1['content']
            arg_5['content'], arg_5['format'], arg_5['mimetype'] = from_b64(
                arg_4,
                arg_6,
                arg_3,
            )
        return arg_5

Build a file model from database record .


return ((val, key) for (key, val) in _iteritems_mapping_or_iterable(arg))

def Func ( arg_0 ) : arg_1 = getattr ( arg_0 , '__Func__' , None ) if callable ( arg_1 ) : return arg_1 ( ) return ( ( arg_3 , arg_2 ) for ( arg_2 , arg_3 ) in _iteritems_mapping_or_iterable ( arg_0 ) )

def Func(arg_0):
    """Yield the inverse items of the provided object.

    If *arg* has a :func:`callable` ``__Func__`` attribute,
    return the result of calling it.

    Otherwise, return an iterator over the items in `arg`,
    inverting each item on the fly.

    *See also* :attr:`bidict.BidirectionalMapping.__Func__`
    """
    arg_1 = getattr(arg_0, '__Func__', None)
    if callable(arg_1):
        return arg_1()
    return ((arg_3, arg_2) for (arg_2, arg_3) in _iteritems_mapping_or_iterable(arg_0))

Yield the inverse items of the provided object.

    If *arg* has a :func:`callable` ``__inverted__`` attribute,
    return the result of calling it.

    Otherwise, return an iterator over the items in `arg`,
    inverting each item on the fly.

    *See also* :attr:`bidict.BidirectionalMapping.__inverted__`

Yield the inverse items of the provided object .