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, OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 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, returns (status, address version number, stream number,
data (almost certainly a ripe hash)) 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() address = str(address).strip()

View File

@ -58,7 +58,8 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
raise ValueError("Invalid value %s" % value) raise ValueError("Invalid value %s" % value)
return ConfigParser.ConfigParser.set(self, section, option, 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: try:
if section == "bitmessagesettings" and option == "timeformat": if section == "bitmessagesettings" and option == "timeformat":
return ConfigParser.ConfigParser.get( return ConfigParser.ConfigParser.get(
@ -109,8 +110,9 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
ValueError, AttributeError): ValueError, AttributeError):
return default 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""" """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) return ConfigParser.ConfigParser.items(self, section, True, variables)
@staticmethod @staticmethod

View File

@ -1,7 +1,8 @@
""" """
Thread for performing PoW 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 from __future__ import division

View File

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

View File

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

View File

@ -231,12 +231,13 @@ def check_sqlite():
conn.close() conn.close()
def check_openssl(): # pylint: disable=too-many-branches, too-many-return-statements def check_openssl():
"""Do openssl dependency check. """Do openssl dependency check.
Here we are checking for openssl with its all dependent libraries Here we are checking for openssl with its all dependent libraries
and version checking. and version checking.
""" """
# pylint: disable=too-many-branches, too-many-return-statements
# pylint: disable=protected-access, redefined-outer-name # pylint: disable=protected-access, redefined-outer-name
ctypes = try_import('ctypes') ctypes = try_import('ctypes')
if not 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 Namecoin queries
""" """
# This file is part of the Bitmessage project. # pylint: disable=too-many-branches,protected-access
# 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

View File

@ -25,7 +25,8 @@ class translateClass:
return self.text 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) return translateText(context, text, n)