Skip to content

Commit

Permalink
Replace range with six.moves.range.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtolson committed Oct 30, 2015
1 parent ccee0fd commit 827c994
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pysis/binning/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from collections import namedtuple
from itertools import izip
from abc import ABCMeta, abstractmethod
from six.moves import range


__all__ = [
Expand Down Expand Up @@ -61,7 +62,7 @@ def _iterkeys(bin):

def iterbounds(self):
"""An iterator over each bins bounds."""
for bin_num in xrange(self.num_bins):
for bin_num in range(self.num_bins):
yield self.get_bounds(bin_num)

def iterbins_bounds(self):
Expand Down
3 changes: 2 additions & 1 deletion pysis/binning/bounded.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

from bisect import bisect
from six.moves import range
from .abstract import AbstractBinnedKeys


Expand All @@ -19,7 +20,7 @@ def __init__(self, bounds):
self.max_value = bounds[-1]

self.num_bins = len(bounds) - 1
self.bins = [[] for _ in xrange(self.num_bins)]
self.bins = [[] for _ in range(self.num_bins)]

def get_bin_index(self, value):
"""Used to get the index of the bin to place a particular value."""
Expand Down
3 changes: 2 additions & 1 deletion pysis/binning/const_width.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

from math import ceil
from six.moves import range
from .abstract import AbstractBinnedKeys


Expand All @@ -24,7 +25,7 @@ def __init__(self, min_value, max_value, num_bins=None, max_bin_size=None):
self.num_bins = int(num_bins)

self.bin_size = (self.max_value - self.min_value) / self.num_bins
self.bins = [[] for _ in xrange(self.num_bins)]
self.bins = [[] for _ in range(self.num_bins)]

def get_bin_index(self, value):
"""Used to get the index of the bin to place a particular value."""
Expand Down
3 changes: 2 additions & 1 deletion pysis/binning/geometric.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

from math import log, ceil
from six.moves import range
from .abstract import AbstractBinnedKeys


Expand All @@ -24,7 +25,7 @@ def __init__(self, min_value, max_value):
self.max_value = pow(2.0, self.num_bins / 2.0) * self.min_value
self.num_bins = int(self.num_bins)

self.bins = [[] for _ in xrange(self.num_bins)]
self.bins = [[] for _ in range(self.num_bins)]

def get_bin_index(self, value):
"""Used to get the index of the bin to place a particular value."""
Expand Down

0 comments on commit 827c994

Please sign in to comment.