fix codacy coding standards issue

This commit is contained in:
surbhi 2018-07-03 15:36:20 +05:30
parent c1868456df
commit b4a0d8ad37
No known key found for this signature in database
GPG Key ID: 88928762974D3618
3 changed files with 40 additions and 48 deletions

View File

@ -1,4 +1,4 @@
<Login_Screen>: <LoginScreen>:
BoxLayout: BoxLayout:
AnchorLayout: AnchorLayout:
TextInput: TextInput:
@ -13,4 +13,4 @@
Button: Button:
id: btnExit id: btnExit
text: "Exit" text: "Exit"
on_press: root.say_exit() on_press: root.sayexit()

View File

@ -1,4 +1,5 @@
from bitmessagemain import main from bitmessagemain import main # import main method to run first for thread start
if __name__ == '__main__': if __name__ == '__main__':
"""python main will call for bitmessage main to start threads."""
main() main()

View File

@ -1,45 +1,51 @@
from kivy.app import App import threading
from kivy.uix.boxlayout import BoxLayout
from kivy.core.window import Window
from os import environ
# environ['BITMESSAGE_HOME'] = '~/home/cis/Desktop/pybit' import time
# environ['HOME'] = '~/home/cis/Desktop/pybit'
from addresses import addBMIfNotPresent, decodeAddress
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
from helper_ackPayload import genAckPayload from helper_ackPayload import genAckPayload
from addresses import decodeAddress, addBMIfNotPresent
from class_sqlThread import sqlThread
from helper_sql import sqlQuery, sqlExecute, sqlExecuteChunked, sqlStoredProcedure from helper_sql import sqlExecute
import time
from kivy.app import App
from kivy.core.window import Window
from kivy.uix.boxlayout import BoxLayout
import queues import queues
import state
import threading
import shutdown import shutdown
from inventory import Inventory
statusIconColor = 'red' statusIconColor = 'red'
class Login_Screen(BoxLayout): class LoginScreen(BoxLayout):
"""This will use for sending message to recipents from mobile client."""
def send(self): def send(self):
# print(len(Inventory()), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") """Send used for sending message with title and body."""
# print(len(Inventory().unexpired_hashes_by_stream(1)), "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDdd")
queues.apiAddressGeneratorReturnQueue.queue.clear() queues.apiAddressGeneratorReturnQueue.queue.clear()
streamNumberForAddress = 1 streamNumberForAddress = 1
label = "CisDevelper" label = "CisDevelper"
eighteenByteRipe = False eighteenByteRipe = False
nonceTrialsPerByte = 1000 nonceTrialsPerByte = 1000
payloadLengthExtraBytes = 1000 payloadLengthExtraBytes = 1000
print("BREAK POINT STARTING @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@") print("BREAK POINT STARTING")
queues.addressGeneratorQueue.put( ( queues.addressGeneratorQueue.put(
'createRandomAddress', 4, streamNumberForAddress, label, 1, "", eighteenByteRipe, nonceTrialsPerByte, payloadLengthExtraBytes ) (
'createRandomAddress', 4,
streamNumberForAddress, label, 1,
"", eighteenByteRipe, nonceTrialsPerByte,
payloadLengthExtraBytes
)
) )
print(BMConfigParser().sections(), "BMConfigParser().sections()") print(BMConfigParser().sections(), "BMConfigParser().sections()")
fromAddress = queues.apiAddressGeneratorReturnQueue.get() fromAddress = queues.apiAddressGeneratorReturnQueue.get()
print("BREAK POINT ENDING //////////////////////////////////////////////////////////////////") print("BREAK POINT ENDING")
# toAddress = "BM-NBqmcWH5XJMmXCVxD4HVTNPe3naGgHgE"
toAddress = "BM-2cWyUfBdY2FbgyuCb7abFZ49JYxSzUhNFe" toAddress = "BM-2cWyUfBdY2FbgyuCb7abFZ49JYxSzUhNFe"
message = self.ids.user_input.text message = self.ids.user_input.text
subject = 'Test' subject = 'Test'
@ -48,7 +54,8 @@ class Login_Screen(BoxLayout):
sendMessageToPeople = True sendMessageToPeople = True
if sendMessageToPeople: if sendMessageToPeople:
if toAddress != '': if toAddress != '':
status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress) status, addressVersionNumber, streamNumber, ripe = decodeAddress(
toAddress)
if status == 'success': if status == 'success':
toAddress = addBMIfNotPresent(toAddress) toAddress = addBMIfNotPresent(toAddress)
@ -61,7 +68,6 @@ class Login_Screen(BoxLayout):
stealthLevel = BMConfigParser().safeGetInt( stealthLevel = BMConfigParser().safeGetInt(
'bitmessagesettings', 'ackstealthlevel') 'bitmessagesettings', 'ackstealthlevel')
ackdata = genAckPayload(streamNumber, stealthLevel) ackdata = genAckPayload(streamNumber, stealthLevel)
t = ()
sqlExecute( sqlExecute(
'''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
'', '',
@ -79,34 +85,19 @@ class Login_Screen(BoxLayout):
'sent', 'sent',
encoding, encoding,
BMConfigParser().getint('bitmessagesettings', 'ttl')) BMConfigParser().getint('bitmessagesettings', 'ttl'))
toLabel = ''
# queryreturn = sqlQuery('''select status from sent''')
# if queryreturn != []:
# for row in queryreturn:
# print(row, "YZYZYZYZYZYZYZYZYZYZYZYZYZYZYZYZYZYZYZYZYZYZZYZYZYZYZYZYZYZYZY")
# toLabel, = row
queues.workerQueue.put(('sendmessage', toAddress)) queues.workerQueue.put(('sendmessage', toAddress))
print("sqlExecute successfully ##### ##################") print("sqlExecute successfully ##### ##################")
for i in threading.enumerate():
# App.get_running_app().stop() print(i.name)
# Window.close()
# shutdown.doCleanShutdown()
for i in threading.enumerate():
print (i.name)
# from threading import Timer
# t = Timer(300.0, connectedHostsList())
# t.start()
# print(connectedHostsList())
print("calling connectios")
return None return None
def say_exit(self): def sayexit(self):
print ("**************************EXITING FROM APPLICATION*****************************") print("**************************EXITING FROM APPLICATION*****************************")
shutdown.doCleanShutdown() shutdown.doCleanShutdown()
Window.close() Window.close()
class MainApp(App): class MainApp(App):
def build(self): def build(self):
return Login_Screen() return LoginScreen()