def Func(arg_0, arg_1="Large", **arg_2):
        """Lookup an Amazon Product.

        :return:
            An instance of :class:`~.AmazonProduct` if one item was returned,
            or a list of  :class:`~.AmazonProduct` instances if multiple
            items where returned.
        """
        arg_3 = arg_0.api.ItemLookup(arg_1=arg_1, **arg_2)
        arg_4 = objectify.fromstring(arg_3)
        if arg_4.Items.Request.IsValid == 'False':
            arg_5 = arg_4.Items.Request.Errors.Error.Code
            arg_6 = arg_4.Items.Request.Errors.Error.Message
            raise LookupException(
                "Amazon Product Lookup Error: '{0}', '{1}'".format(arg_5, arg_6))
        if not hasattr(arg_4.Items, 'Item'):
            raise AsinNotFound("ASIN(s) not found: '{0}'".format(
                etree.tostring(arg_4, pretty_print=True)))
        if len(arg_4.Items.Item) > 1:
            return [
                AmazonProduct(
                    arg_7,
                    arg_0.aws_associate_tag,
                    arg_0,
                    region=arg_0.region) for arg_7 in arg_4.Items.Item
            ]
        else:
            return AmazonProduct(
                arg_4.Items.Item,
                arg_0.aws_associate_tag,
                arg_0,
                region=arg_0.region
            )


def Func(arg_0, arg_1):
    """Read a table structure.

    These are used by Blizzard to collect pieces of data together. Each
    value is prefixed by two bytes, first denoting (doubled) index and the
    second denoting some sort of key -- so far it has always been '09'. The
    actual value follows as a Variable-Length Quantity, also known as uintvar.
    The actual value is also doubled.

    In some tables the keys might jump from 0A 09 to 04 09 for example.
    I have no idea why this happens, as the next logical key is 0C. Perhaps
    it's a table in a table? Some sort of headers might exist for these
    tables, I'd imagine at least denoting length. Further research required.
    """
    def read_field(arg_2):
        arg_0.read(2)
        arg_3[arg_2] = vlq2int(arg_0) / 2
        # Discard unknown fields.
        if arg_2 == 'unknown':
            del arg_3[arg_2]

    arg_3 = {}
    for arg_4 in arg_1:
        read_field(arg_4)
    return arg_3


(vid, title, output_dir='.', merge=True, info_only=False, **kwargs)

def Func(arg_0, arg_1, arg_2='.', arg_3=True, arg_4=False, **arg_5):
    """str, str, str, bool, bool ->None

    Download Acfun video by vid.

    Call Acfun API, decide which site to use, and pass the job to its
    extractor.
    """

    #first call the main parasing API
    arg_6 = json.loads(get_content('http://www.acfun.cn/video/getVideo.aspx?id=' + arg_0))

    arg_7 = arg_6['sourceType']

    #decide sourceId to know which extractor to use
    if 'sourceId' in arg_6: arg_8 = arg_6['sourceId']
    # danmakuId = info['danmakuId']

    #call extractor decided by sourceId
    if arg_7 == 'sina':
        sina_download_by_vid(arg_8, arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)
    elif arg_7 == 'youku':
        youku_download_by_vid(arg_8, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, **arg_5)
    elif arg_7 == 'tudou':
        tudou_download_by_iid(arg_8, arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)
    elif arg_7 == 'qq':
        qq_download_by_vid(arg_8, arg_1, True, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)
    elif arg_7 == 'letv':
        letvcloud_download_by_vu(arg_8, '2d8c027396', arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)
    elif arg_7 == 'zhuzhan':
        #As in Jul.28.2016, Acfun is using embsig to anti hotlink so we need to pass this
#In Mar. 2017 there is a dedicated ``acfun_proxy'' in youku cloud player
#old code removed
        arg_9 = 'http://www.acfun.cn/v/ac' + arg_0
        arg_10 = youku_acfun_proxy(arg_6['sourceId'], arg_6['encode'], arg_9)
        arg_11 = ['mp4hd3', 'mp4hd2', 'mp4hd', 'flvhd']
        for arg_12 in arg_11:
            if arg_10.get(arg_12):
                arg_13 = arg_10[arg_12]
                break
#total_size in the json could be incorrect(F.I. 0)
        arg_14 = 0
        for arg_9 in arg_13[0]:
            arg_15, arg_15, arg_16 = url_info(arg_9)
            arg_14 += arg_16
#fallback to flvhd is not quite possible
        if re.search(r'fid=[0-9A-Z\-]*.flv', arg_13[0][0]):
            arg_17 = 'flv'
        else:
            arg_17 = 'mp4'
        print_info(site_info, arg_1, arg_17, arg_14)
        if not arg_4:
            download_urls(arg_13[0], arg_1, arg_17, arg_14, arg_2=arg_2, arg_3=arg_3)
    else:
        raise NotImplementedError(arg_7)

    if not arg_4 and not dry_run:
        if not arg_5['caption']:
            print('Skipping danmaku.')
            return
        try:
            arg_1 = get_filename(arg_1)
            print('Downloading %s ...\n' % (arg_1 + '.cmt.json'))
            arg_18 = get_srt_json(arg_0)
            with open(os.path.join(arg_2, arg_1 + '.cmt.json'), 'w', encoding='utf-8') as x:
                x.write(arg_18)
        except:
            pass


(self, file_path=None, relpath=None, mimetype=None,
                            time_origin=None, ex_from=None)

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = None , arg_4 = None , arg_5 = None ) : for arg_6 in arg_0 . media_descriptors [ : ] : if arg_1 is not None and arg_6 [ 'MEDIA_URL' ] != arg_1 : continue if arg_2 is not None and arg_6 [ 'RELATIVE_MEDIA_URL' ] != arg_2 : continue if arg_3 is not None and arg_6 [ 'MIME_TYPE' ] != arg_3 : continue if arg_4 is not None and arg_6 [ 'TIME_ORIGIN' ] != arg_4 : continue if arg_5 is not None and arg_6 [ 'EXTRACTED_FROM' ] != arg_5 : continue del ( arg_0 . media_descriptors [ arg_0 . media_descriptors . index ( arg_6 ) ] )

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,
                            arg_4=None, arg_5=None):
        """Remove all linked files that match all the criteria, criterias that
        are ``None`` are ignored.

        :param str file_path: Path of the file.
        :param str relpath: Relative filepath.
        :param str mimetype: Mimetype of the file.
        :param int time_origin: Time origin.
        :param str ex_from: Extracted from.
        """
        for arg_6 in arg_0.media_descriptors[:]:
            if arg_1 is not None and arg_6['MEDIA_URL'] != arg_1:
                continue
            if arg_2 is not None and arg_6['RELATIVE_MEDIA_URL'] != arg_2:
                continue
            if arg_3 is not None and arg_6['MIME_TYPE'] != arg_3:
                continue
            if arg_4 is not None and\
                    arg_6['TIME_ORIGIN'] != arg_4:
                continue
            if arg_5 is not None and arg_6['EXTRACTED_FROM'] != arg_5:
                continue
            del(arg_0.media_descriptors[arg_0.media_descriptors.index(arg_6)])

Remove all linked files that match all the criteria criterias that are None are ignored .


def
Func
(
arg_0
)
:
try
:
if
S3Handler
.
S3_KEYS
:
arg_0
.
s3
=
BotoClient
(
arg_0
.
opt
,
S3Handler
.
S3_KEYS
[
0
]
,
S3Handler
.
S3_KEYS
[
1
]
)
else
:
arg_0
.
s3
=
BotoClient
(
arg_0
.
opt
)
except
Exception
as
e
:
raise
RetryFailure
(
'Unable to Func to s3: %s'
%
e
)

def Func(arg_0):
    '''Connect to S3 storage'''
    try:
      if S3Handler.S3_KEYS:
        arg_0.s3 = BotoClient(arg_0.opt, S3Handler.S3_KEYS[0], S3Handler.S3_KEYS[1])
      else:
        arg_0.s3 = BotoClient(arg_0.opt)
    except Exception as e:
      raise RetryFailure('Unable to Func to s3: %s' % e)


def Func ( arg_0 , * arg_1 ) : for arg_2 , arg_3 , arg_4 in os . walk ( arg_0 ) : if len ( arg_4 ) > 0 : arg_5 = [ ] for arg_6 in arg_4 : for arg_7 in arg_1 : if re . search ( arg_7 , arg_6 ) : arg_5 . append ( op . join ( arg_2 , arg_6 ) ) if len ( arg_5 ) == len ( arg_1 ) : yield arg_5

def Func(arg_0, *arg_1):
    """
    Returns absolute paths of files that match the regexs within folder_path and
    all its children folders.

    This is an iterator function that will use yield to return each set of
    file_paths in one iteration.

    Will only return value if all the strings in regex match a file name.

    Note: The regex matching is done using the search function
    of the re module.

    Parameters
    ----------
    folder_path: string

    regex: strings

    Returns
    -------
    A list of strings.
    """
    for arg_2, arg_3, arg_4 in os.walk(arg_0):
        if len(arg_4) > 0:
            arg_5 = []
            for arg_6 in arg_4:
                for arg_7 in arg_1:
                    if re.search(arg_7, arg_6):
                        arg_5.append(op.join(arg_2, arg_6))
            if len(arg_5) == len(arg_1):
                yield arg_5

Returns absolute paths of files that match the regexs within folder_path and all its children folders .


return LineStringsOnImage(
            line_strings=[ls.deepcopy() for ls in lss],
            shape=tuple(shape))

def Func ( arg_0 , arg_1 = None , arg_2 = None ) : arg_3 = arg_0 . line_strings if arg_1 is None else arg_1 arg_2 = arg_0 . shape if arg_2 is None else arg_2 return LineStringsOnImage ( arg_1 = [ arg_4 . Func ( ) for arg_4 in arg_3 ] , arg_2 = tuple ( arg_2 ) )

def Func(arg_0, arg_1=None, arg_2=None):
        """
        Create a deep copy of the LineStringsOnImage object.

        Parameters
        ----------
        line_strings : None \
                       or list of imgaug.augmentables.lines.LineString, optional
            List of line strings on the image.
            If not ``None``, then the ``line_strings`` attribute of the copied
            object will be set to this value.

        shape : None or tuple of int or ndarray, optional
            The shape of the image on which the objects are placed.
            Either an image with shape ``(H,W,[C])`` or a tuple denoting
            such an image shape.
            If not ``None``, then the ``shape`` attribute of the copied object
            will be set to this value.

        Returns
        -------
        imgaug.augmentables.lines.LineStringsOnImage
            Deep copy.

        """
        arg_3 = arg_0.line_strings if arg_1 is None else arg_1
        arg_2 = arg_0.shape if arg_2 is None else arg_2
        return LineStringsOnImage(
            arg_1=[arg_4.Func() for arg_4 in arg_3],
            arg_2=tuple(arg_2))

Create a deep copy of the LineStringsOnImage object .


(self, aspect_ratio, mode="constant", cval=0.0, return_pad_amounts=False)

def Func(arg_0, arg_1, arg_2="constant", arg_3=0.0, arg_4=False):
        """
        Pad the heatmaps on their sides so that they match a target aspect ratio.

        Depending on which dimension is smaller (height or width), only the corresponding
        sides (left/right or top/bottom) will be padded. In each case, both of the sides will
        be padded equally.

        Parameters
        ----------
        aspect_ratio : float
            Target aspect ratio, given as width/height. E.g. 2.0 denotes the image having twice
            as much width as height.

        mode : str, optional
            Padding mode to use. See :func:`numpy.pad` for details.

        cval : number, optional
            Value to use for padding if `mode` is ``constant``. See :func:`numpy.pad` for details.

        return_pad_amounts : bool, optional
            If False, then only the padded image will be returned. If True, a tuple with two
            entries will be returned, where the first entry is the padded image and the second
            entry are the amounts by which each image side was padded. These amounts are again a
            tuple of the form (top, right, bottom, left), with each value being an integer.

        Returns
        -------
        heatmaps : imgaug.HeatmapsOnImage
            Padded heatmaps as HeatmapsOnImage object.

        pad_amounts : tuple of int
            Amounts by which the heatmaps were padded on each side, given as a tuple ``(top, right, bottom, left)``.
            This tuple is only returned if `return_pad_amounts` was set to True.

        """
        arg_5, arg_6 = ia.Func(arg_0.arr_0to1, arg_1=arg_1, arg_2=arg_2,
                                                              arg_3=arg_3, arg_4=True)
        arg_7 = HeatmapsOnImage.from_0to1(arg_5, shape=arg_0.shape, min_value=arg_0.min_value,
                                             max_value=arg_0.max_value)
        if arg_4:
            return arg_7, arg_6
        else:
            return arg_7

Pad the heatmaps on their sides so that they match a target aspect ratio .


def Func(arg_0, arg_1, arg_2):
  """Convert a 32-bit or 64-bit integer created
  by float_pack into a Python float."""

  if arg_1 == 8:
    arg_3 = -1021  # = sys.float_info.min_exp
    arg_4 = 1024   # = sys.float_info.max_exp
    arg_5 = 53    # = sys.float_info.mant_dig
    arg_6 = 64
  elif arg_1 == 4:
    arg_3 = -125   # C's FLT_MIN_EXP
    arg_4 = 128    # FLT_MAX_EXP
    arg_5 = 24    # FLT_MANT_DIG
    arg_6 = 32
  else:
    raise ValueError("invalid size value")

  if arg_0 >> arg_6:
    raise ValueError("input out of range")

  # extract pieces
  arg_7 = arg_0 >> arg_6 - 1
  arg_8 = (arg_0 & ((1 << arg_6 - 1) - (1 << arg_5 - 1))) >> arg_5 - 1
  arg_9 = arg_0 & ((1 << arg_5 - 1) - 1)

  if arg_8 == arg_4 - arg_3 + 2:
    # nan or infinity
    arg_10 = float('nan') if arg_9 else float('inf')
  elif arg_8 == 0:
    # subnormal or zero
    arg_10 = math.ldexp(float(arg_9), arg_3 - arg_5)
  else:
    # normal
    arg_9 += 1 << arg_5 - 1
    arg_10 = math.ldexp(float(arg_9), arg_8 + arg_3 - arg_5 - 1)
  return -arg_10 if arg_7 else arg_10

Convert a 32 - bit or 64 - bit integer created by float_pack into a Python float .


(tot_style_factor_exposure, factor_name=None,
                                ax=None)

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
)
:
if
arg_2
is
:
arg_2
=
plt
.
gca
(
)
if
arg_1
is
:
arg_1
=
arg_0
.
name
arg_2
.
plot
(
arg_0
.
index
,
arg_0
,
label
=
arg_1
)
arg_3
=
arg_0
.
mean
(
)
arg_2
.
axhline
(
arg_3
,
linestyle
=
'-.'
,
label
=
'Mean = {:.3}'
.
format
(
arg_3
)
)
arg_2
.
axhline
(
0
,
color
=
'k'
,
linestyle
=
'-'
)
arg_4
,
arg_4
,
arg_5
,
arg_6
=
plt
.
axis
(
)
arg_7
=
max
(
abs
(
arg_5
)
,
abs
(
arg_6
)
)
arg_2
.
set
(
title
=
'Exposure to {}'
.
format
(
arg_1
)
,
ylabel
=
'{} \n weighted exposure'
.
format
(
arg_1
)
,
ylim
=
(
arg_7
,
arg_7
)
)
arg_2
.
legend
(
frameon
=
True
,
framealpha
=
0.5
)
return
arg_2

def Func(arg_0, arg_1=None,
                                arg_2=None):
    """
    Plots DataFrame output of compute_style_factor_exposures as a line graph

    Parameters
    ----------
    tot_style_factor_exposure : pd.Series
        Daily style factor exposures (output of compute_style_factor_exposures)
        - Time series with decimal style factor exposures
        - Example:
            2017-04-24    0.037820
            2017-04-25    0.016413
            2017-04-26   -0.021472
            2017-04-27   -0.024859

    factor_name : string
        Name of style factor, for use in graph title
        - Defaults to tot_style_factor_exposure.name
    """

    if arg_2 is None:
        arg_2 = plt.gca()

    if arg_1 is None:
        arg_1 = arg_0.name

    arg_2.plot(arg_0.index, arg_0,
            label=arg_1)
    arg_3 = arg_0.mean()
    arg_2.axhline(arg_3, linestyle='-.', label='Mean = {:.3}'.format(arg_3))
    arg_2.axhline(0, color='k', linestyle='-')
    arg_4, arg_4, arg_5, arg_6 = plt.axis()
    arg_7 = max(abs(arg_5), abs(arg_6))
    arg_2.set(title='Exposure to {}'.format(arg_1),
           ylabel='{} \n weighted exposure'.format(arg_1),
           ylim=(-arg_7, arg_7))
    arg_2.legend(frameon=True, framealpha=0.5)

    return arg_2


def Func ( arg_0 ) : for arg_1 in arg_0 : if isinstance ( arg_1 , pyflakes . messages . UnusedImport ) : yield arg_1 . lineno

def Func(arg_0):
    """Yield line numbers of unused imports."""
    for arg_1 in arg_0:
        if isinstance(arg_1, pyflakes.messages.UnusedImport):
            yield arg_1.lineno


def Func ( arg_0 , arg_1 ) : arg_2 = DAGCircuit ( ) for arg_3 in arg_1 . qregs . values ( ) : arg_2 . add_qreg ( arg_3 ) for arg_4 in arg_1 . cregs . values ( ) : arg_2 . add_creg ( arg_4 ) arg_5 = { } for arg_6 in arg_1 . wires : if not isinstance ( arg_6 [ 0 ] , QuantumRegister ) : continue arg_7 = list ( arg_1 . qregs . values ( ) ) arg_5 [ arg_6 ] = arg_7 . index ( arg_6 [ 0 ] ) + arg_6 [ 1 ] arg_8 = arg_0 . property_set [ 'block_list' ] arg_9 = set ( ) for arg_10 in arg_1 . topological_op_nodes ( ) : if arg_10 in arg_9 or arg_10 . type == 'in' or arg_10 . type == 'out' : continue if arg_8 and arg_10 in arg_8 [ 0 ] : arg_11 = arg_8 [ 0 ] arg_12 = set ( ) for arg_13 in arg_11 : arg_12 |= set ( arg_13 . qargs ) arg_14 = len ( arg_12 ) arg_15 = QuantumRegister ( arg_14 ) arg_16 = QuantumCircuit ( arg_15 ) arg_17 = arg_0 . _block_qargs_to_indices ( arg_12 , arg_5 ) for arg_13 in arg_11 : arg_9 . add ( arg_13 ) arg_16 . append ( arg_13 . op , [ arg_15 [ arg_17 [ arg_18 ] ] for arg_18 in arg_13 . qargs ] ) arg_19 = UnitaryGate ( Operator ( arg_16 ) ) arg_2 . apply_operation_back ( arg_19 , sorted ( arg_12 , key = lambda x : arg_17 [ x ] ) ) del arg_8 [ 0 ] else : for arg_11 in arg_8 [ 1 : ] : if arg_10 in arg_11 : break else : arg_9 . add ( arg_10 ) arg_2 . apply_operation_back ( arg_10 . op , arg_10 . qargs , arg_10 . cargs ) return arg_2

def Func(arg_0, arg_1):
        """iterate over each block and replace it with an equivalent Unitary
        on the same wires.
        """
        arg_2 = DAGCircuit()
        for arg_3 in arg_1.qregs.values():
            arg_2.add_qreg(arg_3)
        for arg_4 in arg_1.cregs.values():
            arg_2.add_creg(arg_4)

        # compute ordered indices for the global circuit wires
        arg_5 = {}
        for arg_6 in arg_1.wires:
            if not isinstance(arg_6[0], QuantumRegister):
                continue
            arg_7 = list(arg_1.qregs.values())
            arg_5[arg_6] = arg_7.index(arg_6[0]) + arg_6[1]

        arg_8 = arg_0.property_set['block_list']
        arg_9 = set()

        for arg_10 in arg_1.topological_op_nodes():
            # skip already-visited nodes or input/output nodes
            if arg_10 in arg_9 or arg_10.type == 'in' or arg_10.type == 'out':
                continue
            # check if the node belongs to the next block
            if arg_8 and arg_10 in arg_8[0]:
                arg_11 = arg_8[0]
                # find the qubits involved in this block
                arg_12 = set()
                for arg_13 in arg_11:
                    arg_12 |= set(arg_13.qargs)
                # convert block to a sub-circuit, then simulate unitary and add
                arg_14 = len(arg_12)
                arg_15 = QuantumRegister(arg_14)
                arg_16 = QuantumCircuit(arg_15)
                arg_17 = arg_0._block_qargs_to_indices(arg_12,
                                                               arg_5)
                for arg_13 in arg_11:
                    arg_9.add(arg_13)
                    arg_16.append(arg_13.op, [arg_15[arg_17[arg_18]] for arg_18 in arg_13.qargs])
                arg_19 = UnitaryGate(Operator(arg_16))  # simulates the circuit
                arg_2.apply_operation_back(
                    arg_19, sorted(arg_12, key=lambda x: arg_17[x]))
                del arg_8[0]
            else:
                # the node could belong to some future block, but in that case
                # we simply skip it. It is guaranteed that we will revisit that
                # future block, via its other nodes
                for arg_11 in arg_8[1:]:
                    if arg_10 in arg_11:
                        break
                # freestanding nodes can just be added
                else:
                    arg_9.add(arg_10)
                    arg_2.apply_operation_back(arg_10.op, arg_10.qargs, arg_10.cargs)

        return arg_2

iterate over each block and replace it with an equivalent Unitary on the same wires .


def Func(arg_0):
        """Return the resolved Func on the side where it is called from.

        The appropriate Func will be returned when called from within
        an app running remotely as well as regular python on the client side.

        Args:
            - self
        Returns:
             - Func (string)
        """
        if hasattr(arg_0, 'local_path'):
            return arg_0.local_path

        if arg_0.scheme in ['ftp', 'http', 'https', 'globus']:
            return arg_0.filename
        elif arg_0.scheme in ['file']:
            return arg_0.path
        else:
            raise Exception('Cannot return Func for unknown scheme {}'.format(arg_0.scheme))

Return the resolved filepath on the side where it is called from.

        The appropriate filepath will be returned when called from within
        an app running remotely as well as regular python on the client side.

        Args:
            - self
        Returns:
             - filepath (string)

Return the resolved filepath on the side where it is called from .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = dict ( ) arg_3 [ 'id' ] = arg_1 if arg_2 : arg_3 [ 'token' ] = arg_2 arg_4 = arg_0 . request ( 'midas.community.get' , arg_3 ) return arg_4

def Func(arg_0, arg_1, arg_2=None):
        """
        Get a community based on its id.

        :param community_id: The id of the target community.
        :type community_id: int | long
        :param token: (optional) A valid token for the user in question.
        :type token: None | string
        :returns: The requested community.
        :rtype: dict
        """
        arg_3 = dict()
        arg_3['id'] = arg_1
        if arg_2:
            arg_3['token'] = arg_2
        arg_4 = arg_0.request('midas.community.get', arg_3)
        return arg_4


def Func(arg_0, arg_1, arg_2):
  """Helper which checks validity of `loc` and `scale` init args."""
  with tf.name_scope("check_" + arg_1):
    arg_3 = []
    if tensorshape_util.rank(arg_0.shape) is not None:
      if tensorshape_util.rank(arg_0.shape) == 0:
        raise ValueError("Mixing params must be a (batch of) vector; "
                         "{}.rank={} is not at least one.".format(
                             arg_1, tensorshape_util.rank(arg_0.shape)))
    elif arg_2:
      arg_3.append(
          assert_util.assert_rank_at_least(
              arg_0,
              1,
              message=("Mixing params must be a (batch of) vector; "
                       "{}.rank is not at least one.".format(arg_1))))

    # TODO(jvdillon): Remove once we support k-mixtures.
    if tensorshape_util.with_rank_at_least(arg_0.shape, 1)[-1] is not None:
      if tf.compat.dimension_value(arg_0.shape[-1]) != 1:
        raise NotImplementedError("Currently only bimixtures are supported; "
                                  "{}.shape[-1]={} is not 1.".format(
                                      arg_1,
                                      tf.compat.dimension_value(
                                          arg_0.shape[-1])))
    elif arg_2:
      arg_3.append(
          assert_util.assert_equal(
              tf.shape(input=arg_0)[-1],
              1,
              message=("Currently only bimixtures are supported; "
                       "{}.shape[-1] is not 1.".format(arg_1))))

    if arg_3:
      return distribution_util.with_dependencies(arg_3, arg_0)
    return arg_0

Helper which checks validity of loc and scale init args .


def Func(arg_0: arg_1):
    """Collapse consistent edges together.

    .. warning:: This operation doesn't preserve evidences or other annotations
    """
    for arg_2, arg_3 in arg_0.edges():
        arg_4 = pair_is_consistent(arg_0, arg_2, arg_3)

        if not arg_4:
            continue

        arg_5 = [(arg_2, arg_3, k) for k in arg_0[arg_2][arg_3]]
        arg_0.remove_edges_from(arg_5)
        arg_0.add_edge(arg_2, arg_3, attr_dict={RELATION: arg_4})


(self, category=CATEGORY_EVENT, from_date=DEFAULT_DATETIME, to_date=None,
              filter_classified=False)

def Func(arg_0, arg_1=arg_2, arg_3=arg_4, arg_5=None,
              arg_6=False):
        """Fetch the events from the server.

        This method Funces those events of a group stored on the server
        that were updated since the given date. Data comments and rsvps
        are included within each event.

        :param category: the category of items to Func
        :param from_date: obtain events updated since this date
        :param to_date: obtain events updated before this date
        :param filter_classified: remove classified fields from the resulting items

        :returns: a generator of events
        """
        if not arg_3:
            arg_3 = arg_4

        arg_3 = datetime_to_utc(arg_3)

        arg_7 = {"from_date": arg_3, "to_date": arg_5}
        arg_8 = super().Func(arg_1,
                              arg_6=arg_6,
                              **arg_7)

        return arg_8

Fetch the events from the server.

        This method fetches those events of a group stored on the server
        that were updated since the given date. Data comments and rsvps
        are included within each event.

        :param category: the category of items to fetch
        :param from_date: obtain events updated since this date
        :param to_date: obtain events updated before this date
        :param filter_classified: remove classified fields from the resulting items

        :returns: a generator of events


def Func ( arg_0 , arg_1 ) : arg_2 = { 'order_by' : 'updated_at' , 'sort' : 'asc' , 'per_page' : PER_PAGE } arg_3 = urijoin ( GitLabClient . MERGES , str ( arg_1 ) , GitLabClient . VERSIONS ) return arg_0 . fetch_items ( arg_3 , arg_2 )

def Func(arg_0, arg_1):
        """Get the merge versions from pagination"""

        arg_2 = {
            'order_by': 'updated_at',
            'sort': 'asc',
            'per_page': PER_PAGE
        }

        arg_3 = urijoin(GitLabClient.MERGES, str(arg_1), GitLabClient.VERSIONS)
        return arg_0.fetch_items(arg_3, arg_2)


def Func():
    """
        Scans available smb services in the database for smb signing and ms17-010.
    """
    arg_0 = ServiceSearch()
    arg_1 = arg_0.get_services(ports=['445'], tags=['!smb_vulnscan'], up=True)
    arg_1 = [arg_3 for arg_3 in arg_1]
    arg_2 = {}
    for arg_3 in arg_1:
        arg_3.add_tag('smb_vulnscan')
        arg_2[arg_4(arg_3.address)] = arg_3

    arg_6 = "-Pn -n --disable-arp-ping --script smb-security-mode.nse,smb-vuln-ms17-010.nse -p 445".split(" ")

    if arg_1:
        arg_7 = nmap(arg_6, [arg_4(s.address) for s in arg_1])
        arg_8 = NmapParser()
        arg_9 = arg_8.parse_fromstring(arg_7)
        arg_10 = 0
        arg_11 = 0
        for arg_12 in arg_9.hosts:
            for arg_13 in arg_12.scripts_results:
                arg_13 = arg_13.get('elements', {})
                arg_3 = arg_2[arg_4(arg_12.address)]
                if arg_13.get('message_signing', '') == 'disabled':
                    print_success("({}) SMB Signing disabled".format(arg_12.address))
                    arg_3.add_tag('smb_signing_disabled')
                    arg_10 += 1
                if arg_13.get('CVE-2017-0143', {}).get('state', '') == 'VULNERABLE':
                    print_success("({}) Vulnerable for MS17-010".format(arg_12.address))
                    arg_3.add_tag('MS17-010')
                    arg_11 += 1
                arg_3.update(tags=arg_3.tags)

        print_notification("Completed, 'smb_signing_disabled' tag added to systems with smb signing disabled, 'MS17-010' tag added to systems that did not apply MS17-010.")
        arg_14 = {'smb_signing': arg_10, 'MS17_010': arg_11, 'scanned_services': len(arg_1)}

        Logger().log('smb_vulnscan', 'Scanned {} smb services for vulnerabilities'.format(len(arg_1)), arg_14)
    else:
        print_notification("No services found to scan.")

Scans available smb services in the database for smb signing and ms17 - 010 .


def Func ( arg_0 ) : arg_1 = np . array ( arg_0 ) if arg_1 . ndim == 1 : return 0 arg_2 = np . maximum ( np . linalg . eigvalsh ( arg_0 ) , 0. ) return shannon_Func ( arg_2 , base = np . e )

def Func(arg_0):
    """
    Compute the von-Neumann Func of a quantum state.

    Args:
        state (array_like): a density matrix or state vector.

    Returns:
        float: The von-Neumann Func S(rho).
    """

    arg_1 = np.array(arg_0)
    if arg_1.ndim == 1:
        return 0
    arg_2 = np.maximum(np.linalg.eigvalsh(arg_0), 0.)
    return shannon_Func(arg_2, base=np.e)

Compute the von-Neumann entropy of a quantum state.

    Args:
        state (array_like): a density matrix or state vector.

    Returns:
        float: The von-Neumann entropy S(rho).

Compute the von - Neumann entropy of a quantum state .


def Func ( arg_0 ) : arg_1 = arg_0 . pop ( 'idx' ) arg_2 = Func . kwargs arg_2 . update ( arg_0 ) arg_3 = arg_2 [ 'traj' ] arg_3 . f_set_crun ( arg_1 ) return _sigint_handling_single_run ( arg_2 )

def Func(arg_0):
    """Single run wrapper for the frozen pool, makes a single run and passes kwargs"""
    arg_1 = arg_0.pop('idx')
    arg_2 = Func.kwargs
    arg_2.update(arg_0)  # in case of `run_map`
    # we need to update job's args and kwargs
    arg_3 = arg_2['traj']
    arg_3.f_set_crun(arg_1)
    return _sigint_handling_single_run(arg_2)

Single run wrapper for the frozen pool makes a single run and passes kwargs


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
{
'jsonrpc'
:
'2.0'
,
'id'
:
arg_0
,
'error'
:
{
'code'
:
32000
,
'message'
:
'Server error'
,
'data'
:
repr
(
arg_1
)
,
}
,
}
raise
ServiceException
(
500
,
dumps
(
arg_2
)
)

def Func(arg_0, arg_1):
    """JSON-RPC server error.

    :param request_id: JSON-RPC request id
    :type request_id: int or str or None
    :param error: server error
    :type error: Exception

    """

    arg_2 = {
        'jsonrpc': '2.0',
        'id': arg_0,
        'error': {
            'code': -32000,
            'message': 'Server error',
            'data': repr(arg_1),
        },
    }
    raise ServiceException(500, dumps(arg_2))


def Func ( arg_0 ) : if arg_0 . decorators : for arg_1 in arg_0 . decorators . nodes : if ( isinstance ( arg_1 , astroid . Attribute ) and getattr ( arg_1 . expr , "name" , None ) == arg_0 . name ) : return True return False

def Func(arg_0):
    """return True if the object is a method redefined via decorator.

    For example:
        @property
        def x(self): return self._x
        @x.setter
        def x(self, value): self._x = value
    """
    if arg_0.decorators:
        for arg_1 in arg_0.decorators.nodes:
            if (
                isinstance(arg_1, astroid.Attribute)
                and getattr(arg_1.expr, "name", None) == arg_0.name
            ):
                return True
    return False

return True if the object is a method redefined via decorator .


def Func(arg_0, arg_1, arg_2):
    '''This gets information on a single object from the LCC-Server.

    Returns a dict with all of the available information on an object, including
    finding charts, comments, object type and variability tags, and
    period-search results (if available).

    If you have an LCC-Server API key present in `~/.astrobase/lccs/` that is
    associated with an LCC-Server user account, objects that are visible to this
    user will be returned, even if they are not visible to the public. Use this
    to look up objects that have been marked as 'private' or 'shared'.

    NOTE: you can pass the result dict returned by this function directly into
    the `astrobase.checkplot.checkplot_pickle_to_png` function, e.g.::

        astrobase.checkplot.checkplot_pickle_to_png(result_dict,
                                                    'object-%s-info.png' %
                                                    result_dict['objectid'])

    to generate a quick PNG overview of the object information.

    Parameters
    ----------

    lcc_server : str
        This is the base URL of the LCC-Server to talk to.

    objectid : str
        This is the unique database ID of the object to retrieve info for. This
        is always returned as the `db_oid` column in LCC-Server search results.

    db_collection_id : str
        This is the collection ID which will be searched for the object. This is
        always returned as the `collection` column in LCC-Server search results.

    Returns
    -------

    dict
        A dict containing the object info is returned. Some important items in
        the result dict:

        - `objectinfo`: all object magnitude, color, GAIA cross-match, and
          object type information available for this object

        - `objectcomments`: comments on the object's variability if available

        - `varinfo`: variability comments, variability features, type tags,
          period and epoch information if available

        - `neighbors`: information on the neighboring objects of this object in
          its parent light curve collection

        - `xmatch`: information on any cross-matches to external catalogs
          (e.g. KIC, EPIC, TIC, APOGEE, etc.)

        - `finderchart`: a base-64 encoded PNG image of the object's DSS2 RED
          finder chart. To convert this to an actual PNG, try the function:
          `astrobase.checkplot.pkl_io._b64_to_file`.

        - `magseries`: a base-64 encoded PNG image of the object's light
          curve. To convert this to an actual PNG, try the function:
          `astrobase.checkplot.pkl_io._b64_to_file`.

        - `pfmethods`: a list of period-finding methods applied to the object if
          any. If this list is present, use the keys in it to get to the actual
          period-finding results for each method. These will contain base-64
          encoded PNGs of the periodogram and phased light curves using the best
          three peaks in the periodogram, as well as period and epoch
          information.

    '''

    arg_3 = {
        'objectid':arg_1,
        'collection':arg_2
    }

    arg_4 = urlencode(arg_3)
    arg_5 = '%s/api/object?%s' % (arg_0, arg_4)

    try:

        LOGINFO(
            'getting info for %s in collection %s from %s' % (
                arg_1,
                arg_2,
                arg_0
            )
        )

        # check if we have an API key already
        arg_6, arg_7, arg_8 = check_existing_apikey(arg_0)

        # if not, get a new one
        if not arg_6:
            arg_7, arg_8 = get_new_apikey(arg_0)

        # if apikey is not None, add it in as an Authorization: Bearer [apikey]
        # header
        if arg_7:
            arg_9 = {'Authorization':'Bearer: %s' % arg_7}
        else:
            arg_9 = {}

        # hit the server
        arg_10 = Request(arg_5, data=None, arg_9=arg_9)
        arg_11 = urlopen(arg_10)
        arg_12 = json.loads(arg_11.read())['result']
        return arg_12

    except HTTPError as e:

        if e.code == 404:

            LOGERROR(
                'additional info for object %s not '
                'found in collection: %s' % (arg_1,
                                             arg_2)
            )

        else:

            LOGERROR('could not retrieve object info, '
                     'URL used: %s, error code: %s, reason: %s' %
                     (arg_5, e.code, e.reason))

        return None

This gets information on a single object from the LCC - Server .


Initialize all the uninitialized variables in the global scope.

def Func ( ) : arg_0 = set ( tf . global_variables ( ) ) - ALREADY_INITIALIZED get_session ( ) . run ( tf . variables_Funcr ( arg_0 ) ) ALREADY_INITIALIZED . update ( arg_0 )

def Func():
    """Initialize all the unFuncd variables in the global scope."""
    arg_0 = set(tf.global_variables()) - ALREADY_INITIALIZED
    get_session().run(tf.variables_Funcr(arg_0))
    ALREADY_INITIALIZED.update(arg_0)

Initialize all the uninitialized variables in the global scope .


def Func(arg_0, arg_1, arg_2):
        """ Finds a single run index given a particular condition on parameters.

        ONLY useful for a single run if ``v_full_copy` was set to ``True``.
        Otherwise a TypeError is thrown.

        :param name_list:

            A list of parameter names the predicate applies to, if you have only a single
            parameter name you can omit the list brackets.

        :param predicate:

            A lambda predicate for filtering that evaluates to either ``True`` or  ``False``

        :return: A generator yielding the matching single run indices

        Example:

        >>> predicate = lambda param1, param2: param1==4 and param2 in [1.0, 2.0]
        >>> iterator = traj.Func(['groupA.param1', 'groupA.param2'], predicate)
        >>> [x for x in iterator]
        [0, 2, 17, 36]

        """
        if arg_0._is_run and not arg_0.v_full_copy:
            raise TypeError('You cannot use this function during a multiprocessing signle run and '
                            'not having ``v_full_copy=True``.')
        if isinstance(arg_1, str):
            arg_1 = [arg_1]

        # First create a list of iterators, each over the range of the matched parameters
        arg_3 = []
        for arg_4 in arg_1:
            arg_5 = arg_0.f_get(arg_4)
            if not arg_5.v_is_parameter:
                raise TypeError('`%s` is not a parameter it is a %s, find idx is not applicable' %
                                (arg_4, str(type(arg_5))))

            if arg_5.f_has_range():
                arg_3.append(iter(arg_5.f_get_range(copy=False)))
            else:
                arg_3.append(itools.repeat(arg_5.f_get(), len(arg_0)))

        # Create a logical iterator returning `True` or `False`
        # whether the user's predicate matches the parameter data
        arg_6 = map(arg_2, *arg_3)

        # Now the run indices are the the indices where `logic_iter` evaluates to `True`
        for arg_7, arg_8 in enumerate(arg_6):
            if arg_8:
                yield arg_7

Finds a single run index given a particular condition on parameters.

        ONLY useful for a single run if ``v_full_copy` was set to ``True``.
        Otherwise a TypeError is thrown.

        :param name_list:

            A list of parameter names the predicate applies to, if you have only a single
            parameter name you can omit the list brackets.

        :param predicate:

            A lambda predicate for filtering that evaluates to either ``True`` or  ``False``

        :return: A generator yielding the matching single run indices

        Example:

        >>> predicate = lambda param1, param2: param1==4 and param2 in [1.0, 2.0]
        >>> iterator = traj.f_find_idx(['groupA.param1', 'groupA.param2'], predicate)
        >>> [x for x in iterator]
        [0, 2, 17, 36]

Finds a single run index given a particular condition on parameters .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_1
=
arg_1
.
lstrip
(
'/'
)
arg_3
=
'{}/{}'
.
format
(
arg_0
.
endpoint
,
arg_1
)
arg_4
=
requests
.
put
(
arg_3
,
data
=
str
(
arg_2
)
)
if
arg_4
.
status_code
!=
200
or
arg_4
.
json
(
)
is
not
True
:
raise
KVStoreError
(
'PUT returned {}'
.
format
(
arg_4
.
status_code
)
)

def Func(arg_0, arg_1, arg_2):
        """Add or update a key, value pair to the database"""
        arg_1 = arg_1.lstrip('/')
        arg_3 = '{}/{}'.format(arg_0.endpoint, arg_1)
        arg_4 = requests.put(arg_3, data=str(arg_2))
        if arg_4.status_code != 200 or arg_4.json() is not True:
            raise KVStoreError('PUT returned {}'.format(arg_4.status_code))

Add or update a key value pair to the database


def Func ( arg_0 , arg_1 = None ) : if arg_1 is not None : arg_0 . gppu = arg_1 arg_0 . _device . writeList ( arg_0 . GPPU , arg_0 . gppu )

def Func(arg_0, arg_1=None):
        """Write the specified byte value to the GPPU registor.  If no value
        specified the current buffered value will be written.
        """
        if arg_1 is not None:
            arg_0.gppu = arg_1
        arg_0._device.writeList(arg_0.GPPU, arg_0.gppu)

Write the specified byte value to the GPPU registor . If no value specified the current buffered value will be written .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
False
)
:
if
arg_1
.
jid
in
arg_0
.
_jids
:
if
arg_2
:
arg_0
.
remove_item
(
arg_1
.
jid
)
else
:
raise
ValueError
(
"JID already in the roster"
)
arg_3
=
len
(
arg_0
.
_items
)
arg_0
.
_items
.
append
(
arg_1
)
arg_0
.
_jids
[
arg_1
.
jid
]
=
arg_3

def Func(arg_0, arg_1, arg_2 = False):
        """
        Add an item to the roster.

        This will not automatically update the roster on the server.

        :Parameters:
            - `item`: the item to add
            - `replace`: if `True` then existing item will be replaced,
              otherwise a `ValueError` will be raised on conflict
        :Types:
            - `item`: `RosterItem`
            - `replace`: `bool`
        """
        if arg_1.jid in arg_0._jids:
            if arg_2:
                arg_0.remove_item(arg_1.jid)
            else:
                raise ValueError("JID already in the roster")
        arg_3 = len(arg_0._items)
        arg_0._items.append(arg_1)
        arg_0._jids[arg_1.jid] = arg_3


def Func ( arg_0 ) : arg_1 = NP_COMPONENT_DTYPE [ arg_0 . component_type . value ] arg_2 = numpy . frombuffer ( arg_0 . buffer . read ( byte_length = arg_0 . byte_length , byte_offset = arg_0 . byte_offset ) , count = arg_0 . count * arg_0 . components , arg_1 = arg_1 , ) return arg_1 , arg_2

def Func(arg_0):
        """Create the VBO"""
        arg_1 = NP_COMPONENT_DTYPE[arg_0.component_type.value]
        arg_2 = numpy.frombuffer(
            arg_0.buffer.read(byte_length=arg_0.byte_length, byte_offset=arg_0.byte_offset),
            count=arg_0.count * arg_0.components,
            arg_1=arg_1,
        )
        return arg_1, arg_2


def Func(arg_0, arg_1=0):
    "Return a count of the number of frames"
    arg_2 = -arg_1
    while arg_0:
        arg_2 += 1
        arg_0 = arg_0.f_back
    return arg_2


return format_html(
        '<link rel="stylesheet" href="{static}djfrontend/css/jquery/jquery.dataTables/{v}/jquery.dataTables{min}.css">',
        static=_static_url, v=version, min=_min)

def Func(arg_0=None):
    """
    Returns the jQuery DataTables CSS file according to version number.
    """
    if arg_0 is None:
        if not getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_CSS', False):
            arg_0 = getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_VERSION', DJFRONTEND_JQUERY_DATATABLES_VERSION_DEFAULT)
        else:
            arg_0 = getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_CSS', DJFRONTEND_JQUERY_DATATABLES_VERSION_DEFAULT)

    return format_html(
        '<link rel="stylesheet" href="{static}djfrontend/css/jquery/jquery.dataTables/{v}/jquery.dataTables{min}.css">',
        static=_static_url, v=arg_0, min=_min)

Returns the jQuery DataTables CSS file according to version number .


Return the contents of a data file of ours.

def Func ( arg_0 ) : arg_1 = open ( Func_filename ( arg_0 ) ) try : return arg_1 . read ( ) finally : arg_1 . close ( )

def Func(arg_0):
    """Return the contents of a Func file of ours."""
    arg_1 = open(Func_filename(arg_0))
    try:
        return arg_1.read()
    finally:
        arg_1.close()

Return the contents of a data file of ours .


def Func ( arg_0 ) : if arg_0 . all is not None : return arg_0 . name in arg_0 . all else : return not arg_0 . name . startswith ( "_" )

def Func(arg_0):
        """Return True iff this function should be considered public."""
        if arg_0.all is not None:
            return arg_0.name in arg_0.all
        else:
            return not arg_0.name.startswith("_")

Return True iff this function should be considered public .


def Func(arg_0, arg_1):
        """Read a list of config files.

        :param iterable files: An iterable (e.g. list) of files to read.
        """
        arg_2 = {}
        for arg_3 in arg_1:
            arg_4, arg_5 = arg_0.read_config_file(arg_3)
            arg_0.update(arg_4)
            if arg_5 is not True:
                arg_2[arg_3] = arg_5
        return arg_2 or True


def Func ( arg_0 ) : for arg_1 , arg_2 in ElementTree . iterparse ( arg_0 . source ) : if arg_2 . tag == arg_0 . item_tag_name : yield arg_2 arg_2 . clear ( )

def Func(arg_0):
        """
        Iterator of the list of items in the XML source.
        """
        # Use `iterparse`, it's more efficient, specially for big files
        for arg_1, arg_2 in ElementTree.iterparse(arg_0.source):
            if arg_2.tag == arg_0.item_tag_name:
                yield arg_2
                # Releases the item from memory
                arg_2.clear()

Iterator of the list of items in the XML source .


def Func ( arg_0 , arg_1 ) : arg_2 = urijoin ( "pulls" , str ( arg_1 ) , "requested_reviewers" ) return arg_0 . fetch_items ( arg_2 , { } )

def Func(arg_0, arg_1):
        """Get pull requested reviewers"""

        arg_2 = urijoin("pulls", str(arg_1), "requested_reviewers")
        return arg_0.fetch_items(arg_2, {})


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : for arg_3 , arg_4 in arg_0 . properties [ : ] : if ( arg_1 is None or arg_1 == arg_3 ) and ( arg_2 is None or arg_2 == arg_4 ) : del ( arg_0 . properties [ arg_0 . properties . index ( ( arg_3 , arg_4 ) ) ] )

def Func(arg_0, arg_1=None, arg_2=None):
        """Remove all properties matching both key and value.

        :param str key: Key of the property.
        :param str value: Value of the property.
        """
        for arg_3, arg_4 in arg_0.properties[:]:
            if (arg_1 is None or arg_1 == arg_3) and (arg_2 is None or arg_2 == arg_4):
                del(arg_0.properties[arg_0.properties.index((arg_3, arg_4))])

Remove all properties matching both key and value .


def Func ( arg_0 , arg_1 , arg_2 = None ) : try : arg_3 = int ( arg_0 . exec_command ( 'main' , 'volume' , arg_1 , arg_2 ) ) return arg_3 except ( ValueError , TypeError ) : pass return None

def Func(arg_0, arg_1, arg_2=None):
        """
        Execute Main.Volume.

        Returns int
        """
        try:
            arg_3 = int(arg_0.exec_command('main', 'volume', arg_1, arg_2))
            return arg_3

        except (ValueError, TypeError):
            pass

        return None

Execute Main.Volume.

        Returns int


def Func ( arg_0 ) : if "float" in str ( type ( arg_0 [ 0 ] ) ) : arg_1 = { } for arg_2 in range ( len ( arg_0 ) ) : arg_1 [ arg_0 . dtype . names [ arg_2 ] ] = arg_0 [ arg_2 ] return arg_1 arg_5 = [ ] for arg_6 in range ( len ( arg_0 ) ) : arg_1 = { } for arg_2 in range ( len ( arg_0 [ arg_6 ] ) ) : arg_1 [ arg_0 . dtype . names [ arg_2 ] ] = arg_0 [ arg_6 ] [ arg_2 ] arg_5 . append ( arg_1 ) return arg_5

def Func(arg_0):
    """given a recarray, return it as a list of dicts."""

    # 1D array
    if "float" in str(type(arg_0[0])):
        arg_1={}
        for arg_2 in range(len(arg_0)):
            arg_1[arg_0.dtype.names[arg_2]]=arg_0[arg_2]
        return arg_1

    # 2D array
    arg_5=[]
    for arg_6 in range(len(arg_0)):
        arg_1={}
        for arg_2 in range(len(arg_0[arg_6])):
            arg_1[arg_0.dtype.names[arg_2]]=arg_0[arg_6][arg_2]
        arg_5.append(arg_1)
    return arg_5

given a recarray return it as a list of dicts .


def Func(arg_0, arg_1, arg_2=None):
        """
        Runs the Dango Func management command.

        By default, runs on only the current site.

        Pass site=all to run on all sites.
        """
        arg_2 = arg_2 or arg_0.genv.SITE
        arg_3 = arg_0.local_renderer
        arg_3.env._Func_path = arg_1
        for arg_6, arg_7 in arg_0.iter_sites(arg_2=arg_2, no_secure=True):
            try:
                arg_0.set_db(arg_2=arg_6)
                arg_3.env.SITE = arg_6
                arg_3.sudo('export SITE={SITE}; export ROLE={ROLE}; '
                    'cd {project_dir}; '
                    '{manage_cmd} Func {_Func_path}')
            except KeyError:
                pass

Runs the Dango loaddata management command.

        By default, runs on only the current site.

        Pass site=all to run on all sites.

Runs the Dango loaddata management command .


def Func(arg_0, arg_1, arg_2):
        """Collect all open and closed clinvar submission created by a user for an institute

            Args:
                user_id(str): a user ID
                institute_id(str): an institute ID

            Returns:
                submissions(list): a list of clinvar submission objects
        """
        LOG.info("Retrieving all clinvar submissions for user '%s', institute '%s'", arg_1, arg_2)
        # get first all submission objects
        arg_3 = dict(arg_1=arg_1, arg_2=arg_2)
        arg_4 = list(arg_0.clinvar_submission_collection.find(arg_3))

        arg_5 = []
        for arg_6 in arg_4:
            arg_7 = {}
            arg_7['_id'] =  arg_6.get('_id')
            arg_7['status'] = arg_6.get('status')
            arg_7['user_id'] = arg_6.get('user_id')
            arg_7['institute_id'] = arg_6.get('institute_id')
            arg_7['created_at'] = arg_6.get('created_at')
            arg_7['updated_at'] = arg_6.get('updated_at')

            if 'clinvar_subm_id' in arg_6:
                arg_7['clinvar_subm_id'] = arg_6['clinvar_subm_id']

            if arg_6.get('variant_data'):
                arg_7['variant_data'] = arg_0.clinvar_collection.find({'_id': { "$in": arg_6['variant_data'] } })
            if arg_6.get('case_data'):
                arg_7['case_data'] = arg_0.clinvar_collection.find({'_id' : { "$in": arg_6['case_data'] } })

            arg_5.append(arg_7)

        return arg_5


def Func ( arg_0 , arg_1 ) : return arg_1 from imp import find_module , get_suffixes from glob import glob arg_2 = [ ] arg_3 = dict . fromkeys ( arg_1 . _get_metadata ( 'top_level.txt' ) ) arg_4 = { '.pyc' : 1 , '.pyo' : 1 } for arg_5 , arg_6 , arg_7 in get_suffixes ( ) : arg_4 [ arg_5 ] = 1 for arg_8 , arg_9 in expand_paths ( [ arg_0 . install_dir ] + arg_0 . all_site_dirs ) : for arg_10 in arg_9 : arg_11 , arg_5 = os . path . splitext ( arg_10 ) if arg_11 in arg_3 : if not arg_5 : try : arg_12 , arg_10 , arg_13 = find_module ( arg_11 , [ arg_8 ] ) except ImportError : continue else : if arg_12 : arg_12 . close ( ) if arg_10 not in arg_2 : arg_2 . append ( arg_10 ) elif arg_5 in arg_4 and arg_11 != 'site' : arg_2 . append ( os . path . join ( arg_8 , arg_10 ) ) if arg_2 : arg_0 . found_conflicts ( arg_1 , arg_2 ) return arg_1

def Func(arg_0, arg_1):
        """Verify that there are no conflicting "old-style" packages"""

        return arg_1     # XXX temporarily disable until new strategy is stable
        from imp import find_module, get_suffixes
        from glob import glob

        arg_2 = []
        arg_3 = dict.fromkeys(arg_1._get_metadata('top_level.txt')) # XXX private attr

        arg_4 = {'.pyc':1, '.pyo':1}     # get_suffixes() might leave one out
        for arg_5,arg_6,arg_7 in get_suffixes():
            arg_4[arg_5] = 1

        for arg_8,arg_9 in expand_paths([arg_0.install_dir]+arg_0.all_site_dirs):
            for arg_10 in arg_9:
                arg_11,arg_5 = os.path.splitext(arg_10)
                if arg_11 in arg_3:
                    if not arg_5:
                        # no extension, check for package
                        try:
                            arg_12, arg_10, arg_13 = find_module(arg_11, [arg_8])
                        except ImportError:
                            continue
                        else:
                            if arg_12: arg_12.close()
                            if arg_10 not in arg_2:
                                arg_2.append(arg_10)
                    elif arg_5 in arg_4 and arg_11!='site':  # XXX ugh
                        arg_2.append(os.path.join(arg_8,arg_10))
        if arg_2:
            arg_0.found_conflicts(arg_1, arg_2)

        return arg_1

Verify that there are no conflicting old - style packages


def Func ( arg_0 ) : arg_0 = os . path . normpath ( arg_0 ) if arg_0 . startswith ( os . path . sep ) : return arg_0 [ 1 : ] else : return arg_0

def Func(arg_0):
    """Normalize `path`.

    All remote paths are absolute.
    """
    arg_0 = os.path.normpath(arg_0)
    if arg_0.startswith(os.path.sep):
        return arg_0[1:]
    else:
        return arg_0


def Func ( arg_0 ) : from invenio_communities . models import FeaturedCommunity arg_1 = FeaturedCommunity ( id = arg_0 [ 'id' ] , id_community = arg_0 [ 'id_community' ] , start_date = iso2dt ( arg_0 [ 'start_date' ] ) ) db . session . add ( arg_1 ) db . session . commit ( )

def Func(arg_0):
    """Load community featuring from data dump.

    :param data: Dictionary containing community featuring data.
    :type data: dict
    """
    from invenio_communities.models import FeaturedCommunity
    arg_1 = FeaturedCommunity(id=arg_0['id'],
                            id_community=arg_0['id_community'],
                            start_date=iso2dt(arg_0['start_date']))
    db.session.add(arg_1)
    db.session.commit()

Load community featuring from data dump .


return self.get_courses_in_account(
            self._sis_id(sis_account_id, sis_field="account"), params)

def Func ( arg_0 , arg_1 , arg_2 = { } ) : return arg_0 . get_courses_in_account ( arg_0 . _sis_id ( arg_1 , sis_field = "account" ) , arg_2 )

def Func(arg_0, arg_1, arg_2={}):
        """
        Return a list of courses for the passed account SIS ID.
        """
        return arg_0.get_courses_in_account(
            arg_0._sis_id(arg_1, sis_field="account"), arg_2)

Return a list of courses for the passed account SIS ID .


def Func(arg_0, arg_1, arg_2):
        """Write the sources to a Func.

        Inputs:

        - line_mod: possibly modified input, such as the transformations made
        by input prefilters or input handlers of various kinds.  This should
        always be valid Python.

        - line_ori: unmodified input line from the user.  This is not
        necessarily valid Python.
        """

        # Write the Func line, but decide which one according to the
        # Func_raw_input flag, set when the Func is started.
        if arg_0.Func_raw_input:
            arg_0.Func_write(arg_2)
        else:
            arg_0.Func_write(arg_1)

Write the sources to a log.

        Inputs:

        - line_mod: possibly modified input, such as the transformations made
        by input prefilters or input handlers of various kinds.  This should
        always be valid Python.

        - line_ori: unmodified input line from the user.  This is not
        necessarily valid Python.


return [serializers.serialize_organization_with_course(organization) for organization in queryset]

def Func ( arg_0 ) : arg_1 = internal . OrganizationCourse . objects . filter ( course_id = text_type ( arg_0 ) , active = True ) . select_related ( 'organization' ) return [ serializers . serialize_organization_with_course ( arg_2 ) for arg_2 in arg_1 ]

def Func(arg_0):
    """
    Retrieves the organizations linked to the specified course
    """
    arg_1 = internal.OrganizationCourse.objects.filter(
        course_id=text_type(arg_0),
        active=True
    ).select_related('organization')
    return [serializers.serialize_organization_with_course(arg_2) for arg_2 in arg_1]


def Func(arg_0, arg_1=None):
    """Compose link to Beacon Network."""
    arg_1 = arg_1 or 37
    arg_2 = ("https://beacon-network.org/#/search?pos={this[position]}&"
                    "chrom={this[chromosome]}&allele={this[alternative]}&"
                    "ref={this[reference]}&rs=GRCh37")
    # beacon does not support build 38 at the moment
    # if build == '38':
    #     url_template = ("https://beacon-network.org/#/search?pos={this[position]}&"
    #                     "chrom={this[chromosome]}&allele={this[alternative]}&"
    #                     "ref={this[reference]}&rs=GRCh38")

    return arg_2.format(this=arg_0)


def
Func
(
arg_0
,
arg_1
=
)
:
with
nested
(
arg_0
.
builtin_trap
,
arg_0
.
display_trap
)
:
while
1
:
try
:
arg_0
.
interact
(
arg_1
=
arg_1
)
break
except
KeyboardInterrupt
:
arg_0
.
write
(
"\nKeyboardInterrupt in interact()\n"
)

def Func(arg_0, arg_1=None):
        """Start the Func.

        If an optional banner argument is given, it will override the
        internally created default banner.
        """

        with nested(arg_0.builtin_trap, arg_0.display_trap):

            while 1:
                try:
                    arg_0.interact(arg_1=arg_1)
                    #self.interact_with_readline()
                    # XXX for testing of a readline-decoupled repl loop, call
                    # interact_with_readline above
                    break
                except KeyboardInterrupt:
                    # this should not be necessary, but KeyboardInterrupt
                    # handling seems rather unpredictable...
                    arg_0.write("\nKeyboardInterrupt in interact()\n")

Start the mainloop.

        If an optional banner argument is given, it will override the
        internally created default banner.


(x,
           layer_fn=tf.compat.v1.layers.dense,
           loc_fn=lambda x: x,
           scale_fn=1.,
           name=None)

def Func(arg_0,
           arg_1=arg_2.compat.v1.layers.dense,
           arg_7=lambda arg_0: arg_0,
           arg_8=1.,
           arg_9=None):
  """Constructs a trainable `tfd.Normal` distribution.

  This function creates a Normal distribution parameterized by loc and scale.
  Using default args, this function is mathematically equivalent to:

  ```none
  Y = Normal(loc=matmul(W, x) + b, scale=1)

  where,
    W in R^[d, n]
    b in R^d
  ```

  #### Examples

  This function can be used as a [linear regression](
  https://en.wikipedia.org/wiki/Linear_regression) loss.

  ```python
  # This example fits a linear regression loss.
  import tensorflow as tf
  import tensorflow_probability as tfp

  # Create fictitious training data.
  dtype = np.float32
  n = 3000    # number of samples
  x_size = 4  # size of single x
  def make_training_data():
    np.random.seed(142)
    x = np.random.randn(n, x_size).astype(dtype)
    w = np.random.randn(x_size).astype(dtype)
    b = np.random.randn(1).astype(dtype)
    true_mean = np.tensordot(x, w, axes=[[-1], [-1]]) + b
    noise = np.random.randn(n).astype(dtype)
    y = true_mean + noise
    return y, x
  y, x = make_training_data()

  # Build TF graph for fitting Normal maximum likelihood estimator.
  Func = tfp.trainable_distributions.Func(x)
  loss = -tf.reduce_mean(Func.log_prob(y))
  train_op = tf.train.AdamOptimizer(learning_rate=2.**-5).minimize(loss)
  mse = tf.reduce_mean(tf.squared_difference(y, Func.mean()))
  init_op = tf.global_variables_initializer()

  # Run graph 1000 times.
  num_steps = 1000
  loss_ = np.zeros(num_steps)   # Style: `_` to indicate sess.run result.
  mse_ = np.zeros(num_steps)
  with tf.Session() as sess:
    sess.run(init_op)
    for it in xrange(loss_.size):
      _, loss_[it], mse_[it] = sess.run([train_op, loss, mse])
      if it % 200 == 0 or it == loss_.size - 1:
        print("iteration:{}  loss:{}  mse:{}".format(it, loss_[it], mse_[it]))

  # ==> iteration:0    loss:6.34114170074  mse:10.8444051743
  #     iteration:200  loss:1.40146839619  mse:0.965059816837
  #     iteration:400  loss:1.40052902699  mse:0.963181257248
  #     iteration:600  loss:1.40052902699  mse:0.963181257248
  #     iteration:800  loss:1.40052902699  mse:0.963181257248
  #     iteration:999  loss:1.40052902699  mse:0.963181257248
  ```

  Args:
    x: `Tensor` with floating type. Must have statically defined rank and
      statically known right-most dimension.
    layer_fn: Python `callable` which takes input `x` and `int` scalar `d` and
      returns a transformation of `x` with shape
      `tf.concat([tf.shape(x)[:-1], [1]], axis=0)`.
      Default value: `tf.layers.dense`.
    loc_fn: Python `callable` which transforms the `loc` parameter. Takes a
      (batch of) length-`dims` vectors and returns a `Tensor` of same shape and
      `dtype`.
      Default value: `lambda x: x`.
    scale_fn: Python `callable` or `Tensor`. If a `callable` transforms the
      `scale` parameters; if `Tensor` is the `tfd.Normal` `scale` argument.
      Takes a (batch of) length-`dims` vectors and returns a `Tensor` of same
      size. (Taking a `callable` or `Tensor` is how `tf.Variable` intializers
      behave.)
      Default value: `1`.
    name: A `name_scope` name for operations created by this function.
      Default value: `None` (i.e., "Func").

  Returns:
    Func: An instance of `tfd.Normal`.
  """
  with arg_2.compat.v1.name_scope(arg_9, 'Func', [arg_0]):
    arg_0 = arg_2.convert_to_tensor(value=arg_0, arg_9='x')
    if callable(arg_8):
      arg_10 = arg_1(arg_0, 2)
      arg_11 = arg_7(arg_10[..., 0])
      arg_12 = arg_8(arg_10[..., 1])
    else:
      arg_10 = arg_2.squeeze(arg_1(arg_0, 1), axis=-1)
      arg_11 = arg_7(arg_10)
      arg_12 = arg_2.cast(arg_8, arg_11.dtype.base_dtype)
    return tfd.Normal(arg_11=arg_11, arg_12=arg_12)

Constructs a trainable `tfd.Normal` distribution.

  This function creates a Normal distribution parameterized by loc and scale.
  Using default args, this function is mathematically equivalent to:

  ```none
  Y = Normal(loc=matmul(W, x) + b, scale=1)

  where,
    W in R^[d, n]
    b in R^d
  ```

  #### Examples

  This function can be used as a [linear regression](
  https://en.wikipedia.org/wiki/Linear_regression) loss.

  ```python
  # This example fits a linear regression loss.
  import tensorflow as tf
  import tensorflow_probability as tfp

  # Create fictitious training data.
  dtype = np.float32
  n = 3000    # number of samples
  x_size = 4  # size of single x
  def make_training_data():
    np.random.seed(142)
    x = np.random.randn(n, x_size).astype(dtype)
    w = np.random.randn(x_size).astype(dtype)
    b = np.random.randn(1).astype(dtype)
    true_mean = np.tensordot(x, w, axes=[[-1], [-1]]) + b
    noise = np.random.randn(n).astype(dtype)
    y = true_mean + noise
    return y, x
  y, x = make_training_data()

  # Build TF graph for fitting Normal maximum likelihood estimator.
  normal = tfp.trainable_distributions.normal(x)
  loss = -tf.reduce_mean(normal.log_prob(y))
  train_op = tf.train.AdamOptimizer(learning_rate=2.**-5).minimize(loss)
  mse = tf.reduce_mean(tf.squared_difference(y, normal.mean()))
  init_op = tf.global_variables_initializer()

  # Run graph 1000 times.
  num_steps = 1000
  loss_ = np.zeros(num_steps)   # Style: `_` to indicate sess.run result.
  mse_ = np.zeros(num_steps)
  with tf.Session() as sess:
    sess.run(init_op)
    for it in xrange(loss_.size):
      _, loss_[it], mse_[it] = sess.run([train_op, loss, mse])
      if it % 200 == 0 or it == loss_.size - 1:
        print("iteration:{}  loss:{}  mse:{}".format(it, loss_[it], mse_[it]))

  # ==> iteration:0    loss:6.34114170074  mse:10.8444051743
  #     iteration:200  loss:1.40146839619  mse:0.965059816837
  #     iteration:400  loss:1.40052902699  mse:0.963181257248
  #     iteration:600  loss:1.40052902699  mse:0.963181257248
  #     iteration:800  loss:1.40052902699  mse:0.963181257248
  #     iteration:999  loss:1.40052902699  mse:0.963181257248
  ```

  Args:
    x: `Tensor` with floating type. Must have statically defined rank and
      statically known right-most dimension.
    layer_fn: Python `callable` which takes input `x` and `int` scalar `d` and
      returns a transformation of `x` with shape
      `tf.concat([tf.shape(x)[:-1], [1]], axis=0)`.
      Default value: `tf.layers.dense`.
    loc_fn: Python `callable` which transforms the `loc` parameter. Takes a
      (batch of) length-`dims` vectors and returns a `Tensor` of same shape and
      `dtype`.
      Default value: `lambda x: x`.
    scale_fn: Python `callable` or `Tensor`. If a `callable` transforms the
      `scale` parameters; if `Tensor` is the `tfd.Normal` `scale` argument.
      Takes a (batch of) length-`dims` vectors and returns a `Tensor` of same
      size. (Taking a `callable` or `Tensor` is how `tf.Variable` intializers
      behave.)
      Default value: `1`.
    name: A `name_scope` name for operations created by this function.
      Default value: `None` (i.e., "normal").

  Returns:
    normal: An instance of `tfd.Normal`.

Constructs a trainable tfd . Normal distribution .


def Func(arg_0, arg_1):
    """
    Return the current course run on the following conditions.

    - If user has active course runs (already enrolled) then return course run with closest start date
    Otherwise it will check the following logic:
    - Course run is enrollable (see is_course_run_enrollable)
    - Course run has a verified seat and the upgrade deadline has not expired.
    - Course run start date is closer to now than any other enrollable/upgradeable course runs.
    - If no enrollable/upgradeable course runs, return course run with most recent start date.
    """
    arg_2 = None
    arg_3 = []
    arg_4 = arg_0['course_runs']

    if arg_1:
        arg_2 = get_closest_course_run(arg_1)
    else:
        for arg_5 in arg_4:
            if is_course_run_enrollable(arg_5) and is_course_run_upgradeable(arg_5):
                arg_3.append(arg_5)

        if not arg_3:
            # Consider all runs if there were not any enrollable/upgradeable ones.
            arg_3 = arg_4

        if arg_3:
            arg_2 = get_closest_course_run(arg_3)
    return arg_2

Return the current course run on the following conditions .


def Func ( arg_0 , arg_1 ) : if arg_1 and arg_0 . checker . is_url_valid ( arg_1 ) : arg_2 = arg_1 . split ( "/" ) [ - 1 ] if ( not arg_3 . path . isfile ( arg_2 ) or arg_3 . INTERN [ "counter" ] [ "number" ] [ "tested" ] == 0 ) : Download ( arg_1 , arg_2 ) . text ( ) arg_3 . INTERN [ "file_to_test" ] = arg_2 return True return False

def Func(arg_0, arg_1):
        """
        Check if the given information is a URL.
        If it is the case, it download and update the location of file to test.

        :param passed: The url passed to the system.
        :type passed: str

        :return: The state of the check.
        :rtype: bool
        """

        if arg_1 and arg_0.checker.is_url_valid(arg_1):
            # The passed string is an URL.

            # We get the file name based on the URL.
            # We actually just get the  string after the last `/` in the URL.
            arg_2 = arg_1.split("/")[-1]

            if (
                not arg_3.path.isfile(arg_2)
                or arg_3.INTERN["counter"]["number"]["tested"] == 0
            ):
                # The filename does not exist in the current directory
                # or the currently number of tested is equal to 0.

                # We download the content of the link.
                Download(arg_1, arg_2).text()

            # The files does exist or the currently number of tested is greater than
            # 0.

            # We initiate the file we have to test.
            arg_3.INTERN["file_to_test"] = arg_2

            # We return true to say that everything goes right.
            return True

        # The passed string is not an URL.

        # We do not need to do anything else.
        return False

Check if the given information is a URL . If it is the case it download and update the location of file to test .


def Func(arg_0, arg_1):
    """Scans through a string for substrings matched some patterns.

    Args:
        text: A string to be scanned.
        patterns: a list of regex pattern.

    Returns:
        a list if matched. empty if not.
    """

    arg_2 = []
    for arg_3 in arg_1:
        arg_4 = re.findall(arg_3, arg_0)
        arg_2 += arg_4

    return arg_2

Scans through a string for substrings matched some patterns .


def
Func
(
arg_0
)
:
arg_1
=
copy
.
copy
(
arg_0
.
streams
[
0
]
)
arg_1
.
stat_log
=
arg_0
.
stat_log
arg_1
.
steps
=
[
]
arg_1
.
ammo_file
=
''
arg_1
.
rps_schedule
=
arg_1
.
ammo_count
=
0
arg_1
.
duration
=
0
arg_1
.
instances
=
0
arg_1
.
loadscheme
=
[
]
arg_1
.
loop_count
=
0
for
arg_11
in
arg_0
.
streams
:
arg_12
=
0
logger
.
debug
(
"Steps: %s"
,
arg_11
.
stepper_wrapper
.
steps
)
for
arg_13
in
arg_11
.
stepper_wrapper
.
steps
:
for
arg_14
in
range
(
0
,
arg_13
[
1
]
)
:
if
len
(
arg_1
.
steps
)
>
arg_12
:
arg_1
.
steps
[
arg_12
]
[
0
]
+=
arg_13
[
0
]
else
:
arg_1
.
steps
.
append
(
[
arg_13
[
0
]
,
1
]
)
arg_12
+=
1
if
arg_1
.
rps_schedule
:
arg_1
.
rps_schedule
=
[
]
else
:
arg_1
.
rps_schedule
=
arg_11
.
stepper_wrapper
.
loadscheme
if
arg_1
.
loadscheme
:
arg_1
.
loadscheme
=
''
else
:
arg_1
.
loadscheme
=
''
if
arg_1
.
loop_count
:
arg_1
.
loop_count
=
u'0'
else
:
arg_1
.
loop_count
=
arg_11
.
stepper_wrapper
.
loop_count
arg_1
.
ammo_file
+=
'{} '
.
format
(
arg_11
.
stepper_wrapper
.
ammo_file
)
arg_1
.
ammo_count
+=
arg_11
.
stepper_wrapper
.
ammo_count
arg_1
.
duration
=
max
(
arg_1
.
duration
,
arg_11
.
stepper_wrapper
.
duration
)
arg_1
.
instances
+=
arg_11
.
instances
if
not
arg_1
.
ammo_count
:
raise
ValueError
(
"Total ammo count cannot be zero"
)
return
arg_1

def Func(arg_0):
        """ get merged info about phantom conf """
        arg_1 = copy.copy(arg_0.streams[0])
        arg_1.stat_log = arg_0.stat_log
        arg_1.steps = []
        arg_1.ammo_file = ''
        arg_1.rps_schedule = None
        arg_1.ammo_count = 0
        arg_1.duration = 0

        arg_1.instances = 0
        arg_1.loadscheme = []
        arg_1.loop_count = 0

        for arg_11 in arg_0.streams:
            arg_12 = 0
            logger.debug("Steps: %s", arg_11.stepper_wrapper.steps)
            for arg_13 in arg_11.stepper_wrapper.steps:
                for arg_14 in range(0, arg_13[1]):
                    if len(arg_1.steps) > arg_12:
                        arg_1.steps[arg_12][0] += arg_13[0]
                    else:
                        arg_1.steps.append([arg_13[0], 1])
                    arg_12 += 1

            if arg_1.rps_schedule:
                arg_1.rps_schedule = []
            else:
                arg_1.rps_schedule = arg_11.stepper_wrapper.loadscheme
            if arg_1.loadscheme:
                arg_1.loadscheme = ''
            else:
                # FIXME: add formatted load scheme for server:
                # <step_size,step_type,first_rps,last_rps,original_step_params>
                # as a string
                arg_1.loadscheme = ''

            if arg_1.loop_count:
                arg_1.loop_count = u'0'
            else:
                arg_1.loop_count = arg_11.stepper_wrapper.loop_count

            arg_1.ammo_file += '{} '.format(arg_11.stepper_wrapper.ammo_file)
            arg_1.ammo_count += arg_11.stepper_wrapper.ammo_count
            arg_1.duration = max(
                arg_1.duration, arg_11.stepper_wrapper.duration)
            arg_1.instances += arg_11.instances

        if not arg_1.ammo_count:
            raise ValueError("Total ammo count cannot be zero")
        return arg_1


def Func(arg_0, arg_1: arg_2) -> str:
        """
        Give the waterfall step a unique name
        """
        arg_3 = arg_0._steps[arg_1].__qualname__

        if not arg_3 or ">" in arg_3 :
            arg_3 = f"Step{index + 1}of{len(self._steps)}"

        return arg_3


def Func ( arg_0 , arg_1 ) : arg_0 . objective = arg_0 . solver . interface . Objective ( Zero , direction = "min" , sloppy = True ) arg_3 = [ ] for arg_4 in arg_0 . reactions : arg_5 = arg_1 [ arg_4 . id ] if arg_4 . boundary : arg_4 . bounds = ( arg_5 , arg_5 ) continue if arg_5 >= 0 : arg_4 . bounds = max ( 0 , arg_4 . lower_bound ) , max ( arg_5 , arg_4 . upper_bound ) arg_3 . append ( arg_4 . forward_variable ) else : arg_4 . bounds = min ( arg_5 , arg_4 . lower_bound ) , min ( 0 , arg_4 . upper_bound ) arg_3 . append ( arg_4 . reverse_variable ) arg_0 . objective . set_linear_coefficients ( { arg_7 : 1.0 for arg_7 in arg_3 } )

def Func(arg_0, arg_1):
    """Add constraints for CycleFreeFlux."""
    arg_0.objective = arg_0.solver.interface.Objective(
        Zero, direction="min", sloppy=True)
    arg_3 = []
    for arg_4 in arg_0.reactions:
        arg_5 = arg_1[arg_4.id]
        if arg_4.boundary:
            arg_4.bounds = (arg_5, arg_5)
            continue
        if arg_5 >= 0:
            arg_4.bounds = max(0, arg_4.lower_bound), max(arg_5, arg_4.upper_bound)
            arg_3.append(arg_4.forward_variable)
        else:
            arg_4.bounds = min(arg_5, arg_4.lower_bound), min(0, arg_4.upper_bound)
            arg_3.append(arg_4.reverse_variable)

    arg_0.objective.set_linear_coefficients({arg_7: 1.0 for arg_7 in arg_3})


def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : arg_1 = html . html_parser . makeelement arg_2 = _Func ( arg_0 , arg_1 ) arg_3 = arg_2 . getchildren ( ) for arg_4 in arg_3 : arg_2 . remove ( arg_4 ) return arg_3

def Func(arg_0, arg_1=None):
    """Convert a BeautifulSoup tree to a list of Element trees.

    Returns a list instead of a single root Element to support
    HTML-like soup with more than one root element.

    You can pass a different Element factory through the `makeelement`
    keyword.
    """
    if arg_1 is None:
        arg_1 = html.html_parser.makeelement
    arg_2 = _Func(arg_0, arg_1)
    arg_3 = arg_2.getchildren()
    for arg_4 in arg_3:
        arg_2.remove(arg_4)
    return arg_3

Convert a BeautifulSoup tree to a list of Element trees .


def Func ( arg_0 ) : try : arg_1 = ipaddress . ip_address ( u'' + arg_0 ) return True except ValueError as e : return False

def Func(arg_0):
    """ Check Validity of an IP address """

    try:
        arg_1 = ipaddress.ip_address(u'' + arg_0)
        return True
    except ValueError as e:
        return False


return X if self.return_df else X.values

def Func(arg_0, arg_1):
        """
        Perform the inverse transformation to encoded data. Will attempt best case reconstruction, which means
        it will return nan for handle_missing and handle_unknown settings that break the bijection. We issue
        warnings when some of those cases occur.

        Parameters
        ----------
        X_in : array-like, shape = [n_samples, n_features]

        Returns
        -------
        p: array, the same size of X_in

        """
        arg_2 = arg_1.copy(deep=True)

        # first check the type
        arg_2 = util.convert_input(arg_2)

        if arg_0._dim is None:
            raise ValueError(
                'Must train encoder before it can be used to Func data')

        # then make sure that it is the right size
        if arg_2.shape[1] != arg_0._dim:
            if arg_0.drop_invariant:
                raise ValueError("Unexpected input dimension %d, the attribute drop_invariant should "
                                 "set as False when transform data" % (arg_2.shape[1],))
            else:
                raise ValueError('Unexpected input dimension %d, expected %d' % (arg_2.shape[1], arg_0._dim,))

        if not arg_0.cols:
            return arg_2 if arg_0.return_df else arg_2.values

        if arg_0.handle_unknown == 'value':
            for arg_3 in arg_0.cols:
                if any(arg_2[arg_3] == -1):
                    warnings.warn("Func is not supported because transform impute "
                                  "the unknown category -1 when encode %s" % (arg_3,))

        if arg_0.handle_unknown == 'return_nan' and arg_0.handle_missing == 'return_nan':
            for arg_3 in arg_0.cols:
                if arg_2[arg_3].isnull().any():
                    warnings.warn("Func is not supported because transform impute "
                                  "the unknown category nan when encode %s" % (arg_3,))

        for arg_4 in arg_0.mapping:
            arg_5 = arg_4.get('mapping')
            arg_6 = pd.Series(data=arg_5.index, index=arg_5.get_values())
            arg_2[arg_4.get('col')] = arg_2[arg_4.get('col')].map(arg_6).astype(arg_4.get('data_type'))

        return arg_2 if arg_0.return_df else arg_2.values

Perform the inverse transformation to encoded data . Will attempt best case reconstruction which means it will return nan for handle_missing and handle_unknown settings that break the bijection . We issue warnings when some of those cases occur .


def Func ( arg_0 ) : arg_0 . _run_startup_files ( ) arg_0 . _run_exec_lines ( ) arg_0 . _run_exec_files ( ) arg_0 . _run_cmd_line_code ( ) arg_0 . _run_module ( ) sys . stdout . flush ( ) sys . stderr . flush ( ) arg_0 . shell . user_ns_hidden . update ( arg_0 . shell . user_ns )

def Func(arg_0):
        """run the pre-flight code, specified via exec_lines"""
        arg_0._run_startup_files()
        arg_0._run_exec_lines()
        arg_0._run_exec_files()
        arg_0._run_cmd_line_code()
        arg_0._run_module()

        # flush output, so itwon't be attached to the first cell
        sys.stdout.flush()
        sys.stderr.flush()

        # Hide variables defined here from %who etc.
        arg_0.shell.user_ns_hidden.update(arg_0.shell.user_ns)

run the pre - flight code specified via exec_lines


def Func ( arg_0 , arg_1 = True ) : arg_2 = custom_prompt ( arg_0 , [ "y" , "n" ] , "y" if arg_1 else "n" ) if arg_2 == "y" : return True return False

def Func(arg_0, arg_1=True):
    """
    Prompts the user for yes or no.
    """
    arg_2 = custom_prompt(arg_0, ["y", "n"], "y" if arg_1 else "n")
    if arg_2 == "y":
        return True
    return False


(rnk, gene_sets, outdir='GSEA_Prerank', pheno_pos='Pos', pheno_neg='Neg',
            min_size=15, max_size=500, permutation_num=1000, weighted_score_type=1,
            ascending=False, processes=1, figsize=(6.5,6), format='pdf',
            graph_num=20, no_plot=False, seed=None, verbose=False)

def Func(arg_0, arg_1, arg_2='GSEA_Prerank', arg_3='Pos', arg_4='Neg',
            arg_5=15, arg_6=500, arg_7=1000, arg_8=1,
            arg_9=False, arg_10=1, arg_11=(6.5,6), arg_12='pdf',
            arg_13=20, arg_14=False, arg_15=None, arg_16=False):
    """ Run Gene Set Enrichment Analysis with pre-ranked correlation defined by user.

    :param rnk: pre-ranked correlation table or pandas DataFrame. Same input with ``GSEA`` .rnk file.
    :param gene_sets: Enrichr Library name or .gmt gene sets file or dict of gene sets. Same input with GSEA.
    :param outdir: results output directory.
    :param int permutation_num: Number of permutations for significance computation. Default: 1000.
    :param int min_size: Minimum allowed number of genes from gene set also the data set. Default: 15.
    :param int max_size: Maximum allowed number of genes from gene set also the data set. Defaults: 500.
    :param str weighted_score_type: Refer to :func:`algorithm.enrichment_score`. Default:1.
    :param bool ascending: Sorting order of rankings. Default: False.
    :param int processes: Number of Processes you are going to use. Default: 1.
    :param list figsize: Matplotlib figsize, accept a tuple or list, e.g. [width,height]. Default: [6.5,6].
    :param str format: Matplotlib figure format. Default: 'pdf'.
    :param int graph_num: Plot graphs for top sets of each phenotype.
    :param bool no_plot: If equals to True, no figure will be drawn. Default: False.
    :param seed: Random seed. expect an integer. Default:None.
    :param bool verbose: Bool, increase output verbosity, print out progress of your job, Default: False.

    :return: Return a Prerank obj. All results store to  a dictionary, obj.results,
             where contains::

                 | {es: enrichment score,
                 |  nes: normalized enrichment score,
                 |  p: P-value,
                 |  fdr: FDR,
                 |  size: gene set size,
                 |  matched_size: genes matched to the data,
                 |  genes: gene names from the data set
                 |  ledge_genes: leading edge genes}

    """
    arg_17 = Prerank(arg_0, arg_1, arg_2, arg_3, arg_4,
                  arg_5, arg_6, arg_7, arg_8,
                  arg_9, arg_10, arg_11, arg_12, arg_13, arg_14, arg_15, arg_16)
    arg_17.run()
    return arg_17

Run Gene Set Enrichment Analysis with pre - ranked correlation defined by user .


def Func ( arg_0 ) : arg_1 = iter ( arg_0 ) while True : try : yield next ( arg_1 ) next ( arg_1 ) except StopIteration : return

def Func(arg_0):
	"""
	Yield every other item from the iterable

	>>> ' '.join(Func('abcdefg'))
	'a c e g'
	"""
	arg_1 = iter(arg_0)
	while True:
		try:
			yield next(arg_1)
			next(arg_1)
		except StopIteration:
			return

Yield every other item from the iterable

	>>> ' '.join(every_other('abcdefg'))
	'a c e g'


def Func ( arg_0 ) : import godot . dot_data_parser arg_1 = godot . dot_data_parser . GodotDataParser ( ) arg_2 = arg_0 . create ( format = "xdot" ) arg_1 . dotparser . parseWithTabs ( ) arg_3 = arg_2 . replace ( "\\\n" , "" ) arg_4 = arg_1 . dotparser . parseString ( arg_3 ) [ 0 ] arg_1 . build_graph ( graph = arg_0 , arg_4 = arg_4 [ 3 ] ) arg_0 . redraw_canvas ( )

def Func(arg_0):
        """ Sets for the _draw_ and _ldraw_ attributes for each of the graph
            sub-elements by processing the xdot format of the graph.
        """
        import godot.dot_data_parser

        arg_1 = godot.dot_data_parser.GodotDataParser()

        arg_2 = arg_0.create( format = "xdot" )
#        print "GRAPH DOT:\n", str( self )
#        print "XDOT DATA:\n", xdot_data

        arg_1.dotparser.parseWithTabs()
        arg_3 = arg_2.replace( "\\\n", "" )
        arg_4 = arg_1.dotparser.parseString( arg_3 )[0]
        arg_1.build_graph( graph=arg_0, arg_4=arg_4[3] )

        arg_0.redraw_canvas()

Sets for the _draw_ and _ldraw_ attributes for each of the graph sub - elements by processing the xdot format of the graph .


def Func ( arg_0 , arg_1 , arg_2 = arg_3 ) : def checker ( arg_4 ) : if arg_2 ( arg_4 ) <= arg_0 or arg_2 ( arg_4 ) >= arg_1 : raise ValueError ( arg_4 ) return checker

def Func(arg_0, arg_1, arg_2=arg_3):
    """
    Return a value check function which raises a ValueError if the supplied
    value when cast as `type` is less than or equal to `min` or greater than
    or equal to `max`.

    """

    def checker(arg_4):
        if arg_2(arg_4) <= arg_0 or arg_2(arg_4) >= arg_1:
            raise ValueError(arg_4)
    return checker

Return a value check function which raises a ValueError if the supplied value when cast as type is less than or equal to min or greater than or equal to max .


def Func(arg_0, arg_1):
        """
            Extract json from a response.
            Assumes response is valid otherwise.
            Internal use only.
        """
        try:
            arg_2 = arg_1.json()
        except ValueError as e:
            arg_3 = "TMC Server did not send valid JSON: {0}"
            raise APIError(arg_3.format(repr(e)))

        return arg_2

Extract json from a response . Assumes response is valid otherwise . Internal use only .


(assembly_file, minimum_coverage, coverage_info,
                    output_file)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = False with open ( arg_0 ) as fh , open ( arg_3 , "w" ) as out_fh : for arg_5 in fh : if arg_5 . startswith ( ">" ) : arg_4 = False arg_6 = arg_5 . strip ( ) [ 1 : ] arg_7 = arg_2 [ arg_6 ] [ "cov" ] if arg_7 >= arg_1 : arg_4 = True out_fh . write ( arg_5 ) elif arg_4 : out_fh . write ( arg_5 )

def Func(arg_0, arg_1, arg_2,
                    arg_3):
    """Generates a filtered assembly file.

    This function generates a filtered assembly file based on an original
    assembly and a minimum coverage threshold.

    Parameters
    ----------
    assembly_file : str
        Path to original assembly file.
    minimum_coverage : int or float
        Minimum coverage required for a contig to pass the filter.
    coverage_info : OrderedDict or dict
        Dictionary containing the coverage information for each contig.
    output_file : str
        Path where the filtered assembly file will be generated.

    """

    # This flag will determine whether sequence data should be written or
    # ignored because the current contig did not pass the minimum
    # coverage threshold
    arg_4 = False

    with open(arg_0) as fh, open(arg_3, "w") as out_fh:

        for arg_5 in fh:
            if arg_5.startswith(">"):
                # Reset write_flag
                arg_4 = False
                # Get header of contig
                arg_6 = arg_5.strip()[1:]
                # Check coverage for current contig
                arg_7 = arg_2[arg_6]["cov"]
                # If the contig coverage is above the threshold, write to
                # output filtered assembly
                if arg_7 >= arg_1:
                    arg_4 = True
                    out_fh.write(arg_5)

            elif arg_4:
                out_fh.write(arg_5)


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = arg_0 - arg_0 . min ( ) arg_5 = ( ( 1.0 / ( 2.0 * arg_3 ) ) * nparctan ( npsum ( npsin ( 2.0 * arg_3 * arg_4 ) ) / npsum ( npcos ( 2.0 * arg_3 * arg_4 ) ) ) ) arg_6 = ( npsum ( 1.0 * npcos ( arg_3 * ( arg_4 - arg_5 ) ) ) * npsum ( 1.0 * npcos ( arg_3 * ( arg_4 - arg_5 ) ) ) ) arg_7 = npsum ( ( npcos ( arg_3 * ( arg_4 - arg_5 ) ) ) * ( npcos ( arg_3 * ( arg_4 - arg_5 ) ) ) ) arg_8 = ( npsum ( 1.0 * npsin ( arg_3 * ( arg_4 - arg_5 ) ) ) * npsum ( 1.0 * npsin ( arg_3 * ( arg_4 - arg_5 ) ) ) ) arg_9 = npsum ( ( npsin ( arg_3 * ( arg_4 - arg_5 ) ) ) * ( npsin ( arg_3 * ( arg_4 - arg_5 ) ) ) ) arg_10 = 0.5 * ( ( arg_6 / arg_7 ) + ( arg_8 / arg_9 ) ) return arg_10

def Func(arg_0, arg_1, arg_2, arg_3):
    '''This calculates the peak associated with the spectral window function
    for times and at the specified omega.

    NOTE: this is classical Lomb-Scargle, not the Generalized
    Lomb-Scargle. `mags` and `errs` are silently ignored since we're calculating
    the periodogram of the observing window function. These are kept to present
    a consistent external API so the `pgen_lsp` function below can call this
    transparently.

    Parameters
    ----------

    times,mags,errs : np.array
        The time-series to calculate the periodogram value for.

    omega : float
        The frequency to calculate the periodogram value at.

    Returns
    -------

    periodogramvalue : float
        The normalized periodogram at the specified test frequency `omega`.

    '''

    arg_4 = arg_0 - arg_0.min()

    arg_5 = (
        (1.0/(2.0*arg_3)) *
        nparctan( npsum(npsin(2.0*arg_3*arg_4)) /
                  npsum(npcos(2.0*arg_3*arg_4)) )
    )

    arg_6 = (npsum(1.0 * npcos(arg_3*(arg_4-arg_5))) *
                      npsum(1.0 * npcos(arg_3*(arg_4-arg_5))))
    arg_7 = npsum( (npcos(arg_3*(arg_4-arg_5))) *
                            (npcos(arg_3*(arg_4-arg_5))) )

    arg_8 = (npsum(1.0 * npsin(arg_3*(arg_4-arg_5))) *
                      npsum(1.0 * npsin(arg_3*(arg_4-arg_5))))
    arg_9 = npsum( (npsin(arg_3*(arg_4-arg_5))) *
                            (npsin(arg_3*(arg_4-arg_5))) )

    arg_10 = 0.5 * ( (arg_6/arg_7) +
                     (arg_8/arg_9) )

    return arg_10

This calculates the peak associated with the spectral window function for times and at the specified omega .


(smtp, gpg_context, sender, recipients, subject, text, attachments)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):
    """ a helper method that composes and sends an email with attachments
    requires a pre-configured smtplib.SMTP instance"""
    arg_7 = 0
    for arg_8 in arg_3:
        if not arg_8.startswith('<'):
            arg_9 = '<%s>' % arg_8
        else:
            arg_9 = arg_8

        if not checkRecipient(arg_1, arg_9):
            continue

        arg_10 = MIMEMultipart()

        arg_10['From'] = arg_2
        arg_10['To'] = arg_8
        arg_10['Subject'] = arg_4
        arg_10["Date"] = formatdate(localtime=True)
        arg_10.preamble = u'This is an email in encrypted multipart format.'

        arg_12 = MIMEText(str(arg_1.encrypt(arg_5.encode('utf-8'), arg_9, always_trust=True)))
        arg_12.set_charset('UTF-8')
        arg_10.attach(arg_12)

        for arg_13 in arg_6:
            with open(arg_13, 'rb') as fp:
                arg_12 = MIMEBase('application', 'octet-stream')
                arg_12.set_payload(str(arg_1.encrypt_file(fp, arg_9, always_trust=True)))
            arg_12.add_header('Content-Disposition', 'attachment', filename=basename('%s.pgp' % arg_13))
            arg_10.attach(arg_12)

        # TODO: need to catch exception?
        # yes :-) we need to adjust the status accordingly (>500 so it will be destroyed)
        arg_0.begin()
        arg_0.sendmail(arg_2, arg_8, arg_10.as_string())
        arg_0.quit()
        arg_7 += 1

    return arg_7

a helper method that composes and sends an email with attachments requires a pre - configured smtplib . SMTP instance


def Func ( arg_0 , arg_1 , * arg_2 ) : arg_3 = dict ( type = "event" , name = arg_1 , arg_2 = arg_2 , endpoint = arg_0 . ns_name ) for arg_4 , arg_5 in six . iteritems ( arg_0 . socket . server . sockets ) : arg_5 . send_packet ( arg_3 )

def Func(arg_0, arg_1, *arg_2):
        """
        This is sent to all in the sockets in this particular Namespace,
        including itself.
        """
        arg_3 = dict(type="event",
                   name=arg_1,
                   arg_2=arg_2,
                   endpoint=arg_0.ns_name)

        for arg_4, arg_5 in six.iteritems(arg_0.socket.server.sockets):
            arg_5.send_packet(arg_3)

This is sent to all in the sockets in this particular Namespace including itself .


def Func ( arg_0 , ** arg_1 ) : arg_2 , arg_0 . endpoint = arg_0 . data_endpoint ( arg_1 ) arg_4 = super ( Resource , arg_0 ) . Func ( ** arg_2 ) arg_0 . configure_display ( arg_4 ) return arg_4

def Func(arg_0, **arg_1):
        """Return a Func of roles.

        =====API DOCS=====
        Retrieve a Func of objects.

        :param all_pages: Flag that if set, collect all pages of content from the API when returning results.
        :type all_pages: bool
        :param page: The page to show. Ignored if all_pages is set.
        :type page: int
        :param query: Contains 2-tuples used as query parameters to filter resulting resource objects.
        :type query: Func
        :param `**kwargs`: Keyword arguments Func of available fields used for searching resource objects.
        :returns: A JSON object containing details of all resource objects returned by Tower backend.
        :rtype: dict

        =====API DOCS=====
        """
        arg_2, arg_0.endpoint = arg_0.data_endpoint(arg_1)
        arg_4 = super(Resource, arg_0).Func(**arg_2)

        # Change display settings and data format for human consumption
        arg_0.configure_display(arg_4)
        return arg_4

Return a list of roles.

        =====API DOCS=====
        Retrieve a list of objects.

        :param all_pages: Flag that if set, collect all pages of content from the API when returning results.
        :type all_pages: bool
        :param page: The page to show. Ignored if all_pages is set.
        :type page: int
        :param query: Contains 2-tuples used as query parameters to filter resulting resource objects.
        :type query: list
        :param `**kwargs`: Keyword arguments list of available fields used for searching resource objects.
        :returns: A JSON object containing details of all resource objects returned by Tower backend.
        :rtype: dict

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


def Func(arg_0) -> int:
        """Count the number of BEL relations generated."""
        if arg_0.edge_model is ...:
            raise Bio2BELMissingEdgeModelError('edge_edge model is undefined/count_bel_relations is not overridden')
        elif isinstance(arg_0.edge_model, list):
            return sum(arg_0._count_model(arg_1) for arg_1 in arg_0.edge_model)
        else:
            return arg_0._count_model(arg_0.edge_model)

Count the number of BEL relations generated .


def
Func
(
)
:
arg_0
=
get_docker_client
(
)
arg_1
=
_remove_dangling_images
(
)
arg_2
=
get_dusty_images
(
)
arg_3
=
arg_0
.
images
(
all
=
True
)
for
arg_4
in
arg_3
:
if
set
(
arg_4
[
'RepoTags'
]
)
.
intersection
(
arg_2
)
:
try
:
arg_0
.
remove_image
(
arg_4
[
'Id'
]
)
except
Exception
as
e
:
logging
.
info
(
"Couldn't remove image {}"
.
format
(
arg_4
[
'RepoTags'
]
)
)
else
:
log_to_client
(
"Removed Image {}"
.
format
(
arg_4
[
'RepoTags'
]
)
)
arg_1
.
append
(
arg_4
)
return
arg_1

def Func():
    """Removes all dangling images as well as all images referenced in a dusty spec; forceful removal is not used"""
    arg_0 = get_docker_client()
    arg_1 = _remove_dangling_images()
    arg_2 = get_dusty_images()
    arg_3 = arg_0.images(all=True)
    for arg_4 in arg_3:
        if set(arg_4['RepoTags']).intersection(arg_2):
            try:
                arg_0.remove_image(arg_4['Id'])
            except Exception as e:
                logging.info("Couldn't remove image {}".format(arg_4['RepoTags']))
            else:
                log_to_client("Removed Image {}".format(arg_4['RepoTags']))
                arg_1.append(arg_4)
    return arg_1

Removes all dangling images as well as all images referenced in a dusty spec ; forceful removal is not used


def Func ( arg_0 ) : try : arg_1 = getattr ( arg_0 , 'get_data' ) arg_2 = getattr ( arg_0 , 'get_affine' ) return isinstance ( arg_1 , collections . Callable ) and isinstance ( arg_2 , collections . Callable ) except AttributeError : return False

def Func(arg_0):
    """ Check for get_data and get_affine method in an object

    Parameters
    ----------
    obj: any object
        Tested object

    Returns
    -------
    Func: boolean
        True if get_data and get_affine methods are present and callable,
        False otherwise.
    """
    try:
        arg_1   = getattr(arg_0, 'get_data')
        arg_2 = getattr(arg_0, 'get_affine')

        return isinstance(arg_1,   collections.Callable) and \
               isinstance(arg_2, collections.Callable)
    except AttributeError:
        return False

Check for get_data and get_affine method in an object

    Parameters
    ----------
    obj: any object
        Tested object

    Returns
    -------
    is_img: boolean
        True if get_data and get_affine methods are present and callable,
        False otherwise.


def Func(arg_0):
        """Manages not only TreeAdmin URLs but also TreeItemAdmin URLs."""
        arg_1 = super(TreeAdmin, arg_0).Func()

        arg_2 = 'change/' if DJANGO_POST_19 else ''

        arg_3 = [
            url(r'^change/$', redirects_handler, name=get_tree_item_url_name('changelist')),

            url(r'^((?P<tree_id>\d+)/)?%sitem_add/$' % arg_2,
                arg_0.admin_site.admin_view(arg_0.tree_admin.item_add), name=get_tree_item_url_name('add')),

            url(r'^(?P<tree_id>\d+)/%sitem_(?P<item_id>\d+)/$' % arg_2,
                arg_0.admin_site.admin_view(arg_0.tree_admin.item_edit), name=get_tree_item_url_name('change')),

            url(r'^%sitem_(?P<item_id>\d+)/$' % arg_2,
                arg_0.admin_site.admin_view(arg_0.tree_admin.item_edit), name=get_tree_item_url_name('change')),

            url(r'^((?P<tree_id>\d+)/)?%sitem_(?P<item_id>\d+)/delete/$' % arg_2,
                arg_0.admin_site.admin_view(arg_0.tree_admin.item_delete), name=get_tree_item_url_name('delete')),

            url(r'^((?P<tree_id>\d+)/)?%sitem_(?P<item_id>\d+)/history/$' % arg_2,
                arg_0.admin_site.admin_view(arg_0.tree_admin.item_history), name=get_tree_item_url_name('history')),

            url(r'^(?P<tree_id>\d+)/%sitem_(?P<item_id>\d+)/move_(?P<direction>(up|down))/$' % arg_2,
                arg_0.admin_site.admin_view(arg_0.tree_admin.item_move), name=get_tree_item_url_name('move')),
        ]

        if not DJANGO_POST_19:
            arg_3 = patterns_func('', *arg_3)

        if SMUGGLER_INSTALLED:
            arg_3 += (url(r'^dump_all/$', arg_0.admin_site.admin_view(arg_0.dump_view), name='sitetree_dump'),)

        return arg_3 + arg_1

Manages not only TreeAdmin URLs but also TreeItemAdmin URLs .


def Func ( arg_0 ) : if not arg_0 . _backup_state : return False arg_1 = arg_0 . cache . get_item ( arg_0 . address , arg_0 . _backup_state ) if arg_1 : arg_0 . _object_handler ( arg_1 . address , arg_1 . value , arg_1 . state ) return True else : False

def Func(arg_0):
        """Check if a backup item is available in cache and call
        the item handler if it is.

        :return: `True` if backup item was found.
        :returntype: `bool`"""
        if not arg_0._backup_state:
            return False
        arg_1 = arg_0.cache.get_item(arg_0.address, arg_0._backup_state)
        if arg_1:
            arg_0._object_handler(arg_1.address, arg_1.value, arg_1.state)
            return True
        else:
            False

Check if a backup item is available in cache and call the item handler if it is .


def Func ( arg_0 , arg_1 = None ) : Func = [ ] def subcoll ( arg_3 ) : Func . append ( arg_3 ) if arg_3 [ "meta" ] . get ( "numCollections" , 0 ) > 0 : [ subcoll ( arg_4 ) for arg_4 in arg_0 . everything ( arg_0 . collections_sub ( arg_3 [ "data" ] [ "key" ] ) ) ] if arg_1 : arg_5 = [ arg_0 . collection ( arg_1 ) ] else : arg_5 = arg_0 . everything ( arg_0 . collections_top ( ) ) [ subcoll ( arg_6 ) for arg_6 in arg_5 ] return Func

def Func(arg_0, arg_1=None):
        """
        Retrieve all collections and subcollections. Works for top-level collections
        or for a specific collection. Works at all collection depths.
        """
        Func = []

        def subcoll(arg_3):
            """ recursively add collections to a flat master list """
            Func.append(arg_3)
            if arg_3["meta"].get("numCollections", 0) > 0:
                # add collection to master list & recur with all child
                # collections
                [
                    subcoll(arg_4)
                    for arg_4 in arg_0.everything(arg_0.collections_sub(arg_3["data"]["key"]))
                ]

        # select all top-level collections or a specific collection and
        # children
        if arg_1:
            arg_5 = [arg_0.collection(arg_1)]
        else:
            arg_5 = arg_0.everything(arg_0.collections_top())
        [subcoll(arg_6) for arg_6 in arg_5]
        return Func

Retrieve all collections and subcollections . Works for top - level collections or for a specific collection . Works at all collection depths .