当前位置: 首页>>代码示例>>Python>>正文


Python builtins.next方法代码示例

本文整理汇总了Python中builtins.next方法的典型用法代码示例。如果您正苦于以下问题:Python builtins.next方法的具体用法?Python builtins.next怎么用?Python builtins.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在builtins的用法示例。


在下文中一共展示了builtins.next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init_pipeline_plugins

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def init_pipeline_plugins(plugin_dir):
    """
    Initialize the pipeline plugins which triggers the auto registering of user
    defined pipeline functions.
    1. Add the plugin_dir into sys.path.
    2. Import the file under plugin_dir that starts with "cce_plugin_" and ends
    with ".py"
    """
    if not op.isdir(plugin_dir):
        logger.warning("%s is not a directory! Pipeline plugin files won't be loaded.",
                       plugin_dir)
        return

    sys.path.append(plugin_dir)
    for file_name in next(walk(plugin_dir))[2]:
        if file_name == "__init__.py" or not file_name.startswith("cce_plugin_"):
            continue
        if file_name.endswith(".py"):
            import_plugin_file(file_name) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:21,代码来源:plugin.py

示例2: skip

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def skip(self, buffer_as, offset):
        """Skip uninteresting regions.

        Where should we go next? By default we go 1 byte ahead, but if some of
        the checkers have skippers, we may actually go much farther. Checkers
        with skippers basically tell us that there is no way they can match
        anything before the skipped result, so there is no point in trying them
        on all the data in between. This optimization is useful to really speed
        things up.
        """
        skip = 1
        for s in self.skippers:
            skip_value = s.skip(buffer_as, offset)
            skip = max(skip, skip_value)

        return skip 
开发者ID:google,项目名称:rekall,代码行数:18,代码来源:scan.py

示例3: scan

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def scan(self, offset=0, maxlen=None):
        available_length = maxlen or self.session.profile.get_constant(
            "MaxPointer")

        while available_length > 0:
            to_read = min(constants.SCAN_BLOCKSIZE + self.overlap,
                          available_length)

            # Now feed all the scanners from the same address space.
            for name, scanner in list(self.scanners.items()):
                for hit in scanner.scan(offset=offset, maxlen=to_read):
                    # Yield the result as well as cache it.
                    yield name, hit

            # Move to the next scan block.
            offset += constants.SCAN_BLOCKSIZE
            available_length -= constants.SCAN_BLOCKSIZE 
开发者ID:google,项目名称:rekall,代码行数:19,代码来源:scan.py

示例4: LookupIndex

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def LookupIndex(self):
        """Loookup the profile from an index."""
        try:
            index = self.session.LoadProfile(
                "%s/index" % self.plugin_args.module)
        except ValueError:
            return

        cc = self.session.plugins.cc()
        for session in self.session.plugins.sessions().session_spaces():
            # Switch the process context to this session so the address
            # resolver can find the correctly mapped driver.
            with cc:
                cc.SwitchProcessContext(next(iter(session.processes())))

                # Get the image base of the win32k module.
                image_base = self.session.address_resolver.get_address_by_name(
                    self.plugin_args.module)

                for profile, _ in index.LookupIndex(
                        image_base, minimal_match=self.plugin_args.minimal_match):
                    yield self.session.GetParameter("process_context"), profile 
开发者ID:google,项目名称:rekall,代码行数:24,代码来源:index.py

示例5: extractFromVolume

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def extractFromVolume(container_urn, volume, imageURNs, destFolder):
    printVolumeInfo(container_urn.original_filename, volume)
    resolver = volume.resolver
    for imageUrn in imageURNs:
        imageUrn = utils.SmartUnicode(imageUrn)

        pathName = next(resolver.QuerySubjectPredicate(volume.urn, imageUrn, volume.lexicon.pathName))

        with resolver.AFF4FactoryOpen(imageUrn) as srcStream:
            if destFolder != "-":
                pathName = escaping.arnPathFragment_from_path(pathName.value)
                while pathName.startswith("/"):
                    pathName = pathName[1:]
                destFile = os.path.join(destFolder, pathName)
                if not os.path.exists(os.path.dirname(destFile)):
                    try:
                        os.makedirs(os.path.dirname(destFile))
                    except OSError as exc:  # Guard against race condition
                        if exc.errno != errno.EEXIST:
                            raise
                with open(destFile, "wb") as destStream:
                    shutil.copyfileobj(srcStream, destStream, length=32 * 2014)
                    print("\tExtracted %s to %s" % (pathName, destFile))
            else:
                shutil.copyfileobj(srcStream, sys.stdout) 
开发者ID:aff4,项目名称:pyaff4,代码行数:27,代码来源:aff4.py

示例6: _get_or_insert_iam_binding

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def _get_or_insert_iam_binding(policy, role):
  """Return the binding corresponding to the given role. Creates the binding if
  needed."""
  existing_binding = next(
      (binding for binding in policy['bindings'] if binding['role'] == role),
      None)
  if existing_binding:
    return existing_binding

  new_binding = {
      'role': role,
      'members': [],
  }

  policy['bindings'].append(new_binding)
  return new_binding 
开发者ID:google,项目名称:clusterfuzz,代码行数:18,代码来源:service_accounts.py

示例7: get_filetype_by_name

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def get_filetype_by_name(self, name, tree):
        fileTypeRows = tree.findall('FileTypes/FileType')

        fileTypeRow = next((element for element in fileTypeRows if element.attrib.get('name') == name), None)
        if fileTypeRow is None:
            Logutil.log('Configuration error. FileType %s does not exist in config.xml' % name, util.LOG_LEVEL_ERROR)
            return None, util.localize(32005)

        fileType = FileType()
        fileType.name = name

        try:
            fileType.id = fileTypeRow.attrib.get('id')
            fileType.type = fileTypeRow.find('type').text
            fileType.parent = fileTypeRow.find('parent').text
        except KeyError:
            Logutil.log('Configuration error. FileType %s must have an id' % name, util.LOG_LEVEL_ERROR)
            return None, util.localize(32005)
        except AttributeError:
            pass

        return fileType, '' 
开发者ID:maloep,项目名称:romcollectionbrowser,代码行数:24,代码来源:config.py

示例8: is_abstract

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def is_abstract(self, pass_is_abstract=True):
        """return true if the method is abstract
        It's considered as abstract if the only statement is a raise of
        NotImplementError, or, if pass_is_abstract, a pass statement
        """
        for child_node in self.code.getChildNodes():
            if isinstance(child_node, Raise) and child_node.expr1:
                try:
                    name = next(child_node.expr1.nodes_of_class(Name))
                    if name.name == 'NotImplementedError':
                        return True
                except StopIteration:
                    pass
            if pass_is_abstract and isinstance(child_node, Pass):
                return True
            return False
        # empty function is the same as function with a single "pass" statement
        if pass_is_abstract:
            return True 
开发者ID:jlachowski,项目名称:clonedigger,代码行数:21,代码来源:scoped_nodes.py

示例9: infer_subscript

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def infer_subscript(self, context=None):
    """infer simple subscription such as [1,2,3][0] or (1,2,3)[-1]
    """
    if len(self.subs) == 1:
        index = next(self.subs[0].infer(context))
        if index is YES:
            yield YES
            return
        try:
            # suppose it's a Tuple/List node (attribute error else)
            assigned = self.expr.getitem(index.value)
        except AttributeError:
            raise InferenceError()
        except IndexError:
            yield YES
            return
        for infered in assigned.infer(context):
            yield infered
    else:
        raise InferenceError() 
开发者ID:jlachowski,项目名称:clonedigger,代码行数:22,代码来源:inference.py

示例10: __init__

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def __init__(self, methanalysis):
        method = methanalysis.get_method()
        self.method = method
        self.irmethod = None
        self.start_block = next(methanalysis.get_basic_blocks().get(), None)
        self.cls_name = method.get_class_name()
        self.name = method.get_name()
        self.lparams = []
        self.var_to_name = defaultdict()
        self.offset_to_node = {}
        self.graph = None

        self.access = util.get_access_method(method.get_access_flags())

        desc = method.get_descriptor()
        self.type = desc.split(')')[-1]
        self.params_type = util.get_params_type(desc)
        self.triple = method.get_triple()

        self.exceptions = methanalysis.exceptions.exceptions
        self.curret_block = None

        self.var_versions = defaultdict(int)

        code = self.method.get_code()
        if code:
            start = code.registers_size - code.ins_size
            if 'static' not in self.access:
                self.lparams.append(start)
                start += 1
            num_param = 0
            for ptype in self.params_type:
                param = start + num_param
                self.lparams.append(param)
                num_param += util.get_type_size(ptype)

        if DEBUG:
            from androguard.core import bytecode
            bytecode.method2png('graphs/%s#%s.png' % \
                                (self.cls_name.split('/')[-1][:-1], self.name),
                                methanalysis) 
开发者ID:amimo,项目名称:dcc,代码行数:43,代码来源:compiler.py

示例11: client_adatper

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def client_adatper(job_func):
    class TaDataClientAdapter(TaDataClient):
        def __init__(self, all_conf_contents, meta_config, task_config,
                     chp_mgr):
            super(TaDataClientAdapter, self).__init__(meta_config, task_config,
                                                      chp_mgr)
            self._execute_times = 0
            self._gen = job_func(self._task_config, chp_mgr)

        def stop(self):
            """
            overwrite to handle stop control command
            """

            # normaly base class just set self._stop as True
            super(TaDataClientAdapter, self).stop()

        def get(self):
            """
            overwrite to get events
            """
            self._execute_times += 1
            if self.is_stopped():
                # send stop signal
                self._gen.send(self.is_stopped())
                raise StopIteration
            if self._execute_times == 1:
                return next(self._gen)
            return self._gen.send(self.is_stopped())

    return TaDataClientAdapter 
开发者ID:remg427,项目名称:misp42splunk,代码行数:33,代码来源:ta_data_client.py

示例12: addinfo

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def addinfo(self):
        """ The purpose of this method is to populate the
        modular action info variable with the contents of info.csv.

        @raise Exception: raises Exception if self.info_file could not be opened
                          or if there were problems parsing the info.csv data
        """
        if self.info_file:
            try:
                with open(self.info_file, 'rU') as fh:
                    self.info = next(csv.DictReader(fh))
            except Exception as e:
                self.message('Could not retrieve info.csv', level=logging.WARN) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:15,代码来源:cim_actions.py

示例13: nextOrNone

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def nextOrNone(iterable):
    try:
        return next(iterable)
    except:
        return None 
开发者ID:aff4,项目名称:pyaff4,代码行数:7,代码来源:aff4.py

示例14: extractAllFromVolume

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def extractAllFromVolume(container_urn, volume, destFolder):
    printVolumeInfo(container_urn.original_filename, volume)
    resolver = volume.resolver
    for imageUrn in resolver.QueryPredicateObject(volume.urn, lexicon.AFF4_TYPE, lexicon.standard11.FileImage):
        imageUrn = utils.SmartUnicode(imageUrn)

        pathName = next(resolver.QuerySubjectPredicate(volume.urn, imageUrn, lexicon.standard11.pathName)).value
        if pathName.startswith("/"):
            pathName = "." + pathName
        with resolver.AFF4FactoryOpen(imageUrn) as srcStream:
            if destFolder != "-":
                destFile = os.path.join(destFolder, pathName)
                if not os.path.exists(os.path.dirname(destFile)):
                    try:
                        os.makedirs(os.path.dirname(destFile))
                    except OSError as exc:  # Guard against race condition
                        if exc.errno != errno.EEXIST:
                            raise
                with open(destFile, "wb") as destStream:
                    shutil.copyfileobj(srcStream, destStream)
                    print("\tExtracted %s to %s" % (pathName, destFile))

                lastWritten = nextOrNone(
                    resolver.QuerySubjectPredicate(volume.urn, imageUrn, lexicon.standard11.lastWritten))
                lastAccessed = nextOrNone(
                    resolver.QuerySubjectPredicate(volume.urn, imageUrn, lexicon.standard11.lastAccessed))
                recordChanged = nextOrNone(
                    resolver.QuerySubjectPredicate(volume.urn, imageUrn, lexicon.standard11.recordChanged))
                birthTime = nextOrNone(
                    resolver.QuerySubjectPredicate(volume.urn, imageUrn, lexicon.standard11.birthTime))
                logical.resetTimestamps(destFile, lastWritten, lastAccessed, recordChanged, birthTime)

            else:
                shutil.copyfileobj(srcStream, sys.stdout) 
开发者ID:aff4,项目名称:pyaff4,代码行数:36,代码来源:aff4.py

示例15: getDTB

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import next [as 别名]
def getDTB(self):
        # UGLY: At the moment, the CR3 returned by MacPMEM doesnt seem to work, so we need to rely on scanning
        # that being the case, we dont return the dtb if it is OSX

        kaslrSlide = list(self.resolver.QuerySubjectPredicate(self.urn, lexicon.standard.OSXKALSRSlide))
        if len(kaslrSlide) == 1 and int(kaslrSlide[0]) != 0:
            # it is Mac OS
            return 0
        else:
            try:
                dtb = next(self.resolver.QuerySubjectPredicate(self.urn, lexicon.standard.memoryPageTableEntryOffset))
                return int(dtb)
            except:
                # some early images generated by Rekall don't contain a CR3
                return 0 
开发者ID:aff4,项目名称:pyaff4,代码行数:17,代码来源:aff4.py


注:本文中的builtins.next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。