def Func ( arg_0 ) : arg_1 = arg_0 . task . retry_delay if arg_0 . task . retry_exponential_backoff : arg_2 = int ( arg_1 . total_seconds ( ) * ( 2 ** ( arg_0 . try_number - 2 ) ) ) arg_3 = int ( hashlib . sha1 ( "{}#{}#{}#{}" . format ( arg_0 . dag_id , arg_0 . task_id , arg_0 . execution_date , arg_0 . try_number ) . encode ( 'utf-8' ) ) . hexdigest ( ) , 16 ) arg_4 = arg_2 + arg_3 % arg_2 arg_5 = min ( arg_4 , timedelta . max . total_seconds ( ) - 1 ) arg_1 = timedelta ( seconds = arg_5 ) if arg_0 . task . max_retry_delay : arg_1 = min ( arg_0 . task . max_retry_delay , arg_1 ) return arg_0 . end_date + arg_1

def Func(arg_0):
        """
        Get datetime of the next retry if the task instance fails. For exponential
        backoff, retry_delay is used as base and will be converted to seconds.
        """
        arg_1 = arg_0.task.retry_delay
        if arg_0.task.retry_exponential_backoff:
            arg_2 = int(arg_1.total_seconds() * (2 ** (arg_0.try_number - 2)))
            # deterministic per task instance
            arg_3 = int(hashlib.sha1("{}#{}#{}#{}".format(arg_0.dag_id,
                                                         arg_0.task_id,
                                                         arg_0.execution_date,
                                                         arg_0.try_number)
                                    .encode('utf-8')).hexdigest(), 16)
            # between 0.5 * delay * (2^retry_number) and 1.0 * delay * (2^retry_number)
            arg_4 = arg_2 + arg_3 % arg_2
            # timedelta has a maximum representable value. The exponentiation
            # here means this value can be exceeded after a certain number
            # of tries (around 50 if the initial delay is 1s, even fewer if
            # the delay is larger). Cap the value here before creating a
            # timedelta object so the operation doesn't fail.
            arg_5 = min(
                arg_4,
                timedelta.max.total_seconds() - 1
            )
            arg_1 = timedelta(seconds=arg_5)
            if arg_0.task.max_retry_delay:
                arg_1 = min(arg_0.task.max_retry_delay, arg_1)
        return arg_0.end_date + arg_1

Get datetime of the next retry if the task instance fails . For exponential backoff retry_delay is used as base and will be converted to seconds .


def
Func
(
arg_0
,
**
arg_1
)
:
arg_0
.
_fill_project_info
(
arg_1
)
arg_0
.
db
.
Model
.
delete_many
(
arg_1
)
logging
.
info
(
"[Database] Delete Model SUCCESS"
)

def Func(arg_0, **arg_1):
        """Delete model.

        Parameters
        -----------
        kwargs : logging information
            Find items to delete, leave it empty to delete all log.
        """
        arg_0._fill_project_info(arg_1)
        arg_0.db.Model.delete_many(arg_1)
        logging.info("[Database] Delete Model SUCCESS")


def Func ( arg_0 = 0.0 , arg_1 = arg_2 , arg_3 = 20 ) : arg_4 = init . create_two_particle_state ( imsize = 6 * arg_1 + 4 , axis = 'x' , sigma = 1.0 / arg_3 , delta = arg_0 , arg_1 = arg_1 , stateargs = { 'varyn' : True } , psfargs = { 'error' : 1e-6 } ) arg_4 . obj . typ [ 1 ] = 0. arg_4 . reset ( ) return arg_4 , arg_4 . obj . pos . copy ( )

def Func(arg_0=0.0, arg_1=arg_2, arg_3=20):
    """ create a two particle state and compare it to featuring using a single particle guess """
    # create a base image of one particle
    arg_4 = init.create_two_particle_state(imsize=6*arg_1+4, axis='x', sigma=1.0/arg_3,
            delta=arg_0, arg_1=arg_1, stateargs={'varyn': True}, psfargs={'error': 1e-6})
    arg_4.obj.typ[1] = 0.
    arg_4.reset()

    return arg_4, arg_4.obj.pos.copy()


def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : arg_0 . style = '' arg_0 . underline = False elif arg_0 . family == ( 'symbol' or 'zapfdingbats' ) : arg_0 . style = '' arg_0 . underline = False arg_0 . style = arg_1 . upper ( ) if 'U' in arg_0 . style or arg_0 . style == 'U' : arg_0 . underline = True else : arg_0 . underline = False

def Func(arg_0, arg_1=None):
        """ Style should be a string, containing the letters 'B' for bold,
        'U' for underline, or 'I' for italic, or should be '', for no style.
        Symbol will not be underlined. The underline style can further be
        modified by specifying the underline thickness and position.

        """
        if arg_1 is None:
            arg_0.style = ''
            arg_0.underline = False
        # No syling for symbol
        elif arg_0.family == ('symbol' or 'zapfdingbats'):
            arg_0.style = ''
            arg_0.underline = False

        arg_0.style = arg_1.upper()
            # SetUnderline

        if 'U' in arg_0.style or arg_0.style == 'U':
            arg_0.underline = True
        else:
            arg_0.underline = False

Style should be a string containing the letters B for bold U for underline or I for italic or should be for no style . Symbol will not be underlined . The underline style can further be modified by specifying the underline thickness and position .


def
Func
(
arg_0
)
:
if
isinstance
(
arg_0
,
tuple
)
:
return
'function'
arg_0
,
arg_1
,
arg_1
=
arg_0
.
partition
(
' '
)
if
os
.
path
.
isdir
(
arg_0
)
:
return
'package'
return
'module'

def Func(arg_0):
        """Determines run object type."""
        if isinstance(arg_0, tuple):
            return 'function'
        arg_0, arg_1, arg_1 = arg_0.partition(' ')
        if os.path.isdir(arg_0):
            return 'package'
        return 'module'


(self, uc, access, address, size, value, data)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):
        """
        Captures memory written by Unicorn
        """
        arg_0._mem_delta[arg_3] = (arg_5, arg_4)
        return True


def Func(arg_0):
    """
    Returns a randomly generated permanence value for a synapses that is
    initialized in a connected state. The basic idea here is to initialize
    permanence values very close to synPermConnected so that a small number of
    learning steps could make it disconnected or connected.

    Note: experimentation was done a long time ago on the best way to initialize
    permanence values, but the history for this particular scheme has been lost.
    """
    arg_1 = arg_0._synPermConnected + (
        arg_0._synPermMax - arg_0._synPermConnected)*arg_0._random.getReal64()

    # Ensure we don't have too much unnecessary precision. A full 64 bits of
    # precision causes numerical stability issues across platforms and across
    # implementations
    arg_1 = int(arg_1*100000) / 100000.0
    return arg_1

Returns a randomly generated permanence value for a synapses that is initialized in a connected state . The basic idea here is to initialize permanence values very close to synPermConnected so that a small number of learning steps could make it disconnected or connected .


def Func ( arg_0 , arg_1 , arg_2 = False ) : _AssertIsLocal ( arg_0 ) _AssertIsLocal ( arg_1 ) if arg_2 and IsDir ( arg_1 ) : DeleteDirectory ( arg_1 , skip_on_error = False ) import shutil shutil . copytree ( arg_0 , arg_1 )

def Func(arg_0, arg_1, arg_2=False):
    '''
    Recursively copy a directory tree.

    :param unicode source_dir:
        Where files will come from

    :param unicode target_dir:
        Where files will go to

    :param bool override:
        If True and target_dir already exists, it will be deleted before copying.

    :raises NotImplementedForRemotePathError:
        If trying to copy to/from remote directories
    '''
    _AssertIsLocal(arg_0)
    _AssertIsLocal(arg_1)

    if arg_2 and IsDir(arg_1):
        DeleteDirectory(arg_1, skip_on_error=False)

    import shutil
    shutil.copytree(arg_0, arg_1)


def Func ( arg_0 , * arg_1 , ** arg_2 ) : arg_3 = object ( ) arg_4 = [ arg_3 ] def evaluate ( ) : if arg_4 [ 0 ] is arg_3 : arg_4 [ 0 ] = arg_0 ( * arg_1 , ** arg_2 ) return arg_4 [ 0 ] return evaluate

def Func(arg_0, *arg_1, **arg_2):
    ''' Produces a callable so that functions can be lazily evaluated in
    templates.

    Arguments:

        function (callable): The function to call at evaluation time.

        args: Positional arguments, passed directly to ``function``.

        kwargs: Keyword arguments, passed directly to ``function``.

    Return:

        callable: A callable that will evaluate a call to ``function`` with
            the specified arguments.

    '''

    arg_3 = object()
    arg_4 = [arg_3]

    def evaluate():
        if arg_4[0] is arg_3:
            arg_4[0] = arg_0(*arg_1, **arg_2)
        return arg_4[0]

    return evaluate

Produces a callable so that functions can be lazily evaluated in templates .


(fx, gx, x, fx_gx_manually_stopped=False, name=None)

def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=None):
  """Embeds a custom gradient into a `Tensor`.

  This function works by clever application of `stop_gradient`. I.e., observe
  that:

  ```none
  h(x) = stop_gradient(f(x)) + stop_gradient(g(x)) * (x - stop_gradient(x))
  ```

  is such that `h(x) == stop_gradient(f(x))` and
  `grad[h(x), x] == stop_gradient(g(x)).`

  In addition to scalar-domain/scalar-range functions, this function also
  supports tensor-domain/scalar-range functions.

  Partial Custom Gradient:

  Suppose `h(x) = htilde(x, y)`. Note that `dh/dx = stop(g(x))` but `dh/dy =
  None`. This is because a `Tensor` cannot have only a portion of its gradient
  stopped. To circumvent this issue, one must manually `stop_gradient` the
  relevant portions of `f`, `g`. For example see the unit-test,
  `test_works_correctly_fx_gx_manually_stopped`.

  Args:
    fx: `Tensor`. Output of function evaluated at `x`.
    gx: `Tensor` or list of `Tensor`s. Gradient of function at (each) `x`.
    x: `Tensor` or list of `Tensor`s. Args of evaluation for `f`.
    fx_gx_manually_stopped: Python `bool` indicating that `fx`, `gx` manually
      have `stop_gradient` applied.
    name: Python `str` name prefixed to Ops created by this function.

  Returns:
    fx: Floating-type `Tensor` equal to `f(x)` but which has gradient
      `stop_gradient(g(x))`.
  """
  def maybe_stop(arg_2):
    if arg_3:
      return arg_2
    return tf.stop_gradient(arg_2)

  with tf.compat.v1.name_scope(arg_4, 'Func', [arg_0, arg_1, arg_2]):
    arg_0 = tf.convert_to_tensor(value=arg_0, arg_4='fx')
    # We don't want to bother eagerly computing `gx` since we may not even need
    # it.
    with tf.control_dependencies([arg_0]):
      if is_list_like(arg_2):
        arg_2 = [identity(arg_6, arg_4='x') for arg_6 in arg_2]
      else:
        arg_2 = [identity(arg_2, arg_4='x')]

      if is_list_like(arg_1):
        arg_1 = [identity(arg_7, dtype=arg_0.dtype, arg_4='gx')
              for arg_7 in arg_1]
      else:
        arg_1 = [identity(arg_1, dtype=arg_0.dtype, arg_4='gx')]

      arg_5 = []
      for arg_6, arg_7 in zip(arg_2, arg_1):
        # Observe: tf.gradients(f(x), x)[i].shape == x[i].shape
        # thus we check that the user is supplying correct shapes.
        arg_8 = tf.compat.v1.assert_equal(
            tf.shape(input=arg_6),
            tf.shape(input=arg_7),
            message='Each `x` must have the same shape as each `gx`.')
        with tf.control_dependencies([arg_8]):
          # IEEE754 ensures `(x-x)==0.` and that `0.*x==0.` so we make sure to
          # write the code this way, rather than, e.g.,
          # `sum_x * stop(gx) + stop(fx - sum_x * gx)`.
          # For more discussion regarding the relevant portions of the IEEE754
          # standard, see the StackOverflow question,
          # "Is there a floating point value of x, for which x-x == 0 is false?"
          # http://stackoverflow.com/q/2686644
          arg_9 = arg_6 - tf.stop_gradient(arg_6)
          arg_5.append(
              tf.reduce_sum(input_tensor=maybe_stop(arg_7) * arg_9))
      arg_5 = sum(arg_5)
      arg_5 /= tf.cast(tf.size(input=arg_0), dtype=arg_0.dtype.base_dtype)

      # Proof of correctness:
      #
      #  f(x) = x * stop[gx] + stop[fx - x * gx]
      #       = stop[fx]
      #
      #  g(x) = grad[fx]
      #       = stop[gx] + grad[stop[fx - x * gx]]
      #       = stop[gx] + 0
      #
      # Notice that when x is zero it still works:
      # grad[x * stop(gx) + stop(fx - x * gx)] = 1 * stop[gx] + 0 = stop[gx]
      #
      # The proof is similar for the tensor-domain case, except that we
      # `reduce_sum` the `stop[gx] * (x - stop[x])` then rescale by
      # `tf.size(fx)` since this reduced version is broadcast to `fx`.
      return maybe_stop(arg_0) + arg_5

Embeds a custom gradient into a Tensor .


def Func ( arg_0 ) : arg_1 = peek ( ) try : if ( arg_1 is EndOfFile ) or ( arg_1 not in arg_0 ) : fail ( list ( arg_0 ) ) except TypeError : if arg_1 != arg_0 : fail ( [ arg_0 ] ) next ( ) return arg_1

def Func(arg_0):
    """Returns the current token if is found in the collection provided.

    Fails otherwise.
    """
    arg_1 = peek()
    try:
        if (arg_1 is EndOfFile) or (arg_1 not in arg_0):
            fail(list(arg_0))
    except TypeError:
        if arg_1 != arg_0:
            fail([arg_0])
    next()
    return arg_1

Returns the current token if is found in the collection provided . Fails otherwise .


def
Func
(
arg_0
)
:
validate_type
(
arg_0
)
def
arg_8
(
arg_1
)
:
arg_2
=
lambda
f
,
*
arg_6
,
**
k
:
f
(
*
arg_6
,
**
k
)
if
callable
(
arg_1
)
:
arg_3
=
arg_1
arg_4
=
arg_3
.
func_name
arg_5
=
decorator
(
arg_2
,
arg_3
)
record_magic
(
magics
,
arg_0
,
arg_4
,
arg_4
)
elif
isinstance
(
arg_1
,
basestring
)
:
arg_4
=
arg_1
def
mark
(
arg_3
,
*
arg_6
,
**
arg_7
)
:
record_magic
(
magics
,
arg_0
,
arg_4
,
arg_3
.
func_name
)
return
decorator
(
arg_2
,
arg_3
)
arg_5
=
mark
else
:
raise
TypeError
(
"Decorator can only be called with "
"string or function"
)
return
arg_5
arg_8
.
__doc__
=
_docstring_template
.
format
(
'method'
,
arg_0
)
return
arg_8

def Func(arg_0):
    """Decorator factory for methods in Magics subclasses.
    """

    validate_type(arg_0)

    # This is a closure to capture the magic_kind.  We could also use a class,
    # but it's overkill for just that one bit of state.
    def arg_8(arg_1):
        arg_2 = lambda f, *arg_6, **k: f(*arg_6, **k)

        if callable(arg_1):
            # "Naked" decorator call (just @foo, no args)
            arg_3 = arg_1
            arg_4 = arg_3.func_name
            arg_5 = decorator(arg_2, arg_3)
            record_magic(magics, arg_0, arg_4, arg_4)
        elif isinstance(arg_1, basestring):
            # Decorator called with arguments (@foo('bar'))
            arg_4 = arg_1
            def mark(arg_3, *arg_6, **arg_7):
                record_magic(magics, arg_0, arg_4, arg_3.func_name)
                return decorator(arg_2, arg_3)
            arg_5 = mark
        else:
            raise TypeError("Decorator can only be called with "
                            "string or function")
        return arg_5

    # Ensure the resulting decorator has a usable docstring
    arg_8.__doc__ = _docstring_template.format('method', arg_0)
    return arg_8

Decorator factory for methods in Magics subclasses .


return lambda **kwargs: interpret.run_function(metamodel, label,
                                                   action, kwargs)

def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 . Action_Semantics_internal arg_3 = arg_1 . Name return lambda ** kwargs : interpret . run_function ( arg_0 , arg_3 , arg_2 , kwargs )

def Func(arg_0, arg_1):
    '''
    Create a python function from a BridgePoint function.
    '''
    arg_2 = arg_1.Action_Semantics_internal
    arg_3 = arg_1.Name
    return lambda **kwargs: interpret.run_function(arg_0, arg_3,
                                                   arg_2, kwargs)

Create a python function from a BridgePoint function .


def
Func
(
*
arg_0
)
:
arg_1
=
(
'--download-cache=%s '
%
options
.
paved
.
pip
.
download_cache
)
if
options
.
paved
.
pip
.
download_cache
else
''
shv
(
'pip install %s%s'
%
(
arg_1
,
' '
.
join
(
arg_0
)
)
)

def Func(*arg_0):
    """Send the given arguments to `pip install`.
    """
    arg_1 = ('--download-cache=%s ' % options.paved.pip.download_cache) if options.paved.pip.download_cache else ''
    shv('pip install %s%s' % (arg_1, ' '.join(arg_0)))

Send the given arguments to pip install .


def
Func
(
arg_0
)
:
arg_1
=
read_client_secrets
(
)
if
arg_0
in
arg_1
:
del
arg_1
[
arg_0
]
if
'SREGISTRY_CLIENT'
in
arg_1
:
if
arg_1
[
'SREGISTRY_CLIENT'
]
==
arg_0
:
del
arg_1
[
'SREGISTRY_CLIENT'
]
update_secrets
(
arg_1
)
print
(
'[delete] %s'
%
arg_0
)
else
:
if
arg_0
is
not
:
print
(
'%s is not a known client.'
%
arg_0
)
else
:
print
(
'Please specify a backend to delete.'
)

def Func(arg_0):
    '''delete a backend, and update the secrets file
    '''
    arg_1 = read_client_secrets()
    if arg_0 in arg_1:
        del arg_1[arg_0]

        # If the backend was the active client, remove too
        if 'SREGISTRY_CLIENT' in arg_1:
            if arg_1['SREGISTRY_CLIENT'] == arg_0:
                del arg_1['SREGISTRY_CLIENT']

        update_secrets(arg_1)
        print('[delete] %s' %arg_0)
    else:
        if arg_0 is not None:
            print('%s is not a known client.' %arg_0)
        else:
            print('Please specify a backend to delete.')

delete a backend and update the secrets file


def Func(arg_0, arg_1=None):
        """Set the frame of the completer."""
        if arg_1:
            arg_0.Completer.namespace = arg_1.f_locals
            arg_0.Completer.global_namespace = arg_1.f_globals
        else:
            arg_0.Completer.namespace = arg_0.user_ns
            arg_0.Completer.global_namespace = arg_0.user_global_ns


def Func ( arg_0 ) : arg_1 = arg_0 . rate_limit_reset_ts - ( datetime_utcnow ( ) . replace ( microsecond = 0 ) . timestamp ( ) + 1 ) if arg_1 < 0 : arg_1 = 0 return arg_1

def Func(arg_0):
        """Calculate the seconds to reset the token requests, by obtaining the different
        between the current date and the next date when the token is fully regenerated.
        """

        arg_1 = arg_0.rate_limit_reset_ts - (datetime_utcnow().replace(microsecond=0).timestamp() + 1)

        if arg_1 < 0:
            arg_1 = 0

        return arg_1

Calculate the seconds to reset the token requests by obtaining the different between the current date and the next date when the token is fully regenerated .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = len ( arg_0 ) arg_4 = np . zeros ( arg_3 , dtype = "uint32" ) arg_5 = int ( arg_1 * arg_2 ) for arg_6 in range ( arg_3 ) : arg_4 [ arg_6 ] = arg_0 [ arg_6 ] for arg_7 in range ( arg_5 ) : arg_6 = random . randrange ( arg_3 ) if arg_4 [ arg_6 ] == 1 : arg_4 [ arg_6 ] = 0 else : arg_4 [ arg_6 ] = 1 return arg_4

def Func(arg_0, arg_1, arg_2):
  """
  Corrupts a copy of a binary vector by inverting noiseLevel percent of its bits.

  @param v1      (array) binary vector whose copy will be corrupted
  @param noiseLevel  (float) amount of noise to be applied on the new vector
  @param numActiveCols (int)   number of sparse columns that represent an input

  @return v2 (array) corrupted binary vector
  """
  arg_3 = len(arg_0)
  arg_4 = np.zeros(arg_3, dtype="uint32")
  arg_5 = int(arg_1 * arg_2)
  # Copy the contents of v1 into v2
  for arg_6 in range(arg_3):
    arg_4[arg_6] = arg_0[arg_6]
  for arg_7 in range(arg_5):
    arg_6 = random.randrange(arg_3)
    if arg_4[arg_6] == 1:
      arg_4[arg_6] = 0
    else:
      arg_4[arg_6] = 1
  return arg_4

Corrupts a copy of a binary vector by inverting noiseLevel percent of its bits .


(script, iterations=10, t_lambda=0.5, t_mu=-0.53, selected=False)

def Func(arg_0, arg_1=10, arg_2=0.5, arg_3=-0.53, arg_4=False):
    """ The lambda & mu Taubin smoothing, it make two steps of smoothing, forth
        and back, for each iteration.

    Based on:
    Gabriel Taubin
    "A signal processing approach to fair surface design"
    Siggraph 1995

    Args:
        script: the FilterScript object or script filename to write
            the filter to.
        iterations (int): The number of times that the Func smoothing is
            iterated. Usually it requires a larger number of iteration than the
            classical laplacian.
        t_lambda (float): The lambda parameter of the Taubin Smoothing algorithm
        t_mu (float): The mu parameter of the Taubin Smoothing algorithm
        selected (bool): If selected the filter is performed only on the
            selected faces

    Layer stack:
        No impacts

    MeshLab versions:
        2016.12
        1.3.4BETA
    """
    arg_5 = ''.join([
        '  <filter name="Taubin Smooth">\n',
        '    <Param name="lambda" ',
        'value="{}" '.format(arg_2),
        'description="Lambda" ',
        'type="RichFloat" ',
        '/>\n',
        '    <Param name="mu" ',
        'value="{}" '.format(arg_3),
        'description="mu" ',
        'type="RichFloat" ',
        '/>\n',
        '    <Param name="stepSmoothNum" ',
        'value="{:d}" '.format(arg_1),
        'description="Smoothing steps" ',
        'type="RichInt" ',
        '/>\n',
        '    <Param name="Selected" ',
        'value="{}" '.format(str(arg_4).lower()),
        'description="Affect only selected faces" ',
        'type="RichBool" ',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(arg_0, arg_5)
    return None

The lambda & mu Taubin smoothing, it make two steps of smoothing, forth
        and back, for each iteration.

    Based on:
    Gabriel Taubin
    "A signal processing approach to fair surface design"
    Siggraph 1995

    Args:
        script: the FilterScript object or script filename to write
            the filter to.
        iterations (int): The number of times that the taubin smoothing is
            iterated. Usually it requires a larger number of iteration than the
            classical laplacian.
        t_lambda (float): The lambda parameter of the Taubin Smoothing algorithm
        t_mu (float): The mu parameter of the Taubin Smoothing algorithm
        selected (bool): If selected the filter is performed only on the
            selected faces

    Layer stack:
        No impacts

    MeshLab versions:
        2016.12
        1.3.4BETA

The lambda & mu Taubin smoothing it make two steps of smoothing forth and back for each iteration .


def Func(arg_0, arg_1, arg_2, arg_3, arg_4=(0, 255, 0), arg_5=25):
    """
    Draw text on an image.

    This uses by default DejaVuSans as its font, which is included in this library.

    dtype support::

        * ``uint8``: yes; fully tested
        * ``uint16``: no
        * ``uint32``: no
        * ``uint64``: no
        * ``int8``: no
        * ``int16``: no
        * ``int32``: no
        * ``int64``: no
        * ``float16``: no
        * ``float32``: yes; not tested
        * ``float64``: no
        * ``float128``: no
        * ``bool``: no

        TODO check if other dtypes could be enabled

    Parameters
    ----------
    img : (H,W,3) ndarray
        The image array to draw text on.
        Expected to be of dtype uint8 or float32 (value range 0.0 to 255.0).

    y : int
        x-coordinate of the top left corner of the text.

    x : int
        y- coordinate of the top left corner of the text.

    text : str
        The text to draw.

    color : iterable of int, optional
        Color of the text to draw. For RGB-images this is expected to be an RGB color.

    size : int, optional
        Font size of the text to draw.

    Returns
    -------
    img_np : (H,W,3) ndarray
        Input image with text drawn on it.

    """
    do_assert(arg_0.dtype in [np.uint8, np.float32])

    arg_6 = arg_0.dtype
    if arg_0.dtype == np.float32:
        arg_0 = arg_0.astype(np.uint8)

    arg_0 = PIL_Image.fromarray(arg_0)
    arg_7 = PIL_ImageFont.truetype(DEFAULT_FONT_FP, arg_5)
    arg_8 = PIL_ImageDraw.Draw(arg_0)
    arg_8.text((arg_2, arg_1), arg_3, fill=tuple(arg_4), arg_7=arg_7)
    arg_9 = np.asarray(arg_0)

    # PIL/asarray returns read only array
    if not arg_9.flags["WRITEABLE"]:
        try:
            # this seems to no longer work with np 1.16 (or was pillow updated?)
            arg_9.setflags(write=True)
        except ValueError as ex:
            if "cannot set WRITEABLE flag to True of this array" in str(ex):
                arg_9 = np.copy(arg_9)

    if arg_9.dtype != arg_6:
        arg_9 = arg_9.astype(arg_6)

    return arg_9


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] with open ( os . path . join ( arg_0 , arg_1 ) , 'r' ) as f : for arg_3 in f : arg_4 = arg_3 . split ( ) arg_2 . append ( [ int ( arg_4 [ 0 ] ) , int ( arg_4 [ 3 ] ) , int ( arg_4 [ 1 ] == arg_4 [ 4 ] ) ] ) return torch . LongTensor ( arg_2 )

def Func(arg_0, arg_1):
    """Return a Tensor containing the ground truth matches
       Read the file and keep only 3D point ID.
       Matches are represented with a 1, non matches with a 0.
    """
    arg_2 = []
    with open(os.path.join(arg_0, arg_1), 'r') as f:
        for arg_3 in f:
            arg_4 = arg_3.split()
            arg_2.append([int(arg_4[0]), int(arg_4[3]),
                            int(arg_4[1] == arg_4[4])])
    return torch.LongTensor(arg_2)

Return a Tensor containing the ground truth matches Read the file and keep only 3D point ID . Matches are represented with a 1 non matches with a 0 .


def Func ( arg_0 , arg_1 ) : arg_2 = many ( arg_1 ) . S_BRG [ 19 ] ( ) arg_3 = [ brg . Name for brg in arg_2 ] arg_4 = collections . namedtuple ( arg_1 . Key_Lett , arg_3 ) arg_5 = list ( ) for arg_6 in many ( arg_1 ) . S_BRG [ 19 ] ( ) : arg_7 = mk_bridge ( arg_0 , arg_6 ) arg_5 . append ( arg_7 ) return arg_4 ( * arg_5 )

def Func(arg_0, arg_1):
    '''
    Create a python object from a BridgePoint external entity with bridges
    realized as python member functions.
    '''
    arg_2 = many(arg_1).S_BRG[19]()
    arg_3 = [brg.Name for brg in arg_2]
    arg_4 = collections.namedtuple(arg_1.Key_Lett, arg_3)

    arg_5 = list()
    for arg_6 in many(arg_1).S_BRG[19]():
        arg_7 = mk_bridge(arg_0, arg_6)
        arg_5.append(arg_7)

    return arg_4(*arg_5)

Create a python object from a BridgePoint external entity with bridges realized as python member functions .


def Func ( arg_0 : arg_1 ) : arg_2 = request . get_json ( ) arg_3 = arg_2 [ 'request' ] . get ( 'command' , '' ) . strip ( ) arg_4 = arg_2 [ 'request' ] . get ( 'payload' ) arg_5 = arg_2 [ 'session' ] [ 'session_id' ] arg_6 = arg_2 [ 'session' ] [ 'user_id' ] arg_7 = arg_2 [ 'session' ] [ 'message_id' ] arg_8 = DialogID ( arg_6 , arg_5 ) arg_9 = { 'response' : { 'end_session' : True , 'text' : '' } , "session" : { 'session_id' : arg_5 , 'message_id' : arg_7 , 'user_id' : arg_6 } , 'version' : '1.0' } arg_10 : Union [ str , RichMessage ] = arg_0 ( [ arg_4 or arg_3 ] , [ arg_8 ] ) [ 0 ] if isinstance ( arg_10 , RichMessage ) : arg_9 [ 'response' ] [ 'text' ] = '\n' . join ( [ j [ 'content' ] for j in arg_10 . json ( ) if j [ 'type' ] == 'plain_text' ] ) else : arg_9 [ 'response' ] [ 'text' ] = str ( arg_10 ) return jsonify ( arg_9 ) , 200

def Func(arg_0: arg_1):
    """
    Exchange messages between basic pipelines and the Yandex.Dialogs service.
    If the pipeline returns multiple values, only the first one is forwarded to Yandex.
    """
    arg_2 = request.get_json()
    arg_3 = arg_2['request'].get('command', '').strip()
    arg_4 = arg_2['request'].get('payload')

    arg_5 = arg_2['session']['session_id']
    arg_6 = arg_2['session']['user_id']
    arg_7 = arg_2['session']['message_id']

    arg_8 = DialogID(arg_6, arg_5)

    arg_9 = {
        'response': {
            'end_session': True,
            'text': ''
        },
        "session": {
            'session_id': arg_5,
            'message_id': arg_7,
            'user_id': arg_6
        },
        'version': '1.0'
    }

    arg_10: Union[str, RichMessage] = arg_0([arg_4 or arg_3], [arg_8])[0]
    if isinstance(arg_10, RichMessage):
        arg_9['response']['text'] = '\n'.join([j['content']
                                                  for j in arg_10.json()
                                                  if j['type'] == 'plain_text'])
    else:
        arg_9['response']['text'] = str(arg_10)

    return jsonify(arg_9), 200

Exchange messages between basic pipelines and the Yandex . Dialogs service . If the pipeline returns multiple values only the first one is forwarded to Yandex .


def Func(arg_0, arg_1, arg_2='37'):
        """Check if a hgnc symbol is an alias

            Return the correct hgnc symbol, if not existing return None

            Args:
                hgnc_alias(str)

            Returns:
                hgnc_symbol(str)
        """
        arg_3 = arg_0.hgnc_genes(hgnc_symbol=arg_1, arg_2=arg_2)
        if arg_3:
            for arg_4 in arg_3:
                return arg_4['hgnc_symbol']
        else:
            return None


def Func ( arg_0 , arg_1 ) : arg_2 = ET . Element ( 'xs:element' , name = arg_1 . name ) arg_3 = ET . SubElement ( arg_2 , 'xs:complexType' ) arg_3 = ET . SubElement ( arg_3 , 'xs:sequence' ) arg_4 = lambda selected : ooaofooa . is_contained_in ( selected , arg_1 ) for arg_5 in arg_0 . select_many ( 'O_OBJ' , arg_4 ) : arg_6 = build_class ( arg_5 ) arg_3 . append ( arg_6 ) return arg_2

def Func(arg_0, arg_1):
    '''
    Build an xsd complex element out of a C_C, including its packaged S_DT and O_OBJ.
    '''
    arg_2 = ET.Element('xs:element', name=arg_1.name)

    arg_3 = ET.SubElement(arg_2, 'xs:complexType')
    arg_3 = ET.SubElement(arg_3, 'xs:sequence')

    arg_4 = lambda selected: ooaofooa.is_contained_in(selected, arg_1)

    for arg_5 in arg_0.select_many('O_OBJ', arg_4):
        arg_6 = build_class(arg_5)
        arg_3.append(arg_6)

    return arg_2

Build an xsd complex element out of a C_C including its packaged S_DT and O_OBJ .


def
Func
(
arg_0
)
:
arg_1
=
'&=+'
arg_2
=
'-_.~'
if
PY2
:
arg_0
=
arg_0
.
encode
(
'utf-8'
)
arg_1
=
arg_1
.
encode
(
)
arg_2
=
arg_2
.
encode
(
)
arg_0
=
unquote
(
arg_0
)
arg_3
=
b' '
if
PY2
else
' '
arg_0
=
arg_0
.
split
(
arg_3
)
[
0
]
arg_0
=
quote
(
arg_0
,
safe
=
arg_1
)
arg_4
=
{
}
for
arg_5
,
arg_6
in
parse_qs
(
arg_0
,
keep_blank_values
=
True
)
.
items
(
)
:
arg_5
=
quote
(
arg_5
,
safe
=
arg_2
)
arg_6
=
[
quote
(
arg_8
,
safe
=
arg_2
)
for
arg_8
in
arg_6
]
arg_4
[
arg_5
]
=
arg_6
arg_7
=
[
]
for
arg_5
,
arg_6
in
arg_4
.
items
(
)
:
for
arg_8
in
arg_6
:
arg_7
.
append
(
'='
.
join
(
[
arg_5
,
arg_8
]
)
)
arg_0
=
'&'
.
join
(
sorted
(
arg_7
)
)
if
PY2
:
arg_0
=
unicode
(
arg_0
)
return
arg_0

def Func(arg_0):
        """
        Parse and format querystring as per AWS4 auth requirements.

        Perform percent quoting as needed.

        qs -- querystring

        """
        arg_1 = '&=+'
        arg_2 = '-_.~'
        # If Python 2, switch to working entirely in str
        # as quote() has problems with Unicode
        if PY2:
            arg_0 = arg_0.encode('utf-8')
            arg_1 = arg_1.encode()
            arg_2 = arg_2.encode()
        arg_0 = unquote(arg_0)
        arg_3 = b' ' if PY2 else ' '
        arg_0 = arg_0.split(arg_3)[0]
        arg_0 = quote(arg_0, safe=arg_1)
        arg_4 = {}
        for arg_5, arg_6 in parse_qs(arg_0, keep_blank_values=True).items():
            arg_5 = quote(arg_5, safe=arg_2)
            arg_6 = [quote(arg_8, safe=arg_2) for arg_8 in arg_6]
            arg_4[arg_5] = arg_6
        arg_7 = []
        for arg_5, arg_6 in arg_4.items():
            for arg_8 in arg_6:
                arg_7.append('='.join([arg_5, arg_8]))
        arg_0 = '&'.join(sorted(arg_7))
        if PY2:
            arg_0 = unicode(arg_0)
        return arg_0

Parse and format querystring as per AWS4 auth requirements .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_4
=
figure
.
Figure
(
figsize
=
(
6
,
3
)
)
arg_5
=
backend_agg
.
FigureCanvasAgg
(
arg_4
)
arg_6
=
arg_4
.
add_subplot
(
1
,
2
,
1
)
for
arg_7
,
arg_8
in
zip
(
arg_0
,
arg_1
)
:
sns
.
distplot
(
arg_8
.
flatten
(
)
,
arg_6
=
arg_6
,
label
=
arg_7
)
arg_6
.
set_title
(
"weight means"
)
arg_6
.
set_xlim
(
[
1.5
,
1.5
]
)
arg_6
.
legend
(
)
arg_6
=
arg_4
.
add_subplot
(
1
,
2
,
2
)
for
arg_7
,
arg_9
in
zip
(
arg_0
,
arg_2
)
:
sns
.
distplot
(
arg_9
.
flatten
(
)
,
arg_6
=
arg_6
)
arg_6
.
set_title
(
"weight stddevs"
)
arg_6
.
set_xlim
(
[
0
,
1.
]
)
arg_4
.
tight_layout
(
)
arg_5
.
print_figure
(
arg_3
,
format
=
"png"
)
print
(
"saved {}"
.
format
(
arg_3
)
)

def Func(arg_0, arg_1, arg_2, arg_3):
  """Save a PNG plot with histograms of weight means and stddevs.

  Args:
    names: A Python `iterable` of `str` variable names.
    qm_vals: A Python `iterable`, the same length as `names`,
      whose elements are Numpy `array`s, of any shape, containing
      posterior means of weight varibles.
    qs_vals: A Python `iterable`, the same length as `names`,
      whose elements are Numpy `array`s, of any shape, containing
      posterior standard deviations of weight varibles.
    fname: Python `str` filename to save the plot to.
  """
  arg_4 = figure.Figure(figsize=(6, 3))
  arg_5 = backend_agg.FigureCanvasAgg(arg_4)

  arg_6 = arg_4.add_subplot(1, 2, 1)
  for arg_7, arg_8 in zip(arg_0, arg_1):
    sns.distplot(arg_8.flatten(), arg_6=arg_6, label=arg_7)
  arg_6.set_title("weight means")
  arg_6.set_xlim([-1.5, 1.5])
  arg_6.legend()

  arg_6 = arg_4.add_subplot(1, 2, 2)
  for arg_7, arg_9 in zip(arg_0, arg_2):
    sns.distplot(arg_9.flatten(), arg_6=arg_6)
  arg_6.set_title("weight stddevs")
  arg_6.set_xlim([0, 1.])

  arg_4.tight_layout()
  arg_5.print_figure(arg_3, format="png")
  print("saved {}".format(arg_3))

Save a PNG plot with histograms of weight means and stddevs .


def Func ( arg_0 , Func ) : arg_2 = json . loads ( Func ) return arg_0 . object ( arg_2 )

def Func(arg_0, Func):
        """Load an object from a string and return the processed JSON content

        :return: the result of the processing step
        :param str string: the string to load the JSON from
        """
        arg_2 = json.loads(Func)
        return arg_0.object(arg_2)


(envs, labels, inputs, inputs_recursive, outputs,
                       outputs_recursive, mounts, input_file_param_util,
                       output_file_param_util, mount_param_util)

return {
      'envs': env_data,
      'inputs': input_data,
      'outputs': output_data,
      'labels': label_data,
      'mounts': mount_data,
  }

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                       arg_5, arg_6, arg_7,
                       arg_8, arg_9):
  """Parse env, input, and output parameters into a job parameters and data.

  Passing arguments on the command-line allows for launching a single job.
  The env, input, and output arguments encode both the definition of the
  job as well as the single job's values.

  Env arguments are simple name=value pairs.
  Input and output file arguments can contain name=value pairs or just values.
  Either of the following is valid:

    uri
    myfile=uri

  Args:
    envs: list of environment variable job parameters
    labels: list of labels to attach to the tasks
    inputs: list of file input parameters
    inputs_recursive: list of recursive directory input parameters
    outputs: list of file output parameters
    outputs_recursive: list of recursive directory output parameters
    mounts: list of gcs buckets to mount
    input_file_param_util: Utility for producing InputFileParam objects.
    output_file_param_util: Utility for producing OutputFileParam objects.
    mount_param_util: Utility for producing MountParam objects.

  Returns:
    job_params: a dictionary of 'envs', 'inputs', and 'outputs' that defines the
    set of parameters and data for a job.
  """
  # Parse environmental variables and labels.
  arg_10 = parse_pair_args(arg_0, job_model.EnvParam)
  arg_11 = parse_pair_args(arg_1, job_model.LabelParam)

  # For input files, we need to:
  #   * split the input into name=uri pairs (name optional)
  #   * get the environmental variable name, or automatically set if null.
  #   * create the input file param
  arg_12 = set()
  for (arg_13, arg_14) in ((False, arg_2), (True, arg_3)):
    for arg_15 in arg_14:
      arg_16, arg_17 = split_pair(arg_15, '=', nullable_idx=0)
      arg_16 = arg_7.get_variable_name(arg_16)
      arg_12.add(arg_7.make_param(arg_16, arg_17, arg_13))

  # For output files, we need to:
  #   * split the input into name=uri pairs (name optional)
  #   * get the environmental variable name, or automatically set if null.
  #   * create the output file param
  arg_18 = set()
  for (arg_13, arg_14) in ((False, arg_4), (True, arg_5)):
    for arg_15 in arg_14:
      arg_16, arg_17 = split_pair(arg_15, '=', 0)
      arg_16 = arg_8.get_variable_name(arg_16)
      arg_18.add(arg_8.make_param(arg_16, arg_17, arg_13))

  arg_19 = set()
  for arg_15 in arg_6:
    # Mounts can look like `--mount VAR=PATH` or `--mount VAR=PATH {num}`,
    # where num is the size of the disk in Gb. We assume a space is the
    # separator between path and disk size.
    if ' ' in arg_15:
      arg_20, arg_21 = arg_15.split(' ')
      arg_16, arg_17 = split_pair(arg_20, '=', 1)
      arg_19.add(arg_9.make_param(arg_16, arg_17, arg_21))
    else:
      arg_16, arg_17 = split_pair(arg_15, '=', 1)
      arg_19.add(arg_9.make_param(arg_16, arg_17, arg_21=None))
  return {
      'envs': arg_10,
      'inputs': arg_12,
      'outputs': arg_18,
      'labels': arg_11,
      'mounts': arg_19,
  }

Parse env input and output parameters into a job parameters and data .


(
    params, w_name, scope_name, inputs, layers, weights, names
)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_6
)
:
print
(
'Converting Sum ...'
)
def
target_layer
(
arg_7
)
:
import
keras
.
backend
as
K
return
K
.
sum
(
arg_7
)
arg_8
=
keras
.
layers
.
Lambda
(
target_layer
)
arg_4
[
arg_2
]
=
arg_8
(
arg_4
[
arg_3
[
0
]
]
)

def Func(
    arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6
):
    """
    Convert sum.

    Args:
        params: dictionary with layer parameters
        w_name: name prefix in state_dict
        scope_name: pytorch scope name
        inputs: pytorch node inputs
        layers: dictionary with keras tensors
        weights: pytorch state_dict
        names: use short names for keras layers
    """
    print('Converting Sum ...')

    def target_layer(arg_7):
        import keras.backend as K
        return K.sum(arg_7)

    arg_8 = keras.layers.Lambda(target_layer)
    arg_4[arg_2] = arg_8(arg_4[arg_3[0]])


def Func ( arg_0 , arg_1 = '.' ) : if not arg_0 . startswith ( '.' ) : arg_0 = '.' + arg_0 arg_1 = os . path . abspath ( arg_1 ) for arg_2 , arg_3 , arg_4 in os . walk ( arg_1 ) : for arg_5 in arg_4 : if os . path . splitext ( arg_5 ) [ - 1 ] == arg_0 : arg_6 = os . path . join ( arg_2 , arg_5 ) arg_7 = os . path . relpath ( arg_6 , start = arg_1 ) yield arg_7

def Func(arg_0, arg_1='.'):
    """Iterative over relative filepaths of files in a directory, and
    sub-directories, with the given extension.

    Parameters
    ----------
    extname : `str`
        Extension name (such as 'txt' or 'rst'). Extension comparison is
        case sensitive.
    root_dir : 'str`, optional
        Root directory. Current working directory by default.

    Yields
    ------
    filepath : `str`
        File path, relative to ``root_dir``, with the given extension.
    """
    # needed for comparison with os.path.splitext
    if not arg_0.startswith('.'):
        arg_0 = '.' + arg_0

    arg_1 = os.path.abspath(arg_1)

    for arg_2, arg_3, arg_4 in os.walk(arg_1):
        for arg_5 in arg_4:
            if os.path.splitext(arg_5)[-1] == arg_0:
                arg_6 = os.path.join(arg_2, arg_5)
                arg_7 = os.path.relpath(arg_6, start=arg_1)
                yield arg_7

Iterative over relative filepaths of files in a directory and sub - directories with the given extension .


def Func(arg_0, arg_1=1):
        """Scales out the number of blocks by "blocks"

        Raises:
             NotImplementedError
        """
        arg_2 = []
        for arg_3 in range(arg_1):
            if arg_0.provider:
                arg_4 = str(len(arg_0.blocks))
                arg_5 = arg_0.launch_cmd.format(block_id=arg_4)
                arg_6 = arg_0.provider.submit(arg_5, 1, 1)
                logger.debug("Launched block {}->{}".format(arg_4, arg_6))
                if not arg_6:
                    raise(ScalingFailed(arg_0.provider.label,
                                        "Attempts to provision nodes via provider has failed"))
                arg_2.extend([arg_4])
                arg_0.blocks[arg_4] = arg_6
            else:
                logger.error("No execution provider available")
                arg_2 = None
        return arg_2

Scales out the number of blocks by blocks


def
Func
(
arg_0
)
:
arg_1
,
arg_2
=
arg_0
.
command
(
"LIST EXTENSIONS"
)
if
arg_1
!=
202
:
raise
NNTPReplyError
(
arg_1
,
arg_2
)
for
arg_3
in
arg_0
.
info_gen
(
arg_1
,
arg_2
)
:
yield
arg_3
.
strip
(
)

def Func(arg_0):
        """Generator for the LIST EXTENSIONS command.
        """
        arg_1, arg_2 = arg_0.command("LIST EXTENSIONS")
        if arg_1 != 202:
            raise NNTPReplyError(arg_1, arg_2)

        for arg_3 in arg_0.info_gen(arg_1, arg_2):
            yield arg_3.strip()

Generator for the LIST EXTENSIONS command .


def Func(arg_0, arg_1, arg_2, arg_3=True):
        """
        Reads a specific amount of data from a stream and returns it. If there
        is any data in initial_data, that will be popped out first.

        :type fileobj: A file-like object that implements read
        :param fileobj: The stream to read from.

        :type amount: int
        :param amount: The number of bytes to read from the stream.

        :type truncate: bool
        :param truncate: Whether or not to truncate initial_data after
            reading from it.

        :return: Generator which generates part bodies from the initial data.
        """
        # If the the initial data is empty, we simply read from the fileobj
        if len(arg_0._initial_data) == 0:
            return arg_1.read(arg_2)

        # If the requested number of bytes is less than the amount of
        # initial data, pull entirely from initial data.
        if arg_2 <= len(arg_0._initial_data):
            arg_4 = arg_0._initial_data[:arg_2]
            # Truncate initial data so we don't hang onto the data longer
            # than we need.
            if arg_3:
                arg_0._initial_data = arg_0._initial_data[arg_2:]
            return arg_4

        # At this point there is some initial data left, but not enough to
        # satisfy the number of bytes requested. Pull out the remaining
        # initial data and read the rest from the fileobj.
        arg_6 = arg_2 - len(arg_0._initial_data)
        arg_4 = arg_0._initial_data + arg_1.read(arg_6)

        # Zero out initial data so we don't hang onto the data any more.
        if arg_3:
            arg_0._initial_data = b''
        return arg_4

Reads a specific amount of data from a stream and returns it . If there is any data in initial_data that will be popped out first .


def Func ( arg_0 , arg_1 = '' ) : if not arg_1 : for arg_2 in arg_0 : os . remove ( arg_2 ) else : for arg_2 in arg_0 : os . remove ( op . join ( arg_1 , arg_2 ) )

def Func(arg_0, arg_1=''):
    """Deletes all files in filelist

    Parameters
    ----------
    filelist: list of str
        List of the file paths to be removed

    folder: str
        Path to be used as common directory for all file paths in filelist
    """
    if not arg_1:
        for arg_2 in arg_0:
            os.remove(arg_2)
    else:
        for arg_2 in arg_0:
            os.remove(op.join(arg_1, arg_2))


def
Func
(
arg_0
)
:
arg_1
,
arg_2
,
arg_3
=
get_job_or_local
(
arg_0
.
obj
.
get
(
'project'
)
,
arg_0
.
obj
.
get
(
'job'
)
)
if
not
click
.
confirm
(
"Are sure you want to Func job `{}`"
.
format
(
arg_3
)
)
:
click
.
echo
(
'Existing without deleting job.'
)
sys
.
exit
(
1
)
try
:
arg_4
=
PolyaxonClient
(
)
.
job
.
Func_job
(
arg_1
,
arg_2
,
arg_3
)
JobManager
.
purge
(
)
except
(
PolyaxonHTTPError
,
PolyaxonShouldExitError
,
PolyaxonClientException
)
as
e
:
Printer
.
print_error
(
'Could not Func job `{}`.'
.
format
(
arg_3
)
)
Printer
.
print_error
(
'Error message `{}`.'
.
format
(
e
)
)
sys
.
exit
(
1
)
if
arg_4
.
status_code
==
204
:
Printer
.
print_success
(
"Job `{}` was Func successfully"
.
format
(
arg_3
)
)

def Func(arg_0):
    """Delete job.

    Uses [Caching](/references/polyaxon-cli/#caching)

    Example:

    \b
    ```bash
    $ polyaxon job Func
    ```
    """
    arg_1, arg_2, arg_3 = get_job_or_local(arg_0.obj.get('project'), arg_0.obj.get('job'))
    if not click.confirm("Are sure you want to Func job `{}`".format(arg_3)):
        click.echo('Existing without deleting job.')
        sys.exit(1)

    try:
        arg_4 = PolyaxonClient().job.Func_job(
            arg_1, arg_2, arg_3)
        # Purge caching
        JobManager.purge()
    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
        Printer.print_error('Could not Func job `{}`.'.format(arg_3))
        Printer.print_error('Error message `{}`.'.format(e))
        sys.exit(1)

    if arg_4.status_code == 204:
        Printer.print_success("Job `{}` was Func successfully".format(arg_3))

Delete job.

    Uses [Caching](/references/polyaxon-cli/#caching)

    Example:

    \b
    ```bash
    $ polyaxon job delete
    ```


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = Ellipse ( pen = arg_0 . pen , x_origin = arg_1 [ "x0" ] , y_origin = arg_1 [ "y0" ] , e_width = arg_1 [ "w" ] , e_height = arg_1 [ "h" ] , arg_2 = arg_2 ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """ Returns the components of an ellipse. """

        arg_3 = Ellipse(pen=arg_0.pen,
                            x_origin=arg_1["x0"],
                            y_origin=arg_1["y0"],
                            e_width=arg_1["w"],
                            e_height=arg_1["h"],
                            arg_2=arg_2)

        return arg_3


def
Func
(
arg_0
,
arg_1
)
:
try
:
if
typepy
.
is_not_null_string
(
arg_1
.
stdout
)
:
arg_1
=
arg_1
.
stdout
except
AttributeError
:
pass
logger
.
debug
(
"parsing ping result: {}"
.
format
(
arg_1
)
)
arg_0
.
__Funcr
=
NullPingParser
(
)
if
typepy
.
is_null_string
(
arg_1
)
:
logger
.
debug
(
"ping_message is empty"
)
arg_0
.
__stats
=
PingStats
(
)
return
arg_0
.
__stats
arg_4
=
_to_unicode
(
arg_1
)
.
splitlines
(
)
arg_5
=
(
LinuxPingParser
,
WindowsPingParser
,
MacOsPingParser
,
AlpineLinuxPingParser
,
)
for
arg_6
in
arg_5
:
arg_0
.
__Funcr
=
arg_6
(
)
try
:
arg_0
.
__stats
=
arg_0
.
__Funcr
.
Func
(
arg_4
)
return
arg_0
.
__stats
except
ParseError
as
e
:
if
e
.
reason
!=
ParseErrorReason
.
HEADER_NOT_FOUND
:
raise
e
except
pp
.
ParseException
:
pass
arg_0
.
__Funcr
=
NullPingParser
(
)
return
arg_0
.
__stats

def Func(arg_0, arg_1):
        """
        Parse ping command output.

        Args:
            ping_message (str or :py:class:`~pingparsing.PingResult`):
                ``ping`` command output.

        Returns:
            :py:class:`~pingparsing.PingStats`: Parsed result.
        """

        try:
            # accept PingResult instance as an input
            if typepy.is_not_null_string(arg_1.stdout):
                arg_1 = arg_1.stdout
        except AttributeError:
            pass

        logger.debug("parsing ping result: {}".format(arg_1))

        arg_0.__Funcr = NullPingParser()

        if typepy.is_null_string(arg_1):
            logger.debug("ping_message is empty")
            arg_0.__stats = PingStats()

            return arg_0.__stats

        arg_4 = _to_unicode(arg_1).splitlines()
        arg_5 = (
            LinuxPingParser,
            WindowsPingParser,
            MacOsPingParser,
            AlpineLinuxPingParser,
        )

        for arg_6 in arg_5:
            arg_0.__Funcr = arg_6()
            try:
                arg_0.__stats = arg_0.__Funcr.Func(arg_4)
                return arg_0.__stats
            except ParseError as e:
                if e.reason != ParseErrorReason.HEADER_NOT_FOUND:
                    raise e
            except pp.ParseException:
                pass

        arg_0.__Funcr = NullPingParser()

        return arg_0.__stats


(self, workflow_job_template=None, monitor=False, wait=False,
               timeout=None, extra_vars=None, **kwargs)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
False
,
arg_3
=
False
,
arg_4
=
,
arg_5
=
,
**
arg_6
)
:
if
arg_5
is
not
and
len
(
arg_5
)
>
0
:
arg_6
[
'extra_vars'
]
=
parser
.
process_extra_vars
(
arg_5
)
debug
.
log
(
'Launching the workflow job.'
,
header
=
'details'
)
arg_0
.
_pop_none
(
arg_6
)
arg_7
=
client
.
post
(
'workflow_job_templates/{0}/Func/'
.
format
(
arg_1
)
,
data
=
arg_6
)
.
json
(
)
arg_8
=
arg_7
[
'id'
]
arg_7
[
'changed'
]
=
True
if
arg_2
:
return
arg_0
.
monitor
(
arg_8
,
arg_4
=
arg_4
)
elif
arg_3
:
return
arg_0
.
wait
(
arg_8
,
arg_4
=
arg_4
)
return
arg_7

def Func(arg_0, arg_1=None, arg_2=False, arg_3=False,
               arg_4=None, arg_5=None, **arg_6):
        """Launch a new workflow job based on a workflow job template.

        Creates a new workflow job in Ansible Tower, starts it, and
        returns back an ID in order for its status to be monitored.

        =====API DOCS=====
        Launch a new workflow job based on a workflow job template.

        :param workflow_job_template: Primary key or name of the workflow job template to Func new job.
        :type workflow_job_template: str
        :param monitor: Flag that if set, immediately calls ``monitor`` on the newly Funced workflow job rather
                        than exiting with a success.
        :type monitor: bool
        :param wait: Flag that if set, monitor the status of the workflow job, but do not print while job is
                     in progress.
        :type wait: bool
        :param timeout: If provided with ``monitor`` flag set, this attempt will time out after the given number
                        of seconds.
        :type timeout: int
        :param extra_vars: yaml formatted texts that contains extra variables to pass on.
        :type extra_vars: array of strings
        :param `**kwargs`: Fields needed to create and Func a workflow job.
        :returns: Result of subsequent ``monitor`` call if ``monitor`` flag is on; Result of subsequent ``wait``
                  call if ``wait`` flag is on; loaded JSON output of the job Func if none of the two flags are on.
        :rtype: dict

        =====API DOCS=====
        """
        if arg_5 is not None and len(arg_5) > 0:
            arg_6['extra_vars'] = parser.process_extra_vars(arg_5)

        debug.log('Launching the workflow job.', header='details')
        arg_0._pop_none(arg_6)
        arg_7 = client.post('workflow_job_templates/{0}/Func/'.format(
            arg_1), data=arg_6).json()

        arg_8 = arg_7['id']
        arg_7['changed'] = True

        if arg_2:
            return arg_0.monitor(arg_8, arg_4=arg_4)
        elif arg_3:
            return arg_0.wait(arg_8, arg_4=arg_4)

        return arg_7

Launch a new workflow job based on a workflow job template.

        Creates a new workflow job in Ansible Tower, starts it, and
        returns back an ID in order for its status to be monitored.

        =====API DOCS=====
        Launch a new workflow job based on a workflow job template.

        :param workflow_job_template: Primary key or name of the workflow job template to launch new job.
        :type workflow_job_template: str
        :param monitor: Flag that if set, immediately calls ``monitor`` on the newly launched workflow job rather
                        than exiting with a success.
        :type monitor: bool
        :param wait: Flag that if set, monitor the status of the workflow job, but do not print while job is
                     in progress.
        :type wait: bool
        :param timeout: If provided with ``monitor`` flag set, this attempt will time out after the given number
                        of seconds.
        :type timeout: int
        :param extra_vars: yaml formatted texts that contains extra variables to pass on.
        :type extra_vars: array of strings
        :param `**kwargs`: Fields needed to create and launch a workflow job.
        :returns: Result of subsequent ``monitor`` call if ``monitor`` flag is on; Result of subsequent ``wait``
                  call if ``wait`` flag is on; loaded JSON output of the job launch if none of the two flags are on.
        :rtype: dict

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

Launch a new workflow job based on a workflow job template .


return urlsafe_b64encode(h + ciphertext)

def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = b64decode ( config . GOOGLE_PUBKEY ) arg_4 = utils . readInt ( arg_3 , 0 ) arg_5 = utils . toBigInt ( arg_3 [ 4 : ] [ 0 : arg_4 ] ) arg_6 = utils . readInt ( arg_3 , arg_4 + 4 ) arg_7 = utils . toBigInt ( arg_3 [ arg_4 + 8 : ] [ 0 : arg_6 ] ) arg_8 = hashes . Hash ( hashes . SHA1 ( ) , backend = default_backend ( ) ) arg_8 . update ( arg_3 ) arg_9 = b'\x00' + arg_8 . finalize ( ) [ 0 : 4 ] arg_10 = encode_dss_signature ( arg_5 , arg_7 ) arg_11 = load_der_public_key ( arg_10 , backend = default_backend ( ) ) arg_12 = arg_1 . encode ( ) + b'\x00' + arg_2 . encode ( ) arg_13 = arg_11 . encrypt ( arg_12 , padding . OAEP ( mgf = padding . MGF1 ( algorithm = hashes . SHA1 ( ) ) , algorithm = hashes . SHA1 ( ) , label = None ) ) return urlsafe_b64encode ( arg_9 + arg_13 )

def Func(arg_0, arg_1, arg_2):
        """Encrypt credentials using the google publickey, with the
        RSA algorithm"""

        # structure of the binary key:
        #
        # *-------------------------------------------------------*
        # | modulus_length | modulus | exponent_length | exponent |
        # *-------------------------------------------------------*
        #
        # modulus_length and exponent_length are uint32
        arg_3 = b64decode(config.GOOGLE_PUBKEY)
        # modulus
        arg_4 = utils.readInt(arg_3, 0)
        arg_5 = utils.toBigInt(arg_3[4:][0:arg_4])
        # exponent
        arg_6 = utils.readInt(arg_3, arg_4 + 4)
        arg_7 = utils.toBigInt(arg_3[arg_4 + 8:][0:arg_6])

        # calculate SHA1 of the pub key
        arg_8 = hashes.Hash(hashes.SHA1(), backend=default_backend())
        arg_8.update(arg_3)
        arg_9 = b'\x00' + arg_8.finalize()[0:4]

        # generate a public key
        arg_10 = encode_dss_signature(arg_5, arg_7)
        arg_11 = load_der_public_key(arg_10, backend=default_backend())

        # encrypt email and password using pubkey
        arg_12 = arg_1.encode() + b'\x00' + arg_2.encode()
        arg_13 = arg_11.encrypt(
            arg_12,
            padding.OAEP(
                mgf=padding.MGF1(algorithm=hashes.SHA1()),
                algorithm=hashes.SHA1(),
                label=None
            )
        )

        return urlsafe_b64encode(arg_9 + arg_13)

Encrypt credentials using the google publickey with the RSA algorithm


def Func ( arg_0 ) : if not arg_0 : return arg_0 if ( arg_0 [ 0 ] == "'" and arg_0 [ - 1 ] == "'" ) or ( arg_0 [ 0 ] == '"' and arg_0 [ - 1 ] == '"' ) : return arg_0 [ 1 : - 1 ] else : return arg_0

def Func(arg_0):
    """Remove a single pair of quotes from the endpoints of a string."""

    if not arg_0:
        return arg_0
    if (arg_0[0]=="'" and arg_0[-1]=="'") or \
       (arg_0[0]=='"' and arg_0[-1]=='"'):
        return arg_0[1:-1]
    else:
        return arg_0

Remove a single pair of quotes from the endpoints of a string .


def Func(arg_0):
        """Sets cursor as beginning of next line."""
        arg_0._eol.append(arg_0.position)
        arg_0._lineno += 1
        arg_0._col_offset = 0


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_1
.
split_contents
(
)
if
len
(
arg_2
)
>
1
:
raise
TemplateSyntaxError
(
"'%s' takes no arguments"
%
arg_2
[
0
]
)
return
GoSquaredNode
(
)

def Func(arg_0, arg_1):
    """
    GoSquared tracking template tag.

    Renders Javascript code to track page visits.  You must supply
    your GoSquared site token in the ``GOSQUARED_SITE_TOKEN`` setting.
    """
    arg_2 = arg_1.split_contents()
    if len(arg_2) > 1:
        raise TemplateSyntaxError("'%s' takes no arguments" % arg_2[0])
    return GoSquaredNode()


def Func ( arg_0 ) : arg_1 = Templite ( data ( "index.html" ) , arg_0 . template_globals ) arg_0 . totals = sum ( [ f [ 'nums' ] for f in arg_0 . files ] ) arg_3 = arg_1 . render ( { 'arcs' : arg_0 . arcs , 'extra_css' : arg_0 . extra_css , 'files' : arg_0 . files , 'totals' : arg_0 . totals , } ) if sys . version_info < ( 3 , 0 ) : arg_3 = arg_3 . decode ( "utf-8" ) arg_0 . write_html ( os . path . join ( arg_0 . directory , "index.html" ) , arg_3 ) arg_0 . status . write ( arg_0 . directory )

def Func(arg_0):
        """Write the index.html file for this report."""
        arg_1 = Templite(
            data("index.html"), arg_0.template_globals
            )

        arg_0.totals = sum([f['nums'] for f in arg_0.files])

        arg_3 = arg_1.render({
            'arcs': arg_0.arcs,
            'extra_css': arg_0.extra_css,
            'files': arg_0.files,
            'totals': arg_0.totals,
        })

        if sys.version_info < (3, 0):
            arg_3 = arg_3.decode("utf-8")
        arg_0.write_html(
            os.path.join(arg_0.directory, "index.html"),
            arg_3
            )

        # Write the latest hashes for next time.
        arg_0.status.write(arg_0.directory)

Write the index . html file for this report .


def Func(arg_0, arg_1, arg_2):
    """Run WsgiDAV using cheroot.server if Cheroot is installed."""
    assert arg_2 == "cheroot"
    try:
        from cheroot import arg_13, arg_4
    #         from cheroot.ssl.builtin import BuiltinSSLAdapter
    #         import cheroot.ssl.pyopenssl
    except ImportError:
        _logger.error("*" * 78)
        _logger.error("ERROR: Could not import Cheroot.")
        _logger.error(
            "Try `pip install cheroot` or specify another server using the --server option."
        )
        _logger.error("*" * 78)
        raise

    arg_3 = "WsgiDAV/{} {} Python/{}".format(
        __version__, arg_4.Server.version, util.PYTHON_VERSION
    )
    arg_4.Server.version = arg_3

    # Support SSL
    arg_7 = _get_checked_path(arg_1.get("ssl_certificate"), arg_1)
    arg_8 = _get_checked_path(arg_1.get("ssl_private_key"), arg_1)
    arg_9 = _get_checked_path(
        arg_1.get("ssl_certificate_chain"), arg_1
    )
    arg_10 = arg_1.get("ssl_adapter", "builtin")
    arg_11 = "http"
    if arg_7 and arg_8:
        arg_10 = arg_13.get_ssl_adapter_class(arg_10)
        arg_4.Server.ssl_adapter = arg_10(
            arg_7, arg_8, arg_9
        )
        arg_11 = "https"
        _logger.info("SSL / HTTPS enabled. Adapter: {}".format(arg_10))
    elif arg_7 or arg_8:
        raise RuntimeError(
            "Option 'ssl_certificate' and 'ssl_private_key' must be used together."
        )
    #     elif ssl_adapter:
    #         print("WARNING: Ignored option 'ssl_adapter' (requires 'ssl_certificate').")

    _logger.info("Running {}".format(arg_3))
    _logger.info(
        "Serving on {}://{}:{} ...".format(arg_11, arg_1["host"], arg_1["port"])
    )

    arg_12 = {
        "bind_addr": (arg_1["host"], arg_1["port"]),
        "wsgi_app": arg_0,
        "server_name": arg_3,
    }
    # Override or add custom args
    arg_12.update(arg_1.get("server_args", {}))

    arg_13 = arg_4.Server(**arg_12)

    # If the caller passed a startup event, monkey patch the server to set it
    # when the request handler loop is entered
    arg_14 = arg_1.get("startup_event")
    if arg_14:

        def _patched_tick():
            arg_13.tick = arg_16  # undo the monkey patch
            _logger.info("wsgi.Server is ready")
            arg_14.set()
            arg_16()

        arg_16 = arg_13.tick
        arg_13.tick = _patched_tick

    try:
        arg_13.start()
    except KeyboardInterrupt:
        _logger.warning("Caught Ctrl-C, shutting down...")
    finally:
        arg_13.stop()

    return

Run WsgiDAV using cheroot . server if Cheroot is installed .


def Func(arg_0, arg_1: arg_2):
        """
        Set the current time in the music in seconds causing the player
        to seek to this location in the file.
        """
        if arg_1 < 0:
            arg_1 = 0

        # mixer.music.play(start=value)
        mixer.music.set_pos(arg_1)

Set the current time in the music in seconds causing the player to seek to this location in the file .


def Func ( arg_0 , arg_1 ) : if 'kCBAdvDataServiceUUIDs' in arg_1 : arg_0 . _advertised = arg_0 . _advertised + map ( cbuuid_to_uuid , arg_1 [ 'kCBAdvDataServiceUUIDs' ] )

def Func(arg_0, arg_1):
        """Called when advertisement data is received."""
        # Advertisement data was received, pull out advertised service UUIDs and
        # name from advertisement data.
        if 'kCBAdvDataServiceUUIDs' in arg_1:
            arg_0._advertised = arg_0._advertised + map(cbuuid_to_uuid, arg_1['kCBAdvDataServiceUUIDs'])

Called when advertisement data is received .


def Func ( arg_0 ) : arg_1 = arg_0 . items ( ) arg_2 = operator . itemgetter ( 0 ) return tuple ( sorted ( arg_1 , key = arg_2 ) )

def Func(arg_0):
    """Freezes ``dict`` into ``tuple``.

    A typical usage is packing ``dict`` into hashable.

    e.g.::

        >>> Func({'a': 1, 'b': 2})
        (('a', 1), ('b', 2))
    """
    arg_1 = arg_0.items()
    arg_2 = operator.itemgetter(0)
    return tuple(sorted(arg_1, key=arg_2))

Freezes ``dict`` into ``tuple``.

    A typical usage is packing ``dict`` into hashable.

    e.g.::

        >>> freeze_dict({'a': 1, 'b': 2})
        (('a', 1), ('b', 2))


def Func ( arg_0 ) : arg_1 = arg_0 . _meta . get_all_field_names ( ) if 'id' in arg_1 : arg_1 . remove ( 'id' ) return arg_1

def Func(arg_0):
        """
        get all fields of model, execpt id
        """
        arg_1 = arg_0._meta.get_all_field_names()
        if 'id' in arg_1:
            arg_1.remove('id')

        return arg_1


(
    input_shape, event_shape_in, event_shape_out, validate_args)

def Func(
    arg_0, arg_1, arg_2, arg_3):
  """Replaces the rightmost dims in a `Tensor` representing a shape.

  Args:
    input_shape: a rank-1 `Tensor` of integers
    event_shape_in: the event shape expected to be present in rightmost dims
      of `shape_in`.
    event_shape_out: the event shape with which to replace `event_shape_in` in
      the rightmost dims of `input_shape`.
    validate_args: Python `bool` indicating whether arguments should
      be checked for correctness.

  Returns:
    output_shape: A rank-1 integer `Tensor` with the same contents as
      `input_shape` except for the event dims, which are replaced with
      `event_shape_out`.
  """
  arg_4, arg_5 = _replace_event_shape_in_tensorshape(
      tensorshape_util.constant_value_as_shape(arg_0),
      arg_1,
      arg_2)

  # TODO(b/124240153): Remove map(tf.identity, deps) once tf.function
  # correctly supports control_dependencies.
  arg_6 = (
      map(tf.identity, (arg_1, arg_2))
      if arg_3 else ())

  if (tensorshape_util.is_fully_defined(arg_4) and
      (arg_5 or not arg_3)):
    with tf.control_dependencies(arg_6):
      arg_7 = tf.convert_to_tensor(
          value=arg_4, name='output_shape', dtype_hint=tf.int32)
    return arg_7, arg_4

  with tf.control_dependencies(arg_6):
    arg_8 = (
        tf.size(input=arg_1)
        if tensorshape_util.num_elements(arg_1.shape) is None else
        tensorshape_util.num_elements(arg_1.shape))
    arg_9, arg_10 = tf.split(
        arg_0, num_or_size_splits=[-1, arg_8])

  arg_11 = []
  if arg_5:
    pass
  elif arg_3:
    # Check that `input_event_shape` and `event_shape_in` are compatible in the
    # sense that they have equal entries in any position that isn't a `-1` in
    # `event_shape_in`. Note that our validations at construction time ensure
    # there is at most one such entry in `event_shape_in`.
    arg_12 = arg_1 >= 0
    arg_13 = tf.boolean_mask(
        tensor=arg_10, arg_12=arg_12)
    arg_14 = tf.boolean_mask(
        tensor=arg_1, arg_12=arg_12)
    arg_11.append(
        assert_util.assert_equal(
            arg_13,
            arg_14,
            message='Input `event_shape` does not match `event_shape_in`.'))
    # We don't explicitly additionally verify
    # `tf.size(input_shape) > tf.size(event_shape_in)` since `tf.split`
    # already makes this assertion.

  with tf.control_dependencies(arg_11):
    arg_7 = tf.concat([arg_9, arg_2], axis=0,
                             name='output_shape')

  return arg_7, arg_4

Replaces the rightmost dims in a Tensor representing a shape .


(self, service_name, description, label,
                               affinity_group=None, location=None,
                               geo_replication_enabled=None,
                               extended_properties=None,
                               account_type='Standard_GRS')

return self._perform_post(
            self._get_storage_service_path(),
            _XmlSerializer.create_storage_service_input_to_xml(
                service_name,
                description,
                label,
                affinity_group,
                location,
                account_type,
                extended_properties),
            as_async=True)

def Func(arg_0, arg_1, arg_2, arg_3,
                               arg_4=None, arg_5=None,
                               arg_6=None,
                               arg_7=None,
                               arg_8='Standard_GRS'):
        '''
        Creates a new storage account in Windows Azure.

        service_name:
            A name for the storage account that is unique within Windows Azure.
            Storage account names must be between 3 and 24 characters in length
            and use numbers and lower-case letters only.
        description:
            A description for the storage account. The description may be up
            to 1024 characters in length.
        label:
            A name for the storage account. The name may be up to 100
            characters in length. The name can be used to identify the storage
            account for your tracking purposes.
        affinity_group:
            The name of an existing affinity group in the specified
            subscription. You can specify either a location or affinity_group,
            but not both.
        location:
            The location where the storage account is created. You can specify
            either a location or affinity_group, but not both.
        geo_replication_enabled:
            Deprecated. Replaced by the account_type parameter.
        extended_properties:
            Dictionary containing name/value pairs of storage account
            properties. You can have a maximum of 50 extended property
            name/value pairs. The maximum length of the Name element is 64
            characters, only alphanumeric characters and underscores are valid
            in the Name, and the name must start with a letter. The value has
            a maximum length of 255 characters.
        account_type:
            Specifies whether the account supports locally-redundant storage,
            geo-redundant storage, zone-redundant storage, or read access
            geo-redundant storage.
            Possible values are:
                Standard_LRS, Standard_ZRS, Standard_GRS, Standard_RAGRS
        '''
        _validate_not_none('service_name', arg_1)
        _validate_not_none('description', arg_2)
        _validate_not_none('label', arg_3)
        if arg_4 is None and arg_5 is None:
            raise ValueError(
                'location or affinity_group must be specified')
        if arg_4 is not None and arg_5 is not None:
            raise ValueError(
                'Only one of location or affinity_group needs to be specified')
        if arg_6 == False:
            arg_8 = 'Standard_LRS'
        return arg_0._perform_post(
            arg_0._get_storage_service_path(),
            _XmlSerializer.create_storage_service_input_to_xml(
                arg_1,
                arg_2,
                arg_3,
                arg_4,
                arg_5,
                arg_8,
                arg_7),
            as_async=True)

Creates a new storage account in Windows Azure .


def Func ( arg_0 , arg_1 ) : for arg_2 in arg_1 : if 'action' in arg_2 and "()" in arg_2 [ 'action' ] : arg_2 [ 'action' ] = eval ( "self.{}" . format ( arg_2 [ 'action' ] ) ) if arg_2 [ 'keys' ] [ 0 ] . startswith ( '-' ) : if 'required' not in arg_2 : arg_2 [ 'required' ] = False

def Func(arg_0, arg_1):
        """ apply default settings to commands
            not static, shadow "self" in eval
        """
        for arg_2 in arg_1:
            if 'action' in arg_2 and "()" in arg_2['action']:
                arg_2['action'] = eval("self.{}".format(arg_2['action']))
            if arg_2['keys'][0].startswith('-'):
                if 'required' not in arg_2:
                    arg_2['required'] = False

apply default settings to commands not static shadow self in eval


def
Func
(
arg_0
)
:
arg_1
=
arg_2
=
arg_0
.
conf
[
'es_enrichment'
]
[
'url'
]
arg_3
=
'.kibana/config/_search'
arg_4
=
urijoin
(
arg_2
,
arg_3
)
arg_1
=
try
:
arg_5
=
arg_0
.
grimoire_con
.
get
(
arg_4
)
arg_5
.
raise_for_status
(
)
arg_1
=
arg_5
.
json
(
)
[
'hits'
]
[
'hits'
]
[
0
]
[
'_id'
]
logger
.
debug
(
"Kibiter version: %s"
,
arg_1
)
except
requests
.
exceptions
.
HTTPError
:
logger
.
warning
(
"Can not find Kibiter version"
)
return
arg_1

def Func(arg_0):
        """ Get the kibiter vesion.

        :param major: major Elasticsearch version
        """
        arg_1 = None

        arg_2 = arg_0.conf['es_enrichment']['url']
        arg_3 = '.kibana/config/_search'
        arg_4 = urijoin(arg_2, arg_3)
        arg_1 = None
        try:
            arg_5 = arg_0.grimoire_con.get(arg_4)
            arg_5.raise_for_status()
            arg_1 = arg_5.json()['hits']['hits'][0]['_id']
            logger.debug("Kibiter version: %s", arg_1)
        except requests.exceptions.HTTPError:
            logger.warning("Can not find Kibiter version")

        return arg_1


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """
    Encrypts plaintext via CryptoAPI

    :param cipher:
        A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key",
        "rc2", "rc4"

    :param key:
        The encryption key - a byte string 5-16 bytes long

    :param data:
        The plaintext - a byte string

    :param iv:
        The initialization vector - a byte string - unused for RC4

    :param padding:
        Boolean, if padding should be used - unused for RC4

    :raises:
        ValueError - when any of the parameters contain an invalid value
        TypeError - when any of the parameters are of the wrong type
        OSError - when an error is returned by the OS crypto library

    :return:
        A byte string of the ciphertext
    """

    arg_5 = None
    arg_6 = None

    try:
        arg_5, arg_6 = _advapi32_create_handles(arg_0, arg_1, arg_3)

        arg_7 = new(advapi32, 'DWORD *', len(arg_2))
        arg_8 = advapi32.CryptEncrypt(
            arg_6,
            null(),
            True,
            0,
            null(),
            arg_7,
            0
        )
        handle_error(arg_8)

        arg_9 = deref(arg_7)
        arg_10 = buffer_from_bytes(arg_9)
        write_to_buffer(arg_10, arg_2)

        pointer_set(arg_7, len(arg_2))
        arg_8 = advapi32.CryptEncrypt(
            arg_6,
            null(),
            True,
            0,
            arg_10,
            arg_7,
            arg_9
        )
        handle_error(arg_8)

        arg_11 = bytes_from_buffer(arg_10, deref(arg_7))

        # Remove padding when not required. CryptoAPI doesn't support this, so
        # we just manually remove it.
        if arg_0 == 'aes' and not arg_4:
            if arg_11[-16:] != (b'\x10' * 16):
                raise ValueError('Invalid padding generated by OS crypto library')
            arg_11 = arg_11[:-16]

        return arg_11

    finally:
        if arg_6:
            advapi32.CryptDestroyKey(arg_6)
        if arg_5:
            close_context_handle(arg_5)


def
Func
(
arg_0
)
:
arg_1
=
globals
(
)
if
isinstance
(
arg_0
,
(
list
,
tuple
,
set
)
)
:
for
arg_2
in
arg_0
:
if
not
arg_1
.
has_key
(
arg_2
)
:
raise
NameError
(
"name '%s' is not defined"
%
arg_2
)
return
map
(
arg_1
.
get
,
arg_0
)
else
:
if
not
arg_1
.
has_key
(
arg_0
)
:
raise
NameError
(
"name '%s' is not defined"
%
arg_0
)
return
arg_1
.
get
(
arg_0
)

def Func(arg_0):
    """helper method for implementing `client.pull` via `client.apply`"""
    arg_1 = globals()
    if isinstance(arg_0, (list,tuple, set)):
        for arg_2 in arg_0:
            if not arg_1.has_key(arg_2):
                raise NameError("name '%s' is not defined"%arg_2)
        return map(arg_1.get, arg_0)
    else:
        if not arg_1.has_key(arg_0):
            raise NameError("name '%s' is not defined"%arg_0)
        return arg_1.get(arg_0)

helper method for implementing client . pull via client . apply


def Func ( arg_0 , arg_1 ) : if not isinstance ( arg_1 , UUID ) : arg_1 = UUID ( arg_1 ) arg_2 = str ( arg_1 ) . split ( "-" ) arg_3 = '' . join ( [ arg_2 [ 2 ] , arg_2 [ 1 ] , arg_2 [ 0 ] , arg_2 [ 3 ] , arg_2 [ 4 ] ] ) arg_1 = binascii . unhexlify ( arg_3 ) return super ( OrderedUUIDField , arg_0 ) . Func ( arg_1 )

def Func(arg_0, arg_1):
        """
        Convert UUID to binary blob
        """

        # ensure we have a valid UUID
        if not isinstance(arg_1, UUID):
            arg_1 = UUID(arg_1)

        # reconstruct for optimal indexing
        arg_2 = str(arg_1).split("-")
        arg_3 = ''.join([arg_2[2], arg_2[1], arg_2[0], arg_2[3], arg_2[4]])
        arg_1 = binascii.unhexlify(arg_3)
        return super(OrderedUUIDField, arg_0).Func(arg_1)


def
Func
(
arg_0
,
arg_1
)
:
if
not
arg_0
.
show_rewritten_input
:
return
arg_2
=
arg_0
.
prompt_manager
.
render
(
'rewrite'
)
+
arg_1
try
:
arg_2
=
str
(
arg_2
)
print
>>
io
.
stdout
,
arg_2
except
UnicodeEncodeError
:
print
"------> "
+
arg_1

def Func(arg_0, arg_1):
        """Print to the screen the rewritten form of the user's command.

        This shows visual feedback by rewriting input lines that cause
        automatic calling to kick in, like::

          /f x

        into::

          ------> f(x)

        after the user's input prompt.  This helps the user understand that the
        input line was transformed automatically by IPython.
        """
        if not arg_0.show_rewritten_input:
            return

        arg_2 = arg_0.prompt_manager.render('rewrite') + arg_1

        try:
            # plain ascii works better w/ pyreadline, on some machines, so
            # we use it and only print uncolored rewrite if we have unicode
            arg_2 = str(arg_2)
            print >> io.stdout, arg_2
        except UnicodeEncodeError:
            print "------> " + arg_1

Print to the screen the rewritten form of the user s command .


return (np.asanyarray(frames) * hop_length + offset).astype(int)

def Func ( arg_0 , arg_1 = 512 , arg_2 = None ) : arg_3 = 0 if arg_2 is not None : arg_3 = int ( arg_2 // 2 ) return ( np . asanyarray ( arg_0 ) * arg_1 + arg_3 ) . astype ( int )

def Func(arg_0, arg_1=512, arg_2=None):
    """Converts frame indices to audio sample indices.

    Parameters
    ----------
    frames     : number or np.ndarray [shape=(n,)]
        frame index or vector of frame indices

    hop_length : int > 0 [scalar]
        number of samples between successive frames

    n_fft : None or int > 0 [scalar]
        Optional: length of the FFT window.
        If given, time conversion will include an offset of `n_fft / 2`
        to counteract windowing effects when using a non-centered STFT.

    Returns
    -------
    times : number or np.ndarray
        time (in samples) of each given frame number:
        `times[i] = frames[i] * hop_length`

    See Also
    --------
    frames_to_time : convert frame indices to time values
    samples_to_frames : convert sample indices to frame indices

    Examples
    --------
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> tempo, beats = librosa.beat.beat_track(y, sr=sr)
    >>> beat_samples = librosa.Func(beats)
    """

    arg_3 = 0
    if arg_2 is not None:
        arg_3 = int(arg_2 // 2)

    return (np.asanyarray(arg_0) * arg_1 + arg_3).astype(int)

Converts frame indices to audio sample indices.

    Parameters
    ----------
    frames     : number or np.ndarray [shape=(n,)]
        frame index or vector of frame indices

    hop_length : int > 0 [scalar]
        number of samples between successive frames

    n_fft : None or int > 0 [scalar]
        Optional: length of the FFT window.
        If given, time conversion will include an offset of `n_fft / 2`
        to counteract windowing effects when using a non-centered STFT.

    Returns
    -------
    times : number or np.ndarray
        time (in samples) of each given frame number:
        `times[i] = frames[i] * hop_length`

    See Also
    --------
    frames_to_time : convert frame indices to time values
    samples_to_frames : convert sample indices to frame indices

    Examples
    --------
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> tempo, beats = librosa.beat.beat_track(y, sr=sr)
    >>> beat_samples = librosa.frames_to_samples(beats)

Converts frame indices to audio sample indices .


def Func ( arg_0 , arg_1 , ** arg_2 ) : from django . db . models . signals import post_save post_save . disconnect ( arg_1 = arg_0 . auth_user_model , dispatch_uid = USER_POST_SAVE_DISPATCH_UID )

def Func(arg_0, arg_1, **arg_2):  # pylint: disable=unused-argument
        """
        Handle pre_migrate signal - disconnect User post_save handler.
        """
        from django.db.models.signals import post_save
        post_save.disconnect(arg_1=arg_0.auth_user_model, dispatch_uid=USER_POST_SAVE_DISPATCH_UID)

Handle pre_migrate signal - disconnect User post_save handler .


(cfg, path_to_zip_file, use_s3=False, s3_file=None)

def Func(arg_0, arg_1, arg_2=False, arg_3=None):
    """Register and upload a function to AWS Lambda."""

    print('Creating your new Lambda function')
    arg_4 = read(arg_1, binary_file=True)
    arg_5 = arg_0.get('profile')
    arg_6 = arg_0.get('aws_access_key_id')
    arg_7 = arg_0.get('aws_secret_access_key')

    arg_8 = get_account_id(
        arg_5, arg_6, arg_7, arg_0.get(
            'region',
        ),
    )
    arg_9 = get_role_name(
        arg_0.get('region'), arg_8,
        arg_0.get('role', 'lambda_basic_execution'),
    )

    arg_10 = get_client(
        'lambda', arg_5, arg_6, arg_7,
        arg_0.get('region'),
    )

    # Do we prefer development variable over config?
    arg_11 = (
        os.environ.get('S3_BUCKET_NAME') or arg_0.get('bucket_name')
    )
    arg_12 = (
        os.environ.get('LAMBDA_FUNCTION_NAME') or arg_0.get('function_name')
    )
    print('Creating lambda function with name: {}'.format(arg_12))

    if arg_2:
        arg_13 = {
            'FunctionName': arg_12,
            'Runtime': arg_0.get('runtime', 'python2.7'),
            'Role': arg_9,
            'Handler': arg_0.get('handler'),
            'Code': {
                'S3Bucket': '{}'.format(arg_11),
                'S3Key': '{}'.format(arg_3),
            },
            'Description': arg_0.get('description', ''),
            'Timeout': arg_0.get('timeout', 15),
            'MemorySize': arg_0.get('memory_size', 512),
            'VpcConfig': {
                'SubnetIds': arg_0.get('subnet_ids', []),
                'SecurityGroupIds': arg_0.get('security_group_ids', []),
            },
            'Publish': True,
        }
    else:
        arg_13 = {
            'FunctionName': arg_12,
            'Runtime': arg_0.get('runtime', 'python2.7'),
            'Role': arg_9,
            'Handler': arg_0.get('handler'),
            'Code': {'ZipFile': arg_4},
            'Description': arg_0.get('description', ''),
            'Timeout': arg_0.get('timeout', 15),
            'MemorySize': arg_0.get('memory_size', 512),
            'VpcConfig': {
                'SubnetIds': arg_0.get('subnet_ids', []),
                'SecurityGroupIds': arg_0.get('security_group_ids', []),
            },
            'Publish': True,
        }

    if 'tags' in arg_0:
        arg_13.update(
            Tags={
                arg_14: str(arg_15)
                for arg_14, arg_15 in arg_0.get('tags').items()
            }
        )

    if 'environment_variables' in arg_0:
        arg_13.update(
            Environment={
                'Variables': {
                    arg_14: get_environment_variable_value(arg_15)
                    for arg_14, arg_15
                    in arg_0.get('environment_variables').items()
                },
            },
        )

    arg_10.Func(**arg_13)

    arg_16 = get_concurrency(arg_0)
    if arg_16 > 0:
        arg_10.put_function_concurrency(FunctionName=arg_12, ReservedConcurrentExecutions=arg_16)

Register and upload a function to AWS Lambda .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : if not isinstance ( arg_1 , str ) : return arg_1 if isinstance ( arg_1 , six . binary_type ) : arg_1 = arg_1 . decode ( 'UTF-8' ) if arg_1 . startswith ( '@' ) : arg_4 = os . path . expanduser ( arg_1 [ 1 : ] ) arg_5 = super ( Variables , arg_0 ) . Func ( arg_4 , arg_2 , arg_3 ) if hasattr ( arg_5 , 'read' ) : return arg_5 . read ( ) return arg_5 return arg_1

def Func(arg_0, arg_1, arg_2, arg_3):
        """Return file content if file, else, return value as-is
        """
        # Protect against corner cases of invalid inputs
        if not isinstance(arg_1, str):
            return arg_1
        if isinstance(arg_1, six.binary_type):
            arg_1 = arg_1.decode('UTF-8')
        # Read from a file under these cases
        if arg_1.startswith('@'):
            arg_4 = os.path.expanduser(arg_1[1:])
            arg_5 = super(Variables, arg_0).Func(arg_4, arg_2, arg_3)
            if hasattr(arg_5, 'read'):
                # Sometimes click.File may return a buffer and not a string
                return arg_5.read()
            return arg_5

        # No file, use given string
        return arg_1

Return file content if file else return value as - is


def Func(arg_0):
        """Returns list of ancestor task specs based on inputs"""
        arg_1 = []

        def recursive_find_Func(arg_2, arg_3):
            for arg_4 in arg_2.inputs:
                if arg_4 not in arg_3:
                    arg_3.append(arg_4)
                    recursive_find_Func(arg_4, arg_3)
        recursive_find_Func(arg_0, arg_1)

        return arg_1


def Func ( arg_0 , arg_1 ) : if arg_0 . should_check_whitelist ( arg_1 ) : for arg_2 in arg_1 . keys : if arg_2 . s in arg_0 . whitelist or arg_2 . s . startswith ( "debug_" ) : continue arg_0 . violations . append ( ( arg_0 . current_logging_call , WHITELIST_VIOLATION . format ( arg_2 . s ) ) ) if arg_0 . should_check_extra_exception ( arg_1 ) : for arg_3 in arg_1 . values : arg_0 . check_exception_arg ( arg_3 ) super ( LoggingVisitor , arg_0 ) . generic_visit ( arg_1 )

def Func(arg_0, arg_1):
        """
        Process dict arguments.

        """
        if arg_0.should_check_whitelist(arg_1):
            for arg_2 in arg_1.keys:
                if arg_2.s in arg_0.whitelist or arg_2.s.startswith("debug_"):
                    continue
                arg_0.violations.append((arg_0.current_logging_call, WHITELIST_VIOLATION.format(arg_2.s)))

        if arg_0.should_check_extra_exception(arg_1):
            for arg_3 in arg_1.values:
                arg_0.check_exception_arg(arg_3)

        super(LoggingVisitor, arg_0).generic_visit(arg_1)


def Func ( arg_0 , arg_1 ) : arg_0 . _buf += arg_1 while True : arg_2 = _best_effort_decode ( arg_0 . _buf ) arg_3 = arg_2 . encode ( 'utf-16' ) [ 2 : ] arg_4 = LEN_REGEX . match ( arg_2 ) if arg_4 is None : break else : arg_5 = arg_4 . group ( 1 ) arg_6 = int ( arg_5 ) * 2 arg_7 = len ( ( arg_5 + '\n' ) . encode ( 'utf-16' ) [ 2 : ] ) if len ( arg_3 ) - arg_7 < arg_6 : break arg_8 = arg_3 [ arg_7 : arg_7 + arg_6 ] yield arg_8 . decode ( 'utf-16' ) arg_9 = ( len ( ( arg_5 + '\n' ) . encode ( ) ) + len ( arg_8 . decode ( 'utf-16' ) . encode ( ) ) ) arg_0 . _buf = arg_0 . _buf [ arg_9 : ]

def Func(arg_0, arg_1):
        """Yield chunks generated from received data.

        The buffer may not be decodable as UTF-8 if there's a split multi-byte
        character at the end. To handle this, do a "best effort" decode of the
        buffer to decode as much of it as possible.

        The length is actually the length of the string as reported by
        JavaScript. JavaScript's string length function returns the number of
        code units in the string, represented in UTF-16. We can emulate this by
        encoding everything in UTF-16 and multiplying the reported length by 2.

        Note that when encoding a string in UTF-16, Python will prepend a
        byte-order character, so we need to remove the first two bytes.
        """
        arg_0._buf += arg_1

        while True:

            arg_2 = _best_effort_decode(arg_0._buf)
            arg_3 = arg_2.encode('utf-16')[2:]

            arg_4 = LEN_REGEX.match(arg_2)
            if arg_4 is None:
                break
            else:
                arg_5 = arg_4.group(1)
                # Both lengths are in number of bytes in UTF-16 encoding.
                # The length of the submission:
                arg_6 = int(arg_5) * 2
                # The length of the submission length and newline:
                arg_7 = len((arg_5 + '\n').encode('utf-16')[2:])
                if len(arg_3) - arg_7 < arg_6:
                    break

                arg_8 = arg_3[arg_7:arg_7 + arg_6]
                yield arg_8.decode('utf-16')
                # Drop the length and the submission itself from the beginning
                # of the buffer.
                arg_9 = (len((arg_5 + '\n').encode()) +
                               len(arg_8.decode('utf-16').encode()))
                arg_0._buf = arg_0._buf[arg_9:]

Yield chunks generated from received data .


def Func ( arg_0 ) : for arg_1 in pkg_resources . iter_entry_points ( 'dgit.plugins' ) : arg_2 = arg_1 . load ( ) arg_2 . setup ( arg_0 )

def Func(arg_0):
        """
        Load all plugins from dgit extension
        """
        for arg_1 in pkg_resources.iter_entry_points('dgit.plugins'):
            arg_2 = arg_1.load()
            arg_2.setup(arg_0)


def
Func
(
arg_0
,
arg_1
=
)
:
arg_2
=
dict
(
arg_0
.
items
(
)
)
arg_3
=
arg_2
.
pop
(
'type'
)
if
'components'
in
arg_0
:
arg_4
=
arg_2
.
pop
(
'components'
)
elif
arg_3
==
'Menu'
and
'items'
in
arg_0
:
arg_4
=
arg_2
.
pop
(
'items'
)
else
:
arg_4
=
[
]
from
gui
import
registry
if
arg_3
in
registry
.
CONTROLS
:
arg_5
=
registry
.
CONTROLS
[
arg_3
]
elif
arg_3
in
registry
.
MENU
:
arg_5
=
registry
.
MENU
[
arg_3
]
elif
arg_3
in
registry
.
MISC
:
arg_5
=
registry
.
MISC
[
arg_3
]
else
:
raise
RuntimeError
(
"%s not in registry"
%
arg_3
)
arg_6
=
arg_5
(
arg_1
=
arg_1
,
**
arg_2
)
for
arg_7
in
arg_4
:
Func
(
arg_7
,
arg_1
=
arg_6
)
return
arg_6

def Func(arg_0, arg_1=None):
    "Create a gui2py control based on the python resource"
    # control specs (parameters)
    arg_2 = dict(arg_0.items())
    arg_3 = arg_2.pop('type')
    if 'components' in arg_0:
        arg_4 = arg_2.pop('components')
    elif arg_3 == 'Menu' and 'items' in arg_0:
        arg_4 = arg_2.pop('items')
    else:
        arg_4 = []

    from gui import registry

    if arg_3 in registry.CONTROLS:
        arg_5 = registry.CONTROLS[arg_3]
    elif arg_3 in registry.MENU:
        arg_5 = registry.MENU[arg_3]
    elif arg_3 in registry.MISC:
        arg_5 = registry.MISC[arg_3]
    else:
        raise RuntimeError("%s not in registry" % arg_3)

    # Instantiate the GUI object
    arg_6 = arg_5(arg_1=arg_1, **arg_2)

    for arg_7 in arg_4:
        Func(arg_7, arg_1=arg_6)

    return arg_6


(self, states, internals, actions, terminal, reward, next_states, next_internals)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7):
        """
        Returns the optimizer arguments including the time, the list of variables to optimize,
        and various functions which the optimizer might require to perform an update step.

        Args:
            states (dict): Dict of state tensors.
            internals (dict): Dict of prior internal state tensors.
            actions (dict): Dict of action tensors.
            terminal: 1D boolean is-terminal tensor.
            reward: 1D (float) rewards tensor.
            next_states (dict): Dict of successor state tensors.
            next_internals (dict): Dict of posterior internal state tensors.

        Returns:
            Optimizer arguments as dict to be used as **kwargs to the optimizer.
        """
        arg_8 = dict(
            time=arg_0.global_timestep,
            variables=arg_0.get_variables(),
            arg_8=dict(
                arg_1=arg_1,
                arg_2=arg_2,
                arg_3=arg_3,
                arg_4=arg_4,
                arg_5=arg_5,
                arg_6=arg_6,
                arg_7=arg_7,
                update=tf.constant(value=True)
            ),
            fn_reference=arg_0.fn_reference,
            fn_loss=arg_0.fn_loss
        )
        if arg_0.global_model is not None:
            arg_8['global_variables'] = arg_0.global_model.get_variables()
        return arg_8

Returns the optimizer arguments including the time the list of variables to optimize and various functions which the optimizer might require to perform an update step .


def Func(arg_0, arg_1: arg_2) -> Namespace:
        """Add this manager's namespace to the graph."""
        arg_3 = arg_0.upload_bel_namespace()
        arg_1.namespace_url[arg_3.keyword] = arg_3.url

        # Add this manager as an annotation, too
        arg_0._add_annotation_to_graph(arg_1)

        return arg_3

Add this manager s namespace to the graph .