(cls, settings = None, option_prefix = u'--',
                                                            add_help = False)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
u'--'
,
arg_3
=
False
)
:
arg_4
=
argparse
.
ArgumentParser
(
arg_3
=
arg_3
,
prefix_chars
=
arg_2
[
0
]
)
if
arg_1
is
:
arg_1
=
arg_0
.
list_all
(
basic
=
True
)
if
sys
.
version_info
.
major
<
3
:
from
locale
import
getpreferredencoding
arg_5
=
getpreferredencoding
(
)
def
decode_string_option
(
arg_6
)
:
return
arg_6
.
decode
(
arg_5
)
for
arg_7
in
arg_1
:
if
arg_7
not
in
arg_0
.
_defs
:
logger
.
debug
(
"Func: ignoring unknown option {0}"
.
format
(
arg_7
)
)
return
arg_8
=
arg_0
.
_defs
[
arg_7
]
if
not
arg_8
.
cmdline_help
:
logger
.
debug
(
"Func: option {0} has no cmdline"
.
format
(
arg_7
)
)
return
if
sys
.
version_info
.
major
<
3
:
arg_7
=
arg_7
.
encode
(
arg_5
,
"replace"
)
arg_9
=
arg_2
+
arg_7
.
replace
(
"_"
,
"-"
)
arg_10
=
"pyxmpp2_"
+
arg_7
if
arg_8
.
validator
:
arg_11
=
arg_8
.
validator
elif
arg_8
.
type
is
unicode
and
sys
.
version_info
.
major
<
3
:
arg_11
=
decode_string_option
else
:
arg_11
=
arg_8
.
type
if
arg_8
.
default_d
:
arg_12
=
arg_8
.
default_d
if
sys
.
version_info
.
major
<
3
:
arg_12
=
arg_12
.
encode
(
arg_5
,
"replace"
)
elif
arg_8
.
default
is
not
:
arg_12
=
repr
(
arg_8
.
default
)
else
:
arg_12
=
arg_13
=
arg_8
.
cmdline_help
if
sys
.
version_info
.
major
<
3
:
arg_13
=
arg_13
.
encode
(
arg_5
,
"replace"
)
if
arg_12
:
arg_13
+=
" (Default: {0})"
.
format
(
arg_12
)
if
arg_11
is
bool
:
arg_14
=
_YesNoAction
else
:
arg_14
=
"store"
arg_4
.
add_argument
(
arg_9
,
action
=
arg_14
,
default
=
arg_8
.
default
,
type
=
arg_11
,
help
=
arg_13
,
metavar
=
arg_7
.
upper
(
)
,
arg_10
=
arg_10
)
return
arg_4

def Func(arg_0, arg_1 = None, arg_2 = u'--',
                                                            arg_3 = False):
        """Make a command-line option parser.

        The returned parser may be used as a parent parser for application
        argument parser.

        :Parameters:
            - `settings`: list of PyXMPP2 settings to consider. By default
              all 'basic' settings are provided.
            - `option_prefix`: custom prefix for PyXMPP2 options. E.g.
              ``'--xmpp'`` to differentiate them from not xmpp-related
              application options.
            - `add_help`: when `True` a '--help' option will be included
              (probably already added in the application parser object)
        :Types:
            - `settings`: list of `unicode`
            - `option_prefix`: `str`
            - `add_help`:

        :return: an argument parser object.
        :returntype: :std:`argparse.ArgumentParser`
        """
        # pylint: disable-msg=R0914,R0912
        arg_4 = argparse.ArgumentParser(arg_3 = arg_3,
                                            prefix_chars = arg_2[0])
        if arg_1 is None:
            arg_1 = arg_0.list_all(basic = True)

        if sys.version_info.major < 3:
            # pylint: disable-msg=W0404
            from locale import getpreferredencoding
            arg_5 = getpreferredencoding()
            def decode_string_option(arg_6):
                """Decode a string option."""
                return arg_6.decode(arg_5)

        for arg_7 in arg_1:
            if arg_7 not in arg_0._defs:
                logger.debug("Func: ignoring unknown option {0}"
                                                                .format(arg_7))
                return
            arg_8 = arg_0._defs[arg_7]
            if not arg_8.cmdline_help:
                logger.debug("Func: option {0} has no cmdline"
                                                                .format(arg_7))
                return
            if sys.version_info.major < 3:
                arg_7 = arg_7.encode(arg_5, "replace")
            arg_9 = arg_2 + arg_7.replace("_", "-")
            arg_10 = "pyxmpp2_" + arg_7
            if arg_8.validator:
                arg_11 = arg_8.validator
            elif arg_8.type is unicode and sys.version_info.major < 3:
                arg_11 = decode_string_option
            else:
                arg_11 = arg_8.type
            if arg_8.default_d:
                arg_12 = arg_8.default_d
                if sys.version_info.major < 3:
                    arg_12 = arg_12.encode(arg_5, "replace")
            elif arg_8.default is not None:
                arg_12 = repr(arg_8.default)
            else:
                arg_12 = None
            arg_13 = arg_8.cmdline_help
            if sys.version_info.major < 3:
                arg_13 = arg_13.encode(arg_5, "replace")
            if arg_12:
                arg_13 += " (Default: {0})".format(arg_12)
            if arg_11 is bool:
                arg_14 = _YesNoAction
            else:
                arg_14 = "store"
            arg_4.add_argument(arg_9,
                                action = arg_14,
                                default = arg_8.default,
                                type = arg_11,
                                help = arg_13,
                                metavar = arg_7.upper(),
                                arg_10 = arg_10)
        return arg_4


return self._get('/instance/{pipeline_counter:d}/{counter:d}'
                         .format(pipeline_counter=pipeline_counter, counter=counter))

def Func(arg_0, arg_1=None, arg_2=None):
        """Returns all the information regarding a specific stage run

        See the `Go stage Func documentation`__ for examples.

        .. __: http://api.go.cd/current/#get-stage-Func

        Args:
          counter (int): The stage Func to fetch.
            If falsey returns the latest stage Func from :meth:`history`.
          pipeline_counter (int): The pipeline Func for which to fetch
            the stage. If falsey returns the latest pipeline Func.

        Returns:
          Response: :class:`gocd.api.response.Response` object
        """
        arg_2 = arg_2 or arg_0.pipeline_counter
        arg_3 = None

        if not arg_2:
            arg_3 = arg_0.server.pipeline(arg_0.pipeline_name).Func()
            arg_0.pipeline_counter = int(arg_3['counter'])

        if not arg_1:
            if arg_3 is None:
                arg_3 = (
                    arg_0.server
                        .pipeline(arg_0.pipeline_name)
                        .Func(arg_2)
                )

            for arg_4 in arg_3['stages']:
                if arg_4['name'] == arg_0.stage_name:
                    return arg_0.Func(
                        arg_1=int(arg_4['counter']),
                        arg_2=arg_2
                    )

        return arg_0._get('/Func/{pipeline_counter:d}/{counter:d}'
                         .format(arg_2=arg_2, arg_1=arg_1))

Returns all the information regarding a specific stage run

        See the `Go stage instance documentation`__ for examples.

        .. __: http://api.go.cd/current/#get-stage-instance

        Args:
          counter (int): The stage instance to fetch.
            If falsey returns the latest stage instance from :meth:`history`.
          pipeline_counter (int): The pipeline instance for which to fetch
            the stage. If falsey returns the latest pipeline instance.

        Returns:
          Response: :class:`gocd.api.response.Response` object


def
Func
(
arg_0
)
:
if
os
.
path
.
exists
(
arg_0
.
path
)
:
with
open
(
arg_0
.
path
,
'r'
)
as
f
:
arg_0
.
d
=
yaml
.
safe_Func
(
f
.
read
(
)
.
replace
(
'\t'
,
' '
*
4
)
)

def Func(arg_0):
        """
        Load a saved state file.
        """
        if os.path.exists(arg_0.path):
            with open(arg_0.path, 'r') as f:
                arg_0.d = yaml.safe_Func(f.read().replace('\t', ' '*4))


def Func ( arg_0 , arg_1 ) : if not arg_1 . is_statement : return if not arg_1 . root ( ) . pure_python : return arg_2 = arg_1 . previous_sibling ( ) if arg_2 is not None : arg_3 = arg_2 . fromlineno else : if ( isinstance ( arg_1 . parent , nodes . TryFinally ) and arg_1 in arg_1 . parent . finalbody ) : arg_3 = arg_1 . parent . body [ 0 ] . tolineno + 1 else : arg_3 = arg_1 . parent . statement ( ) . fromlineno arg_4 = arg_1 . fromlineno assert arg_4 , arg_1 if arg_3 == arg_4 and arg_0 . _visited_lines . get ( arg_4 ) != 2 : arg_0 . _check_multi_statement_line ( arg_1 , arg_4 ) return if arg_4 in arg_0 . _visited_lines : return try : arg_5 = arg_1 . blockstart_tolineno except AttributeError : arg_5 = arg_1 . tolineno assert arg_5 , arg_1 arg_6 = [ ] for arg_4 in range ( arg_4 , arg_5 + 1 ) : arg_0 . _visited_lines [ arg_4 ] = 1 try : arg_6 . append ( arg_0 . _lines [ arg_4 ] . rstrip ( ) ) except KeyError : arg_6 . append ( "" )

def Func(arg_0, arg_1):
        """check the node line number and check it if not yet done"""
        if not arg_1.is_statement:
            return
        if not arg_1.root().pure_python:
            return  # XXX block visit of child nodes
        arg_2 = arg_1.previous_sibling()
        if arg_2 is not None:
            arg_3 = arg_2.fromlineno
        else:
            # The line on which a finally: occurs in a try/finally
            # is not directly represented in the AST. We infer it
            # by taking the last line of the body and adding 1, which
            # should be the line of finally:
            if (
                isinstance(arg_1.parent, nodes.TryFinally)
                and arg_1 in arg_1.parent.finalbody
            ):
                arg_3 = arg_1.parent.body[0].tolineno + 1
            else:
                arg_3 = arg_1.parent.statement().fromlineno
        arg_4 = arg_1.fromlineno
        assert arg_4, arg_1
        if arg_3 == arg_4 and arg_0._visited_lines.get(arg_4) != 2:
            arg_0._check_multi_statement_line(arg_1, arg_4)
            return
        if arg_4 in arg_0._visited_lines:
            return
        try:
            arg_5 = arg_1.blockstart_tolineno
        except AttributeError:
            arg_5 = arg_1.tolineno
        assert arg_5, arg_1
        arg_6 = []
        for arg_4 in range(arg_4, arg_5 + 1):
            arg_0._visited_lines[arg_4] = 1
            try:
                arg_6.append(arg_0._lines[arg_4].rstrip())
            except KeyError:
                arg_6.append("")


def Func ( arg_0 ) : arg_1 = arg_0 . copy ( ) arg_2 = arg_1 . find_gaps ( index = True ) if not arg_2 : return for arg_3 in arg_2 : arg_4 = arg_1 [ arg_3 ] arg_5 = arg_1 [ arg_3 + 1 ] if arg_1 . order == 'depth' : arg_6 = ( arg_5 . top . z - arg_4 . base . z ) / 2 arg_4 . base = arg_4 . base . z + arg_6 arg_5 . top = arg_5 . top . z - arg_6 else : arg_6 = ( arg_5 . base - arg_4 . top ) / 2 arg_4 . top = arg_4 . top . z + arg_6 arg_5 . base = arg_5 . base . z - arg_6 return arg_1

def Func(arg_0):
        """
        Fill in empty intervals by growing from top and base.

        Note that this operation happens in-place and destroys any information
        about the ``Position`` (e.g. metadata associated with the top or base).
        See GitHub issue #54.
        """
        arg_1 = arg_0.copy()

        arg_2 = arg_1.find_gaps(index=True)

        if not arg_2:
            return

        for arg_3 in arg_2:
            arg_4 = arg_1[arg_3]
            arg_5 = arg_1[arg_3 + 1]

            if arg_1.order == 'depth':
                arg_6 = (arg_5.top.z-arg_4.base.z)/2
                arg_4.base = arg_4.base.z + arg_6
                arg_5.top = arg_5.top.z - arg_6
            else:
                arg_6 = (arg_5.base-arg_4.top)/2
                arg_4.top = arg_4.top.z + arg_6
                arg_5.base = arg_5.base.z - arg_6

        return arg_1

Fill in empty intervals by growing from top and base .


return map(lambda row: mapping(row_in_grid(row)), self._rows)

def Func ( arg_0 , arg_1 = arg_2 ) : arg_3 = arg_0 . _walk . row_in_grid return map ( lambda row : arg_1 ( arg_3 ( row ) ) , arg_0 . _rows )

def Func(arg_0, arg_1=arg_2):
        """Iterate over rows.

        :return: an iterator over :class:`rows <RowsInGrid>`
        :param mapping: funcion to map the result, see
          :meth:`walk_instructions` for an example usage
        """
        arg_3 = arg_0._walk.row_in_grid
        return map(lambda row: arg_1(arg_3(row)), arg_0._rows)


(x, filters, kernel, stride, kernel_posterior_fn)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : arg_5 = tfp . layers . Convolution2DFlipout ( arg_1 , arg_2 , padding = 'same' , arg_4 = arg_4 ) ( arg_0 ) arg_5 = tf . keras . layers . BatchNormalization ( ) ( arg_5 ) arg_5 = tf . keras . layers . Activation ( 'relu' ) ( arg_5 ) arg_5 = tfp . layers . Convolution2DFlipout ( arg_1 , arg_2 , padding = 'same' , arg_4 = arg_4 ) ( arg_5 ) arg_5 = tf . keras . layers . BatchNormalization ( ) ( arg_5 ) arg_5 = tf . keras . layers . Activation ( 'relu' ) ( arg_5 ) arg_5 = tf . keras . layers . MaxPooling2D ( pool_size = ( 2 , 2 ) , strides = arg_3 ) ( arg_5 ) return arg_5

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
  """Network block for VGG."""
  arg_5 = tfp.layers.Convolution2DFlipout(
      arg_1,
      arg_2,
      padding='same',
      arg_4=arg_4)(arg_0)
  arg_5 = tf.keras.layers.BatchNormalization()(arg_5)
  arg_5 = tf.keras.layers.Activation('relu')(arg_5)

  arg_5 = tfp.layers.Convolution2DFlipout(
      arg_1,
      arg_2,
      padding='same',
      arg_4=arg_4)(arg_5)
  arg_5 = tf.keras.layers.BatchNormalization()(arg_5)
  arg_5 = tf.keras.layers.Activation('relu')(arg_5)

  arg_5 = tf.keras.layers.MaxPooling2D(
      pool_size=(2, 2), strides=arg_3)(arg_5)
  return arg_5


def Func(arg_0, arg_1, arg_2=True):
        """
        This method does the work of updating settings. Can be passed with
        enforce_helpstring = False which you may want if allowing end users to
        add arbitrary metadata via the settings system.

        Preferable to use update_settings (without leading _) in code to do the
        right thing and always have docstrings.
        """
        for arg_3, arg_4 in six.iteritems(arg_1):
            arg_5 = arg_3.replace("_", "-")

            arg_6 = arg_5 in arg_0._instance_settings
            arg_7 = isinstance(arg_4, list) and len(arg_4) == 2
            arg_8 = not arg_6 and arg_7

            if isinstance(arg_4, tuple) or arg_8:
                arg_0._instance_settings[arg_5] = arg_4

            else:
                if arg_5 not in arg_0._instance_settings:
                    if arg_2:
                        arg_10 = "You must specify param '%s' as a tuple of (helpstring, value)"
                        raise InternalCashewException(arg_10 % arg_5)

                    else:
                        # Create entry with blank helpstring.
                        arg_0._instance_settings[arg_5] = ('', arg_4,)

                else:
                    # Save inherited helpstring, replace default value.
                    arg_11 = arg_0._instance_settings[arg_5]
                    arg_0._instance_settings[arg_5] = (arg_11[0], arg_4,)

This method does the work of updating settings . Can be passed with enforce_helpstring = False which you may want if allowing end users to add arbitrary metadata via the settings system .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . result_fullpath ( arg_1 ) try : with gzip . open ( arg_2 , 'rb' ) as f : arg_3 = pickle . load ( f ) except Exception as e : arg_4 = logging . getLogger ( __name__ ) arg_4 . warning ( e ) return None return arg_3

def Func(arg_0, arg_1):
        """Collect the result of a task

        Parameters
        ----------
        package_index :
            a package index

        Returns
        -------
        obj
            The result of the task

        """

        arg_2 = arg_0.result_fullpath(arg_1)
        # e.g., '{path}/tpd_20161129_122841_HnpcmF/results/task_00009/result.p.gz'

        try:
            with gzip.open(arg_2, 'rb') as f:
                arg_3 = pickle.load(f)
        except Exception as e:
            arg_4 = logging.getLogger(__name__)
            arg_4.warning(e)
            return None

        return arg_3


def
Func
(
arg_0
)
:
arg_1
,
arg_2
=
arg_0
.
_dst_addrs
.
pop
(
0
)
arg_0
.
_socket
=
socket
.
socket
(
arg_1
,
socket
.
SOCK_STREAM
)
arg_0
.
_socket
.
setblocking
(
False
)
arg_0
.
_dst_addr
=
arg_2
arg_0
.
_family
=
arg_1
try
:
arg_0
.
_socket
.
connect
(
arg_2
)
except
socket
.
error
,
err
:
logger
.
debug
(
"Connect error: {0}"
.
format
(
err
)
)
if
err
.
args
[
0
]
in
BLOCKING_ERRORS
:
arg_0
.
_set_state
(
"connecting"
)
arg_0
.
_write_queue
.
append
(
ContinueConnect
(
)
)
arg_0
.
_write_queue_cond
.
notify
(
)
arg_0
.
event
(
ConnectingEvent
(
arg_2
)
)
return
elif
arg_0
.
_dst_addrs
:
arg_0
.
_set_state
(
"connect"
)
return
elif
arg_0
.
_dst_nameports
:
arg_0
.
_set_state
(
"resolve-hostname"
)
return
else
:
arg_0
.
_socket
.
close
(
)
arg_0
.
_socket
=
arg_0
.
_set_state
(
"aborted"
)
arg_0
.
_write_queue
.
clear
(
)
arg_0
.
_write_queue_cond
.
notify
(
)
raise
arg_0
.
_connected
(
)

def Func(arg_0):
        """Start connecting to the next address on the `_dst_addrs` list.

        [ called with `lock` acquired ]

        """
        arg_1, arg_2 = arg_0._dst_addrs.pop(0)
        arg_0._socket = socket.socket(arg_1, socket.SOCK_STREAM)
        arg_0._socket.setblocking(False)
        arg_0._dst_addr = arg_2
        arg_0._family  = arg_1
        try:
            arg_0._socket.connect(arg_2)
        except socket.error, err:
            logger.debug("Connect error: {0}".format(err))
            if err.args[0] in BLOCKING_ERRORS:
                arg_0._set_state("connecting")
                arg_0._write_queue.append(ContinueConnect())
                arg_0._write_queue_cond.notify()
                arg_0.event(ConnectingEvent(arg_2))
                return
            elif arg_0._dst_addrs:
                arg_0._set_state("connect")
                return
            elif arg_0._dst_nameports:
                arg_0._set_state("resolve-hostname")
                return
            else:
                arg_0._socket.close()
                arg_0._socket = None
                arg_0._set_state("aborted")
                arg_0._write_queue.clear()
                arg_0._write_queue_cond.notify()
                raise
        arg_0._connected()

Start connecting to the next address on the _dst_addrs list .


def Func ( arg_0 , * arg_1 , ** arg_2 ) : arg_3 = hash ( tuple ( arg_2 . iteritems ( ) ) + arg_1 ) return '{}_{}' . format ( arg_0 , arg_3 )

def Func(arg_0, *arg_1, **arg_2):
    """
    Calculates cache key based on `args` and `kwargs`.
    `args` and `kwargs` must be instances of hashable types.
    """
    arg_3 = hash(tuple(arg_2.iteritems()) + arg_1)
    return '{}_{}'.format(arg_0, arg_3)

Calculates cache key based on args and kwargs . args and kwargs must be instances of hashable types .


def Func(arg_0, arg_1, arg_2):
        """Updates security groups by setting the ack field"""
        arg_3 = [arg_0.vif_key(vif.device_id, vif.mac_address)
                    for vif in arg_1]
        arg_0.set_fields(arg_3, SECURITY_GROUP_ACK, arg_2)


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_4
=
arg_3
.
find
(
arg_2
)
arg_5
=
arg_3
.
rfind
(
"\n="
,
0
,
arg_4
)
arg_6
=
arg_3
.
find
(
"\n"
,
arg_5
+
1
)
arg_7
=
arg_3
[
arg_5
:
arg_6
]
.
strip
(
)
.
strip
(
"= "
)
for
arg_8
in
arg_0
.
paragraphs
:
if
arg_8
.
title
==
arg_7
:
arg_8
.
tables
.
append
(
arg_1
)
arg_1
.
paragraph
=
arg_8

def Func(arg_0, arg_1, arg_2, arg_3):

        """ Creates a link from the table to paragraph and vice versa.

        Finds the first heading above the table in the markup.
        This is the title of the paragraph the table belongs to.

        """

        arg_4 = arg_3.find(arg_2)
        arg_5 = arg_3.rfind("\n=", 0, arg_4)
        arg_6 = arg_3.find("\n", arg_5+1)
        arg_7 = arg_3[arg_5:arg_6].strip().strip("= ")
        for arg_8 in arg_0.paragraphs:
            if arg_8.title == arg_7:
                arg_8.tables.append(arg_1)
                arg_1.paragraph = arg_8

Creates a link from the table to paragraph and vice versa . Finds the first heading above the table in the markup . This is the title of the paragraph the table belongs to .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
PriceDbApplication
(
)
arg_3
.
logger
=
arg_4
if
arg_2
:
arg_5
=
arg_3
.
get_latest_prices
(
)
else
:
arg_5
=
arg_3
.
get_prices
(
arg_0
,
arg_1
)
for
arg_6
in
arg_5
:
print
(
arg_6
)
print
(
f"{len(prices)} records found."
)

def Func(arg_0, arg_1, arg_2):
    """ Display all prices """
    arg_3 = PriceDbApplication()
    arg_3.logger = arg_4

    if arg_2:
        # fetch only the last prices
        arg_5 = arg_3.get_latest_prices()
    else:
        arg_5 = arg_3.get_prices(arg_0, arg_1)
    for arg_6 in arg_5:
        print(arg_6)

    print(f"{len(prices)} records found.")


Handle normal input lines. Use as a template for handlers.

def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 . line arg_3 = arg_1 . continue_prompt if ( arg_3 and arg_0 . shell . autoindent and arg_2 . isspace ( ) and 0 < abs ( len ( arg_2 ) - arg_0 . shell . indent_current_nsp ) <= 2 ) : arg_2 = '' return arg_2

def Func(arg_0, arg_1):
        # print "normal: ", line_info
        """Handle normal input lines. Use as a template for Funcrs."""

        # With autoindent on, we need some way to exit the input loop, and I
        # don't want to force the user to have to backspace all the way to
        # clear the line.  The rule will be in this case, that either two
        # lines of pure whitespace in a row, or a line of pure whitespace but
        # of a size different to the indent level, will exit the input loop.
        arg_2 = arg_1.line
        arg_3 = arg_1.continue_prompt

        if (arg_3 and
            arg_0.shell.autoindent and
            arg_2.isspace() and
            0 < abs(len(arg_2) - arg_0.shell.indent_current_nsp) <= 2):
            arg_2 = ''

        return arg_2

Handle normal input lines . Use as a template for handlers .


return getattr(requests, verb)(api, headers=headers, **request_kwargs)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
**
arg_3
)
:
arg_4
=
'https://api.github.com{}'
.
format
(
arg_2
)
arg_5
=
{
'Authorization'
:
'token {}'
.
format
(
arg_0
.
api_token
)
}
arg_6
=
{
**
arg_5
,
**
arg_3
.
pop
(
'headers'
,
{
}
)
}
return
getattr
(
requests
,
arg_1
)
(
arg_4
,
arg_6
=
arg_6
,
**
arg_3
)

def Func(arg_0, arg_1, arg_2, **arg_3):
        """Perform a github API call

        Args:
            verb (str): Can be "post", "put", or "get"
            url (str): The base URL with a leading slash for Github API (v3)
            auth (str or HTTPBasicAuth): A Github API token or a HTTPBasicAuth object
        """
        arg_4 = 'https://api.github.com{}'.format(arg_2)
        arg_5 = {'Authorization': 'token {}'.format(arg_0.api_token)}
        arg_6 = {**arg_5, **arg_3.pop('headers', {})}
        return getattr(requests, arg_1)(arg_4, arg_6=arg_6, **arg_3)


def
Func
(
arg_0
)
:
arg_1
=
int
(
time
.
time
(
)
)
arg_2
=
arg_0
.
get
(
'iat'
)
if
arg_2
is
:
raise
AppIdentityError
(
'No iat field in token: {0}'
.
format
(
arg_0
)
)
arg_3
=
arg_0
.
get
(
'exp'
)
if
arg_3
is
:
raise
AppIdentityError
(
'No exp field in token: {0}'
.
format
(
arg_0
)
)
if
arg_3
>=
arg_1
+
MAX_TOKEN_LIFETIME_SECS
:
raise
AppIdentityError
(
'exp field too far in future: {0}'
.
format
(
arg_0
)
)
arg_4
=
arg_2
CLOCK_SKEW_SECS
if
arg_1
<
arg_4
:
raise
AppIdentityError
(
'Token used too early, {0} < {1}: {2}'
.
format
(
arg_1
,
arg_4
,
arg_0
)
)
arg_5
=
arg_3
+
CLOCK_SKEW_SECS
if
arg_1
>
arg_5
:
raise
AppIdentityError
(
'Token used too late, {0} > {1}: {2}'
.
format
(
arg_1
,
arg_5
,
arg_0
)
)

def Func(arg_0):
    """Verifies the issued at and expiration from a JWT payload.

    Makes sure the current time (in UTC) falls between the issued at and
    expiration for the JWT (with some skew allowed for via
    ``CLOCK_SKEW_SECS``).

    Args:
        payload_dict: dict, A dictionary containing a JWT payload.

    Raises:
        AppIdentityError: If there is no ``'iat'`` field in the payload
                          dictionary.
        AppIdentityError: If there is no ``'exp'`` field in the payload
                          dictionary.
        AppIdentityError: If the JWT expiration is too far in the future (i.e.
                          if the expiration would imply a token lifetime
                          longer than what is allowed.)
        AppIdentityError: If the token appears to have been issued in the
                          future (up to clock skew).
        AppIdentityError: If the token appears to have expired in the past
                          (up to clock skew).
    """
    # Get the current time to use throughout.
    arg_1 = int(time.time())

    # Make sure issued at and expiration are in the payload.
    arg_2 = arg_0.get('iat')
    if arg_2 is None:
        raise AppIdentityError(
            'No iat field in token: {0}'.format(arg_0))
    arg_3 = arg_0.get('exp')
    if arg_3 is None:
        raise AppIdentityError(
            'No exp field in token: {0}'.format(arg_0))

    # Make sure the expiration gives an acceptable token lifetime.
    if arg_3 >= arg_1 + MAX_TOKEN_LIFETIME_SECS:
        raise AppIdentityError(
            'exp field too far in future: {0}'.format(arg_0))

    # Make sure (up to clock skew) that the token wasn't issued in the future.
    arg_4 = arg_2 - CLOCK_SKEW_SECS
    if arg_1 < arg_4:
        raise AppIdentityError('Token used too early, {0} < {1}: {2}'.format(
            arg_1, arg_4, arg_0))
    # Make sure (up to clock skew) that the token isn't already expired.
    arg_5 = arg_3 + CLOCK_SKEW_SECS
    if arg_1 > arg_5:
        raise AppIdentityError('Token used too late, {0} > {1}: {2}'.format(
            arg_1, arg_5, arg_0))

Verifies the issued at and expiration from a JWT payload .


def Func ( arg_0 ) : if arg_0 . _Func is None and arg_0 . _Func_locator is not None : return arg_0 . page . find_element ( * arg_0 . _Func_locator ) return arg_0 . _Func

def Func(arg_0):
        """Root element for the page region.

        Page regions should define a Func element either by passing this on
        instantiation or by defining a :py:attr:`_Func_locator` attribute. To
        reduce the chances of hitting :py:class:`~selenium.common.exceptions.StaleElementReferenceException`
        or similar you should use :py:attr:`_Func_locator`, as this is looked up every
        time the :py:attr:`Func` property is accessed.
        """
        if arg_0._Func is None and arg_0._Func_locator is not None:
            return arg_0.page.find_element(*arg_0._Func_locator)
        return arg_0._Func

Root element for the page region.

        Page regions should define a root element either by passing this on
        instantiation or by defining a :py:attr:`_root_locator` attribute. To
        reduce the chances of hitting :py:class:`~selenium.common.exceptions.StaleElementReferenceException`
        or similar you should use :py:attr:`_root_locator`, as this is looked up every
        time the :py:attr:`root` property is accessed.


def
Func
(
)
:
try
:
with
open
(
'/proc/1/cgroup'
,
'r'
)
as
readable
:
arg_0
=
readable
.
read
(
)
arg_1
=
set
(
re
.
compile
(
'[0-9a-f]{12,}'
)
.
findall
(
arg_0
)
)
assert
len
(
arg_1
)
==
1
return
arg_1
.
pop
(
)
except
:
logging
.
exception
(
'Failed to obtain current container ID'
)
raise
NotInsideContainerError
(
)

def Func():
    """
    Returns a string that represents the container ID of the current Docker container. If this
    function is invoked outside of a container a NotInsideContainerError is raised.

    >>> import subprocess
    >>> import sys
    >>> a = subprocess.check_output(['docker', 'run', '-v',
    ...                              sys.modules[__name__].__file__ + ':/foo.py',
    ...                              'python:2.7.12','python', '-c',
    ...                              'from foo import Func;\\
    ...                               print Func()'])
    int call will fail if a is not a valid hex string
    >>> int(a, 16) > 0
    True
    """
    try:
        with open('/proc/1/cgroup', 'r') as readable:
            arg_0 = readable.read()
        arg_1 = set(re.compile('[0-9a-f]{12,}').findall(arg_0))
        assert len(arg_1) == 1
        return arg_1.pop()
    except:
        logging.exception('Failed to obtain current container ID')
        raise NotInsideContainerError()

Returns a string that represents the container ID of the current Docker container. If this
    function is invoked outside of a container a NotInsideContainerError is raised.

    >>> import subprocess
    >>> import sys
    >>> a = subprocess.check_output(['docker', 'run', '-v',
    ...                              sys.modules[__name__].__file__ + ':/foo.py',
    ...                              'python:2.7.12','python', '-c',
    ...                              'from foo import current_docker_container_id;\\
    ...                               print current_docker_container_id()'])
    int call will fail if a is not a valid hex string
    >>> int(a, 16) > 0
    True

Returns a string that represents the container ID of the current Docker container . If this function is invoked outside of a container a NotInsideContainerError is raised .


def Func ( arg_0 , arg_1 = None , ** arg_2 ) : if arg_1 is None : arg_3 = arg_0 . f_get ( ) else : arg_3 = arg_0 . f_get ( arg_1 ) return arg_3 . Func ( ** arg_2 )

def Func(arg_0, arg_1=None, **arg_2):
        """Calls the corresponding function of the shared data item"""
        if arg_1 is None:
            arg_3 = arg_0.f_get()
        else:
            arg_3 = arg_0.f_get(arg_1)
        return arg_3.Func(**arg_2)


(self, fn=None, package_name=None, update=0, list_only=0)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=0, arg_4=0):
        """
        Installs system packages listed in yum-requirements.txt.
        """
        assert arg_0.genv[ROLE]
        arg_5 = arg_1 or arg_0.find_template(arg_0.genv.yum_requirments_fn)
        if not arg_5:
            return []
        assert os.path.isfile(arg_5)
        arg_3 = int(arg_3)
        if arg_4:
            return [
                arg_6.strip() for arg_6 in open(arg_5).readlines()
                if arg_6.strip() and not arg_6.strip.startswith('#')
                and (not arg_2 or arg_6.strip() == arg_2)
            ]
        if arg_3:
            arg_0.sudo_or_dryrun('yum update --assumeyes')
        if arg_2:
            arg_0.sudo_or_dryrun('yum install --assumeyes %s' % arg_2)
        else:
            if arg_0.genv.is_local:
                arg_0.put_or_dryrun(local_path=arg_5)
                arg_5 = arg_0.genv.put_remote_fn
            arg_0.sudo_or_dryrun('yum install --assumeyes $(cat %(yum_req_fn)s)' % arg_5)

Installs system packages listed in yum - requirements . txt .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_1
[
"quiet"
]
arg_3
=
arg_1
[
"recon"
]
arg_4
=
arg_1
[
"sprint"
]
arg_5
=
arg_1
[
"error"
]
arg_6
=
[
]
for
arg_7
in
arg_0
.
nodes
(
data
=
True
)
:
if
"output"
in
arg_7
[
1
]
:
for
arg_8
in
get_all_outputs
(
arg_7
[
1
]
)
:
arg_6
.
append
(
arg_8
)
arg_6
.
append
(
".shastore"
)
arg_9
=
0
for
arg_8
in
sorted
(
arg_6
)
:
if
os
.
path
.
isfile
(
arg_8
)
:
if
arg_3
:
arg_4
(
"Would remove file: {}"
.
format
(
arg_8
)
)
continue
arg_4
(
"Attempting to remove file '{}'"
,
level
=
"verbose"
)
try
:
os
.
remove
(
arg_8
)
arg_4
(
"Removed file"
,
level
=
"verbose"
)
except
:
arg_10
=
"Error: file '{}' failed to be removed"
arg_5
(
arg_10
.
format
(
arg_8
)
)
arg_9
=
1
if
not
arg_9
and
not
arg_3
:
arg_4
(
"All clean"
,
color
=
True
)
return
arg_9

def Func(arg_0, arg_1):
    """
    Removes all the output files from all targets. Takes
    the graph as the only argument

    Args:
        The networkx graph object
        The settings dictionary

    Returns:
        0 if successful
        1 if removing even one file failed
    """
    arg_2 = arg_1["quiet"]
    arg_3 = arg_1["recon"]
    arg_4 = arg_1["sprint"]
    arg_5 = arg_1["error"]
    arg_6 = []
    for arg_7 in arg_0.nodes(data=True):
        if "output" in arg_7[1]:
            for arg_8 in get_all_outputs(arg_7[1]):
                arg_6.append(arg_8)
    arg_6.append(".shastore")
    arg_9 = 0
    for arg_8 in sorted(arg_6):
        if os.path.isfile(arg_8):
            if arg_3:
                arg_4("Would remove file: {}".format(arg_8))
                continue
            arg_4("Attempting to remove file '{}'", level="verbose")
            try:
                os.remove(arg_8)
                arg_4("Removed file", level="verbose")
            except:
                arg_10 = "Error: file '{}' failed to be removed"
                arg_5(arg_10.format(arg_8))
                arg_9 = 1
    if not arg_9 and not arg_3:
        arg_4("All clean", color=True)
    return arg_9

Removes all the output files from all targets . Takes the graph as the only argument


def Func ( arg_0 = '' ) : arg_1 = 0.0 if arg_0 is None or len ( arg_0 ) == 0 : return arg_1 arg_0 = arg_0 . strip ( ) arg_2 = parse_compound ( arg_0 ) return arg_2 . Func ( )

def Func(arg_0=''):
    """Determine the molar mass of a chemical compound.

    The molar mass is usually the mass of one mole of the substance, but here
    it is the mass of 1000 moles, since the mass unit used in auxi is kg.

    :param compound: Formula of a chemical compound, e.g. 'Fe2O3'.

    :returns: Molar mass. [kg/kmol]
    """

    arg_1 = 0.0
    if arg_0 is None or len(arg_0) == 0:
        return arg_1

    arg_0 = arg_0.strip()

    arg_2 = parse_compound(arg_0)

    return arg_2.Func()

Determine the molar mass of a chemical compound .


def Func ( ) : try : arg_0 = sys . modules [ 'tasks' ] except KeyError : return None else : return os . path . abspath ( os . path . dirname ( arg_0 . __file__ ) )

def Func():
    """ Determine location of `tasks.py`."""
    try:
        arg_0 = sys.modules['tasks']
    except KeyError:
        return None
    else:
        return os.path.abspath(os.path.dirname(arg_0.__file__))


def Func(arg_0, arg_1, arg_2):
        """
        Set min value

        @param window_name: Window name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type window_name: string
        @param object_name: Object name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type object_name: string

        @return: 1 on success.
        @rtype: integer
        """
        arg_3 = arg_0._get_object_handle(arg_1, arg_2)
        arg_3.AXValue = 0
        return 1


def Func(arg_0, arg_1):
    '''Validate that combine method can be performed with given files.
    Raises IOError if input file formats are incompatible.
    '''
    _validate_sample_rates(arg_0, arg_1)

    if arg_1 == 'concatenate':
        _validate_num_channels(arg_0, arg_1)

Validate that combine method can be performed with given files . Raises IOError if input file formats are incompatible .


def Func ( arg_0 ) : if arg_0 . _file_logger : arg_0 . logger . removeHandler ( arg_1 ) arg_0 . _file_logger = None return 1

def Func(arg_0):
        """ Stop logging.

        @return: 1 on success and 0 on error
        @rtype: integer
        """
        if arg_0._file_logger:
            arg_0.logger.removeHandler(arg_1)
            arg_0._file_logger = None
        return 1


def Func(arg_0):
    """ Function to create generic filenames based on what has been explored """
    arg_1 = arg_0.f_get_explored_parameters()
    arg_2 = ''
    for arg_3 in arg_1.values():
        arg_4 = arg_3.v_name
        arg_5 = arg_3.f_get()
        arg_2 += '%s_%s__' % (arg_4, str(arg_5))

    return arg_2[:-2] + '.png'


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = str ( uuid . uuid1 ( ) ) arg_4 = arg_0 . kernel_manager . shell_channel . execute ( '' , silent = True , user_expressions = { arg_3 : arg_1 } ) arg_0 . _callback_dict [ arg_3 ] = arg_2 arg_0 . _request_info [ 'execute' ] [ arg_4 ] = arg_0 . _ExecutionRequest ( arg_4 , 'silent_exec_callback' )

def Func(arg_0, arg_1, arg_2):
        """Silently execute `expr` in the kernel and call `callback` with reply

        the `expr` is evaluated silently in the kernel (without) output in
        the frontend. Call `callback` with the
        `repr <http://docs.python.org/library/functions.html#repr> `_ as first argument

        Parameters
        ----------
        expr : string
            valid string to be executed by the kernel.
        callback : function
            function accepting one argument, as a string. The string will be
            the `repr` of the result of evaluating `expr`

        The `callback` is called with the `repr()` of the result of `expr` as
        first argument. To get the object, do `eval()` on the passed value.

        See Also
        --------
        _handle_exec_callback : private method, deal with calling callback with reply

        """

        # generate uuid, which would be used as an indication of whether or
        # not the unique request originated from here (can use msg id ?)
        arg_3 = str(uuid.uuid1())
        arg_4 = arg_0.kernel_manager.shell_channel.execute('',
            silent=True, user_expressions={ arg_3:arg_1 })
        arg_0._callback_dict[arg_3] = arg_2
        arg_0._request_info['execute'][arg_4] = arg_0._ExecutionRequest(arg_4, 'silent_exec_callback')

Silently execute expr in the kernel and call callback with reply


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = { 'q' : arg_1 } if arg_2 : arg_3 [ 'ontology' ] = ',' . join ( arg_2 ) arg_4 = requests . get ( arg_0 . ontology_Func , arg_3 = arg_3 ) return arg_4 . json ( )

def Func(arg_0, arg_1, arg_2=None):
        """Suggest terms from an optional list of ontologies

        :param str name:
        :param list[str] ontology:
        :rtype: dict

        .. seealso:: https://www.ebi.ac.uk/ols/docs/api#_Func_term
        """
        arg_3 = {'q': arg_1}
        if arg_2:
            arg_3['ontology'] = ','.join(arg_2)
        arg_4 = requests.get(arg_0.ontology_Func, arg_3=arg_3)

        return arg_4.json()

Suggest terms from an optional list of ontologies

        :param str name:
        :param list[str] ontology:
        :rtype: dict

        .. seealso:: https://www.ebi.ac.uk/ols/docs/api#_suggest_term


return iter(data.items(**kwargs)) if IS_PY3 else data.iteritems(**kwargs)

def Func ( arg_0 , ** arg_1 ) : return iter ( arg_0 . items ( ** arg_1 ) ) if IS_PY3 else arg_0 . Func ( ** arg_1 )

def Func(arg_0, **arg_1):
    """Iterate over dict items."""
    return iter(arg_0.items(**arg_1)) if IS_PY3 else arg_0.Func(**arg_1)


(self, path, prefixed_path, source_storage)

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Attempt to copy ``path`` with storage
        """
        # Skip this file if it was already copied earlier
        if arg_2 in arg_0.copied_files:
            return arg_0.log("Skipping '%s' (already copied earlier)" % arg_1)
        # Delete the target file if needed or break
        if not arg_0.delete_file(arg_1, arg_2, arg_3):
            return
        # The full path of the source file
        arg_4 = arg_3.path(arg_1)
        # Finally start copying
        if arg_0.dry_run:
            arg_0.log("Pretending to copy '%s'" % arg_4, level=1)
        else:
            arg_0.log("Copying '%s'" % arg_4, level=1)
            with arg_3.open(arg_1) as source_file:
                arg_0.storage.save(arg_2, source_file)
        arg_0.copied_files.append(arg_2)


def
Func
(
arg_0
)
:
if
hasattr
(
arg_0
,
"_ishelper"
)
and
arg_0
.
_ishelper
:
return
arg_0
.
_toOM
(
)
elif
isinstance
(
arg_0
,
om
.
OMAny
)
:
return
arg_0
elif
isinstance
(
arg_0
,
six
.
integer_types
)
:
return
om
.
OMInteger
(
arg_0
)
elif
isinstance
(
arg_0
,
float
)
:
return
om
.
OMFloat
(
arg_0
)
elif
isinstance
(
arg_0
,
six
.
string_types
)
:
return
om
.
OMString
(
arg_0
)
elif
isinstance
(
arg_0
,
WrappedHelper
)
:
return
arg_0
.
toOM
(
)
elif
inspect
.
isfunction
(
arg_0
)
:
arg_1
=
inspect
.
signature
(
arg_0
)
.
parameters
arg_2
=
[
v
for
k
,
v
in
six
.
iteritems
(
arg_1
)
]
arg_3
=
[
inspect
.
Parameter
.
POSITIONAL_ONLY
,
inspect
.
Parameter
.
POSITIONAL_OR_KEYWORD
]
if
not
all
(
[
arg_4
.
kind
in
arg_3
for
arg_4
in
arg_2
]
)
:
raise
CannotInterpretAsOpenMath
(
"no sequence arguments allowed"
)
arg_5
=
[
om
.
OMVariable
(
name
=
arg_4
.
name
)
for
arg_4
in
arg_2
]
arg_6
=
Func
(
arg_0
(
*
arg_5
)
)
return
OMBinding
(
om
.
OMSymbol
(
name
=
"lambda"
,
cd
=
"python"
,
cdbase
=
"http://python.org"
)
,
arg_5
,
arg_6
)
else
:
raise
CannotInterpretAsOpenMath
(
"unknown kind of object: "
+
str
(
arg_0
)
)

def Func(arg_0):
    """tries to convert a Python object into an OpenMath object
    this is not a replacement for using a Converter for exporting Python objects
    instead, it is used conveniently building OM objects in DSL embedded in Python
    inparticular, it converts Python functions into OMBinding objects using lambdaOM as the binder"""

    if hasattr(arg_0, "_ishelper") and arg_0._ishelper:
        # wrapped things in this class -> unwrap
        return arg_0._toOM()

    elif isinstance(arg_0, om.OMAny):
        # already OM
        return arg_0

    elif isinstance(arg_0, six.integer_types):
        # integers -> OMI
        return om.OMInteger(arg_0)

    elif isinstance(arg_0, float):
        # floats -> OMF
        return om.OMFloat(arg_0)

    elif isinstance(arg_0, six.string_types):
        # strings -> OMSTR
        return om.OMString(arg_0)

    elif isinstance(arg_0, WrappedHelper):
        # wrapper -> wrapped object
        return arg_0.toOM()

    elif inspect.isfunction(arg_0):
        # function -> OMBIND(lambda,...)

        # get all the parameters of the function
        arg_1 = inspect.signature(arg_0).parameters
        arg_2 = [v for k, v in six.iteritems(arg_1)]

        # make sure that all of them are positional
        arg_3 = [inspect.Parameter.POSITIONAL_ONLY, inspect.Parameter.POSITIONAL_OR_KEYWORD]
        if not all([arg_4.kind in arg_3 for arg_4 in arg_2]):
            raise CannotInterpretAsOpenMath("no sequence arguments allowed")

        # call the function with appropriate OMVariables
        arg_5 = [om.OMVariable(name=arg_4.name) for arg_4 in arg_2]
        arg_6 = Func(arg_0(*arg_5))

        return OMBinding(om.OMSymbol(name="lambda", cd="python", cdbase="http://python.org"), arg_5, arg_6)

    else:
        # fail
        raise CannotInterpretAsOpenMath("unknown kind of object: " + str(arg_0))

tries to convert a Python object into an OpenMath object this is not a replacement for using a Converter for exporting Python objects instead it is used conveniently building OM objects in DSL embedded in Python inparticular it converts Python functions into OMBinding objects using lambdaOM as the binder


def
Func
(
arg_0
)
:
for
arg_1
in
arg_0
.
rxSerial
(
arg_0
.
_TUN
.
_tun
.
mtu
)
:
try
:
arg_0
.
_TUN
.
_tun
.
write
(
arg_1
)
except
pytun
.
Error
as
error
:
print
(
"pytun error writing: {0}"
.
format
(
arg_1
)
)
print
(
error
)

def Func(arg_0):
        """
        Check the serial port for data to write to the TUN adapter.
        """
        for arg_1 in arg_0.rxSerial(arg_0._TUN._tun.mtu):
            # print("about to send: {0}".format(item))
            try:
                arg_0._TUN._tun.write(arg_1)
            except pytun.Error as error:
                print("pytun error writing: {0}".format(arg_1))
                print(error)

Check the serial port for data to write to the TUN adapter .


(self, key, data, hdf5_group, full_name, flag, **kwargs)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, **arg_6):
        """Creates and array that can be used with an HDF5 array object"""

        if arg_5 == HDF5StorageService.ARRAY:
            arg_0._prm_write_into_array(arg_1, arg_2, arg_3, arg_4, **arg_6)
        elif arg_5 in (HDF5StorageService.CARRAY,
                    HDF5StorageService.EARRAY,
                    HDF5StorageService.VLARRAY):
            arg_0._prm_write_into_other_array(arg_1, arg_2, arg_3, arg_4,
                                             arg_5=arg_5, **arg_6)
        else:
            raise RuntimeError('Flag `%s` of hdf5 data `%s` of `%s` not understood' %
                               (arg_5, arg_1, arg_4))

        arg_0._hdf5file.flush()


def Func(arg_0):
    """Given a model's ``metadata``, iterate over the roles.
    Return values are the role identifier and role type as a tuple.
    """
    for arg_1 in cnxepub.ATTRIBUTED_ROLE_KEYS:
        for arg_2 in arg_0.get(arg_1, []):
            if arg_2['type'] != 'cnx-id':
                raise ValueError("Archive only accepts Connexions users.")
            arg_3 = parse_user_uri(arg_2['id'])
            yield arg_3, arg_1
    raise StopIteration()

Given a model s metadata iterate over the roles . Return values are the role identifier and role type as a tuple .


(self, service_name, deployment_name, role_name)

return self._perform_post(
            self._get_role_instance_operations_path(
                service_name, deployment_name, role_name),
            _XmlSerializer.start_role_operation_to_xml(),
            as_async=True)

def Func(arg_0, arg_1, arg_2, arg_3):
        '''
        Starts the specified virtual machine.

        service_name:
            The name of the service.
        deployment_name:
            The name of the deployment.
        role_name:
            The name of the role.
        '''
        _validate_not_none('service_name', arg_1)
        _validate_not_none('deployment_name', arg_2)
        _validate_not_none('role_name', arg_3)
        return arg_0._perform_post(
            arg_0._get_role_instance_operations_path(
                arg_1, arg_2, arg_3),
            _XmlSerializer.Func_operation_to_xml(),
            as_async=True)


def
Func
(
arg_0
,
arg_1
=
False
)
:
if
(
arg_0
.
_authorization
(
)
and
PyFunceble
.
CONFIGURATION
[
"logs"
]
and
"file_to_test"
in
PyFunceble
.
INTERN
and
PyFunceble
.
INTERN
[
"file_to_test"
]
)
:
arg_0
.
file
=
(
PyFunceble
.
OUTPUT_DIRECTORY
+
PyFunceble
.
OUTPUTS
[
"parent_directory"
]
+
PyFunceble
.
OUTPUTS
[
"logs"
]
[
"directories"
]
[
"parent"
]
+
PyFunceble
.
OUTPUTS
[
"logs"
]
[
"filenames"
]
[
"execution_time"
]
)
if
PyFunceble
.
path
.
isfile
(
arg_0
.
file
)
:
arg_3
=
Dict
(
)
.
from_json
(
File
(
arg_0
.
file
)
.
read
(
)
)
else
:
arg_3
=
{
}
if
arg_0
.
action
==
"start"
:
if
"final_total"
in
arg_3
and
arg_3
[
"final_total"
]
:
del
arg_3
[
"final_total"
]
if
"data"
in
arg_3
:
arg_3
[
"data"
]
.
append
(
[
PyFunceble
.
INTERN
[
"start"
]
]
)
else
:
arg_3
[
"data"
]
=
[
[
PyFunceble
.
INTERN
[
"start"
]
]
]
elif
arg_0
.
action
==
"stop"
:
try
:
arg_3
[
"data"
]
[
1
]
.
append
(
PyFunceble
.
INTERN
[
"end"
]
)
arg_4
=
arg_3
[
"data"
]
[
0
]
[
0
]
arg_5
=
arg_3
[
"data"
]
[
1
]
[
1
]
arg_3
[
"current_total"
]
=
arg_0
.
format_execution_time
(
arg_4
,
arg_5
)
if
arg_1
:
arg_3
[
"final_total"
]
=
arg_3
[
"current_total"
]
print
(
PyFunceble
.
Fore
.
MAGENTA
+
PyFunceble
.
Style
.
BRIGHT
+
"Global execution time: "
+
arg_3
[
"final_total"
]
)
except
KeyError
:
pass
try
:
Dict
(
arg_3
)
.
to_json
(
arg_0
.
file
)
except
FileNotFoundError
:
DirectoryStructure
(
)
Dict
(
arg_3
)
.
to_json
(
arg_0
.
file
)

def Func(arg_0, arg_1=False):  # pragma: no cover
        """
        Save the current time to the file.

        :param last:
            Tell us if we are at the very end of the file testing.
        :type last: bool
        """

        if (
            arg_0._authorization()
            and PyFunceble.CONFIGURATION["logs"]
            and "file_to_test" in PyFunceble.INTERN
            and PyFunceble.INTERN["file_to_test"]
        ):
            # * We are authorized to work.
            # and
            # * The generation of logs is activated.
            # and
            # * We are not testing as an imported module.

            # We set the location of the file we are working with.
            arg_0.file = (
                PyFunceble.OUTPUT_DIRECTORY
                + PyFunceble.OUTPUTS["parent_directory"]
                + PyFunceble.OUTPUTS["logs"]["directories"]["parent"]
                + PyFunceble.OUTPUTS["logs"]["filenames"]["execution_time"]
            )

            if PyFunceble.path.isfile(arg_0.file):
                # The file we are working with exist.

                # We get its content so we can directly work with it.
                arg_3 = Dict().from_json(File(arg_0.file).read())
            else:
                # The file we are working with does not exist.

                # We generate a dummy content.
                arg_3 = {}

            if arg_0.action == "start":
                # The action is equal to `start`.

                if "final_total" in arg_3 and arg_3["final_total"]:
                    # The final total index exist.

                    # We delete it.
                    del arg_3["final_total"]

                if "data" in arg_3:
                    # The data index exist.

                    # We append the current start time inside it at
                    # a new sublist.
                    arg_3["data"].append([PyFunceble.INTERN["start"]])
                else:
                    # The data index does not exist.

                    # We create the index along with the current start time.
                    arg_3["data"] = [[PyFunceble.INTERN["start"]]]
            elif arg_0.action == "stop":
                # The action is equal to `stop`.

                try:
                    # We try to work with the data index.

                    # We append the end time at the end of the last element
                    # of data.
                    #
                    # Note: It is at the end because we should have as first
                    # the star time.
                    arg_3["data"][-1].append(PyFunceble.INTERN["end"])

                    # We get the start time.
                    arg_4 = arg_3["data"][0][0]
                    # We get the end time.
                    arg_5 = arg_3["data"][-1][-1]

                    # We calculate the execution time of the test.
                    arg_3["current_total"] = arg_0.format_execution_time(arg_4, arg_5)

                    if arg_1:
                        # We are at the very end of the file testing.

                        # We initiate the global execution time.
                        arg_3["final_total"] = arg_3["current_total"]

                        # We inform the user about the global execution time.
                        print(
                            PyFunceble.Fore.MAGENTA
                            + PyFunceble.Style.BRIGHT
                            + "Global execution time: "
                            + arg_3["final_total"]
                        )
                except KeyError:
                    # It is not possible to work with the data index because
                    # it does not exist.

                    # We ignore the problem.
                    pass

            try:
                # We try to save the whole data at its final location.
                Dict(arg_3).to_json(arg_0.file)
            except FileNotFoundError:
                # The directory was not found.

                # We construct the output directory
                DirectoryStructure()

                # And we retry to save the whole data at its final location.
                Dict(arg_3).to_json(arg_0.file)


(start_sqn=None, base_url='https://planet.openstreetmap.org/replication/minute', expected_interval=60, parse_timestamps=True, state_dir=None)

def Func(arg_0=None, arg_1='https://planet.openstreetmap.org/replication/minute', arg_2=60, arg_3=True, arg_4=None):
    """Start processing an OSM diff stream and yield one changeset at a time to
    the caller."""

    # If the user specifies a state_dir, read the state from the statefile there
    if arg_4:
        if not os.path.exists(arg_4):
            raise Exception('Specified state_dir "%s" doesn\'t exist.' % arg_4)

        if os.path.exists('%s/state.txt' % arg_4):
            with open('%s/state.txt' % arg_4) as f:
                arg_5 = readState(f)
                arg_0 = arg_5['sequenceNumber']

    # If no start_sqn, assume to start from the most recent diff
    if not arg_0:
        arg_6 = urllib2.urlopen('%s/state.txt' % arg_1)
        arg_5 = readState(arg_6)
    else:
        arg_7 = str(arg_0).zfill(9)
        arg_6 = urllib2.urlopen('%s/%s/%s/%s.state.txt' % (arg_1, arg_7[0:3], arg_7[3:6], arg_7[6:9]))
        arg_5 = readState(arg_6)

    arg_8 = 0.0

    while True:
        arg_7 = arg_5['sequenceNumber'].zfill(9)
        arg_9 = '%s/%s/%s/%s.osc.gz' % (arg_1, arg_7[0:3], arg_7[3:6], arg_7[6:9])
        arg_10 = urllib2.urlopen(arg_9)
        arg_10 = StringIO.StringIO(arg_10.read())
        arg_11 = gzip.GzipFile(fileobj=arg_10)

        for arg_12 in iter_osm_change_file(arg_11, arg_3):
            yield arg_12

        # After parsing the OSC, check to see how much time is remaining
        arg_13 = datetime.datetime.strptime(arg_5['timestamp'], "%Y-%m-%dT%H:%M:%SZ")
        yield (None, model.Finished(arg_5['sequenceNumber'], arg_13))

        arg_14 = arg_13 + datetime.timedelta(seconds=arg_2 + arg_8)
        if datetime.datetime.utcnow() < arg_14:
            arg_15 = (arg_14 - datetime.datetime.utcnow()).total_seconds()
        else:
            arg_15 = 0.0
        time.sleep(arg_15)

        # Then try to fetch the next state file
        arg_7 = str(int(arg_5['sequenceNumber']) + 1).zfill(9)
        arg_9 = '%s/%s/%s/%s.state.txt' % (arg_1, arg_7[0:3], arg_7[3:6], arg_7[6:9])
        arg_16 = 1.0
        while True:
            try:
                arg_6 = urllib2.urlopen(arg_9)
                arg_8 -= (arg_8 / 2.0)
                break
            except urllib2.HTTPError as e:
                if e.code == 404:
                    time.sleep(arg_16)
                    arg_16 = min(arg_16 * 2, 13)
                    arg_8 += arg_16

        if arg_4:
            with open('%s/state.txt' % arg_4, 'w') as f:
                f.write(arg_6.read())
            with open('%s/state.txt' % arg_4, 'r') as f:
                arg_5 = readState(f)
        else:
            arg_5 = readState(arg_6)

Start processing an OSM diff stream and yield one changeset at a time to the caller .


def
Func
(
arg_0
)
:
TaskProjects
(
arg_0
)
.
execute
(
)
arg_1
=
TaskIdentitiesMerge
(
arg_0
)
arg_1
.
execute
(
)
logging
.
info
(
"Merging identities finished!"
)

def Func(arg_0):
    """Execute the merge identities phase

    :param config: a Mordred config object
    """

    TaskProjects(arg_0).execute()
    arg_1 = TaskIdentitiesMerge(arg_0)
    arg_1.execute()
    logging.info("Merging identities finished!")


def Func ( arg_0 , arg_1 , arg_2 ) : arg_0 . _check_for_exceptions ( arg_1 , arg_2 ) arg_3 = { } for arg_4 in arg_1 [ 'results' ] : arg_5 = ZipTaxClient . _cast_tax_rate ( arg_4 [ 'taxSales' ] ) arg_3 [ arg_4 [ 'geoCity' ] ] = arg_5 if not arg_2 : return arg_3 [ list ( arg_3 . keys ( ) ) [ 0 ] ] return arg_3

def Func(arg_0, arg_1, arg_2):
        """ Get the tax rate from the ZipTax response """
        arg_0._check_for_exceptions(arg_1, arg_2)

        arg_3 = {}
        for arg_4 in arg_1['results']:
            arg_5 = ZipTaxClient._cast_tax_rate(arg_4['taxSales'])
            arg_3[arg_4['geoCity']] = arg_5
        if not arg_2:
            return arg_3[list(arg_3.keys())[0]]
        return arg_3


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
Chunk
(
)
arg_4
=
arg_1
.
__iter__
(
)
arg_5
=
''
arg_6
=
arg_7
=
xml
.
dom
.
minidom
.
parse
(
open
(
arg_0
)
)
for
arg_8
in
arg_7
.
getElementsByTagName
(
'FILENAME'
)
:
arg_9
=
arg_4
.
next
(
)
arg_6
=
arg_8
.
attributes
.
get
(
'docid'
)
.
value
assert
arg_6
and
arg_6
==
arg_9
.
stream_id
,
'%s != %s\nner=%r'
%
(
arg_6
,
arg_9
.
stream_id
,
arg_5
)
arg_10
=
'lingpipe'
arg_11
=
Tagging
(
)
arg_11
.
tagger_id
=
arg_10
arg_12
=
list
(
lingpipe
.
files
(
arg_8
.
toxml
(
)
)
)
[
0
]
[
1
]
arg_11
.
raw_tagging
=
arg_12
arg_11
.
generation_time
=
streamcorpus
.
make_stream_time
(
)
arg_9
.
body
.
taggings
[
arg_10
]
=
arg_11
arg_17
=
list
(
lingpipe
.
sentences
(
arg_12
)
)
assert
arg_9
.
ratings
[
0
]
.
mentions
,
arg_9
.
stream_id
arg_18
=
Label
(
)
arg_18
.
annotator
=
arg_9
.
ratings
[
0
]
.
annotator
arg_18
.
target_id
=
arg_9
.
ratings
[
0
]
.
target_id
arg_21
=
collections
.
defaultdict
(
lambda
:
set
(
)
)
for
arg_22
in
arg_17
:
for
arg_23
in
arg_22
.
tokens
:
if
arg_23
.
entity_type
is
not
:
arg_21
[
arg_23
.
equiv_id
]
.
add
(
cleanse
(
arg_23
.
token
)
)
arg_24
=
set
(
)
for
arg_25
,
arg_26
in
arg_21
.
items
(
)
:
arg_27
=
cleanse
(
' '
.
join
(
arg_26
)
)
if
'john'
in
arg_27
and
'smith'
in
arg_27
:
arg_24
.
add
(
arg_25
)
print
len
(
arg_24
)
for
arg_22
in
arg_17
:
for
arg_23
in
arg_22
.
tokens
:
if
arg_23
.
equiv_id
in
arg_24
:
arg_23
.
labels
=
[
arg_18
]
arg_9
.
body
.
sentences
[
arg_10
]
=
arg_17
arg_3
.
add
(
arg_9
)
open
(
arg_2
,
'wb'
)
.
write
(
str
(
arg_3
)
)
print
'created %s'
%
arg_2

def Func(arg_0, arg_1, arg_2):
    '''
    iterate through the i_chunk and tmp_ner_path to generate a new
    Chunk with body.ner
    '''
    arg_3 = Chunk()
    arg_4 = arg_1.__iter__()
    arg_5 = ''
    arg_6 = None

    arg_7 = xml.dom.minidom.parse(open(arg_0))

    for arg_8 in arg_7.getElementsByTagName('FILENAME'):

        arg_9 = arg_4.next()
        ## get stream_id out of the XML
        arg_6 = arg_8.attributes.get('docid').value
        assert arg_6 and arg_6 == arg_9.stream_id, \
            '%s != %s\nner=%r' % (arg_6, arg_9.stream_id, arg_5)

        arg_10 = 'lingpipe'
        arg_11 = Tagging()
        arg_11.tagger_id = arg_10
        ## get this one file out of its FILENAME tags
        arg_12 = list(lingpipe.files(arg_8.toxml()))[0][1]
        arg_11.raw_tagging = arg_12
        arg_11.generation_time = streamcorpus.make_stream_time()
        arg_9.body.taggings[arg_10] = arg_11

        arg_17 = list(lingpipe.sentences(arg_12))

        ## make JS labels on individual tokens
        assert arg_9.ratings[0].mentions, arg_9.stream_id
        arg_18 = Label()
        arg_18.annotator = arg_9.ratings[0].annotator
        arg_18.target_id = arg_9.ratings[0].target_id

        # first map all corefchains to their words
        arg_21 = collections.defaultdict(lambda: set())
        for arg_22 in arg_17:
            for arg_23 in arg_22.tokens:
                if arg_23.entity_type is not None:
                    arg_21[arg_23.equiv_id].add(cleanse(arg_23.token))

        ## find all the chains that are John Smith
        arg_24 = set()
        for arg_25, arg_26 in arg_21.items():
            ## detect 'smith' in 'smithye'
            arg_27 = cleanse(' '.join(arg_26))
            if 'john' in arg_27 and 'smith' in arg_27:
                arg_24.add(arg_25)

        print len(arg_24)
        ## now apply the label
        for arg_22 in arg_17:
            for arg_23 in arg_22.tokens:
                if arg_23.equiv_id in arg_24:
                    arg_23.labels = [arg_18]

        arg_9.body.sentences[arg_10] = arg_17

        arg_3.add(arg_9)

    ## put the o_chunk bytes into the specified file
    open(arg_2, 'wb').write(str(arg_3))
    ## replace this with log.info()
    print 'created %s' % arg_2

iterate through the i_chunk and tmp_ner_path to generate a new Chunk with body . ner


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
arg_2
[
'content'
]
arg_0
.
log
.
info
(
"Dropping records with %s"
,
arg_3
)
arg_4
=
arg_3
.
get
(
'msg_ids'
,
[
]
)
arg_5
=
dict
(
status
=
'ok'
)
if
arg_4
==
'all'
:
try
:
arg_0
.
db
.
drop_matching_records
(
dict
(
completed
=
{
'$ne'
:
}
)
)
except
Exception
:
arg_5
=
error
.
wrap_exception
(
)
else
:
arg_6
=
filter
(
lambda
m
:
m
in
arg_0
.
pending
,
arg_4
)
if
arg_6
:
try
:
raise
IndexError
(
"msg pending: %r"
%
arg_6
[
0
]
)
except
:
arg_5
=
error
.
wrap_exception
(
)
else
:
try
:
arg_0
.
db
.
drop_matching_records
(
dict
(
msg_id
=
{
'$in'
:
arg_4
}
)
)
except
Exception
:
arg_5
=
error
.
wrap_exception
(
)
if
arg_5
[
'status'
]
==
'ok'
:
arg_7
=
arg_3
.
get
(
'engine_ids'
,
[
]
)
for
arg_8
in
arg_7
:
if
arg_8
not
in
arg_0
.
engines
:
try
:
raise
IndexError
(
"No such engine: %i"
%
arg_8
)
except
:
arg_5
=
error
.
wrap_exception
(
)
break
arg_9
=
arg_0
.
engines
[
arg_8
]
.
queue
try
:
arg_0
.
db
.
drop_matching_records
(
dict
(
engine_uuid
=
arg_9
,
completed
=
{
'$ne'
:
}
)
)
except
Exception
:
arg_5
=
error
.
wrap_exception
(
)
break
arg_0
.
session
.
send
(
arg_0
.
query
,
'purge_reply'
,
arg_3
=
arg_5
,
ident
=
arg_1
)

def Func(arg_0, arg_1, arg_2):
        """Purge results from memory. This method is more valuable before we move
        to a DB based message storage mechanism."""
        arg_3 = arg_2['content']
        arg_0.log.info("Dropping records with %s", arg_3)
        arg_4 = arg_3.get('msg_ids', [])
        arg_5 = dict(status='ok')
        if arg_4 == 'all':
            try:
                arg_0.db.drop_matching_records(dict(completed={'$ne':None}))
            except Exception:
                arg_5 = error.wrap_exception()
        else:
            arg_6 = filter(lambda m: m in arg_0.pending, arg_4)
            if arg_6:
                try:
                    raise IndexError("msg pending: %r" % arg_6[0])
                except:
                    arg_5 = error.wrap_exception()
            else:
                try:
                    arg_0.db.drop_matching_records(dict(msg_id={'$in':arg_4}))
                except Exception:
                    arg_5 = error.wrap_exception()

            if arg_5['status'] == 'ok':
                arg_7 = arg_3.get('engine_ids', [])
                for arg_8 in arg_7:
                    if arg_8 not in arg_0.engines:
                        try:
                            raise IndexError("No such engine: %i" % arg_8)
                        except:
                            arg_5 = error.wrap_exception()
                        break
                    arg_9 = arg_0.engines[arg_8].queue
                    try:
                        arg_0.db.drop_matching_records(dict(engine_uuid=arg_9, completed={'$ne':None}))
                    except Exception:
                        arg_5 = error.wrap_exception()
                        break

        arg_0.session.send(arg_0.query, 'purge_reply', arg_3=arg_5, ident=arg_1)

Purge results from memory . This method is more valuable before we move to a DB based message storage mechanism .


def
Func
(
arg_0
,
arg_1
=
4
,
arg_2
=
0
,
arg_3
=
False
)
:
if
arg_0
is
:
return
arg_4
=
'\t'
*
arg_2
+
' '
*
arg_1
if
arg_3
:
arg_5
=
re
.
compile
(
r'^\s*'
,
re
.
MULTILINE
)
else
:
arg_5
=
re
.
compile
(
r'^'
,
re
.
MULTILINE
)
arg_6
=
re
.
sub
(
arg_5
,
arg_4
,
arg_0
)
if
arg_6
.
endswith
(
os
.
linesep
+
arg_4
)
:
return
arg_6
[
:
len
(
arg_4
)
]
else
:
return
arg_6

def Func(arg_0,arg_1=4, arg_2=0, arg_3=False):
    """Indent a string a given number of spaces or tabstops.

    Func(str,nspaces=4,ntabs=0) -> Func str by ntabs+nspaces.

    Parameters
    ----------

    instr : basestring
        The string to be Funced.
    nspaces : int (default: 4)
        The number of spaces to be Funced.
    ntabs : int (default: 0)
        The number of tabs to be Funced.
    flatten : bool (default: False)
        Whether to scrub existing Funcation.  If True, all lines will be
        aligned to the same Funcation.  If False, existing Funcation will
        be strictly increased.

    Returns
    -------

    str|unicode : string Funced by ntabs and nspaces.

    """
    if arg_0 is None:
        return
    arg_4 = '\t'*arg_2+' '*arg_1
    if arg_3:
        arg_5 = re.compile(r'^\s*', re.MULTILINE)
    else:
        arg_5 = re.compile(r'^', re.MULTILINE)
    arg_6 = re.sub(arg_5, arg_4, arg_0)
    if arg_6.endswith(os.linesep+arg_4):
        return arg_6[:-len(arg_4)]
    else:
        return arg_6

Indent a string a given number of spaces or tabstops.

    indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.

    Parameters
    ----------

    instr : basestring
        The string to be indented.
    nspaces : int (default: 4)
        The number of spaces to be indented.
    ntabs : int (default: 0)
        The number of tabs to be indented.
    flatten : bool (default: False)
        Whether to scrub existing indentation.  If True, all lines will be
        aligned to the same indentation.  If False, existing indentation will
        be strictly increased.

    Returns
    -------

    str|unicode : string indented by ntabs and nspaces.

Indent a string a given number of spaces or tabstops .


def Func ( arg_0 ) : arg_0 . __path = None arg_0 . __repo = { 'repository_unique_name' : str ( uuid . uuid1 ( ) ) , 'create_utctime' : time . time ( ) , 'last_update_utctime' : None , 'pyrep_version' : str ( __version__ ) , 'repository_information' : '' , 'walk_repo' : [ ] }

def Func(arg_0):
        """Reset repository instance.
        """
        arg_0.__path   = None
        arg_0.__repo   = {'repository_unique_name': str(uuid.uuid1()),
                         'create_utctime': time.time(),
                         'last_update_utctime': None,
                         'pyrep_version': str(__version__),
                         'repository_information': '',
                         'walk_repo': []}


def Func(arg_0, arg_1='smhdw'):
  """Convert the timeout duration to seconds.

  The value must be of the form "<integer><unit>" where supported
  units are s, m, h, d, w (seconds, minutes, hours, days, weeks).

  Args:
    interval: A "<integer><unit>" string.
    valid_units: A list of supported units.

  Returns:
    A string of the form "<integer>s" or None if timeout is empty.
  """
  if not arg_0:
    return None

  try:
    arg_2 = arg_0[-1]

    if arg_2 == 's' and 's' in arg_1:
      return str(float(arg_0[:-1])) + 's'
    elif arg_2 == 'm' and 'm' in arg_1:
      return str(float(arg_0[:-1]) * 60) + 's'
    elif arg_2 == 'h' and 'h' in arg_1:
      return str(float(arg_0[:-1]) * 60 * 60) + 's'
    elif arg_2 == 'd' and 'd' in arg_1:
      return str(float(arg_0[:-1]) * 60 * 60 * 24) + 's'
    elif arg_2 == 'w' and 'w' in arg_1:
      return str(float(arg_0[:-1]) * 60 * 60 * 24 * 7) + 's'
    else:
      raise ValueError(
          'Unsupported units in interval string %s: %s' % (arg_0, arg_2))

  except (ValueError, OverflowError) as e:
    raise ValueError('Unable to parse interval string %s: %s' % (arg_0, e))

Convert the timeout duration to seconds .


(self, text, shorten=None, now=None, top=None, media=None, when=None)

def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=None, arg_6=None):
    '''
      Create one or more Func status updates.
    '''

    arg_7 = PATHS['CREATE']

    arg_8 = "text=%s&" % arg_1
    arg_8 += "profile_ids[]=%s&" % arg_0.profile_id

    if arg_2:
      arg_8 += "shorten=%s&" % arg_2

    if arg_3:
      arg_8 += "now=%s&" % arg_3

    if arg_4:
      arg_8 += "top=%s&" % arg_4

    if arg_6:
      arg_8 += "scheduled_at=%s&" % str(arg_6)

    if arg_5:
      arg_9 = "media[%s]=%s&"

      for arg_10, arg_11 in arg_5.iteritems():
        arg_8 += arg_9 % (arg_10, arg_11)

    arg_12 = arg_0.api.post(arg_7=arg_7, data=arg_8)
    arg_13 = Update(api=arg_0.api, raw_response=arg_12['updates'][0])

    arg_0.append(arg_13)

    return arg_13


def Func(arg_0):
    """validate a url for zeromq"""
    if not isinstance(arg_0, basestring):
        raise TypeError("url must be a string, not %r"%type(arg_0))
    arg_0 = arg_0.lower()

    arg_1 = arg_0.split('://')
    assert len(arg_1) == 2, 'Invalid url: %r'%arg_0
    arg_2, arg_3 = arg_1
    assert arg_2 in ['tcp','pgm','epgm','ipc','inproc'], "Invalid protocol: %r"%arg_2

    # domain pattern adapted from http://www.regexlib.com/REDetails.aspx?regexp_id=391
    # author: Remi Sabourin
    arg_4 = re.compile(r'^([\w\d]([\w\d\-]{0,61}[\w\d])?\.)*[\w\d]([\w\d\-]{0,61}[\w\d])?$')

    if arg_2 == 'tcp':
        arg_5 = arg_3.split(':')
        assert len(arg_5) == 2, 'Invalid url: %r'%arg_0
        arg_3,arg_6 = arg_5
        try:
            arg_7 = int(arg_6)
        except ValueError:
            raise AssertionError("Invalid port %r in url: %r"%(arg_7, arg_0))

        assert arg_3 == '*' or arg_4.match(arg_3) is not None, 'Invalid url: %r'%arg_0

    else:
        # only validate tcp urls currently
        pass

    return True


def Func(arg_0, arg_1):
        """Determines whether action 'Left' is available."""

        # True if any field is 0 (empty) on the left of a tile or two tiles can
        # be merged.
        for arg_2 in range(4):
            arg_3 = False
            for arg_4 in range(4):
                arg_3 |= arg_1[arg_2, arg_4] == 0
                if arg_1[arg_2, arg_4] != 0 and arg_3:
                    return True
                if (arg_1[arg_2, arg_4] != 0 and arg_4 > 0 and
                        arg_1[arg_2, arg_4] == arg_1[arg_2, arg_4 - 1]):
                    return True

        return False

Determines whether action Left is available .


def Func(arg_0, arg_1: arg_2) -> Node:
        """Evaluate a rule by name."""
        # context created by caller
        arg_3 = Node()
        arg_4 = id(arg_3)
        arg_0.rule_nodes['_'] = arg_3
        arg_0.id_cache[arg_4] = '_'
        # TODO: other behavior for  empty rules?
        if arg_1 not in arg_0.__class__._rules:
            arg_0.diagnostic.notify(
                error.Severity.ERROR,
                "Unknown rule : %s" % arg_1,
                error.LocationInfo.from_stream(arg_0._stream, is_error=True)
            )
            raise arg_0.diagnostic
        arg_0._lastRule = arg_1
        arg_8 = arg_0.__class__._rules[arg_1]
        # TODO: add packrat cache here, same rule - same pos == same res
        arg_9 = arg_8(arg_0)
        if arg_9:
            arg_9 = arg_0.rule_nodes['_']
        return arg_9


def
Func
(
arg_0
,
arg_1
)
:
arg_1
=
list
(
preprocess_query
(
arg_1
)
)
[
0
]
arg_2
=
[
k
.
decode
(
)
for
k
in
DB
.
smembers
(
edge_ngram_key
(
arg_1
)
)
]
print
(
white
(
arg_2
)
)
print
(
magenta
(
'({} elements)'
.
format
(
len
(
arg_2
)
)
)
)

def Func(arg_0, arg_1):
    """Shows autocomplete results for a given token."""
    arg_1 = list(preprocess_query(arg_1))[0]
    arg_2 = [k.decode() for k in DB.smembers(edge_ngram_key(arg_1))]
    print(white(arg_2))
    print(magenta('({} elements)'.format(len(arg_2))))

Shows autocomplete results for a given token .


def Func ( arg_0 ) : if PyFunceble . CONFIGURATION [ "inactive_database" ] : Dict ( PyFunceble . INTERN [ "inactive_db" ] ) . to_json ( arg_0 . inactive_db_path )

def Func(arg_0):
        """
        Save the current database into the inactive-db.json file.
        """

        if PyFunceble.CONFIGURATION["inactive_database"]:
            # The database subsystem is activated.

            # We save the current database state into the database file.
            Dict(PyFunceble.INTERN["inactive_db"]).to_json(arg_0.inactive_db_path)

Save the current database into the inactive - db . json file .


def Func(arg_0, arg_1=None, arg_2=arg_3):
    """Create Graphene Enum for sorting a SQLAlchemy class query

    Parameters
    - cls : Sqlalchemy model class
        Model used to create the sort enumerator
    - name : str, optional, default None
        Name to use for the enumerator. If not provided it will be set to `cls.__name__ + 'SortEnum'`
    - symbol_name : function, optional, default `_symbol_name`
        Function which takes the column name and a boolean indicating if the sort direction is ascending,
        and returns the symbol name for the current column and sort direction.
        The default function will create, for a column named 'foo', the symbols 'foo_asc' and 'foo_desc'

    Returns
    - Enum
        The Graphene enumerator
    """
    arg_4, arg_5 = _Func(arg_0, arg_1, arg_2)
    return arg_4


def Func ( arg_0 ) : arg_1 = [ ] arg_2 = sorted ( arg_0 , key = len ) for arg_3 , arg_4 in enumerate ( arg_2 ) : arg_5 = False arg_6 = op . basename ( arg_4 ) arg_7 = arg_2 [ arg_3 + 1 : ] for arg_8 in arg_7 : arg_9 = op . basename ( arg_8 ) if arg_9 . endswith ( arg_6 ) : arg_5 = True break if not arg_5 : arg_1 . append ( arg_4 ) return arg_1

def Func(arg_0):
    """ Return a subset of `filepaths`. Keep only the files that have a basename longer than the
    others with same suffix.
    This works based on that dcm2nii appends a preffix character for each processing
    step it does automatically in the DICOM to NifTI conversion.

    Parameters
    ----------
    filepaths: iterable of str

    Returns
    -------
    cleaned_paths: iterable of str
    """
    arg_1 = []

    # sort them by size
    arg_2 = sorted(arg_0, key=len)

    for arg_3, arg_4 in enumerate(arg_2):
        arg_5 = False

        # get the basename and the rest of the files
        arg_6 = op.basename(arg_4)
        arg_7  = arg_2[arg_3+1:]

        # check if the basename is in the basename of the rest of the files
        for arg_8 in arg_7:
            arg_9 = op.basename(arg_8)
            if arg_9.endswith(arg_6):
                arg_5 = True
                break

        if not arg_5:
            arg_1.append(arg_4)

    return arg_1

Return a subset of filepaths . Keep only the files that have a basename longer than the others with same suffix . This works based on that dcm2nii appends a preffix character for each processing step it does automatically in the DICOM to NifTI conversion .


return self.request(path, method, call_params)

def Func ( arg_0 , arg_1 ) : arg_2 = '/' + arg_0 . api_version + '/CancelScheduledPlay/' arg_3 = 'POST' return arg_0 . request ( arg_2 , arg_3 , arg_1 )

def Func(arg_0, arg_1):
        """REST Cancel a Scheduled Play Helper
        """
        arg_2 = '/' + arg_0.api_version + '/CancelScheduledPlay/'
        arg_3 = 'POST'
        return arg_0.request(arg_2, arg_3, arg_1)


return self._action('change_kernel', kernel=kernel_id, wait=wait)

def Func ( arg_0 , arg_1 , arg_2 = True ) : return arg_0 . _action ( 'Func' , kernel = arg_1 , arg_2 = arg_2 )

def Func(arg_0, arg_1, arg_2=True):
        """
        Change the kernel of this droplet

        Parameters
        ----------
        kernel_id: int
            Can be retrieved from output of self.kernels()
        wait: bool, default True
            Whether to block until the pending action is completed

        Raises
        ------
        APIError if region does not support private networking
        """
        return arg_0._action('Func', kernel=arg_1, arg_2=arg_2)


def Func ( arg_0 , arg_1 ) : arg_2 = json . dumps ( { 'jsonrpc' : arg_0 . version , 'method' : arg_0 . service_name , 'params' : arg_1 , 'id' : text_type ( uuid . uuid4 ( ) ) } ) arg_3 = arg_2 . encode ( 'utf-8' ) arg_4 = Request ( arg_0 . service_url , arg_3 , headers = arg_0 . headers ) return urlopen ( arg_4 ) . read ( )

def Func(arg_0, arg_1):
        """Performs the actual sending action and returns the result
        """
        arg_2 = json.dumps({
            'jsonrpc': arg_0.version,
            'method': arg_0.service_name,
            'params': arg_1,
            'id': text_type(uuid.uuid4())
        })
        arg_3 = arg_2.encode('utf-8')
        arg_4 = Request(arg_0.service_url, arg_3, headers=arg_0.headers)
        return urlopen(arg_4).read()


def Func ( arg_0 , arg_1 ) : arg_0 . word_starts = [ ] arg_3 = 0 for arg_4 in range ( len ( arg_1 ) ) : arg_0 . word_starts . append ( arg_3 ) arg_3 += len ( arg_1 [ arg_4 ] ) + 1

def Func(arg_0, arg_1):
        """Helper method returns the starting indexes of strings in GST"""
        arg_0.word_starts = []
        arg_3 = 0
        for arg_4 in range(len(arg_1)):
            arg_0.word_starts.append(arg_3)
            arg_3 += len(arg_1[arg_4]) + 1


(project_id, limit=100, offset=0, last_id=None)

def Func ( arg_0 , arg_1 = 100 , arg_2 = 0 , arg_3 = None ) : if arg_3 is not None : arg_4 = dict ( arg_1 = arg_1 , arg_3 = arg_3 ) else : arg_4 = dict ( arg_1 = arg_1 , arg_2 = arg_2 ) print ( OFFSET_WARNING ) arg_4 [ 'project_id' ] = arg_0 try : arg_5 = _pybossa_req ( 'get' , 'task' , arg_4 = arg_4 ) if type ( arg_5 ) . __name__ == 'list' : return [ Task ( arg_6 ) for arg_6 in arg_5 ] else : return arg_5 except : raise

def Func(arg_0, arg_1=100, arg_2=0, arg_3=None):
    """Return a list of tasks for a given project ID.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :param limit: Number of returned items, default 100
    :type limit: integer
    :param offset: Offset for the query, default 0
    :param last_id: id of the last task, used for pagination. If provided, offset is ignored
    :type last_id: integer
    :type offset: integer
    :returns: True -- the response status code

    """
    if arg_3 is not None:
        arg_4 = dict(arg_1=arg_1, arg_3=arg_3)
    else:
        arg_4 = dict(arg_1=arg_1, arg_2=arg_2)
        print(OFFSET_WARNING)
    arg_4['project_id'] = arg_0
    try:
        arg_5 = _pybossa_req('get', 'task',
                           arg_4=arg_4)
        if type(arg_5).__name__ == 'list':
            return [Task(arg_6) for arg_6 in arg_5]
        else:
            return arg_5
    except:  # pragma: no cover
        raise

Return a list of tasks for a given project ID .


(queue_url,
                 item,
                 delay_seconds=0,
                 client=None,
                 raiseonfail=False)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
0
,
arg_3
=
,
arg_4
=
False
)
:
if
not
arg_3
:
arg_3
=
boto3
.
client
(
'sqs'
)
try
:
arg_5
=
json
.
dumps
(
arg_1
)
arg_6
=
arg_3
.
send_message
(
QueueUrl
=
arg_0
,
MessageBody
=
arg_5
,
DelaySeconds
=
arg_2
,
)
if
not
arg_6
:
LOGERROR
(
'could not send item to queue: %s'
%
arg_0
)
return
else
:
return
arg_6
except
Exception
as
e
:
LOGEXCEPTION
(
'could not send item to queue: %s'
%
arg_0
)
if
arg_4
:
raise
return

def Func(arg_0,
                 arg_1,
                 arg_2=0,
                 arg_3=None,
                 arg_4=False):
    """This pushes a dict serialized to JSON to the specified SQS queue.

    Parameters
    ----------

    queue_url : str
        The SQS URL of the queue to push the object to.

    item : dict
        The dict passed in here will be serialized to JSON.

    delay_seconds : int
        The amount of time in seconds the pushed item will be held before going
        'live' and being visible to all queue consumers.

    client : boto3.Client or None
        If None, this function will instantiate a new `boto3.Client` object to
        use in its operations. Alternatively, pass in an existing `boto3.Client`
        instance to re-use it here.

    raiseonfail : bool
        If True, will re-raise whatever Exception caused the operation to fail
        and break out immediately.

    Returns
    -------

    boto3.Response or None
        If the item was successfully put on the queue, will return the response
        from the service. If it wasn't, will return None.

    """

    if not arg_3:
        arg_3 = boto3.client('sqs')

    try:

        arg_5 = json.dumps(arg_1)

        arg_6 = arg_3.send_message(
            QueueUrl=arg_0,
            MessageBody=arg_5,
            DelaySeconds=arg_2,
        )
        if not arg_6:
            LOGERROR('could not send item to queue: %s' % arg_0)
            return None
        else:
            return arg_6

    except Exception as e:

        LOGEXCEPTION('could not send item to queue: %s' % arg_0)

        if arg_4:
            raise

        return None

This pushes a dict serialized to JSON to the specified SQS queue .


def Func ( arg_0 , arg_1 , arg_2 ) : if not arg_0 . doc_comment_set : arg_0 . doc_comment_set = True if validations . validate_doc_comment ( arg_2 ) : arg_1 . comment = str_from_text ( arg_2 ) return True else : raise SPDXValueError ( 'Document::Comment' ) else : raise CardinalityError ( 'Document::Comment' )

def Func(arg_0, arg_1, arg_2):
        """Sets document comment, Raises CardinalityError if
        comment already set.
        Raises SPDXValueError if comment is not free form text.
        """
        if not arg_0.doc_comment_set:
            arg_0.doc_comment_set = True
            if validations.validate_doc_comment(arg_2):
                arg_1.comment = str_from_text(arg_2)
                return True
            else:
                raise SPDXValueError('Document::Comment')
        else:
            raise CardinalityError('Document::Comment')

Sets document comment Raises CardinalityError if comment already set . Raises SPDXValueError if comment is not free form text .


def Func ( arg_0 , arg_1 ) : arg_2 = [ ( arg_0 , arg_1 ) ] while len ( arg_2 ) > 0 : arg_0 , arg_1 = arg_2 . pop ( ) for arg_3 , arg_4 in arg_1 . iteritems ( ) : if arg_3 in arg_0 and isinstance ( arg_0 [ arg_3 ] , dict ) and isinstance ( arg_4 , dict ) : arg_2 . append ( ( arg_0 [ arg_3 ] , arg_4 ) ) else : arg_0 [ arg_3 ] = arg_4

def Func(arg_0, arg_1):
  """Recursively updates the values in original with the values from updates."""
  # Keep a list of the sub-dictionaries that need to be updated to avoid having
  # to use recursion (which could fail for dictionaries with a lot of nesting.
  arg_2 = [(arg_0, arg_1)]
  while len(arg_2) > 0:
    arg_0, arg_1 = arg_2.pop()
    for arg_3, arg_4 in arg_1.iteritems():
      if arg_3 in arg_0 and isinstance(arg_0[arg_3], dict) and isinstance(arg_4, dict):
        arg_2.append((arg_0[arg_3], arg_4))
      else:
        arg_0[arg_3] = arg_4

Recursively updates the values in original with the values from updates .


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
_check_kernel_id
(
arg_1
)
super
(
MappingKernelManager
,
arg_0
)
.
Func
(
arg_1
)
arg_0
.
log
.
info
(
"Kernel interrupted: %s"
%
arg_1
)

def Func(arg_0, arg_1):
        """Interrupt a kernel."""
        arg_0._check_kernel_id(arg_1)
        super(MappingKernelManager, arg_0).Func(arg_1)
        arg_0.log.info("Kernel interrupted: %s" % arg_1)


def Func ( arg_0 ) : from invenio_oauth2server . models import Token arg_0 [ 'expires' ] = iso2dt_or_none ( arg_0 [ 'expires' ] ) load_common ( Token , arg_0 )

def Func(arg_0):
    """Load the oauth2server token from data dump."""
    from invenio_oauth2server.models import Token
    arg_0['expires'] = iso2dt_or_none(arg_0['expires'])
    load_common(Token, arg_0)

Load the oauth2server token from data dump .


def Func(arg_0):
        """Asserts that val is not empty."""
        if len(arg_0.val) == 0:
            if isinstance(arg_0.val, str_types):
                arg_0._err('Expected not empty string, but was empty.')
            else:
                arg_0._err('Expected not empty, but was empty.')
        return arg_0


def Func(arg_0, arg_1, arg_2):
        """Selector has delivered us an event."""
        arg_0._logger.debug('Processing event with key {} and mask {}'.format(arg_1, arg_2))
        arg_3, (arg_4, arg_5) = arg_1.fileobj, arg_1.data
        if arg_2 & selectors.EVENT_READ and arg_4 is not None:
            if arg_4._cancelled:
                arg_0.remove_reader(arg_3)
            else:
                arg_0._logger.debug('Invoking reader callback: {}'.format(arg_4))
                arg_4._run()
        if arg_2 & selectors.EVENT_WRITE and arg_5 is not None:
            if arg_5._cancelled:
                arg_0.remove_writer(arg_3)
            else:
                arg_0._logger.debug('Invoking writer callback: {}'.format(arg_5))
                arg_5._run()


def
Func
(
arg_0
)
:
for
arg_1
,
arg_2
in
zip
(
DANGLER_QUERIES
,
DANGLER_WARNINGS
)
:
arg_3
=
arg_0
.
gtfs
.
execute_custom_query
(
arg_1
)
.
fetchone
(
)
[
0
]
if
arg_3
>
0
:
if
arg_0
.
verbose
:
print
(
str
(
arg_3
)
+
" "
+
arg_2
)
arg_0
.
warnings_container
.
add_warning
(
arg_2
,
arg_0
.
location
,
count
=
arg_3
)

def Func(arg_0):
        """
        Checks for rows that are not referenced in the the tables that should be linked

        stops <> stop_times using stop_I
        stop_times <> trips <> days, using trip_I
        trips <> routes, using route_I
        :return:
        """
        for arg_1, arg_2 in zip(DANGLER_QUERIES, DANGLER_WARNINGS):
            arg_3 = arg_0.gtfs.execute_custom_query(arg_1).fetchone()[0]
            if arg_3 > 0:
                if arg_0.verbose:
                    print(str(arg_3) + " " + arg_2)
                arg_0.warnings_container.add_warning(arg_2, arg_0.location, count=arg_3)


def Func(arg_0):
        """
        If not already cached, fetch the creation date of the repo, cache it
        and return the special value indicating the creation of the repo.

        :rtype: str
        :return: value indicating the creation
        """
        arg_1 = arg_0.tag_times_dict.get(REPO_CREATED_TAG_NAME, None)
        if not arg_1:
            arg_2, arg_1 = arg_0.fetcher.fetch_repo_creation_date()
            arg_0.tag_times_dict[arg_2] = timestring_to_datetime(arg_1)
        return REPO_CREATED_TAG_NAME

If not already cached fetch the creation date of the repo cache it and return the special value indicating the creation of the repo .


def Func(arg_0):
        """
        Parse DAG files repeatedly in a standalone loop.
        """
        while True:
            arg_1 = time.time()

            if arg_0._signal_conn.poll():
                arg_2 = arg_0._signal_conn.recv()
                if arg_2 == DagParsingSignal.TERMINATE_MANAGER:
                    arg_0.terminate()
                    break
                elif arg_2 == DagParsingSignal.END_MANAGER:
                    arg_0.end()
                    sys.exit(os.EX_OK)

            arg_0._refresh_dag_dir()

            arg_3 = arg_0.heartbeat()
            for arg_4 in arg_3:
                arg_0._result_queue.put(arg_4)

            arg_0._print_stat()

            arg_5 = all(arg_0.get_last_finish_time(x) is not None
                                      for x in arg_0.file_paths)
            arg_6 = arg_0.max_runs_reached()

            arg_7 = DagParsingStat(arg_0._file_paths,
                                              arg_0.get_all_pids(),
                                              arg_6,
                                              arg_5,
                                              len(arg_3))
            arg_0._stat_queue.put(arg_7)

            if arg_6:
                arg_0.log.info("Exiting dag parsing loop as all files "
                              "have been processed %s times", arg_0._max_runs)
                break

            arg_8 = time.time() - arg_1
            if arg_8 < 1:
                arg_9 = 1 - arg_8
                arg_0.log.debug("Sleeping for %.2f seconds to prevent excessive logging", arg_9)
                time.sleep(arg_9)

Parse DAG files repeatedly in a standalone loop .


return new_statements, rank_decrease, io_change

def Func(arg_0: arg_1["HdlStatement"]):
        """
        Simplify statements in the list
        """
        arg_2 = False
        arg_3 = []

        for arg_4 in arg_0:
            arg_5, arg_6 = arg_4._try_reduce()
            arg_3.extend(arg_5)
            arg_2 |= arg_6

        arg_3, arg_7 = HdlStatement._merge_statements(
            arg_3)

        return arg_3, arg_7, arg_2


return self.merge(SkypeBotUser.fromRaw(self.skype, json[0])) if json else None

def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . skype . conn ( "GET" , "{0}/agents" . format ( SkypeConnection . API_BOT ) , params = { "agentId" : arg_1 } , auth = SkypeConnection . Auth . SkypeToken ) . json ( ) . get ( "agentDescriptions" , [ ] ) return arg_0 . merge ( SkypeBotUser . fromRaw ( arg_0 . skype , arg_2 [ 0 ] ) ) if arg_2 else None

def Func(arg_0, arg_1):
        """
        Retrieve a single Func.

        Args:
            id (str): UUID or username of the Func

        Returns:
            SkypeBotUser: resulting Func user object
        """
        arg_2 = arg_0.skype.conn("GET", "{0}/agents".format(SkypeConnection.API_BOT), params={"agentId": arg_1},
                               auth=SkypeConnection.Auth.SkypeToken).json().get("agentDescriptions", [])
        return arg_0.merge(SkypeBotUser.fromRaw(arg_0.skype, arg_2[0])) if arg_2 else None

Retrieve a single bot.

        Args:
            id (str): UUID or username of the bot

        Returns:
            SkypeBotUser: resulting bot user object


(args, type_comment, *, is_method=False)

def Func(arg_0, arg_1, *, arg_2=False):
    """Copies AST nodes from `type_comment` into the ast3.arguments in `args`.

    Does validaation of argument count (allowing for untyped self/cls)
    and type (vararg and kwarg).
    """
    if isinstance(arg_1, ast3.Ellipsis):
        return

    arg_3 = len(arg_0.args)
    if arg_0.vararg:
        arg_3 += 1
    arg_3 += len(arg_0.kwonlyargs)
    if arg_0.kwarg:
        arg_3 += 1
    arg_4 = len(arg_1) if isinstance(arg_1, list) else 1
    if arg_3 != arg_4:
        if arg_2 and arg_3 - arg_4 == 1:
            pass  # fine, we're just skipping `self`, `cls`, etc.
        else:
            raise ValueError(
                f"number of arguments in type comment doesn't match; " +
                f"expected {expected}, found {actual}"
            )

    if isinstance(arg_1, list):
        arg_5 = arg_1.pop
    else:
        # If there's just one value, only one of the loops and ifs below will
        # be populated. We ensure this with the expected/actual length check
        # above.
        arg_6 = arg_1

        def arg_5(arg_7: arg_8 = 0) -> ast3.expr:
            return arg_6

    for arg_9 in arg_0.args[arg_3 - arg_4:]:
        ensure_no_annotation(arg_9.annotation)
        arg_9.annotation = arg_5(0)

    if arg_0.vararg:
        ensure_no_annotation(arg_0.vararg.annotation)
        arg_0.vararg.annotation = arg_5(0)

    for arg_9 in arg_0.kwonlyargs:
        ensure_no_annotation(arg_9.annotation)
        arg_9.annotation = arg_5(0)

    if arg_0.kwarg:
        ensure_no_annotation(arg_0.kwarg.annotation)
        arg_0.kwarg.annotation = arg_5(0)

Copies AST nodes from type_comment into the ast3 . arguments in args .


def Func ( arg_0 , arg_1 ) : arg_1 = iter ( arg_1 ) assert _is_just_started ( arg_1 ) arg_2 = yield_from ( arg_1 ) for arg_3 in arg_2 : with arg_2 : arg_2 . send ( arg_0 ( ( yield arg_3 ) ) ) return_ ( arg_2 . result )

def Func(arg_0, arg_1):
    """Apply a function to all ``send`` values of a generator

    Parameters
    ----------
    func: ~typing.Callable[[T_send], T_mapped]
        the function to apply
    gen: Generable[T_yield, T_mapped, T_return]
        the generator iterable.

    Returns
    -------
    ~typing.Generator[T_yield, T_send, T_return]
        the mapped generator
    """
    arg_1 = iter(arg_1)
    assert _is_just_started(arg_1)
    arg_2 = yield_from(arg_1)
    for arg_3 in arg_2:
        with arg_2:
            arg_2.send(arg_0((yield arg_3)))
    return_(arg_2.result)

Apply a function to all send values of a generator


def Func(arg_0, arg_1, arg_2, arg_3):
        """Start SASL authentication process.

        [initiating entity only]

        :Parameters:
            - `username`: user name.
            - `authzid`: authorization ID.
            - `mechanism`: SASL mechanism to use."""
        if not arg_1.initiator:
            raise SASLAuthenticationFailed("Only initiating entity start"
                                                        " SASL authentication")
        if arg_1.features is None or not arg_0.peer_sasl_mechanisms:
            raise SASLNotAvailable("Peer doesn't support SASL")

        arg_4 = dict(arg_1.auth_properties)
        if not arg_4.get("service-domain") and (
                                        arg_1.peer and arg_1.peer.domain):
            arg_4["service-domain"] = arg_1.peer.domain
        if arg_2 is not None:
            arg_4["username"] = arg_2
        if arg_3 is not None:
            arg_4["authzid"] = arg_3
        if "password" in arg_0.settings:
            arg_4["password"] = arg_0.settings["password"]
        arg_4["available_mechanisms"] = arg_0.peer_sasl_mechanisms
        arg_5 = sasl.filter_mechanism_list(
                            arg_0.settings['sasl_mechanisms'], arg_4,
                                            arg_0.settings['insecure_auth'])
        if not arg_5:
            raise SASLNotAvailable(
                                "None of SASL mechanism selected can be used")
        arg_4["enabled_mechanisms"] = arg_5

        arg_6 = None
        for arg_7 in arg_5:
            if arg_7 in arg_0.peer_sasl_mechanisms:
                arg_6 = arg_7
                break
        if not arg_6:
            raise SASLMechanismNotAvailable("Peer doesn't support any of"
                                                    " our SASL mechanisms")
        logger.debug("Our mechanism: {0!r}".format(arg_6))

        arg_1.auth_method_used = arg_6
        arg_0.authenticator = sasl.client_authenticator_factory(arg_6)
        arg_10 = arg_0.authenticator.start(arg_4)
        if not isinstance(arg_10, sasl.Response):
            raise SASLAuthenticationFailed("SASL initiation failed")

        arg_11 = ElementTree.Element(AUTH_TAG)
        arg_11.set("mechanism", arg_6)
        if arg_10.data:
            if arg_10.encode:
                arg_11.text = arg_10.encode()
            else:
                arg_11.text = arg_10.data
        arg_1.write_element(arg_11)


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
if
arg_2
==
ZABRANSKY_SPLINE
:
return
arg_0
.
Zabransky_spline
.
Func
(
arg_1
)
elif
arg_2
==
ZABRANSKY_QUASIPOLYNOMIAL
:
return
arg_0
.
Zabransky_quasipolynomial
.
Func
(
arg_1
)
elif
arg_2
==
ZABRANSKY_SPLINE_C
:
return
arg_0
.
Zabransky_spline_iso
.
Func
(
arg_1
)
elif
arg_2
==
ZABRANSKY_QUASIPOLYNOMIAL_C
:
return
arg_0
.
Zabransky_quasipolynomial_iso
.
Func
(
arg_1
)
elif
arg_2
==
ZABRANSKY_SPLINE_SAT
:
return
arg_0
.
Zabransky_spline_sat
.
Func
(
arg_1
)
elif
arg_2
==
ZABRANSKY_QUASIPOLYNOMIAL_SAT
:
return
arg_0
.
Zabransky_quasipolynomial_sat
.
Func
(
arg_1
)
elif
arg_2
==
COOLPROP
:
return
CoolProp_T_dependent_property
(
arg_1
,
arg_0
.
CASRN
,
'CPMOLAR'
,
'l'
)
elif
arg_2
==
POLING_CONST
:
return
arg_0
.
POLING_constant
elif
arg_2
==
CRCSTD
:
return
arg_0
.
CRCSTD_constant
elif
arg_2
==
ROWLINSON_POLING
:
arg_3
=
arg_0
.
Cpgm
(
arg_1
)
if
hasattr
(
arg_0
.
Cpgm
,
'__call__'
)
else
arg_0
.
Cpgm
return
Rowlinson_Poling
(
arg_1
,
arg_0
.
Tc
,
arg_0
.
omega
,
arg_3
)
elif
arg_2
==
ROWLINSON_BONDI
:
arg_3
=
arg_0
.
Cpgm
(
arg_1
)
if
hasattr
(
arg_0
.
Cpgm
,
'__call__'
)
else
arg_0
.
Cpgm
return
Rowlinson_Bondi
(
arg_1
,
arg_0
.
Tc
,
arg_0
.
omega
,
arg_3
)
elif
arg_2
==
DADGOSTAR_SHAW
:
arg_4
=
Dadgostar_Shaw
(
arg_1
,
arg_0
.
similarity_variable
)
return
property_mass_to_molar
(
arg_4
,
arg_0
.
MW
)
elif
arg_2
in
arg_0
.
tabular_data
:
return
arg_0
.
interpolate
(
arg_1
,
arg_2
)
else
:
raise
Exception
(
'Method not valid'
)

def Func(arg_0, arg_1, arg_2):
        r'''Method to Func heat capacity of a liquid at temperature `T`
        with a given method.

        This method has no exception handling; see `T_dependent_property`
        for that.

        Parameters
        ----------
        T : float
            Temperature at which to Func heat capacity, [K]
        method : str
            Name of the method to use

        Returns
        -------
        Cp : float
            Heat capacity of the liquid at T, [J/mol/K]
        '''
        if arg_2 == ZABRANSKY_SPLINE:
            return arg_0.Zabransky_spline.Func(arg_1)
        elif arg_2 == ZABRANSKY_QUASIPOLYNOMIAL:
            return arg_0.Zabransky_quasipolynomial.Func(arg_1)
        elif arg_2 == ZABRANSKY_SPLINE_C:
            return arg_0.Zabransky_spline_iso.Func(arg_1)
        elif arg_2 == ZABRANSKY_QUASIPOLYNOMIAL_C:
            return arg_0.Zabransky_quasipolynomial_iso.Func(arg_1)
        elif arg_2 == ZABRANSKY_SPLINE_SAT:
            return arg_0.Zabransky_spline_sat.Func(arg_1)
        elif arg_2 == ZABRANSKY_QUASIPOLYNOMIAL_SAT:
            return arg_0.Zabransky_quasipolynomial_sat.Func(arg_1)
        elif arg_2 == COOLPROP:
            return CoolProp_T_dependent_property(arg_1, arg_0.CASRN , 'CPMOLAR', 'l')
        elif arg_2 == POLING_CONST:
            return arg_0.POLING_constant
        elif arg_2 == CRCSTD:
            return arg_0.CRCSTD_constant
        elif arg_2 == ROWLINSON_POLING:
            arg_3 = arg_0.Cpgm(arg_1) if hasattr(arg_0.Cpgm, '__call__') else arg_0.Cpgm
            return Rowlinson_Poling(arg_1, arg_0.Tc, arg_0.omega, arg_3)
        elif arg_2 == ROWLINSON_BONDI:
            arg_3 = arg_0.Cpgm(arg_1) if hasattr(arg_0.Cpgm, '__call__') else arg_0.Cpgm
            return Rowlinson_Bondi(arg_1, arg_0.Tc, arg_0.omega, arg_3)
        elif arg_2 == DADGOSTAR_SHAW:
            arg_4 = Dadgostar_Shaw(arg_1, arg_0.similarity_variable)
            return property_mass_to_molar(arg_4, arg_0.MW)
        elif arg_2 in arg_0.tabular_data:
            return arg_0.interpolate(arg_1, arg_2)
        else:
            raise Exception('Method not valid')

r'''Method to calculate heat capacity of a liquid at temperature `T`
        with a given method.

        This method has no exception handling; see `T_dependent_property`
        for that.

        Parameters
        ----------
        T : float
            Temperature at which to calculate heat capacity, [K]
        method : str
            Name of the method to use

        Returns
        -------
        Cp : float
            Heat capacity of the liquid at T, [J/mol/K]

r Method to calculate heat capacity of a liquid at temperature T with a given method .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = 'milestones/{}' . format ( arg_1 ) arg_4 = make_get_request ( arg_0 , arg_3 , params_data = arg_2 ) arg_5 = arg_4 . json ( ) if arg_4 . status_code == 200 : return arg_5 [ 'result' ] else : raise MilestonesNotFoundException ( message = arg_5 [ 'message' ] , error_code = arg_5 [ 'error_code' ] , request_id = arg_5 [ 'request_id' ] )

def Func(arg_0, arg_1, arg_2=None):
    """
    Get a specific milestone
    """
    # GET /api/projects/0.1/milestones/{milestone_id}/
    arg_3 = 'milestones/{}'.format(arg_1)

    arg_4 = make_get_request(arg_0, arg_3, params_data=arg_2)
    arg_5 = arg_4.json()
    if arg_4.status_code == 200:
        return arg_5['result']
    else:
        raise MilestonesNotFoundException(
            message=arg_5['message'],
            error_code=arg_5['error_code'],
            request_id=arg_5['request_id']
        )


def Func ( arg_0 , arg_1 ) : if arg_1 not in arg_0 . mapping : return False arg_2 = arg_0 . get_path_by_name ( arg_0 . mapping [ arg_1 ] ) return os . path . isfile ( arg_2 )

def Func(arg_0, arg_1):
        """Does a notebook exist?"""
        if arg_1 not in arg_0.mapping:
            return False
        arg_2 = arg_0.get_path_by_name(arg_0.mapping[arg_1])
        return os.path.isfile(arg_2)


def Func(arg_0, arg_1):
        """Get a Func by its ID"""

        arg_2 = urijoin(CRATES_API_URL, CATEGORY_CRATES, arg_1)
        arg_3 = arg_0.fetch(arg_2)

        return arg_3