From 3866041bba04e2f611292f5551653439854a7525 Mon Sep 17 00:00:00 2001 From: Mark Mayo Date: Tue, 22 Nov 2022 17:25:34 +1300 Subject: [PATCH] python 3 updates - sorted imports with isort - removed inherits of object - no need to prefix strings with u - tidied whitespace/indents/newlines --- bin/app.py | 18 +++++++++--------- bin/clean_cache.py | 3 ++- bin/release.py | 6 +++--- bin/srv.py | 4 ++-- lib/adapter/__init__.py | 4 ++-- lib/adapter/adapter.py | 6 ++++-- lib/adapter/cheat_cheat.py | 1 + lib/adapter/cheat_sheets.py | 3 ++- lib/adapter/cmd.py | 2 +- lib/adapter/common.py | 3 +-- lib/adapter/git_adapter.py | 3 ++- lib/adapter/internal.py | 11 ++++++----- lib/adapter/latenz.py | 4 +++- lib/adapter/learnxiny.py | 6 +++++- lib/adapter/question.py | 8 ++++---- lib/adapter/rosetta.py | 6 ++++-- lib/adapter/tldr.py | 3 ++- lib/adapter/upstream.py | 4 +++- lib/buttons.py | 1 - lib/cache.py | 3 ++- lib/cheat_wrapper.py | 10 +++++----- lib/config.py | 2 ++ lib/fetch.py | 6 +++--- lib/fmt/comments.py | 10 +++++----- lib/fmt/internal.py | 2 +- lib/fmt/markdown.py | 2 ++ lib/frontend/ansi.py | 14 ++++++++------ lib/frontend/html.py | 8 ++++---- lib/globals.py | 3 ++- lib/limits.py | 3 ++- lib/panela/colors.py | 26 ++++++++++++-------------- lib/panela/panela_colors.py | 23 ++++++++++++----------- lib/post.py | 4 +++- lib/postprocessing.py | 3 ++- lib/routing.py | 21 +++++++++++---------- lib/search.py | 1 + lib/standalone.py | 3 +++ lib/stateful_queries.py | 1 + 38 files changed, 137 insertions(+), 104 deletions(-) diff --git a/bin/app.py b/bin/app.py index d965bd7..e11c226 100644 --- a/bin/app.py +++ b/bin/app.py @@ -17,26 +17,26 @@ Configuration parameters: from __future__ import print_function import sys + if sys.version_info[0] < 3: reload(sys) sys.setdefaultencoding('utf8') -import sys import logging import os -import requests +import sys + import jinja2 -from flask import Flask, request, send_from_directory, redirect, Response +import requests +from flask import Flask, Response, redirect, request, send_from_directory sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "lib"))) +from cheat_wrapper import cheat_wrapper from config import CONFIG from limits import Limits -from cheat_wrapper import cheat_wrapper -from post import process_post_request from options import parse_args - -from stateful_queries import save_query, last_query - +from post import process_post_request +from stateful_queries import last_query, save_query if not os.path.exists(os.path.dirname(CONFIG["path.log.main"])): os.makedirs(os.path.dirname(CONFIG["path.log.main"])) @@ -58,7 +58,7 @@ stderr_handler.setFormatter(logging.Formatter('%(filename)s:%(lineno)s: %(messag # (https://github.com/pallets/werkzeug/issues/1969) # resulting in duplicating lines. In that case we need root # stderr handler to skip lines from werkzeug. -class SkipFlaskLogger(object): +class SkipFlaskLogger(): def filter(self, record): if record.name != 'werkzeug': return True diff --git a/bin/clean_cache.py b/bin/clean_cache.py index bc19aa8..0d1816b 100644 --- a/bin/clean_cache.py +++ b/bin/clean_cache.py @@ -1,7 +1,8 @@ import sys + import redis + REDIS = redis.Redis(host='localhost', port=6379, db=0) for key in sys.argv[1:]: REDIS.delete(key) - diff --git a/bin/release.py b/bin/release.py index 3283fa6..2932ec0 100755 --- a/bin/release.py +++ b/bin/release.py @@ -2,14 +2,14 @@ from __future__ import print_function -from datetime import datetime import os -from os import path import re import shutil import subprocess -from subprocess import Popen import sys +from datetime import datetime +from os import path +from subprocess import Popen SHARE_DIR = path.join(path.dirname(__file__), "../share/") diff --git a/bin/srv.py b/bin/srv.py index 847375a..73a405d 100644 --- a/bin/srv.py +++ b/bin/srv.py @@ -5,13 +5,13 @@ from gevent.monkey import patch_all from gevent.pywsgi import WSGIServer + patch_all() import os import sys -from app import app, CONFIG - +from app import CONFIG, app if '--debug' in sys.argv: # Not all debug mode features are available under `gevent` diff --git a/lib/adapter/__init__.py b/lib/adapter/__init__.py index 50d30cd..20c21c5 100644 --- a/lib/adapter/__init__.py +++ b/lib/adapter/__init__.py @@ -6,13 +6,13 @@ and make them available for import as # pylint: disable=wildcard-import,relative-import -from os.path import dirname, basename, isfile, join import glob +from os.path import basename, dirname, isfile, join __all__ = [ basename(f)[:-3] for f in glob.glob(join(dirname(__file__), "*.py")) if isfile(f) and not f.endswith('__init__.py')] -from .adapter import all_adapters from . import * +from .adapter import all_adapters diff --git a/lib/adapter/adapter.py b/lib/adapter/adapter.py index ffa55ec..840690a 100644 --- a/lib/adapter/adapter.py +++ b/lib/adapter/adapter.py @@ -8,8 +8,10 @@ Configuration parameters: import abc import os -from six import with_metaclass + from config import CONFIG +from six import with_metaclass + class AdapterMC(type): """ @@ -21,7 +23,7 @@ class AdapterMC(type): return getattr(cls, '_class_repr')() return super(AdapterMC, cls).__repr__() -class Adapter(with_metaclass(AdapterMC, object)): +class Adapter(with_metaclass(AdapterMC)): """ An abstract class, defines methods: diff --git a/lib/adapter/cheat_cheat.py b/lib/adapter/cheat_cheat.py index 9ba9955..ca80f08 100644 --- a/lib/adapter/cheat_cheat.py +++ b/lib/adapter/cheat_cheat.py @@ -9,6 +9,7 @@ Each cheat sheet is a separate file without extension from .git_adapter import GitRepositoryAdapter + class Cheat(GitRepositoryAdapter): """ cheat/cheat adapter diff --git a/lib/adapter/cheat_sheets.py b/lib/adapter/cheat_sheets.py index 01666a2..45efa7c 100644 --- a/lib/adapter/cheat_sheets.py +++ b/lib/adapter/cheat_sheets.py @@ -6,11 +6,12 @@ sheets covering programming languages are are located in subdirectories. # pylint: disable=relative-import -import os import glob +import os from .git_adapter import GitRepositoryAdapter + def _remove_initial_underscore(filename): if filename.startswith('_'): filename = filename[1:] diff --git a/lib/adapter/cmd.py b/lib/adapter/cmd.py index edcf923..c2c6083 100644 --- a/lib/adapter/cmd.py +++ b/lib/adapter/cmd.py @@ -5,7 +5,7 @@ import os.path import re -from subprocess import Popen, PIPE +from subprocess import PIPE, Popen from .adapter import Adapter diff --git a/lib/adapter/common.py b/lib/adapter/common.py index 9efce00..de6deba 100644 --- a/lib/adapter/common.py +++ b/lib/adapter/common.py @@ -1,6 +1,5 @@ -class Adapter(object): +class Adapter(): pass class cheatAdapter(Adapter): pass - diff --git a/lib/adapter/git_adapter.py b/lib/adapter/git_adapter.py index 8aa1864..8a4df2d 100644 --- a/lib/adapter/git_adapter.py +++ b/lib/adapter/git_adapter.py @@ -5,7 +5,8 @@ Implementation of `GitRepositoryAdapter`, adapter that is used to handle git rep import glob import os -from .adapter import Adapter # pylint: disable=relative-import +from .adapter import Adapter # pylint: disable=relative-import + def _get_filenames(path): return [os.path.split(topic)[1] for topic in glob.glob(path)] diff --git a/lib/adapter/internal.py b/lib/adapter/internal.py index da1e416..aa04ff8 100644 --- a/lib/adapter/internal.py +++ b/lib/adapter/internal.py @@ -5,21 +5,22 @@ Configuration parameters: path.internal.pages """ -import sys -import os import collections +import os +import sys try: - from rapidfuzz import process, fuzz + from rapidfuzz import fuzz, process _USING_FUZZYWUZZY=False except ImportError: - from fuzzywuzzy import process, fuzz + from fuzzywuzzy import fuzz, process _USING_FUZZYWUZZY=True from config import CONFIG -from .adapter import Adapter from fmt.internal import colorize_internal +from .adapter import Adapter + _INTERNAL_TOPICS = [ ":cht.sh", ":bash_completion", diff --git a/lib/adapter/latenz.py b/lib/adapter/latenz.py index 4b73ee3..cc78ad3 100644 --- a/lib/adapter/latenz.py +++ b/lib/adapter/latenz.py @@ -8,10 +8,12 @@ The adapter exposes one page ("latencies") and several its aliases # pylint: disable=relative-import -import sys import os +import sys + from .git_adapter import GitRepositoryAdapter + class Latenz(GitRepositoryAdapter): """ diff --git a/lib/adapter/learnxiny.py b/lib/adapter/learnxiny.py index 3b16b72..e2407bd 100644 --- a/lib/adapter/learnxiny.py +++ b/lib/adapter/learnxiny.py @@ -9,11 +9,15 @@ Configuration parameters: # pylint: disable=relative-import from __future__ import print_function + import os import re + from config import CONFIG + from .git_adapter import GitRepositoryAdapter + class LearnXinY(GitRepositoryAdapter): """ @@ -62,7 +66,7 @@ class LearnXinY(GitRepositoryAdapter): return self.adapters[lang].is_valid(topic) -class LearnXYAdapter(object): +class LearnXYAdapter(): """ Parent class of all languages adapters diff --git a/lib/adapter/question.py b/lib/adapter/question.py index 994156d..25c548a 100644 --- a/lib/adapter/question.py +++ b/lib/adapter/question.py @@ -10,13 +10,13 @@ from __future__ import print_function import os import re -from subprocess import Popen, PIPE - -from polyglot.detect import Detector -from polyglot.detect.base import UnknownLanguage +from subprocess import PIPE, Popen from config import CONFIG from languages_data import SO_NAME +from polyglot.detect import Detector +from polyglot.detect.base import UnknownLanguage + from .upstream import UpstreamAdapter NOT_FOUND_MESSAGE = """404 NOT FOUND diff --git a/lib/adapter/rosetta.py b/lib/adapter/rosetta.py index 2ed23b4..8cd3b69 100644 --- a/lib/adapter/rosetta.py +++ b/lib/adapter/rosetta.py @@ -8,12 +8,14 @@ Exports: # pylint: disable=relative-import -import os import glob +import os + import yaml -from .git_adapter import GitRepositoryAdapter from .cheat_sheets import CheatSheets +from .git_adapter import GitRepositoryAdapter + class Rosetta(GitRepositoryAdapter): diff --git a/lib/adapter/tldr.py b/lib/adapter/tldr.py index 9b32434..7b27d53 100644 --- a/lib/adapter/tldr.py +++ b/lib/adapter/tldr.py @@ -9,11 +9,12 @@ The pages are formatted with a markdown dialect # pylint: disable=relative-import,abstract-method -import re import os +import re from .git_adapter import GitRepositoryAdapter + class Tldr(GitRepositoryAdapter): """ diff --git a/lib/adapter/upstream.py b/lib/adapter/upstream.py index 786d9b2..04e2f6f 100644 --- a/lib/adapter/upstream.py +++ b/lib/adapter/upstream.py @@ -10,11 +10,13 @@ Configuration parameters: # pylint: disable=relative-import import textwrap -import requests +import requests from config import CONFIG + from .adapter import Adapter + def _are_you_offline(): return textwrap.dedent( """ diff --git a/lib/buttons.py b/lib/buttons.py index 8c57736..17ed7f0 100644 --- a/lib/buttons.py +++ b/lib/buttons.py @@ -17,4 +17,3 @@ GITHUB_BUTTON_FOOTER = """ """ - diff --git a/lib/cache.py b/lib/cache.py index 8e2b126..4655730 100644 --- a/lib/cache.py +++ b/lib/cache.py @@ -12,8 +12,9 @@ Configuration parameters: cache.redis.port """ -import os import json +import os + from config import CONFIG _REDIS = None diff --git a/lib/cheat_wrapper.py b/lib/cheat_wrapper.py index fdcaff6..fe8deec 100644 --- a/lib/cheat_wrapper.py +++ b/lib/cheat_wrapper.py @@ -8,16 +8,16 @@ Exports: cheat_wrapper() """ -import re import json +import re +import frontend.ansi +import frontend.html +import postprocessing +from languages_data import LANGUAGE_ALIAS, rewrite_editor_section_name from routing import get_answers, get_topics_list from search import find_answers_by_keyword -from languages_data import LANGUAGE_ALIAS, rewrite_editor_section_name -import postprocessing -import frontend.html -import frontend.ansi def _add_section_name(query): # temporary solution before we don't find a fixed one diff --git a/lib/config.py b/lib/config.py index 25c9785..39d3744 100644 --- a/lib/config.py +++ b/lib/config.py @@ -42,9 +42,11 @@ specified by an environment variable is not an integer, it is ignored. """ from __future__ import print_function + import os from pygments.styles import get_all_styles + #def get_all_styles(): # return [] diff --git a/lib/fetch.py b/lib/fetch.py index bc21047..4cbea5d 100644 --- a/lib/fetch.py +++ b/lib/fetch.py @@ -12,17 +12,17 @@ Configuration parameters: from __future__ import print_function -import sys import logging import os import subprocess +import sys import textwrap -from globals import fatal import adapter import cache - from config import CONFIG +from globals import fatal + def _log(*message): logging.info(*message) diff --git a/lib/fmt/comments.py b/lib/fmt/comments.py index 8bd122d..5e428f1 100644 --- a/lib/fmt/comments.py +++ b/lib/fmt/comments.py @@ -20,18 +20,18 @@ Configuration parameters: from __future__ import print_function -import sys -import os -import textwrap import hashlib +import os import re -from itertools import groupby, chain +import sys +import textwrap +from itertools import chain, groupby from subprocess import Popen from tempfile import NamedTemporaryFile +import cache from config import CONFIG from languages_data import VIM_NAME -import cache FNULL = open(os.devnull, 'w') TEXT = 0 diff --git a/lib/fmt/internal.py b/lib/fmt/internal.py index a30ab95..699d610 100644 --- a/lib/fmt/internal.py +++ b/lib/fmt/internal.py @@ -5,8 +5,8 @@ Will be merged with panela later. import re -from colorama import Fore, Back, Style import colored +from colorama import Back, Fore, Style PALETTES = { 0: { diff --git a/lib/fmt/markdown.py b/lib/fmt/markdown.py index e120a8c..dca1066 100644 --- a/lib/fmt/markdown.py +++ b/lib/fmt/markdown.py @@ -8,9 +8,11 @@ Uses external pygments formatters for highlighting (passed as an argument). """ import re + import ansiwrap import colored + def format_text(text, config=None, highlighter=None): """ Renders `text` according to markdown rules. diff --git a/lib/frontend/ansi.py b/lib/frontend/ansi.py index 276d58b..052593b 100644 --- a/lib/frontend/ansi.py +++ b/lib/frontend/ansi.py @@ -23,19 +23,21 @@ Configuration parameters: """ import os -import sys import re +import sys import colored from pygments import highlight as pygments_highlight -from pygments.formatters import Terminal256Formatter # pylint: disable=no-name-in-module +from pygments.formatters import \ + Terminal256Formatter # pylint: disable=no-name-in-module + # pylint: disable=wrong-import-position sys.path.append(os.path.abspath(os.path.join(__file__, '..'))) -from config import CONFIG -import languages_data # pylint: enable=wrong-import-position - -import fmt.internal import fmt.comments +import fmt.internal +import languages_data # pylint: enable=wrong-import-position +from config import CONFIG + def visualize(answer_data, request_options): """ diff --git a/lib/frontend/html.py b/lib/frontend/html.py index 43469d3..cdc722e 100644 --- a/lib/frontend/html.py +++ b/lib/frontend/html.py @@ -5,19 +5,19 @@ Configuration parameters: path.internal.ansi2html """ -import sys import os import re -from subprocess import Popen, PIPE +import sys +from subprocess import PIPE, Popen MYDIR = os.path.abspath(os.path.join(__file__, '..', '..')) sys.path.append("%s/lib/" % MYDIR) +import frontend.ansi +from buttons import GITHUB_BUTTON, GITHUB_BUTTON_FOOTER, TWITTER_BUTTON # 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 # temporary having it here, but actually we have the same data # in the adapter module diff --git a/lib/globals.py b/lib/globals.py index 4af832a..1956534 100644 --- a/lib/globals.py +++ b/lib/globals.py @@ -6,8 +6,9 @@ For the configuration related things see `config.py` from __future__ import print_function -import sys import logging +import sys + def fatal(text): """ diff --git a/lib/limits.py b/lib/limits.py index 6abea2d..36a76d6 100644 --- a/lib/limits.py +++ b/lib/limits.py @@ -17,6 +17,7 @@ Usage: """ import time + from globals import log _WHITELIST = ['5.9.243.177'] @@ -28,7 +29,7 @@ def _time_caps(minutes, hours, days): 'day': days, } -class Limits(object): +class Limits(): """ Queries limitation (by IP). diff --git a/lib/panela/colors.py b/lib/panela/colors.py index 7373fca..db06f00 100644 --- a/lib/panela/colors.py +++ b/lib/panela/colors.py @@ -1,5 +1,5 @@ -import os import json +import os COLORS_JSON = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'colors.json') COLOR_TABLE = json.loads(open(COLORS_JSON, 'r').read()) @@ -7,19 +7,17 @@ VALID_COLORS = [x['hexString'] for x in COLOR_TABLE] HEX_TO_ANSI = {x['hexString']:x['colorId'] for x in COLOR_TABLE} def rgb_from_str(s): - # s starts with a #. - r, g, b = int(s[1:3],16), int(s[3:5], 16),int(s[5:7], 16) - return r, g, b + # s starts with a #. + r, g, b = int(s[1:3],16), int(s[3:5], 16),int(s[5:7], 16) + return r, g, b -def find_nearest_color(hex_color): +def find_nearest_color(hex_color): R, G, B = rgb_from_str(hex_color) mindiff = None - for d in VALID_COLORS: - r, g, b = rgb_from_str(d) - diff = abs(R -r)*256 + abs(G-g)* 256 + abs(B- b)* 256 - if mindiff is None or diff < mindiff: - mindiff = diff - mincolorname = d - return mincolorname - - + for d in VALID_COLORS: + r, g, b = rgb_from_str(d) + diff = abs(R -r)*256 + abs(G-g)* 256 + abs(B- b)* 256 + if mindiff is None or diff < mindiff: + mindiff = diff + mincolorname = d + return mincolorname diff --git a/lib/panela/panela_colors.py b/lib/panela/panela_colors.py index 00bf58b..a4244a3 100644 --- a/lib/panela/panela_colors.py +++ b/lib/panela/panela_colors.py @@ -1,9 +1,10 @@ # vim: encoding=utf-8 +import itertools import os import sys + import colored -import itertools from globals import MYDIR """ @@ -18,9 +19,9 @@ TODO: """ -from wcwidth import wcswidth -from colors import find_nearest_color, HEX_TO_ANSI, rgb_from_str import pyte +from colors import HEX_TO_ANSI, find_nearest_color, rgb_from_str +from wcwidth import wcswidth # http://stackoverflow.com/questions/19782975/convert-rgb-color-to-the-nearest-color-in-palette-web-safe-color @@ -35,7 +36,7 @@ def color_mapping(clr): return None return clr -class Point(object): +class Point(): """ One point (character) on a terminal """ @@ -452,9 +453,9 @@ class Panela: """ frame_chars = { - 'ascii': u'++++-|', - 'single': u'┌┐└┘─│', - 'double': u'┌┐└┘─│', + 'ascii': '++++-|', + 'single': '┌┐└┘─│', + 'double': '┌┐└┘─│', } if frame in frame_chars: chars = frame_chars[frame] @@ -493,16 +494,16 @@ class Panela: self.put_point(x0, y0 - radius, char=char, color=color, background=background) self.put_point(x0 + k(radius), y0, char=char, color=color, background=background) self.put_point(x0 - k(radius), y0, char=char, color=color, background=background) - + char = "x" while x < y: - if f >= 0: + if f >= 0: y -= 1 ddf_y += 2 f += ddf_y x += 1 ddf_x += 2 - f += ddf_x + f += ddf_x self.put_point(x0 + k(x), y0 + y, char=char, color=color, background=background) self.put_point(x0 - k(x), y0 + y, char=char, color=color, background=background) self.put_point(x0 + k(x), y0 - y, char=char, color=color, background=background) @@ -558,7 +559,7 @@ class Panela: ######################################################################################################## -class Template(object): +class Template(): def __init__(self): self._mode = 'page' self.page = [] diff --git a/lib/post.py b/lib/post.py index aa6b51b..5114ad1 100644 --- a/lib/post.py +++ b/lib/post.py @@ -7,11 +7,13 @@ Configuration parameters: path.spool """ -import string import os import random +import string + from config import CONFIG + def _save_cheatsheet(topic_name, cheatsheet): """ Save posted cheat sheet `cheatsheet` with `topic_name` diff --git a/lib/postprocessing.py b/lib/postprocessing.py index 649c4a6..3557aee 100644 --- a/lib/postprocessing.py +++ b/lib/postprocessing.py @@ -1,5 +1,6 @@ -import search import fmt.comments +import search + def postprocess(answer, keyword, options, request_options=None): answer = _answer_add_comments(answer, request_options=request_options) diff --git a/lib/routing.py b/lib/routing.py index e45002e..967b643 100644 --- a/lib/routing.py +++ b/lib/routing.py @@ -11,7 +11,6 @@ import random import re from typing import Any, Dict, List -import cache import adapter.cheat_sheets import adapter.cmd import adapter.internal @@ -19,9 +18,11 @@ import adapter.latenz import adapter.learnxiny import adapter.question import adapter.rosetta +import cache from config import CONFIG -class Router(object): + +class Router(): """ Implementation of query routing. Routing is based on `routing_table` @@ -133,24 +134,24 @@ class Router(object): #Here we still check that cleaned_topic_list in not empty if not cleaned_topic_list: return prefix - + random_topic = random.choice(cleaned_topic_list) return prefix + random_topic - + if topic.endswith('/:random') or topic.lstrip('/') == ':random': #We strip the :random part and see if the query is valid by running a get_topics_list() if topic.lstrip('/') == ':random' : - topic = topic.lstrip('/') + topic = topic.lstrip('/') prefix = topic[:-7] - + topic_list = [x[len(prefix):] for x in self.get_topics_list() if x.startswith(prefix)] - if '' in topic_list: + if '' in topic_list: topic_list.remove('') - if topic_list: + if topic_list: # This is a correct formatted random query like /cpp/:random as the topic_list is not empty. random_topic = __select_random_topic(prefix, topic_list) return random_topic @@ -162,7 +163,7 @@ class Router(object): #Here if not a random requst, we just forward the topic return topic - + def get_answers(self, topic: str, request_options:Dict[str, str] = None) -> List[Dict[str, Any]]: """ Find cheat sheets for the topic. @@ -173,7 +174,7 @@ class Router(object): Returns: [answer_dict]: list of answers (dictionaries) """ - + # if topic specified as :, # cut off topic_type = "" diff --git a/lib/search.py b/lib/search.py index 02d67b6..b1046c7 100644 --- a/lib/search.py +++ b/lib/search.py @@ -24,6 +24,7 @@ import re from config import CONFIG from routing import get_answers, get_topics_list + def _limited_entry(): return { 'topic_type': 'LIMITED', diff --git a/lib/standalone.py b/lib/standalone.py index 97b6b66..92e2d1a 100644 --- a/lib/standalone.py +++ b/lib/standalone.py @@ -6,17 +6,20 @@ from __future__ import print_function import sys import textwrap + try: import urlparse except ModuleNotFoundError: import urllib.parse as urlparse import config + config.CONFIG["cache.type"] = "none" import cheat_wrapper import options + def show_usage(): """ Show how to use the program in the standalone mode diff --git a/lib/stateful_queries.py b/lib/stateful_queries.py index d196f6a..605d56a 100644 --- a/lib/stateful_queries.py +++ b/lib/stateful_queries.py @@ -4,6 +4,7 @@ Support for the stateful queries import cache + def save_query(client_id, query): """ Save the last query `query` for the client `client_id`