Formatting and fix License

This commit is contained in:
lakshyacis 2020-01-15 16:17:26 +05:30
parent 22e22633c2
commit b6a81f1252
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
12 changed files with 51 additions and 39 deletions

24
LICENSE
View File

@ -68,3 +68,27 @@ CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
===== based on namecoin.py namecoin.py python implementation 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
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.

View File

@ -180,7 +180,7 @@ def decodeAddress(address):
returns (status, address version number, stream number,
data (almost certainly a ripe hash))
"""
# pylint: disable=too-many-return-statements,too-many-statements,too-many-return-statements,too-many-branches
# pylint: disable=too-many-return-statements,too-many-statements,too-many-branches
address = str(address).strip()

View File

@ -412,7 +412,7 @@ class Main(object):
# wait until grandchild ready
while True:
time.sleep(1)
os._exit(0) # pylint: disable=protected-access
os._exit(0) # pylint: disable=protected-access
except AttributeError:
# fork not implemented
pass
@ -433,7 +433,7 @@ class Main(object):
# wait until child ready
while True:
time.sleep(1)
os._exit(0) # pylint: disable=protected-access
os._exit(0) # pylint: disable=protected-access
except AttributeError:
# fork not implemented
pass

View File

@ -58,7 +58,8 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
raise ValueError("Invalid value %s" % value)
return ConfigParser.ConfigParser.set(self, section, option, value)
def get(self, section, option, raw=False, variables=None): # pylint: disable=arguments-differ
def get(self, section, option, raw=False, variables=None):
# pylint: disable=arguments-differ
try:
if section == "bitmessagesettings" and option == "timeformat":
return ConfigParser.ConfigParser.get(
@ -109,8 +110,9 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
ValueError, AttributeError):
return default
def items(self, section, raw=False, variables=None): # pylint: disable=arguments-differ
def items(self, section, raw=False, variables=None):
"""Return section variables as parent, but override the "raw" argument to always True"""
# pylint: disable=arguments-differ
return ConfigParser.ConfigParser.items(self, section, True, variables)
@staticmethod

View File

@ -1,7 +1,8 @@
"""
Thread for performing PoW
"""
# pylint: disable=protected-access,too-many-branches,too-many-statements,no-self-use,too-many-lines,too-many-locals
# pylint: disable=protected-access,too-many-branches,too-many-statements
# pylint: disable=no-self-use,too-many-lines,too-many-locals
from __future__ import division

View File

@ -22,8 +22,9 @@ class smtpDeliver(StoppableThread):
_instance = None
def stopThread(self):
# pylint: disable=no-member
try:
queues.UISignallerQueue.put(("stopThread", "data")) # pylint: disable=no-member
queues.UISignallerQueue.put(("stopThread", "data"))
except:
pass
super(smtpDeliver, self).stopThread()
@ -37,6 +38,7 @@ class smtpDeliver(StoppableThread):
def run(self):
# pylint: disable=too-many-branches,too-many-statements,too-many-locals
# pylint: disable=deprecated-lambda
while state.shutdown == 0:
command, data = queues.UISignalQueue.get()
if command == 'writeNewAddressToTable':
@ -59,9 +61,9 @@ class smtpDeliver(StoppableThread):
msg = MIMEText(body, 'plain', 'utf-8')
msg['Subject'] = Header(subject, 'utf-8')
msg['From'] = fromAddress + '@' + SMTPDOMAIN
toLabel = map( # pylint: disable=deprecated-lambda
toLabel = map(
lambda y: BMConfigParser().safeGet(y, "label"),
filter( # pylint: disable=deprecated-lambda
filter(
lambda x: x == toAddress, BMConfigParser().addresses())
)
if toLabel:

View File

@ -76,8 +76,9 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
# print >> DEBUGSTREAM, 'Incoming connection from %s' % repr(addr)
self.channel = smtpServerChannel(self, conn, addr)
def send(self, fromAddress, toAddress, subject, message): # pylint: disable=arguments-differ
def send(self, fromAddress, toAddress, subject, message):
"""Send a bitmessage"""
# pylint: disable=arguments-differ
streamNumber, ripe = decodeAddress(toAddress)[2:]
stealthLevel = BMConfigParser().safeGetInt('bitmessagesettings', 'ackstealthlevel')
ackdata = genAckPayload(streamNumber, stealthLevel)
@ -114,8 +115,9 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
return ret
def process_message(self, peer, mailfrom, rcpttos, data): # pylint: disable=too-many-locals, too-many-branches
def process_message(self, peer, mailfrom, rcpttos, data):
"""Process an email"""
# pylint: disable=too-many-locals, too-many-branches
# print 'Receiving message from:', peer
p = re.compile(".*<([^>]+)>")
if not hasattr(self.channel, "auth") or not self.channel.auth:

View File

@ -27,7 +27,7 @@ class sqlThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self, name="SQL")
def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements
def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements
"""Process SQL queries from `.helper_sql.sqlSubmitQueue`"""
self.conn = sqlite3.connect(state.appdata + 'messages.dat')
self.conn.text_factory = str

View File

@ -231,12 +231,13 @@ def check_sqlite():
conn.close()
def check_openssl(): # pylint: disable=too-many-branches, too-many-return-statements
def check_openssl():
"""Do openssl dependency check.
Here we are checking for openssl with its all dependent libraries
and version checking.
"""
# pylint: disable=too-many-branches, too-many-return-statements
# pylint: disable=protected-access, redefined-outer-name
ctypes = try_import('ctypes')
if not ctypes:

View File

@ -1,28 +1,7 @@
# pylint: disable=too-many-branches,protected-access
"""
Copyright (C) 2013 by Daniel Kraft <d@domob.eu>
Namecoin queries
"""
# This file is part of the Bitmessage project.
# 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.
# pylint: disable=too-many-branches,protected-access
import base64
import httplib

View File

@ -118,7 +118,7 @@ def decodeWalletImportFormat(WIFstring):
' 6 characters of the PRIVATE key: %s',
str(WIFstring)[:6]
)
os._exit(0) # pylint: disable=protected-access
os._exit(0) # pylint: disable=protected-access
# return ""
elif privkey[0] == '\x80': # checksum passed
return privkey[1:]
@ -128,7 +128,7 @@ def decodeWalletImportFormat(WIFstring):
' the checksum passed but the key doesn\'t begin with hex 80.'
' Here is the PRIVATE key: %s', WIFstring
)
os._exit(0) # pylint: disable=protected-access
os._exit(0) # pylint: disable=protected-access
def reloadMyAddressHashes():

View File

@ -25,7 +25,8 @@ class translateClass:
return self.text
def _translate(context, text, disambiguation=None, encoding=None, n=None): # pylint: disable=unused-argument
def _translate(context, text, disambiguation=None, encoding=None, n=None):
# pylint: disable=unused-argument
return translateText(context, text, n)
@ -45,7 +46,7 @@ def translateText(context, text, n=None):
' or by searching Google for \'PyQt Download\'.'\
' If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon'
print 'Error message:', err
os._exit(0) # pylint: disable=protected-access
os._exit(0) # pylint: disable=protected-access
if n is None:
return QtGui.QApplication.translate(context, text)
return QtGui.QApplication.translate(context, text, None, QtCore.QCoreApplication.CodecForTr, n)