Code Fixes 2 regarding PR#11

This commit is contained in:
lakshyacis 2019-09-18 14:16:09 +05:30
parent c1a8f040d7
commit 581ef84ffa
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
4 changed files with 24 additions and 28 deletions

View File

@ -1,5 +1,5 @@
"""
src/identiconGeneration
src/identiconGeneration.py
=================================
"""
import hashlib

View File

@ -5,6 +5,7 @@ src/bitmessagekivy/mpybit.py
import os
import time
from functools import partial
import identiconGeneration
from bmconfigparser import BMConfigParser
from helper_sql import sqlExecute, sqlQuery
from kivy.app import App
@ -57,16 +58,12 @@ import state
from uikivysignaler import UIkivySignaler
# pylint: disable=unused-argument, too-few-public-methods, import-error
import identiconGeneration
import os
from kivy.core.clipboard import Clipboard
# pylint: disable=unused-argument, too-few-public-methods
def toast(text):
"""Method will display the toast message."""
# pylint: disable=redefined-outer-name
if platform == 'linux':
from kivymd.toast.kivytoast import toast # pylint: disable=redefined-outer-name
from kivymd.toast.kivytoast import toast
toast(text)
return
@ -104,7 +101,7 @@ class Inbox(Screen):
def loadMessagelist(self, account, where="", what=""):
"""Load Inbox list for Inbox messages."""
# pylint: disable=too-many-locals
# pylint: disable=too-many-locals, unused-variable
if state.searcing_text:
where = ['subject', 'message']
what = state.searcing_text
@ -1866,7 +1863,6 @@ class Draft(Screen):
'draft',
encoding,
BMConfigParser().getint('bitmessagesettings', 'ttl'))
state.msg_counter_objs = src_object.children[2].children[0].ids
state.draft_count = str(int(state.draft_count) + 1)
src_object.ids.sc16.clear_widgets()

View File

@ -70,7 +70,7 @@ depends.check_dependencies()
def connectToStream(streamNumber):
"""Connecting to stream"""
"""Method helps us to connect with the stream"""
state.streamsInWhichIAmParticipating.append(streamNumber)
if isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections():
@ -111,7 +111,7 @@ def _fixSocket():
addressToString = ctypes.windll.ws2_32.WSAAddressToStringA
def inet_ntop(family, host):
"""inet ntop"""
"""Method converts an IP address in packed binary format to string format"""
if family == socket.AF_INET:
if len(host) != 4:
raise ValueError("invalid IPv4 host")
@ -133,7 +133,7 @@ def _fixSocket():
stringToAddress = ctypes.windll.ws2_32.WSAStringToAddressA
def inet_pton(family, host):
"""inet pton"""
"""Method converts an IP address in string format to a packed binary format"""
buf = "\0" * 28
lengthBuf = pack("I", len(buf))
if stringToAddress(str(host),
@ -189,7 +189,7 @@ def signal_handler(signum, frame):
class Main: # pylint: disable=no-init, old-style-class
"""Main Method"""
"""Method starts the proxy config plugin"""
@staticmethod
def start_proxyconfig(config):
@ -213,7 +213,7 @@ class Main: # pylint: disable=no-init, old-style-class
proxy_type, time.time() - proxyconfig_start)
def start(self): # pylint: disable=too-many-statements, too-many-branches, too-many-locals
"""Start the main method"""
"""This method helps to start the daemon"""
_fixSocket()
config = BMConfigParser()
@ -276,7 +276,7 @@ class Main: # pylint: disable=no-init, old-style-class
# is the application already running? If yes then exit.
try:
shared.thisapp = singleinstance("", daemon)
except Exception as e:
except Exception:
pass
if daemon:
@ -438,7 +438,7 @@ class Main: # pylint: disable=no-init, old-style-class
@staticmethod
def daemonize():
"""Daemonize"""
"""Running as a daemon. Send signal in end."""
grandfatherPid = os.getpid()
parentPid = None
try:
@ -491,14 +491,14 @@ class Main: # pylint: disable=no-init, old-style-class
os.kill(grandfatherPid, signal.SIGTERM)
def setSignalHandler(self): # pylint: disable=no-self-use
"""Set Signal Handler"""
"""Setting the Signal Handler"""
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
# signal.signal(signal.SIGINT, signal.SIG_DFL)
@staticmethod
def usage():
"""getting usages"""
"""After passing argument, method displays the usages"""
print 'Usage: ' + sys.argv[0] + ' [OPTIONS]'
print '''
Options:
@ -511,14 +511,14 @@ All parameters are optional.
'''
def stop(self): # pylint: disable=no-self-use
"""Stopping Bitmessage Deamon"""
"""Method helps to stop the Bitmessage Deamon"""
with shared.printLock:
print 'Stopping Bitmessage Deamon.'
shutdown.doCleanShutdown()
# ..todo: nice function but no one is using this
def getApiAddress(self): # pylint: disable=no-self-use
"""Getting Api Addresses"""
"""This method returns the Api Addresses"""
if not BMConfigParser().safeGetBoolean(
'bitmessagesettings', 'apienabled'):
return None
@ -528,7 +528,7 @@ All parameters are optional.
def main():
"""Start of main thread"""
"""Start of the main thread"""
mainprogram = Main()
mainprogram.start()

View File

@ -2,7 +2,6 @@
src/pyelliptic/openssl.py
=================================
"""
import sys
import ctypes
from kivy.utils import platform
@ -19,7 +18,8 @@ OpenSSL = None
class CipherName: # pylint: disable=old-style-class
"""Getting CipherName"""
"""Method helps to get pointers, name and blocksize"""
def __init__(self, name, pointer, blocksize):
self._name = name
self._pointer = pointer
@ -31,20 +31,20 @@ class CipherName: # pylint: disable=old-style-class
" | Function pointer : " + str(self._pointer)
def get_pointer(self):
"""Getting pointer"""
"""Method returns the pointer"""
return self._pointer()
def get_name(self):
"""Getting Name"""
"""Method returns the name"""
return self._name
def get_blocksize(self):
"""Getting blocksize"""
"""Method returns the blocksize"""
return self._blocksize
def get_version(library):
"""Getting versions"""
"""Method returns the version of the OpenSSL Library"""
version = None
hexversion = None
cflags = None
@ -645,7 +645,7 @@ class _OpenSSL: # pylint: disable=too-many-instance-attributes, old-style-cl
def loadOpenSSL():
"""Loading OpenSSL"""
"""Method find and load the OpenSSL library"""
# pylint: disable=global-statement, protected-access, too-many-branches
global OpenSSL
from os import path, environ