From 9bfd23ae678a3ebb56057cf6407a7e04fac47335 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 17 Nov 2020 17:23:33 +0300 Subject: [PATCH] Remove explicit `gevent` imports It is enough to monkey patch one time at the top level, which is done in `bin/srv.py` web server script. --- lib/adapter/cmd.py | 11 +++++------ lib/adapter/question.py | 6 ++---- lib/fmt/comments.py | 6 +----- lib/frontend/html.py | 7 ++----- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/lib/adapter/cmd.py b/lib/adapter/cmd.py index 1e90991..edcf923 100644 --- a/lib/adapter/cmd.py +++ b/lib/adapter/cmd.py @@ -1,15 +1,14 @@ """ """ -# pylint: disable=relative-import,wrong-import-position,unused-argument,abstract-method - -from gevent.monkey import patch_all -from gevent.subprocess import Popen, PIPE - -from .adapter import Adapter +# pylint: disable=unused-argument,abstract-method import os.path import re +from subprocess import Popen, PIPE + +from .adapter import Adapter + def _get_abspath(path): """Find absolute path of the specified `path` diff --git a/lib/adapter/question.py b/lib/adapter/question.py index 0e22d85..54b97ec 100644 --- a/lib/adapter/question.py +++ b/lib/adapter/question.py @@ -4,15 +4,13 @@ Configuration parameters: path.internal.bin.upstream """ -# pylint: disable=relative-import,wrong-import-position,wrong-import-order +# pylint: disable=relative-import from __future__ import print_function -from gevent.monkey import patch_all -from gevent.subprocess import Popen, PIPE - import os import re +from subprocess import Popen, PIPE from polyglot.detect import Detector from polyglot.detect.base import UnknownLanguage diff --git a/lib/fmt/comments.py b/lib/fmt/comments.py index 824140f..5b7625b 100644 --- a/lib/fmt/comments.py +++ b/lib/fmt/comments.py @@ -18,19 +18,15 @@ Exported functions: Configuration parameters: """ -# pylint: disable=wrong-import-position,wrong-import-order - from __future__ import print_function -from gevent.monkey import patch_all -from gevent.subprocess import Popen - import sys import os import textwrap import hashlib import re from itertools import groupby, chain +from subprocess import Popen from tempfile import NamedTemporaryFile from config import CONFIG diff --git a/lib/frontend/html.py b/lib/frontend/html.py index c73e96c..a130e69 100644 --- a/lib/frontend/html.py +++ b/lib/frontend/html.py @@ -5,22 +5,19 @@ Configuration parameters: path.internal.ansi2html """ -from gevent.monkey import patch_all -from gevent.subprocess import Popen, PIPE - -# pylint: disable=wrong-import-position,wrong-import-order import sys import os import re +from subprocess import Popen, PIPE MYDIR = os.path.abspath(os.path.join(__file__, '..', '..')) sys.path.append("%s/lib/" % MYDIR) +# pylint: disable=wrong-import-position from config import CONFIG from globals import error from buttons import TWITTER_BUTTON, GITHUB_BUTTON, GITHUB_BUTTON_FOOTER import frontend.ansi -# pylint: disable=wrong-import-position,wrong-import-order # temporary having it here, but actually we have the same data # in the adapter module