Skip to content

Commit

Permalink
Fixes for Python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrattli committed Dec 25, 2018
1 parent f1cecac commit 764df72
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
2 changes: 2 additions & 0 deletions pytest.ini
@@ -0,0 +1,2 @@
[pytest]
testpaths = tests
7 changes: 3 additions & 4 deletions rx/internal/enumerable.py
Expand Up @@ -3,7 +3,7 @@
from .basic import identity


class Enumerable(object):
class Enumerable:

def __init__(self, iterator):
self._iterator = iterator
Expand All @@ -24,11 +24,11 @@ def next():

for value in self:
if n <= 0:
raise StopIteration
return
n -= 1
yield value

raise StopIteration
return
return Enumerable(next())

@classmethod
Expand All @@ -41,7 +41,6 @@ def next():
value += 1
n -= 1

raise StopIteration
return Enumerable(next())

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions rx/linq/enumerable/whiledo.py
@@ -1,4 +1,4 @@
from rx.internal import Enumerable, Enumerator
from rx.internal import Enumerable
from rx.internal import extensionclassmethod

@extensionclassmethod(Enumerable)
Expand All @@ -7,6 +7,5 @@ def next():
while condition(source):
yield source

raise StopIteration()
return Enumerable(next())

1 change: 0 additions & 1 deletion rx/linq/observable/fromiterable.py
Expand Up @@ -34,7 +34,6 @@ def action(scheduler, state=None):
try:
with lock:
item = next(iterator)

except StopIteration:
observer.on_completed()
else:
Expand Down
7 changes: 4 additions & 3 deletions rx/linq/observable/selectmany.py
@@ -1,13 +1,14 @@
import collections

from rx import Observable
from rx.internal.utils import adapt_call
from rx.internal import extensionmethod
import collections


def _flat_map(source, selector):
def projection(x, i):
selector_result = selector(x, i)
if isinstance(selector_result, collections.Iterable):
if isinstance(selector_result, collections.abc.Iterable):
result = Observable.from_(selector_result)
else:
result = Observable.from_future(selector_result)
Expand Down Expand Up @@ -56,7 +57,7 @@ def select_many(self, selector, result_selector=None):
if result_selector:
def projection(x, i):
selector_result = selector(x, i)
if isinstance(selector_result, collections.Iterable):
if isinstance(selector_result, collections.abc.Iterable):
result = Observable.from_(selector_result)
else:
result = Observable.from_future(selector_result)
Expand Down
2 changes: 1 addition & 1 deletion rx/linq/observable/sequenceequal.py
Expand Up @@ -29,7 +29,7 @@ def sequence_equal(self, second, comparer=None):
first = self
comparer = comparer or default_comparer

if isinstance(second, collections.Iterable):
if isinstance(second, collections.abc.Iterable):
second = Observable.from_iterable(second)

def subscribe(observer):
Expand Down
1 change: 1 addition & 0 deletions rx/testing/testscheduler.py
Expand Up @@ -15,6 +15,7 @@ class TestScheduler(VirtualTimeScheduler):
"""Test time scheduler used for testing applications and libraries
built using Reactive Extensions. All time, both absolute and relative is
specified as integer ticks"""
__test__ = False

def __init__(self):
"""Initializes a new instance of the TestScheduler class."""
Expand Down
2 changes: 2 additions & 0 deletions tests/test_core/test_priorityqueue.py
Expand Up @@ -5,6 +5,8 @@


class TestItem():
__test__ = False

def __init__(self, value, label=None):
self.value = value
self.label = label
Expand Down

0 comments on commit 764df72

Please sign in to comment.