-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: re-formats code according to black rules
Also removed extra comments in the file headers. Should make merging of existing PRs messy.
- Loading branch information
Showing
173 changed files
with
8,472 additions
and
8,453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,6 @@ | |
__author__ = "João Magalhães <[email protected]>" | ||
""" The author(s) of the module """ | ||
|
||
__version__ = "1.0.0" | ||
""" The version of the module """ | ||
|
||
__revision__ = "$LastChangedRevision$" | ||
""" The revision number of the module """ | ||
|
||
__date__ = "$LastChangedDate$" | ||
""" The last change date of the module """ | ||
|
||
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda." | ||
""" The copyright for the module """ | ||
|
||
|
@@ -41,24 +32,25 @@ | |
|
||
import netius | ||
|
||
def set(future, raise_e = True): | ||
if raise_e: future.set_exception(Exception("Awaiting error")) | ||
else: future.set_result(42) | ||
|
||
def set(future, raise_e=True): | ||
if raise_e: | ||
future.set_exception(Exception("Awaiting error")) | ||
else: | ||
future.set_result(42) | ||
|
||
|
||
@netius.coroutine | ||
def await_forever(): | ||
print("Awaiting forever") | ||
future = netius.build_future() | ||
thread = threading.Thread( | ||
target = set, | ||
args = (future,), | ||
kwargs = dict(raise_e = True) | ||
) | ||
thread = threading.Thread(target=set, args=(future,), kwargs=dict(raise_e=True)) | ||
thread.start() | ||
result = yield from future | ||
return result | ||
|
||
loop = netius.get_loop(_compat = True) | ||
|
||
loop = netius.get_loop(_compat=True) | ||
result = loop.run_until_complete(await_forever()) | ||
loop.close() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,6 @@ | |
__author__ = "João Magalhães <[email protected]>" | ||
""" The author(s) of the module """ | ||
|
||
__version__ = "1.0.0" | ||
""" The version of the module """ | ||
|
||
__revision__ = "$LastChangedRevision$" | ||
""" The revision number of the module """ | ||
|
||
__date__ = "$LastChangedDate$" | ||
""" The last change date of the module """ | ||
|
||
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda." | ||
""" The copyright for the module """ | ||
|
||
|
@@ -41,22 +32,23 @@ | |
|
||
import netius | ||
|
||
def set(future, raise_e = True): | ||
if raise_e: future.set_exception(Exception("Awaiting error")) | ||
else: future.set_result(42) | ||
|
||
def set(future, raise_e=True): | ||
if raise_e: | ||
future.set_exception(Exception("Awaiting error")) | ||
else: | ||
future.set_result(42) | ||
|
||
|
||
async def await_forever(): | ||
print("Awaiting forever") | ||
future = netius.build_future() | ||
thread = threading.Thread( | ||
target = set, | ||
args = (future,), | ||
kwargs = dict(raise_e = True) | ||
) | ||
thread = threading.Thread(target=set, args=(future,), kwargs=dict(raise_e=True)) | ||
thread.start() | ||
return await future | ||
|
||
loop = netius.get_loop(_compat = True) | ||
|
||
loop = netius.get_loop(_compat=True) | ||
result = loop.run_until_complete(await_forever()) | ||
loop.close() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,6 @@ | |
__author__ = "João Magalhães <[email protected]>" | ||
""" The author(s) of the module """ | ||
|
||
__version__ = "1.0.0" | ||
""" The version of the module """ | ||
|
||
__revision__ = "$LastChangedRevision$" | ||
""" The revision number of the module """ | ||
|
||
__date__ = "$LastChangedDate$" | ||
""" The last change date of the module """ | ||
|
||
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda." | ||
""" The copyright for the module """ | ||
|
||
|
@@ -41,23 +32,25 @@ | |
|
||
import netius | ||
|
||
def set(future, raise_e = True): | ||
if raise_e: future.set_exception(Exception("Awaiting error")) | ||
else: future.set_result(42) | ||
|
||
def set(future, raise_e=True): | ||
if raise_e: | ||
future.set_exception(Exception("Awaiting error")) | ||
else: | ||
future.set_result(42) | ||
|
||
|
||
@netius.coroutine | ||
def await_forever(): | ||
print("Awaiting forever") | ||
future = netius.build_future() | ||
thread = threading.Thread( | ||
target = set, | ||
args = (future,), | ||
kwargs = dict(raise_e = True) | ||
) | ||
thread = threading.Thread(target=set, args=(future,), kwargs=dict(raise_e=True)) | ||
thread.start() | ||
for value in future: yield value | ||
for value in future: | ||
yield value | ||
|
||
|
||
loop = netius.get_loop(_compat = True) | ||
loop = netius.get_loop(_compat=True) | ||
result = loop.run_until_complete(await_forever()) | ||
loop.close() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,6 @@ | |
__author__ = "João Magalhães <[email protected]>" | ||
""" The author(s) of the module """ | ||
|
||
__version__ = "1.0.0" | ||
""" The version of the module """ | ||
|
||
__revision__ = "$LastChangedRevision$" | ||
""" The revision number of the module """ | ||
|
||
__date__ = "$LastChangedDate$" | ||
""" The last change date of the module """ | ||
|
||
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda." | ||
""" The copyright for the module """ | ||
|
||
|
@@ -39,17 +30,20 @@ | |
|
||
import netius | ||
|
||
|
||
@netius.coroutine | ||
def compute(x, y): | ||
print("Compute %s + %s ..." % (x, y)) | ||
yield from netius.sleep(1.0) | ||
return x + y | ||
|
||
|
||
@netius.coroutine | ||
def print_sum(x, y): | ||
result = yield from compute(x, y) | ||
print("%s + %s = %s" % (x, y, result)) | ||
|
||
loop = netius.get_loop(_compat = True) | ||
|
||
loop = netius.get_loop(_compat=True) | ||
loop.run_until_complete(print_sum(1, 2)) | ||
loop.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,6 @@ | |
__author__ = "João Magalhães <[email protected]>" | ||
""" The author(s) of the module """ | ||
|
||
__version__ = "1.0.0" | ||
""" The version of the module """ | ||
|
||
__revision__ = "$LastChangedRevision$" | ||
""" The revision number of the module """ | ||
|
||
__date__ = "$LastChangedDate$" | ||
""" The last change date of the module """ | ||
|
||
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda." | ||
""" The copyright for the module """ | ||
|
||
|
@@ -41,17 +32,20 @@ | |
|
||
import netius | ||
|
||
|
||
@asyncio.coroutine | ||
def compute(x, y): | ||
print("Compute %s + %s ..." % (x, y)) | ||
yield from asyncio.sleep(1.0) | ||
return x + y | ||
|
||
|
||
@asyncio.coroutine | ||
def print_sum(x, y): | ||
result = yield from compute(x, y) | ||
print("%s + %s = %s" % (x, y, result)) | ||
|
||
loop = netius.get_loop(_compat = True) | ||
|
||
loop = netius.get_loop(_compat=True) | ||
loop.run_until_complete(print_sum(1, 2)) | ||
loop.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,6 @@ | |
__author__ = "João Magalhães <[email protected]>" | ||
""" The author(s) of the module """ | ||
|
||
__version__ = "1.0.0" | ||
""" The version of the module """ | ||
|
||
__revision__ = "$LastChangedRevision$" | ||
""" The revision number of the module """ | ||
|
||
__date__ = "$LastChangedDate$" | ||
""" The last change date of the module """ | ||
|
||
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda." | ||
""" The copyright for the module """ | ||
|
||
|
@@ -39,15 +30,18 @@ | |
|
||
import netius | ||
|
||
|
||
async def compute(x, y): | ||
print("Compute %s + %s ..." % (x, y)) | ||
await netius.sleep(1.0) | ||
return x + y | ||
|
||
|
||
async def print_sum(x, y): | ||
result = await compute(x, y) | ||
print("%s + %s = %s" % (x, y, result)) | ||
|
||
loop = netius.get_loop(_compat = True) | ||
|
||
loop = netius.get_loop(_compat=True) | ||
loop.run_until_complete(print_sum(1, 2)) | ||
loop.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,6 @@ | |
__author__ = "João Magalhães <[email protected]>" | ||
""" The author(s) of the module """ | ||
|
||
__version__ = "1.0.0" | ||
""" The version of the module """ | ||
|
||
__revision__ = "$LastChangedRevision$" | ||
""" The revision number of the module """ | ||
|
||
__date__ = "$LastChangedDate$" | ||
""" The last change date of the module """ | ||
|
||
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda." | ||
""" The copyright for the module """ | ||
|
||
|
@@ -39,19 +30,24 @@ | |
|
||
import netius | ||
|
||
|
||
@netius.coroutine | ||
def compute(future, x, y): | ||
print("Compute %s + %s ..." % (x, y)) | ||
for value in netius.sleep(1.0): yield value | ||
for value in netius.sleep(1.0): | ||
yield value | ||
future.set_result(x + y) | ||
|
||
|
||
@netius.coroutine | ||
def print_sum(x, y): | ||
future = netius.build_future() | ||
for value in compute(future, x, y): yield value | ||
for value in compute(future, x, y): | ||
yield value | ||
result = future.result() | ||
print("%s + %s = %s" % (x, y, result)) | ||
|
||
loop = netius.get_loop(_compat = True) | ||
|
||
loop = netius.get_loop(_compat=True) | ||
loop.run_until_complete(print_sum(1, 2)) | ||
loop.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,6 @@ | |
__author__ = "João Magalhães <[email protected]>" | ||
""" The author(s) of the module """ | ||
|
||
__version__ = "1.0.0" | ||
""" The version of the module """ | ||
|
||
__revision__ = "$LastChangedRevision$" | ||
""" The revision number of the module """ | ||
|
||
__date__ = "$LastChangedDate$" | ||
""" The last change date of the module """ | ||
|
||
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda." | ||
""" The copyright for the module """ | ||
|
||
|
@@ -39,13 +30,15 @@ | |
|
||
import netius | ||
|
||
|
||
@netius.coroutine | ||
def compute(x, y): | ||
print("Compute %s + %s ..." % (x, y)) | ||
yield from netius.sleep(1.0) | ||
return x + y | ||
|
||
loop = netius.get_loop(_compat = True) | ||
|
||
loop = netius.get_loop(_compat=True) | ||
result = loop.run_until_complete(compute(1, 2)) | ||
loop.close() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,6 @@ | |
__author__ = "João Magalhães <[email protected]>" | ||
""" The author(s) of the module """ | ||
|
||
__version__ = "1.0.0" | ||
""" The version of the module """ | ||
|
||
__revision__ = "$LastChangedRevision$" | ||
""" The revision number of the module """ | ||
|
||
__date__ = "$LastChangedDate$" | ||
""" The last change date of the module """ | ||
|
||
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda." | ||
""" The copyright for the module """ | ||
|
||
|
@@ -39,18 +30,21 @@ | |
|
||
import netius | ||
|
||
|
||
async def compute(x, y): | ||
result = None | ||
async for value in _compute(x, y): | ||
result = value | ||
return result | ||
|
||
|
||
async def _compute(x, y): | ||
print("Compute %s + %s ..." % (x, y)) | ||
await netius.sleep(1.0) | ||
yield x + y | ||
|
||
loop = netius.get_loop(_compat = True) | ||
|
||
loop = netius.get_loop(_compat=True) | ||
result = loop.run_until_complete(compute(1, 2)) | ||
loop.close() | ||
|
||
|
Oops, something went wrong.