Fixed badly formatted docstrings and some wrong text
This commit is contained in:
parent
d412e8341b
commit
b5df242141
|
@ -1,19 +1,15 @@
|
||||||
# pylint: disable=too-many-locals,too-many-lines,no-self-use,too-many-public-methods,too-many-branches
|
# pylint: disable=too-many-locals,too-many-lines,no-self-use,too-many-public-methods,too-many-branches
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
"""
|
|
||||||
src/api.py
|
|
||||||
==========
|
|
||||||
|
|
||||||
# Copyright (c) 2012-2016 Jonathan Warren
|
# Copyright (c) 2012-2016 Jonathan Warren
|
||||||
# Copyright (c) 2012-2019 The Bitmessage developers
|
# Copyright (c) 2012-2019 The Bitmessage developers
|
||||||
|
|
||||||
|
"""
|
||||||
This is not what you run to run the Bitmessage API. Instead, enable the API
|
This is not what you run to run the Bitmessage API. Instead, enable the API
|
||||||
( https://bitmessage.org/wiki/API ) and optionally enable daemon mode
|
( https://bitmessage.org/wiki/API ) and optionally enable daemon mode
|
||||||
( https://bitmessage.org/wiki/Daemon ) then run bitmessagemain.py.
|
( https://bitmessage.org/wiki/Daemon ) then run bitmessagemain.py.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import errno
|
import errno
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
|
@ -2,19 +2,20 @@
|
||||||
The singleCleaner class is a timer-driven thread that cleans data structures
|
The singleCleaner class is a timer-driven thread that cleans data structures
|
||||||
to free memory, resends messages when a remote node doesn't respond, and
|
to free memory, resends messages when a remote node doesn't respond, and
|
||||||
sends pong messages to keep connections alive if the network isn't busy.
|
sends pong messages to keep connections alive if the network isn't busy.
|
||||||
|
|
||||||
It cleans these data structures in memory:
|
It cleans these data structures in memory:
|
||||||
inventory (moves data to the on-disk sql database)
|
- inventory (moves data to the on-disk sql database)
|
||||||
inventorySets (clears then reloads data out of sql database)
|
- inventorySets (clears then reloads data out of sql database)
|
||||||
|
|
||||||
It cleans these tables on the disk:
|
It cleans these tables on the disk:
|
||||||
inventory (clears expired objects)
|
- inventory (clears expired objects)
|
||||||
pubkeys (clears pubkeys older than 4 weeks old which we have not used
|
- pubkeys (clears pubkeys older than 4 weeks old which we have not used
|
||||||
personally)
|
personally)
|
||||||
knownNodes (clears addresses which have not been online for over 3 days)
|
- knownNodes (clears addresses which have not been online for over 3 days)
|
||||||
|
|
||||||
It resends messages when there has been no response:
|
It resends messages when there has been no response:
|
||||||
resends getpubkey messages in 5 days (then 10 days, then 20 days, etc...)
|
- resends getpubkey messages in 5 days (then 10 days, then 20 days, etc...)
|
||||||
resends msg messages in 5 days (then 10 days, then 20 days, etc...)
|
- resends msg messages in 5 days (then 10 days, then 20 days, etc...)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -100,9 +100,9 @@ def pointMult(secret):
|
||||||
|
|
||||||
Evidently, this type of error can occur very rarely:
|
Evidently, this type of error can occur very rarely:
|
||||||
|
|
||||||
File "highlevelcrypto.py", line 54, in pointMult
|
>>> File "highlevelcrypto.py", line 54, in pointMult
|
||||||
group = OpenSSL.EC_KEY_get0_group(k)
|
>>> group = OpenSSL.EC_KEY_get0_group(k)
|
||||||
WindowsError: exception: access violation reading 0x0000000000000008
|
>>> WindowsError: exception: access violation reading 0x0000000000000008
|
||||||
"""
|
"""
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,31 +1,28 @@
|
||||||
# pylint: disable=too-many-branches,protected-access
|
# pylint: disable=too-many-branches,protected-access
|
||||||
"""
|
"""
|
||||||
Copyright (C) 2013 by Daniel Kraft <d@domob.eu>
|
Copyright (C) 2013 by Daniel Kraft <d@domob.eu>
|
||||||
This file is part of the Bitmessage project.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Namecoin queries
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
||||||
.. todo:: from debug import logger crashes PyBitmessage due to a circular dependency. The debug module will also
|
|
||||||
override/disable logging.getLogger() # loggers so module level logging functions are used instead
|
|
||||||
"""
|
"""
|
||||||
|
# This file is part of the Bitmessage project.
|
||||||
|
|
||||||
from __future__ import absolute_import
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import httplib
|
import httplib
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
"""
|
"""
|
||||||
src/network/bmobject.py
|
BMObject and it's exceptions.
|
||||||
======================
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
# pylint: disable=too-many-boolean-expressions,too-many-return-statements,too-many-locals,too-many-statements
|
# pylint: disable=too-many-boolean-expressions,too-many-return-statements,too-many-locals,too-many-statements
|
||||||
"""
|
"""
|
||||||
protocol.py
|
|
||||||
===========
|
|
||||||
|
|
||||||
Low-level protocol-related functions.
|
Low-level protocol-related functions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import random
|
import random
|
||||||
|
@ -205,12 +200,13 @@ def isProofOfWorkSufficient(data,
|
||||||
recvTime=0):
|
recvTime=0):
|
||||||
"""
|
"""
|
||||||
Validate an object's Proof of Work using method described in:
|
Validate an object's Proof of Work using method described in:
|
||||||
https://bitmessage.org/wiki/Proof_of_work
|
https://bitmessage.org/wiki/Proof_of_work
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
int nonceTrialsPerByte (default: from default.py)
|
int nonceTrialsPerByte (default: from default.py)
|
||||||
int payloadLengthExtraBytes (default: from default.py)
|
int payloadLengthExtraBytes (default: from default.py)
|
||||||
float recvTime (optional) UNIX epoch time when object was
|
float recvTime (optional) UNIX epoch time when object was
|
||||||
received from the network (default: current system time)
|
received from the network (default: current system time)
|
||||||
Returns:
|
Returns:
|
||||||
True if PoW valid and sufficient, False in all other cases
|
True if PoW valid and sufficient, False in all other cases
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
"""
|
"""
|
||||||
src/pyelliptic/__init__.py
|
Copyright (C) 2010
|
||||||
=====================================
|
Author: Yann GUIBET
|
||||||
|
Contact: <yannguibet@gmail.com>
|
||||||
|
|
||||||
|
Python OpenSSL wrapper.
|
||||||
|
For modern cryptography with ECC, AES, HMAC, Blowfish, ...
|
||||||
|
|
||||||
|
This is an abandoned package maintained inside of the PyBitmessage.
|
||||||
"""
|
"""
|
||||||
# Copyright (C) 2010
|
|
||||||
# Author: Yann GUIBET
|
|
||||||
# Contact: <yannguibet@gmail.com>
|
|
||||||
|
|
||||||
from .openssl import OpenSSL
|
from .openssl import OpenSSL
|
||||||
from .ecc import ECC
|
from .ecc import ECC
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
src/pyelliptic/hash.py
|
Wrappers for hash functions from OpenSSL.
|
||||||
=====================
|
|
||||||
"""
|
"""
|
||||||
# Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com>
|
# Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
|
||||||
src/pyelliptic/openssl.py
|
|
||||||
=====================
|
|
||||||
"""
|
|
||||||
# Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com>
|
# Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
#
|
#
|
||||||
# Software slightly changed by Jonathan Warren <bitmessage at-symbol jonwarren.org>
|
# Software slightly changed by Jonathan Warren <bitmessage at-symbol jonwarren.org>
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
|
"""
|
||||||
|
This module loads openssl libs with ctypes and incapsulates
|
||||||
|
needed openssl functionality in class _OpenSSL.
|
||||||
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import ctypes
|
import ctypes
|
||||||
|
|
Reference in New Issue
Block a user