Skip to content

Commit 5283937

Browse files
committed
refactor: code structure according to black
Ran black to re-structure the code layout. Removed some variable assignment that were not needed. Changed year references to 2024.
1 parent d7dd216 commit 5283937

File tree

179 files changed

+9210
-9168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+9210
-9168
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515

16-
*
16+
* Code structure to make it compliant with `black`
1717

1818
### Fixed
1919

examples/basic/future.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
# Hive Netius System
5-
# Copyright (c) 2008-2020 Hive Solutions Lda.
5+
# Copyright (c) 2008-2024 Hive Solutions Lda.
66
#
77
# This file is part of Hive Netius System.
88
#
@@ -22,16 +22,7 @@
2222
__author__ = "João Magalhães <[email protected]>"
2323
""" The author(s) of the module """
2424

25-
__version__ = "1.0.0"
26-
""" The version of the module """
27-
28-
__revision__ = "$LastChangedRevision$"
29-
""" The revision number of the module """
30-
31-
__date__ = "$LastChangedDate$"
32-
""" The last change date of the module """
33-
34-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
25+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
3526
""" The copyright for the module """
3627

3728
__license__ = "Apache License, Version 2.0"
@@ -41,24 +32,25 @@
4132

4233
import netius
4334

44-
def set(future, raise_e = True):
45-
if raise_e: future.set_exception(Exception("Awaiting error"))
46-
else: future.set_result(42)
35+
36+
def set(future, raise_e=True):
37+
if raise_e:
38+
future.set_exception(Exception("Awaiting error"))
39+
else:
40+
future.set_result(42)
41+
4742

4843
@netius.coroutine
4944
def await_forever():
5045
print("Awaiting forever")
5146
future = netius.build_future()
52-
thread = threading.Thread(
53-
target = set,
54-
args = (future,),
55-
kwargs = dict(raise_e = True)
56-
)
47+
thread = threading.Thread(target=set, args=(future,), kwargs=dict(raise_e=True))
5748
thread.start()
5849
result = yield from future
5950
return result
6051

61-
loop = netius.get_loop(_compat = True)
52+
53+
loop = netius.get_loop(_compat=True)
6254
result = loop.run_until_complete(await_forever())
6355
loop.close()
6456

examples/basic/future_neo.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
# Hive Netius System
5-
# Copyright (c) 2008-2020 Hive Solutions Lda.
5+
# Copyright (c) 2008-2024 Hive Solutions Lda.
66
#
77
# This file is part of Hive Netius System.
88
#
@@ -22,16 +22,7 @@
2222
__author__ = "João Magalhães <[email protected]>"
2323
""" The author(s) of the module """
2424

25-
__version__ = "1.0.0"
26-
""" The version of the module """
27-
28-
__revision__ = "$LastChangedRevision$"
29-
""" The revision number of the module """
30-
31-
__date__ = "$LastChangedDate$"
32-
""" The last change date of the module """
33-
34-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
25+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
3526
""" The copyright for the module """
3627

3728
__license__ = "Apache License, Version 2.0"
@@ -41,22 +32,23 @@
4132

4233
import netius
4334

44-
def set(future, raise_e = True):
45-
if raise_e: future.set_exception(Exception("Awaiting error"))
46-
else: future.set_result(42)
35+
36+
def set(future, raise_e=True):
37+
if raise_e:
38+
future.set_exception(Exception("Awaiting error"))
39+
else:
40+
future.set_result(42)
41+
4742

4843
async def await_forever():
4944
print("Awaiting forever")
5045
future = netius.build_future()
51-
thread = threading.Thread(
52-
target = set,
53-
args = (future,),
54-
kwargs = dict(raise_e = True)
55-
)
46+
thread = threading.Thread(target=set, args=(future,), kwargs=dict(raise_e=True))
5647
thread.start()
5748
return await future
5849

59-
loop = netius.get_loop(_compat = True)
50+
51+
loop = netius.get_loop(_compat=True)
6052
result = loop.run_until_complete(await_forever())
6153
loop.close()
6254

examples/basic/future_old.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
# Hive Netius System
5-
# Copyright (c) 2008-2020 Hive Solutions Lda.
5+
# Copyright (c) 2008-2024 Hive Solutions Lda.
66
#
77
# This file is part of Hive Netius System.
88
#
@@ -22,16 +22,7 @@
2222
__author__ = "João Magalhães <[email protected]>"
2323
""" The author(s) of the module """
2424

25-
__version__ = "1.0.0"
26-
""" The version of the module """
27-
28-
__revision__ = "$LastChangedRevision$"
29-
""" The revision number of the module """
30-
31-
__date__ = "$LastChangedDate$"
32-
""" The last change date of the module """
33-
34-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
25+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
3526
""" The copyright for the module """
3627

3728
__license__ = "Apache License, Version 2.0"
@@ -41,23 +32,25 @@
4132

4233
import netius
4334

44-
def set(future, raise_e = True):
45-
if raise_e: future.set_exception(Exception("Awaiting error"))
46-
else: future.set_result(42)
35+
36+
def set(future, raise_e=True):
37+
if raise_e:
38+
future.set_exception(Exception("Awaiting error"))
39+
else:
40+
future.set_result(42)
41+
4742

4843
@netius.coroutine
4944
def await_forever():
5045
print("Awaiting forever")
5146
future = netius.build_future()
52-
thread = threading.Thread(
53-
target = set,
54-
args = (future,),
55-
kwargs = dict(raise_e = True)
56-
)
47+
thread = threading.Thread(target=set, args=(future,), kwargs=dict(raise_e=True))
5748
thread.start()
58-
for value in future: yield value
49+
for value in future:
50+
yield value
51+
5952

60-
loop = netius.get_loop(_compat = True)
53+
loop = netius.get_loop(_compat=True)
6154
result = loop.run_until_complete(await_forever())
6255
loop.close()
6356

examples/basic/loop.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
# Hive Netius System
5-
# Copyright (c) 2008-2020 Hive Solutions Lda.
5+
# Copyright (c) 2008-2024 Hive Solutions Lda.
66
#
77
# This file is part of Hive Netius System.
88
#
@@ -22,34 +22,28 @@
2222
__author__ = "João Magalhães <[email protected]>"
2323
""" The author(s) of the module """
2424

25-
__version__ = "1.0.0"
26-
""" The version of the module """
27-
28-
__revision__ = "$LastChangedRevision$"
29-
""" The revision number of the module """
30-
31-
__date__ = "$LastChangedDate$"
32-
""" The last change date of the module """
33-
34-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
25+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
3526
""" The copyright for the module """
3627

3728
__license__ = "Apache License, Version 2.0"
3829
""" The license for the module """
3930

4031
import netius
4132

33+
4234
@netius.coroutine
4335
def compute(x, y):
4436
print("Compute %s + %s ..." % (x, y))
4537
yield from netius.sleep(1.0)
4638
return x + y
4739

40+
4841
@netius.coroutine
4942
def print_sum(x, y):
5043
result = yield from compute(x, y)
5144
print("%s + %s = %s" % (x, y, result))
5245

53-
loop = netius.get_loop(_compat = True)
46+
47+
loop = netius.get_loop(_compat=True)
5448
loop.run_until_complete(print_sum(1, 2))
5549
loop.close()

examples/basic/loop_asyncio.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
# Hive Netius System
5-
# Copyright (c) 2008-2020 Hive Solutions Lda.
5+
# Copyright (c) 2008-2024 Hive Solutions Lda.
66
#
77
# This file is part of Hive Netius System.
88
#
@@ -22,16 +22,7 @@
2222
__author__ = "João Magalhães <[email protected]>"
2323
""" The author(s) of the module """
2424

25-
__version__ = "1.0.0"
26-
""" The version of the module """
27-
28-
__revision__ = "$LastChangedRevision$"
29-
""" The revision number of the module """
30-
31-
__date__ = "$LastChangedDate$"
32-
""" The last change date of the module """
33-
34-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
25+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
3526
""" The copyright for the module """
3627

3728
__license__ = "Apache License, Version 2.0"
@@ -41,17 +32,20 @@
4132

4233
import netius
4334

35+
4436
@asyncio.coroutine
4537
def compute(x, y):
4638
print("Compute %s + %s ..." % (x, y))
4739
yield from asyncio.sleep(1.0)
4840
return x + y
4941

42+
5043
@asyncio.coroutine
5144
def print_sum(x, y):
5245
result = yield from compute(x, y)
5346
print("%s + %s = %s" % (x, y, result))
5447

55-
loop = netius.get_loop(_compat = True)
48+
49+
loop = netius.get_loop(_compat=True)
5650
loop.run_until_complete(print_sum(1, 2))
5751
loop.close()

examples/basic/loop_neo.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
# Hive Netius System
5-
# Copyright (c) 2008-2020 Hive Solutions Lda.
5+
# Copyright (c) 2008-2024 Hive Solutions Lda.
66
#
77
# This file is part of Hive Netius System.
88
#
@@ -22,32 +22,26 @@
2222
__author__ = "João Magalhães <[email protected]>"
2323
""" The author(s) of the module """
2424

25-
__version__ = "1.0.0"
26-
""" The version of the module """
27-
28-
__revision__ = "$LastChangedRevision$"
29-
""" The revision number of the module """
30-
31-
__date__ = "$LastChangedDate$"
32-
""" The last change date of the module """
33-
34-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
25+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
3526
""" The copyright for the module """
3627

3728
__license__ = "Apache License, Version 2.0"
3829
""" The license for the module """
3930

4031
import netius
4132

33+
4234
async def compute(x, y):
4335
print("Compute %s + %s ..." % (x, y))
4436
await netius.sleep(1.0)
4537
return x + y
4638

39+
4740
async def print_sum(x, y):
4841
result = await compute(x, y)
4942
print("%s + %s = %s" % (x, y, result))
5043

51-
loop = netius.get_loop(_compat = True)
44+
45+
loop = netius.get_loop(_compat=True)
5246
loop.run_until_complete(print_sum(1, 2))
5347
loop.close()

examples/basic/loop_old.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
# Hive Netius System
5-
# Copyright (c) 2008-2020 Hive Solutions Lda.
5+
# Copyright (c) 2008-2024 Hive Solutions Lda.
66
#
77
# This file is part of Hive Netius System.
88
#
@@ -22,36 +22,32 @@
2222
__author__ = "João Magalhães <[email protected]>"
2323
""" The author(s) of the module """
2424

25-
__version__ = "1.0.0"
26-
""" The version of the module """
27-
28-
__revision__ = "$LastChangedRevision$"
29-
""" The revision number of the module """
30-
31-
__date__ = "$LastChangedDate$"
32-
""" The last change date of the module """
33-
34-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
25+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
3526
""" The copyright for the module """
3627

3728
__license__ = "Apache License, Version 2.0"
3829
""" The license for the module """
3930

4031
import netius
4132

33+
4234
@netius.coroutine
4335
def compute(future, x, y):
4436
print("Compute %s + %s ..." % (x, y))
45-
for value in netius.sleep(1.0): yield value
37+
for value in netius.sleep(1.0):
38+
yield value
4639
future.set_result(x + y)
4740

41+
4842
@netius.coroutine
4943
def print_sum(x, y):
5044
future = netius.build_future()
51-
for value in compute(future, x, y): yield value
45+
for value in compute(future, x, y):
46+
yield value
5247
result = future.result()
5348
print("%s + %s = %s" % (x, y, result))
5449

55-
loop = netius.get_loop(_compat = True)
50+
51+
loop = netius.get_loop(_compat=True)
5652
loop.run_until_complete(print_sum(1, 2))
5753
loop.close()

0 commit comments

Comments
 (0)