Added a number of missing imports fixing several issues (thank you PyDev)
This commit is contained in:
parent
e9dc2d5c5e
commit
2eb6558cf1
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,3 +3,5 @@
|
||||||
**.DS_Store
|
**.DS_Store
|
||||||
src/build
|
src/build
|
||||||
src/dist
|
src/dist
|
||||||
|
src/.project
|
||||||
|
src/.pydevprojecy
|
||||||
|
|
|
@ -9,7 +9,7 @@ Usage (Windows):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys, os, shutil, re
|
import sys, os, shutil, re
|
||||||
from setuptools import setup
|
from setuptools import setup # @UnresolvedImport
|
||||||
|
|
||||||
|
|
||||||
name = "Bitmessage"
|
name = "Bitmessage"
|
||||||
|
|
|
@ -2,9 +2,11 @@ import shared
|
||||||
import threading
|
import threading
|
||||||
import bitmessagemain
|
import bitmessagemain
|
||||||
import time
|
import time
|
||||||
|
import sys
|
||||||
from pyelliptic.openssl import OpenSSL
|
from pyelliptic.openssl import OpenSSL
|
||||||
import ctypes
|
import ctypes
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import highlevelcrypto
|
||||||
from addresses import *
|
from addresses import *
|
||||||
from pyelliptic import arithmetic
|
from pyelliptic import arithmetic
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ class outgoingSynSender(threading.Thread):
|
||||||
shared.printLock.release()
|
shared.printLock.release()
|
||||||
except socks.Socks5AuthError as err:
|
except socks.Socks5AuthError as err:
|
||||||
shared.UISignalQueue.put((
|
shared.UISignalQueue.put((
|
||||||
'updateStatusBar', translateText(
|
'updateStatusBar', bitmessagemain.translateText(
|
||||||
"MainWindow", "SOCKS5 Authentication problem: %1").arg(str(err))))
|
"MainWindow", "SOCKS5 Authentication problem: %1").arg(str(err))))
|
||||||
except socks.Socks5Error as err:
|
except socks.Socks5Error as err:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -7,9 +7,16 @@ import pickle
|
||||||
import random
|
import random
|
||||||
from struct import unpack, pack
|
from struct import unpack, pack
|
||||||
import sys
|
import sys
|
||||||
|
import string
|
||||||
|
from subprocess import call # used when the API must execute an outside program
|
||||||
|
from pyelliptic.openssl import OpenSSL
|
||||||
|
|
||||||
|
import highlevelcrypto
|
||||||
from addresses import *
|
from addresses import *
|
||||||
import helper_generic
|
import helper_generic
|
||||||
|
import helper_bitcoin
|
||||||
|
import helper_inbox
|
||||||
|
import helper_sent
|
||||||
import bitmessagemain
|
import bitmessagemain
|
||||||
from bitmessagemain import lengthOfTimeToLeaveObjectsInInventory, lengthOfTimeToHoldOnToAllPubkeys, maximumAgeOfAnObjectThatIAmWillingToAccept, maximumAgeOfObjectsThatIAdvertiseToOthers, maximumAgeOfNodesThatIAdvertiseToOthers, numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer, neededPubkeys
|
from bitmessagemain import lengthOfTimeToLeaveObjectsInInventory, lengthOfTimeToHoldOnToAllPubkeys, maximumAgeOfAnObjectThatIAmWillingToAccept, maximumAgeOfObjectsThatIAdvertiseToOthers, maximumAgeOfNodesThatIAdvertiseToOthers, numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer, neededPubkeys
|
||||||
|
|
||||||
|
@ -814,8 +821,8 @@ class receiveDataThread(threading.Thread):
|
||||||
shared.sqlReturnQueue.get()
|
shared.sqlReturnQueue.get()
|
||||||
shared.sqlSubmitQueue.put('commit')
|
shared.sqlSubmitQueue.put('commit')
|
||||||
shared.sqlLock.release()
|
shared.sqlLock.release()
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (encryptedData[readPosition:], translateText("MainWindow",'Acknowledgement of the message received. %1').arg(unicode(
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (encryptedData[readPosition:], bitmessagemain.translateText("MainWindow",'Acknowledgement of the message received. %1').arg(unicode(
|
||||||
strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))), 'utf-8')))))
|
time.strftime(shared.config.get('bitmessagesettings', 'timeformat'), time.localtime(int(time.time()))), 'utf-8')))))
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
shared.printLock.acquire()
|
shared.printLock.acquire()
|
||||||
|
@ -1046,7 +1053,7 @@ class receiveDataThread(threading.Thread):
|
||||||
subject = self.addMailingListNameToSubject(
|
subject = self.addMailingListNameToSubject(
|
||||||
subject, mailingListName)
|
subject, mailingListName)
|
||||||
# Let us now send this message out as a broadcast
|
# Let us now send this message out as a broadcast
|
||||||
message = strftime("%a, %Y-%m-%d %H:%M:%S UTC", gmtime(
|
message = time.strftime("%a, %Y-%m-%d %H:%M:%S UTC", time.gmtime(
|
||||||
)) + ' Message ostensibly from ' + fromAddress + ':\n\n' + body
|
)) + ' Message ostensibly from ' + fromAddress + ':\n\n' + body
|
||||||
fromAddress = toAddress # The fromAddress for the broadcast that we are about to send is the toAddress (my address) for the msg message we are currently processing.
|
fromAddress = toAddress # The fromAddress for the broadcast that we are about to send is the toAddress (my address) for the msg message we are currently processing.
|
||||||
ackdata = OpenSSL.rand(
|
ackdata = OpenSSL.rand(
|
||||||
|
@ -1069,14 +1076,14 @@ class receiveDataThread(threading.Thread):
|
||||||
# Display timing data
|
# Display timing data
|
||||||
timeRequiredToAttemptToDecryptMessage = time.time(
|
timeRequiredToAttemptToDecryptMessage = time.time(
|
||||||
) - self.messageProcessingStartTime
|
) - self.messageProcessingStartTime
|
||||||
successfullyDecryptMessageTimings.append(
|
bitmessagemain.successfullyDecryptMessageTimings.append(
|
||||||
timeRequiredToAttemptToDecryptMessage)
|
timeRequiredToAttemptToDecryptMessage)
|
||||||
sum = 0
|
sum = 0
|
||||||
for item in successfullyDecryptMessageTimings:
|
for item in bitmessagemain.successfullyDecryptMessageTimings:
|
||||||
sum += item
|
sum += item
|
||||||
shared.printLock.acquire()
|
shared.printLock.acquire()
|
||||||
print 'Time to decrypt this message successfully:', timeRequiredToAttemptToDecryptMessage
|
print 'Time to decrypt this message successfully:', timeRequiredToAttemptToDecryptMessage
|
||||||
print 'Average time for all message decryption successes since startup:', sum / len(successfullyDecryptMessageTimings)
|
print 'Average time for all message decryption successes since startup:', sum / len(bitmessagemain.successfullyDecryptMessageTimings)
|
||||||
shared.printLock.release()
|
shared.printLock.release()
|
||||||
|
|
||||||
def isAckDataValid(self, ackData):
|
def isAckDataValid(self, ackData):
|
||||||
|
|
|
@ -4,6 +4,9 @@ import shared
|
||||||
import Queue
|
import Queue
|
||||||
from struct import unpack, pack
|
from struct import unpack, pack
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import random
|
||||||
|
import sys
|
||||||
|
import socket
|
||||||
|
|
||||||
import bitmessagemain
|
import bitmessagemain
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import threading
|
import threading
|
||||||
import shared
|
import shared
|
||||||
import time
|
import time
|
||||||
from bitmessagemain import lengthOfTimeToLeaveObjectsInInventory, lengthOfTimeToHoldOnToAllPubkeys, maximumAgeOfAnObjectThatIAmWillingToAccept, maximumAgeOfObjectsThatIAdvertiseToOthers, maximumAgeOfNodesThatIAdvertiseToOthers
|
from bitmessagemain import lengthOfTimeToLeaveObjectsInInventory, lengthOfTimeToHoldOnToAllPubkeys, maximumAgeOfAnObjectThatIAmWillingToAccept, maximumAgeOfObjectsThatIAdvertiseToOthers, maximumAgeOfNodesThatIAdvertiseToOthers,\
|
||||||
|
neededPubkeys
|
||||||
|
import sys
|
||||||
|
|
||||||
'''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 sends pong messages to keep connections alive if the network isn't busy.
|
'''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 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:
|
||||||
|
|
|
@ -7,6 +7,9 @@ from addresses import *
|
||||||
import bitmessagemain
|
import bitmessagemain
|
||||||
import highlevelcrypto
|
import highlevelcrypto
|
||||||
import proofofwork
|
import proofofwork
|
||||||
|
from bitmessagemain import neededPubkeys, encryptedBroadcastSwitchoverTime
|
||||||
|
import sys
|
||||||
|
from class_addressGenerator import pointMult
|
||||||
|
|
||||||
# This thread, of which there is only one, does the heavy lifting:
|
# This thread, of which there is only one, does the heavy lifting:
|
||||||
# calculating POWs.
|
# calculating POWs.
|
||||||
|
|
|
@ -4,6 +4,7 @@ import sqlite3
|
||||||
import time
|
import time
|
||||||
import shutil # used for moving the messages.dat file
|
import shutil # used for moving the messages.dat file
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
# This thread exists because SQLITE3 is so un-threadsafe that we must
|
# This thread exists because SQLITE3 is so un-threadsafe that we must
|
||||||
# submit queries to it and it puts results back in a different queue. They
|
# submit queries to it and it puts results back in a different queue. They
|
||||||
|
|
|
@ -59,7 +59,7 @@ if __name__ == "__main__":
|
||||||
APPNAME = "PyBitmessage"
|
APPNAME = "PyBitmessage"
|
||||||
from os import path, environ
|
from os import path, environ
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
from AppKit import NSSearchPathForDirectoriesInDomains
|
from AppKit import NSSearchPathForDirectoriesInDomains # @UnresolvedImport
|
||||||
# http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/func/NSSearchPathForDirectoriesInDomains
|
# http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/func/NSSearchPathForDirectoriesInDomains
|
||||||
# NSApplicationSupportDirectory = 14
|
# NSApplicationSupportDirectory = 14
|
||||||
# NSUserDomainMask = 1
|
# NSUserDomainMask = 1
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import shared
|
import shared
|
||||||
|
import sys
|
||||||
|
|
||||||
def convertIntToString(n):
|
def convertIntToString(n):
|
||||||
a = __builtins__.hex(n)
|
a = __builtins__.hex(n)
|
||||||
|
|
|
@ -8,7 +8,6 @@ storeConfigFilesInSameDirectoryAsProgramByDefault = False # The user may de-sel
|
||||||
def loadConfig():
|
def loadConfig():
|
||||||
# First try to load the config file (the keys.dat file) from the program
|
# First try to load the config file (the keys.dat file) from the program
|
||||||
# directory
|
# directory
|
||||||
shared.config = ConfigParser.SafeConfigParser()
|
|
||||||
shared.config.read('keys.dat')
|
shared.config.read('keys.dat')
|
||||||
try:
|
try:
|
||||||
shared.config.get('bitmessagesettings', 'settingsversion')
|
shared.config.get('bitmessagesettings', 'settingsversion')
|
||||||
|
|
|
@ -4,16 +4,17 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
from struct import unpack, pack
|
from struct import unpack, pack
|
||||||
import sys
|
import sys
|
||||||
|
from shared import config
|
||||||
#import os
|
#import os
|
||||||
|
|
||||||
def _set_idle():
|
def _set_idle():
|
||||||
if 'linux' in sys.platform:
|
if 'linux' in sys.platform:
|
||||||
import os
|
import os
|
||||||
os.nice(20)
|
os.nice(20) # @UndefinedVariable
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
sys.getwindowsversion()
|
sys.getwindowsversion()
|
||||||
import win32api,win32process,win32con
|
import win32api,win32process,win32con # @UnresolvedImport
|
||||||
pid = win32api.GetCurrentProcessId()
|
pid = win32api.GetCurrentProcessId()
|
||||||
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
|
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
|
||||||
win32process.SetPriorityClass(handle, win32process.IDLE_PRIORITY_CLASS)
|
win32process.SetPriorityClass(handle, win32process.IDLE_PRIORITY_CLASS)
|
||||||
|
|
|
@ -8,7 +8,9 @@ import Queue
|
||||||
import pickle
|
import pickle
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import ConfigParser
|
||||||
|
|
||||||
|
config = ConfigParser.SafeConfigParser()
|
||||||
myECCryptorObjects = {}
|
myECCryptorObjects = {}
|
||||||
MyECSubscriptionCryptorObjects = {}
|
MyECSubscriptionCryptorObjects = {}
|
||||||
myAddressesByHash = {} #The key in this dictionary is the RIPE hash which is encoded in an address and value is the address itself.
|
myAddressesByHash = {} #The key in this dictionary is the RIPE hash which is encoded in an address and value is the address itself.
|
||||||
|
|
|
@ -34,7 +34,7 @@ class singleinstance:
|
||||||
print(e.errno)
|
print(e.errno)
|
||||||
raise
|
raise
|
||||||
else: # non Windows
|
else: # non Windows
|
||||||
import fcntl
|
import fcntl # @UnresolvedImport
|
||||||
self.fp = open(self.lockfile, 'w')
|
self.fp = open(self.lockfile, 'w')
|
||||||
try:
|
try:
|
||||||
fcntl.lockf(self.fp, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
fcntl.lockf(self.fp, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||||
|
@ -53,7 +53,7 @@ class singleinstance:
|
||||||
os.close(self.fd)
|
os.close(self.fd)
|
||||||
os.unlink(self.lockfile)
|
os.unlink(self.lockfile)
|
||||||
else:
|
else:
|
||||||
import fcntl
|
import fcntl # @UnresolvedImport
|
||||||
fcntl.lockf(self.fp, fcntl.LOCK_UN)
|
fcntl.lockf(self.fp, fcntl.LOCK_UN)
|
||||||
if os.path.isfile(self.lockfile):
|
if os.path.isfile(self.lockfile):
|
||||||
os.unlink(self.lockfile)
|
os.unlink(self.lockfile)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user