From 14fe92978e42b7f8cfbfd8339dba807240cb5259 Mon Sep 17 00:00:00 2001 From: Hengfeng Li Date: Sat, 1 Dec 2018 15:57:59 +1100 Subject: [PATCH] Fix the issues with flake8 and add some todos. --- Makefile | 5 ++++- README.md | 3 +++ kcpy/checkpoint.py | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 064c6a3..bb3aeb4 100644 --- a/Makefile +++ b/Makefile @@ -11,13 +11,16 @@ bump-minor: bump-major: $(BUMPVERSION) major -clean: clean-pyc clean-build +clean: clean-pyc clean-build clean-test clean-dist: clean clean-build: rm -rf build/ dist/ .eggs/ *.egg-info/ .tox/ .coverage cover/ +clean-test: + rm -rf .pytest_cache/ + clean-pyc: -find . -type f -a \( -name "*.pyc" -o -name "*$$py.class" \) | xargs rm -find . -type d -name "__pycache__" | xargs rm -r diff --git a/README.md b/README.md index 9ee1719..1a0589a 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,9 @@ Below shows the schema of checkpointing: ## Todo +* Add type checking with `mypy` +* Add the config for travis CI +* Add code coverage check * Support other storage solutions (mysql, dynamodb, redis, etc.) for checkpointing * Rebalance when the number of shards changes * Allow kcpy to run on multiple machines diff --git a/kcpy/checkpoint.py b/kcpy/checkpoint.py index 6f6da59..e3a75c1 100644 --- a/kcpy/checkpoint.py +++ b/kcpy/checkpoint.py @@ -14,8 +14,8 @@ def __init__(self, sqlite_file_path, db_name, consumer_name: str, stream_name: s def init_db(self): conn = sqlite3.connect(self.sqlite_file_path) c = conn.cursor() - c.execute(f'''CREATE TABLE IF NOT EXISTS {self.db_name} - (consumer_name text, stream_name text, shard_id text, seq_no text)''') + c.execute(f'CREATE TABLE IF NOT EXISTS {self.db_name}' + '(consumer_name text, stream_name text, shard_id text, seq_no text)') conn.commit() conn.close()