Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Commit 0d57510

Browse files
committed
[#145] Reformat core commands for PEP-8.
1 parent e5f3f82 commit 0d57510

16 files changed

+453
-472
lines changed
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
# coding=utf-8
22
from __future__ import absolute_import, division, print_function, \
3-
unicode_literals
3+
unicode_literals
44

55
import filters as f
66

77
from iota.commands import FilterCommand, RequestFilter
88
from iota.filters import NodeUri
99

1010
__all__ = [
11-
'AddNeighborsCommand',
11+
'AddNeighborsCommand',
1212
]
1313

1414

1515
class AddNeighborsCommand(FilterCommand):
16-
"""
17-
Executes `addNeighbors` command.
16+
"""
17+
Executes `addNeighbors` command.
1818
19-
See :py:meth:`iota.api.StrictIota.add_neighbors`.
20-
"""
21-
command = 'addNeighbors'
19+
See :py:meth:`iota.api.StrictIota.add_neighbors`.
20+
"""
21+
command = 'addNeighbors'
2222

23-
def get_request_filter(self):
24-
return AddNeighborsRequestFilter()
23+
def get_request_filter(self):
24+
return AddNeighborsRequestFilter()
2525

26-
def get_response_filter(self):
27-
pass
26+
def get_response_filter(self):
27+
pass
2828

2929

3030
class AddNeighborsRequestFilter(RequestFilter):
31-
def __init__(self):
32-
super(AddNeighborsRequestFilter, self).__init__({
33-
'uris': f.Required | f.Array | f.FilterRepeater(f.Required | NodeUri),
34-
})
31+
def __init__(self):
32+
super(AddNeighborsRequestFilter, self).__init__({
33+
'uris':
34+
f.Required | f.Array | f.FilterRepeater(f.Required | NodeUri),
35+
})
Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,58 @@
11
# coding=utf-8
22
from __future__ import absolute_import, division, print_function, \
3-
unicode_literals
3+
unicode_literals
44

55
import filters as f
6+
67
from iota import TransactionHash, TransactionTrytes
78
from iota.commands import FilterCommand, RequestFilter, ResponseFilter
89
from iota.filters import Trytes
910

1011
__all__ = [
11-
'AttachToTangleCommand',
12+
'AttachToTangleCommand',
1213
]
1314

1415

1516
class AttachToTangleCommand(FilterCommand):
16-
"""
17-
Executes ``attachToTangle`` command.
17+
"""
18+
Executes ``attachToTangle`` command.
1819
19-
See :py:meth:`iota.api.StrictIota.attach_to_tangle` for more info.
20-
"""
21-
command = 'attachToTangle'
20+
See :py:meth:`iota.api.StrictIota.attach_to_tangle` for more info.
21+
"""
22+
command = 'attachToTangle'
2223

23-
def get_request_filter(self):
24-
return AttachToTangleRequestFilter()
24+
def get_request_filter(self):
25+
return AttachToTangleRequestFilter()
2526

26-
def get_response_filter(self):
27-
return AttachToTangleResponseFilter()
27+
def get_response_filter(self):
28+
return AttachToTangleResponseFilter()
2829

2930

3031
class AttachToTangleRequestFilter(RequestFilter):
31-
def __init__(self):
32-
super(AttachToTangleRequestFilter, self).__init__({
33-
'branchTransaction': f.Required | Trytes(result_type=TransactionHash),
34-
'trunkTransaction': f.Required | Trytes(result_type=TransactionHash),
32+
def __init__(self):
33+
super(AttachToTangleRequestFilter, self).__init__({
34+
'branchTransaction': f.Required | Trytes(TransactionHash),
35+
'trunkTransaction': f.Required | Trytes(TransactionHash),
3536

36-
'trytes':
37-
f.Required
38-
| f.Array
39-
| f.FilterRepeater(f.Required | Trytes(result_type=TransactionTrytes)),
37+
'trytes':
38+
f.Required |
39+
f.Array |
40+
f.FilterRepeater(
41+
f.Required | Trytes(result_type=TransactionTrytes),
42+
),
4043

41-
# Loosely-validated; testnet nodes require a different value than
42-
# mainnet.
43-
'minWeightMagnitude': f.Required| f.Type(int) | f.Min(1),
44-
})
44+
# Loosely-validated; testnet nodes require a different value
45+
# than mainnet.
46+
'minWeightMagnitude': f.Required | f.Type(int) | f.Min(1),
47+
})
4548

4649

4750
class AttachToTangleResponseFilter(ResponseFilter):
48-
def __init__(self):
49-
super(AttachToTangleResponseFilter, self).__init__({
50-
'trytes':
51-
f.FilterRepeater(
52-
f.ByteString(encoding='ascii')
53-
| Trytes(result_type=TransactionTrytes)
54-
),
55-
})
51+
def __init__(self):
52+
super(AttachToTangleResponseFilter, self).__init__({
53+
'trytes':
54+
f.FilterRepeater(
55+
f.ByteString(encoding='ascii') |
56+
Trytes(TransactionTrytes),
57+
),
58+
})
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
from __future__ import absolute_import, division, print_function, \
3-
unicode_literals
3+
unicode_literals
44

55
import filters as f
66

@@ -9,34 +9,34 @@
99
from iota.filters import Trytes
1010

1111
__all__ = [
12-
'BroadcastTransactionsCommand',
12+
'BroadcastTransactionsCommand',
1313
]
1414

1515

1616
class BroadcastTransactionsCommand(FilterCommand):
17-
"""
18-
Executes `broadcastTransactions` command.
17+
"""
18+
Executes `broadcastTransactions` command.
1919
20-
See :py:meth:`iota.api.StrictIota.broadcast_transactions`.
21-
"""
22-
command = 'broadcastTransactions'
20+
See :py:meth:`iota.api.StrictIota.broadcast_transactions`.
21+
"""
22+
command = 'broadcastTransactions'
2323

24-
def get_request_filter(self):
25-
return BroadcastTransactionsRequestFilter()
24+
def get_request_filter(self):
25+
return BroadcastTransactionsRequestFilter()
2626

27-
def get_response_filter(self):
28-
pass
27+
def get_response_filter(self):
28+
pass
2929

3030

3131
class BroadcastTransactionsRequestFilter(RequestFilter):
32-
def __init__(self):
33-
super(BroadcastTransactionsRequestFilter, self).__init__({
34-
'trytes':
35-
f.Required
36-
| f.Array
37-
| f.FilterRepeater(
38-
f.Required
39-
| Trytes(result_type=TransactionTrytes)
40-
| f.Unicode(encoding='ascii', normalize=False)
41-
),
42-
})
32+
def __init__(self):
33+
super(BroadcastTransactionsRequestFilter, self).__init__({
34+
'trytes':
35+
f.Required |
36+
f.Array |
37+
f.FilterRepeater(
38+
f.Required |
39+
Trytes(TransactionTrytes) |
40+
f.Unicode(encoding='ascii', normalize=False),
41+
),
42+
})
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
# coding=utf-8
22
from __future__ import absolute_import, division, print_function, \
3-
unicode_literals
3+
unicode_literals
44

55
import filters as f
6-
from iota import Transaction, TransactionHash
6+
7+
from iota import TransactionHash
78
from iota.commands import FilterCommand, RequestFilter
89
from iota.filters import Trytes
910

1011
__all__ = [
11-
'CheckConsistencyCommand',
12+
'CheckConsistencyCommand',
1213
]
1314

1415

1516
class CheckConsistencyCommand(FilterCommand):
16-
"""
17-
Executes ``checkConsistency`` extended API command.
17+
"""
18+
Executes ``checkConsistency`` extended API command.
1819
19-
See :py:meth:`iota.api.Iota.check_consistency` for more info.
20-
"""
21-
command = 'checkConsistency'
20+
See :py:meth:`iota.api.Iota.check_consistency` for more info.
21+
"""
22+
command = 'checkConsistency'
2223

23-
def get_request_filter(self):
24-
return CheckConsistencyRequestFilter()
24+
def get_request_filter(self):
25+
return CheckConsistencyRequestFilter()
2526

26-
def get_response_filter(self):
27-
pass
27+
def get_response_filter(self):
28+
pass
2829

2930

3031
class CheckConsistencyRequestFilter(RequestFilter):
31-
def __init__(self):
32-
super(CheckConsistencyRequestFilter, self).__init__({
33-
'tails': (
34-
f.Required
35-
| f.Array
36-
| f.FilterRepeater(f.Required | Trytes(result_type=TransactionHash))
37-
),
38-
})
32+
def __init__(self):
33+
super(CheckConsistencyRequestFilter, self).__init__({
34+
'tails':
35+
f.Required |
36+
f.Array |
37+
f.FilterRepeater(f.Required | Trytes(TransactionHash)),
38+
})

0 commit comments

Comments
 (0)