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


Python six.advance_iterator方法代码示例

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


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

示例1: _iter_cached

# 需要导入模块: import six [as 别名]
# 或者: from six import advance_iterator [as 别名]
def _iter_cached(self):
        i = 0
        gen = self._cache_gen
        cache = self._cache
        acquire = self._cache_lock.acquire
        release = self._cache_lock.release
        while gen:
            if i == len(cache):
                acquire()
                if self._cache_complete:
                    break
                try:
                    for j in range(10):
                        cache.append(advance_iterator(gen))
                except StopIteration:
                    self._cache_gen = gen = None
                    self._cache_complete = True
                    break
                release()
            yield cache[i]
            i += 1
        while i < self._len:
            yield cache[i]
            i += 1 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:26,代码来源:rrule.py

示例2: __getitem__

# 需要导入模块: import six [as 别名]
# 或者: from six import advance_iterator [as 别名]
def __getitem__(self, item):
        if self._cache_complete:
            return self._cache[item]
        elif isinstance(item, slice):
            if item.step and item.step < 0:
                return list(iter(self))[item]
            else:
                return list(itertools.islice(self,
                                             item.start or 0,
                                             item.stop or sys.maxsize,
                                             item.step or 1))
        elif item >= 0:
            gen = iter(self)
            try:
                for i in range(item+1):
                    res = advance_iterator(gen)
            except StopIteration:
                raise IndexError
            return res
        else:
            return list(iter(self))[item] 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:23,代码来源:rrule.py

示例3: dstat_get_jobs

# 需要导入模块: import six [as 别名]
# 或者: from six import advance_iterator [as 别名]
def dstat_get_jobs(statuses=None,
                   job_ids=None,
                   task_ids=None,
                   labels=None,
                   create_time_min=None,
                   create_time_max=None):
  """Build up test parameters and call dstat.dstat_job_producer()."""

  statuses = statuses or {'*'}
  labels = labels or {}
  labels['test-token'] = test_setup.TEST_TOKEN
  labels['test-name'] = test_setup.TEST_NAME
  labels_set = {job_model.LabelParam(k, v) for (k, v) in labels.items()}

  return six.advance_iterator(
      dstat.dstat_job_producer(
          provider=get_dsub_provider(),
          statuses=statuses,
          job_ids=job_ids,
          task_ids=task_ids,
          labels=labels_set,
          create_time_min=create_time_min,
          create_time_max=create_time_max,
          full_output=True)) 
开发者ID:DataBiosphere,项目名称:dsub,代码行数:26,代码来源:e2e_python_api.py

示例4: __init__

# 需要导入模块: import six [as 别名]
# 或者: from six import advance_iterator [as 别名]
def __init__(self, chronology):
    """The chronology is a generator that updates the world.

    Yield how many seconds of fake time elapse. Think of each yield as a
    "sleep". We read the very first value immediately, so that the world can be
    initialized in the chronology.

    Args:
      chronology: a generator that updates the state of the world and then
      sleeps via yielding.
    """
    self._chronology = chronology
    # current fake time
    self._now = 0
    # time at which to wake up the chronology
    self._next = six.advance_iterator(self._chronology) 
开发者ID:DataBiosphere,项目名称:dsub,代码行数:18,代码来源:fake_time.py


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