def
Func
(
arg_0
)
:
if
arg_0
.
show_vars
:
arg_0
.
show_variables_window
(
)
else
:
arg_0
.
hide_variables_window
(
)
for
arg_1
in
arg_0
.
scheduled_snapshots
:
fn
=
arg_1
(
arg_0
.
last_draw_ctx
)
print
(
"Saved snapshot: %s"
%
fn
)
else
:
arg_0
.
scheduled_snapshots
=
deque
(
)
while
Gtk
.
events_pending
(
)
:
Gtk
.
Func
(
)

def Func(arg_0):
        """
        Called from main loop, if your sink needs to handle GUI events
        do it here.

        Check any GUI flags then call Gtk.Func to update things.
        """
        if arg_0.show_vars:
            arg_0.show_variables_window()
        else:
            arg_0.hide_variables_window()

        for arg_1 in arg_0.scheduled_snapshots:
            fn = arg_1(arg_0.last_draw_ctx)
            print("Saved snapshot: %s" % fn)
        else:
            arg_0.scheduled_snapshots = deque()

        while Gtk.events_pending():
            Gtk.Func()

Called from main loop, if your sink needs to handle GUI events
        do it here.

        Check any GUI flags then call Gtk.main_iteration to update things.

Called from main loop if your sink needs to handle GUI events do it here .


def Func(arg_0, arg_1='color'):
    """Read an image from bytes.

    Args:
        content (bytes): Image bytes got from files or other streams.
        flag (str): Same as :func:`imread`.

    Returns:
        ndarray: Loaded image array.
    """
    arg_2 = np.frombuffer(arg_0, np.uint8)
    arg_1 = imread_flags[arg_1] if is_str(arg_1) else arg_1
    arg_3 = cv2.imdecode(arg_2, arg_1)
    return arg_3


def
Func
(
arg_0
,
arg_1
=
"left-to-right"
)
:
if
isinstance
(
arg_1
,
six
.
string_types
)
:
if
arg_1
==
"left-to-right"
:
return
np
.
arange
(
start
=
1
,
stop
=
arg_0
+
1
)
elif
arg_1
==
"right-to-left"
:
return
np
.
arange
(
start
=
arg_0
,
stop
=
0
,
step
=
1
)
elif
arg_1
==
"random"
:
arg_2
=
np
.
arange
(
start
=
1
,
stop
=
arg_0
+
1
)
np
.
random
.
shuffle
(
arg_2
)
return
arg_2
elif
np
.
all
(
np
.
sort
(
arg_1
)
==
np
.
arange
(
1
,
arg_0
+
1
)
)
:
return
np
.
array
(
arg_1
)
raise
ValueError
(
"Invalid input order: '{}'."
.
format
(
arg_1
)
)

def Func(arg_0, arg_1="left-to-right"):
  """Returns a degree vectors for the input."""
  if isinstance(arg_1, six.string_types):
    if arg_1 == "left-to-right":
      return np.arange(start=1, stop=arg_0 + 1)
    elif arg_1 == "right-to-left":
      return np.arange(start=arg_0, stop=0, step=-1)
    elif arg_1 == "random":
      arg_2 = np.arange(start=1, stop=arg_0 + 1)
      np.random.shuffle(arg_2)
      return arg_2
  elif np.all(np.sort(arg_1) == np.arange(1, arg_0 + 1)):
    return np.array(arg_1)

  raise ValueError("Invalid input order: '{}'.".format(arg_1))

Returns a degree vectors for the input .


def Func ( arg_0 ) : if not any ( arg_1 . startswith ( 'multiproc_' ) for arg_1 in arg_0 . keys ( ) ) : return None arg_2 = { } for arg_1 in arg_0 . keys ( ) : if arg_1 . startswith ( 'multiproc_' ) : arg_3 = arg_1 . replace ( 'multiproc_' , '' ) arg_2 [ arg_3 ] = arg_0 [ arg_1 ] arg_2 [ 'version' ] = arg_0 [ 'version' ] if 'disable_existing_loggers' in arg_0 : arg_2 [ 'disable_existing_loggers' ] = arg_0 [ 'disable_existing_loggers' ] return arg_2

def Func(arg_0):
        """ Searches for multiprocessing options in a given `dictionary`.

        If found they are copied (without the `'multiproc_'` prefix)
        into a new dictionary

        """
        if not any(arg_1.startswith('multiproc_') for arg_1 in arg_0.keys()):
            return None
        arg_2 = {}
        for arg_1 in arg_0.keys():
            if arg_1.startswith('multiproc_'):
                arg_3 = arg_1.replace('multiproc_', '')
                arg_2[arg_3] = arg_0[arg_1]
        arg_2['version'] = arg_0['version']
        if 'disable_existing_loggers' in arg_0:
            arg_2['disable_existing_loggers'] = arg_0['disable_existing_loggers']
        return arg_2

Searches for multiprocessing options in a given dictionary .


def Func ( arg_0 ) : try : arg_1 = eval ( arg_0 . builder . config . plot_gallery ) except TypeError : arg_1 = bool ( arg_0 . builder . config . plot_gallery ) gallery_conf . update ( arg_0 . config . sphinx_gallery_conf ) gallery_conf . update ( arg_1 = arg_1 ) gallery_conf . update ( abort_on_example_error = arg_0 . builder . config . abort_on_example_error ) arg_0 . config . sphinx_gallery_conf = gallery_conf arg_0 . config . html_static_path . append ( glr_path_static ( ) ) clean_gallery_out ( arg_0 . builder . outdir ) arg_4 = gallery_conf [ 'examples_dirs' ] arg_5 = gallery_conf [ 'gallery_dirs' ] if not isinstance ( arg_4 , list ) : arg_4 = [ arg_4 ] if not isinstance ( arg_5 , list ) : arg_5 = [ arg_5 ] arg_6 = os . path . relpath ( gallery_conf [ 'mod_example_dir' ] , arg_0 . builder . srcdir ) arg_7 = set ( ) for arg_8 , arg_9 in zip ( arg_4 , arg_5 ) : arg_8 = os . path . relpath ( arg_8 , arg_0 . builder . srcdir ) arg_9 = os . path . relpath ( arg_9 , arg_0 . builder . srcdir ) for arg_10 in [ arg_8 , arg_9 , arg_6 ] : if not os . path . exists ( arg_10 ) : os . makedirs ( arg_10 ) arg_11 = open ( os . path . join ( arg_9 , 'index.rst' ) , 'w' ) arg_11 . write ( generate_dir_rst ( arg_8 , arg_9 , gallery_conf , arg_7 ) ) for arg_12 in sorted ( os . listdir ( arg_8 ) ) : if os . path . isdir ( os . path . join ( arg_8 , arg_12 ) ) : arg_13 = os . path . join ( arg_8 , arg_12 ) arg_14 = os . path . join ( arg_9 , arg_12 ) arg_11 . write ( generate_dir_rst ( arg_13 , arg_14 , gallery_conf , arg_7 ) ) arg_11 . flush ( )

def Func(arg_0):
    """Generate the Main examples gallery reStructuredText

    Start the sphinx-gallery configuration and recursively scan the examples
    directories in order to populate the examples gallery
    """
    try:
        arg_1 = eval(arg_0.builder.config.plot_gallery)
    except TypeError:
        arg_1 = bool(arg_0.builder.config.plot_gallery)

    gallery_conf.update(arg_0.config.sphinx_gallery_conf)
    gallery_conf.update(arg_1=arg_1)
    gallery_conf.update(abort_on_example_error=arg_0.builder.config.abort_on_example_error)

    # this assures I can call the config in other places
    arg_0.config.sphinx_gallery_conf = gallery_conf
    arg_0.config.html_static_path.append(glr_path_static())

    clean_gallery_out(arg_0.builder.outdir)

    arg_4 = gallery_conf['examples_dirs']
    arg_5 = gallery_conf['gallery_dirs']

    if not isinstance(arg_4, list):
        arg_4 = [arg_4]
    if not isinstance(arg_5, list):
        arg_5 = [arg_5]

    arg_6 = os.path.relpath(gallery_conf['mod_example_dir'],
                                       arg_0.builder.srcdir)
    arg_7 = set()

    for arg_8, arg_9 in zip(arg_4, arg_5):
        arg_8 = os.path.relpath(arg_8,
                                       arg_0.builder.srcdir)
        arg_9 = os.path.relpath(arg_9,
                                      arg_0.builder.srcdir)

        for arg_10 in [arg_8, arg_9, arg_6]:
            if not os.path.exists(arg_10):
                os.makedirs(arg_10)

        # we create an index.rst with all examples
        arg_11 = open(os.path.join(arg_9, 'index.rst'), 'w')
        # Here we don't use an os.walk, but we recurse only twice: flat is
        # better than nested.
        arg_11.write(generate_dir_rst(arg_8, arg_9, gallery_conf,
                                       arg_7))
        for arg_12 in sorted(os.listdir(arg_8)):
            if os.path.isdir(os.path.join(arg_8, arg_12)):
                arg_13 = os.path.join(arg_8, arg_12)
                arg_14 = os.path.join(arg_9, arg_12)
                arg_11.write(generate_dir_rst(arg_13, arg_14,
                                               gallery_conf,
                                               arg_7))
        arg_11.flush()


(self,
             lumping=None,
             summary=False,
             sort=True,
             plot=True,
             legend=None,
             ax=None
             )

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
False
,
arg_3
=
True
,
arg_4
=
True
,
arg_5
=
,
arg_6
=
)
:
arg_7
=
[
]
arg_8
=
[
]
arg_9
=
defaultdict
(
int
)
for
arg_10
in
arg_0
:
if
arg_1
:
arg_11
=
arg_10
.
primary
[
arg_1
]
else
:
if
arg_2
:
arg_11
=
arg_10
.
primary
.
summary
(
)
else
:
arg_11
=
arg_10
.
primary
arg_7
.
append
(
arg_10
.
primary
)
arg_8
.
append
(
arg_10
.
primary
.
summary
(
)
)
arg_9
[
arg_11
]
+=
arg_10
.
thickness
if
arg_3
:
arg_12
=
sorted
(
arg_9
.
items
(
)
,
key
=
lambda
arg_10
:
arg_10
[
1
]
,
reverse
=
True
)
arg_13
,
arg_14
=
zip
(
*
arg_12
)
else
:
arg_13
,
arg_14
=
tuple
(
arg_9
.
keys
(
)
)
,
tuple
(
arg_9
.
values
(
)
)
if
arg_4
:
if
arg_6
is
:
arg_15
,
arg_6
=
plt
.
subplots
(
)
arg_16
=
False
else
:
arg_16
=
True
arg_17
=
np
.
arange
(
len
(
arg_13
)
)
arg_18
=
arg_6
.
bar
(
arg_17
,
arg_14
,
align
=
'center'
)
arg_6
.
set_xticks
(
arg_17
)
arg_6
.
set_xticklabels
(
arg_8
)
if
arg_5
:
arg_19
=
[
arg_5
.
get_colour
(
arg_21
)
for
arg_21
in
arg_7
]
for
arg_20
,
arg_21
in
zip
(
arg_18
,
arg_19
)
:
arg_20
.
set_color
(
arg_21
)
arg_6
.
set_ylabel
(
'Thickness [m]'
)
else
:
arg_18
=
[
]
if
arg_4
and
arg_16
:
return
arg_14
,
arg_13
,
arg_6
return
arg_14
,
arg_13
,
arg_18

def Func(arg_0,
             arg_1=None,
             arg_2=False,
             arg_3=True,
             arg_4=True,
             arg_5=None,
             arg_6=None
             ):
        """
        Plots a Funcogram and returns the data for it.

        Args:
            lumping (str): If given, the bins will be lumped based on this
                attribute of the primary components of the intervals
                encountered.
            summary (bool): If True, the summaries of the components are
                returned as the bins. Otherwise, the default behaviour is to
                return the Components themselves.
            sort (bool): If True (default), the Funcogram is sorted by value,
                starting with the largest.
            plot (bool): If True (default), produce a bar plot.
            legend (Legend): The legend with which to colour the bars.
            ax (axis): An axis object, which will be returned if provided.
                If you don't provide one, it will be created but not returned.

        Returns:
            Tuple: A tuple of tuples of entities and counts.

        TODO:
            Deal with numeric properties, so I can Funcogram 'Vp' values, say.
        """
        # This seems like overkill, but collecting all this stuff gives
        # the user some choice about what they get back.
        arg_7 = []
        arg_8 = []
        arg_9 = defaultdict(int)
        for arg_10 in arg_0:
            if arg_1:
                arg_11 = arg_10.primary[arg_1]
            else:
                if arg_2:
                    arg_11 = arg_10.primary.summary()
                else:
                    arg_11 = arg_10.primary
            arg_7.append(arg_10.primary)
            arg_8.append(arg_10.primary.summary())
            arg_9[arg_11] += arg_10.thickness

        if arg_3:
            arg_12 = sorted(arg_9.items(), key=lambda arg_10: arg_10[1], reverse=True)
            arg_13, arg_14 = zip(*arg_12)
        else:
            arg_13, arg_14 = tuple(arg_9.keys()), tuple(arg_9.values())

        # Make plot.
        if arg_4:
            if arg_6 is None:
                arg_15, arg_6 = plt.subplots()
                arg_16 = False
            else:
                arg_16 = True
            arg_17 = np.arange(len(arg_13))
            arg_18 = arg_6.bar(arg_17, arg_14, align='center')
            arg_6.set_xticks(arg_17)
            arg_6.set_xticklabels(arg_8)
            if arg_5:
                arg_19 = [arg_5.get_colour(arg_21) for arg_21 in arg_7]
                for arg_20, arg_21 in zip(arg_18, arg_19):
                    arg_20.set_color(arg_21)
            arg_6.set_ylabel('Thickness [m]')
        else:
            arg_18 = []

        if arg_4 and arg_16:
            return arg_14, arg_13, arg_6

        return arg_14, arg_13, arg_18

Plots a histogram and returns the data for it.

        Args:
            lumping (str): If given, the bins will be lumped based on this
                attribute of the primary components of the intervals
                encountered.
            summary (bool): If True, the summaries of the components are
                returned as the bins. Otherwise, the default behaviour is to
                return the Components themselves.
            sort (bool): If True (default), the histogram is sorted by value,
                starting with the largest.
            plot (bool): If True (default), produce a bar plot.
            legend (Legend): The legend with which to colour the bars.
            ax (axis): An axis object, which will be returned if provided.
                If you don't provide one, it will be created but not returned.

        Returns:
            Tuple: A tuple of tuples of entities and counts.

        TODO:
            Deal with numeric properties, so I can histogram 'Vp' values, say.

Plots a histogram and returns the data for it .


(in_file,
                 out_file,
                 size=None,
                 ratio=None,
                 keep_ar=False,
                 log_level='info',
                 print_cmd=False,
                 **kwargs)

def Func(arg_0,
                 arg_1,
                 arg_2=None,
                 arg_3=None,
                 arg_4=False,
                 arg_5='info',
                 arg_6=False,
                 **arg_7):
    """Resize a video.

    Args:
        in_file (str): Input video filename.
        out_file (str): Output video filename.
        size (tuple): Expected size (w, h), eg, (320, 240) or (320, -1).
        ratio (tuple or float): Expected resize ratio, (2, 0.5) means
            (w*2, h*0.5).
        keep_ar (bool): Whether to keep original aspect ratio.
        log_level (str): Logging level of ffmpeg.
        print_cmd (bool): Whether to print the final ffmpeg command.
    """
    if arg_2 is None and arg_3 is None:
        raise ValueError('expected size or ratio must be specified')
    elif arg_2 is not None and arg_3 is not None:
        raise ValueError('size and ratio cannot be specified at the same time')
    arg_8 = {'log_level': arg_5}
    if arg_2:
        if not arg_4:
            arg_8['vf'] = 'scale={}:{}'.format(arg_2[0], arg_2[1])
        else:
            arg_8['vf'] = ('scale=w={}:h={}:force_original_aspect_ratio'
                             '=decrease'.format(arg_2[0], arg_2[1]))
    else:
        if not isinstance(arg_3, tuple):
            arg_3 = (arg_3, arg_3)
        arg_8['vf'] = 'scale="trunc(iw*{}):trunc(ih*{})"'.format(
            arg_3[0], arg_3[1])
    convert_video(arg_0, arg_1, arg_6, **arg_8)


def Func ( arg_0 ) : if isinstance ( arg_0 , dict ) : return _PrettyDict ( { arg_1 : Func ( arg_2 ) for arg_1 , arg_2 in arg_0 . items ( ) } ) if ( isinstance ( arg_0 , collections . Sequence ) and not isinstance ( arg_0 , six . string_types ) ) : arg_3 = ( Func ( x_ ) for x_ in arg_0 ) arg_4 = ( isinstance ( arg_0 , tuple ) and hasattr ( arg_0 , "_asdict" ) and hasattr ( arg_0 , "_fields" ) ) return type ( arg_0 ) ( * arg_3 ) if arg_4 else type ( arg_0 ) ( arg_3 ) if isinstance ( arg_0 , collections . Mapping ) : return type ( arg_0 ) ( ** { arg_1 : Func ( arg_2 ) for arg_1 , arg_2 in arg_0 . items ( ) } ) return arg_0

def Func(arg_0):
  """Recursively replace `dict`s with `_PrettyDict`."""
  # We use "PrettyDict" because collections.OrderedDict repr/str has the word
  # "OrderedDict" in it. We only want to print "OrderedDict" if in fact the
  # input really is an OrderedDict.
  if isinstance(arg_0, dict):
    return _PrettyDict({
        arg_1: Func(arg_2)
        for arg_1, arg_2 in arg_0.items()})
  if (isinstance(arg_0, collections.Sequence) and
      not isinstance(arg_0, six.string_types)):
    arg_3 = (Func(x_) for x_ in arg_0)
    arg_4 = (isinstance(arg_0, tuple) and
                      hasattr(arg_0, "_asdict") and
                      hasattr(arg_0, "_fields"))
    return type(arg_0)(*arg_3) if arg_4 else type(arg_0)(arg_3)
  if isinstance(arg_0, collections.Mapping):
    return type(arg_0)(**{arg_1: Func(arg_2)
                      for arg_1, arg_2 in arg_0.items()})
  return arg_0

Recursively replace dict s with _PrettyDict .


def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
)
:
arg_3
=
arg_0
.
_rectify_products
(
arg_2
)
arg_4
=
{
'timestamp'
:
util_time
.
timestamp
(
)
,
'product'
:
arg_3
,
}
if
arg_3
is
not
:
if
not
all
(
map
(
os
.
path
.
exists
,
arg_3
)
)
:
raise
IOError
(
'The stamped product must exist: {}'
.
format
(
arg_3
)
)
arg_4
[
'product_file_hash'
]
=
arg_0
.
_product_file_hash
(
arg_3
)
arg_0
.
cacher
.
save
(
arg_4
,
arg_1
=
arg_1
)
return
arg_4

def Func(arg_0, arg_1=None, arg_2=None):
        """
        Recertify that the product has been recomputed by writing a new
        certificate to disk.
        """
        arg_3 = arg_0._rectify_products(arg_2)
        arg_4 = {
            'timestamp': util_time.timestamp(),
            'product': arg_3,
        }
        if arg_3 is not None:
            if not all(map(os.path.exists, arg_3)):
                raise IOError(
                    'The stamped product must exist: {}'.format(arg_3))
            arg_4['product_file_hash'] = arg_0._product_file_hash(arg_3)
        arg_0.cacher.save(arg_4, arg_1=arg_1)
        return arg_4

Recertify that the product has been recomputed by writing a new certificate to disk .


(shape, dtype=tf.float32, seed=None, name=None)

def Func(arg_0, arg_1=arg_2.float32, arg_4=None, arg_5=None):
  """Generates `Tensor` consisting of `-1` or `+1`, chosen uniformly at random.

  For more details, see [Rademacher distribution](
  https://en.wikipedia.org/wiki/Rademacher_distribution).

  Args:
    shape: Vector-shaped, `int` `Tensor` representing shape of output.
    dtype: (Optional) TF `dtype` representing `dtype` of output.
    seed: (Optional) Python integer to seed the random number generator.
    name: Python `str` name prefixed to Ops created by this function.
      Default value: `None` (i.e., 'Func').

  Returns:
    rademacher: `Tensor` with specified `shape` and `dtype` consisting of `-1`
      or `+1` chosen uniformly-at-random.
  """
  with arg_2.compat.v1.name_scope(arg_5, 'Func', [arg_0, arg_4]):
    # Choose the dtype to cause `2 * random_bernoulli - 1` to run in the same
    # memory (host or device) as the downstream cast will want to put it.  The
    # convention on GPU is that int32 are in host memory and int64 are in device
    # memory.
    arg_6 = arg_2.int64 if arg_2.as_dtype(arg_1) != arg_2.int32 else arg_2.int32
    arg_7 = arg_2.random.uniform(
        arg_0, minval=0, maxval=2, arg_1=arg_6, arg_4=arg_4)
    return arg_2.cast(2 * arg_7 - 1, arg_1)

Generates `Tensor` consisting of `-1` or `+1`, chosen uniformly at random.

  For more details, see [Rademacher distribution](
  https://en.wikipedia.org/wiki/Rademacher_distribution).

  Args:
    shape: Vector-shaped, `int` `Tensor` representing shape of output.
    dtype: (Optional) TF `dtype` representing `dtype` of output.
    seed: (Optional) Python integer to seed the random number generator.
    name: Python `str` name prefixed to Ops created by this function.
      Default value: `None` (i.e., 'random_rademacher').

  Returns:
    rademacher: `Tensor` with specified `shape` and `dtype` consisting of `-1`
      or `+1` chosen uniformly-at-random.

Generates Tensor consisting of - 1 or + 1 chosen uniformly at random .


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 , arg_3 in arg_0 . _state [ 'swarms' ] . iteritems ( ) : if arg_3 [ 'status' ] == 'completing' : arg_1 . append ( arg_2 ) return arg_1

def Func(arg_0):
    """Return the list of all completing swarms.

    Parameters:
    ---------------------------------------------------------------------
    retval:   list of active swarm Ids
    """
    arg_1 = []
    for arg_2, arg_3 in arg_0._state['swarms'].iteritems():
      if arg_3['status'] == 'completing':
        arg_1.append(arg_2)

    return arg_1

Return the list of all completing swarms .


def
Func
(
arg_0
)
:
try
:
arg_0
.
log
.
debug
(
"Loading IPython extensions..."
)
arg_1
=
arg_0
.
default_extensions
+
arg_0
.
extensions
for
arg_2
in
arg_1
:
try
:
arg_0
.
log
.
info
(
"Loading IPython extension: %s"
%
arg_2
)
arg_0
.
shell
.
extension_manager
.
load_extension
(
arg_2
)
except
:
arg_0
.
log
.
warn
(
"Error in loading extension: %s"
%
arg_2
+
"\nCheck your config files in %s"
%
arg_0
.
profile_dir
.
location
)
arg_0
.
shell
.
showtraceback
(
)
except
:
arg_0
.
log
.
warn
(
"Unknown error in loading extensions:"
)
arg_0
.
shell
.
showtraceback
(
)

def Func(arg_0):
        """Load all IPython extensions in IPythonApp.extensions.

        This uses the :meth:`ExtensionManager.load_extensions` to load all
        the extensions listed in ``self.extensions``.
        """
        try:
            arg_0.log.debug("Loading IPython extensions...")
            arg_1 = arg_0.default_extensions + arg_0.extensions
            for arg_2 in arg_1:
                try:
                    arg_0.log.info("Loading IPython extension: %s" % arg_2)
                    arg_0.shell.extension_manager.load_extension(arg_2)
                except:
                    arg_0.log.warn("Error in loading extension: %s" % arg_2 +
                        "\nCheck your config files in %s" % arg_0.profile_dir.location
                    )
                    arg_0.shell.showtraceback()
        except:
            arg_0.log.warn("Unknown error in loading extensions:")
            arg_0.shell.showtraceback()

Load all IPython extensions in IPythonApp . extensions .


def Func ( arg_0 , arg_1 ) : def pairwise_intersect ( arg_2 , arg_3 ) : arg_4 = set ( arg_3 ) arg_5 = [ val for val in arg_2 if val in arg_4 ] return arg_5 arg_1 = list ( arg_1 ) arg_6 = len ( arg_1 ) while arg_6 > 1 : arg_2 = arg_1 . pop ( ) arg_3 = arg_1 . pop ( ) arg_7 = pairwise_intersect ( arg_2 , arg_3 ) arg_1 . append ( arg_7 ) arg_6 = len ( arg_1 ) return arg_1 [ 0 ]

def Func(arg_0, arg_1):
        """
        Find the intersection of any number of 1D arrays.
        Return the sorted, unique values that are in all of the input arrays.
        Adapted from numpy.lib.arraysetops.intersect1d
        """
        def pairwise_intersect(arg_2, arg_3):
            arg_4 = set(arg_3)
            arg_5 = [val for val in arg_2 if val in arg_4]
            return arg_5

        arg_1 = list(arg_1) # allow assignment
        arg_6 = len(arg_1)
        while arg_6 > 1:
            arg_2 = arg_1.pop()
            arg_3 = arg_1.pop()
            arg_7 = pairwise_intersect(arg_2, arg_3)
            arg_1.append(arg_7)
            arg_6 = len(arg_1)

        return arg_1[0]

Find the intersection of any number of 1D arrays . Return the sorted unique values that are in all of the input arrays . Adapted from numpy . lib . arraysetops . intersect1d


Start an nmap process with the given args on the given ips.

def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
Config
(
)
arg_3
=
[
'Func'
,
'-Pn'
]
arg_3
.
extend
(
arg_1
)
arg_3
.
extend
(
arg_0
)
arg_4
=
''
arg_5
=
datetime
.
datetime
.
now
(
)
if
not
'-oA'
in
arg_0
:
arg_6
=
'Func_jackal_{}'
.
format
(
arg_5
.
strftime
(
"%Y-%m-%d %H:%M"
)
)
arg_7
=
os
.
path
.
join
(
arg_2
.
get
(
'Func'
,
'directory'
)
,
arg_6
)
print_notification
(
"Writing output of Func to {}"
.
format
(
arg_7
)
)
if
not
os
.
path
.
exists
(
arg_2
.
get
(
'Func'
,
'directory'
)
)
:
os
.
makedirs
(
arg_2
.
get
(
'Func'
,
'directory'
)
)
arg_4
=
arg_7
+
'.xml'
arg_3
.
extend
(
[
'-oA'
,
arg_7
]
)
else
:
arg_4
=
arg_0
[
arg_0
.
index
(
'-oA'
)
+
1
]
+
'.xml'
print_notification
(
"Starting Func"
)
subprocess
.
call
(
arg_3
)
with
open
(
arg_4
,
'r'
)
as
f
:
return
f
.
read
(
)

def Func(arg_0, arg_1):
    """
        Start an Func process with the given args on the given ips.
    """
    arg_2 = Config()
    arg_3 = ['Func', '-Pn']
    arg_3.extend(arg_1)
    arg_3.extend(arg_0)
    arg_4 = ''
    arg_5 = datetime.datetime.now()
    if not '-oA' in arg_0:
        arg_6 = 'Func_jackal_{}'.format(arg_5.strftime("%Y-%m-%d %H:%M"))
        arg_7 = os.path.join(arg_2.get('Func', 'directory'), arg_6)
        print_notification("Writing output of Func to {}".format(arg_7))
        if not os.path.exists(arg_2.get('Func', 'directory')):
            os.makedirs(arg_2.get('Func', 'directory'))
        arg_4 = arg_7 + '.xml'
        arg_3.extend(['-oA', arg_7])
    else:
        arg_4 = arg_0[arg_0.index('-oA') + 1] + '.xml'

    print_notification("Starting Func")
    subprocess.call(arg_3)

    with open(arg_4, 'r') as f:
        return f.read()

Start an nmap process with the given args on the given ips .


def Func(arg_0, arg_1, arg_2):
        """
        Post a new message to a conversation.

        :param conversation_id: The unique id for the conversation.
        :type conversation_id: :py:class:`str`
        :param data: The request body parameters
        :type data: :py:class:`dict`
        data = {
            "from_email": string*,
            "read": boolean*
        }
        """
        arg_0.conversation_id = arg_1
        if 'from_email' not in arg_2:
            raise KeyError('The conversation message must have a from_email')
        check_email(arg_2['from_email'])
        if 'read' not in arg_2:
            raise KeyError('The conversation message must have a read')
        if arg_2['read'] not in [True, False]:
            raise TypeError('The conversation message read must be True or False')
        arg_3 =  arg_0._mc_client._post(url=arg_0._build_path(arg_1, 'messages'), arg_2=arg_2)
        if arg_3 is not None:
            arg_0.message_id = arg_3['id']
        else:
            arg_0.message_id = None
        return arg_3


(self, line_kwargs=None, scatter_kwargs=None, pos=None)

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = None ) : if arg_3 is not None : arg_0 . set_pos ( arg_3 ) elif arg_0 . pos is None : arg_0 . set_pos ( ) arg_4 = [ 0 for arg_5 in arg_0 . edges ( ) ] for arg_5 in arg_0 . edges ( ) : arg_6 = arg_0 . edge_index [ arg_5 ] arg_4 [ arg_6 ] = ( arg_0 . pos [ arg_5 [ 0 ] ] , arg_0 . pos [ arg_5 [ 1 ] ] ) arg_7 = { 'segments' : arg_4 , 'colors' : arg_0 . edge_color , 'linewidths' : ( 1 , ) , 'antialiaseds' : ( 1 , ) , 'linestyle' : 'solid' , 'transOffset' : None , 'cmap' : plt . cm . ocean_r , 'pickradius' : 5 , 'zorder' : 0 , 'facecolors' : None , 'norm' : None , 'offsets' : None , 'offset_position' : 'screen' , 'hatch' : None , } arg_8 = { 'x' : arg_0 . pos [ : , 0 ] , 'y' : arg_0 . pos [ : , 1 ] , 's' : 50 , 'c' : arg_0 . vertex_fill_color , 'alpha' : None , 'norm' : None , 'vmin' : None , 'vmax' : None , 'marker' : 'o' , 'zorder' : 2 , 'cmap' : plt . cm . ocean_r , 'linewidths' : 1 , 'edgecolors' : arg_0 . vertex_color , 'facecolors' : None , 'antialiaseds' : None , 'offset_position' : 'screen' , 'hatch' : None , } arg_1 = { } if arg_1 is None else arg_1 arg_2 = { } if arg_2 is None else arg_2 for arg_9 , arg_10 in arg_1 . items ( ) : if arg_9 in arg_7 : arg_7 [ arg_9 ] = arg_10 for arg_9 , arg_10 in arg_2 . items ( ) : if arg_9 in arg_8 : arg_8 [ arg_9 ] = arg_10 return arg_7 , arg_8

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):
        """Returns the arguments used when plotting.

        Takes any keyword arguments for
        :class:`~matplotlib.collections.LineCollection` and
        :meth:`~matplotlib.axes.Axes.scatter` and returns two
        dictionaries with all the defaults set.

        Parameters
        ----------
        line_kwargs : dict (optional, default: ``None``)
            Any keyword arguments accepted by
            :class:`~matplotlib.collections.LineCollection`.
        scatter_kwargs : dict (optional, default: ``None``)
            Any keyword arguments accepted by
            :meth:`~matplotlib.axes.Axes.scatter`.

        Returns
        -------
        tuple
            A 2-tuple of dicts. The first entry is the keyword
            arguments for
            :class:`~matplotlib.collections.LineCollection` and the
            second is the keyword args for
            :meth:`~matplotlib.axes.Axes.scatter`.

        Notes
        -----
        If a specific keyword argument is not passed then the defaults
        are used.
        """
        if arg_3 is not None:
            arg_0.set_pos(arg_3)
        elif arg_0.pos is None:
            arg_0.set_pos()

        arg_4 = [0 for arg_5 in arg_0.edges()]
        for arg_5 in arg_0.edges():
            arg_6 = arg_0.edge_index[arg_5]
            arg_4[arg_6] = (arg_0.pos[arg_5[0]], arg_0.pos[arg_5[1]])

        arg_7 = {
            'segments': arg_4,
            'colors': arg_0.edge_color,
            'linewidths': (1,),
            'antialiaseds': (1,),
            'linestyle': 'solid',
            'transOffset': None,
            'cmap': plt.cm.ocean_r,
            'pickradius': 5,
            'zorder': 0,
            'facecolors': None,
            'norm': None,
            'offsets': None,
            'offset_position': 'screen',
            'hatch': None,
        }
        arg_8 = {
            'x': arg_0.pos[:, 0],
            'y': arg_0.pos[:, 1],
            's': 50,
            'c': arg_0.vertex_fill_color,
            'alpha': None,
            'norm': None,
            'vmin': None,
            'vmax': None,
            'marker': 'o',
            'zorder': 2,
            'cmap': plt.cm.ocean_r,
            'linewidths': 1,
            'edgecolors': arg_0.vertex_color,
            'facecolors': None,
            'antialiaseds': None,
            'offset_position': 'screen',
            'hatch': None,
        }

        arg_1 = {} if arg_1 is None else arg_1
        arg_2 = {} if arg_2 is None else arg_2

        for arg_9, arg_10 in arg_1.items():
            if arg_9 in arg_7:
                arg_7[arg_9] = arg_10

        for arg_9, arg_10 in arg_2.items():
            if arg_9 in arg_8:
                arg_8[arg_9] = arg_10

        return arg_7, arg_8

Returns the arguments used when plotting .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
make_client
(
)
arg_3
=
{
'code'
:
arg_1
.
get
(
'code'
)
,
'client_secret'
:
arg_0
.
consumer_secret
,
'redirect_uri'
:
session
.
get
(
'%s_oauthredir'
%
arg_0
.
name
)
}
log
.
debug
(
'Prepare oauth2 remote args %r'
,
arg_3
)
arg_3
.
update
(
arg_0
.
access_token_params
)
arg_4
=
copy
(
arg_0
.
_access_token_headers
)
if
arg_0
.
access_token_method
==
'POST'
:
arg_4
.
update
(
{
'Content-Type'
:
'application/x-www-form-urlencoded'
}
)
arg_5
=
arg_2
.
prepare_request_body
(
**
arg_3
)
arg_6
,
arg_7
=
arg_0
.
http_request
(
arg_0
.
expand_url
(
arg_0
.
access_token_url
)
,
arg_4
=
arg_4
,
arg_10
=
to_bytes
(
arg_5
,
arg_0
.
encoding
)
,
method
=
arg_0
.
access_token_method
,
)
elif
arg_0
.
access_token_method
==
'GET'
:
arg_8
=
arg_2
.
prepare_request_body
(
**
arg_3
)
arg_9
=
arg_0
.
expand_url
(
arg_0
.
access_token_url
)
arg_9
+=
(
'?'
in
arg_9
and
'&'
or
'?'
)
+
arg_8
arg_6
,
arg_7
=
arg_0
.
http_request
(
arg_9
,
arg_4
=
arg_4
,
method
=
arg_0
.
access_token_method
,
)
else
:
raise
OAuthException
(
'Unsupported access_token_method: %s'
%
arg_0
.
access_token_method
)
arg_10
=
parse_response
(
arg_6
,
arg_7
,
content_type
=
arg_0
.
content_type
)
if
arg_6
.
code
not
in
(
200
,
201
)
:
raise
OAuthException
(
'Invalid response from %s'
%
arg_0
.
name
,
type
=
'invalid_response'
,
arg_10
=
arg_10
)
return
arg_10

def Func(arg_0, arg_1):
        """Handles an oauth2 authorization response."""

        arg_2 = arg_0.make_client()
        arg_3 = {
            'code': arg_1.get('code'),
            'client_secret': arg_0.consumer_secret,
            'redirect_uri': session.get('%s_oauthredir' % arg_0.name)
        }
        log.debug('Prepare oauth2 remote args %r', arg_3)
        arg_3.update(arg_0.access_token_params)
        arg_4 = copy(arg_0._access_token_headers)
        if arg_0.access_token_method == 'POST':
            arg_4.update({'Content-Type': 'application/x-www-form-urlencoded'})
            arg_5 = arg_2.prepare_request_body(**arg_3)
            arg_6, arg_7 = arg_0.http_request(
                arg_0.expand_url(arg_0.access_token_url),
                arg_4=arg_4,
                arg_10=to_bytes(arg_5, arg_0.encoding),
                method=arg_0.access_token_method,
            )
        elif arg_0.access_token_method == 'GET':
            arg_8 = arg_2.prepare_request_body(**arg_3)
            arg_9 = arg_0.expand_url(arg_0.access_token_url)
            arg_9 += ('?' in arg_9 and '&' or '?') + arg_8
            arg_6, arg_7 = arg_0.http_request(
                arg_9,
                arg_4=arg_4,
                method=arg_0.access_token_method,
            )
        else:
            raise OAuthException(
                'Unsupported access_token_method: %s' %
                arg_0.access_token_method
            )

        arg_10 = parse_response(arg_6, arg_7, content_type=arg_0.content_type)
        if arg_6.code not in (200, 201):
            raise OAuthException(
                'Invalid response from %s' % arg_0.name,
                type='invalid_response', arg_10=arg_10
            )
        return arg_10

Handles an oauth2 authorization response .


def Func ( arg_0 , arg_1 = None , ** arg_2 ) : def _match_all ( arg_3 , arg_4 ) : return all ( getattr ( arg_3 , arg_5 , None ) == arg_6 for arg_5 , arg_6 in arg_4 . items ( ) ) arg_7 = { } arg_8 = { } for arg_9 , arg_10 in arg_2 . items ( ) : if all ( arg_9 in arg_11 . configuration ( ) for arg_11 in arg_0 ) : arg_7 [ arg_9 ] = arg_10 else : arg_8 [ arg_9 ] = arg_10 if arg_7 : arg_0 = [ b for b in arg_0 if _match_all ( b . configuration ( ) , arg_7 ) ] if arg_8 : arg_0 = [ b for b in arg_0 if _match_all ( b . status ( ) , arg_8 ) ] arg_0 = list ( filter ( arg_1 , arg_0 ) ) return arg_0

def Func(arg_0, arg_1=None, **arg_2):
    """Return the backends matching the specified filtering.

    Filter the `backends` list by their `configuration` or `status`
    attributes, or from a boolean callable. The criteria for filtering can
    be specified via `**kwargs` or as a callable via `filters`, and the
    backends must fulfill all specified conditions.

    Args:
        backends (list[BaseBackend]): list of backends.
        filters (callable): filtering conditions as a callable.
        **kwargs (dict): dict of criteria.

    Returns:
        list[BaseBackend]: a list of backend instances matching the
            conditions.
    """
    def _match_all(arg_3, arg_4):
        """Return True if all items in criteria matches items in obj."""
        return all(getattr(arg_3, arg_5, None) == arg_6 for
                   arg_5, arg_6 in arg_4.items())

    # Inspect the backends to decide which filters belong to
    # backend.configuration and which ones to backend.status, as it does
    # not involve querying the API.
    arg_7 = {}
    arg_8 = {}
    for arg_9, arg_10 in arg_2.items():
        if all(arg_9 in arg_11.configuration() for arg_11 in arg_0):
            arg_7[arg_9] = arg_10
        else:
            arg_8[arg_9] = arg_10

    # 1. Apply backend.configuration filtering.
    if arg_7:
        arg_0 = [b for b in arg_0 if
                    _match_all(b.configuration(), arg_7)]

    # 2. Apply backend.status filtering (it involves one API call for
    # each backend).
    if arg_8:
        arg_0 = [b for b in arg_0 if
                    _match_all(b.status(), arg_8)]

    # 3. Apply acceptor filter.
    arg_0 = list(filter(arg_1, arg_0))

    return arg_0

Return the backends matching the specified filtering .


def
Func
(
arg_0
)
:
arg_1
=
urijoin
(
arg_0
.
base_url
,
"rate_limit"
)
try
:
arg_2
=
arg_0
.
archive
arg_0
.
archive
=
arg_4
=
super
(
)
.
fetch
(
arg_1
)
arg_0
.
archive
=
arg_2
arg_0
.
update_rate_limit
(
arg_4
)
arg_0
.
last_rate_limit_checked
=
arg_0
.
rate_limit
except
requests
.
exceptions
.
HTTPError
as
error
:
if
error
.
response
.
status_code
==
404
:
logger
.
warning
(
"Rate limit not initialized: %s"
,
error
)
else
:
raise
error

def Func(arg_0):
        """Update rate limits data for the current token"""

        arg_1 = urijoin(arg_0.base_url, "rate_limit")
        try:
            # Turn off archiving when checking rates, because that would cause
            # archive key conflict (the same URLs giving different responses)
            arg_2 = arg_0.archive
            arg_0.archive = None
            arg_4 = super().fetch(arg_1)
            arg_0.archive = arg_2
            arg_0.update_rate_limit(arg_4)
            arg_0.last_rate_limit_checked = arg_0.rate_limit
        except requests.exceptions.HTTPError as error:
            if error.response.status_code == 404:
                logger.warning("Rate limit not initialized: %s", error)
            else:
                raise error


def Func ( arg_0 = False , arg_1 = "" , arg_2 = "" ) : arg_3 = os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , "wordlists" , ) if arg_0 : arg_4 = "sowpods.txt" else : arg_4 = "twl.txt" arg_5 = os . path . join ( arg_3 , arg_4 ) with open ( arg_5 ) as wordfile : for arg_6 in wordfile . readlines ( ) : arg_6 = arg_6 . strip ( ) if arg_1 and arg_2 and arg_6 . startswith ( arg_1 ) and arg_6 . endswith ( arg_2 ) : yield arg_6 elif arg_1 and arg_6 . startswith ( arg_1 ) and not arg_2 : yield arg_6 elif arg_2 and arg_6 . endswith ( arg_2 ) and not arg_1 : yield arg_6 elif not arg_1 and not arg_2 : yield arg_6

def Func(arg_0=False, arg_1="", arg_2=""):
    """Opens the word list file.

    Args:
        sowpods: a boolean to declare using the sowpods list or TWL (default)
        start: a string of starting characters to find anagrams based on
        end: a string of ending characters to find anagrams based on

    Yeilds:
        a word at a time out of 178691 words for TWL, 267751 for sowpods. Much
        less if either start or end are used (filtering is applied here)
    """

    arg_3 = os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
        "wordlists",
    )

    if arg_0:
        arg_4 = "sowpods.txt"
    else:
        arg_4 = "twl.txt"

    arg_5 = os.path.join(arg_3, arg_4)

    with open(arg_5) as wordfile:
        for arg_6 in wordfile.readlines():
            arg_6 = arg_6.strip()
            if arg_1 and arg_2 and arg_6.startswith(arg_1) and arg_6.endswith(arg_2):
                yield arg_6
            elif arg_1 and arg_6.startswith(arg_1) and not arg_2:
                yield arg_6
            elif arg_2 and arg_6.endswith(arg_2) and not arg_1:
                yield arg_6
            elif not arg_1 and not arg_2:
                yield arg_6


def Func(arg_0):
    r"""Lanczos window also known as sinc window.

    :param N: window length

    .. math:: w(n) = sinc \left(  \frac{2n}{N-1} - 1 \right)

    .. plot::
        :width: 80%
        :include-source:

        from spectrum import window_visu
        window_visu(64, 'lanczos')

    .. seealso:: :func:`create_window`, :class:`Window`
    """
    if arg_0 ==1:
        return ones(1)

    arg_1 = linspace(-arg_0/2., arg_0/2., arg_0)
    arg_2 = sinc(2*arg_1/(arg_0-1.))
    return arg_2

r Lanczos window also known as sinc window .


Runs the standard Django syncdb command for one or more sites.

(self, site=None, all=0, database=None, ignore_errors=1)

def Func(arg_0, arg_1=None, arg_2=0, arg_3=None, arg_4=1): # pylint: disable=redefined-builtin
        """
        Runs the standard Django Func command for one or more sites.
        """
        arg_5 = arg_0.local_renderer

        arg_4 = int(arg_4)

        arg_6 = arg_0.version_tuple >= (1, 7, 0)

        arg_7 = arg_0.version_tuple >= (1, 9, 0)

        # DEPRECATED: removed in Django>=1.7
        arg_5.env.db_Func_all_flag = '--all' if int(arg_2) else ''

        arg_5.env.db_Func_database = ''
        if arg_3:
            arg_5.env.db_Func_database = ' --database=%s' % arg_3

        if arg_0.is_local:
            arg_5.env.project_dir = arg_5.env.local_project_dir

        arg_1 = arg_1 or arg_0.genv.SITE
        for arg_12, arg_13 in arg_5.iter_unique_databases(arg_1=arg_1):
            arg_5.env.SITE = arg_12
            with arg_0.settings(warn_only=arg_4):
                if arg_6:
                    if arg_7:
                        arg_5.run_or_local(
                            'export SITE={SITE}; export ROLE={ROLE}; cd {project_dir}; '
                            '{manage_cmd} migrate --run-Func --noinput {db_Func_database}')
                    else:
                        # Between Django>=1.7,<1.9 we can only do a regular migrate, no true Func.
                        arg_5.run_or_local(
                            'export SITE={SITE}; export ROLE={ROLE}; cd {project_dir}; '
                            '{manage_cmd} migrate --noinput {db_Func_database}')
                else:
                    arg_5.run_or_local(
                        'export SITE={SITE}; export ROLE={ROLE}; cd {project_dir}; '
                        '{manage_cmd} Func --noinput {db_Func_all_flag} {db_Func_database}')

Runs the standard Django syncdb command for one or more sites .


def Func ( arg_0 ) : Func = tf . TensorShape ( [ ] ) for arg_2 in arg_0 . parameters : Func = tf . broadcast_static_shape ( Func , arg_2 . prior . batch_shape ) return Func

def Func(arg_0):
    """Static batch shape of models represented by this component.

    Returns:
      batch_shape: A `tf.TensorShape` giving the broadcast batch shape of
        all model parameters. This should match the batch shape of
        derived state space models, i.e.,
        `self.make_state_space_model(...).batch_shape`. It may be partially
        defined or unknown.
    """
    Func = tf.TensorShape([])
    for arg_2 in arg_0.parameters:
      Func = tf.broadcast_static_shape(
          Func, arg_2.prior.batch_shape)
    return Func

Static batch shape of models represented by this component .


(t, clip_value_min, clip_value_max,
                                    name=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = None ) : with tf . compat . v1 . name_scope ( arg_3 , 'Func' , [ arg_0 , arg_1 , arg_2 ] ) : arg_0 = tf . convert_to_tensor ( value = arg_0 , arg_3 = 't' ) arg_4 = tf . clip_by_value ( arg_0 , arg_1 , arg_2 ) return arg_0 + tf . stop_gradient ( arg_4 - arg_0 )

def Func(arg_0, arg_1, arg_2,
                                    arg_3=None):
  """Clips values to a specified min and max while leaving gradient unaltered.

  Like `tf.clip_by_value`, this function returns a tensor of the same type and
  shape as input `t` but with values clamped to be no smaller than to
  `clip_value_min` and no larger than `clip_value_max`. Unlike
  `tf.clip_by_value`, the gradient is unaffected by this op, i.e.,

  ```python
  tf.gradients(tfp.math.Func(x), x)[0]
  # ==> ones_like(x)
  ```

  Note: `clip_value_min` needs to be smaller or equal to `clip_value_max` for
  correct results.

  Args:
    t: A `Tensor`.
    clip_value_min: A scalar `Tensor`, or a `Tensor` with the same shape
      as `t`. The minimum value to clip by.
    clip_value_max: A scalar `Tensor`, or a `Tensor` with the same shape
      as `t`. The maximum value to clip by.
    name: A name for the operation (optional).
      Default value: `'Func'`.

  Returns:
    clipped_t: A clipped `Tensor`.
  """
  with tf.compat.v1.name_scope(arg_3, 'Func',
                               [arg_0, arg_1, arg_2]):
    arg_0 = tf.convert_to_tensor(value=arg_0, arg_3='t')
    arg_4 = tf.clip_by_value(arg_0, arg_1, arg_2)
    return arg_0 + tf.stop_gradient(arg_4 - arg_0)

Clips values to a specified min and max while leaving gradient unaltered.

  Like `tf.clip_by_value`, this function returns a tensor of the same type and
  shape as input `t` but with values clamped to be no smaller than to
  `clip_value_min` and no larger than `clip_value_max`. Unlike
  `tf.clip_by_value`, the gradient is unaffected by this op, i.e.,

  ```python
  tf.gradients(tfp.math.clip_by_value_preserve_gradient(x), x)[0]
  # ==> ones_like(x)
  ```

  Note: `clip_value_min` needs to be smaller or equal to `clip_value_max` for
  correct results.

  Args:
    t: A `Tensor`.
    clip_value_min: A scalar `Tensor`, or a `Tensor` with the same shape
      as `t`. The minimum value to clip by.
    clip_value_max: A scalar `Tensor`, or a `Tensor` with the same shape
      as `t`. The maximum value to clip by.
    name: A name for the operation (optional).
      Default value: `'clip_by_value_preserve_gradient'`.

  Returns:
    clipped_t: A clipped `Tensor`.

Clips values to a specified min and max while leaving gradient unaltered .


(
        ra,
        decl,
        radius_arcmin=5.0,
        apiversion='v0',
        forcefetch=False,
        cachedir='~/.astrobase/mast-cache',
        verbose=True,
        timeout=10.0,
        refresh=5.0,
        maxtimeout=90.0,
        maxtries=3,
        jitter=5.0,
        raiseonfail=False
)

return mast_query(service,
                      params,
                      jitter=jitter,
                      apiversion=apiversion,
                      forcefetch=forcefetch,
                      cachedir=cachedir,
                      verbose=verbose,
                      timeout=timeout,
                      refresh=refresh,
                      maxtimeout=maxtimeout,
                      maxtries=maxtries,
                      raiseonfail=raiseonfail)

def Func(
        arg_0,
        arg_1,
        arg_2=5.0,
        arg_3='v0',
        arg_4=False,
        arg_5='~/.astrobase/mast-cache',
        arg_6=True,
        arg_7=10.0,
        arg_8=5.0,
        arg_9=90.0,
        arg_10=3,
        arg_11=5.0,
        arg_12=False
):
    '''This runs a TESS Input Catalog cone search on MAST.

    If you use this, please cite the TIC paper (Stassun et al 2018;
    http://adsabs.harvard.edu/abs/2018AJ....156..102S). Also see the "living"
    TESS input catalog docs:

    https://docs.google.com/document/d/1zdiKMs4Ld4cXZ2DW4lMX-fuxAF6hPHTjqjIwGqnfjqI

    Also see: https://mast.stsci.edu/api/v0/_t_i_cfields.html for the fields
    returned by the service and present in the result JSON file.

    Parameters
    ----------

    ra,decl : float
        The center coordinates of the cone-search in decimal degrees.

    radius_arcmin : float
        The cone-search radius in arcminutes.

    apiversion : str
        The API version of the MAST service to use. This sets the URL that this
        function will call, using `apiversion` as key into the `MAST_URLS` dict
        above.

    forcefetch : bool
        If this is True, the query will be retried even if cached results for
        it exist.

    cachedir : str
        This points to the directory where results will be downloaded.

    verbose : bool
        If True, will indicate progress and warn of any issues.

    timeout : float
        This sets the amount of time in seconds to wait for the service to
        respond to our initial request.

    refresh : float
        This sets the amount of time in seconds to wait before checking if the
        result file is available. If the results file isn't available after
        `refresh` seconds have elapsed, the function will wait for `refresh`
        seconds continuously, until `maxtimeout` is reached or the results file
        becomes available.

    maxtimeout : float
        The maximum amount of time in seconds to wait for a result to become
        available after submitting our query request.

    maxtries : int
        The maximum number of tries (across all mirrors tried) to make to either
        submit the request or download the results, before giving up.

    jitter : float
        This is used to control the scale of the random wait in seconds before
        starting the query. Useful in parallelized situations.

    raiseonfail : bool
        If this is True, the function will raise an Exception if something goes
        wrong, instead of returning None.

    Returns
    -------

    dict
        This returns a dict of the following form::

            {'params':dict of the input params used for the query,
             'provenance':'cache' or 'new download',
             'result':path to the file on disk with the downloaded data table}

    '''

    arg_13 = {'ra':arg_0,
              'dec':arg_1,
              'radius':arg_2/60.0}
    arg_14 = 'Mast.Catalogs.Tic.Cone'

    return mast_query(arg_14,
                      arg_13,
                      arg_11=arg_11,
                      arg_3=arg_3,
                      arg_4=arg_4,
                      arg_5=arg_5,
                      arg_6=arg_6,
                      arg_7=arg_7,
                      arg_8=arg_8,
                      arg_9=arg_9,
                      arg_10=arg_10,
                      arg_12=arg_12)

This runs a TESS Input Catalog cone search on MAST .


(packages, upgrade=False, use_sudo=False, python_cmd='python')

def Func ( arg_0 , arg_1 = False , arg_2 = False , arg_3 = 'python' ) : arg_4 = [ ] if arg_1 : arg_4 . append ( "-U" ) if isinstance ( arg_0 , six . string_types ) : arg_4 . append ( arg_0 ) else : arg_4 . extend ( arg_0 ) _easy_Func ( arg_4 , arg_3 , arg_2 )

def Func(arg_0, arg_1=False, arg_2=False, arg_3='python'):
    """
    Install Python packages with ``easy_Func``.

    Examples::

        import burlap

        # Install a single package
        burlap.python_setuptools.Func('package', use_sudo=True)

        # Install a list of packages
        burlap.python_setuptools.Func(['pkg1', 'pkg2'], use_sudo=True)

    .. note:: most of the time, you'll want to use
              :py:func:`burlap.python.Func()` instead,
              which uses ``pip`` to Func packages.

    """
    arg_4 = []
    if arg_1:
        arg_4.append("-U")
    if isinstance(arg_0, six.string_types):
        arg_4.append(arg_0)
    else:
        arg_4.extend(arg_0)
    _easy_Func(arg_4, arg_3, arg_2)

Install Python packages with ``easy_install``.

    Examples::

        import burlap

        # Install a single package
        burlap.python_setuptools.install('package', use_sudo=True)

        # Install a list of packages
        burlap.python_setuptools.install(['pkg1', 'pkg2'], use_sudo=True)

    .. note:: most of the time, you'll want to use
              :py:func:`burlap.python.install()` instead,
              which uses ``pip`` to install packages.

Install Python packages with easy_install .


def Func(arg_0, arg_1):
    '''Beat tracking function

    :parameters:
      - input_file : str
          Path to input audio file (wav, mp3, m4a, flac, etc.)

      - output_file : str
          Path to save beat event timestamps as a CSV file
    '''

    print('Loading ', arg_0)
    arg_2, arg_3 = librosa.load(arg_0, arg_3=22050)

    # Use a default hop size of 512 samples @ 22KHz ~= 23ms
    arg_4 = 512

    # This is the window length used by default in stft
    print('Tracking beats')
    arg_5, arg_6 = librosa.beat.Func(arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)

    print('Estimated tempo: {:0.2f} beats per minute'.format(arg_5))

    # save output
    # 'beats' will contain the frame numbers of beat events.
    arg_7 = librosa.frames_to_time(arg_6, arg_3=arg_3, arg_4=arg_4)

    print('Saving output to ', arg_1)
    librosa.output.times_csv(arg_1, arg_7)
    print('done!')


(
        times,
        mags,
        errs,
        magsarefluxes=False,
        startp=None,
        endp=None,
        stepsize=1.0e-4,
        autofreq=True,
        nbestpeaks=5,
        periodepsilon=0.1,
        sigclip=10.0,
        nworkers=None,
        glspfunc=_glsp_worker_specwindow,
        verbose=True
)

def Func(
        arg_0,
        arg_1,
        arg_2,
        arg_3=False,
        arg_4=None,
        arg_5=None,
        arg_6=1.0e-4,
        arg_7=True,
        arg_8=5,
        arg_9=0.1,
        arg_10=10.0,
        arg_11=None,
        arg_12=arg_13,
        arg_14=True
):
    '''This calculates the spectral window function.

    Wraps the `pgen_lsp` function above to use the specific worker for
    calculating the window-function.

    Parameters
    ----------

    times,mags,errs : np.array
        The mag/flux time-series with associated measurement errors to run the
        period-finding on.

    magsarefluxes : bool
        If the input measurement values in `mags` and `errs` are in fluxes, set
        this to True.

    startp,endp : float or None
        The minimum and maximum periods to consider for the transit search.

    stepsize : float
        The step-size in frequency to use when constructing a frequency grid for
        the period search.

    autofreq : bool
        If this is True, the value of `stepsize` will be ignored and the
        :py:func:`astrobase.periodbase.get_frequency_grid` function will be used
        to generate a frequency grid based on `startp`, and `endp`. If these are
        None as well, `startp` will be set to 0.1 and `endp` will be set to
        `times.max() - times.min()`.

    nbestpeaks : int
        The number of 'best' peaks to return from the periodogram results,
        starting from the global maximum of the periodogram peak values.

    periodepsilon : float
        The fractional difference between successive values of 'best' periods
        when sorting by periodogram power to consider them as separate periods
        (as opposed to part of the same periodogram peak). This is used to avoid
        broad peaks in the periodogram and make sure the 'best' periods returned
        are all actually independent.

    sigclip : float or int or sequence of two floats/ints or None
        If a single float or int, a symmetric sigma-clip will be performed using
        the number provided as the sigma-multiplier to cut out from the input
        time-series.

        If a list of two ints/floats is provided, the function will perform an
        'asymmetric' sigma-clip. The first element in this list is the sigma
        value to use for fainter flux/mag values; the second element in this
        list is the sigma value to use for brighter flux/mag values. For
        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma
        dimmings and greater than 3-sigma brightenings. Here the meaning of
        "dimming" and "brightening" is set by *physics* (not the magnitude
        system), which is why the `magsarefluxes` kwarg must be correctly set.

        If `sigclip` is None, no sigma-clipping will be performed, and the
        time-series (with non-finite elems removed) will be passed through to
        the output.

    nworkers : int
        The number of parallel workers to use when calculating the periodogram.

    glspfunc : Python function
        The worker function to use to calculate the periodogram. This is used to
        used to make the `pgen_lsp` function calculate the time-series sampling
        window function instead of the time-series measurements' GLS periodogram
        by passing in `_glsp_worker_specwindow` instead of the default
        `_glsp_worker` function.

    verbose : bool
        If this is True, will indicate progress and details about the frequency
        grid used for the period search.

    Returns
    -------

    dict
        This function returns a dict, referred to as an `lspinfo` dict in other
        astrobase functions that operate on periodogram results. This is a
        standardized format across all astrobase period-finders, and is of the
        form below::

            {'bestperiod': the best period value in the periodogram,
             'bestlspval': the periodogram peak associated with the best period,
             'nbestpeaks': the input value of nbestpeaks,
             'nbestlspvals': nbestpeaks-size list of best period peak values,
             'nbestperiods': nbestpeaks-size list of best periods,
             'lspvals': the full array of periodogram powers,
             'periods': the full array of periods considered,
             'method':'win' -> the name of the period-finder method,
             'kwargs':{ dict of all of the input kwargs for record-keeping}}

    '''

    # run the LSP using glsp_worker_specwindow as the worker
    arg_15 = pgen_lsp(
        arg_0,
        arg_1,
        arg_2,
        arg_3=arg_3,
        arg_4=arg_4,
        arg_5=arg_5,
        arg_7=arg_7,
        arg_8=arg_8,
        arg_9=arg_9,
        arg_6=arg_6,
        arg_11=arg_11,
        arg_10=arg_10,
        arg_12=arg_12,
        arg_14=arg_14
    )

    # update the resultdict to indicate we're a spectral window function
    arg_15['method'] = 'win'

    if arg_15['lspvals'] is not None:

        # renormalize the periodogram to between 0 and 1 like the usual GLS.
        arg_16 = npnanmax(arg_15['lspvals'])

        if npisfinite(arg_16):

            arg_15['lspvals'] = arg_15['lspvals']/arg_16
            arg_15['nbestlspvals'] = [
                x/arg_16 for x in arg_15['nbestlspvals']
            ]
            arg_15['bestlspval'] = arg_15['bestlspval']/arg_16

    return arg_15

This calculates the spectral window function .


def Func(arg_0, arg_1, arg_2):
    """
    This a parser that allows the passing of any valid ResourceRecordSet
    tag. It will spit out the appropriate ResourceRecordSet object for the tag.

    :param lxml.etree._Element e_rrset: The root node of the etree parsed
        response from the API.
    :param Route53Connection connection: The connection instance used to
        query the API.
    :param str zone_id: The zone ID of the HostedZone these rrsets belong to.
    :rtype: ResourceRecordSet
    :returns: An instantiated ResourceRecordSet object.
    """

    # This dict will be used to instantiate a ResourceRecordSet instance to yield.
    arg_3 = {
        'connection': arg_1,
        'zone_id': arg_2,
    }
    arg_4 = None

    for arg_5 in arg_0:
        # Cheesy way to strip off the namespace.
        arg_6 = arg_5.tag.split('}')[1]
        arg_7 = arg_5.text

        if arg_6 == 'Type':
            # Need to store this to determine which ResourceRecordSet
            # subclass to instantiate.
            arg_4 = arg_7
            continue
        elif arg_6 == 'AliasTarget':
            # A records have some special field values we need.
            arg_8, arg_9 = Func_alias(arg_5)
            arg_3['alias_hosted_zone_id'] = arg_8
            arg_3['alias_dns_name'] = arg_9
            # Alias A entries have no TTL.
            arg_3['ttl'] = None
            continue
        elif arg_6 == 'ResourceRecords':
            arg_3['records'] = Func_record_values(arg_5)
            continue

        # Map the XML tag name to a kwarg name.
        arg_10 = RRSET_TAG_TO_KWARG_MAP[arg_6]
        # This will be the key/val pair used to instantiate the
        # ResourceRecordSet instance.
        arg_3[arg_10] = arg_7

    if not arg_4:
        raise Route53Error("No Type tag found in ListResourceRecordSetsResponse.")

    if 'records' not in arg_3:
        # Not all rrsets have records.
        arg_3['records'] = []

    arg_11 = RRSET_TYPE_TO_RSET_SUBCLASS_MAP[arg_4]
    return arg_11(**arg_3)

This a parser that allows the passing of any valid ResourceRecordSet tag . It will spit out the appropriate ResourceRecordSet object for the tag .


def
Func
(
arg_0
)
:
if
arg_0
.
logger
:
arg_0
.
logger
.
info
(
"accessed parameters:"
)
for
arg_1
in
arg_0
.
used_parameters
:
arg_0
.
logger
.
info
(
" - %s %s"
%
(
arg_1
,
"(undefined)"
if
arg_1
in
arg_0
.
undefined_parameters
else
""
)
)

def Func(arg_0):
        """
        Report usage of training parameters.
        """
        if arg_0.logger:
            arg_0.logger.info("accessed parameters:")
            for arg_1 in arg_0.used_parameters:
                arg_0.logger.info(" - %s %s" % (arg_1, "(undefined)" if arg_1 in arg_0.undefined_parameters else ""))


def
Func
(
)
:
arg_0
=
os
.
getcwd
(
)
print
(
'Merging all files'
)
merge_all_in_folder
(
arg_0
,
delete_other_files
=
True
,
dynamic_imports
=
FunctionParameter
,
backup
=
False
)
print
(
'Done'
)

def Func():
    """Simply merge all trajectories in the working directory"""
    arg_0 = os.getcwd()
    print('Merging all files')
    merge_all_in_folder(arg_0,
                        delete_other_files=True,  # We will only keep one trajectory
                        dynamic_imports=FunctionParameter,
                        backup=False)
    print('Done')


def
Func
(
arg_0
)
:
arg_1
=
[
]
for
arg_2
,
arg_3
,
arg_4
,
arg_5
in
arg_0
:
arg_6
=
'  File "%s", line %d, in %s\n'
%
(
arg_2
,
arg_3
,
arg_4
)
if
arg_5
:
arg_6
=
arg_6
+
'    %s\n'
%
arg_5
.
strip
(
)
arg_1
.
append
(
arg_6
)
return
arg_1

def Func(arg_0):
    """Format a list of traceback entry tuples for printing.

    Given a list of tuples as returned by extract_tb() or
    extract_stack(), return a list of strings ready for printing.
    Each string in the resulting list corresponds to the item with the
    same index in the argument list.  Each string ends in a newline;
    the strings may contain internal newlines as well, for those items
    whose source text line is not None.
    """
    arg_1 = []
    for arg_2, arg_3, arg_4, arg_5 in arg_0:
        arg_6 = '  File "%s", line %d, in %s\n' % (arg_2,arg_3,arg_4)
        if arg_5:
            arg_6 = arg_6 + '    %s\n' % arg_5.strip()
        arg_1.append(arg_6)
    return arg_1

Format a list of traceback entry tuples for printing .


(self, socket, code, silent=True, subheader=None, ident=None)

def Func(arg_0, arg_1, arg_2, arg_3=True, arg_4=None, arg_5=None):
        """construct and send an execute request via a socket.

        """

        if arg_0._closed:
            raise RuntimeError("Client cannot be used after its sockets have been closed")

        # defaults:
        arg_4 = arg_4 if arg_4 is not None else {}

        # validate arguments
        if not isinstance(arg_2, basestring):
            raise TypeError("code must be text, not %s" % type(arg_2))
        if not isinstance(arg_4, dict):
            raise TypeError("subheader must be dict, not %s" % type(arg_4))

        arg_6 = dict(arg_2=arg_2, arg_3=bool(arg_3), user_variables=[], user_expressions={})

        arg_7 = arg_0.session.send(arg_1, "execute_request", arg_6=arg_6, arg_5=arg_5,
                            arg_4=arg_4)

        arg_8 = arg_7['header']['msg_id']
        arg_0.outstanding.add(arg_8)
        if arg_5:
            # possibly routed to a specific engine
            if isinstance(arg_5, list):
                arg_5 = arg_5[-1]
            if arg_5 in arg_0._engines.values():
                # save for later, in case of engine death
                arg_0._outstanding_dict[arg_5].add(arg_8)
        arg_0.history.append(arg_8)
        arg_0.metadata[arg_8]['submitted'] = datetime.now()

        return arg_7

construct and send an execute request via a socket .


def Func(arg_0):  # pylint: disable=arguments-differ
        """
        Save the model with the found EnterpriseCustomerUser.
        """
        arg_1 = arg_0.validated_data['course_id']

        arg_2, arg_3 = models.EnterpriseCourseEnrollment.objects.get_or_create(
            enterprise_customer_user=arg_0.enterprise_customer_user,
            arg_1=arg_1,
        )
        if arg_3:
            track_enrollment('rest-api-enrollment', arg_0.enterprise_customer_user.user_id, arg_1)

Save the model with the found EnterpriseCustomerUser .


return {
            'objectName': self._object_name,
            'sampleInterval': _SAMPLE_INTERVAL,
            'runTime': prof.run_time,
            'callStats': call_tree,
            'totalSamples': call_tree.get('sampleCount', 0),
            'timestamp': int(time.time())
        }

def Func ( arg_0 ) : with _StatProfiler ( ) as arg_1 : arg_1 . base_frame = inspect . currentframe ( ) try : runpy . run_path ( arg_0 . _run_object , run_name = '__main__' ) except SystemExit : pass arg_3 = arg_1 . call_tree return { 'objectName' : arg_0 . _object_name , 'sampleInterval' : _SAMPLE_INTERVAL , 'runTime' : arg_1 . run_time , 'callStats' : arg_3 , 'totalSamples' : arg_3 . get ( 'sampleCount' , 0 ) , 'timestamp' : int ( time . time ( ) ) }

def Func(arg_0):
        """Runs statistical profiler on a package."""
        with _StatProfiler() as arg_1:
            arg_1.base_frame = inspect.currentframe()
            try:
                runpy.run_path(arg_0._run_object, run_name='__main__')
            except SystemExit:
                pass

        arg_3 = arg_1.call_tree
        return {
            'objectName': arg_0._object_name,
            'sampleInterval': _SAMPLE_INTERVAL,
            'runTime': arg_1.run_time,
            'callStats': arg_3,
            'totalSamples': arg_3.get('sampleCount', 0),
            'timestamp': int(time.time())
        }

Runs statistical profiler on a package .


def Func ( arg_0 , arg_1 ) : arg_2 = [ ( sa . Column ( ) , arg_4 ) for arg_4 in arg_1 . primary_key ] for arg_3 , arg_4 in arg_2 : setattr ( arg_0 , "%s_%s" % ( arg_1 . name , arg_4 . name ) , arg_3 ) arg_0 . __table__ . append_constraint ( sa . ForeignKeyConstraint ( * zip ( * arg_2 ) ) )

def Func(arg_0, arg_1):
        """Create a foreign key reference from the local class to the given remote
        table.

        Adds column references to the declarative class and adds a
        ForeignKeyConstraint.

        """
        # create pairs of (Foreign key column, primary key column)
        arg_2 = [(sa.Column(), arg_4) for arg_4 in arg_1.primary_key]

        # set "tablename_colname = Foreign key Column" on the local class
        for arg_3, arg_4 in arg_2:
            setattr(arg_0, "%s_%s" % (arg_1.name, arg_4.name), arg_3)

        # add a ForeignKeyConstraint([local columns], [remote columns])
        arg_0.__table__.append_constraint(sa.ForeignKeyConstraint(*zip(*arg_2)))

Create a foreign key reference from the local class to the given remote table .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = get_node ( arg_0 , * convert_args ( arg_1 , arg_2 ) ) arg_4 = arg_3 [ KEY ] if arg_4 in arg_0 . param_spaces : return arg_0 . param_spaces [ arg_4 ] else : arg_5 = arg_0 . system . self arg_0 . system . self = arg_0 try : arg_7 = arg_0 . eval_formula ( arg_3 ) finally : arg_0 . system . self = arg_5 if arg_7 is None : arg_7 = { "bases" : [ arg_0 ] } else : if "bases" in arg_7 : arg_8 = get_impls ( arg_7 [ "bases" ] ) if isinstance ( arg_8 , StaticSpaceImpl ) : arg_7 [ "bases" ] = [ arg_8 ] elif arg_8 is None : arg_7 [ "bases" ] = [ arg_0 ] else : arg_7 [ "bases" ] = arg_8 else : arg_7 [ "bases" ] = [ arg_0 ] arg_7 [ "arguments" ] = node_get_args ( arg_3 ) arg_9 = arg_0 . _new_dynspace ( ** arg_7 ) arg_0 . param_spaces [ arg_4 ] = arg_9 arg_9 . inherit ( clear_value = False ) return arg_9

def Func(arg_0, arg_1, arg_2=None):
        """Create a dynamic root space

        Called from interface methods
        """

        arg_3 = get_node(arg_0, *convert_args(arg_1, arg_2))
        arg_4 = arg_3[KEY]

        if arg_4 in arg_0.param_spaces:
            return arg_0.param_spaces[arg_4]

        else:
            arg_5 = arg_0.system.self
            arg_0.system.self = arg_0

            try:
                arg_7 = arg_0.eval_formula(arg_3)

            finally:
                arg_0.system.self = arg_5

            if arg_7 is None:
                arg_7 = {"bases": [arg_0]}  # Default
            else:
                if "bases" in arg_7:
                    arg_8 = get_impls(arg_7["bases"])
                    if isinstance(arg_8, StaticSpaceImpl):
                        arg_7["bases"] = [arg_8]
                    elif arg_8 is None:
                        arg_7["bases"] = [arg_0]  # Default
                    else:
                        arg_7["bases"] = arg_8
                else:
                    arg_7["bases"] = [arg_0]

            arg_7["arguments"] = node_get_args(arg_3)
            arg_9 = arg_0._new_dynspace(**arg_7)
            arg_0.param_spaces[arg_4] = arg_9
            arg_9.inherit(clear_value=False)
            return arg_9


return (
            min(len(concat_comp), len(concat_comp2))
            - min(len(src_comp), len(tar_comp))
        ) / max(len(src_comp), len(tar_comp))

def Func ( arg_0 , arg_1 , arg_2 ) : if arg_1 == arg_2 : return 0.0 arg_1 = arg_1 . encode ( 'utf-8' ) arg_2 = arg_2 . encode ( 'utf-8' ) arg_0 . _compressor . compress ( arg_1 ) arg_3 = arg_0 . _compressor . flush ( zlib . Z_FULL_FLUSH ) arg_0 . _compressor . compress ( arg_2 ) arg_4 = arg_0 . _compressor . flush ( zlib . Z_FULL_FLUSH ) arg_0 . _compressor . compress ( arg_1 + arg_2 ) arg_5 = arg_0 . _compressor . flush ( zlib . Z_FULL_FLUSH ) arg_0 . _compressor . compress ( arg_2 + arg_1 ) arg_6 = arg_0 . _compressor . flush ( zlib . Z_FULL_FLUSH ) return ( min ( len ( arg_5 ) , len ( arg_6 ) ) - min ( len ( arg_3 ) , len ( arg_4 ) ) ) / max ( len ( arg_3 ) , len ( arg_4 ) )

def Func(arg_0, arg_1, arg_2):
        """Return the NCD between two strings using zlib compression.

        Parameters
        ----------
        src : str
            Source string for comparison
        tar : str
            Target string for comparison

        Returns
        -------
        float
            Compression Funcance

        Examples
        --------
        >>> cmp = NCDzlib()
        >>> cmp.Func('cat', 'hat')
        0.3333333333333333
        >>> cmp.Func('Niall', 'Neil')
        0.45454545454545453
        >>> cmp.Func('aluminum', 'Catalan')
        0.5714285714285714
        >>> cmp.Func('ATCG', 'TAGC')
        0.4

        """
        if arg_1 == arg_2:
            return 0.0

        arg_1 = arg_1.encode('utf-8')
        arg_2 = arg_2.encode('utf-8')

        arg_0._compressor.compress(arg_1)
        arg_3 = arg_0._compressor.flush(zlib.Z_FULL_FLUSH)
        arg_0._compressor.compress(arg_2)
        arg_4 = arg_0._compressor.flush(zlib.Z_FULL_FLUSH)
        arg_0._compressor.compress(arg_1 + arg_2)
        arg_5 = arg_0._compressor.flush(zlib.Z_FULL_FLUSH)
        arg_0._compressor.compress(arg_2 + arg_1)
        arg_6 = arg_0._compressor.flush(zlib.Z_FULL_FLUSH)

        return (
            min(len(arg_5), len(arg_6))
            - min(len(arg_3), len(arg_4))
        ) / max(len(arg_3), len(arg_4))

Return the NCD between two strings using zlib compression.

        Parameters
        ----------
        src : str
            Source string for comparison
        tar : str
            Target string for comparison

        Returns
        -------
        float
            Compression distance

        Examples
        --------
        >>> cmp = NCDzlib()
        >>> cmp.dist('cat', 'hat')
        0.3333333333333333
        >>> cmp.dist('Niall', 'Neil')
        0.45454545454545453
        >>> cmp.dist('aluminum', 'Catalan')
        0.5714285714285714
        >>> cmp.dist('ATCG', 'TAGC')
        0.4

Return the NCD between two strings using zlib compression .


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in arg_0 . children : if arg_2 . type == "custom_unitary" : arg_1 . append ( arg_2 . name ) return arg_1

def Func(arg_0):
        """Return a list of custom gate names in this gate body."""
        arg_1 = []
        for arg_2 in arg_0.children:
            if arg_2.type == "custom_unitary":
                arg_1.append(arg_2.name)
        return arg_1

Return a list of custom gate names in this gate body .


(self, obtained_fn, expected_fn, fix_callback=lambda x:x, binary=False, encoding=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
lambda
arg_4
:
arg_4
,
arg_5
=
False
,
arg_6
=
)
:
import
os
from
zerotk
.
easyfs
import
GetFileContents
,
GetFileLines
arg_7
=
True
import
io
def
FindFile
(
arg_8
)
:
arg_9
=
arg_0
.
get_filename
(
arg_8
)
if
os
.
path
.
isfile
(
arg_9
)
:
return
arg_9
if
os
.
path
.
isfile
(
arg_8
)
:
return
arg_8
from
.
_exceptions
import
MultipleFilesNotFound
raise
MultipleFilesNotFound
(
[
arg_8
,
arg_9
]
)
arg_1
=
FindFile
(
arg_1
)
arg_2
=
FindFile
(
arg_2
)
if
arg_5
:
arg_10
=
GetFileContents
(
arg_1
,
arg_5
=
True
)
arg_11
=
GetFileContents
(
arg_2
,
arg_5
=
True
)
assert
arg_10
==
arg_11
else
:
arg_10
=
arg_3
(
GetFileLines
(
arg_1
,
arg_6
=
arg_6
)
)
arg_11
=
GetFileLines
(
arg_2
,
arg_6
=
arg_6
)
if
arg_10
!=
arg_11
:
arg_12
=
os
.
path
.
splitext
(
arg_1
)
[
0
]
+
'.diff.html'
arg_13
=
arg_0
.
_generate_html_diff
(
arg_2
,
arg_11
,
arg_1
,
arg_10
)
with
io
.
open
(
arg_12
,
'w'
)
as
f
:
f
.
write
(
arg_13
)
import
difflib
arg_14
=
[
'FILES DIFFER:'
,
arg_1
,
arg_2
]
arg_14
+=
[
'HTML DIFF: %s'
%
arg_12
]
arg_14
+=
difflib
.
context_diff
(
arg_10
,
arg_11
)
raise
AssertionError
(
'\n'
.
join
(
arg_14
)
+
'\n'
)

def Func(arg_0, arg_1, arg_2, arg_3=lambda arg_4:arg_4, arg_5=False, arg_6=None):
        '''
        Compare two files contents. If the files differ, show the diff and write a nice HTML
        diff file into the data directory.

        Searches for the filenames both inside and outside the data directory (in that order).

        :param unicode obtained_fn: basename to obtained file into the data directory, or full path.

        :param unicode expected_fn: basename to expected file into the data directory, or full path.

        :param bool binary:
            Thread both files as binary files.

        :param unicode encoding:
            File's encoding. If not None, contents obtained from file will be decoded using this
            `encoding`.

        :param callable fix_callback:
            A callback to "fix" the contents of the obtained (first) file.
            This callback receives a list of strings (lines) and must also return a list of lines,
            changed as needed.
            The resulting lines will be used to compare with the contents of expected_fn.

        :param bool binary:
            .. seealso:: zerotk.easyfs.GetFileContents
        '''
        import os
        from zerotk.easyfs import GetFileContents, GetFileLines

        arg_7 = True
        import io

        def FindFile(arg_8):
            # See if this path exists in the data dir
            arg_9 = arg_0.get_filename(arg_8)
            if os.path.isfile(arg_9):
                return arg_9

            # If not, we might have already received a full path
            if os.path.isfile(arg_8):
                return arg_8

            # If we didn't find anything, raise an error
            from ._exceptions import MultipleFilesNotFound
            raise MultipleFilesNotFound([arg_8, arg_9])

        arg_1 = FindFile(arg_1)
        arg_2 = FindFile(arg_2)

        if arg_5:
            arg_10 = GetFileContents(arg_1, arg_5=True)
            arg_11 = GetFileContents(arg_2, arg_5=True)
            assert arg_10 == arg_11
        else:
            arg_10 = arg_3(GetFileLines(arg_1, arg_6=arg_6))
            arg_11 = GetFileLines(arg_2, arg_6=arg_6)

            if arg_10 != arg_11:
                arg_12 = os.path.splitext(arg_1)[0] + '.diff.html'
                arg_13 = arg_0._generate_html_diff(
                    arg_2, arg_11, arg_1, arg_10)
                with io.open(arg_12, 'w') as f:
                    f.write(arg_13)

                import difflib
                arg_14 = ['FILES DIFFER:', arg_1, arg_2]
                arg_14 += ['HTML DIFF: %s' % arg_12]
                arg_14 += difflib.context_diff(arg_10, arg_11)
                raise AssertionError('\n'.join(arg_14) + '\n')

Compare two files contents . If the files differ show the diff and write a nice HTML diff file into the data directory .


def Func ( arg_0 , arg_1 = None ) : Func . Func ( arg_0 . asDict ( includeMeta = True , forStorage = False , strKeys = True ) , arg_1 = arg_1 )

def Func(arg_0, arg_1=None):
		'''
			Func - Pretty-print a dict representation of this object.

			@param stream <file/None> - Either a stream to output, or None to default to sys.stdout
		'''
		Func.Func(arg_0.asDict(includeMeta=True, forStorage=False, strKeys=True), arg_1=arg_1)

pprint - Pretty-print a dict representation of this object.

			@param stream <file/None> - Either a stream to output, or None to default to sys.stdout

pprint - Pretty - print a dict representation of this object .


def Func(arg_0, arg_1, arg_2=0, **arg_3):
    """Get deposits."""
    arg_4 = _Func_depositions()
    arg_5 = 1  # Count of depositions is hard to determine

    # If limit provided, serve only first n=limit items
    if arg_2 > 0:
        arg_4 = islice(arg_4, arg_2)
        arg_5 = arg_2
    return arg_5, arg_4


def Func ( arg_0 = arg_1 , arg_2 = arg_3 ) : return color ( random . randint ( arg_0 , arg_2 ) )

def Func(arg_0=arg_1, arg_2=arg_3):
    """Returns a random color between min and max."""
    return color(random.randint(arg_0, arg_2))

Returns a random color between min and max .


Add 'num' to the day and count that day until we reach end_repeat, or
        until we're outside of the current month, counting the days
        as we go along.

def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : arg_1 = arg_0 . day try : arg_2 = date ( arg_0 . year , arg_0 . month , arg_1 ) except ValueError : return arg_0 . count if arg_0 . count_first and arg_2 <= arg_0 . end_Func : arg_0 . count_it ( arg_2 . day ) arg_2 += timedelta ( days = arg_0 . num ) if arg_0 . end_on is not None : while arg_2 . month == arg_0 . month and arg_2 <= arg_0 . end_Func and arg_2 . day <= arg_0 . end_on : arg_0 . count_it ( arg_2 . day ) arg_2 += timedelta ( days = arg_0 . num ) else : while arg_2 . month == arg_0 . month and arg_2 <= arg_0 . end_Func : arg_0 . count_it ( arg_2 . day ) arg_2 += timedelta ( days = arg_0 . num )

def Func(arg_0, arg_1=None):
        """
        Add 'num' to the day and count that day until we reach end_Func, or
        until we're outside of the current month, counting the days
        as we go along.
        """
        if arg_1 is None:
            arg_1 = arg_0.day

        try:
            arg_2 = date(arg_0.year, arg_0.month, arg_1)
        except ValueError:  # out of range day
            return arg_0.count

        if arg_0.count_first and arg_2 <= arg_0.end_Func:
            arg_0.count_it(arg_2.day)

        arg_2 += timedelta(days=arg_0.num)

        if arg_0.end_on is not None:
            while arg_2.month == arg_0.month and \
                    arg_2 <= arg_0.end_Func and \
                    arg_2.day <= arg_0.end_on:
                arg_0.count_it(arg_2.day)
                arg_2 += timedelta(days=arg_0.num)
        else:
            while arg_2.month == arg_0.month and arg_2 <= arg_0.end_Func:
                arg_0.count_it(arg_2.day)
                arg_2 += timedelta(days=arg_0.num)

Add num to the day and count that day until we reach end_repeat or until we re outside of the current month counting the days as we go along .


async def Func ( arg_0 , arg_1 ) : arg_2 = hangouts_pb2 . AddUserResponse ( ) await arg_0 . _pb_request ( 'conversations/adduser' , arg_1 , arg_2 ) return arg_2

async def Func(arg_0, arg_1):
        """Invite users to join an existing group conversation."""
        arg_2 = hangouts_pb2.AddUserResponse()
        await arg_0._pb_request('conversations/adduser',
                               arg_1, arg_2)
        return arg_2

Invite users to join an existing group conversation .


(
            self, vault_base_url, key_name, key_version, key_ops=None, key_attributes=None, tags=None, custom_headers=None, raw=False, **operation_config)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
=
,
arg_5
=
,
arg_6
=
,
arg_7
=
,
arg_8
=
False
,
**
arg_9
)
:
arg_10
=
models
.
KeyUpdateParameters
(
arg_4
=
arg_4
,
arg_5
=
arg_5
,
arg_6
=
arg_6
)
arg_11
=
arg_0
.
Func
.
metadata
[
'url'
]
arg_12
=
{
'vaultBaseUrl'
:
arg_0
.
_serialize
.
url
(
"vault_base_url"
,
arg_1
,
'str'
,
skip_quote
=
True
)
,
'key-name'
:
arg_0
.
_serialize
.
url
(
"key_name"
,
arg_2
,
'str'
)
,
'key-version'
:
arg_0
.
_serialize
.
url
(
"key_version"
,
arg_3
,
'str'
)
}
arg_11
=
arg_0
.
_client
.
format_url
(
arg_11
,
**
arg_12
)
arg_13
=
{
}
arg_13
[
'api-version'
]
=
arg_0
.
_serialize
.
query
(
"self.api_version"
,
arg_0
.
api_version
,
'str'
)
arg_14
=
{
}
arg_14
[
'Content-Type'
]
=
'application/json; charset=utf-8'
if
arg_0
.
config
.
generate_client_request_id
:
arg_14
[
'x-ms-client-request-id'
]
=
str
(
uuid
.
uuid1
(
)
)
if
arg_7
:
arg_14
.
update
(
arg_7
)
if
arg_0
.
config
.
accept_language
is
not
:
arg_14
[
'accept-language'
]
=
arg_0
.
_serialize
.
header
(
"self.config.accept_language"
,
arg_0
.
config
.
accept_language
,
'str'
)
arg_15
=
arg_0
.
_serialize
.
body
(
arg_10
,
'KeyUpdateParameters'
)
arg_16
=
arg_0
.
_client
.
patch
(
arg_11
,
arg_13
)
arg_17
=
arg_0
.
_client
.
send
(
arg_16
,
arg_14
,
arg_15
,
stream
=
False
,
**
arg_9
)
if
arg_17
.
status_code
not
in
[
200
]
:
raise
models
.
KeyVaultErrorException
(
arg_0
.
_deserialize
,
arg_17
)
arg_18
=
if
arg_17
.
status_code
==
200
:
arg_18
=
arg_0
.
_deserialize
(
'KeyBundle'
,
arg_17
)
if
arg_8
:
arg_19
=
ClientRawResponse
(
arg_18
,
arg_17
)
return
arg_19
return
arg_18

def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=None, arg_7=None, arg_8=False, **arg_9):
        """The update key operation changes specified attributes of a stored key
        and can be applied to any key type and key version stored in Azure Key
        Vault.

        In order to perform this operation, the key must already exist in the
        Key Vault. Note: The cryptographic material of a key itself cannot be
        changed. This operation requires the keys/update permission.

        :param vault_base_url: The vault name, for example
         https://myvault.vault.azure.net.
        :type vault_base_url: str
        :param key_name: The name of key to update.
        :type key_name: str
        :param key_version: The version of the key to update.
        :type key_version: str
        :param key_ops: Json web key operations. For more information on
         possible key operations, see JsonWebKeyOperation.
        :type key_ops: list[str or
         ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation]
        :param key_attributes:
        :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes
        :param tags: Application specific metadata in the form of key-value
         pairs.
        :type tags: dict[str, str]
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: KeyBundle or ClientRawResponse if raw=true
        :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`KeyVaultErrorException<azure.keyvault.v2016_10_01.models.KeyVaultErrorException>`
        """
        arg_10 = models.KeyUpdateParameters(arg_4=arg_4, arg_5=arg_5, arg_6=arg_6)

        # Construct URL
        arg_11 = arg_0.Func.metadata['url']
        arg_12 = {
            'vaultBaseUrl': arg_0._serialize.url("vault_base_url", arg_1, 'str', skip_quote=True),
            'key-name': arg_0._serialize.url("key_name", arg_2, 'str'),
            'key-version': arg_0._serialize.url("key_version", arg_3, 'str')
        }
        arg_11 = arg_0._client.format_url(arg_11, **arg_12)

        # Construct parameters
        arg_13 = {}
        arg_13['api-version'] = arg_0._serialize.query("self.api_version", arg_0.api_version, 'str')

        # Construct headers
        arg_14 = {}
        arg_14['Content-Type'] = 'application/json; charset=utf-8'
        if arg_0.config.generate_client_request_id:
            arg_14['x-ms-client-request-id'] = str(uuid.uuid1())
        if arg_7:
            arg_14.update(arg_7)
        if arg_0.config.accept_language is not None:
            arg_14['accept-language'] = arg_0._serialize.header("self.config.accept_language", arg_0.config.accept_language, 'str')

        # Construct body
        arg_15 = arg_0._serialize.body(arg_10, 'KeyUpdateParameters')

        # Construct and send request
        arg_16 = arg_0._client.patch(arg_11, arg_13)
        arg_17 = arg_0._client.send(
            arg_16, arg_14, arg_15, stream=False, **arg_9)

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

        arg_18 = None

        if arg_17.status_code == 200:
            arg_18 = arg_0._deserialize('KeyBundle', arg_17)

        if arg_8:
            arg_19 = ClientRawResponse(arg_18, arg_17)
            return arg_19

        return arg_18

The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 , arg_4 = institute_and_case ( store , arg_0 , arg_1 ) arg_5 = url_for ( '.case' , arg_0 = arg_0 , arg_1 = arg_1 ) if arg_2 : arg_6 = store . user ( arg_2 ) else : arg_6 = store . user ( current_user . email ) if request . form . get ( 'action' ) == 'DELETE' : store . unFunc ( arg_3 , arg_4 , arg_6 , arg_5 ) else : store . Func ( arg_3 , arg_4 , arg_6 , arg_5 ) return redirect ( request . referrer )

def Func(arg_0, arg_1, arg_2=None):
    """Assign and unFunc a user from a case."""
    arg_3, arg_4 = institute_and_case(store, arg_0, arg_1)
    arg_5 = url_for('.case', arg_0=arg_0, arg_1=arg_1)
    if arg_2:
        arg_6 = store.user(arg_2)
    else:
        arg_6 = store.user(current_user.email)
    if request.form.get('action') == 'DELETE':
        store.unFunc(arg_3, arg_4, arg_6, arg_5)
    else:
        store.Func(arg_3, arg_4, arg_6, arg_5)
    return redirect(request.referrer)

Assign and unassign a user from a case .


def
Func
(
arg_0
)
:
if
arg_0
.
startswith
(
(
"http://"
,
"https://"
)
)
:
try
:
urlopen
(
arg_0
)
.
info
(
)
return
True
except
HTTPError
as
e
:
if
e
.
code
==
404
:
return
False
else
:
raise
elif
arg_0
.
startswith
(
"s3://"
)
:
arg_1
=
get_boto3_bucket
(
arg_0
.
split
(
"/"
)
[
2
]
)
arg_2
=
"/"
.
join
(
arg_0
.
split
(
"/"
)
[
3
:
]
)
for
arg_3
in
arg_1
.
objects
.
filter
(
Prefix
=
arg_2
)
:
if
arg_3
.
key
==
arg_2
:
return
True
else
:
return
False
else
:
logger
.
debug
(
"%s exists: %s"
,
arg_0
,
os
.
path
.
exists
(
arg_0
)
)
return
os
.
path
.
exists
(
arg_0
)

def Func(arg_0):
    """
    Check if file exists either remote or local.

    Parameters:
    -----------
    path : path to file

    Returns:
    --------
    exists : bool
    """
    if arg_0.startswith(("http://", "https://")):
        try:
            urlopen(arg_0).info()
            return True
        except HTTPError as e:
            if e.code == 404:
                return False
            else:
                raise
    elif arg_0.startswith("s3://"):
        arg_1 = get_boto3_bucket(arg_0.split("/")[2])
        arg_2 = "/".join(arg_0.split("/")[3:])
        for arg_3 in arg_1.objects.filter(Prefix=arg_2):
            if arg_3.key == arg_2:
                return True
        else:
            return False
    else:
        logger.debug("%s exists: %s", arg_0, os.path.exists(arg_0))
        return os.path.exists(arg_0)

Check if file exists either remote or local .


(self, method, url, params={}, **kwargs)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = { } , ** arg_4 ) : try : arg_5 = arg_0 . syncStates [ ( arg_1 , arg_2 ) ] except KeyError : arg_5 = arg_0 . syncStates [ ( arg_1 , arg_2 ) ] = [ ] if arg_5 : arg_2 = arg_5 [ - 1 ] arg_3 = { } arg_6 = arg_0 ( arg_1 , arg_2 , arg_3 = arg_3 , ** arg_4 ) try : arg_7 = arg_6 . json ( ) except ValueError : pass else : arg_8 = arg_7 . get ( "_metadata" , { } ) . get ( "syncState" ) if arg_8 : arg_5 . append ( arg_8 ) return arg_6

def Func(arg_0, arg_1, arg_2, arg_3={}, **arg_4):
        """
        Follow and track sync state URLs provided by an API endpoint, in order to implicitly handle pagination.

        In the first call, ``url`` and ``params`` are used as-is.  If a ``syncState`` endpoint is provided in the
        response, subsequent calls go to the latest URL instead.

        Args:
            method (str): HTTP request method
            url (str): full URL to connect to
            params (dict): query parameters to include in the URL
            kwargs (dict): any extra parameters to pass to :meth:`__call__`
        """
        try:
            arg_5 = arg_0.syncStates[(arg_1, arg_2)]
        except KeyError:
            arg_5 = arg_0.syncStates[(arg_1, arg_2)] = []
        if arg_5:
            # We have a state link, use it to replace the URL and query string.
            arg_2 = arg_5[-1]
            arg_3 = {}
        arg_6 = arg_0(arg_1, arg_2, arg_3=arg_3, **arg_4)
        try:
            arg_7 = arg_6.json()
        except ValueError:
            # Don't do anything if not a JSON response.
            pass
        else:
            # If a state link exists in the response, store it for later.
            arg_8 = arg_7.get("_metadata", {}).get("syncState")
            if arg_8:
                arg_5.append(arg_8)
        return arg_6

Follow and track sync state URLs provided by an API endpoint in order to implicitly handle pagination .


wait for all actions to complete on a droplet

def Func ( arg_0 ) : arg_1 = 5 while True : arg_2 = arg_0 . actions ( ) arg_3 = False for arg_4 in arg_2 : if arg_4 [ 'status' ] == 'in-progress' : time . sleep ( arg_1 ) arg_3 = True break if not arg_3 : break

def Func(arg_0):
        """
        Func for all actions to complete on a droplet
        """
        arg_1 = 5
        while True:
            arg_2 = arg_0.actions()
            arg_3 = False
            for arg_4 in arg_2:
                if arg_4['status'] == 'in-progress':
                    # n.b. gevent will monkey patch
                    time.sleep(arg_1)
                    arg_3 = True
                    break
            if not arg_3:
                break


def Func(arg_0, arg_1):
    """Build a gene_panel object

        Args:
            panel_info(dict): A dictionary with panel information
            adapter (scout.adapter.MongoAdapter)

        Returns:
            panel_obj(dict)

    gene_panel = dict(
        panel_id = str, # required
        institute = str, # institute_id, required
        version = float, # required
        date = datetime, # required
        display_name = str, # default is panel_name
        genes = list, # list of panel genes, sorted on panel_gene['symbol']
    )

    """

    arg_2 = arg_0.get('panel_id', arg_0.get('panel_name'))
    if not arg_2:
        raise KeyError("Panel has to have a id")

    arg_3 = dict(arg_2 = arg_2)
    LOG.info("Building panel with name: {0}".format(arg_2))

    try:
        arg_4 = arg_0['institute']
    except KeyError as err:
        raise KeyError("Panel has to have a institute")

    # Check if institute exists in database
    if arg_1.institute(arg_4) is None:
        raise IntegrityError("Institute %s could not be found" % arg_4)

    arg_3['institute'] = arg_0['institute']

    arg_3['version'] = float(arg_0['version'])

    try:
        arg_3['date'] = arg_0['date']
    except KeyError as err:
        raise KeyError("Panel has to have a date")

    arg_3['display_name'] = arg_0.get('display_name', arg_3['panel_name'])

    arg_5 = []
    arg_6 = False
    for arg_7 in arg_0.get('genes', []):
        try:
            arg_8 = build_gene(arg_7, arg_1)
            arg_5.append(arg_8)
        except IntegrityError as err:
            LOG.warning(err)
            arg_6=True

    if arg_6:
        raise IntegrityError("Some genes did not exist in database. Please see log messages.")

    arg_3['genes'] = arg_5

    return arg_3


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : with arg_0 . engine . begin ( ) as db : try : arg_4 = get_file ( db , arg_0 . user_id , arg_1 , arg_2 , arg_0 . crypto . decrypt , ) except NoSuchFile : arg_0 . no_such_entity ( arg_1 ) return arg_0 . _notebook_model_from_db ( arg_4 , arg_2 )

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Get a notebook from the database.
        """
        with arg_0.engine.begin() as db:
            try:
                arg_4 = get_file(
                    db,
                    arg_0.user_id,
                    arg_1,
                    arg_2,
                    arg_0.crypto.decrypt,
                )
            except NoSuchFile:
                arg_0.no_such_entity(arg_1)

        return arg_0._notebook_model_from_db(arg_4, arg_2)


def Func ( arg_0 ) : if arg_0 . getAction ( ) == ACTION_PROBE : return createProbeMessage ( arg_0 ) if arg_0 . getAction ( ) == ACTION_PROBE_MATCH : return createProbeMatchMessage ( arg_0 ) if arg_0 . getAction ( ) == ACTION_RESOLVE : return createResolveMessage ( arg_0 ) if arg_0 . getAction ( ) == ACTION_RESOLVE_MATCH : return createResolveMatchMessage ( arg_0 ) if arg_0 . getAction ( ) == ACTION_HELLO : return createHelloMessage ( arg_0 ) if arg_0 . getAction ( ) == ACTION_BYE : return createByeMessage ( arg_0 )

def Func(arg_0):
    "construct a a raw SOAP XML string, given a prepared SoapEnvelope object"
    if arg_0.getAction() == ACTION_PROBE:
        return createProbeMessage(arg_0)
    if arg_0.getAction() == ACTION_PROBE_MATCH:
        return createProbeMatchMessage(arg_0)
    if arg_0.getAction() == ACTION_RESOLVE:
        return createResolveMessage(arg_0)
    if arg_0.getAction() == ACTION_RESOLVE_MATCH:
        return createResolveMatchMessage(arg_0)
    if arg_0.getAction() == ACTION_HELLO:
        return createHelloMessage(arg_0)
    if arg_0.getAction() == ACTION_BYE:
        return createByeMessage(arg_0)

construct a a raw SOAP XML string given a prepared SoapEnvelope object


def
Func
(
)
:
arg_0
=
cpenv
.
get_active_env
(
)
arg_1
=
[
]
if
arg_0
:
arg_1
=
arg_0
.
get_modules
(
)
arg_2
=
cpenv
.
get_active_modules
(
)
if
not
arg_0
and
not
arg_1
and
not
arg_2
:
click
.
echo
(
'\nNo active modules...'
)
return
click
.
echo
(
bold
(
'\nActive modules'
)
)
if
arg_0
:
click
.
echo
(
format_objects
(
[
arg_0
]
+
arg_2
)
)
arg_3
=
set
(
arg_1
)
set
(
arg_2
)
if
arg_3
:
click
.
echo
(
bold
(
'\nInactive modules in {}\n'
)
.
format
(
cyan
(
arg_0
.
name
)
)
)
click
.
echo
(
format_objects
(
arg_3
,
header
=
False
)
)
else
:
click
.
echo
(
format_objects
(
arg_2
)
)
arg_4
=
set
(
cpenv
.
get_modules
(
)
)
set
(
arg_2
)
if
not
arg_4
:
return
click
.
echo
(
bold
(
'\nInactive shared modules \n'
)
)
click
.
echo
(
format_objects
(
arg_4
,
header
=
False
)
)

def Func():
    '''Show context Func'''

    arg_0 = cpenv.get_active_env()
    arg_1 = []
    if arg_0:
        arg_1 = arg_0.get_modules()
    arg_2 = cpenv.get_active_modules()

    if not arg_0 and not arg_1 and not arg_2:
        click.echo('\nNo active modules...')
        return

    click.echo(bold('\nActive modules'))
    if arg_0:
        click.echo(format_objects([arg_0] + arg_2))

        arg_3 = set(arg_1) - set(arg_2)
        if arg_3:

            click.echo(
                bold('\nInactive modules in {}\n').format(cyan(arg_0.name))
            )
            click.echo(format_objects(arg_3, header=False))

    else:
        click.echo(format_objects(arg_2))

    arg_4 = set(cpenv.get_modules()) - set(arg_2)
    if not arg_4:
        return

    click.echo(bold('\nInactive shared modules \n'))
    click.echo(format_objects(arg_4, header=False))


def Func(arg_0, arg_1=False):
        """
        Returns true if the host does not exist at the expected location and may need
        to have its initial configuration set.
        Returns false if the host exists at the expected location.
        """

        arg_2 = False

        arg_3 = arg_0.is_present()

        if not arg_3:
            arg_4 = arg_0.is_present(arg_0.env.default_hostname)
            if arg_4:
                if arg_0.verbose:
                    print('Target host missing and default host present so host init required.')
                arg_2 = True
            else:
                if arg_0.verbose:
                    print('Target host missing but default host also missing, '
                        'so no host init required.')
#                 if stop_on_error:
#                     raise Exception(
#                         'Both target and default hosts missing! '
#                         'Is the machine turned on and plugged into the network?')
        else:
            if arg_0.verbose:
                print('Target host is present so no host init required.')

        return arg_2

Returns true if the host does not exist at the expected location and may need to have its initial configuration set . Returns false if the host exists at the expected location .


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
check_profile
(
arg_1
)
arg_2
=
arg_0
.
profiles
[
arg_1
]
if
arg_2
[
'status'
]
==
'stopped'
:
raise
web
.
HTTPError
(
409
,
u'cluster not running'
)
arg_2
=
arg_0
.
profiles
[
arg_1
]
arg_3
=
arg_2
[
'controller_launcher'
]
arg_4
=
arg_2
[
'engine_set_launcher'
]
if
arg_3
.
running
:
arg_3
.
stop
(
)
if
arg_4
.
running
:
arg_4
.
stop
(
)
arg_5
=
{
'profile'
:
arg_2
[
'profile'
]
,
'profile_dir'
:
arg_2
[
'profile_dir'
]
,
'status'
:
'stopped'
}
return
arg_5

def Func(arg_0, arg_1):
        """Stop a cluster for a given profile."""
        arg_0.check_profile(arg_1)
        arg_2 = arg_0.profiles[arg_1]
        if arg_2['status'] == 'stopped':
            raise web.HTTPError(409, u'cluster not running')
        arg_2 = arg_0.profiles[arg_1]
        arg_3 = arg_2['controller_launcher']
        arg_4 = arg_2['engine_set_launcher']
        if arg_3.running:
            arg_3.stop()
        if arg_4.running:
            arg_4.stop()
        # Return a temp info dict, the real one is updated in the on_stop
        # logic above.
        arg_5 = {
            'profile': arg_2['profile'],
            'profile_dir': arg_2['profile_dir'],
            'status': 'stopped'
        }
        return arg_5


def Func ( arg_0 ) : arg_1 = _group_tasks_by_jobid ( arg_0 ) arg_2 = [ ] for arg_3 in arg_1 . keys ( ) : arg_4 = sorted ( arg_1 [ arg_3 ] , key = _importance_of_task ) arg_2 . append ( arg_4 [ 0 ] ) return arg_2

def Func(arg_0):
  """A list with, for each job, its dominant task.

  The dominant task is the one that exemplifies its job's
  status. It is either:
  - the first (FAILURE or CANCELED) task, or if none
  - the first RUNNING task, or if none
  - the first SUCCESS task.

  Args:
    tasks: a list of tasks to consider

  Returns:
    A list with, for each job, its dominant task.
  """

  arg_1 = _group_tasks_by_jobid(arg_0)

  arg_2 = []
  for arg_3 in arg_1.keys():
    arg_4 = sorted(arg_1[arg_3], key=_importance_of_task)
    arg_2.append(arg_4[0])
  return arg_2

A list with for each job its dominant task .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . vcard . add ( 'categories' ) arg_2 . value = helpers . convert_to_vcard ( "category" , arg_1 , ObjectType . list_with_strings )

def Func(arg_0, arg_1):
        """ categories variable must be a list """
        arg_2 = arg_0.vcard.add('categories')
        arg_2.value = helpers.convert_to_vcard(
            "category", arg_1, ObjectType.list_with_strings)