This repository has been archived by the owner on Jan 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#145] Reformat core commands for PEP-8.
- Loading branch information
1 parent
e5f3f82
commit 0d57510
Showing
16 changed files
with
453 additions
and
472 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 |
---|---|---|
@@ -1,34 +1,35 @@ | ||
# coding=utf-8 | ||
from __future__ import absolute_import, division, print_function, \ | ||
unicode_literals | ||
unicode_literals | ||
|
||
import filters as f | ||
|
||
from iota.commands import FilterCommand, RequestFilter | ||
from iota.filters import NodeUri | ||
|
||
__all__ = [ | ||
'AddNeighborsCommand', | ||
'AddNeighborsCommand', | ||
] | ||
|
||
|
||
class AddNeighborsCommand(FilterCommand): | ||
""" | ||
Executes `addNeighbors` command. | ||
""" | ||
Executes `addNeighbors` command. | ||
See :py:meth:`iota.api.StrictIota.add_neighbors`. | ||
""" | ||
command = 'addNeighbors' | ||
See :py:meth:`iota.api.StrictIota.add_neighbors`. | ||
""" | ||
command = 'addNeighbors' | ||
|
||
def get_request_filter(self): | ||
return AddNeighborsRequestFilter() | ||
def get_request_filter(self): | ||
return AddNeighborsRequestFilter() | ||
|
||
def get_response_filter(self): | ||
pass | ||
def get_response_filter(self): | ||
pass | ||
|
||
|
||
class AddNeighborsRequestFilter(RequestFilter): | ||
def __init__(self): | ||
super(AddNeighborsRequestFilter, self).__init__({ | ||
'uris': f.Required | f.Array | f.FilterRepeater(f.Required | NodeUri), | ||
}) | ||
def __init__(self): | ||
super(AddNeighborsRequestFilter, self).__init__({ | ||
'uris': | ||
f.Required | f.Array | f.FilterRepeater(f.Required | NodeUri), | ||
}) |
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 |
---|---|---|
@@ -1,55 +1,58 @@ | ||
# coding=utf-8 | ||
from __future__ import absolute_import, division, print_function, \ | ||
unicode_literals | ||
unicode_literals | ||
|
||
import filters as f | ||
|
||
from iota import TransactionHash, TransactionTrytes | ||
from iota.commands import FilterCommand, RequestFilter, ResponseFilter | ||
from iota.filters import Trytes | ||
|
||
__all__ = [ | ||
'AttachToTangleCommand', | ||
'AttachToTangleCommand', | ||
] | ||
|
||
|
||
class AttachToTangleCommand(FilterCommand): | ||
""" | ||
Executes ``attachToTangle`` command. | ||
""" | ||
Executes ``attachToTangle`` command. | ||
See :py:meth:`iota.api.StrictIota.attach_to_tangle` for more info. | ||
""" | ||
command = 'attachToTangle' | ||
See :py:meth:`iota.api.StrictIota.attach_to_tangle` for more info. | ||
""" | ||
command = 'attachToTangle' | ||
|
||
def get_request_filter(self): | ||
return AttachToTangleRequestFilter() | ||
def get_request_filter(self): | ||
return AttachToTangleRequestFilter() | ||
|
||
def get_response_filter(self): | ||
return AttachToTangleResponseFilter() | ||
def get_response_filter(self): | ||
return AttachToTangleResponseFilter() | ||
|
||
|
||
class AttachToTangleRequestFilter(RequestFilter): | ||
def __init__(self): | ||
super(AttachToTangleRequestFilter, self).__init__({ | ||
'branchTransaction': f.Required | Trytes(result_type=TransactionHash), | ||
'trunkTransaction': f.Required | Trytes(result_type=TransactionHash), | ||
def __init__(self): | ||
super(AttachToTangleRequestFilter, self).__init__({ | ||
'branchTransaction': f.Required | Trytes(TransactionHash), | ||
'trunkTransaction': f.Required | Trytes(TransactionHash), | ||
|
||
'trytes': | ||
f.Required | ||
| f.Array | ||
| f.FilterRepeater(f.Required | Trytes(result_type=TransactionTrytes)), | ||
'trytes': | ||
f.Required | | ||
f.Array | | ||
f.FilterRepeater( | ||
f.Required | Trytes(result_type=TransactionTrytes), | ||
), | ||
|
||
# Loosely-validated; testnet nodes require a different value than | ||
# mainnet. | ||
'minWeightMagnitude': f.Required| f.Type(int) | f.Min(1), | ||
}) | ||
# Loosely-validated; testnet nodes require a different value | ||
# than mainnet. | ||
'minWeightMagnitude': f.Required | f.Type(int) | f.Min(1), | ||
}) | ||
|
||
|
||
class AttachToTangleResponseFilter(ResponseFilter): | ||
def __init__(self): | ||
super(AttachToTangleResponseFilter, self).__init__({ | ||
'trytes': | ||
f.FilterRepeater( | ||
f.ByteString(encoding='ascii') | ||
| Trytes(result_type=TransactionTrytes) | ||
), | ||
}) | ||
def __init__(self): | ||
super(AttachToTangleResponseFilter, self).__init__({ | ||
'trytes': | ||
f.FilterRepeater( | ||
f.ByteString(encoding='ascii') | | ||
Trytes(TransactionTrytes), | ||
), | ||
}) |
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
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 |
---|---|---|
@@ -1,38 +1,38 @@ | ||
# coding=utf-8 | ||
from __future__ import absolute_import, division, print_function, \ | ||
unicode_literals | ||
unicode_literals | ||
|
||
import filters as f | ||
from iota import Transaction, TransactionHash | ||
|
||
from iota import TransactionHash | ||
from iota.commands import FilterCommand, RequestFilter | ||
from iota.filters import Trytes | ||
|
||
__all__ = [ | ||
'CheckConsistencyCommand', | ||
'CheckConsistencyCommand', | ||
] | ||
|
||
|
||
class CheckConsistencyCommand(FilterCommand): | ||
""" | ||
Executes ``checkConsistency`` extended API command. | ||
""" | ||
Executes ``checkConsistency`` extended API command. | ||
See :py:meth:`iota.api.Iota.check_consistency` for more info. | ||
""" | ||
command = 'checkConsistency' | ||
See :py:meth:`iota.api.Iota.check_consistency` for more info. | ||
""" | ||
command = 'checkConsistency' | ||
|
||
def get_request_filter(self): | ||
return CheckConsistencyRequestFilter() | ||
def get_request_filter(self): | ||
return CheckConsistencyRequestFilter() | ||
|
||
def get_response_filter(self): | ||
pass | ||
def get_response_filter(self): | ||
pass | ||
|
||
|
||
class CheckConsistencyRequestFilter(RequestFilter): | ||
def __init__(self): | ||
super(CheckConsistencyRequestFilter, self).__init__({ | ||
'tails': ( | ||
f.Required | ||
| f.Array | ||
| f.FilterRepeater(f.Required | Trytes(result_type=TransactionHash)) | ||
), | ||
}) | ||
def __init__(self): | ||
super(CheckConsistencyRequestFilter, self).__init__({ | ||
'tails': | ||
f.Required | | ||
f.Array | | ||
f.FilterRepeater(f.Required | Trytes(TransactionHash)), | ||
}) |
Oops, something went wrong.