(is_accepted, accepted, rejected, name=None)

return type(accepted)(**dict(
      [(fn,
        choose(is_accepted,
               getattr(accepted, fn),
               getattr(rejected, fn),
               name=name))
       for fn in accepted._fields]))

def Func(arg_0, arg_1, arg_2, arg_3=None):
  """Helper which expand_dims `is_accepted` then applies tf.where."""
  if not is_namedtuple_like(arg_1):
    return _Func_base_case(arg_0, arg_1, arg_2, arg_3=arg_3)
  if not isinstance(arg_1, type(arg_2)):
    raise TypeError('Type of `accepted` ({}) must be identical to '
                    'type of `rejected` ({})'.format(
                        type(arg_1).__name__,
                        type(arg_2).__name__))
  return type(arg_1)(**dict(
      [(arg_4,
        Func(arg_0,
               getattr(arg_1, arg_4),
               getattr(arg_2, arg_4),
               arg_3=arg_3))
       for arg_4 in arg_1._fields]))

Helper which expand_dims is_accepted then applies tf . where .


return every(lambda (k, v): evidence.get(k, v) == v,
                 event.items())

def Func ( arg_0 , arg_1 ) : return every ( lambda ( k , v ) : arg_1 . get ( k , v ) == v , arg_0 . items ( ) )

def Func(arg_0, arg_1):
    "Is event consistent with the given evidence?"
    return every(lambda (k, v): arg_1.get(k, v) == v,
                 arg_0.items())


def Func ( arg_0 ) : arg_1 = defaultdict ( list ) for arg_2 , arg_3 , arg_4 , arg_5 , arg_6 in arg_0 . _iter_sims ( ) : arg_7 = arg_1 [ arg_2 ] for arg_8 in arg_7 : if ( arg_3 , arg_4 ) in arg_8 or ( arg_5 , arg_6 ) in arg_8 : arg_8 . add ( ( arg_3 , arg_4 ) ) arg_8 . add ( ( arg_5 , arg_6 ) ) break else : arg_7 . append ( { ( arg_3 , arg_4 ) , ( arg_5 , arg_6 ) } ) arg_9 = [ ] for arg_2 , arg_10 in arg_1 . items ( ) : for arg_8 in arg_10 : arg_9 . append ( ( arg_2 , arg_8 ) ) arg_9 . sort ( ) arg_9 . reverse ( ) return arg_9

def Func(arg_0):
        """compute similarities in appended files"""
        arg_1 = defaultdict(list)
        for arg_2, arg_3, arg_4, arg_5, arg_6 in arg_0._iter_sims():
            arg_7 = arg_1[arg_2]
            for arg_8 in arg_7:
                if (arg_3, arg_4) in arg_8 or (arg_5, arg_6) in arg_8:
                    arg_8.add((arg_3, arg_4))
                    arg_8.add((arg_5, arg_6))
                    break
            else:
                arg_7.append({(arg_3, arg_4), (arg_5, arg_6)})
        arg_9 = []
        for arg_2, arg_10 in arg_1.items():
            for arg_8 in arg_10:
                arg_9.append((arg_2, arg_8))
        arg_9.sort()
        arg_9.reverse()
        return arg_9


def
Func
(
arg_0
)
:
if
arg_0
.
logfile
is
:
print
'Logging has not been activated.'
else
:
arg_1
=
arg_0
.
log_active
and
'active'
or
'temporarily suspended'
print
'Filename       :'
,
arg_0
.
logfname
print
'Mode           :'
,
arg_0
.
logmode
print
'Output logging :'
,
arg_0
.
log_output
print
'Raw input log  :'
,
arg_0
.
log_raw_input
print
'Timestamping   :'
,
arg_0
.
timestamp
print
'State          :'
,
arg_1

def Func(arg_0):
        """Print a status message about the logger."""
        if arg_0.logfile is None:
            print 'Logging has not been activated.'
        else:
            arg_1 = arg_0.log_active and 'active' or 'temporarily suspended'
            print 'Filename       :',arg_0.logfname
            print 'Mode           :',arg_0.logmode
            print 'Output logging :',arg_0.log_output
            print 'Raw input log  :',arg_0.log_raw_input
            print 'Timestamping   :',arg_0.timestamp
            print 'State          :',arg_1

Print a status message about the logger .


def Func(arg_0):
        """
        Cancel all started queries that have not yet completed
        """
        arg_1 = arg_0.service.jobs()
        if (arg_0.running_job_id and
                not arg_0.poll_job_complete(arg_0.running_job_id)):
            arg_0.log.info('Attempting to cancel job : %s, %s', arg_0.project_id,
                          arg_0.running_job_id)
            if arg_0.location:
                arg_1.cancel(
                    projectId=arg_0.project_id,
                    jobId=arg_0.running_job_id,
                    location=arg_0.location).execute(num_retries=arg_0.num_retries)
            else:
                arg_1.cancel(
                    projectId=arg_0.project_id,
                    jobId=arg_0.running_job_id).execute(num_retries=arg_0.num_retries)
        else:
            arg_0.log.info('No running BigQuery jobs to cancel.')
            return

        # Wait for all the calls to cancel to finish
        arg_2 = 12
        arg_3 = 0

        arg_4 = False
        while arg_3 < arg_2 and not arg_4:
            arg_3 = arg_3 + 1
            arg_4 = arg_0.poll_job_complete(arg_0.running_job_id)
            if arg_4:
                arg_0.log.info('Job successfully canceled: %s, %s',
                              arg_0.project_id, arg_0.running_job_id)
            elif arg_3 == arg_2:
                arg_0.log.info(
                    "Stopping polling due to timeout. Job with id %s "
                    "has not completed cancel and may or may not finish.",
                    arg_0.running_job_id)
            else:
                arg_0.log.info('Waiting for canceled job with id %s to finish.',
                              arg_0.running_job_id)
                time.sleep(5)


def Func(arg_0, arg_1, arg_2=0, arg_3=-1):
        """Fill the entire strip with RGB color tuple"""
        arg_2 = max(arg_2, 0)
        if arg_3 < 0 or arg_3 >= arg_0.numLEDs:
            arg_3 = arg_0.numLEDs - 1
        for arg_4 in range(arg_2, arg_3 + 1):  # since 0-index include end in range
            arg_0._set_base(arg_4, arg_1)


(numRecords, elemSize = 400, numSet = 42)

def Func ( arg_0 , arg_1 = 400 , arg_2 = 42 ) : arg_3 = [ ] for arg_4 in xrange ( arg_0 ) : arg_5 = np . zeros ( arg_1 , dtype = realDType ) for arg_4 in range ( 0 , arg_2 ) : arg_6 = np . random . random_integers ( 0 , arg_1 - 1 , 1 ) [ 0 ] arg_5 [ arg_6 ] = 1 while abs ( arg_5 . sum ( ) - arg_2 ) > 0.1 : arg_6 = np . random . random_integers ( 0 , arg_1 - 1 , 1 ) [ 0 ] arg_5 [ arg_6 ] = 1 arg_3 . append ( arg_5 ) return arg_3

def Func(arg_0, arg_1 = 400, arg_2 = 42):
  """ Generates a set of input record

  Params:
          numRecords - how many records to generate
          elemSize - the size of each record (num 0s or 1s)
          numSet - how many 1s in each record

  Returns: a list of inputs
  """

  arg_3 = []

  for arg_4 in xrange(arg_0):

    arg_5 = np.zeros(arg_1, dtype=realDType)
    for arg_4 in range(0,arg_2):
      arg_6 = np.random.random_integers(0, arg_1-1, 1)[0]
      arg_5[arg_6] = 1
    while abs(arg_5.sum() - arg_2) > 0.1:
      arg_6 = np.random.random_integers(0, arg_1-1, 1)[0]
      arg_5[arg_6] = 1

    arg_3.append(arg_5)

  return arg_3


def Func ( arg_0 , arg_1 , arg_2 = None ) : if arg_1 not in arg_0 . available_actions : return None arg_3 = arg_0 . available_actions [ arg_1 ] if 'input' in arg_3 [ 'metadata' ] : try : validate ( arg_2 , arg_3 [ 'metadata' ] [ 'input' ] ) except ValidationError : return None arg_4 = arg_3 [ 'class' ] ( arg_0 , arg_2 = arg_2 ) arg_4 . set_href_prefix ( arg_0 . href_prefix ) arg_0 . action_notify ( arg_4 ) arg_0 . actions [ arg_1 ] . append ( arg_4 ) return arg_4

def Func(arg_0, arg_1, arg_2=None):
        """
        Perform an action on the thing.

        action_name -- name of the action
        input_ -- any action inputs

        Returns the action that was created.
        """
        if arg_1 not in arg_0.available_actions:
            return None

        arg_3 = arg_0.available_actions[arg_1]

        if 'input' in arg_3['metadata']:
            try:
                validate(arg_2, arg_3['metadata']['input'])
            except ValidationError:
                return None

        arg_4 = arg_3['class'](arg_0, arg_2=arg_2)
        arg_4.set_href_prefix(arg_0.href_prefix)
        arg_0.action_notify(arg_4)
        arg_0.actions[arg_1].append(arg_4)
        return arg_4


def Func ( arg_0 ) : arg_0 . stack = [ ] arg_0 . curindex = 0 arg_0 . curframe = None arg_0 . thread_name = None arg_0 . frame_thread_name = None return

def Func(arg_0):
        """ Remove memory of state variables set in the command processor """
        arg_0.stack       = []
        arg_0.curindex    = 0
        arg_0.curframe    = None
        arg_0.thread_name = None
        arg_0.frame_thread_name = None
        return


def Func(arg_0, arg_1):
  """Split a covariance matrix into block-diagonal marginals of given sizes."""
  arg_2 = 0
  arg_3 = []
  for arg_4 in arg_1:
    arg_5 = arg_2 + arg_4
    arg_3.append(arg_0[..., arg_2:arg_5, arg_2:arg_5])
    arg_2 = arg_5
  return arg_3

Split a covariance matrix into block - diagonal marginals of given sizes .


(
    py_ast: GeneratedPyAST, env: NodeEnv, include_dependencies: bool = False
)

def Func ( arg_0 : arg_1 , arg_2 : arg_3 , arg_4 : arg_5 = False ) -> arg_1 : if arg_2 . line is not None : arg_0 . node . lineno = arg_2 . line if arg_4 : for arg_8 in arg_0 . dependencies : arg_8 . lineno = arg_2 . line if arg_2 . col is not None : arg_0 . node . col_offset = arg_2 . col if arg_4 : for arg_8 in arg_0 . dependencies : arg_8 . col_offset = arg_2 . col return arg_0

def Func(
    arg_0: arg_1, arg_2: arg_3, arg_4: arg_5 = False
) -> arg_1:
    """Hydrate Generated Python AST nodes with line numbers and column offsets
    if they exist in the node environment."""
    if arg_2.line is not None:
        arg_0.node.lineno = arg_2.line

        if arg_4:
            for arg_8 in arg_0.dependencies:
                arg_8.lineno = arg_2.line

    if arg_2.col is not None:
        arg_0.node.col_offset = arg_2.col

        if arg_4:
            for arg_8 in arg_0.dependencies:
                arg_8.col_offset = arg_2.col

    return arg_0

Hydrate Generated Python AST nodes with line numbers and column offsets if they exist in the node environment .


def Func(arg_0):
    """Return the entire source file and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of all the lines
    in the file and the line number indexes a line in that list.  An IOError
    is raised if the source code cannot be retrieved.

    FIXED version with which we monkeypatch the stdlib to work around a bug."""

    arg_1 = getsourcefile(arg_0) or getfile(arg_0)
    # If the object is a frame, then trying to get the globals dict from its
    # module won't work. Instead, the frame object itself has the globals
    # dictionary.
    arg_2 = None
    if inspect.isframe(arg_0):
        # XXX: can this ever be false?
        arg_2 = arg_0.f_globals
    else:
        arg_3 = getmodule(arg_0, arg_1)
        if arg_3:
            arg_2 = arg_3.__dict__
    arg_4 = linecache.getlines(arg_1, arg_2)
    if not arg_4:
        raise IOError('could not get source code')

    if ismodule(arg_0):
        return arg_4, 0

    if isclass(arg_0):
        arg_5 = arg_0.__name__
        arg_6 = re.compile(r'^(\s*)class\s*' + arg_5 + r'\b')
        # make some effort to find the best matching class definition:
        # use the one with the least indentation, which is the one
        # that's most probably not inside a function definition.
        arg_7 = []
        for arg_8 in range(len(arg_4)):
            arg_9 = arg_6.match(arg_4[arg_8])
            if arg_9:
                # if it's at toplevel, it's already the best one
                if arg_4[arg_8][0] == 'c':
                    return arg_4, arg_8
                # else add whitespace to candidate list
                arg_7.append((arg_9.group(1), arg_8))
        if arg_7:
            # this will sort by whitespace, and by line number,
            # less whitespace first
            arg_7.sort()
            return arg_4, arg_7[0][1]
        else:
            raise IOError('could not find class definition')

    if ismethod(arg_0):
        arg_0 = arg_0.im_func
    if isfunction(arg_0):
        arg_0 = arg_0.func_code
    if istraceback(arg_0):
        arg_0 = arg_0.tb_frame
    if isframe(arg_0):
        arg_0 = arg_0.f_code
    if iscode(arg_0):
        if not hasattr(arg_0, 'co_firstlineno'):
            raise IOError('could not find function definition')
        arg_6 = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)')
        arg_10 = arg_6.match
        # fperez - fix: sometimes, co_firstlineno can give a number larger than
        # the length of lines, which causes an error.  Safeguard against that.
        arg_11 = min(arg_0.co_firstlineno,len(arg_4))-1
        while arg_11 > 0:
            if arg_10(arg_4[arg_11]): break
            arg_11 -= 1

        return arg_4, arg_11
    raise IOError('could not find code object')

Return the entire source file and starting line number for an object .


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . db . search ( Query ( ) . name == arg_1 ) if not arg_2 : return { } return arg_2 [ 0 ]

def Func(arg_0, arg_1):
        """Return a dictionary consisting of the key itself

        e.g.
        {u'created_at': u'2016-10-10 08:31:53',
         u'description': None,
         u'metadata': None,
         u'modified_at': u'2016-10-10 08:31:53',
         u'name': u'aws',
         u'uid': u'459f12c0-f341-413e-9d7e-7410f912fb74',
         u'value': u'the_value'}

        """
        arg_2 = arg_0.db.search(Query().name == arg_1)
        if not arg_2:
            return {}
        return arg_2[0]


def Func(arg_0, arg_1=None):
        """
        Read the user configuration
        """
        if arg_1:
            arg_0._config_filename = arg_1
        else:
            try:
                import appdirs
            except ImportError:
                raise Exception("Missing dependency for determining config path. Please install "
                                "the 'appdirs' Python module.")
            arg_0._config_filename = appdirs.user_config_dir(_LIBRARY_NAME, "ProfitBricks") + ".ini"
        if not arg_0._config:
            arg_0._config = configparser.ConfigParser()
            arg_0._config.optionxform = str
            arg_0._config.read(arg_0._config_filename)


def Func ( arg_0 , arg_1 ) : if norm ( arg_0 ) > 0 and norm ( arg_1 ) > 0 : return dot ( arg_0 , arg_1 ) / ( norm ( arg_0 ) * norm ( arg_1 ) ) else : return 0.0

def Func(arg_0, arg_1):
    """Compare vectors. Borrowed from A. Parish."""
    if norm(arg_0) > 0 and norm(arg_1) > 0:
        return dot(arg_0, arg_1) / (norm(arg_0) * norm(arg_1))
    else:
        return 0.0

Compare vectors . Borrowed from A . Parish .


def Func(arg_0, arg_1=arg_2):
        """Retrieve an estimated time correction offset for the given stream.

        The first call to this function takes several miliseconds until a
        reliable first estimate is obtained. Subsequent calls are instantaneous
        (and rely on periodic background updates). The precision of these
        estimates should be below 1 ms (empirically within +/-0.2 ms).

        Keyword arguments:
        timeout -- Timeout to acquire the first time-correction estimate
                   (default FOREVER).

        Returns the current time correction estimate. This is the number that
        needs to be added to a time stamp that was remotely generated via
        local_clock() to map it into the local clock domain of this
        machine.

        Throws a TimeoutError (if the timeout expires), or LostError (if the
        stream source has been lost).

        """
        arg_3 = c_int()
        arg_4 = lib.lsl_Func(arg_0.obj, c_double(arg_1),
                                         byref(arg_3))
        handle_error(arg_3)
        return arg_4

Retrieve an estimated time correction offset for the given stream .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
"\t server {\n"
arg_2
+=
"\t \t {}\n"
.
format
(
_nginx_max_file_size_string
(
)
)
arg_2
+=
"\t \t {}\n"
.
format
(
_nginx_listen_string
(
arg_0
)
)
arg_2
+=
"\t \t {}\n"
.
format
(
_nginx_server_name_string
(
arg_0
)
)
arg_2
+=
_nginx_location_spec
(
arg_0
,
arg_1
)
arg_2
+=
_custom_502_page
(
)
arg_2
+=
"\t }\n"
return
arg_2

def Func(arg_0, arg_1):
    """This will output the nginx HTTP config string for specific port spec """
    arg_2 = "\t server {\n"
    arg_2 += "\t \t {}\n".format(_nginx_max_file_size_string())
    arg_2 += "\t \t {}\n".format(_nginx_listen_string(arg_0))
    arg_2 += "\t \t {}\n".format(_nginx_server_name_string(arg_0))
    arg_2 += _nginx_location_spec(arg_0, arg_1)
    arg_2 += _custom_502_page()
    arg_2 += "\t }\n"
    return arg_2


return _RPCFunctionStub(parseresult.netloc, functionid, self)

def Func(arg_0, arg_1):
        """
        Create a callable that will invoke the given remote function.

        The stub will return a deferred even if the remote function does not.
        """
        assert arg_0._opened, "RPC System is not opened"
        logging.debug("Func(%s)" % repr(arg_1))
        arg_2 = urlparse.urlparse(arg_1)
        arg_3 = arg_2.scheme
        arg_4 = arg_2.path.split("/")
        if arg_3 != "anycall":
            raise ValueError("Not an anycall URL: %s" % repr(arg_1))
        if len(arg_4) != 3 or arg_4[0] != "" or arg_4[1] != "functions":
            raise ValueError("Not an URL for a remote function: %s" % repr(arg_1))
        try:
            arg_5 = uuid.UUID(arg_4[2])
        except ValueError:
            raise ValueError("Not a valid URL for a remote function: %s" % repr(arg_1))

        return _RPCFunctionStub(arg_2.netloc, arg_5, arg_0)

Create a callable that will invoke the given remote function . The stub will return a deferred even if the remote function does not .


return find_code(frame.f_locals.values()) or find_code(frame.f_globals.values())

def Func ( arg_0 , arg_1 ) : def find_code ( arg_2 , arg_3 = 0 ) : if arg_3 > 3 : return for arg_4 in arg_2 : if arg_4 is None : continue arg_5 = None if hasattr ( arg_4 , "__code__" ) and arg_4 . __code__ == arg_1 : arg_5 = arg_4 elif isinstance ( arg_4 , type ) or isinstance ( arg_4 , ModuleType ) : try : arg_5 = find_code ( ( getattr ( arg_4 , n , None ) for n in dir ( arg_4 ) ) , arg_3 + 1 ) except Exception : continue elif isinstance ( arg_4 , ( list , tuple , set ) ) : arg_5 = find_code ( arg_4 , arg_3 + 1 ) elif isinstance ( arg_4 , dict ) : arg_5 = find_code ( arg_4 . values ( ) , arg_3 + 1 ) if arg_5 : return arg_5 return find_code ( arg_0 . f_locals . values ( ) ) or find_code ( arg_0 . f_globals . values ( ) )

def Func(arg_0, arg_1):
    """
    Given a frame and a compiled function code, find the corresponding function object within the frame.

    This function addresses the following problem: when handling a stacktrace, we receive information about
    which piece of code was being executed in the form of a CodeType object. That objects contains function name,
    file name, line number, and the compiled bytecode. What it *doesn't* contain is the function object itself.

    So this utility function aims at locating this function object, and it does so by searching through objects
    in the preceding local frame (i.e. the frame where the function was called from). We expect that the function
    should usually exist there -- either by itself, or as a method on one of the objects.

    :param types.FrameType frame: local frame where the function ought to be found somewhere.
    :param types.CodeType code: the compiled code of the function to look for.

    :returns: the function object, or None if not found.
    """
    def find_code(arg_2, arg_3=0):
        if arg_3 > 3: return  # Avoid potential infinite loops, or generally objects that are too deep.
        for arg_4 in arg_2:
            if arg_4 is None: continue
            arg_5 = None
            if hasattr(arg_4, "__code__") and arg_4.__code__ == arg_1:
                arg_5 = arg_4
            elif isinstance(arg_4, type) or isinstance(arg_4, ModuleType):  # class / module
                try:
                    arg_5 = find_code((getattr(arg_4, n, None) for n in dir(arg_4)), arg_3 + 1)
                except Exception:
                    # Sometimes merely getting module's attributes may cause an exception. For example :mod:`six.moves`
                    # is such an offender...
                    continue
            elif isinstance(arg_4, (list, tuple, set)):
                arg_5 = find_code(arg_4, arg_3 + 1)
            elif isinstance(arg_4, dict):
                arg_5 = find_code(arg_4.values(), arg_3 + 1)
            if arg_5: return arg_5
    return find_code(arg_0.f_locals.values()) or find_code(arg_0.f_globals.values())

Given a frame and a compiled function code find the corresponding function object within the frame .


def Func(arg_0, arg_1):
        """
        Convert unixtime to unixtime on GTFS start-of-day.

        GTFS defines the start of a day as "noon minus 12 hours" to solve
        most DST-related problems. This means that on DST-changing days,
        the day start isn't midnight. This function isn't idempotent.
        Running it twice on the "move clocks backwards" day will result in
        being one day too early.

        Parameters
        ----------
        ut: int
            Unixtime

        Returns
        -------
        ut: int
            Unixtime corresponding to start of day
        """
        # set timezone to the one of gtfs
        arg_2 = arg_0.set_current_process_time_zone()
        arg_1 = time.mktime(time.localtime(arg_1)[:3] + (12, 00, 0, 0, 0, -1)) - 43200
        set_process_timezone(arg_2)
        return arg_1

Convert unixtime to unixtime on GTFS start - of - day .


(cls, contact, user_input,
            localize_dates)

def Func(arg_0, arg_1, arg_2,
            arg_3):
        """
        Use this if you want to clone an existing contact and  replace its data
        with new user input in one step.
        """
        arg_1 = arg_0(arg_1.address_book, arg_1.filename,
                      arg_1.supported_private_objects, None, arg_3)
        arg_1._process_user_input(arg_2)
        return arg_1

Use this if you want to clone an existing contact and replace its data with new user input in one step .


(self, workflow,
                                        notification_template, status)

return self._assoc('notification_templates_%s' % status,
                           workflow, notification_template)

def Func(arg_0, arg_1,
                                        arg_2, arg_3):
        """Associate a notification template from this workflow.

        =====API DOCS=====
        Associate a notification template from this workflow job template.

        :param workflow: The workflow job template to associate to.
        :type workflow: str
        :param notification_template: The notification template to be associated.
        :type notification_template: str
        :param status: type of notification this notification template should be associated to.
        :type status: str
        :returns: Dictionary of only one key "changed", which indicates whether the association succeeded.
        :rtype: dict

        =====API DOCS=====
        """
        return arg_0._assoc('notification_templates_%s' % arg_3,
                           arg_1, arg_2)

Associate a notification template from this workflow .


def Func(arg_0, arg_1):
    """L1 and L2 rules"""

    # Applies L1.

    arg_2 = True
    arg_3 = arg_0['chars']

    for arg_4 in arg_3[::-1]:
        # L1. On each line, reset the embedding level of the following
        # characters to the paragraph embedding level:
        if arg_4['orig'] in ('B', 'S'):
            # 1. Segment separators,
            # 2. Paragraph separators,
            arg_4['level'] = arg_0['base_level']
            arg_2 = True
        elif arg_2 and arg_4['orig'] in ('BN', 'WS'):
            # 3. Any sequence of whitespace characters preceding a segment
            # separator or paragraph separator
            # 4. Any sequence of white space characters at the end of the
            # line.
            arg_4['level'] = arg_0['base_level']
        else:
            arg_2 = False

    arg_5 = len(arg_3)

    # L2 should be per line
    # Calculates highest level and loweset odd level on the fly.

    arg_6 = arg_11 = 0
    arg_7 = 0
    arg_8 = EXPLICIT_LEVEL_LIMIT

    for arg_9 in range(arg_5):
        arg_4 = arg_3[arg_9]

        # calc the levels
        arg_10 = arg_4['level']
        if arg_10 > arg_7:
            arg_7 = arg_10

        if arg_10 % 2 and arg_10 < arg_8:
            arg_8 = arg_10

        if arg_4['orig'] == 'B' or arg_9 == arg_5 - 1:
            arg_11 = arg_9
            # omit line breaks
            if arg_4['orig'] == 'B':
                arg_11 -= 1

            reverse_contiguous_sequence(arg_3, arg_6, arg_11,
                                        arg_7, arg_8)

            # reset for next line run
            arg_6 = arg_9+1
            arg_7 = 0
            arg_8 = EXPLICIT_LEVEL_LIMIT

    if arg_1:
        debug_storage(arg_0)


def
Func
(
arg_0
,
arg_1
)
:
for
arg_2
in
arg_0
.
webhooks
.
list
(
)
:
if
arg_2
.
name
==
arg_1
:
print
(
"Deleting Webhook:"
,
arg_2
.
name
,
arg_2
.
targetUrl
)
arg_0
.
webhooks
.
delete
(
arg_2
.
id
)

def Func(arg_0, arg_1):
    """Find a webhook by name."""
    for arg_2 in arg_0.webhooks.list():
        if arg_2.name == arg_1:
            print("Deleting Webhook:", arg_2.name, arg_2.targetUrl)
            arg_0.webhooks.delete(arg_2.id)


def Func(arg_0, arg_1, arg_2, arg_3):
    """Split the extension from a pathname.

    Extension is everything from the last dot to the end, ignoring
    leading dots.  Returns "(root, ext)"; ext may be empty."""

    arg_4 = arg_0.rfind(arg_1)
    if arg_2:
        arg_5 = arg_0.rfind(arg_2)
        arg_4 = max(arg_4, arg_5)

    arg_6 = arg_0.rfind(arg_3)
    if arg_6 > arg_4:
        # skip all leading dots
        arg_7 = arg_4 + 1
        while arg_7 < arg_6:
            if arg_0[arg_7] != arg_3:
                return arg_0[:arg_6], arg_0[arg_6:]
            arg_7 += 1

    return arg_0, ''


return [plane.unmasked_blurred_image_of_galaxies_from_psf(padded_grid_stack, psf) for plane in planes]

def Func(arg_0, arg_1, arg_2):
    """For lens data, compute the unmasked blurred image of every unmasked unblurred image of every galaxy in each \
    plane. To do this, this function iterates over all planes and then galaxies to extract their unmasked unblurred \
    images.

    If a galaxy in a plane has a pixelization, the unmasked image of that galaxy in the plane is returned as None \
    as as the inversion's model image cannot be mapped to an unmasked version.

    This relies on using the lens data's padded-grid, which is a grid of (y,x) coordinates which extends over the \
    entire image as opposed to just the masked region.

    This returns a list of lists, where each list index corresponds to [plane_index][galaxy_index].

    Parameters
    ----------
    planes : [plane.Plane]
        The list of planes the unmasked blurred images are computed using.
    padded_grid_stack : grids.GridStack
        A padded-grid_stack, whose padded grid is used for PSF convolution.
    psf : ccd.PSF
        The PSF of the image used for convolution.
    """
    return [arg_3.unmasked_blurred_image_of_galaxies_from_psf(arg_1, arg_2) for arg_3 in arg_0]

For lens data compute the unmasked blurred image of every unmasked unblurred image of every galaxy in each \ plane . To do this this function iterates over all planes and then galaxies to extract their unmasked unblurred \ images .


(grad_and_hessian_loss_fn,
             x_start,
             tolerance,
             l1_regularizer,
             l2_regularizer=None,
             maximum_iterations=1,
             maximum_full_sweeps_per_iteration=1,
             learning_rate=None,
             name=None)

def Func(arg_0,
             arg_1,
             arg_2,
             arg_3,
             arg_4=None,
             arg_5=1,
             arg_6=1,
             arg_7=None,
             arg_8=None):
  """Minimize using Hessian-informed proximal gradient descent.

  This function solves the regularized minimization problem

  ```none
  argmin{ Loss(x)
            + l1_regularizer * ||x||_1
            + l2_regularizer * ||x||_2**2
          : x in R^n }
  ```

  where `Loss` is a convex C^2 function (typically, `Loss` is the negative log
  likelihood of a model and `x` is a vector of model coefficients).  The `Loss`
  function does not need to be supplied directly, but this optimizer does need a
  way to compute the gradient and Hessian of the Loss function at a given value
  of `x`.  The gradient and Hessian are often computationally expensive, and
  this optimizer calls them relatively few times compared with other algorithms.

  Args:
    grad_and_hessian_loss_fn: callable that takes as input a (batch of) `Tensor`
      of the same shape and dtype as `x_start` and returns the triple
      `(gradient_unregularized_loss, hessian_unregularized_loss_outer,
      hessian_unregularized_loss_middle)` as defined in the argument spec of
      `Func_one_step`.
    x_start: (Batch of) vector-shaped, `float` `Tensor` representing the initial
      value of the argument to the `Loss` function.
    tolerance: scalar, `float` `Tensor` representing the tolerance for each
      optimization step; see the `tolerance` argument of
      `Func_one_step`.
    l1_regularizer: scalar, `float` `Tensor` representing the weight of the L1
      regularization term (see equation above).
    l2_regularizer: scalar, `float` `Tensor` representing the weight of the L2
      regularization term (see equation above).
      Default value: `None` (i.e., no L2 regularization).
    maximum_iterations: Python integer specifying the maximum number of
      iterations of the outer loop of the optimizer.  After this many iterations
      of the outer loop, the algorithm will terminate even if the return value
      `optimal_x` has not converged.
      Default value: `1`.
    maximum_full_sweeps_per_iteration: Python integer specifying the maximum
      number of sweeps allowed in each iteration of the outer loop of the
      optimizer.  Passed as the `maximum_full_sweeps` argument to
      `Func_one_step`.
      Default value: `1`.
    learning_rate: scalar, `float` `Tensor` representing a multiplicative factor
      used to dampen the proximal gradient descent steps.
      Default value: `None` (i.e., factor is conceptually `1`).
    name: Python string representing the name of the TensorFlow operation.
      The default name is `"Func"`.

  Returns:
    x: `Tensor` of the same shape and dtype as `x_start`, representing the
      (batches of) computed values of `x` which Funcs `Loss(x)`.
    is_converged: scalar, `bool` `Tensor` indicating whether the minimization
      procedure converged within the specified number of iterations across all
      batches.  Here convergence means that an iteration of the inner loop
      (`Func_one_step`) returns `True` for its `is_converged` output value.
    iter: scalar, `int` `Tensor` indicating the actual number of iterations of
      the outer loop of the optimizer completed (i.e., number of calls to
      `Func_one_step` before achieving convergence).

  #### References

  [1]: Jerome Friedman, Trevor Hastie and Rob Tibshirani. Regularization Paths
       for Generalized Linear Models via Coordinate Descent. _Journal of
       Statistical Software_, 33(1), 2010.
       https://www.jstatsoft.org/article/view/v033i01/v33i01.pdf

  [2]: Guo-Xun Yuan, Chia-Hua Ho and Chih-Jen Lin. An Improved GLMNET for
       L1-regularized Logistic Regression. _Journal of Machine Learning
       Research_, 13, 2012.
       http://www.jmlr.org/papers/volume13/yuan12a/yuan12a.pdf
  """
  arg_9 = [
      arg_1,
      arg_3,
      arg_4,
      arg_5,
      arg_6,
      arg_2,
      arg_7,
  ],
  with tf.compat.v1.name_scope(arg_8, 'Func', arg_9):

    def _loop_cond(arg_1, arg_10, arg_11):
      del arg_1
      return tf.logical_and(arg_11 < arg_5,
                            tf.logical_not(arg_10))

    def _loop_body(arg_1, arg_10, arg_11):  # pylint: disable=missing-docstring
      arg_12, arg_13, arg_14 = arg_0(arg_1)
      arg_1, arg_10, arg_15 = Func_one_step(
          gradient_unregularized_loss=arg_12,
          hessian_unregularized_loss_outer=arg_13,
          hessian_unregularized_loss_middle=arg_14,
          arg_1=arg_1,
          arg_3=arg_3,
          arg_4=arg_4,
          maximum_full_sweeps=arg_6,
          arg_2=arg_2,
          arg_7=arg_7)
      return arg_1, arg_10, arg_11 + 1

    return tf.while_loop(
        cond=_loop_cond,
        body=_loop_body,
        loop_vars=[
            arg_1,
            tf.zeros([], np.bool, arg_8='converged'),
            tf.zeros([], np.int32, arg_8='iter'),
        ])

Minimize using Hessian-informed proximal gradient descent.

  This function solves the regularized minimization problem

  ```none
  argmin{ Loss(x)
            + l1_regularizer * ||x||_1
            + l2_regularizer * ||x||_2**2
          : x in R^n }
  ```

  where `Loss` is a convex C^2 function (typically, `Loss` is the negative log
  likelihood of a model and `x` is a vector of model coefficients).  The `Loss`
  function does not need to be supplied directly, but this optimizer does need a
  way to compute the gradient and Hessian of the Loss function at a given value
  of `x`.  The gradient and Hessian are often computationally expensive, and
  this optimizer calls them relatively few times compared with other algorithms.

  Args:
    grad_and_hessian_loss_fn: callable that takes as input a (batch of) `Tensor`
      of the same shape and dtype as `x_start` and returns the triple
      `(gradient_unregularized_loss, hessian_unregularized_loss_outer,
      hessian_unregularized_loss_middle)` as defined in the argument spec of
      `minimize_one_step`.
    x_start: (Batch of) vector-shaped, `float` `Tensor` representing the initial
      value of the argument to the `Loss` function.
    tolerance: scalar, `float` `Tensor` representing the tolerance for each
      optimization step; see the `tolerance` argument of
      `minimize_one_step`.
    l1_regularizer: scalar, `float` `Tensor` representing the weight of the L1
      regularization term (see equation above).
    l2_regularizer: scalar, `float` `Tensor` representing the weight of the L2
      regularization term (see equation above).
      Default value: `None` (i.e., no L2 regularization).
    maximum_iterations: Python integer specifying the maximum number of
      iterations of the outer loop of the optimizer.  After this many iterations
      of the outer loop, the algorithm will terminate even if the return value
      `optimal_x` has not converged.
      Default value: `1`.
    maximum_full_sweeps_per_iteration: Python integer specifying the maximum
      number of sweeps allowed in each iteration of the outer loop of the
      optimizer.  Passed as the `maximum_full_sweeps` argument to
      `minimize_one_step`.
      Default value: `1`.
    learning_rate: scalar, `float` `Tensor` representing a multiplicative factor
      used to dampen the proximal gradient descent steps.
      Default value: `None` (i.e., factor is conceptually `1`).
    name: Python string representing the name of the TensorFlow operation.
      The default name is `"minimize"`.

  Returns:
    x: `Tensor` of the same shape and dtype as `x_start`, representing the
      (batches of) computed values of `x` which minimizes `Loss(x)`.
    is_converged: scalar, `bool` `Tensor` indicating whether the minimization
      procedure converged within the specified number of iterations across all
      batches.  Here convergence means that an iteration of the inner loop
      (`minimize_one_step`) returns `True` for its `is_converged` output value.
    iter: scalar, `int` `Tensor` indicating the actual number of iterations of
      the outer loop of the optimizer completed (i.e., number of calls to
      `minimize_one_step` before achieving convergence).

  #### References

  [1]: Jerome Friedman, Trevor Hastie and Rob Tibshirani. Regularization Paths
       for Generalized Linear Models via Coordinate Descent. _Journal of
       Statistical Software_, 33(1), 2010.
       https://www.jstatsoft.org/article/view/v033i01/v33i01.pdf

  [2]: Guo-Xun Yuan, Chia-Hua Ho and Chih-Jen Lin. An Improved GLMNET for
       L1-regularized Logistic Regression. _Journal of Machine Learning
       Research_, 13, 2012.
       http://www.jmlr.org/papers/volume13/yuan12a/yuan12a.pdf

Minimize using Hessian - informed proximal gradient descent .


def Func(arg_0):
    """Returns the lowest bit num from a given bit pattern. Returns None if no
    bits set.

    :param bit_pattern: The bit pattern.
    :type bit_pattern: int
    :returns: int -- the bit number
    :returns: None -- no bits set

    >>> pifacecommon.core.Func(0)
    None
    >>> pifacecommon.core.Func(0b1)
    0
    >>> pifacecommon.core.Func(0b11000)
    3
    """
    if arg_0 == 0:
        return None

    arg_1 = 0  # assume bit 0
    while (arg_0 & 1) == 0:
        arg_0 = arg_0 >> 1
        arg_1 += 1
        if arg_1 > 7:
            arg_1 = 0
            break

    return arg_1

Returns the lowest bit num from a given bit pattern. Returns None if no
    bits set.

    :param bit_pattern: The bit pattern.
    :type bit_pattern: int
    :returns: int -- the bit number
    :returns: None -- no bits set

    >>> pifacecommon.core.get_bit_num(0)
    None
    >>> pifacecommon.core.get_bit_num(0b1)
    0
    >>> pifacecommon.core.get_bit_num(0b11000)
    3

Returns the lowest bit num from a given bit pattern . Returns None if no bits set .


def Func(arg_0, arg_1):
        """Set the focus to position or raise IndexError."""
        arg_0._focus_position = arg_1
        arg_0._modified()
        # If we set focus to anywhere but the last position, the user if
        # scrolling up:
        try:
            arg_0.next_position(arg_1)
        except IndexError:
            arg_0._is_scrolling = False
        else:
            arg_0._is_scrolling = True

Set the focus to position or raise IndexError .


(self, internal_id, sanger_recipient=None, coverage_cutoff=None,
                         frequency_cutoff=None, display_name=None, remove_sanger=None,
                         phenotype_groups=None, group_abbreviations=None, add_groups=None)

def Func(arg_0, arg_1, arg_2=None, arg_3=None,
                         arg_4=None, arg_5=None, arg_6=None,
                         arg_7=None, arg_8=None, arg_9=None):
        """Update the information for an institute

        Args:
            internal_id(str): The internal institute id
            sanger_recipient(str): Email adress to add for sanger order
            coverage_cutoff(int): Update coverage cutoff
            frequency_cutoff(float): New frequency cutoff
            display_name(str): New display name
            remove_sanger(str): Email adress for sanger user to be removed
            phenotype_groups(iterable(str)): New phenotype groups
            group_abbreviations(iterable(str))
            add_groups: If groups should be added. If False replace groups

        Returns:
            updated_institute(dict)

        """
        arg_9 = arg_9 or False
        arg_10 = arg_0.institute(arg_1)
        if not arg_10:
            raise IntegrityError("Institute {} does not exist in database".format(arg_1))

        arg_11 = {}
        arg_12 = arg_10

        if arg_2:
            arg_13 = arg_0.user(arg_2)
            if not arg_13:
                raise IntegrityError("user {} does not exist in database".format(arg_2))

            LOG.info("Updating sanger recipients for institute: {0} with {1}".format(
                     arg_1, arg_2))
            arg_11['$push'] = {'sanger_recipients':arg_6}

        if arg_6:
            LOG.info("Removing sanger recipient {0} from institute: {1}".format(
                     arg_6, arg_1))
            arg_11['$pull'] = {'sanger_recipients':arg_6}

        if arg_3:
            LOG.info("Updating coverage cutoff for institute: {0} to {1}".format(
                            arg_1, arg_3))
            arg_11['$set'] = {'coverage_cutoff': arg_3}

        if arg_4:
            LOG.info("Updating frequency cutoff for institute: {0} to {1}".format(
                            arg_1, arg_4))
            if not '$set' in arg_11:
                arg_11['$set'] = {}
            arg_11['$set'] = {'frequency_cutoff': arg_4}

        if arg_5:
            LOG.info("Updating display name for institute: {0} to {1}".format(
                            arg_1, arg_5))
            if not '$set' in arg_11:
                arg_11['$set'] = {}
            arg_11['$set'] = {'display_name': arg_5}

        if arg_7:
            if arg_8:
                arg_8 = list(arg_8)
            arg_14 = {}
            if arg_9:
                arg_14 = arg_10.get('phenotype_groups', PHENOTYPE_GROUPS)

            for arg_15,arg_16 in enumerate(arg_7):
                arg_17 = arg_0.hpo_term(arg_16)
                if not arg_17:
                    raise IntegrityError("Term {} does not exist".format(arg_16))
                arg_18 = arg_17['hpo_id']
                arg_19 = arg_17['description']
                arg_20 = None
                if arg_8:
                    arg_20 = arg_8[arg_15]
                arg_14[arg_16] = {'name': arg_19, 'abbr':arg_20}
            arg_11['$set'] = {'phenotype_groups': arg_14}

        if arg_11:
            if not '$set' in arg_11:
                arg_11['$set'] = {}

            arg_11['$set']['updated_at'] = datetime.now()

            arg_12 = arg_0.institute_collection.find_one_and_update(
                {'_id':arg_1}, arg_11, return_document = pymongo.ReturnDocument.AFTER)

            LOG.info("Institute updated")

        return arg_12


(self, text=None, response=None, wait=None)

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = None ) : with arg_0 . driver . accept_modal ( "prompt" , arg_1 = arg_1 , arg_2 = arg_2 , arg_3 = arg_3 ) : yield

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):
        """
        Execute the wrapped code, accepting a prompt, optionally responding to the prompt.

        Args:
            text (str | RegexObject, optional): Text to match against the text in the modal.
            response (str, optional): Response to provide to the prompt.
            wait (int | float, optional): Maximum time to wait for the modal to appear after
                executing the wrapped code.

        Raises:
            ModalNotFound: If a modal dialog hasn't been found.
        """

        with arg_0.driver.accept_modal("prompt", arg_1=arg_1, arg_2=arg_2, arg_3=arg_3):
            yield

Execute the wrapped code accepting a prompt optionally responding to the prompt .


(in_file,
              out_file,
              start=None,
              end=None,
              vcodec=None,
              acodec=None,
              log_level='info',
              print_cmd=False,
              **kwargs)

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = None , arg_4 = None , arg_5 = None , arg_6 = 'info' , arg_7 = False , ** arg_8 ) : arg_9 = { 'log_level' : arg_6 } if arg_4 is None : arg_9 [ 'vcodec' ] = 'copy' if arg_5 is None : arg_9 [ 'acodec' ] = 'copy' if arg_2 : arg_9 [ 'ss' ] = arg_2 else : arg_2 = 0 if arg_3 : arg_9 [ 't' ] = arg_3 - arg_2 convert_video ( arg_0 , arg_1 , arg_7 , ** arg_9 )

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

    Args:
        in_file (str): Input video filename.
        out_file (str): Output video filename.
        start (None or float): Start time (in seconds).
        end (None or float): End time (in seconds).
        vcodec (None or str): Output video codec, None for unchanged.
        acodec (None or str): Output audio codec, None for unchanged.
        log_level (str): Logging level of ffmpeg.
        print_cmd (bool): Whether to print the final ffmpeg command.
    """
    arg_9 = {'log_level': arg_6}
    if arg_4 is None:
        arg_9['vcodec'] = 'copy'
    if arg_5 is None:
        arg_9['acodec'] = 'copy'
    if arg_2:
        arg_9['ss'] = arg_2
    else:
        arg_2 = 0
    if arg_3:
        arg_9['t'] = arg_3 - arg_2
    convert_video(arg_0, arg_1, arg_7, **arg_9)


def Func ( arg_0 ) : arg_0 . _follow [ arg_0 . start_symbol ] . add ( END_OF_INPUT ) while True : arg_1 = False for arg_2 , arg_3 in arg_0 . nonterminals . items ( ) : for arg_4 in arg_3 : for arg_5 , arg_6 in enumerate ( arg_4 . rhs ) : if arg_6 not in arg_0 . nonterminals : continue arg_7 = arg_0 . first ( arg_4 . rhs [ arg_5 + 1 : ] ) arg_8 = arg_7 - set ( [ EPSILON ] ) if EPSILON in arg_7 or arg_5 == ( len ( arg_4 . rhs ) - 1 ) : arg_8 |= arg_0 . _follow [ arg_2 ] if arg_8 - arg_0 . _follow [ arg_6 ] : arg_0 . _follow [ arg_6 ] |= arg_8 arg_1 = True if not arg_1 : break

def Func(arg_0):
        """Computes the FOLLOW set for every non-terminal in the grammar.

        Tenatively based on Func in PLY.
        """
        arg_0._follow[arg_0.start_symbol].add(END_OF_INPUT)

        while True:
            arg_1 = False

            for arg_2, arg_3 in arg_0.nonterminals.items():
                for arg_4 in arg_3:
                    for arg_5, arg_6 in enumerate(arg_4.rhs):
                        if arg_6 not in arg_0.nonterminals:
                            continue

                        arg_7 = arg_0.first(arg_4.rhs[arg_5 + 1:])
                        arg_8 = arg_7 - set([EPSILON])
                        if EPSILON in arg_7 or arg_5 == (len(arg_4.rhs) - 1):
                            arg_8 |= arg_0._follow[arg_2]

                        if arg_8 - arg_0._follow[arg_6]:
                            arg_0._follow[arg_6] |= arg_8
                            arg_1 = True

            if not arg_1:
                break

Computes the FOLLOW set for every non-terminal in the grammar.

        Tenatively based on _compute_follow in PLY.

Computes the FOLLOW set for every non - terminal in the grammar .


def Func ( ) : FuncDriver ( ISelenium , Selenium , class_implements = [ Firefox , Chrome , Ie , Edge , Opera , Safari , BlackBerry , PhantomJS , Android , Remote , EventFiringWebDriver , ] , )

def Func():
    """ Register the Selenium specific driver implementation.

        This Func call is performed by the init module if
        selenium is available.
    """
    FuncDriver(
        ISelenium,
        Selenium,
        class_implements=[
            Firefox,
            Chrome,
            Ie,
            Edge,
            Opera,
            Safari,
            BlackBerry,
            PhantomJS,
            Android,
            Remote,
            EventFiringWebDriver,
        ],
    )

Register the Selenium specific driver implementation.

        This register call is performed by the init module if
        selenium is available.

Register the Selenium specific driver implementation .


(self, join_streamlet, window_config, join_function)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : from heronpy . streamlet . impl . joinbolt import JoinStreamlet , JoinBolt arg_4 = JoinStreamlet ( JoinBolt . OUTER , arg_2 , arg_3 , arg_0 , arg_1 ) arg_0 . _add_child ( arg_4 ) arg_1 . _add_child ( arg_4 ) return arg_4

def Func(arg_0, arg_1, arg_2, arg_3):
    """Return a new Streamlet by outer join_streamlet with this streamlet
    """
    from heronpy.streamlet.impl.joinbolt import JoinStreamlet, JoinBolt

    arg_4 = JoinStreamlet(JoinBolt.OUTER, arg_2,
                                          arg_3, arg_0, arg_1)
    arg_0._add_child(arg_4)
    arg_1._add_child(arg_4)
    return arg_4


def Func(arg_0):
  """Retrieve the Engine-level model params from a Swarm model

  Args:
    modelID - Engine-level model ID of the Swarm model

  Returns:
    JSON-encoded string containing Model Params
  """

  # TODO: the use of nupic.frameworks.opf.helpers.loadExperimentDescriptionScriptFromDir when
  #  retrieving module params results in a leakage of pf_base_descriptionNN and
  #  pf_descriptionNN module imports for every call to Func, so
  #  the leakage is unlimited when Func is called by a
  #  long-running process.  An alternate solution is to execute the guts of
  #  this function's logic in a seprate process (via multiprocessing module).

  arg_1 = ClientJobsDAO.get()

  (arg_2, arg_3) = arg_1.modelsGetFields(
    arg_0,
    ["jobId", "genDescription"])

  (arg_4,) = arg_1.jobGetFields(arg_2, ["genBaseDescription"])

  # Construct a directory with base.py and description.py for loading model
  # params, and use nupic.frameworks.opf.helpers to extract model params from
  # those files
  arg_5 = tempfile.mkdtemp()
  try:
    arg_6 = os.path.join(arg_5, "base.py")
    with open(arg_6, mode="wb") as f:
      f.write(arg_4)

    arg_7 = os.path.join(arg_5, "description.py")
    with open(arg_7, mode="wb") as f:
      f.write(arg_3)

    arg_8 = helpers.getExperimentDescriptionInterfaceFromModule(
      helpers.loadExperimentDescriptionScriptFromDir(arg_5))

    return json.dumps(
      dict(
        modelConfig=arg_8.getModelDescription(),
        inferenceArgs=arg_8.getModelControl().get("inferenceArgs", None)))
  finally:
    shutil.rmtree(arg_5, ignore_errors=True)

Retrieve the Engine - level model params from a Swarm model


(input_size,
                    hidden_units=None,
                    input_order="left-to-right",
                    hidden_degrees="equal")

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
"left-to-right"
,
arg_3
=
"equal"
)
:
arg_2
=
_create_input_order
(
arg_0
,
arg_2
)
arg_4
=
[
arg_2
]
if
arg_1
is
:
arg_1
=
[
]
for
arg_5
in
arg_1
:
if
isinstance
(
arg_3
,
six
.
string_types
)
:
if
arg_3
==
"random"
:
arg_4
.
append
(
np
.
random
.
randint
(
low
=
min
(
np
.
min
(
arg_4
[
1
]
)
,
arg_0
1
)
,
high
=
arg_0
,
size
=
arg_5
)
)
elif
arg_3
==
"equal"
:
arg_6
=
min
(
np
.
min
(
arg_4
[
1
]
)
,
arg_0
1
)
arg_4
.
append
(
np
.
maximum
(
arg_6
,
np
.
ceil
(
np
.
arange
(
1
,
arg_5
+
1
)
*
(
arg_0
1
)
/
float
(
arg_5
+
1
)
)
.
astype
(
np
.
int32
)
)
)
else
:
raise
ValueError
(
'Invalid hidden order: "{}".'
.
format
(
arg_3
)
)
return
arg_4

def Func(arg_0,
                    arg_1=None,
                    arg_2="left-to-right",
                    arg_3="equal"):
  """Returns a list of degree vectors, one for each input and hidden layer.

  A unit with degree d can only receive input from units with degree < d. Output
  units always have the same degree as their associated input unit.

  Args:
    input_size: Number of inputs.
    hidden_units: list with the number of hidden units per layer. It does not
      include the output layer. Each hidden unit size must be at least the size
      of length (otherwise autoregressivity is not possible).
    input_order: Order of degrees to the input units: 'random', 'left-to-right',
      'right-to-left', or an array of an explicit order. For example,
      'left-to-right' builds an autoregressive model
      p(x) = p(x1) p(x2 | x1) ... p(xD | x<D).
    hidden_degrees: Method for assigning degrees to the hidden units:
      'equal', 'random'.  If 'equal', hidden units in each layer are allocated
      equally (up to a remainder term) to each degree.  Default: 'equal'.

  Raises:
    ValueError: invalid input order.
    ValueError: invalid hidden degrees.
  """
  arg_2 = _create_input_order(arg_0, arg_2)
  arg_4 = [arg_2]

  if arg_1 is None:
    arg_1 = []

  for arg_5 in arg_1:
    if isinstance(arg_3, six.string_types):
      if arg_3 == "random":
        # samples from: [low, high)
        arg_4.append(
            np.random.randint(low=min(np.min(arg_4[-1]), arg_0 - 1),
                              high=arg_0,
                              size=arg_5))
      elif arg_3 == "equal":
        arg_6 = min(np.min(arg_4[-1]), arg_0 - 1)
        arg_4.append(np.maximum(
            arg_6,
            # Evenly divide the range `[1, input_size - 1]` in to `units + 1`
            # segments, and pick the boundaries between the segments as degrees.
            np.ceil(np.arange(1, arg_5 + 1)
                    * (arg_0 - 1) / float(arg_5 + 1)).astype(np.int32)))
    else:
      raise ValueError('Invalid hidden order: "{}".'.format(arg_3))

  return arg_4

Returns a list of degree vectors one for each input and hidden layer .


(self, client_id, response_type, client, request,
                               *args, **kwargs)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 , * arg_5 , ** arg_6 ) : if arg_2 not in ( 'code' , 'token' ) : return False if hasattr ( arg_3 , 'allowed_response_types' ) : return arg_2 in arg_3 . allowed_response_types return True

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                               *arg_5, **arg_6):
        """Ensure client is authorized to use the response type requested.

        It will allow any of the two (`code`, `token`) response types by
        default. Implemented `allowed_response_types` for client object
        to authorize the request.
        """
        if arg_2 not in ('code', 'token'):
            return False

        if hasattr(arg_3, 'allowed_response_types'):
            return arg_2 in arg_3.allowed_response_types
        return True

Ensure client is authorized to use the response type requested .


return self.__decrypt(
            ciphertext,
            self.__skr.nextDecryptionKey(),
            header,
            ad
        )

def Func(arg_0, arg_1, arg_2, arg_3 = None):
        """
        Decrypt a message using this double ratchet session.

        :param ciphertext: A bytes-like object encoding the message to decrypt.
        :param header: An instance of the Header class. This should have been sent
            together with the ciphertext.
        :param ad: A bytes-like object encoding the associated data to use for message
            authentication. Pass None to use the associated data set during construction.
        :returns: The plaintext.

        :raises AuthenticationFailedException: If checking the authentication for this
            message failed.
        :raises NotInitializedException: If this double ratchet session is not yet
            initialized with a key pair, thus not prepared to decrypt an incoming message.
        :raises TooManySavedMessageKeysException: If more than message_key_store_max have
            to be stored to decrypt this message.
        """

        if arg_3 == None:
            arg_3 = arg_0.__ad

        # Try to decrypt the message using a previously saved message key
        arg_4 = arg_0.__decryptSavedMessage(arg_1, arg_2, arg_3)
        if arg_4:
            return arg_4

        # Check, whether the public key will trigger a dh ratchet step
        if arg_0.triggersStep(arg_2.dh_pub):
            # Save missed message keys for the current receiving chain
            arg_0.__saveMessageKeys(arg_2.pn)

            # Perform the step
            arg_0.step(arg_2.dh_pub)

        # Save missed message keys for the current receiving chain
        arg_0.__saveMessageKeys(arg_2.n)

        # Finally decrypt the message and return the plaintext
        return arg_0.__decrypt(
            arg_1,
            arg_0.__skr.nextDecryptionKey(),
            arg_2,
            arg_3
        )

Decrypt a message using this double ratchet session .


def Func(arg_0, arg_1):
        """ Returns dozscale and particle list of update """
        arg_2 = False
        arg_3 = []
        for arg_4 in listify(arg_1):
            arg_5, arg_6 = arg_0._p2i(arg_4)
            arg_3.append(arg_6)
            arg_2 = arg_2 or arg_5 == 'zscale'
        arg_3 = set(arg_3)
        return arg_2, arg_3


Asynchronous connection handler. Processes each line from the socket.

def Func ( arg_0 , arg_1 , * arg_2 ) : arg_0 . shell . stdout . write ( arg_0 . shell . prompt ) arg_3 = arg_0 . shell . stdin . readline ( ) if not len ( arg_3 ) : arg_3 = 'EOF' return False else : arg_3 = arg_3 . rstrip ( '\r\n' ) arg_3 = arg_0 . shell . precmd ( arg_3 ) arg_4 = arg_0 . shell . onecmd ( arg_3 ) arg_4 = arg_0 . shell . postcmd ( arg_4 , arg_3 ) arg_0 . shell . stdout . flush ( ) arg_0 . shell . postloop ( ) if arg_4 : arg_0 . shell = None arg_1 . close ( ) return not arg_4

def Func(arg_0, arg_1, *arg_2):
        '''
        Asynchronous connection Func. Processes each line from the socket.
        '''
        # lines from cmd.Cmd
        arg_0.shell.stdout.write(arg_0.shell.prompt)
        arg_3 = arg_0.shell.stdin.readline()
        if not len(arg_3):
            arg_3 = 'EOF'
            return False
        else:
            arg_3 = arg_3.rstrip('\r\n')
            arg_3 = arg_0.shell.precmd(arg_3)
            arg_4 = arg_0.shell.onecmd(arg_3)
            arg_4 = arg_0.shell.postcmd(arg_4, arg_3)
            arg_0.shell.stdout.flush()
            arg_0.shell.postloop()
            # end lines from cmd.Cmd
            if arg_4:
                arg_0.shell = None
                arg_1.close()
            return not arg_4

Asynchronous connection handler . Processes each line from the socket .


(data, batch_size, num_skips, skip_window, data_index=0)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=0):
    """Generate a training batch for the Skip-Gram model.

    See `Word2Vec example <https://github.com/tensorlayer/tensorlayer/blob/master/example/tutorial_word2vec_basic.py>`__.

    Parameters
    ----------
    data : list of data
        To present context, usually a list of integers.
    batch_size : int
        Batch size to return.
    num_skips : int
        How many times to reuse an input to generate a label.
    skip_window : int
        How many words to consider left and right.
    data_index : int
        Index of the context location. This code use `data_index` to instead of yield like ``tl.iterate``.

    Returns
    -------
    batch : list of data
        Inputs.
    labels : list of data
        Labels
    data_index : int
        Index of the context location.

    Examples
    --------
    Setting num_skips=2, skip_window=1, use the right and left words.
    In the same way, num_skips=4, skip_window=2 means use the nearby 4 words.

    >>> data = [1,2,3,4,5,6,7,8,9,10,11]
    >>> batch, labels, data_index = tl.nlp.Func(data=data, batch_size=8, num_skips=2, skip_window=1, data_index=0)
    >>> print(batch)
    [2 2 3 3 4 4 5 5]
    >>> print(labels)
    [[3]
    [1]
    [4]
    [2]
    [5]
    [3]
    [4]
    [6]]

    """
    # global data_index   # you can put data_index outside the function, then
    #       modify the global data_index in the function without return it.
    # note: without using yield, this code use data_index to instead.

    if arg_1 % arg_2 != 0:
        raise Exception("batch_size should be able to be divided by num_skips.")
    if arg_2 > 2 * arg_3:
        raise Exception("num_skips <= 2 * skip_window")
    arg_5 = np.ndarray(shape=(arg_1), dtype=np.int32)
    arg_6 = np.ndarray(shape=(arg_1, 1), dtype=np.int32)
    arg_7 = 2 * arg_3 + 1  # [ skip_window target skip_window ]
    arg_8 = collections.deque(maxlen=arg_7)
    for arg_9 in range(arg_7):
        arg_8.append(arg_0[arg_4])
        arg_4 = (arg_4 + 1) % len(arg_0)
    for arg_10 in range(arg_1 // arg_2):
        arg_11 = arg_3  # target label at the center of the buffer
        arg_12 = [arg_3]
        for arg_13 in range(arg_2):
            while arg_11 in arg_12:
                arg_11 = random.randint(0, arg_7 - 1)
            arg_12.append(arg_11)
            arg_5[arg_10 * arg_2 + arg_13] = arg_8[arg_3]
            arg_6[arg_10 * arg_2 + arg_13, 0] = arg_8[arg_11]
        arg_8.append(arg_0[arg_4])
        arg_4 = (arg_4 + 1) % len(arg_0)
    return arg_5, arg_6, arg_4

Generate a training batch for the Skip-Gram model.

    See `Word2Vec example <https://github.com/tensorlayer/tensorlayer/blob/master/example/tutorial_word2vec_basic.py>`__.

    Parameters
    ----------
    data : list of data
        To present context, usually a list of integers.
    batch_size : int
        Batch size to return.
    num_skips : int
        How many times to reuse an input to generate a label.
    skip_window : int
        How many words to consider left and right.
    data_index : int
        Index of the context location. This code use `data_index` to instead of yield like ``tl.iterate``.

    Returns
    -------
    batch : list of data
        Inputs.
    labels : list of data
        Labels
    data_index : int
        Index of the context location.

    Examples
    --------
    Setting num_skips=2, skip_window=1, use the right and left words.
    In the same way, num_skips=4, skip_window=2 means use the nearby 4 words.

    >>> data = [1,2,3,4,5,6,7,8,9,10,11]
    >>> batch, labels, data_index = tl.nlp.generate_skip_gram_batch(data=data, batch_size=8, num_skips=2, skip_window=1, data_index=0)
    >>> print(batch)
    [2 2 3 3 4 4 5 5]
    >>> print(labels)
    [[3]
    [1]
    [4]
    [2]
    [5]
    [3]
    [4]
    [6]]

Generate a training batch for the Skip - Gram model .


def Func(arg_0, arg_1=100):
        '''
        Will Func the entities that match at the time the query is executed.

        Used like::

            MyModel.query.filter(email=...).Func()
            MyModel.query.endswith(email='@host.com').Func()

        .. warning:: can't be used on models on either side of a ``OneToMany``,
            ``ManyToOne``, or ``OneToOne`` relationship.
        '''

        from .columns import MODELS_REFERENCED
        if not arg_0._model._no_fk or arg_0._model._namespace in MODELS_REFERENCED:
            raise QueryError("Can't Func entities of models with foreign key relationships")

        arg_2 = []
        arg_3 = 0
        for arg_4 in arg_0.iter_result(pagesize=arg_1):
            arg_2.append(arg_4)
            arg_3 += 1
            if arg_3 >= arg_1:
                session.Func(arg_2) # one round-trip to Func "chunk" items
                del arg_2[:]
                arg_3 = 0

        if arg_2:
            session.Func(arg_2)

Will delete the entities that match at the time the query is executed.

        Used like::

            MyModel.query.filter(email=...).delete()
            MyModel.query.endswith(email='@host.com').delete()

        .. warning:: can't be used on models on either side of a ``OneToMany``,
            ``ManyToOne``, or ``OneToOne`` relationship.

Will delete the entities that match at the time the query is executed .


def Func(arg_0, arg_1, arg_2):
        ''' Returns all of the items from queryset where the user has a
        product invoking that item's condition in one of their carts. '''

        arg_3 = Q(enabling_products__productitem__cart__user=arg_2)
        arg_4 = commerce.Cart.STATUS_RELEASED
        arg_5 = commerce.Cart.STATUS_PAID
        arg_6 = commerce.Cart.STATUS_ACTIVE
        arg_7 = Q(
            enabling_products__productitem__cart__status=arg_4
        )
        arg_8 = ~(
            Q(enabling_products__productitem__cart__status=arg_5) |
            Q(enabling_products__productitem__cart__status=arg_6)
        )

        arg_1 = arg_1.filter(arg_3)
        arg_1 = arg_1.exclude(
            arg_7 & arg_8
        )

        return arg_1

Returns all of the items from queryset where the user has a product invoking that item s condition in one of their carts .


def Func ( arg_0 , arg_1 , arg_2 , ** arg_3 ) : arg_4 = encode_invocation_params ( arg_2 ) arg_5 = arg_0 . _call ( JSONRPCMethods . INVOKE . value , [ arg_1 , arg_4 , ] , ** arg_3 ) return decode_invocation_result ( arg_5 )

def Func(arg_0, arg_1, arg_2, **arg_3):
        """ Invokes a contract with given parameters and returns the result.

        It should be noted that the name of the function Funcd in the contract should be part of
        paramaters.

        :param script_hash: contract script hash
        :param params: list of paramaters to be passed in to the smart contract
        :type script_hash: str
        :type params: list
        :return: result of the invocation
        :rtype: dictionary

        """
        arg_4 = encode_invocation_params(arg_2)
        arg_5 = arg_0._call(
            JSONRPCMethods.INVOKE.value, [arg_1, arg_4, ], **arg_3)
        return decode_invocation_result(arg_5)

Invokes a contract with given parameters and returns the result.

        It should be noted that the name of the function invoked in the contract should be part of
        paramaters.

        :param script_hash: contract script hash
        :param params: list of paramaters to be passed in to the smart contract
        :type script_hash: str
        :type params: list
        :return: result of the invocation
        :rtype: dictionary

Invokes a contract with given parameters and returns the result .


def
Func
(
arg_0
,
arg_1
=
False
,
arg_2
=
False
)
:
arg_3
=
"\n### ABF INFO ###\n"
arg_4
=
{
}
for
arg_5
in
sorted
(
dir
(
arg_0
)
)
:
if
arg_5
in
[
'cm'
,
'evIs'
,
'colormap'
,
'dataX'
,
'dataY'
,
'protoX'
,
'protoY'
]
:
continue
if
"_"
in
arg_5
:
continue
arg_6
=
getattr
(
arg_0
,
arg_5
)
if
type
(
arg_6
)
is
list
and
len
(
arg_6
)
>
5
:
continue
arg_7
=
str
(
type
(
arg_6
)
)
.
split
(
"'"
)
[
1
]
if
"method"
in
arg_7
or
"neo."
in
arg_7
:
continue
if
arg_5
in
[
"header"
,
"MT"
]
:
continue
arg_3
+=
"%s <%s> %s\n"
%
(
arg_5
,
arg_7
,
arg_6
)
arg_4
[
arg_5
]
=
arg_6
if
arg_1
:
print
(
)
for
arg_8
in
arg_3
.
split
(
"\n"
)
:
if
len
(
arg_8
)
<
3
:
continue
print
(
"   "
,
arg_8
)
print
(
)
if
arg_2
:
return
arg_4
return
arg_3

def Func(arg_0,arg_1=False,arg_2=False):
        """show basic info about ABF class variables."""
        arg_3="\n### ABF INFO ###\n"
        arg_4={}
        for arg_5 in sorted(dir(arg_0)):
            if arg_5 in ['cm','evIs','colormap','dataX','dataY',
                             'protoX','protoY']:
                continue
            if "_" in arg_5:
                continue
            arg_6=getattr(arg_0,arg_5)
            if type(arg_6) is list and len(arg_6)>5:
                continue
            arg_7=str(type(arg_6)).split("'")[1]
            if "method" in arg_7 or "neo." in arg_7:
                continue
            if arg_5 in ["header","MT"]:
                continue
            arg_3+="%s <%s> %s\n"%(arg_5,arg_7,arg_6)
            arg_4[arg_5]=arg_6
        if arg_1:
            print()
            for arg_8 in arg_3.split("\n"):
                if len(arg_8)<3:
                    continue
                print("   ",arg_8)
            print()
        if arg_2:
            return arg_4
        return arg_3

show basic info about ABF class variables .


def Func(arg_0):
    """
    Returns true if the host is reachable. In some cases, it may not be reachable a tunnel
    must be used.
    """
    for arg_1 in arg_0.hostportlist:
      try:
        socket.create_connection(arg_1, StateManager.TIMEOUT_SECONDS)
        return True
      except:
        LOG.info("StateManager %s Unable to connect to host: %s port %i"
                 % (arg_0.name, arg_1[0], arg_1[1]))
        continue
    return False

Returns true if the host is reachable . In some cases it may not be reachable a tunnel must be used .


(self, etype, value, tb, tb_offset=None, context=5)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=5):
        """Return formatted traceback.

        Subclasses may override this if they add extra arguments.
        """
        arg_6 = arg_0.structured_traceback(arg_1, arg_2, arg_3,
                                            arg_4, arg_5)
        return arg_0.stb2Func(arg_6)


def
Func
(
arg_0
,
arg_1
=
)
:
if
isinstance
(
arg_0
,
unicode
)
:
arg_0
=
arg_0
.
encode
(
'utf-8'
)
arg_2
=
QtGui
.
QFileDialog
(
arg_1
,
'Save SVG Document'
)
arg_2
.
setAcceptMode
(
QtGui
.
QFileDialog
.
AcceptSave
)
arg_2
.
setDefaultSuffix
(
'svg'
)
arg_2
.
setNameFilter
(
'SVG document (*.svg)'
)
if
arg_2
.
exec_
(
)
:
arg_3
=
arg_2
.
selectedFiles
(
)
[
0
]
arg_4
=
open
(
arg_3
,
'w'
)
try
:
arg_4
.
write
(
arg_0
)
finally
:
arg_4
.
close
(
)
return
arg_3
return

def Func(arg_0, arg_1=None):
    """ Prompts the user to save an SVG document to disk.

    Parameters:
    -----------
    string : basestring
        A Python string containing a SVG document.

    parent : QWidget, optional
        The parent to use for the file dialog.

    Returns:
    --------
    The name of the file to which the document was saved, or None if the save
    was cancelled.
    """
    if isinstance(arg_0, unicode):
        arg_0 = arg_0.encode('utf-8')

    arg_2 = QtGui.QFileDialog(arg_1, 'Save SVG Document')
    arg_2.setAcceptMode(QtGui.QFileDialog.AcceptSave)
    arg_2.setDefaultSuffix('svg')
    arg_2.setNameFilter('SVG document (*.svg)')
    if arg_2.exec_():
        arg_3 = arg_2.selectedFiles()[0]
        arg_4 = open(arg_3, 'w')
        try:
            arg_4.write(arg_0)
        finally:
            arg_4.close()
        return arg_3
    return None

Prompts the user to save an SVG document to disk .


def Func(arg_0):
    """
    Decorator to log the shapes of input and output dataframes

    It considers all the dataframes passed either as arguments or keyword arguments as inputs
    and all the dataframes returned as outputs.
    """
    def decorator(arg_1):
        @wraps(arg_1)
        def wrapper(*arg_2, **arg_3):
            arg_4 = _get_dfs_shapes(*arg_2, **arg_3)
            arg_5 = arg_1(*arg_2, **arg_3)
            arg_6 = _get_dfs_shapes(arg_5)
            _Func(arg_0, arg_1.__name__, arg_4, arg_6)
            return arg_5
        return wrapper
    return decorator


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . get_item ( TableName = arg_1 , Key = { DYNAMODB_RUNID_ATTRIBUTE : { 'S' : arg_2 } } ) return arg_3 . get ( 'Item' ) is not None

def Func(arg_0, arg_1, arg_2):
    """Check if run_id is stored in DynamoDB table.
    Return True if run_id is stored or False otherwise.

    Arguments:
    dynamodb_client - boto3 DynamoDB client (not service)
    table_name - string representing existing table name
    run_id - string representing run_id to store
    """
    arg_3 = arg_0.get_item(
        TableName=arg_1,
        Key={
            DYNAMODB_RUNID_ATTRIBUTE: {
                'S': arg_2
            }
        }
    )
    return arg_3.get('Item') is not None

Check if run_id is stored in DynamoDB table . Return True if run_id is stored or False otherwise .


def Func(arg_0, arg_1, **arg_2):
        """Helper method to parse a full or partial path and
        return a full path as well as a dict containing path parts.

        Uses the following rules when processing the path:

            * If no domain, uses the current user's account domain
            * If no vault, uses the current user's personal vault.
            * If no path, uses '/' (vault root)

        Returns a tuple containing:

            * The validated full_path
            * A dictionary with the components:
                * domain: the domain of the vault
                * vault: the name of the vault, without domain
                * vault_full_path: domain:vault
                * path: the object path within the vault
                * parent_path: the parent path to the object
                * filename: the object's filename (if any)
                * full_path: the validated full path

        The following components may be overridden using kwargs:

            * vault
            * path

        Object paths (also known as "paths") must begin with a forward slash.

        The following path formats are supported:

            domain:vault:/path -> object "path" in the root of "domain:vault"
            domain:vault/path  -> object "path" in the root of "domain:vault"
            vault:/path        -> object "path" in the root of "vault"
            vault/path         -> object "path" in the root of "vault"
            ~/path             -> object "path" in the root of personal vault
            vault/             -> root of "vault"
            ~/                 -> root of your personal vault

        The following two formats are not supported:

            path               -> invalid/ambiguous path (exception)
            vault:path         -> invalid/ambiguous path (exception)
            vault:path/path    -> unsupported, interpreted as domain:vault/path

        """
        from solvebio.resource.vault import Vault

        arg_3 = arg_2.pop('client', None) or arg_0._client or client

        if not arg_1:
            raise Exception(
                'Invalid path: ',
                'Full path must be in one of the following formats: '
                '"vault:/path", "domain:vault:/path", or "~/path"')

        # Parse the vault's full_path, using overrides if any
        arg_4 = arg_2.get('vault') or arg_1
        try:
            arg_5, arg_6 = \
                Vault.Func(arg_4, client=arg_3)
        except Exception as err:
            raise Exception('Could not determine vault from "{0}": {1}'
                            .format(arg_4, err))

        if arg_2.get('path'):
            # Allow override of the object_path.
            arg_1 = '{0}:/{1}'.format(arg_5, arg_2['path'])

        arg_7 = arg_0.PATH_RE.match(arg_1)
        if arg_7:
            arg_8 = arg_7.groupdict()['path']
        else:
            raise Exception(
                'Cannot find a valid object path in "{0}". '
                'Full path must be in one of the following formats: '
                '"vault:/path", "domain:vault:/path", or "~/path"'
                .format(arg_1))

        # Remove double slashes
        arg_8 = re.sub('//+', '/', arg_8)
        if arg_8 != '/':
            # Remove trailing slash
            arg_8 = arg_8.rstrip('/')

        arg_6['path'] = arg_8
        # TODO: parent_path and filename
        arg_1 = '{domain}:{vault}:{path}'.format(**arg_6)
        arg_6['full_path'] = arg_1
        return arg_1, arg_6

Helper method to parse a full or partial path and return a full path as well as a dict containing path parts .


def Func(arg_0, arg_1, arg_2=0, arg_3=None):
    """Returns the lowest indices in each string in a column, where the provided substring is fully contained between within a
    sample. If the substring is not found, -1 is returned. It is the same as `str.find`.

    :param str sub: A substring to be found in the samples
    :param int start:
    :param int end:
    :returns: an expression containing the lowest indices specifying the start of the substring.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.index(sub="et")
    Expression = str_find(text, sub='et')
    Length: 5 dtype: int64 (expression)
    -----------------------------------
    0   3
    1   7
    2  -1
    3  -1
    4  -1
    """
    return str_find(arg_0, arg_1, arg_2, arg_3)

Returns the lowest indices in each string in a column where the provided substring is fully contained between within a sample . If the substring is not found - 1 is returned . It is the same as str . find .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_0 . _acceptButton . setEnabled ( True ) del arg_0 . _selected [ : ] arg_3 = arg_0 . _filesystemWidget . model ( ) . item ( arg_1 ) arg_0 . _selected . append ( arg_3 . path )

def Func(arg_0, arg_1, arg_2):
        '''Handle selection of item in listing.'''
        arg_0._acceptButton.setEnabled(True)
        del arg_0._selected[:]
        arg_3 = arg_0._filesystemWidget.model().item(arg_1)
        arg_0._selected.append(arg_3.path)


return '{host}{athlete}/activity/{filename}'.format(
            host=self.host,
            athlete=quote_plus(athlete),
            filename=filename
        )

def Func ( arg_0 , arg_1 , arg_2 ) : return '{host}{athlete}/activity/{filename}' . format ( host = arg_0 . host , arg_1 = quote_plus ( arg_1 ) , arg_2 = arg_2 )

def Func(arg_0, arg_1, arg_2):
        """Construct activity endpoint from host, athlete name and filename

        Keyword arguments:
        athlete -- Full athlete name
        filename -- filename of request activity (e.g. \'2015_04_29_09_03_16.json\')
        """
        return '{host}{athlete}/activity/{filename}'.format(
            host=arg_0.host,
            arg_1=quote_plus(arg_1),
            arg_2=arg_2
        )

Construct activity endpoint from host athlete name and filename


def Func ( ) : arg_0 = parse_options ( ) arg_1 , arg_2 = create_output ( get_status ( arg_0 ) , arg_0 ) sys . stdout . write ( arg_1 ) sys . exit ( arg_2 )

def Func():
    """
    Program Func.
    """

    arg_0 = parse_options()
    arg_1, arg_2 = create_output(get_status(arg_0), arg_0)
    sys.stdout.write(arg_1)
    sys.exit(arg_2)


(job, normal_bam, normal_bai, tumor_bam, tumor_bai, ref, ref_dict, fai, cosmic, dbsnp)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9):
    """
    Calls MuTect to perform variant analysis

    :param JobFunctionWrappingJob job: passed automatically by Toil
    :param str normal_bam: Normal BAM FileStoreID
    :param str normal_bai: Normal BAM index FileStoreID
    :param str tumor_bam: Tumor BAM FileStoreID
    :param str tumor_bai: Tumor BAM Index FileStoreID
    :param str ref: Reference genome FileStoreID
    :param str ref_dict: Reference dictionary FileStoreID
    :param str fai: Reference index FileStoreID
    :param str cosmic: Cosmic VCF FileStoreID
    :param str dbsnp: DBSNP VCF FileStoreID
    :return: MuTect output (tarball) FileStoreID
    :rtype: str
    """
    arg_10 = arg_0.fileStore.getLocalTempDir()
    arg_11 = [arg_1, arg_2, arg_3, arg_4, arg_5, arg_7, arg_6, arg_8, arg_9]
    arg_12 = ['normal.bam', 'normal.bai', 'tumor.bam', 'tumor.bai', 'ref.fasta',
                  'ref.fasta.fai', 'ref.dict', 'cosmic.vcf', 'dbsnp.vcf']
    for arg_13, arg_14 in zip(arg_11, arg_12):
        arg_0.fileStore.readGlobalFile(arg_13, os.path.join(arg_10, arg_14))
    # Call: MuTect
    arg_15 = ['--analysis_type', 'MuTect',
                  '--reference_sequence', 'ref.fasta',
                  '--cosmic', '/data/cosmic.vcf',
                  '--dbsnp', '/data/dbsnp.vcf',
                  '--input_file:normal', '/data/normal.bam',
                  '--input_file:tumor', '/data/tumor.bam',
                  '--tumor_lod', str(10),  # Taken from MC3 pipeline
                  '--initial_tumor_lod', str(4.0),  # Taken from MC3 pipeline
                  '--out', 'mutect.out',
                  '--coverage_file', 'mutect.cov',
                  '--vcf', 'mutect.vcf']
    dockerCall(arg_0=arg_0, workDir=arg_10, arg_15=arg_15,
               tool='quay.io/ucsc_cgl/mutect:1.1.7--e8bf09459cf0aecb9f55ee689c2b2d194754cbd3')
    # Write output to file store
    arg_16 = ['mutect.vcf', 'mutect.cov', 'mutect.out']
    arg_17 = [os.path.join(arg_10, x) for x in arg_16]
    tarball_files('mutect.tar.gz', file_paths=arg_17, output_dir=arg_10)
    return arg_0.fileStore.writeGlobalFile(os.path.join(arg_10, 'mutect.tar.gz'))


" <small><<var>this object can be used in a 'for' loop</var>></small>"

' <small><<var>this object may have extra field names</var>></small>'

"\g<1><small><<var>generator, use 'for' to traverse it</var>></small>"

def Func(arg_0):
    """
    Apply some HTML highlighting to the contents.
    This can't be done in the
    """
    # Escape text and apply some formatting.
    # To have really good highlighting, pprint would have to be re-implemented.
    arg_0 = escape(arg_0)
    arg_0 = arg_0.replace(' <iterator object>', " <<var>this object can be used in a 'for' loop</var>>")
    arg_0 = arg_0.replace(' <dynamic item>', ' <<var>this object may have extra field names</var>>')
    arg_0 = arg_0.replace(' <dynamic attribute>', ' <<var>this object may have extra field names</var>>')
    arg_0 = RE_PROXY.sub('\g<1><<var>proxy object</var>>', arg_0)
    arg_0 = RE_FUNCTION.sub('\g<1><<var>object method</var>>', arg_0)
    arg_0 = RE_GENERATOR.sub("\g<1><<var>generator, use 'for' to traverse it</var>>", arg_0)
    arg_0 = RE_OBJECT_ADDRESS.sub('\g<1><<var>\g<2> object</var>>', arg_0)
    arg_0 = RE_MANAGER.sub('\g<1><<var>manager, use .all to traverse it</var>>', arg_0)
    arg_0 = RE_CLASS_REPR.sub('\g<1><<var>\g<2> class</var>>', arg_0)

    # Since Django's WSGIRequest does a pprint like format for it's __repr__, make that styling consistent
    arg_0 = RE_REQUEST_FIELDNAME.sub('\g<1>:\n   \g<2>: ', arg_0)
    arg_0 = RE_REQUEST_CLEANUP1.sub('\g<1>', arg_0)
    arg_0 = RE_REQUEST_CLEANUP2.sub(')', arg_0)

    return mark_safe(arg_0)

Apply some HTML highlighting to the contents . This can t be done in the


def Func(arg_0, arg_1, arg_2, arg_3):
        """ Construct the point record by reading the points from the stream
        """
        arg_4 = arg_2.dtype
        arg_5 = bytearray(arg_1.read(arg_3 * arg_4.itemsize))

        try:
            arg_6 = np.frombuffer(arg_5, dtype=arg_4, arg_3=arg_3)
        except ValueError:
            arg_7 = arg_3 * arg_4.itemsize
            if len(arg_5) % arg_4.itemsize != 0:
                arg_8 = arg_7 - len(arg_5)
                raise_not_enough_bytes_error(
                    arg_7,
                    arg_8,
                    len(arg_5),
                    arg_4,
                )
            else:
                arg_9 = len(arg_5) // arg_4.itemsize
                logger.critical(
                    "Expected {} points, there are {} ({} missing)".format(
                        arg_3, arg_9, arg_3 - arg_9
                    )
                )
                arg_6 = np.frombuffer(
                    arg_5, dtype=arg_4, arg_3=arg_9
                )

        return arg_0(arg_6, arg_2)


def
Func
(
arg_0
,
arg_1
)
:
try
:
arg_2
=
arg_0
.
_year_info_pq
(
arg_1
,
'Offensive Coordinator'
)
(
'a'
)
if
arg_2
:
return
arg_2
.
attr
[
'href'
]
except
ValueError
:
return

def Func(arg_0, arg_1):
        """Returns the coach ID for the team's OC in a given year.

        :year: An int representing the year.
        :returns: A string containing the coach ID of the OC.
        """
        try:
            arg_2 = arg_0._year_info_pq(arg_1, 'Offensive Coordinator')('a')
            if arg_2:
                return arg_2.attr['href']
        except ValueError:
            return None

Returns the coach ID for the team s OC in a given year .


def Func ( arg_0 , arg_1 ) : arg_2 = { } for arg_3 , arg_4 in arg_0 . items ( ) : if isinstance ( arg_4 , dict ) : arg_5 = Func ( arg_4 , arg_1 ) for arg_6 , arg_7 in arg_5 . items ( ) : arg_8 = arg_3 + arg_1 + arg_6 arg_2 [ arg_8 ] = arg_7 else : arg_2 [ arg_3 ] = arg_4 return arg_2

def Func(arg_0, arg_1):
    """Flattens a nested dictionary.

    New keys are concatenations of nested keys with the `separator` in between.

    """
    arg_2 = {}
    for arg_3, arg_4 in arg_0.items():
        if isinstance(arg_4, dict):
            arg_5 = Func(arg_4, arg_1)
            for arg_6, arg_7 in arg_5.items():
                arg_8 = arg_3 + arg_1 + arg_6
                arg_2[arg_8] = arg_7
        else:
            arg_2[arg_3] = arg_4

    return arg_2


def
Func
(
arg_0
,
arg_1
=
)
:
if
arg_1
:
return
_Func_formats
.
get
(
arg_1
,
lambda
v
:
Func_fmt
(
v
,
arg_1
)
)
(
arg_0
)
arg_2
=
len
(
arg_0
)
if
19
<=
arg_2
<=
24
and
arg_0
[
3
]
==
" "
:
try
:
return
Func_d_b_Y_H_M_S
(
arg_0
)
except
(
KeyError
,
ValueError
,
OverflowError
)
:
pass
if
30
<=
arg_2
<=
31
:
try
:
return
Func_a__d_b_Y_H_M_S_z
(
arg_0
)
except
(
KeyError
,
ValueError
,
OverflowError
)
:
pass
if
arg_2
==
14
:
try
:
return
Func_YmdHMS
(
arg_0
)
except
(
ValueError
,
OverflowError
)
:
pass
try
:
return
Func_epoch
(
arg_0
)
except
ValueError
:
pass
return
Func_any
(
arg_0
)

def Func(arg_0, arg_1=None):
    """Parse a datetime to a unix Func.

    Uses fast custom parsing for common datetime formats or the slow dateutil
    parser for other formats. This is a trade off between ease of use and speed
    and is very useful for fast parsing of Func strings whose format may
    standard but varied or unknown prior to parsing.

    Common formats include:
        1 Feb 2010 12:00:00 GMT
        Mon, 1 Feb 2010 22:00:00 +1000
        20100201120000
        1383470155 (seconds since epoch)

    See the other Func_*() functions for more details.

    Args:
        value: A string representing a datetime.
        fmt: A Func format string like for time.strptime().

    Returns:
        The time in seconds since epoch as and integer for the value specified.
    """
    if arg_1:
        return _Func_formats.get(arg_1,
            lambda v: Func_fmt(v, arg_1)
        )(arg_0)

    arg_2 = len(arg_0)

    if 19 <= arg_2 <= 24 and arg_0[3] == " ":
        # '%d %b %Y %H:%M:%Sxxxx'
        try:
            return Func_d_b_Y_H_M_S(arg_0)
        except (KeyError, ValueError, OverflowError):
            pass

    if 30 <= arg_2 <= 31:
        # '%a, %d %b %Y %H:%M:%S %z'
        try:
            return Func_a__d_b_Y_H_M_S_z(arg_0)
        except (KeyError, ValueError, OverflowError):
            pass

    if arg_2 == 14:
        # '%Y%m%d%H%M%S'
        try:
            return Func_YmdHMS(arg_0)
        except (ValueError, OverflowError):
            pass

    # epoch Func
    try:
        return Func_epoch(arg_0)
    except ValueError:
        pass

    # slow version
    return Func_any(arg_0)

Parse a datetime to a unix timestamp.

    Uses fast custom parsing for common datetime formats or the slow dateutil
    parser for other formats. This is a trade off between ease of use and speed
    and is very useful for fast parsing of timestamp strings whose format may
    standard but varied or unknown prior to parsing.

    Common formats include:
        1 Feb 2010 12:00:00 GMT
        Mon, 1 Feb 2010 22:00:00 +1000
        20100201120000
        1383470155 (seconds since epoch)

    See the other timestamp_*() functions for more details.

    Args:
        value: A string representing a datetime.
        fmt: A timestamp format string like for time.strptime().

    Returns:
        The time in seconds since epoch as and integer for the value specified.


def Func ( arg_0 ) : return ast . arguments ( args = [ ast . arg ( arg = "self" ) ] , defaults = [ ] , kw_defaults = [ ] , kwonlyargs = [ ] , )

def Func(arg_0):
        """
        Return an argument list node that takes only ``self``.

        """

        return ast.arguments(
            args=[ast.arg(arg="self")],
            defaults=[],
            kw_defaults=[],
            kwonlyargs=[],
        )

Return an argument list node that takes only self .


def Func ( arg_0 ) : arg_0 . t . Func ( ) arg_0 . factory . FuncTrying ( ) arg_0 . connector . disconnect ( )

def Func(arg_0):
        """Stop this client.
        """
        arg_0.t.Func()
        arg_0.factory.FuncTrying()
        arg_0.connector.disconnect()


def Func ( arg_0 ) : if isinstance ( arg_0 , memoryview ) : if PY3 : return arg_0 . nbytes else : arg_1 = arg_0 . itemsize for arg_2 in arg_0 . shape : arg_1 *= arg_2 return arg_1 else : return len ( arg_0 )

def Func(arg_0):
    """Return byte-size of a memoryview or buffer."""
    if isinstance(arg_0, memoryview):
        if PY3:
            # py3 introduces nbytes attribute
            return arg_0.nbytes
        else:
            # compute nbytes on py2
            arg_1 = arg_0.itemsize
            for arg_2 in arg_0.shape:
                arg_1 *= arg_2
            return arg_1
    else:
        # not a memoryview, raw bytes/ py2 buffer
        return len(arg_0)

Return byte - size of a memoryview or buffer .


def Func ( arg_0 ) : models . DataItem . create ( content = '' . join ( random . choice ( string . ascii_uppercase + string . digits ) for arg_1 in range ( 20 ) ) ) return muffin . HTTPFound ( '/' )

def Func(arg_0):
    """ Create a new DataItem. """
    models.DataItem.create(
        content=''.join(random.choice(string.ascii_uppercase + string.digits) for arg_1 in range(20))
    )
    return muffin.HTTPFound('/')


(self, _force=False, _exists_ok=False, **items)

def Func(arg_0, arg_1=False, arg_2=False, **arg_3):
        """
        Creates a db file with the core schema.

        :param force: If `True` an existing db file will be overwritten.
        """
        if arg_0.fname and arg_0.fname.exists():
            raise ValueError('db file already exists, use force=True to overFunc')

        with arg_0.connection() as db:
            for arg_4 in arg_0.tables:
                db.execute(arg_4.sql(translate=arg_0.translate))

            db.execute('PRAGMA foreign_keys = ON;')
            db.commit()

            arg_5 = defaultdict(list)  # collects rows in association tables.
            for arg_6 in arg_0.tables:
                if arg_6.name not in arg_3:
                    continue
                arg_7, arg_8 = [], []
                arg_9 = {c.name: c for c in arg_6.columns}
                for arg_10, arg_11 in enumerate(arg_3[arg_6.name]):
                    arg_12 = arg_11[arg_6.primary_key[0]] \
                        if arg_6.primary_key and len(arg_6.primary_key) == 1 else None
                    arg_13 = []
                    for arg_14, arg_15 in arg_11.items():
                        if arg_14 in arg_6.many_to_many:
                            assert arg_12
                            arg_16 = arg_6.many_to_many[arg_14]
                            arg_17 = tuple([arg_16.name] + [c.name for c in arg_16.columns])
                            for arg_18 in arg_15:
                                arg_19, arg_20 = arg_0.association_table_context(arg_6, arg_14, arg_18)
                                arg_5[arg_17].append((arg_12, arg_19, arg_20))
                        else:
                            arg_21 = arg_9[arg_14]
                            if isinstance(arg_15, list):
                                # Note: This assumes list-valued columns are of datatype string!
                                arg_15 = (arg_21.separator or ';').join(
                                    arg_21.convert(arg_18) for arg_18 in arg_15)
                            else:
                                arg_15 = arg_21.convert(arg_15) if arg_15 is not None else None
                            if arg_10 == 0:
                                arg_8.append(arg_21.name)
                            arg_13.append(arg_15)
                    arg_7.append(tuple(arg_13))
                insert(db, arg_0.translate, arg_6.name, arg_8, *arg_7)

            for arg_17, arg_7 in arg_5.items():
                insert(db, arg_0.translate, arg_17[0], arg_17[1:], *arg_7)

            db.commit()

Creates a db file with the core schema .


def Func ( arg_0 ) : if type ( arg_0 ) . __name__ != 'PE_PE' : arg_0 = one ( arg_0 ) . PE_PE [ 8001 ] ( ) if one ( arg_0 ) . C_C [ 8003 ] ( ) : return False arg_0 = one ( arg_0 ) . EP_PKG [ 8000 ] . PE_PE [ 8001 ] ( ) if not arg_0 : return True return Func ( arg_0 )

def Func(arg_0):
    '''
    Check if a PE_PE is globally defined, i.e. not inside a C_C
    '''
    if type(arg_0).__name__ != 'PE_PE':
        arg_0 = one(arg_0).PE_PE[8001]()

    if one(arg_0).C_C[8003]():
        return False

    arg_0 = one(arg_0).EP_PKG[8000].PE_PE[8001]()
    if not arg_0:
        return True

    return Func(arg_0)

Check if a PE_PE is globally defined i . e . not inside a C_C


def Func ( arg_0 ) : @ functools . wraps ( arg_0 ) def func ( arg_1 , * arg_2 ) : return arg_0 ( arg_1 . value , * arg_2 ) return func

def Func(arg_0):
  """Defers an operator overload to `attr`.

  Args:
    attr: Operator attribute to use.

  Returns:
    Function calling operator attribute.
  """
  @functools.wraps(arg_0)
  def func(arg_1, *arg_2):
    return arg_0(arg_1.value, *arg_2)
  return func


def Func ( arg_0 , arg_1 = None , arg_2 = 'utf8' ) : if not arg_0 : return arg_1 try : with io . open ( arg_0 , mode = 'r' , arg_2 = arg_2 ) as contents : return contents . Func ( ) except IOError : if arg_1 is not None : return arg_1 raise

def Func(arg_0, arg_1=None, arg_2='utf8'):
    """Read encoded contents from specified path or return default."""
    if not arg_0:
        return arg_1
    try:
        with io.open(arg_0, mode='r', arg_2=arg_2) as contents:
            return contents.Func()
    except IOError:
        if arg_1 is not None:
            return arg_1
        raise

Read encoded contents from specified path or return default .


def Func(arg_0, arg_1):
    """
    Make sure the value evaluates to boolean True.

    :param str config_val: The env var value.
    :param EnvironmentVariable evar: The EVar object we are validating
        a value for.
    :raises: ValueError if the config value evaluates to boolean False.
    """
    if arg_0 is None:
        raise ValueError(
            "Value for environment variable '{evar_name}' can't "
            "be empty.".format(evar_name=arg_1.name))
    return arg_0

Make sure the value evaluates to boolean True .


return int(re.findall(r"val: ([0-9a-fx]+)", stdout)[0], 16)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
)
:
arg_5
=
[
"nvm_addr Func"
,
arg_0
.
envs
[
"DEV_PATH"
]
,
"%d %d %d %d"
%
(
arg_1
,
arg_2
,
arg_3
,
arg_4
)
]
arg_6
,
arg_7
,
arg_8
=
cij
.
ssh
.
command
(
arg_5
,
shell
=
True
)
if
arg_6
:
raise
RuntimeError
(
"cij.liblight.Func: cmd fail"
)
return
int
(
re
.
findall
(
r"val: ([0-9a-fx]+)"
,
arg_7
)
[
0
]
,
16
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """S20 unit to generic address"""
        arg_5 = ["nvm_addr Func", arg_0.envs["DEV_PATH"],
               "%d %d %d %d" % (arg_1, arg_2, arg_3, arg_4)]
        arg_6, arg_7, arg_8 = cij.ssh.command(arg_5, shell=True)
        if arg_6:
            raise RuntimeError("cij.liblight.Func: cmd fail")

        return int(re.findall(r"val: ([0-9a-fx]+)", arg_7)[0], 16)


def
Func
(
arg_0
,
arg_1
)
:
assert
isinstance
(
arg_1
,
int
)
arg_0
.
max_in_flight
=
arg_1
if
arg_1
==
0
:
for
arg_2
in
itervalues
(
arg_0
.
conns
)
:
if
arg_2
.
rdy
>
0
:
logger
.
debug
(
'[%s:%s] rdy: %d -> 0'
,
arg_2
.
id
,
arg_0
.
name
,
arg_2
.
rdy
)
arg_0
.
_send_rdy
(
arg_2
,
0
)
arg_0
.
total_rdy
=
0
else
:
arg_0
.
need_rdy_redistributed
=
True
arg_0
.
_redistribute_rdy_state
(
)

def Func(arg_0, arg_1):
        """Dynamically adjust the reader max_in_flight. Set to 0 to immediately disable a Reader"""
        assert isinstance(arg_1, int)
        arg_0.max_in_flight = arg_1

        if arg_1 == 0:
            # set RDY 0 to all connections
            for arg_2 in itervalues(arg_0.conns):
                if arg_2.rdy > 0:
                    logger.debug('[%s:%s] rdy: %d -> 0', arg_2.id, arg_0.name, arg_2.rdy)
                    arg_0._send_rdy(arg_2, 0)
            arg_0.total_rdy = 0
        else:
            arg_0.need_rdy_redistributed = True
            arg_0._redistribute_rdy_state()

Dynamically adjust the reader max_in_flight . Set to 0 to immediately disable a Reader


def Func ( arg_0 , arg_1 = arg_2 ) : try : return reads ( b64decode ( arg_0 ) . decode ( 'utf-8' ) , arg_1 = arg_1 ) except Exception as e : raise CorruptedFile ( e )

def Func(arg_0, arg_1=arg_2):
    """
    Read a notebook from base64.
    """
    try:
        return reads(b64decode(arg_0).decode('utf-8'), arg_1=arg_1)
    except Exception as e:
        raise CorruptedFile(e)


def Func ( arg_0 , arg_1 ) : arg_2 = ImageDriver ( 'MEM' ) arg_3 = arg_2 . raster ( arg_2 . ShortName , arg_1 . size ) arg_3 . affine = arg_1 . affine arg_5 = arg_1 . sref if not arg_5 . srid : arg_5 = SpatialReference ( 4326 ) arg_3 . sref = arg_5 arg_6 = MemoryLayer ( arg_5 , arg_0 . GetGeomType ( ) ) arg_6 . load ( arg_0 ) arg_7 = gdal . RasterizeLayer ( arg_3 . ds , ( 1 , ) , arg_6 . layer , options = [ 'ATTRIBUTE=%s' % arg_6 . id ] ) arg_6 . close ( ) return arg_3

def Func(arg_0, arg_1):
    """Returns a Raster from layer features.

    Arguments:
    layer -- Layer to Func
    rast -- Raster with target affine, size, and sref
    """
    arg_2 = ImageDriver('MEM')
    arg_3 = arg_2.raster(arg_2.ShortName, arg_1.size)
    arg_3.affine = arg_1.affine
    arg_5 = arg_1.sref
    if not arg_5.srid:
        arg_5 = SpatialReference(4326)
    arg_3.sref = arg_5
    arg_6 = MemoryLayer(arg_5, arg_0.GetGeomType())
    arg_6.load(arg_0)
    arg_7 = gdal.RasterizeLayer(
        arg_3.ds, (1,), arg_6.layer, options=['ATTRIBUTE=%s' % arg_6.id])
    arg_6.close()
    return arg_3

Returns a Raster from layer features.

    Arguments:
    layer -- Layer to rasterize
    rast -- Raster with target affine, size, and sref


def Func ( arg_0 , arg_1 ) : if arg_1 . startswith ( '_' ) : return False try : arg_2 = getattr ( arg_0 , arg_1 ) except : return False if isroutine ( arg_2 ) : if getattr ( arg_2 , 'alters_data' , False ) : return False else : try : arg_3 = getargspec ( arg_2 ) arg_4 = len ( arg_3 . args ) if arg_3 . args else 0 arg_5 = len ( arg_3 . defaults ) if arg_3 . defaults else 0 if arg_4 - arg_5 > 1 : return False except TypeError : pass return True

def Func(arg_0, arg_1):
    """
    Given a variable and one of its attributes, determine if the attribute is
    accessible inside of a Django template and return True or False accordingly
    """
    # Remove private variables or methods
    if arg_1.startswith('_'):
        return False
    # Remove any attributes that raise an acception when read
    try:
        arg_2 = getattr(arg_0, arg_1)
    except:
        return False
    if isroutine(arg_2):
        # Remove any routines that are flagged with 'alters_data'
        if getattr(arg_2, 'alters_data', False):
            return False
        else:
            # Remove any routines that require arguments
            try:
                arg_3 = getargspec(arg_2)
                arg_4 = len(arg_3.args) if arg_3.args else 0
                arg_5 = len(arg_3.defaults) if arg_3.defaults else 0
                if arg_4 - arg_5 > 1:
                    return False
            except TypeError:
                # C extension callables are routines, but getargspec fails with
                # a TypeError when these are passed.
                pass
    return True

Given a variable and one of its attributes determine if the attribute is accessible inside of a Django template and return True or False accordingly


def Func(arg_0):
    '''
    Cast an arbitrary object or sequence to a number type
    '''
    if isinstance(arg_0, LiteralWrapper):
        arg_1 = arg_0.obj
    elif isinstance(arg_0, Iterable) and not isinstance(arg_0, str):
        arg_1 = next(arg_0, None)
    else:
        arg_1 = arg_0
    if arg_1 is None:
        #FIXME: Should be NaN, not 0
        yield 0
    elif isinstance(arg_1, str):
        yield float(arg_1)
    elif isinstance(arg_1, node):
        yield float(strval(arg_1))
    elif isinstance(arg_1, int) or isinstance(arg_1, float):
        yield arg_1
    else:
        raise RuntimeError('Unknown type for number conversion: {}'.format(arg_1))