Skip to content

Commit 628c450

Browse files
committed
Merge pull request #76
53b879f doc: include __init__ docstrings; factor out common flags (Jacob Welsh) 2584abe Update docstrings for RST paragraph flow (Jacob Welsh) 68381f7 Add new modules to sphinx TOC (Jacob Welsh)
2 parents e0b04cf + 53b879f commit 628c450

File tree

9 files changed

+44
-42
lines changed

9 files changed

+44
-42
lines changed

bitcoin/core/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ def CheckBlockHeader(block_header, fCheckPoW = True, cur_time=None):
663663
"""Context independent CBlockHeader checks.
664664
665665
fCheckPoW - Check proof-of-work.
666+
666667
cur_time - Current time. Defaults to time.time()
667668
668669
Raises CBlockHeaderError if block header is invalid.
@@ -699,7 +700,9 @@ def CheckBlock(block, fCheckPoW = True, fCheckMerkleRoot = True, cur_time=None):
699700
transaction.
700701
701702
fCheckPoW - Check proof-of-work.
703+
702704
fCheckMerkleRoot - Check merkle root matches transactions.
705+
703706
cur_time - Current time. Defaults to time.time()
704707
"""
705708

bitcoin/core/key.py

+4
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ def set_compressed(self, compressed):
245245
def recover(self, sigR, sigS, msg, msglen, recid, check):
246246
"""
247247
Perform ECDSA key recovery (see SEC1 4.1.6) for curves over (mod p)-fields
248+
248249
recid selects which key is recovered
250+
249251
if check is non-zero, additional checks are performed
250252
"""
251253
i = int(recid / 2)
@@ -349,7 +351,9 @@ class CPubKey(bytes):
349351
Attributes:
350352
351353
is_valid - Corresponds to CPubKey.IsValid()
354+
352355
is_fullyvalid - Corresponds to CPubKey.IsFullyValid()
356+
353357
is_compressed - Corresponds to CPubKey.IsCompressed()
354358
"""
355359

bitcoin/core/script.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ def to_p2sh_scriptPubKey(self, checksize=True):
741741
redeemScript to spend.
742742
743743
checksize - Check if the redeemScript is larger than the 520-byte max
744-
pushdata limit; raise ValueError if limit exceeded.
744+
pushdata limit; raise ValueError if limit exceeded.
745745
746746
Since a >520-byte PUSHDATA makes EvalScript() fail, it's not actually
747747
possible to redeem P2SH outputs with redeem scripts >520 bytes.

bitcoin/core/scripteval.py

+8
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ def err_raiser(cls, *args):
361361
"""Helper function for raising EvalScriptError exceptions
362362
363363
cls - subclass you want to raise
364+
364365
*args - arguments
365366
366367
Fills in the state of execution for you.
@@ -680,9 +681,13 @@ def EvalScript(stack, scriptIn, txTo, inIdx, flags=()):
680681
"""Evaluate a script
681682
682683
stack - Initial stack
684+
683685
scriptIn - Script
686+
684687
txTo - Transaction the script is a part of
688+
685689
inIdx - txin index of the scriptSig
690+
686691
flags - SCRIPT_VERIFY_* flags to apply
687692
"""
688693

@@ -703,8 +708,11 @@ def VerifyScript(scriptSig, scriptPubKey, txTo, inIdx, flags=()):
703708
"""Verify a scriptSig satisfies a scriptPubKey
704709
705710
scriptSig - Signature
711+
706712
scriptPubKey - PubKey
713+
707714
txTo - Spending transaction
715+
708716
inIdx - Index of the transaction input containing scriptSig
709717
710718
Raises a ValidationError subclass if the validation fails.

bitcoin/rpc.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,10 @@ def getbalance(self, account='*', minconf=1):
306306
"""Get the balance
307307
308308
account - The selected account. Defaults to "*" for entire wallet. It
309-
may be the default account using "".
309+
may be the default account using "".
310+
310311
minconf - Only include transactions confirmed at least this many times.
311-
(default=1)
312+
(default=1)
312313
"""
313314
r = self._call('getbalance', account, minconf)
314315
return int(r*COIN)
@@ -398,8 +399,8 @@ def getrawtransaction(self, txid, verbose=False):
398399
399400
Raises IndexError if transaction not found.
400401
401-
verbose - If true a dict is returned instead with additional information
402-
on the transaction.
402+
verbose - If true a dict is returned instead with additional
403+
information on the transaction.
403404
404405
Note that if all txouts are spent and the transaction index is not
405406
enabled the transaction may not be available.
@@ -433,8 +434,9 @@ def getreceivedbyaddress(self, addr, minconf=1):
433434
always show zero.
434435
435436
addr - The address. (CBitcoinAddress instance)
437+
436438
minconf - Only include transactions confirmed at least this many times.
437-
(default=1)
439+
(default=1)
438440
"""
439441
r = self._call('getreceivedbyaddress', str(addr), minconf)
440442
return int(r * COIN)

bitcoin/wallet.py

+2
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def from_scriptPubKey(cls, scriptPubKey, accept_non_canonical_pushdata=True, acc
153153
form.
154154
155155
accept_non_canonical_pushdata - Allow non-canonical pushes (default True)
156+
156157
accept_bare_checksig - Treat bare-checksig as P2PKH scriptPubKeys (default True)
157158
"""
158159
if accept_non_canonical_pushdata:
@@ -205,6 +206,7 @@ class CKey(object):
205206
Attributes:
206207
207208
pub - The corresponding CPubKey for this private key
209+
208210
is_compressed - True if compressed
209211
210212
"""

doc/bitcoin.core.rst

-15
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,24 @@ Everything consensus critical is found in the core subpackage.
77
-----------
88

99
.. automodule:: bitcoin.core
10-
:members:
11-
:undoc-members:
12-
:show-inheritance:
1310

1411
:mod:`key`
1512
----------
1613

1714
.. automodule:: bitcoin.core.key
18-
:members:
19-
:undoc-members:
20-
:show-inheritance:
2115

2216
:mod:`script`
2317
-------------
2418

2519
.. automodule:: bitcoin.core.script
26-
:members:
27-
:undoc-members:
28-
:show-inheritance:
2920

3021
:mod:`scripteval`
3122
-----------------
3223

3324
.. automodule:: bitcoin.core.scripteval
34-
:members:
35-
:undoc-members:
36-
:show-inheritance:
3725

3826
:mod:`serialize`
3927
----------------
4028

4129
.. automodule:: bitcoin.core.serialize
42-
:members:
43-
:undoc-members:
44-
:show-inheritance:
4530

doc/bitcoin.rst

+10-21
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,43 @@ bitcoin
55
--------------
66

77
.. automodule:: bitcoin
8-
:members:
9-
:undoc-members:
10-
:show-inheritance:
118

129
:mod:`base58`
1310
-------------
1411

1512
.. automodule:: bitcoin.base58
16-
:members:
17-
:undoc-members:
18-
:show-inheritance:
1913

2014
:mod:`bloom`
2115
------------
2216

2317
.. automodule:: bitcoin.bloom
24-
:members:
25-
:undoc-members:
26-
:show-inheritance:
2718

2819
:mod:`messages`
2920
---------------
3021

3122
.. automodule:: bitcoin.messages
32-
:members:
33-
:undoc-members:
34-
:show-inheritance:
3523

3624
:mod:`net`
3725
----------
3826

3927
.. automodule:: bitcoin.net
40-
:members:
41-
:undoc-members:
42-
:show-inheritance:
4328

4429
:mod:`rpc`
4530
----------
4631

4732
.. automodule:: bitcoin.rpc
48-
:members:
49-
:undoc-members:
50-
:show-inheritance:
33+
34+
:mod:`signature`
35+
----------------
36+
37+
.. automodule:: bitcoin.signature
38+
39+
:mod:`signmessage`
40+
------------------
41+
42+
.. automodule:: bitcoin.signmessage
5143

5244
:mod:`wallet`
5345
-------------
5446

5547
.. automodule:: bitcoin.wallet
56-
:members:
57-
:undoc-members:
58-
:show-inheritance:

doc/conf.py

+9
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@
4646
'sphinx.ext.viewcode',
4747
]
4848

49+
autodoc_default_flags = [
50+
'members',
51+
'undoc-members',
52+
'show-inheritance',
53+
]
54+
55+
# Include __init__ docstring in class level docs
56+
autoclass_content = 'both'
57+
4958
# Add any paths that contain templates here, relative to this directory.
5059
templates_path = ['_templates']
5160

0 commit comments

Comments
 (0)