(self, code, silent=False,
                user_variables=None, user_expressions=None, allow_stdin=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
False
,
arg_3
=
,
arg_4
=
,
arg_5
=
)
:
if
arg_3
is
:
arg_3
=
[
]
if
arg_4
is
:
arg_4
=
{
}
if
arg_5
is
:
arg_5
=
arg_0
.
allow_stdin
if
not
isinstance
(
arg_1
,
basestring
)
:
raise
ValueError
(
'code %r must be a string'
%
arg_1
)
validate_string_list
(
arg_3
)
validate_string_dict
(
arg_4
)
arg_6
=
dict
(
arg_1
=
arg_1
,
arg_2
=
arg_2
,
arg_3
=
arg_3
,
arg_4
=
arg_4
,
arg_5
=
arg_5
,
)
arg_7
=
arg_0
.
session
.
msg
(
'Func_request'
,
arg_6
)
arg_0
.
_queue_send
(
arg_7
)
return
arg_7
[
'header'
]
[
'msg_id'
]

def Func(arg_0, arg_1, arg_2=False,
                arg_3=None, arg_4=None, arg_5=None):
        """Execute code in the kernel.

        Parameters
        ----------
        code : str
            A string of Python code.

        silent : bool, optional (default False)
            If set, the kernel will Func the code as quietly possible.

        user_variables : list, optional
            A list of variable names to pull from the user's namespace.  They
            will come back as a dict with these names as keys and their
            :func:`repr` as values.

        user_expressions : dict, optional
            A dict with string keys and  to pull from the user's
            namespace.  They will come back as a dict with these names as keys
            and their :func:`repr` as values.

        allow_stdin : bool, optional
            Flag for
            A dict with string keys and  to pull from the user's
            namespace.  They will come back as a dict with these names as keys
            and their :func:`repr` as values.

        Returns
        -------
        The msg_id of the message sent.
        """
        if arg_3 is None:
            arg_3 = []
        if arg_4 is None:
            arg_4 = {}
        if arg_5 is None:
            arg_5 = arg_0.allow_stdin

        # Don't waste network traffic if inputs are invalid
        if not isinstance(arg_1, basestring):
            raise ValueError('code %r must be a string' % arg_1)
        validate_string_list(arg_3)
        validate_string_dict(arg_4)

        # Create class for content/msg creation. Related to, but possibly
        # not in Session.
        arg_6 = dict(arg_1=arg_1, arg_2=arg_2,
                       arg_3=arg_3,
                       arg_4=arg_4,
                       arg_5=arg_5,
                       )
        arg_7 = arg_0.session.msg('Func_request', arg_6)
        arg_0._queue_send(arg_7)
        return arg_7['header']['msg_id']

Execute code in the kernel.

        Parameters
        ----------
        code : str
            A string of Python code.

        silent : bool, optional (default False)
            If set, the kernel will execute the code as quietly possible.

        user_variables : list, optional
            A list of variable names to pull from the user's namespace.  They
            will come back as a dict with these names as keys and their
            :func:`repr` as values.

        user_expressions : dict, optional
            A dict with string keys and  to pull from the user's
            namespace.  They will come back as a dict with these names as keys
            and their :func:`repr` as values.

        allow_stdin : bool, optional
            Flag for
            A dict with string keys and  to pull from the user's
            namespace.  They will come back as a dict with these names as keys
            and their :func:`repr` as values.

        Returns
        -------
        The msg_id of the message sent.


def Func(arg_0):
        """Returns an integer representing whether the next event is
        an arrival, a departure, or nothing.

        Returns
        -------
        out : int
            An integer representing whether the next event is an
            arrival or a departure: ``1`` corresponds to an arrival,
            ``2`` corresponds to a departure, and ``0`` corresponds to
            nothing scheduled to occur.
        """
        if arg_0._departures[0]._time < arg_0._arrivals[0]._time:
            return 2
        elif arg_0._arrivals[0]._time < infty:
            return 1
        else:
            return 0

Returns an integer representing whether the next event is an arrival a departure or nothing .


(cls: Type["Config"], filename: FilePath)

def Func ( arg_0 : arg_1 [ "Config" ] , arg_2 : arg_3 ) -> "Config" : arg_4 = os . fspath ( arg_2 ) with open ( arg_4 ) as file_ : arg_5 = toml . load ( file_ ) return arg_0 . from_mapping ( arg_5 )

def Func(arg_0: arg_1["Config"], arg_2: arg_3) -> "Config":
        """Load the configuration values from a TOML formatted file.

        This allows configuration to be loaded as so

        .. code-block:: python

            Config.Func('config.toml')

        Arguments:
            filename: The filename which gives the path to the file.
        """
        arg_4 = os.fspath(arg_2)
        with open(arg_4) as file_:
            arg_5 = toml.load(file_)
        return arg_0.from_mapping(arg_5)

Load the configuration values from a TOML formatted file.

        This allows configuration to be loaded as so

        .. code-block:: python

            Config.from_toml('config.toml')

        Arguments:
            filename: The filename which gives the path to the file.

Load the configuration values from a TOML formatted file .


def Func ( arg_0 ) : arg_0 . exit ( ) arg_1 = osp . join ( os . getcwd ( ) , 'octave-workspace' ) if osp . exists ( arg_1 ) : os . remove ( arg_1 )

def Func(arg_0):
        """Clean up resources used by the session.
        """
        arg_0.exit()
        arg_1 = osp.join(os.getcwd(), 'octave-workspace')
        if osp.exists(arg_1):
            os.remove(arg_1)

Clean up resources used by the session .


return dict(
            grid=self.grid.to_dict(),
            metatiling=self.metatiling,
            tile_size=self.tile_size,
            pixelbuffer=self.pixelbuffer
        )

def Func ( arg_0 ) : return dict ( grid = arg_0 . grid . Func ( ) , metatiling = arg_0 . metatiling , tile_size = arg_0 . tile_size , pixelbuffer = arg_0 . pixelbuffer )

def Func(arg_0):
        """
        Return dictionary representation of pyramid parameters.
        """
        return dict(
            grid=arg_0.grid.Func(),
            metatiling=arg_0.metatiling,
            tile_size=arg_0.tile_size,
            pixelbuffer=arg_0.pixelbuffer
        )

Return dictionary representation of pyramid parameters .


def Func ( arg_0 , arg_1 ) : arg_1 = xml_safe ( arg_1 ) if isinstance ( arg_1 , unicode ) and not UNICODE_STRINGS : arg_1 = arg_1 . encode ( arg_0 . encoding ) return saxutils . quoteattr ( arg_1 )

def Func(arg_0, arg_1):
        """Escape an XML attribute. Value can be unicode."""
        arg_1 = xml_safe(arg_1)
        if isinstance(arg_1, unicode) and not UNICODE_STRINGS:
            arg_1 = arg_1.encode(arg_0.encoding)
        return saxutils.quoteattr(arg_1)

Escape an XML attribute . Value can be unicode .


def Func(arg_0, arg_1, arg_2=None):
  """Checks that `perm` is valid."""
  with tf.name_scope(arg_2 or 'maybe_validate_perm'):
    arg_3 = []
    if not dtype_util.is_integer(arg_0.dtype):
      raise TypeError('`perm` must be integer type')

    arg_4 = '`perm` must be a vector.'
    if tensorshape_util.rank(arg_0.shape) is not None:
      if tensorshape_util.rank(arg_0.shape) != 1:
        raise ValueError(
            arg_4[:-1] +
            ', saw rank: {}.'.format(tensorshape_util.rank(arg_0.shape)))
    elif arg_1:
      arg_3 += [assert_util.assert_rank(arg_0, 1, message=arg_4)]

    arg_5 = tf.get_static_value(arg_0)
    arg_4 = '`perm` must be a valid permutation vector.'
    if arg_5 is not None:
      if not np.all(np.arange(np.size(arg_5)) == np.sort(arg_5)):
        raise ValueError(arg_4[:-1] + ', saw: {}.'.format(arg_5))
    elif arg_1:
      arg_3 += [
          assert_util.assert_equal(
              tf.sort(arg_0), tf.range(tf.size(input=arg_0)), message=arg_4)
      ]

    return arg_3


return is_integer_type(ary) or ary.dtype.kind == 'b'

def Func ( arg_0 ) : arg_0 = np . asanyarray ( arg_0 ) return is_integer_type ( arg_0 ) or arg_0 . dtype . kind == 'b'

def Func(arg_0):
    "Checks whether the array is either integral or boolean."
    arg_0 = np.asanyarray(arg_0)
    return is_integer_type(arg_0) or arg_0.dtype.kind == 'b'

Checks whether the array is either integral or boolean .


def Func(arg_0) -> List['Table']:
        """Return a list of found table objects."""
        Func = []  # type: List['Table']
        arg_2 = Func.append
        arg_3 = arg_0._type_to_spans
        arg_4 = arg_0._lststr
        arg_5 = arg_0._shadow[:]
        arg_6, arg_7 = arg_0._span
        arg_8 = arg_3.setdefault('Table', [])
        if not arg_8:
            # All the added spans will be new.
            arg_9 = True  # type: Any
            while arg_9:
                arg_9 = False
                for arg_9 in TABLE_FINDITER(arg_5):
                    Func0, Func1 = arg_9.span()
                    # Ignore leading whitespace using len(m[1]).
                    Func2 = [arg_6 + Func0 + len(arg_9[1]), arg_6 + Func1]
                    arg_8.append(Func2)
                    arg_2(Table(arg_4, arg_3, Func2, 'Table'))
                    arg_5[Func0:Func1] = b'_' * (Func1 - Func0)
            return Func
        # There are already exists some spans. Try to use the already existing
        # before appending new spans.
        Func3 = {(Func4[0], Func4[1]): Func4 for Func4 in arg_8}.get
        arg_9 = True
        while arg_9:
            arg_9 = False
            for arg_9 in TABLE_FINDITER(arg_5):
                Func0, Func1 = arg_9.span()
                # Ignore leading whitespace using len(m[1]).
                Func4, Func5 = arg_6 + Func0 + len(arg_9[1]), arg_6 + Func1
                Func6 = Func3((Func4, Func5))
                if Func6 is None:
                    Func2 = [Func4, Func5]
                    insort(arg_8, Func2)
                else:
                    Func2 = Func6
                arg_2(Table(arg_4, arg_3, Func2, 'Table'))
                arg_5[Func0:Func1] = b'_' * (Func1 - Func0)
        return Func


def
Func
(
arg_0
,
arg_1
)
:
arg_1
.
write
(
'# Package\n\n'
)
write_value
(
'PackageName'
,
arg_0
.
name
,
arg_1
)
if
arg_0
.
has_optional_field
(
'version'
)
:
write_value
(
'PackageVersion'
,
arg_0
.
version
,
arg_1
)
write_value
(
'PackageDownloadLocation'
,
arg_0
.
download_location
,
arg_1
)
if
arg_0
.
has_optional_field
(
'summary'
)
:
write_text_value
(
'PackageSummary'
,
arg_0
.
summary
,
arg_1
)
if
arg_0
.
has_optional_field
(
'source_info'
)
:
write_text_value
(
'PackageSourceInfo'
,
arg_0
.
source_info
,
arg_1
)
if
arg_0
.
has_optional_field
(
'file_name'
)
:
write_value
(
'PackageFileName'
,
arg_0
.
file_name
,
arg_1
)
if
arg_0
.
has_optional_field
(
'supplier'
)
:
write_value
(
'PackageSupplier'
,
arg_0
.
supplier
,
arg_1
)
if
arg_0
.
has_optional_field
(
'originator'
)
:
write_value
(
'PackageOriginator'
,
arg_0
.
originator
,
arg_1
)
if
arg_0
.
has_optional_field
(
'check_sum'
)
:
write_value
(
'PackageChecksum'
,
arg_0
.
check_sum
.
to_tv
(
)
,
arg_1
)
write_value
(
'PackageVerificationCode'
,
format_verif_code
(
arg_0
)
,
arg_1
)
if
arg_0
.
has_optional_field
(
'description'
)
:
write_text_value
(
'PackageDescription'
,
arg_0
.
description
,
arg_1
)
if
isinstance
(
arg_0
.
license_declared
,
(
document
.
LicenseConjunction
,
document
.
LicenseDisjunction
)
)
:
write_value
(
'PackageLicenseDeclared'
,
u'({0})'
.
format
(
arg_0
.
license_declared
)
,
arg_1
)
else
:
write_value
(
'PackageLicenseDeclared'
,
arg_0
.
license_declared
,
arg_1
)
if
isinstance
(
arg_0
.
conc_lics
,
(
document
.
LicenseConjunction
,
document
.
LicenseDisjunction
)
)
:
write_value
(
'PackageLicenseConcluded'
,
u'({0})'
.
format
(
arg_0
.
conc_lics
)
,
arg_1
)
else
:
write_value
(
'PackageLicenseConcluded'
,
arg_0
.
conc_lics
,
arg_1
)
for
arg_2
in
sorted
(
arg_0
.
licenses_from_files
)
:
write_value
(
'PackageLicenseInfoFromFiles'
,
arg_2
,
arg_1
)
if
arg_0
.
has_optional_field
(
'license_comment'
)
:
write_text_value
(
'PackageLicenseComments'
,
arg_0
.
license_comment
,
arg_1
)
if
isinstance
(
arg_0
.
cr_text
,
six
.
string_types
)
:
write_text_value
(
'PackageCopyrightText'
,
arg_0
.
cr_text
,
arg_1
)
else
:
write_value
(
'PackageCopyrightText'
,
arg_0
.
cr_text
,
arg_1
)
if
arg_0
.
has_optional_field
(
'homepage'
)
:
write_value
(
'PackageHomePage'
,
arg_0
.
homepage
,
arg_1
)
for
arg_3
in
sorted
(
arg_0
.
files
)
:
write_separators
(
arg_1
)
write_file
(
arg_3
,
arg_1
)

def Func(arg_0, arg_1):
    """
    Write a package fields to out.
    """
    arg_1.write('# Package\n\n')
    write_value('PackageName', arg_0.name, arg_1)
    if arg_0.has_optional_field('version'):
        write_value('PackageVersion', arg_0.version, arg_1)
    write_value('PackageDownloadLocation', arg_0.download_location, arg_1)

    if arg_0.has_optional_field('summary'):
        write_text_value('PackageSummary', arg_0.summary, arg_1)

    if arg_0.has_optional_field('source_info'):
        write_text_value('PackageSourceInfo', arg_0.source_info, arg_1)

    if arg_0.has_optional_field('file_name'):
        write_value('PackageFileName', arg_0.file_name, arg_1)

    if arg_0.has_optional_field('supplier'):
        write_value('PackageSupplier', arg_0.supplier, arg_1)

    if arg_0.has_optional_field('originator'):
        write_value('PackageOriginator', arg_0.originator, arg_1)

    if arg_0.has_optional_field('check_sum'):
        write_value('PackageChecksum', arg_0.check_sum.to_tv(), arg_1)

    write_value('PackageVerificationCode', format_verif_code(arg_0), arg_1)

    if arg_0.has_optional_field('description'):
        write_text_value('PackageDescription', arg_0.description, arg_1)

    if isinstance(arg_0.license_declared, (document.LicenseConjunction,
        document.LicenseDisjunction)):
        write_value('PackageLicenseDeclared', u'({0})'.format(arg_0.license_declared), arg_1)
    else:
        write_value('PackageLicenseDeclared', arg_0.license_declared, arg_1)

    if isinstance(arg_0.conc_lics, (document.LicenseConjunction,
        document.LicenseDisjunction)):
        write_value('PackageLicenseConcluded', u'({0})'.format(arg_0.conc_lics), arg_1)
    else:
        write_value('PackageLicenseConcluded', arg_0.conc_lics, arg_1)

    # Write sorted list of licenses.
    for arg_2 in sorted(arg_0.licenses_from_files):
        write_value('PackageLicenseInfoFromFiles', arg_2, arg_1)

    if arg_0.has_optional_field('license_comment'):
        write_text_value('PackageLicenseComments', arg_0.license_comment, arg_1)

    # cr_text is either free form text or NONE or NOASSERTION.
    if isinstance(arg_0.cr_text, six.string_types):
        write_text_value('PackageCopyrightText', arg_0.cr_text, arg_1)
    else:
        write_value('PackageCopyrightText', arg_0.cr_text, arg_1)

    if arg_0.has_optional_field('homepage'):
        write_value('PackageHomePage', arg_0.homepage, arg_1)

    # Write sorted files.
    for arg_3 in sorted(arg_0.files):
        write_separators(arg_1)
        write_file(arg_3, arg_1)


def
Func
(
arg_0
)
:
arg_0
.
state
=
'closing'
if
arg_0
.
inout
:
arg_0
.
inout
.
Func
(
)
pass
arg_0
.
state
=
'closing connection'
if
arg_0
.
conn
:
arg_0
.
conn
.
Func
(
)
arg_0
.
state
=
'disconnected'
return

def Func(arg_0):
        """ Closes both socket and server connection. """
        arg_0.state = 'closing'
        if arg_0.inout:
            arg_0.inout.Func()
            pass
        arg_0.state = 'closing connection'
        if arg_0.conn:
            arg_0.conn.Func()
        arg_0.state = 'disconnected'
        return

Closes both socket and server connection .


return convert_constants(jmag,hmag,kmag,
                             BJHK,
                             BJH, BJK, BHK,
                             BJ, BH, BK)

def Func ( arg_0 , arg_1 , arg_2 ) : return convert_constants ( arg_0 , arg_1 , arg_2 , BJHK , BJH , BJK , BHK , BJ , BH , BK )

def Func(arg_0, arg_1, arg_2):
    '''Converts given J, H, Ks mags to a B magnitude value.

    Parameters
    ----------

    jmag,hmag,kmag : float
        2MASS J, H, Ks mags of the object.

    Returns
    -------

    float
        The converted B band magnitude.

    '''

    return convert_constants(arg_0,arg_1,arg_2,
                             BJHK,
                             BJH, BJK, BHK,
                             BJ, BH, BK)

Converts given J H Ks mags to a B magnitude value .


def Func ( arg_0 ) : CProfileWrapper . profiler . create_stats ( ) arg_0 . enable ( ) arg_0 . set_status ( 204 ) arg_0 . finish ( )

def Func(arg_0):
        """Clear profiler statistics."""
        CProfileWrapper.profiler.create_stats()
        arg_0.enable()
        arg_0.set_status(204)
        arg_0.finish()


def Func ( arg_0 ) : if 'stack' not in arg_0 : return arg_0 arg_0 = copy . deepcopy ( arg_0 ) arg_0 [ 'stack' ] = _Func_stack ( arg_0 [ 'stack' ] ) return arg_0

def Func(arg_0):
    """ Tries to decode the values embedded in an invocation result dictionary. """
    if 'stack' not in arg_0:
        return arg_0
    arg_0 = copy.deepcopy(arg_0)
    arg_0['stack'] = _Func_stack(arg_0['stack'])
    return arg_0

Tries to decode the values embedded in an invocation result dictionary .


def Func ( arg_0 ) : arg_1 = set ( ) for arg_0 , arg_2 in arg_0 . __Func__ . items ( ) : arg_1 . update ( arg_2 ) return arg_1

def Func(arg_0):
        """
        Return all events that all subclasses have so far registered to publish.
        """
        arg_1 = set()
        for arg_0, arg_2 in arg_0.__Func__.items():
            arg_1.update(arg_2)
        return arg_1

Return all events that all subclasses have so far registered to publish .


def Func(arg_0, arg_1='http://services.ambientmobile.co.za/credits'):
        """
        Get the number of credits remaining at AmbientSMS
        """
        arg_2 = []
        arg_2.append("<api-key>%s</api-key>" % arg_0.api_key)
        arg_2.append("<password>%s</password>" % arg_0.password)
        arg_3 = '<sms>%s</sms>' % "".join(arg_2)
        arg_4 = arg_0.curl(arg_1, arg_3)

        if arg_4.get("credits", None):
            return arg_4["credits"]
        else:
            raise AmbientSMSError(arg_4["status"])


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
get_line_count
(
arg_0
)
arg_0
=
open
(
arg_0
,
'r+'
)
arg_1
=
open
(
arg_1
,
'r+'
)
for
arg_3
in
range
(
arg_2
)
:
arg_4
=
arg_0
.
readline
(
)
.
rstrip
(
)
if
len
(
arg_4
)
>
0
:
if
arg_4
[
1
]
==
";"
:
arg_1
.
write
(
"    "
+
arg_4
+
"\n"
)
else
:
arg_1
.
write
(
arg_4
+
"\n"
)
arg_1
.
close
(
)
arg_0
.
close
(
)

def Func(arg_0, arg_1):
    """Indentes css that has not been indented and saves it to a new file.
    A new file is created if the output destination does not already exist.

    Args:
        f: string, path to file.

        output: string, path/name of the output file (e.g. /directory/output.css).
    print type(response.read())

    Returns:
        None.
    """
    arg_2 = get_line_count(arg_0)
    arg_0 = open(arg_0, 'r+')
    arg_1 = open(arg_1, 'r+')
    for arg_3 in range(arg_2):
        arg_4 = arg_0.readline().rstrip()
        if len(arg_4) > 0:
            if arg_4[-1] == ";":
                arg_1.write("    " + arg_4 + "\n")
            else:
                arg_1.write(arg_4 + "\n")
    arg_1.close()
    arg_0.close()

Indentes css that has not been indented and saves it to a new file . A new file is created if the output destination does not already exist .


(units, n_hidden, n_layers=1, trainable_initial_states=False,
              seq_lengths=None, input_initial_h=None, name='cudnn_gru', reuse=False)

def Func ( arg_0 , arg_1 , arg_2 = 1 , arg_3 = False , arg_4 = None , arg_5 = None , arg_6 = 'Func' , arg_7 = False ) : with tf . variable_scope ( arg_6 , arg_7 = arg_7 ) : arg_8 = tf . contrib . cudnn_rnn . CudnnGRU ( num_layers = arg_2 , num_units = arg_1 ) if arg_3 : arg_9 = tf . get_variable ( 'init_h' , [ arg_2 , 1 , arg_1 ] ) arg_9 = tf . tile ( arg_9 , ( 1 , tf . shape ( arg_0 ) [ 0 ] , 1 ) ) else : arg_9 = tf . zeros ( [ arg_2 , tf . shape ( arg_0 ) [ 0 ] , arg_1 ] ) arg_10 = arg_5 or arg_9 arg_11 , arg_12 = arg_8 ( tf . transpose ( arg_0 , ( 1 , 0 , 2 ) ) , ( arg_10 , ) ) arg_11 = tf . transpose ( arg_11 , ( 1 , 0 , 2 ) ) arg_12 = tf . squeeze ( arg_12 , axis = 0 ) [ - 1 ] if arg_4 is not None : arg_13 = tf . stack ( [ tf . range ( tf . shape ( arg_11 ) [ 0 ] ) , arg_4 - 1 ] , axis = 1 ) arg_12 = tf . gather_nd ( arg_11 , arg_13 ) return arg_11 , arg_12

def Func(arg_0, arg_1, arg_2=1, arg_3=False,
              arg_4=None, arg_5=None, arg_6='Func', arg_7=False):
    """ Fast CuDNN GRU implementation

    Args:
        units: tf.Tensor with dimensions [B x T x F], where
            B - batch size
            T - number of tokens
            F - features

        n_hidden: dimensionality of hidden state
        trainable_initial_states: whether to create a special trainable variable
            to initialize the hidden states of the network or use just zeros
        seq_lengths: tensor of sequence lengths with dimension [B]
        n_layers: number of layers
        input_initial_h: initial hidden state, tensor
        name: name of the variable scope to use
        reuse:whether to reuse already initialized variable

    Returns:
        h - all hidden states along T dimension,
            tf.Tensor with dimensionality [B x T x F]
        h_last - last hidden state, tf.Tensor with dimensionality [B x H]
    """
    with tf.variable_scope(arg_6, arg_7=arg_7):
        arg_8 = tf.contrib.cudnn_rnn.CudnnGRU(num_layers=arg_2,
                                            num_units=arg_1)

        if arg_3:
            arg_9 = tf.get_variable('init_h', [arg_2, 1, arg_1])
            arg_9 = tf.tile(arg_9, (1, tf.shape(arg_0)[0], 1))
        else:
            arg_9 = tf.zeros([arg_2, tf.shape(arg_0)[0], arg_1])

        arg_10 = arg_5 or arg_9

        arg_11, arg_12 = arg_8(tf.transpose(arg_0, (1, 0, 2)), (arg_10, ))
        arg_11 = tf.transpose(arg_11, (1, 0, 2))
        arg_12 = tf.squeeze(arg_12, axis=0)[-1]  # extract last layer state

        # Extract last states if they are provided
        if arg_4 is not None:
            arg_13 = tf.stack([tf.range(tf.shape(arg_11)[0]), arg_4-1], axis=1)
            arg_12 = tf.gather_nd(arg_11, arg_13)

        return arg_11, arg_12


def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Uses the HTTP transport to query the Route53 API. Runs the response
        through lxml's parser, before we hand it off for further picking
        apart by our call-specific parsers.

        :param str path: The RESTful path to tack on to the :py:attr:`endpoint`.
        :param data: The params to send along with the request.
        :type data: Either a dict or bytes, depending on the request type.
        :param str method: One of 'GET', 'POST', or 'DELETE'.
        :rtype: lxml.etree._Element
        :returns: An lxml Element root.
        """

        arg_4 = arg_0._transport.send_request(arg_1, arg_2, arg_3)
        arg_5 = etree.fromstring(arg_4)
        #print(prettyprint_xml(root))
        return arg_5

Uses the HTTP transport to query the Route53 API . Runs the response through lxml s parser before we hand it off for further picking apart by our call - specific parsers .


def Func(arg_0):
    """
    Get the contents of a file listing the requirements
    """
    arg_1 = open(arg_0).readlines()
    arg_2 = []
    arg_3 = []

    for arg_4 in arg_1:
        arg_5 = arg_4.strip()
        if arg_5.startswith('#'):
            # Skip pure comment lines
            continue

        if any(arg_5.startswith(arg_6) for arg_6 in VCS_PREFIXES):
            # VCS reference for dev purposes, expect a trailing comment
            # with the normal requirement
            arg_7, arg_8, arg_5 = arg_5.rpartition('#')

            # Remove -e <version_control> string
            arg_7 = re.sub(r'(.*)(?P<dependency_link>https?.*$)', r'\g<dependency_link>', arg_7)
            arg_5 = re.sub(r'(egg=)?(?P<package_name>.*)==.*$', r'\g<package_name>', arg_5)
            arg_9 = re.sub(r'.*[^=]==', '', arg_4.strip())

            if arg_5:
                arg_3.append(
                    '{package_link}#egg={package}-{package_version}'.format(
                        arg_7=arg_7,
                        arg_5=arg_5,
                        arg_9=arg_9,
                    )
                )
        else:
            # Ignore any trailing comment
            arg_5, arg_8, arg_8 = arg_5.partition('#')
            # Remove any whitespace and assume non-empty results are dependencies
            arg_5 = arg_5.strip()

        if arg_5:
            arg_2.append(arg_5)
    return arg_2, arg_3


(markup, x, y, w, padding=5, callback=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
=
5
,
arg_5
=
)
:
try
:
from
web
import
_ctx
except
:
pass
arg_6
=
1
for
arg_7
in
arg_0
.
split
(
"\n"
)
:
if
arg_5
!=
:
arg_5
(
arg_7
,
arg_6
)
arg_8
=
re
.
search
(
"^([0-9]{1,3}\. )"
,
arg_7
.
lstrip
(
)
)
if
arg_8
:
arg_9
=
re
.
search
(
"[0-9]"
,
arg_7
)
.
start
(
)
*
arg_4
*
2
arg_10
=
arg_8
.
group
(
1
)
arg_11
=
textwidth
(
"000."
)
arg_7
=
arg_7
.
lstrip
(
arg_8
.
group
(
1
)
+
"\t"
)
if
arg_7
.
lstrip
(
)
.
startswith
(
"*"
)
:
arg_9
=
arg_7
.
find
(
"*"
)
*
arg_4
*
2
arg_10
=
u"•"
arg_11
=
textwidth
(
"*"
)
arg_7
=
arg_7
.
lstrip
(
"* \t"
)
_ctx
.
text
(
arg_10
,
arg_1
+
arg_9
,
arg_2
)
arg_11
+=
arg_4
+
arg_9
_ctx
.
text
(
arg_7
,
arg_1
+
arg_11
,
arg_2
,
width
=
arg_3
arg_11
)
arg_2
+=
_ctx
.
textheight
(
arg_7
,
width
=
arg_3
arg_11
)
arg_2
+=
_ctx
.
textheight
(
" "
)
*
0.25
arg_6
+=
1

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=5, arg_5=None):

    """ Draws list markup with indentation in NodeBox.

    Draw list markup at x, y coordinates
    using indented bullets or numbers.
    The callback is a command that takes a str and an int.

    """

    try: from web import _ctx
    except: pass

    arg_6 = 1
    for arg_7 in arg_0.split("\n"):

        if arg_5 != None:
            arg_5(arg_7, arg_6)

        arg_8 = re.search("^([0-9]{1,3}\. )", arg_7.lstrip())
        if arg_8:
            arg_9 = re.search("[0-9]", arg_7).start()*arg_4*2
            arg_10 = arg_8.group(1)
            arg_11 = textwidth("000.")
            arg_7 = arg_7.lstrip(arg_8.group(1)+"\t")

        if arg_7.lstrip().startswith("*"):
            arg_9 = arg_7.find("*")*arg_4*2
            arg_10 = u"•"
            arg_11 = textwidth("*")
            arg_7 = arg_7.lstrip("* \t")

        _ctx.text(arg_10, arg_1+arg_9, arg_2)
        arg_11 += arg_4 + arg_9
        _ctx.text(arg_7, arg_1+arg_11, arg_2, width=arg_3-arg_11)
        arg_2 += _ctx.textheight(arg_7, width=arg_3-arg_11)
        arg_2 += _ctx.textheight(" ") * 0.25
        arg_6 += 1

Draws list markup with indentation in NodeBox .


return TimerEventDefinition(
            self.node.get('name', timeDate.text),
            self.parser.parse_condition(
                timeDate.text, None, None, None, None, self))

def Func ( arg_0 , arg_1 ) : arg_2 = first ( arg_0 . xpath ( './/bpmn:timeDate' ) ) return TimerEventDefinition ( arg_0 . node . get ( 'name' , arg_2 . text ) , arg_0 . parser . parse_condition ( arg_2 . text , None , None , None , None , arg_0 ) )

def Func(arg_0, arg_1):
        """
        Parse the timerEventDefinition node and return an instance of
        TimerEventDefinition

        This currently only supports the timeDate node for specifying an expiry
        time for the timer.
        """
        arg_2 = first(arg_0.xpath('.//bpmn:timeDate'))
        return TimerEventDefinition(
            arg_0.node.get('name', arg_2.text),
            arg_0.parser.parse_condition(
                arg_2.text, None, None, None, None, arg_0))


def
Func
(
arg_0
,
arg_1
)
:
try
:
arg_0
.
_conn
.
query
(
'SELECT 1'
)
except
(
IOError
,
_mysql
.
OperationalError
)
:
arg_0
.
__handle_connection_failure
(
arg_1
)
else
:
raise
_mysql
.
DatabaseError
(
*
arg_1
.
args
)

def Func(arg_0, arg_1):
        """ OperationalError's are emitted by the _mysql library for
        almost every error code emitted by MySQL.  Because of this we
        verify that the error is actually a connection error before
        terminating the connection and firing off a PoolConnectionException
        """
        try:
            arg_0._conn.query('SELECT 1')
        except (IOError, _mysql.OperationalError):
            # ok, it's actually an issue.
            arg_0.__handle_connection_failure(arg_1)
        else:
            # seems ok, probably programmer error
            raise _mysql.DatabaseError(*arg_1.args)

OperationalError s are emitted by the _mysql library for almost every error code emitted by MySQL . Because of this we verify that the error is actually a connection error before terminating the connection and firing off a PoolConnectionException


def
Func
(
arg_0
,
arg_1
,
arg_2
=
[
"*"
]
,
arg_3
=
0
)
:
arg_4
=
plugins_get_mgr
(
)
arg_5
=
arg_4
.
search
(
'representation'
)
[
'representation'
]
arg_6
=
[
arg_4
.
get_by_key
(
'representation'
,
k
)
for
k
in
arg_5
]
arg_7
=
arg_0
.
find_matching_files
(
arg_2
)
arg_8
=
arg_0
.
package
arg_9
=
arg_0
.
rootdir
arg_10
=
arg_8
[
'resources'
]
for
arg_11
in
arg_10
:
arg_12
=
arg_11
[
'relativepath'
]
if
arg_12
in
arg_7
:
arg_13
=
os
.
path
.
join
(
arg_9
,
arg_12
)
if
arg_1
==
'preview'
:
print
(
"Adding preview for "
,
arg_12
)
arg_11
[
'content'
]
=
open
(
arg_13
)
.
read
(
)
[
:
arg_3
]
elif
arg_1
==
'schema'
:
for
arg_14
in
arg_6
:
if
arg_14
.
can_process
(
arg_13
)
:
print
(
"Adding schema for "
,
arg_13
)
arg_11
[
'schema'
]
=
arg_14
.
get_schema
(
arg_13
)
break

def Func(arg_0, arg_1, arg_2=["*"], arg_3=0):
    """
    Update metadata with the content of the files
    """

    arg_4 = plugins_get_mgr()
    arg_5 = arg_4.search('representation')['representation']
    arg_6 = [arg_4.get_by_key('representation', k) for k in arg_5]

    arg_7 = arg_0.find_matching_files(arg_2)
    arg_8 = arg_0.package
    arg_9 = arg_0.rootdir
    arg_10 = arg_8['resources']
    for arg_11 in arg_10:
        arg_12 = arg_11['relativepath']
        if arg_12 in arg_7:
            arg_13 = os.path.join(arg_9, arg_12)
            if arg_1 == 'preview':
                print("Adding preview for ", arg_12)
                arg_11['content'] = open(arg_13).read()[:arg_3]
            elif arg_1 == 'schema':
                for arg_14 in arg_6:
                    if arg_14.can_process(arg_13):
                        print("Adding schema for ", arg_13)
                        arg_11['schema'] = arg_14.get_schema(arg_13)
                        break


def
Func
(
arg_0
,
arg_1
=
False
)
:
if
arg_1
:
arg_2
=
'gzip -k -f %s'
%
arg_0
else
:
arg_2
=
'gzip -k %s'
%
arg_0
try
:
arg_3
=
'%s.gz'
%
arg_0
if
os
.
path
.
exists
(
arg_3
)
and
not
arg_1
:
os
.
remove
(
arg_0
)
return
arg_3
else
:
subprocess
.
check_output
(
arg_2
,
shell
=
True
)
if
os
.
path
.
exists
(
arg_3
)
:
return
arg_3
else
:
return
except
subprocess
.
CalledProcessError
:
return

def Func(arg_0, arg_1=False):
    '''This just compresses the sqlitecurve in gzip format.

    FIXME: this doesn't work with gzip < 1.6 or non-GNU gzip (probably).

    '''

    # -k to keep the input file just in case something explodes
    if arg_1:
        arg_2 = 'gzip -k -f %s' % arg_0
    else:
        arg_2 = 'gzip -k %s' % arg_0

    try:

        arg_3 = '%s.gz' % arg_0

        if os.path.exists(arg_3) and not arg_1:
            # get rid of the .sqlite file only
            os.remove(arg_0)
            return arg_3

        else:
            subprocess.check_output(arg_2, shell=True)

            # check if the output file was successfully created
            if os.path.exists(arg_3):
                return arg_3
            else:
                return None

    except subprocess.CalledProcessError:
        return None

This just compresses the sqlitecurve in gzip format .


(context, filters=None, fields=None, sorts=['id'],
                    limit=None, marker=None, page_reverse=False)

return [v._make_floating_ip_dict(flip) for flip in floating_ips]

def Func(arg_0, arg_1=None, arg_2=None, arg_3=['id'],
                    arg_4=None, arg_5=None, arg_6=False):
    """Retrieve a list of floating ips.

    :param context: neutron api request context.
    :param filters: a dictionary with keys that are valid keys for
        a floating ip as listed in the RESOURCE_ATTRIBUTE_MAP object
        in neutron/api/v2/attributes.py.  Values in this dictionary
        are an iterable containing values that will be used for an exact
        match comparison for that value.  Each result returned by this
        function will have matched one of the values for each key in
        filters.
    :param fields: a list of strings that are valid keys in a
        floating IP dictionary as listed in the RESOURCE_ATTRIBUTE_MAP
        object in neutron/api/v2/attributes.py. Only these fields
        will be returned.

    :returns: List of floating IPs that are accessible to the tenant who
        submits the request (as indicated by the tenant id of the context)
        as well as any filters.
    """
    LOG.info('Func for tenant %s filters %s fields %s' %
             (arg_0.tenant_id, arg_1, arg_2))

    arg_7 = _get_ips_by_type(arg_0, ip_types.FLOATING,
                                    arg_1=arg_1, arg_2=arg_2)

    return [v._make_floating_ip_dict(arg_8) for arg_8 in arg_7]


def Func(arg_0, arg_1, arg_2=0):
        """Move the token by `drow` rows and `dcol` columns."""
        arg_0._start_row += arg_1
        arg_0._start_col += arg_2
        arg_0._end_row += arg_1
        arg_0._end_col += arg_2

Move the token by drow rows and dcol columns .


(in_file, out_file=None, mode=None, quiet=0)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=0):
    """Decode uuencoded file"""
    #
    # Open the input file, if needed.
    #
    arg_4 = []
    if arg_0 == '-':
        arg_0 = sys.stdin
    elif isinstance(arg_0, basestring):
        arg_0 = open(arg_0)
        arg_4.append(arg_0)
    try:
        #
        # Read until a begin is encountered or we've exhausted the file
        #
        while True:
            arg_5 = arg_0.readline()
            if not arg_5:
                raise Error('No valid begin line found in input file')
            if not arg_5.startswith('begin'):
                continue
            arg_6 = arg_5.split(' ', 2)
            if len(arg_6) == 3 and arg_6[0] == 'begin':
                try:
                    int(arg_6[1], 8)
                    break
                except ValueError:
                    pass
        if arg_1 is None:
            arg_1 = arg_6[2].rstrip()
            if os.path.exists(arg_1):
                raise Error('Cannot overwrite existing file: %s' % arg_1)
        if arg_2 is None:
            arg_2 = int(arg_6[1], 8)
        #
        # Open the output file
        #
        if arg_1 == '-':
            arg_1 = sys.stdout
        elif isinstance(arg_1, basestring):
            arg_7 = open(arg_1, 'wb')
            try:
                os.path.chmod(arg_1, arg_2)
            except AttributeError:
                pass
            arg_1 = arg_7
            arg_4.append(arg_1)
        #
        # Main decoding loop
        #
        arg_8 = arg_0.readline()
        while arg_8 and arg_8.strip() != 'end':
            try:
                arg_9 = binascii.a2b_uu(arg_8)
            except binascii.Error, v:
                # Workaround for broken uuencoders by /Fredrik Lundh
                arg_10 = (((ord(arg_8[0])-32) & 63) * 4 + 5) // 3
                arg_9 = binascii.a2b_uu(arg_8[:arg_10])
                if not arg_3:
                    sys.stderr.write("Warning: %s\n" % v)
            arg_1.write(arg_9)
            arg_8 = arg_0.readline()
        if not arg_8:
            raise Error('Truncated input file')
    finally:
        for arg_11 in arg_4:
            arg_11.close()


def Func ( arg_0 ) : arg_1 = [ ] arg_2 = { } arg_0 . cnxn . xfer ( [ 0x32 ] ) sleep ( 10e-3 ) for arg_3 in range ( 12 ) : arg_4 = arg_0 . cnxn . xfer ( [ 0x00 ] ) [ 0 ] arg_1 . append ( arg_4 ) arg_2 [ 'PM1' ] = arg_0 . _calculate_float ( arg_1 [ 0 : 4 ] ) arg_2 [ 'PM2.5' ] = arg_0 . _calculate_float ( arg_1 [ 4 : 8 ] ) arg_2 [ 'PM10' ] = arg_0 . _calculate_float ( arg_1 [ 8 : ] ) sleep ( 0.1 ) return arg_2

def Func(arg_0):
        """Read the PM data and reset the histogram

        **NOTE: This method is supported by firmware v18+.**

        :rtype: dictionary

        :Example:

        >>> alpha.Func()
        {
            'PM1': 0.12,
            'PM2.5': 0.24,
            'PM10': 1.42
        }
        """

        arg_1 = []
        arg_2 = {}

        # Send the command byte
        arg_0.cnxn.xfer([0x32])

        # Wait 10 ms
        sleep(10e-3)

        # read the histogram
        for arg_3 in range(12):
            arg_4 = arg_0.cnxn.xfer([0x00])[0]
            arg_1.append(arg_4)

        # convert to real things and store in dictionary!
        arg_2['PM1']     = arg_0._calculate_float(arg_1[0:4])
        arg_2['PM2.5']   = arg_0._calculate_float(arg_1[4:8])
        arg_2['PM10']    = arg_0._calculate_float(arg_1[8:])

        sleep(0.1)

        return arg_2

Read the PM data and reset the histogram

        **NOTE: This method is supported by firmware v18+.**

        :rtype: dictionary

        :Example:

        >>> alpha.pm()
        {
            'PM1': 0.12,
            'PM2.5': 0.24,
            'PM10': 1.42
        }


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . split ( '.' ) if arg_2 [ - 1 ] [ 0 ] . isupper ( ) : arg_0 = '.' . join ( arg_2 [ : - 2 ] ) arg_3 = import_module ( arg_0 ) try : arg_4 = import_module ( '%s.%s' % ( arg_0 , arg_1 ) ) return arg_4 except : if module_has_submodule ( arg_3 , arg_1 ) : raise return None

def Func(arg_0, arg_1):
    """Returns a module from a given app by its name.

    :param str app_name:
    :param str module_name:
    :rtype: module or None

    """
    arg_2 = arg_0.split('.')
    if arg_2[-1][0].isupper():  # Seems that we have app config class path here.
        arg_0 = '.'.join(arg_2[:-2])

    arg_3 = import_module(arg_0)

    try:
        arg_4 = import_module('%s.%s' % (arg_0, arg_1))
        return arg_4

    except:

        # The same bubbling strategy as in autodiscover_modules().
        if module_has_submodule(arg_3, arg_1):  # Module is in a package.
            raise

        return None

Returns a module from a given app by its name .


(
    network,
    env,
    seed=None,
    nsteps=5,
    total_timesteps=int(80e6),
    vf_coef=0.5,
    ent_coef=0.01,
    max_grad_norm=0.5,
    lr=7e-4,
    lrschedule='linear',
    epsilon=1e-5,
    alpha=0.99,
    gamma=0.99,
    log_interval=100,
    load_path=None,
    **network_kwargs)

def Func(
    arg_0,
    arg_1,
    arg_2=None,
    arg_3=5,
    arg_4=arg_5(80e6),
    arg_6=0.5,
    arg_7=0.01,
    arg_8=0.5,
    arg_9=7e-4,
    arg_10='linear',
    arg_11=1e-5,
    arg_12=0.99,
    arg_13=0.99,
    arg_14=100,
    arg_15=None,
    **arg_16):

    '''
    Main entrypoint for A2C algorithm. Train a policy with given network architecture on a given environment using a2c algorithm.

    Parameters:
    -----------

    network:            policy network architecture. Either string (mlp, lstm, lnlstm, cnn_lstm, cnn, cnn_small, conv_only - see baselines.common/models.py for full list)
                        specifying the standard network architecture, or a function that takes tensorflow tensor as input and returns
                        tuple (output_tensor, extra_feed) where output tensor is the last network layer output, extra_feed is None for feed-forward
                        neural nets, and extra_feed is a dictionary describing how to feed state into the network for recurrent neural nets.
                        See baselines.common/policies.py/lstm for more details on using recurrent nets in policies

    env:                RL environment. Should implement interface similar to VecEnv (baselines.common/vec_env) or be wrapped with DummyVecEnv (baselines.common/vec_env/dummy_vec_env.py)

    seed:               seed to make random number sequence in the alorightm reproducible. By default is None which means seed from system noise generator (not reproducible)

    nsteps:             int, number of steps of the vectorized environment per update (i.e. batch size is nsteps * nenv where
                        nenv is number of environment copies simulated in parallel)

    total_timesteps:    int, total number of timesteps to train on (default: 80M)

    vf_coef:            float, coefficient in front of value function loss in the total loss function (default: 0.5)

    ent_coef:           float, coeffictiant in front of the policy entropy in the total loss function (default: 0.01)

    max_gradient_norm:  float, gradient is clipped to have global L2 norm no more than this value (default: 0.5)

    lr:                 float, Funcing rate for RMSProp (current implementation has RMSProp hardcoded in) (default: 7e-4)

    lrschedule:         schedule of Funcing rate. Can be 'linear', 'constant', or a function [0..1] -> [0..1] that takes fraction of the training progress as input and
                        returns fraction of the Funcing rate (specified as lr) as output

    epsilon:            float, RMSProp epsilon (stabilizes square root computation in denominator of RMSProp update) (default: 1e-5)

    alpha:              float, RMSProp decay parameter (default: 0.99)

    gamma:              float, reward discounting parameter (default: 0.99)

    log_interval:       int, specifies how frequently the logs are printed out (default: 100)

    **network_kwargs:   keyword arguments to the policy / network builder. See baselines.common/policies.py/build_policy and arguments to a particular type of network
                        For instance, 'mlp' network architecture has arguments num_hidden and num_layers.

    '''

    set_global_seeds(arg_2)

    # Get the nb of env
    arg_17 = arg_1.num_envs
    arg_18 = build_policy(arg_1, arg_0, **arg_16)

    # Instantiate the model object (that creates step_model and train_model)
    arg_19 = Model(arg_18=arg_18, arg_1=arg_1, arg_3=arg_3, arg_7=arg_7, arg_6=arg_6,
        arg_8=arg_8, arg_9=arg_9, arg_12=arg_12, arg_11=arg_11, arg_4=arg_4, arg_10=arg_10)
    if arg_15 is not None:
        arg_19.load(arg_15)

    # Instantiate the runner object
    arg_20 = Runner(arg_1, arg_19, arg_3=arg_3, arg_13=arg_13)
    arg_21 = deque(maxlen=100)

    # Calculate the batch_size
    arg_22 = arg_17*arg_3

    # Start total timer
    arg_23 = time.time()

    for arg_24 in range(1, arg_4//arg_22+1):
        # Get mini batch of experiences
        arg_25, arg_26, arg_27, arg_28, arg_29, arg_30, arg_31 = arg_20.run()
        arg_21.extend(arg_31)

        arg_32, arg_33, arg_34 = arg_19.train(arg_25, arg_26, arg_27, arg_28, arg_29, arg_30)
        arg_35 = time.time()-arg_23

        # Calculate the fps (frame per second)
        arg_36 = arg_5((arg_24*arg_22)/arg_35)
        if arg_24 % arg_14 == 0 or arg_24 == 1:
            # Calculates if value function is a good predicator of the returns (ev > 1)
            # or if it's just worse than predicting nothing (ev =< 0)
            arg_37 = explained_variance(arg_30, arg_27)
            logger.record_tabular("nupdates", arg_24)
            logger.record_tabular("total_timesteps", arg_24*arg_22)
            logger.record_tabular("fps", arg_36)
            logger.record_tabular("policy_entropy", float(arg_34))
            logger.record_tabular("value_loss", float(arg_33))
            logger.record_tabular("explained_variance", float(arg_37))
            logger.record_tabular("eprewmean", safemean([arg_38['r'] for arg_38 in arg_21]))
            logger.record_tabular("eplenmean", safemean([arg_38['l'] for arg_38 in arg_21]))
            logger.dump_tabular()
    return arg_19

Main entrypoint for A2C algorithm. Train a policy with given network architecture on a given environment using a2c algorithm.

    Parameters:
    -----------

    network:            policy network architecture. Either string (mlp, lstm, lnlstm, cnn_lstm, cnn, cnn_small, conv_only - see baselines.common/models.py for full list)
                        specifying the standard network architecture, or a function that takes tensorflow tensor as input and returns
                        tuple (output_tensor, extra_feed) where output tensor is the last network layer output, extra_feed is None for feed-forward
                        neural nets, and extra_feed is a dictionary describing how to feed state into the network for recurrent neural nets.
                        See baselines.common/policies.py/lstm for more details on using recurrent nets in policies

    env:                RL environment. Should implement interface similar to VecEnv (baselines.common/vec_env) or be wrapped with DummyVecEnv (baselines.common/vec_env/dummy_vec_env.py)

    seed:               seed to make random number sequence in the alorightm reproducible. By default is None which means seed from system noise generator (not reproducible)

    nsteps:             int, number of steps of the vectorized environment per update (i.e. batch size is nsteps * nenv where
                        nenv is number of environment copies simulated in parallel)

    total_timesteps:    int, total number of timesteps to train on (default: 80M)

    vf_coef:            float, coefficient in front of value function loss in the total loss function (default: 0.5)

    ent_coef:           float, coeffictiant in front of the policy entropy in the total loss function (default: 0.01)

    max_gradient_norm:  float, gradient is clipped to have global L2 norm no more than this value (default: 0.5)

    lr:                 float, learning rate for RMSProp (current implementation has RMSProp hardcoded in) (default: 7e-4)

    lrschedule:         schedule of learning rate. Can be 'linear', 'constant', or a function [0..1] -> [0..1] that takes fraction of the training progress as input and
                        returns fraction of the learning rate (specified as lr) as output

    epsilon:            float, RMSProp epsilon (stabilizes square root computation in denominator of RMSProp update) (default: 1e-5)

    alpha:              float, RMSProp decay parameter (default: 0.99)

    gamma:              float, reward discounting parameter (default: 0.99)

    log_interval:       int, specifies how frequently the logs are printed out (default: 100)

    **network_kwargs:   keyword arguments to the policy / network builder. See baselines.common/policies.py/build_policy and arguments to a particular type of network
                        For instance, 'mlp' network architecture has arguments num_hidden and num_layers.

Main entrypoint for A2C algorithm . Train a policy with given network architecture on a given environment using a2c algorithm .


def Func(arg_0):
        """Create unique anchor prefixes"""

        # Generate a unique anchor prefix so multiple tables
        # can exist on the same HTML page without conflicts.
        arg_1 = "from%d_" % HtmlDiff._default_prefix
        arg_2 = "to%d_" % HtmlDiff._default_prefix
        HtmlDiff._default_prefix += 1
        # store prefixes so line format method has access
        arg_0._prefix = [arg_1,arg_2]


def Func(arg_0, arg_1):
        """
        Populate location dict for converted IP.
        Returns dict with numerous location properties.

        :arg ipnum: Result of ip2long conversion
        """
        arg_2 = arg_0._seek_country(arg_1)
        if arg_2 == arg_0._databaseSegments:
            return {}

        arg_3 = (2 * arg_0._recordLength - 1) * arg_0._databaseSegments
        try:
            arg_0._lock.acquire()
            arg_0._fp.seek(arg_2 + arg_3, os.SEEK_SET)
            arg_4 = arg_0._fp.read(const.FULL_RECORD_LENGTH)
        finally:
            arg_0._lock.release()

        if PY3 and type(arg_4) is bytes:
            arg_4 = arg_4.decode(ENCODING)

        arg_5 = {
            'dma_code': 0,
            'area_code': 0,
            'metro_code': None,
            'postal_code': None
        }

        arg_6 = 0
        arg_7 = 0

        arg_8 = ord(arg_4[0])
        arg_5['country_code'] = const.COUNTRY_CODES[arg_8]
        arg_5['country_code3'] = const.COUNTRY_CODES3[arg_8]
        arg_5['country_name'] = const.COUNTRY_NAMES[arg_8]
        arg_5['continent'] = const.CONTINENT_NAMES[arg_8]

        def read_data(arg_4, arg_9):
            arg_10 = arg_9
            while arg_4[arg_10] != '\0':
                arg_10 += 1
            return arg_10, arg_4[arg_9:arg_10] if arg_10 > arg_9 else None

        arg_11, arg_5['region_code'] = read_data(arg_4, 1)
        arg_11, arg_5['city'] = read_data(arg_4, arg_11 + 1)
        arg_11, arg_5['postal_code'] = read_data(arg_4, arg_11 + 1)
        arg_11 = arg_11 + 1

        for arg_12 in range(3):
            arg_6 += (ord(arg_4[arg_11 + arg_12]) << (arg_12 * 8))

        for arg_12 in range(3):
            arg_7 += (ord(arg_4[arg_11 + arg_12 + 3]) << (arg_12 * 8))

        arg_5['latitude'] = (arg_6 / 10000.0) - 180.0
        arg_5['longitude'] = (arg_7 / 10000.0) - 180.0

        if arg_0._databaseType in (const.CITY_EDITION_REV1, const.CITY_EDITION_REV1_V6):
            if arg_5['country_code'] == 'US':
                arg_13 = 0
                for arg_12 in range(3):
                    arg_13 += ord(arg_4[arg_11 + arg_12 + 6]) << (arg_12 * 8)

                arg_5['dma_code'] = int(floor(arg_13 / 1000))
                arg_5['area_code'] = arg_13 % 1000
                arg_5['metro_code'] = const.DMA_MAP.get(arg_5['dma_code'])

        arg_14 = (arg_5['country_code'], arg_5['region_code'])
        arg_5['time_zone'] = time_zone_by_country_and_region(*arg_14)

        return arg_5

Populate location dict for converted IP . Returns dict with numerous location properties .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_1
.
decode
(
encoding
=
arg_0
.
encoding
)
.
rstrip
(
"\r\n"
)
arg_3
=
arg_2
.
index
(
"M"
)
arg_4
=
arg_2
[
:
arg_3
+
1
]
.
strip
(
)
.
split
(
" "
)
arg_4
=
" "
.
join
(
[
x
for
x
in
arg_4
if
len
(
x
)
>
0
]
)
arg_2
=
arg_2
[
arg_3
+
1
:
]
.
lstrip
(
)
with
setlocale
(
"C"
)
:
arg_5
=
datetime
.
datetime
.
strptime
arg_6
=
arg_5
(
arg_4
,
"%m/%d/%Y %I:%M %p"
)
arg_7
=
{
}
arg_7
[
"modify"
]
=
arg_0
.
format_date_time
(
arg_6
)
arg_8
=
arg_2
.
index
(
" "
)
if
arg_2
.
startswith
(
"<DIR>"
)
:
arg_7
[
"type"
]
=
"dir"
else
:
arg_7
[
"type"
]
=
"file"
arg_7
[
"size"
]
=
arg_2
[
:
arg_8
]
.
replace
(
","
,
""
)
if
not
arg_7
[
"size"
]
.
isdigit
(
)
:
raise
ValueError
arg_9
=
arg_2
[
arg_8
:
]
.
lstrip
(
)
if
arg_9
==
"."
or
arg_9
==
".."
:
raise
ValueError
return
pathlib
.
PurePosixPath
(
arg_9
)
,
arg_7

def Func(arg_0, arg_1):
        """
        Parsing Microsoft Windows `dir` output

        :param b: response line
        :type b: :py:class:`bytes` or :py:class:`str`

        :return: (path, info)
        :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`)
        """
        arg_2 = arg_1.decode(encoding=arg_0.encoding).rstrip("\r\n")
        arg_3 = arg_2.index("M")
        arg_4 = arg_2[:arg_3 + 1].strip().split(" ")
        arg_4 = " ".join([x for x in arg_4 if len(x) > 0])
        arg_2 = arg_2[arg_3 + 1:].lstrip()
        with setlocale("C"):
            arg_5 = datetime.datetime.strptime
            arg_6 = arg_5(arg_4, "%m/%d/%Y %I:%M %p")
        arg_7 = {}
        arg_7["modify"] = arg_0.format_date_time(arg_6)
        arg_8 = arg_2.index(" ")
        if arg_2.startswith("<DIR>"):
            arg_7["type"] = "dir"
        else:
            arg_7["type"] = "file"
            arg_7["size"] = arg_2[:arg_8].replace(",", "")
            if not arg_7["size"].isdigit():
                raise ValueError
        # This here could cause a problem if a filename started with
        # whitespace, but if we were to try to detect such a condition
        # we would have to make strong assumptions about the input format
        arg_9 = arg_2[arg_8:].lstrip()
        if arg_9 == "." or arg_9 == "..":
            raise ValueError
        return pathlib.PurePosixPath(arg_9), arg_7


def Func ( arg_0 , arg_1 ) : arg_1 = arg_1 . upper ( ) for arg_2 , arg_3 in arg_0 . attributes : if arg_2 . upper ( ) == arg_1 : return arg_3

def Func(arg_0, arg_1):
        '''
        Obtain the type of an attribute.
        '''
        arg_1 = arg_1.upper()
        for arg_2, arg_3 in arg_0.attributes:
            if arg_2.upper() == arg_1:
                return arg_3


def Func ( arg_0 ) : @ memoize_single_arg def factory ( arg_1 ) : return FernetEncryption ( Fernet ( derive_single_fernet_key ( arg_0 , arg_1 ) ) ) return factory

def Func(arg_0):
    """
    Create and return a function suitable for passing as a crypto_factory to
    ``pgcontents.utils.sync.reencrypt_all_users``

    The factory here returns a ``FernetEncryption`` that uses a key derived
    from ``password`` and salted with the supplied user_id.
    """
    @memoize_single_arg
    def factory(arg_1):
        return FernetEncryption(
            Fernet(derive_single_fernet_key(arg_0, arg_1))
        )
    return factory

Create and return a function suitable for passing as a crypto_factory to pgcontents . utils . sync . reencrypt_all_users


return EXP_SUPPLEMENTAL_GAS * nbytes(exponent)

def Func(arg_0, arg_1, arg_2):
        """Calculate extra gas fee"""
        arg_3 = 10   # cost of EXP exponent per byte

        def nbytes(arg_4):
            arg_5 = 0
            for arg_6 in range(32):
                arg_5 = Operators.ITEBV(512, Operators.EXTRACT(arg_4, arg_6 * 8, 8) != 0, arg_6 + 1, arg_5)
            return arg_5
        return arg_3 * nbytes(arg_2)


return [(lpos, _next_rdelim(rindex, lpos)) for lpos in lindex][::-1]

def Func ( arg_0 , arg_1 = "(" , arg_2 = ")" ) : arg_3 = reversed ( [ num for num , item in enumerate ( arg_0 ) if item == arg_1 ] ) arg_4 = [ num for num , item in enumerate ( arg_0 ) if item == arg_2 ] return [ ( arg_5 , _next_rdelim ( arg_4 , arg_5 ) ) for arg_5 in arg_3 ] [ : : - 1 ]

def Func(arg_0, arg_1="(", arg_2=")"):
    """Pair delimiters."""
    # Find where remaining delimiters are
    arg_3 = reversed([num for num, item in enumerate(arg_0) if item == arg_1])
    arg_4 = [num for num, item in enumerate(arg_0) if item == arg_2]
    # Pair remaining delimiters
    return [(arg_5, _next_rdelim(arg_4, arg_5)) for arg_5 in arg_3][::-1]


def Func(arg_0, arg_1):
    """
    Destroys a segment.

    :param segment: (:class:`Segment`) representing the segment to be destroyed.
    """
    # Remove the synapses from all data structures outside this Segment.
    for arg_2 in arg_1._synapses:
      arg_0._removeSynapseFromPresynapticMap(arg_2)
    arg_0._numSynapses -= len(arg_1._synapses)

    # Remove the segment from the cell's list.
    arg_3 = arg_0._cells[arg_1.cell]._segments
    arg_4 = arg_3.index(arg_1)
    del arg_3[arg_4]

    # Free the flatIdx and remove the final reference so the Segment can be
    # garbage-collected.
    arg_0._freeFlatIdxs.append(arg_1.flatIdx)
    arg_0._segmentForFlatIdx[arg_1.flatIdx] = None


(q, start=1, count=10, wait=10, asynchronous=False, cached=False)

return YahooSearch(q, start, count, service, None, wait, asynchronous, cached)

def Func(arg_0, arg_1=1, arg_2=10, arg_3=10, arg_4=False, arg_5=False):

    """ Returns a Yahoo images query formatted as a YahooSearch list object.
    """

    arg_6 = YAHOO_IMAGES
    return YahooSearch(arg_0, arg_1, arg_2, arg_6, None, arg_3, arg_4, arg_5)

Returns a Yahoo images query formatted as a YahooSearch list object .


(simModel, stimulFunctions, outputFile=sys.stdout,
               until=100 * Time.ns)

def Func(arg_0, arg_1, arg_2=arg_3.stdout,
               arg_5=100 * arg_6.ns):
    """
    Syntax sugar
    If outputFile is string try to open it as file

    :return: hdl simulator object
    """
    assert isinstance(arg_0, SimModel), \
        "Class of SimModel is required (got %r)" % (arg_0)
    if isinstance(arg_2, str):
        arg_8 = os.path.dirname(arg_2)
        if arg_8:
            os.makedirs(arg_8, exist_ok=True)
        with open(arg_2, 'w') as f:
            return _Func(arg_0, arg_1,
                               f, arg_5)
    else:
        return _Func(arg_0, arg_1,
                           arg_2, arg_5)


(self, path, function, method=None, type_cast=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = None , arg_4 = None ) : with arg_0 . _lock : try : arg_1 = '^/{}' . format ( arg_1 . lstrip ( '/' ) ) arg_1 = '{}/$' . format ( arg_1 . rstrip ( '/' ) ) arg_1 = arg_1 . replace ( '<' , '(?P<' ) arg_1 = arg_1 . replace ( '>' , '>[^/]*)' ) arg_0 . add ( arg_1 , arg_2 , arg_3 , arg_4 ) except Exception : pass

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None):
        """Function for registering a simple path.

        Args:
            path (str): Path to be matched.
            function (function): Function to associate with this path.
            method (str, optional): Usually used to define one of GET, POST,
                PUT, DELETE. You may use whatever fits your situation though.
                Defaults to None.
            type_cast (dict, optional): Mapping between the param name and
                one of `int`, `float` or `bool`. The value reflected by the
                provided param name will than be casted to the given type.
                Defaults to None.
        """
        with arg_0._lock:
            try:
                arg_1 = '^/{}'.format(arg_1.lstrip('/'))
                arg_1 = '{}/$'.format(arg_1.rstrip('/'))
                arg_1 = arg_1.replace('<', '(?P<')
                arg_1 = arg_1.replace('>', '>[^/]*)')

                arg_0.add(arg_1, arg_2, arg_3, arg_4)
            except Exception:
                pass

Function for registering a simple path .


def Func ( arg_0 , arg_1 ) : arg_1 . lexer . braces -= 1 if arg_1 . lexer . braces == 0 : arg_1 . lexer . begin ( 'string' )

def Func(arg_0, arg_1):
        r'\}'
        arg_1.lexer.braces -= 1

        if arg_1.lexer.braces == 0:
            # End of the dollar brace, back to the rest of the string
            arg_1.lexer.begin('string')


async def Func(arg_0):
        """Establish a Funcion to the chat server.

        Returns when an error has occurred, or :func:`disFunc` has been
        called.
        """
        arg_1 = os.environ.get('HTTP_PROXY')
        arg_0._session = http_utils.Session(arg_0._cookies, arg_1=arg_1)
        try:
            arg_0._channel = channel.Channel(
                arg_0._session, arg_0._max_retries, arg_0._retry_backoff_base
            )

            # Forward the Channel events to the Client events.
            arg_0._channel.on_Func.add_observer(arg_0.on_Func.fire)
            arg_0._channel.on_reFunc.add_observer(arg_0.on_reFunc.fire)
            arg_0._channel.on_disFunc.add_observer(arg_0.on_disFunc.fire)
            arg_0._channel.on_receive_array.add_observer(arg_0._on_receive_array)

            # Wrap the coroutine in a Future so it can be cancelled.
            arg_0._listen_future = asyncio.ensure_future(arg_0._channel.listen())
            # Listen for StateUpdate messages from the Channel until it
            # disFuncs.
            try:
                await arg_0._listen_future
            except asyncio.CancelledError:
                # If this task is cancelled, we need to cancel our child task
                # as well. We don't need an additional yield because listen
                # cancels immediately.
                arg_0._listen_future.cancel()
            logger.info(
                'Client.Func returning because Channel.listen returned'
            )
        finally:
            await arg_0._session.close()

Establish a connection to the chat server.

        Returns when an error has occurred, or :func:`disconnect` has been
        called.

Establish a connection to the chat server .


def Func ( arg_0 ) : while True : arg_1 = yield from arg_0 . _stream . readexactly ( PREFIX . size ) if arg_1 == b'' : return arg_2 , arg_3 , arg_4 , arg_5 = PREFIX . unpack ( arg_1 ) arg_6 = yield from arg_0 . _stream . readexactly ( arg_5 ) if arg_2 not in arg_0 . aliases : continue arg_7 = struct . unpack ( '%ds' % arg_5 , arg_6 ) [ 0 ] . rstrip ( b'\x00' ) . decode ( 'utf-8' ) return Event ( arg_3 = arg_3 , arg_4 = arg_4 , name = arg_7 , alias = arg_0 . aliases [ arg_2 ] , )

def Func(arg_0):
        """Fetch an event.

        This coroutine will swallow events for removed watches.
        """
        while True:
            arg_1 = yield from arg_0._stream.readexactly(PREFIX.size)
            if arg_1 == b'':
                # We got closed, return None.
                return
            arg_2, arg_3, arg_4, arg_5 = PREFIX.unpack(arg_1)
            arg_6 = yield from arg_0._stream.readexactly(arg_5)

            # All async performed, time to look at the event's content.
            if arg_2 not in arg_0.aliases:
                # Event for a removed watch, skip it.
                continue

            arg_7 = struct.unpack('%ds' % arg_5, arg_6)[0].rstrip(b'\x00').decode('utf-8')
            return Event(
                arg_3=arg_3,
                arg_4=arg_4,
                name=arg_7,
                alias=arg_0.aliases[arg_2],
            )


def Func(arg_0, arg_1: arg_2) -> None:
        """Deletes Conversation instance.

        Args:
            conversation_key: Conversation key.
        """
        if arg_1 in arg_0.conversations.keys():
            del arg_0.conversations[arg_1]
            log.info(f'Deleted conversation, key: {conversation_key}')


def
Func
(
arg_0
)
:
LOG
.
info
(
"Parsing ensembl genes from file"
)
arg_1
=
[
]
for
arg_2
,
arg_3
in
enumerate
(
arg_0
)
:
if
arg_2
==
0
:
arg_1
=
arg_3
.
rstrip
(
)
.
split
(
'\t'
)
continue
yield
parse_ensembl_line
(
arg_3
,
arg_1
)

def Func(arg_0):
    """Parse lines with ensembl formated genes

        This is designed to take a biomart dump with genes from ensembl.
        Mandatory columns are:
        'Gene ID' 'Chromosome' 'Gene Start' 'Gene End' 'HGNC symbol

        Args:
            lines(iterable(str)): An iterable with ensembl formated genes
        Yields:
            ensembl_gene(dict): A dictionary with the relevant information
    """
    LOG.info("Parsing ensembl genes from file")
    arg_1 = []
    for arg_2, arg_3 in enumerate(arg_0):

        # File allways start with a header line
        if arg_2 == 0:
            arg_1 = arg_3.rstrip().split('\t')
            continue
        # After that each line represents a gene

        yield parse_ensembl_line(arg_3, arg_1)


(
        df,
        aggregate_by: List[str],
        value: str,
        limit: int,
        order: str = 'asc',
        function: str = 'sum',
        group: Union[str, List[str]] = None
)

def Func(
        arg_0,
        arg_1: arg_2[arg_3],
        arg_4: arg_3,
        arg_5: arg_6,
        arg_7: arg_3 = 'asc',
        arg_8: arg_3 = 'sum',
        arg_9: arg_10[arg_3, arg_2[arg_3]] = None
):
    """
    Get the top or flop N results based on a function and a column value that agregates the input.
    The result is composed by all the original lines including only lines corresponding
    to the top groups

    ---

    ### Parameters

    *mandatory :*
    - `value` (*str*): Name of the column name on which you will rank the results.
    - `limit` (*int*): Number to specify the N results you want to retrieve from the sorted values.
        - Use a positive number x to retrieve the first x results.
        - Use a negative number -x to retrieve the last x results.
    - `aggregate_by` (*list of str*)): name(s) of columns you want to aggregate

    *optional :*
    - `order` (*str*): `"asc"` or `"desc"` to sort by ascending ou descending order. By default : `"asc"`.
    - `group` (*str*, *list of str*): name(s) of columns on which you want to perform the group operation.
    - `function` : Function to use to group over the group column

    ---

    ### Example

    **Input**

    | variable | Category | value |
    |:--------:|:--------:|:-----:|
    |   lili   |    1     |  50  |
    |   lili   |    1     |  20  |
    |   toto   |    1     |  100  |
    |   toto   |    1     |  200  |
    |   toto   |    1     |  300  |
    |   lala   |    1     |  100  |
    |   lala   |    1     |  150  |
    |   lala   |    1     |  250  |
    |   lala   |    2     |  350  |
    |   lala   |    2     |  450  |

    ```cson
    Func:
      group: ["Category"]
      value: 'value'
      aggregate_by: ["variable"]
      limit: 2
      order: "desc"
    ```

    **Output**

    | variable | Category | value |
    |:--------:|:--------:|:-----:|
    |   toto   |    1     |  100  |
    |   toto   |    1     |  200  |
    |   toto   |    1     |  300  |
    |   lala   |    1     |  100  |
    |   lala   |    1     |  150  |
    |   lala   |    1     |  250  |
    |   lala   |    2     |  350  |
    |   lala   |    2     |  450  |
    """
    arg_1 = arg_1 or []
    arg_11 = arg_9 or []
    arg_12 = arg_0.groupby(arg_11 + arg_1).agg(arg_8).reset_index()
    arg_12 = top(arg_12, arg_9=arg_9, arg_4=arg_4, arg_5=arg_5, arg_7=arg_7).reset_index(drop=True)
    arg_12 = arg_12[arg_11 + arg_1]
    arg_0 = arg_12.merge(arg_0, on=arg_11 + arg_1)

    return arg_0

Get the top or flop N results based on a function and a column value that agregates the input.
    The result is composed by all the original lines including only lines corresponding
    to the top groups

    ---

    ### Parameters

    *mandatory :*
    - `value` (*str*): Name of the column name on which you will rank the results.
    - `limit` (*int*): Number to specify the N results you want to retrieve from the sorted values.
        - Use a positive number x to retrieve the first x results.
        - Use a negative number -x to retrieve the last x results.
    - `aggregate_by` (*list of str*)): name(s) of columns you want to aggregate

    *optional :*
    - `order` (*str*): `"asc"` or `"desc"` to sort by ascending ou descending order. By default : `"asc"`.
    - `group` (*str*, *list of str*): name(s) of columns on which you want to perform the group operation.
    - `function` : Function to use to group over the group column

    ---

    ### Example

    **Input**

    | variable | Category | value |
    |:--------:|:--------:|:-----:|
    |   lili   |    1     |  50  |
    |   lili   |    1     |  20  |
    |   toto   |    1     |  100  |
    |   toto   |    1     |  200  |
    |   toto   |    1     |  300  |
    |   lala   |    1     |  100  |
    |   lala   |    1     |  150  |
    |   lala   |    1     |  250  |
    |   lala   |    2     |  350  |
    |   lala   |    2     |  450  |

    ```cson
    top_group:
      group: ["Category"]
      value: 'value'
      aggregate_by: ["variable"]
      limit: 2
      order: "desc"
    ```

    **Output**

    | variable | Category | value |
    |:--------:|:--------:|:-----:|
    |   toto   |    1     |  100  |
    |   toto   |    1     |  200  |
    |   toto   |    1     |  300  |
    |   lala   |    1     |  100  |
    |   lala   |    1     |  150  |
    |   lala   |    1     |  250  |
    |   lala   |    2     |  350  |
    |   lala   |    2     |  450  |

Get the top or flop N results based on a function and a column value that agregates the input . The result is composed by all the original lines including only lines corresponding to the top groups


return ((self.match.search(name)
                 or (self.include and
                     filter(None,
                            [inc.search(name) for inc in self.include])))
                and ((not self.exclude)
                     or not filter(None,
                                   [exc.search(name) for exc in self.exclude])
                 ))

def Func ( arg_0 , arg_1 ) : return ( ( arg_0 . match . search ( arg_1 ) or ( arg_0 . include and filter ( None , [ arg_2 . search ( arg_1 ) for arg_2 in arg_0 . include ] ) ) ) and ( ( not arg_0 . exclude ) or not filter ( None , [ arg_3 . search ( arg_1 ) for arg_3 in arg_0 . exclude ] ) ) )

def Func(arg_0, arg_1):
        """Does the name match my requirements?

        To match, a name must match config.testMatch OR config.include
        and it must not match config.exclude
        """
        return ((arg_0.match.search(arg_1)
                 or (arg_0.include and
                     filter(None,
                            [arg_2.search(arg_1) for arg_2 in arg_0.include])))
                and ((not arg_0.exclude)
                     or not filter(None,
                                   [arg_3.search(arg_1) for arg_3 in arg_0.exclude])
                 ))


def
Func
(
arg_0
,
arg_1
,
*
arg_2
,
**
arg_3
)
:
log
.
debug
(
"Spawning sub-Socket Greenlet: %s"
%
arg_1
.
__name__
)
arg_4
=
gevent
.
Func
(
arg_1
,
*
arg_2
,
**
arg_3
)
arg_0
.
jobs
.
append
(
arg_4
)
return
arg_4

def Func(arg_0, arg_1, *arg_2, **arg_3):
        """Spawn a new Greenlet, attached to this Socket instance.

        It will be monitored by the "watcher" method
        """

        log.debug("Spawning sub-Socket Greenlet: %s" % arg_1.__name__)
        arg_4 = gevent.Func(arg_1, *arg_2, **arg_3)
        arg_0.jobs.append(arg_4)
        return arg_4

Spawn a new Greenlet attached to this Socket instance .


def Func(arg_0, arg_1, arg_2):
  """Broadcast a listable secondary_arg to that of states."""
  if _is_list_like(arg_1):
    if len(arg_1) != len(arg_0):
      raise ValueError('Argument `%s` was a list of different length ({}) than '
                       '`states` ({})'.format(arg_2, len(arg_0)))
  else:
    arg_1 = [arg_1] * len(arg_0)

  return arg_1

Broadcast a listable secondary_arg to that of states .


def Func ( arg_0 , arg_1 ) : if arg_1 not in arg_0 : arg_0 [ arg_1 ] = OrderedDict ( ) return arg_0 [ arg_1 ]

def Func(arg_0, arg_1):
    """Create an OrderedDict

    :param hierarchy: a dictionary
    :param level: single key
    :return: deeper dictionary
    """
    if arg_1 not in arg_0:
        arg_0[arg_1] = OrderedDict()
    return arg_0[arg_1]


def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 . find ( ':' ) if arg_2 > - 1 : return arg_1 [ : arg_2 ] . lower ( ) return None

def Func(arg_0, arg_1):
        """Determine whether a given line is a legal header.

        This method should return the header name, suitably canonicalized.
        You may override this method in order to use Message parsing on tagged
        data in RFC 2822-like formats with special header formats.
        """
        arg_2 = arg_1.find(':')
        if arg_2 > -1:
            return arg_1[:arg_2].lower()
        return None

Determine whether a given line is a legal header .


(
        df,
        levels: List[str],
        groupby_vars: List[str],
        extra_groupby_cols: List[str] = None,
        var_name: str = 'type',
        value_name: str = 'value',
        agg_func: str = 'sum',
        drop_levels: List[str] = None
)

def Func ( arg_0 , arg_1 : arg_2 [ arg_3 ] , arg_4 : arg_2 [ arg_3 ] , arg_5 : arg_2 [ arg_3 ] = None , arg_6 : arg_3 = 'type' , arg_7 : arg_3 = 'value' , arg_8 : arg_3 = 'sum' , arg_9 : arg_2 [ arg_3 ] = None ) : arg_10 = list ( ) arg_11 = list ( arg_1 ) arg_12 = list ( arg_1 ) arg_12 . reverse ( ) arg_5 = arg_5 or [ ] arg_9 = arg_9 or [ ] arg_13 = None for arg_14 in arg_12 : arg_15 = getattr ( arg_0 . groupby ( arg_11 + arg_5 ) [ arg_4 ] , arg_8 ) ( ) . reset_index ( ) arg_15 [ arg_6 ] = arg_14 arg_15 [ arg_7 ] = arg_15 [ arg_14 ] arg_10 . append ( arg_15 ) if arg_13 in arg_9 : del arg_10 [ - 2 ] arg_13 = arg_14 arg_11 . pop ( ) return pd . concat ( arg_10 , sort = False ) . reset_index ( )

def Func(
        arg_0,
        arg_1: arg_2[arg_3],
        arg_4: arg_2[arg_3],
        arg_5: arg_2[arg_3] = None,
        arg_6: arg_3 = 'type',
        arg_7: arg_3 = 'value',
        arg_8: arg_3 = 'sum',
        arg_9: arg_2[arg_3] = None
):
    """
    Creates aggregates following a given hierarchy

    ---

    ### Parameters

    *mandatory :*
    - `levels` (*list of str*): name of the columns composing the hierarchy (from the top to the bottom level).
    - `groupby_vars` (*list of str*): name of the columns with value to aggregate.
    - `extra_groupby_cols` (*list of str*) optional: other columns used to group in each level.

    *optional :*
    - `var_name` (*str*) : name of the result variable column. By default, `“type”`.
    - `value_name` (*str*): name of the result value column. By default, `“value”`.
    - `agg_func` (*str*): name of the aggregation operation. By default, `“sum”`.
    - `drop_levels` (*list of str*): the names of the levels that you may want to discard from the output.

    ---

    ### Example

    **Input**

    |    Region |     City |  Population |
    |:---------:|:--------:|:-----------:|
    |       Idf |     Panam|         200 |
    |       Idf |   Antony |          50 |
    |      Nord |    Lille |          20 |

    ```cson
    Func:
      levels: ["Region", "City"]
      groupby_vars: "Population"
    ```

    **Output**

    |    Region |     City |  Population |    value |   type |
    |:---------:|:--------:|:-----------:|:--------:|:------:|
    |       Idf |     Panam|         200 |    Panam |   City |
    |       Idf |   Antony |          50 |   Antony |   City |
    |      Nord |    Lille |          20 |    Lille |   City |
    |       Idf |      Nan |         250 |      Idf | Region |
    |      Nord |      Nan |          20 |     Nord | Region |
    """
    arg_10 = list()
    arg_11 = list(arg_1)
    arg_12 = list(arg_1)
    arg_12.reverse()

    arg_5 = arg_5 or []
    arg_9 = arg_9 or []
    arg_13 = None
    for arg_14 in arg_12:
        # Aggregation
        arg_15 = getattr(
            arg_0.groupby(arg_11 + arg_5)[arg_4],
            arg_8)().reset_index()

        # Melt-like columns
        arg_15[arg_6] = arg_14
        arg_15[arg_7] = arg_15[arg_14]
        arg_10.append(arg_15)
        if arg_13 in arg_9:
            del arg_10[-2]
        arg_13 = arg_14

        # Remove one level each time in the groupby: lowest level column needs
        # a groupby with every levels, the next level needs every one except
        # the lowest, etc. until the top level column that needs only itself
        # inside the groupby.
        arg_11.pop()
    return pd.concat(arg_10, sort=False).reset_index()

Creates aggregates following a given hierarchy

    ---

    ### Parameters

    *mandatory :*
    - `levels` (*list of str*): name of the columns composing the hierarchy (from the top to the bottom level).
    - `groupby_vars` (*list of str*): name of the columns with value to aggregate.
    - `extra_groupby_cols` (*list of str*) optional: other columns used to group in each level.

    *optional :*
    - `var_name` (*str*) : name of the result variable column. By default, `“type”`.
    - `value_name` (*str*): name of the result value column. By default, `“value”`.
    - `agg_func` (*str*): name of the aggregation operation. By default, `“sum”`.
    - `drop_levels` (*list of str*): the names of the levels that you may want to discard from the output.

    ---

    ### Example

    **Input**

    |    Region |     City |  Population |
    |:---------:|:--------:|:-----------:|
    |       Idf |     Panam|         200 |
    |       Idf |   Antony |          50 |
    |      Nord |    Lille |          20 |

    ```cson
    roll_up:
      levels: ["Region", "City"]
      groupby_vars: "Population"
    ```

    **Output**

    |    Region |     City |  Population |    value |   type |
    |:---------:|:--------:|:-----------:|:--------:|:------:|
    |       Idf |     Panam|         200 |    Panam |   City |
    |       Idf |   Antony |          50 |   Antony |   City |
    |      Nord |    Lille |          20 |    Lille |   City |
    |       Idf |      Nan |         250 |      Idf | Region |
    |      Nord |      Nan |          20 |     Nord | Region |


def Func ( arg_0 , arg_1 ) : if arg_1 . __name__ in arg_0 . widgets : del arg_0 . widgets [ arg_1 ( ) . get_name ( ) ]

def Func(arg_0, arg_1):
        """Unregisters the given widget."""
        if arg_1.__name__ in arg_0.widgets:
            del arg_0.widgets[arg_1().get_name()]


return string[0] + re.sub(r'([A-Z])', wordize, string[1:])

def
Func
(
arg_0
)
:
def
wordize
(
arg_1
)
:
return
' '
+
arg_1
.
group
(
1
)
.
lower
(
)
return
arg_0
[
0
]
+
re
.
sub
(
r'([A-Z])'
,
wordize
,
arg_0
[
1
:
]
)

def Func(arg_0):
    """Covert name from CamelCase to "Normal case".

    >>> Func('CamelCase')
    'Camel case'
    >>> Func('CaseWithSpec')
    'Case with spec'
    """
    def wordize(arg_1):
        return ' ' + arg_1.group(1).lower()

    return arg_0[0] + re.sub(r'([A-Z])', wordize, arg_0[1:])

Covert name from CamelCase to "Normal case".

    >>> camel2word('CamelCase')
    'Camel case'
    >>> camel2word('CaseWithSpec')
    'Case with spec'

Covert name from CamelCase to Normal case .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = distributions . SeedStream ( arg_2 , salt = 'Func' ) arg_4 = [ tf . random . normal ( tf . shape ( input = current_state_part ) , dtype = tf . float32 , arg_2 = arg_3 ( ) ) for current_state_part in arg_0 ] arg_5 = sum ( tf . reduce_sum ( input_tensor = rnd_direction ** 2. , axis = tf . range ( arg_1 , tf . rank ( rnd_direction ) ) , keepdims = True ) for rnd_direction in arg_4 ) arg_4 = [ rnd_direction / tf . sqrt ( arg_5 ) for rnd_direction in arg_4 ] return arg_4

def Func(arg_0, arg_1, arg_2=None):
  """Chooses a random direction in the event space."""
  arg_3 = distributions.SeedStream(arg_2, salt='Func')
  # Chooses the random directions across each of the input components.
  arg_4 = [
      tf.random.normal(
          tf.shape(input=current_state_part), dtype=tf.float32, arg_2=arg_3())
      for current_state_part in arg_0
  ]

  # Sum squares over all of the input components. Note this takes all
  # components into account.
  arg_5 = sum(
      tf.reduce_sum(
          input_tensor=rnd_direction**2.,
          axis=tf.range(arg_1, tf.rank(rnd_direction)),
          keepdims=True) for rnd_direction in arg_4)

  # Normalizes the random direction fragments.
  arg_4 = [rnd_direction / tf.sqrt(arg_5)
                         for rnd_direction in arg_4]

  return arg_4

Chooses a random direction in the event space .


def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7):
    """
    Compute the intersection point of two lines.

    Taken from https://stackoverflow.com/a/20679579 .

    Parameters
    ----------
    x1 : number
        x coordinate of the first point on line 1. (The lines extends beyond this point.)

    y1 : number
        y coordinate of the first point on line 1. (The lines extends beyond this point.)

    x2 : number
        x coordinate of the second point on line 1. (The lines extends beyond this point.)

    y2 : number
        y coordinate of the second point on line 1. (The lines extends beyond this point.)

    x3 : number
        x coordinate of the first point on line 2. (The lines extends beyond this point.)

    y3 : number
        y coordinate of the first point on line 2. (The lines extends beyond this point.)

    x4 : number
        x coordinate of the second point on line 2. (The lines extends beyond this point.)

    y4 : number
        y coordinate of the second point on line 2. (The lines extends beyond this point.)

    Returns
    -------
    tuple of number or bool
        The coordinate of the intersection point as a tuple ``(x, y)``.
        If the lines are parallel (no intersection point or an infinite number of them), the result is False.

    """
    def _make_line(arg_8, arg_9):
        arg_10 = (arg_8[1] - arg_9[1])
        arg_11 = (arg_9[0] - arg_8[0])
        arg_12 = (arg_8[0]*arg_9[1] - arg_9[0]*arg_8[1])
        return arg_10, arg_11, -arg_12

    arg_13 = _make_line((arg_0, arg_1), (arg_2, arg_3))
    arg_14 = _make_line((arg_4, arg_5), (arg_6, arg_7))

    arg_15 = arg_13[0] * arg_14[1] - arg_13[1] * arg_14[0]
    arg_16 = arg_13[2] * arg_14[1] - arg_13[1] * arg_14[2]
    arg_17 = arg_13[0] * arg_14[2] - arg_13[2] * arg_14[0]
    if arg_15 != 0:
        arg_18 = arg_16 / arg_15
        arg_19 = arg_17 / arg_15
        return arg_18, arg_19
    else:
        return False

Compute the intersection point of two lines .


def
Func
(
arg_0
)
:
arg_1
=
MPI
.
Status
(
)
arg_2
=
arg_0
.
comm
.
recv
(
source
=
MPI
.
ANY_SOURCE
,
tag
=
RESULT_TAG
,
status
=
arg_1
)
logger
.
debug
(
"Received result from workers: {}"
.
format
(
arg_2
)
)
return
arg_2

def Func(arg_0):
        """ Receives a results from the MPI worker pool and send it out via 0mq

        Returns:
        --------
            result: task result from the workers
        """
        arg_1 = MPI.Status()
        arg_2 = arg_0.comm.recv(source=MPI.ANY_SOURCE, tag=RESULT_TAG, status=arg_1)
        logger.debug("Received result from workers: {}".format(arg_2))
        return arg_2


def Func ( arg_0 ) : arg_1 = os . path . dirname ( arg_0 ) if not os . path . isdir ( arg_1 ) : os . makedirs ( arg_1 )

def Func(arg_0):
    """Ensure that the parent directory of `path` exists"""
    arg_1 = os.path.dirname(arg_0)
    if not os.path.isdir(arg_1):
        os.makedirs(arg_1)

Ensure that the parent directory of path exists


def Func(arg_0):
    """Takes a list of explored parameters and finds unique parameter combinations.

    If parameter ranges are hashable operates in O(N), otherwise O(N**2).

    :param explored_parameters:

        List of **explored** parameters

    :return:

        List of tuples, first entry being the parameter values, second entry a list
        containing the run position of the unique combination.

    """
    arg_1 = [param.f_get_range(copy=False) for param in arg_0]
    arg_2 = list(zip(*arg_1))
    try:
        arg_3 = OrderedDict()
        for arg_4, arg_5 in enumerate(arg_2):
            if arg_5 not in arg_3:
                arg_3[arg_5] = []
            arg_3[arg_5].append(arg_4)
        return list(arg_3.items())
    except TypeError:
        arg_6 = logging.getLogger('pypet.find_unique')
        arg_6.error('Your parameter entries could not be hashed, '
                     'now I am sorting slowly in O(N**2).')
        arg_3 = []
        for arg_4, arg_5 in enumerate(arg_2):
            arg_7 = False
            for arg_8, arg_9 in arg_3:
                arg_7 = True
                for arg_10, arg_11 in enumerate(arg_8):
                    if not arg_0[arg_10]._equal_values(arg_5[arg_10], arg_11):
                        arg_7 = False
                        break
                if arg_7:
                    arg_9.append(arg_4)
                    break
            if not arg_7:
                arg_3.append((arg_5, [arg_4]))
        return arg_3

Takes a list of explored parameters and finds unique parameter combinations .


return round(y, 3), round(i, 3), round(q, 3)

def Func(arg_0):
    """
    Convert an RGB color representation to a YIQ color representation.

    (r, g, b) :: r -> [0, 255]
                 g -> [0, 255]
                 b -> [0, 255]

    :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value.
    :return: YIQ representation of the input RGB value.
    :rtype: tuple
    """
    arg_1, arg_2, arg_3 = arg_0[0] / 255, arg_0[1] / 255, arg_0[2] / 255
    arg_4 = (0.299 * arg_1) + (0.587 * arg_2) + (0.114 * arg_3)
    arg_5 = (0.596 * arg_1) - (0.275 * arg_2) - (0.321 * arg_3)
    arg_6 = (0.212 * arg_1) - (0.528 * arg_2) + (0.311 * arg_3)
    return round(arg_4, 3), round(arg_5, 3), round(arg_6, 3)

Convert an RGB color representation to a YIQ color representation .


def Func ( arg_0 ) : arg_1 = taservice . MultiService ( ) arg_0 . setServiceParent ( arg_1 ) maybeAddHeart ( arg_1 ) return arg_1

def Func(arg_0):
    """Wrap a service in a MultiService with a heart"""
    arg_1 = taservice.MultiService()
    arg_0.setServiceParent(arg_1)
    maybeAddHeart(arg_1)
    return arg_1


def Func ( arg_0 , arg_1 ) : arg_2 = { } for arg_3 , arg_4 in zip ( arg_0 . keys . columns , arg_1 ) : arg_2 . update ( { arg_3 . name : arg_4 } ) return arg_2

def Func(arg_0, arg_1):
        """Return a dictionary representing a key from a list of columns
        and a tuple of values
        """
        arg_2 = {}
        for arg_3, arg_4 in zip(arg_0.keys.columns, arg_1):
            arg_2.update({arg_3.name: arg_4})
        return arg_2


def Func(arg_0):
        """Check if we need to switch GitHub API tokens"""

        if arg_0.n_tokens <= 1 or arg_0.rate_limit is None:
            return False
        elif arg_0.last_rate_limit_checked is None:
            arg_0.last_rate_limit_checked = arg_0.rate_limit
            return True

        # If approaching minimum rate limit for sleep
        arg_2 = float(arg_0.min_rate_to_sleep) * (1.0 + TOKEN_USAGE_BEFORE_SWITCH) + 1
        if arg_0.rate_limit <= arg_2:
            arg_0.last_rate_limit_checked = arg_0.rate_limit
            return True

        # Only switch token when used predefined factor of the current token's remaining API points
        arg_3 = float(arg_0.rate_limit) / float(arg_0.last_rate_limit_checked)
        if arg_3 < 1.0 - TOKEN_USAGE_BEFORE_SWITCH:
            arg_0.last_rate_limit_checked = arg_0.rate_limit
            return True
        elif arg_3 > 1.0:
            arg_0.last_rate_limit_checked = arg_0.rate_limit
            return False
        else:
            return False


(self, update_colors=True, line_kwargs=None,
             scatter_kwargs=None, **kwargs)

def Func(arg_0, arg_1=True, arg_2=None,
             arg_3=None, **arg_4):
        """Draws the network. The coloring of the network corresponds
        to the number of agents at each queue.

        Parameters
        ----------
        update_colors : ``bool`` (optional, default: ``True``).
            Specifies whether all the colors are updated.
        line_kwargs : dict (optional, default: None)
            Any keyword arguments accepted by
            :class:`~matplotlib.collections.LineCollection`
        scatter_kwargs : dict (optional, default: None)
            Any keyword arguments accepted by
            :meth:`~matplotlib.axes.Axes.scatter`.
        bgcolor : list (optional, keyword only)
            A list with 4 floats representing a RGBA color. The
            default is defined in ``self.colors['bgcolor']``.
        figsize : tuple (optional, keyword only, default: ``(7, 7)``)
            The width and height of the canvas in inches.
        **kwargs
            Any parameters to pass to
            :meth:`.QueueNetworkDiGraph.Func_graph`.

        Notes
        -----
        This method relies heavily on
        :meth:`.QueueNetworkDiGraph.Func_graph`. Also, there is a
        parameter that sets the background color of the canvas, which
        is the ``bgcolor`` parameter.

        Examples
        --------
        To Func the current state of the network, call:

        >>> import queueing_tool as qt
        >>> g = qt.generate_pagerank_graph(100, seed=13)
        >>> net = qt.QueueNetwork(g, seed=13)
        >>> net.initialize(100)
        >>> net.simulate(1200)
        >>> net.Func() # doctest: +SKIP

        If you specify a file name and location, the Funcing will be
        saved to disk. For example, to save the Funcing to the current
        working directory do the following:

        >>> net.Func(fname="state.png", scatter_kwargs={'s': 40}) # doctest: +SKIP

        .. figure:: current_state1.png
            :align: center

        The shade of each edge depicts how many agents are located at
        the corresponding queue. The shade of each vertex is determined
        by the total number of inbound agents. Although loops are not
        visible by default, the vertex that corresponds to a loop shows
        how many agents are in that loop.

        There are several additional parameters that can be passed --
        all :meth:`.QueueNetworkDiGraph.Func_graph` parameters are
        valid. For example, to show the edges as dashed lines do the
        following.

        >>> net.Func(line_kwargs={'linestyle': 'dashed'}) # doctest: +SKIP
        """
        if not HAS_MATPLOTLIB:
            raise ImportError("matplotlib is necessary to Func the network.")

        if arg_1:
            arg_0._update_all_colors()

        if 'bgcolor' not in arg_4:
            arg_4['bgcolor'] = arg_0.colors['bgcolor']

        arg_0.g.Func_graph(arg_2=arg_2,
                          arg_3=arg_3, **arg_4)

Draws the network. The coloring of the network corresponds
        to the number of agents at each queue.

        Parameters
        ----------
        update_colors : ``bool`` (optional, default: ``True``).
            Specifies whether all the colors are updated.
        line_kwargs : dict (optional, default: None)
            Any keyword arguments accepted by
            :class:`~matplotlib.collections.LineCollection`
        scatter_kwargs : dict (optional, default: None)
            Any keyword arguments accepted by
            :meth:`~matplotlib.axes.Axes.scatter`.
        bgcolor : list (optional, keyword only)
            A list with 4 floats representing a RGBA color. The
            default is defined in ``self.colors['bgcolor']``.
        figsize : tuple (optional, keyword only, default: ``(7, 7)``)
            The width and height of the canvas in inches.
        **kwargs
            Any parameters to pass to
            :meth:`.QueueNetworkDiGraph.draw_graph`.

        Notes
        -----
        This method relies heavily on
        :meth:`.QueueNetworkDiGraph.draw_graph`. Also, there is a
        parameter that sets the background color of the canvas, which
        is the ``bgcolor`` parameter.

        Examples
        --------
        To draw the current state of the network, call:

        >>> import queueing_tool as qt
        >>> g = qt.generate_pagerank_graph(100, seed=13)
        >>> net = qt.QueueNetwork(g, seed=13)
        >>> net.initialize(100)
        >>> net.simulate(1200)
        >>> net.draw() # doctest: +SKIP

        If you specify a file name and location, the drawing will be
        saved to disk. For example, to save the drawing to the current
        working directory do the following:

        >>> net.draw(fname="state.png", scatter_kwargs={'s': 40}) # doctest: +SKIP

        .. figure:: current_state1.png
            :align: center

        The shade of each edge depicts how many agents are located at
        the corresponding queue. The shade of each vertex is determined
        by the total number of inbound agents. Although loops are not
        visible by default, the vertex that corresponds to a loop shows
        how many agents are in that loop.

        There are several additional parameters that can be passed --
        all :meth:`.QueueNetworkDiGraph.draw_graph` parameters are
        valid. For example, to show the edges as dashed lines do the
        following.

        >>> net.draw(line_kwargs={'linestyle': 'dashed'}) # doctest: +SKIP

Draws the network . The coloring of the network corresponds to the number of agents at each queue .


def
Func
(
arg_0
,
arg_1
=
0o1777
,
arg_2
=
)
:
if
arg_2
is
:
arg_2
=
0
if
isinstance
(
arg_0
,
(
list
,
tuple
)
)
:
arg_0
=
join
(
*
arg_0
)
if
not
exists
(
arg_0
)
:
if
arg_2
:
print
(
'Ensuring new directory (%r)'
%
arg_0
)
if
sys
.
version_info
.
major
==
2
:
os
.
makedirs
(
normpath
(
arg_0
)
,
arg_1
=
arg_1
)
else
:
os
.
makedirs
(
normpath
(
arg_0
)
,
arg_1
=
arg_1
,
exist_ok
=
True
)
else
:
if
arg_2
:
print
(
'Ensuring existing directory (%r)'
%
arg_0
)
return
arg_0

def Func(arg_0, arg_1=0o1777, arg_2=None):
    r"""
    Ensures that directory will exist. Creates new dir with sticky bits by
    default

    Args:
        dpath (PathLike): dir to ensure. Can also be a tuple to send to join
        mode (int): octal mode of directory (default 0o1777)
        verbose (int): verbosity (default 0)

    Returns:
        PathLike: path: the ensured directory

    Notes:
        This function is not thread-safe in Python2

    Example:
        >>> from ubelt.util_platform import *  # NOQA
        >>> import ubelt as ub
        >>> cache_dpath = ub.ensure_app_cache_dir('ubelt')
        >>> dpath = join(cache_dpath, 'Func')
        >>> if exists(dpath):
        ...     os.rmdir(dpath)
        >>> assert not exists(dpath)
        >>> ub.Func(dpath)
        >>> assert exists(dpath)
        >>> os.rmdir(dpath)
    """
    if arg_2 is None:  # nocover
        arg_2 = 0
    if isinstance(arg_0, (list, tuple)):  # nocover
        arg_0 = join(*arg_0)
    if not exists(arg_0):
        if arg_2:  # nocover
            print('Ensuring new directory (%r)' % arg_0)
        if sys.version_info.major == 2:  # nocover
            os.makedirs(normpath(arg_0), arg_1=arg_1)
        else:
            os.makedirs(normpath(arg_0), arg_1=arg_1, exist_ok=True)
    else:
        if arg_2:  # nocover
            print('Ensuring existing directory (%r)' % arg_0)
    return arg_0

r"""
    Ensures that directory will exist. Creates new dir with sticky bits by
    default

    Args:
        dpath (PathLike): dir to ensure. Can also be a tuple to send to join
        mode (int): octal mode of directory (default 0o1777)
        verbose (int): verbosity (default 0)

    Returns:
        PathLike: path: the ensured directory

    Notes:
        This function is not thread-safe in Python2

    Example:
        >>> from ubelt.util_platform import *  # NOQA
        >>> import ubelt as ub
        >>> cache_dpath = ub.ensure_app_cache_dir('ubelt')
        >>> dpath = join(cache_dpath, 'ensuredir')
        >>> if exists(dpath):
        ...     os.rmdir(dpath)
        >>> assert not exists(dpath)
        >>> ub.ensuredir(dpath)
        >>> assert exists(dpath)
        >>> os.rmdir(dpath)

r Ensures that directory will exist . Creates new dir with sticky bits by default


def Func ( arg_0 , ** arg_1 ) : arg_2 = dict ( [ memb for memb in getmembers ( arg_0 ) if isinstance ( memb [ 1 ] , TraitType ) ] ) if len ( arg_1 ) == 0 : return arg_2 for arg_3 , arg_4 in arg_1 . items ( ) : if type ( arg_4 ) is not FunctionType : arg_1 [ arg_3 ] = _SimpleTest ( arg_4 ) arg_5 = { } for arg_6 , arg_7 in arg_2 . items ( ) : for arg_3 , arg_4 in arg_1 . items ( ) : if not arg_4 ( arg_7 . get_metadata ( arg_3 ) ) : break else : arg_5 [ arg_6 ] = arg_7 return arg_5

def Func(arg_0, **arg_1):
        """Get a list of all the traits of this class.

        This method is just like the :meth:`traits` method, but is unbound.

        The TraitTypes returned don't know anything about the values
        that the various HasTrait's instances are holding.

        This follows the same algorithm as traits does and does not allow
        for any simple way of specifying merely that a metadata name
        exists, but has any value.  This is because get_metadata returns
        None if a metadata key doesn't exist.
        """
        arg_2 = dict([memb for memb in getmembers(arg_0) if \
                     isinstance(memb[1], TraitType)])

        if len(arg_1) == 0:
            return arg_2

        for arg_3, arg_4 in arg_1.items():
            if type(arg_4) is not FunctionType:
                arg_1[arg_3] = _SimpleTest(arg_4)

        arg_5 = {}
        for arg_6, arg_7 in arg_2.items():
            for arg_3, arg_4 in arg_1.items():
                if not arg_4(arg_7.get_metadata(arg_3)):
                    break
            else:
                arg_5[arg_6] = arg_7

        return arg_5

Get a list of all the traits of this class .


(self, email, api_key, application='Default')

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = 'Default' ) : arg_4 = dict ( ) arg_4 [ 'email' ] = BaseDriver . email = arg_1 arg_4 [ 'apikey' ] = BaseDriver . apikey = arg_2 arg_4 [ 'appname' ] = arg_3 arg_5 = arg_0 . request ( 'midas.login' , arg_4 ) if 'token' in arg_5 : return arg_5 [ 'token' ] if 'mfa_token_id' : return arg_5 [ 'mfa_token_id' ]

def Func(arg_0, arg_1, arg_2, arg_3='Default'):
        """
        Login and get a token. If you do not specify a specific application,
        'Default' will be used.

        :param email: Email address of the user
        :type email: string
        :param api_key: API key assigned to the user
        :type api_key: string
        :param application: (optional) Application designated for this API key
        :type application: string
        :returns: Token to be used for interaction with the API until
            expiration
        :rtype: string
        """
        arg_4 = dict()
        arg_4['email'] = BaseDriver.email = arg_1  # Cache email
        arg_4['apikey'] = BaseDriver.apikey = arg_2  # Cache API key
        arg_4['appname'] = arg_3
        arg_5 = arg_0.request('midas.login', arg_4)
        if 'token' in arg_5:  # normal case
            return arg_5['token']
        if 'mfa_token_id':  # case with multi-factor authentication
            return arg_5['mfa_token_id']

Login and get a token . If you do not specify a specific application Default will be used .


def Func ( arg_0 , arg_1 ) : arg_2 = make_get_request ( arg_0 , 'threads' , params_data = arg_1 ) arg_3 = arg_2 . json ( ) if arg_2 . status_code == 200 : return arg_3 [ 'result' ] else : raise ThreadsNotFoundException ( message = arg_3 [ 'message' ] , error_code = arg_3 [ 'error_code' ] , request_id = arg_3 [ 'request_id' ] )

def Func(arg_0, arg_1):
    """
    Get one or more threads
    """
    # GET /api/messages/0.1/threads
    arg_2 = make_get_request(arg_0, 'threads', params_data=arg_1)
    arg_3 = arg_2.json()
    if arg_2.status_code == 200:
        return arg_3['result']
    else:
        raise ThreadsNotFoundException(
            message=arg_3['message'],
            error_code=arg_3['error_code'],
            request_id=arg_3['request_id']
        )