Updated code quality for bitmessagemain.py

This commit is contained in:
kuldeep.k@cisinlabs.com 2021-08-10 21:01:03 +05:30
parent f6cb3ad016
commit 8080e76650

View File

@ -12,15 +12,6 @@ The PyBitmessage startup script
import os import os
import sys import sys
try:
import pathmagic
except ImportError:
from pybitmessage import pathmagic
app_dir = pathmagic.setup()
import depends
depends.check_dependencies()
import ctypes import ctypes
import getopt import getopt
import multiprocessing import multiprocessing
@ -53,6 +44,15 @@ from threads import (
set_thread_name, printLock, set_thread_name, printLock,
addressGenerator, objectProcessor, singleCleaner, singleWorker, sqlThread) addressGenerator, objectProcessor, singleCleaner, singleWorker, sqlThread)
import depends
depends.check_dependencies()
try:
import pathmagic
except ImportError:
from pybitmessage import pathmagic
app_dir = pathmagic.setup()
def _fixSocket(): def _fixSocket():
if sys.platform.startswith('linux'): if sys.platform.startswith('linux'):
@ -424,9 +424,9 @@ class Main(object):
sys.stdout.flush() sys.stdout.flush()
sys.stderr.flush() sys.stderr.flush()
if not sys.platform.startswith('win'): if not sys.platform.startswith('win'):
si = file(os.devnull, 'r') si = open(os.devnull, 'r')
so = file(os.devnull, 'a+') so = open(os.devnull, 'a+')
se = file(os.devnull, 'a+', 0) se = open(os.devnull, 'a+', 0)
os.dup2(si.fileno(), sys.stdin.fileno()) os.dup2(si.fileno(), sys.stdin.fileno())
os.dup2(so.fileno(), sys.stdout.fileno()) os.dup2(so.fileno(), sys.stdout.fileno())
os.dup2(se.fileno(), sys.stderr.fileno()) os.dup2(se.fileno(), sys.stderr.fileno())