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

Commit 57a7d28

Browse files
author
Jan Xie
authored
Merge pull request #748 from dongsam/fix-contract-string-for-unified-triple-quotes
Fixed contracts and docstrings to triple-double-quotes
2 parents f2eb934 + 008357a commit 57a7d28

File tree

9 files changed

+127
-143
lines changed

9 files changed

+127
-143
lines changed

ethereum/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
# ########### endversion ##################
4444

45-
'''from ethereum import utils
45+
"""from ethereum import utils
4646
from ethereum import trie
4747
from ethereum import securetrie
4848
from ethereum import blocks
@@ -51,4 +51,4 @@
5151
from ethereum import tester
5252
from ethereum import abi
5353
from ethereum import keys
54-
from ethereum import ethash'''
54+
from ethereum import ethash"""

ethereum/abi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def event_id(name, encode_types):
135135

136136

137137
def decint(n, signed=False): # pylint: disable=invalid-name,too-many-branches
138-
''' Decode an unsigned/signed integer. '''
138+
""" Decode an unsigned/signed integer. """
139139

140140
if isinstance(n, str):
141141
n = utils.to_string(n)
@@ -185,7 +185,7 @@ def decint(n, signed=False): # pylint: disable=invalid-name,too-many-branches
185185

186186

187187
def encode_single(typ, arg): # pylint: disable=too-many-return-statements,too-many-branches,too-many-statements,too-many-locals
188-
''' Encode `arg` as `typ`.
188+
""" Encode `arg` as `typ`.
189189
190190
`arg` will be encoded in a best effort manner, were necessary the function
191191
will try to correctly define the underlying binary representation (ie.
@@ -223,7 +223,7 @@ def encode_single(typ, arg): # pylint: disable=too-many-return-statements,too-m
223223
Note:
224224
This function don't work with array types, for that use the `enc`
225225
function.
226-
'''
226+
"""
227227
base, sub, _ = typ
228228

229229
if base == 'uint':

ethereum/experimental/pruning_trie.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ def unpack_to_nibbles(bindata):
168168

169169

170170
def starts_with(full, part):
171-
''' test whether the items in the part is
171+
""" test whether the items in the part is
172172
the leading items of the full
173-
'''
173+
"""
174174
if len(full) < len(part):
175175
return False
176176
return full[:len(part)] == part
@@ -200,11 +200,11 @@ def transient_trie_exception(*args):
200200
class Trie(object):
201201

202202
def __init__(self, db, root_hash=BLANK_ROOT, transient=False):
203-
'''it also present a dictionary like interface
203+
"""it also present a dictionary like interface
204204
205205
:param db key value database
206206
:root: blank or trie node in form of [key, value] or [v0,v1..v15,v]
207-
'''
207+
"""
208208
self.db = db # Pass in a database object directly
209209
self.transient = transient
210210
if self.transient:
@@ -215,11 +215,11 @@ def __init__(self, db, root_hash=BLANK_ROOT, transient=False):
215215
self.journal = []
216216

217217
# def __init__(self, dbfile, root_hash=BLANK_ROOT):
218-
# '''it also present a dictionary like interface
218+
# """it also present a dictionary like interface
219219

220220
# :param dbfile: key value database
221221
# :root: blank or trie node in form of [key, value] or [v0,v1..v15,v]
222-
# '''
222+
# """
223223
# if isinstance(dbfile, str):
224224
# dbfile = os.path.abspath(dbfile)
225225
# self.db = DB(dbfile)
@@ -251,8 +251,8 @@ def spv_storing(self, node):
251251

252252
@property
253253
def root_hash(self):
254-
'''always empty or a 32 bytes string
255-
'''
254+
"""always empty or a 32 bytes string
255+
"""
256256
return self.get_root_hash()
257257

258258
def get_root_hash(self):
@@ -311,8 +311,8 @@ def all_nodes(self, node=None):
311311
# return o
312312

313313
def clear(self):
314-
''' clear all tree data
315-
'''
314+
""" clear all tree data
315+
"""
316316
self._delete_child_storage(self.root_node)
317317
self._delete_node_storage(self.root_node)
318318
self.root_node = BLANK_NODE
@@ -349,11 +349,11 @@ def _decode_to_node(self, encoded):
349349
return o
350350

351351
def _get_node_type(self, node):
352-
''' get node type and content
352+
""" get node type and content
353353
354354
:param node: node in form of list, or BLANK_NODE
355355
:return: node type
356-
'''
356+
"""
357357
if node == BLANK_NODE:
358358
return NODE_TYPE_BLANK
359359

@@ -603,9 +603,9 @@ def prev(self, key):
603603
return nibbles_to_bin(o) if o else None
604604

605605
def _delete_node_storage(self, node, is_root=False):
606-
'''delete storage
606+
"""delete storage
607607
:param node: node in form of list, or BLANK_NODE
608-
'''
608+
"""
609609
if node == BLANK_NODE:
610610
return
611611
# assert isinstance(node, list)
@@ -645,8 +645,8 @@ def _delete(self, node, key):
645645

646646
def _normalize_branch_node(self, node):
647647
# sys.stderr.write('nbn\n')
648-
'''node should have only one item changed
649-
'''
648+
"""node should have only one item changed
649+
"""
650650
not_blank_items_count = sum(1 for x in range(17) if node[x])
651651
assert not_blank_items_count >= 1
652652

@@ -772,9 +772,9 @@ def _delete_kv_node(self, node, key):
772772
assert False
773773

774774
def delete(self, key):
775-
'''
775+
"""
776776
:param key: a string with length of [0, 32]
777-
'''
777+
"""
778778
if not is_string(key):
779779
raise Exception("Key must be string")
780780

@@ -808,10 +808,10 @@ def clear_all(self, node=None):
808808
self.clear_all(self._decode_to_node(node[i]))
809809

810810
def _get_size(self, node):
811-
'''Get counts of (key, value) stored in this and the descendant nodes
811+
"""Get counts of (key, value) stored in this and the descendant nodes
812812
813813
:param node: node in form of list, or BLANK_NODE
814-
'''
814+
"""
815815
if node == BLANK_NODE:
816816
return 0
817817

@@ -830,15 +830,15 @@ def _get_size(self, node):
830830
return sum(sizes)
831831

832832
def _to_dict(self, node):
833-
'''convert (key, value) stored in this and the descendant nodes
833+
"""convert (key, value) stored in this and the descendant nodes
834834
to dict items.
835835
836836
:param node: node in form of list, or BLANK_NODE
837837
838838
.. note::
839839
840840
Here key is in full form, rather than key of the individual node
841-
'''
841+
"""
842842
if node == BLANK_NODE:
843843
return {}
844844

@@ -894,12 +894,12 @@ def iter_branch(self):
894894
yield key, value
895895

896896
def _iter_branch(self, node):
897-
'''yield (key, value) stored in this and the descendant nodes
897+
"""yield (key, value) stored in this and the descendant nodes
898898
:param node: node in form of list, or BLANK_NODE
899899
900900
.. note::
901901
Here key is in full form, rather than key of the individual node
902-
'''
902+
"""
903903
if node == BLANK_NODE:
904904
raise StopIteration
905905

@@ -949,10 +949,10 @@ def __contains__(self, key):
949949
return self.get(key) != BLANK_NODE
950950

951951
def update(self, key, value):
952-
'''
952+
"""
953953
:param key: a string
954954
:value: a string
955-
'''
955+
"""
956956
if not is_string(key):
957957
raise Exception("Key must be string")
958958

0 commit comments

Comments
 (0)