depends pylint fixes
This commit is contained in:
parent
21faf52f2f
commit
e97d02ed78
|
@ -113,6 +113,7 @@ PACKAGES = {
|
|||
|
||||
|
||||
def detectOS():
|
||||
"""Finding out what Operating System is running"""
|
||||
if detectOS.result is not None:
|
||||
return detectOS.result
|
||||
if sys.platform.startswith('openbsd'):
|
||||
|
@ -132,6 +133,7 @@ detectOS.result = None
|
|||
|
||||
|
||||
def detectOSRelease():
|
||||
"""Detecting the release of OS"""
|
||||
with open("/etc/os-release", 'r') as osRelease:
|
||||
version = None
|
||||
for line in osRelease:
|
||||
|
@ -148,6 +150,7 @@ def detectOSRelease():
|
|||
|
||||
|
||||
def try_import(module, log_extra=False):
|
||||
"""Try to import the non imported packages"""
|
||||
try:
|
||||
return import_module(module)
|
||||
except ImportError:
|
||||
|
@ -208,10 +211,8 @@ def check_sqlite():
|
|||
).fetchone()[0]
|
||||
logger.info('SQLite Library Source ID: %s', sqlite_source_id)
|
||||
if sqlite_version_number >= 3006023:
|
||||
compile_options = ', '.join(map(
|
||||
lambda row: row[0],
|
||||
conn.execute('PRAGMA compile_options;')
|
||||
))
|
||||
compile_options = ', '.join(
|
||||
[row[0] for row in conn.execute('PRAGMA compile_options;')])
|
||||
logger.info(
|
||||
'SQLite Library Compile Options: %s', compile_options)
|
||||
# There is no specific version requirement as yet, so we just
|
||||
|
@ -230,13 +231,13 @@ def check_sqlite():
|
|||
conn.close()
|
||||
|
||||
|
||||
def check_openssl():
|
||||
def check_openssl(): # pylint: disable=too-many-branches, too-many-return-statements
|
||||
"""Do openssl dependency check.
|
||||
|
||||
Here we are checking for openssl with its all dependent libraries
|
||||
and version checking.
|
||||
"""
|
||||
|
||||
# pylint: disable=protected-access, redefined-outer-name
|
||||
ctypes = try_import('ctypes')
|
||||
if not ctypes:
|
||||
logger.error('Unable to check OpenSSL.')
|
||||
|
@ -300,7 +301,7 @@ def check_openssl():
|
|||
' ECDH, and ECDSA enabled.')
|
||||
return False
|
||||
matches = cflags_regex.findall(openssl_cflags)
|
||||
if len(matches) > 0:
|
||||
if matches:
|
||||
logger.error(
|
||||
'This OpenSSL library is missing the following required'
|
||||
' features: %s. PyBitmessage requires OpenSSL 0.9.8b'
|
||||
|
@ -311,13 +312,13 @@ def check_openssl():
|
|||
return False
|
||||
|
||||
|
||||
# TODO: The minimum versions of pythondialog and dialog need to be determined
|
||||
# ..todo:: The minimum versions of pythondialog and dialog need to be determined
|
||||
def check_curses():
|
||||
"""Do curses dependency check.
|
||||
|
||||
Here we are checking for curses if available or not with check
|
||||
as interface requires the pythondialog <https://pypi.org/project/pythondialog>
|
||||
package and the dialog utility.
|
||||
Here we are checking for curses if available or not with check as interface
|
||||
requires the `pythondialog <https://pypi.org/project/pythondialog>`_ package
|
||||
and the dialog utility.
|
||||
"""
|
||||
if sys.hexversion < 0x20600F0:
|
||||
logger.error(
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
"""This module is for generating ack payload."""
|
||||
"""
|
||||
This module is for generating ack payload
|
||||
"""
|
||||
from binascii import hexlify
|
||||
from struct import pack
|
||||
|
||||
import highlevelcrypto
|
||||
import helper_random
|
||||
from binascii import hexlify
|
||||
from struct import pack
|
||||
from addresses import encodeVarint
|
||||
|
||||
# This function generates payload objects for message acknowledgements
|
||||
|
|
|
@ -3,6 +3,7 @@ from pyelliptic import arithmetic
|
|||
|
||||
# This function expects that pubkey begin with \x04
|
||||
def calculateBitcoinAddressFromPubkey(pubkey):
|
||||
"""This function expects that pubkey begin's with the bitcoin prefix"""
|
||||
if len(pubkey) != 65:
|
||||
print 'Could not calculate Bitcoin address from pubkey because function was passed a pubkey that was', len(pubkey), 'bytes long rather than 65.'
|
||||
return "error"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""Helper Inbox performs inbox messages related operations."""
|
||||
"""Helper Inbox performs inbox messages related operations"""
|
||||
|
||||
from helper_sql import sqlExecute, sqlQuery
|
||||
import queues
|
||||
|
||||
|
||||
def insert(t):
|
||||
"""Perform an insert into the "inbox" table"""
|
||||
"""Perform an insert into the "inbox" table"""
|
||||
sqlExecute('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?,?,?,?)''', *t)
|
||||
# shouldn't emit changedInboxUnread and displayNewInboxMessage
|
||||
# at the same time
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Convenience functions for random operations. Not suitable for security / cryptography operations."""
|
||||
"""
|
||||
Convenience functions for random operations. Not suitable for security / cryptography operations
|
||||
"""
|
||||
|
||||
import os
|
||||
import random
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
SQL-related functions defined here are really pass the queries (or other SQL
|
||||
commands) to :class:`.threads.sqlThread` through `sqlSubmitQueue` queue and check
|
||||
or return the result got from `sqlReturnQueue`.
|
||||
|
||||
This is done that way because :mod:`sqlite3` is so thread-unsafe that they
|
||||
won't even let you call it from different threads using your own locks.
|
||||
SQLite objects can only be used from one thread.
|
||||
|
||||
.. note:: This actually only applies for certain deployments, and/or
|
||||
really old version of sqlite. I haven't actually seen it anywhere.
|
||||
Current versions do have support for threading and multiprocessing.
|
||||
|
@ -50,6 +48,7 @@ def sqlQuery(sqlStatement, *args):
|
|||
|
||||
|
||||
def sqlExecuteChunked(sqlStatement, idCount, *args):
|
||||
"""Execute chunked SQL statement to avoid argument limit"""
|
||||
# SQLITE_MAX_VARIABLE_NUMBER,
|
||||
# unfortunately getting/setting isn't exposed to python
|
||||
sqlExecuteChunked.chunkSize = 999
|
||||
|
|
Loading…
Reference in New Issue
Block a user