From 3f281c220b7e25979b2a0383cd09ece6fdeaec15 Mon Sep 17 00:00:00 2001 From: Micah Jerome Ellison Date: Sat, 7 Nov 2020 14:18:34 -0800 Subject: [PATCH] Update black pin to latest version, poetry update, and make format --- features/steps/export_steps.py | 2 +- jrnl/Journal.py | 5 +++- jrnl/args.py | 9 ++++++-- jrnl/cli.py | 3 ++- jrnl/install.py | 7 +++++- jrnl/jrnl.py | 3 ++- poetry.lock | 42 +++++++++++++++++++++++++++------- pyproject.toml | 2 +- tests/test_parse_args.py | 6 ++++- tests/test_time.py | 17 ++++++++------ 10 files changed, 72 insertions(+), 24 deletions(-) diff --git a/features/steps/export_steps.py b/features/steps/export_steps.py index 9003c1bd..d7173ace 100644 --- a/features/steps/export_steps.py +++ b/features/steps/export_steps.py @@ -50,7 +50,7 @@ def check_output_field_key(context, field, key): @then("the json output should contain {path}") @then('the json output should contain {path} = "{value}"') def check_json_output_path(context, path, value=None): - """ E.g. + """E.g. the json output should contain entries.0.title = "hello" """ out = context.stdout_capture.getvalue() diff --git a/jrnl/Journal.py b/jrnl/Journal.py index a6bf35d0..dc6292b7 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -248,7 +248,10 @@ class Journal: to_delete = [] def ask_delete(entry): - return yesno(f"Delete entry '{entry.pprint(short=True)}'?", default=False,) + return yesno( + f"Delete entry '{entry.pprint(short=True)}'?", + default=False, + ) for entry in self.entries: if ask_delete(entry): diff --git a/jrnl/args.py b/jrnl/args.py index 69462bc8..0ba55961 100644 --- a/jrnl/args.py +++ b/jrnl/args.py @@ -276,10 +276,15 @@ def parse_args(args=[]): help="Show only titles or line containing the search tags", ) exporting.add_argument( - "-s", dest="short", action="store_true", help=argparse.SUPPRESS, + "-s", + dest="short", + action="store_true", + help=argparse.SUPPRESS, ) exporting.add_argument( - "-o", dest="filename", help=argparse.SUPPRESS, + "-o", + dest="filename", + help=argparse.SUPPRESS, ) # Handle '-123' as a shortcut for '-n 123' diff --git a/jrnl/cli.py b/jrnl/cli.py index 3084d417..47b7c303 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -29,7 +29,8 @@ def configure_logger(debug=False): return logging.basicConfig( - level=logging.DEBUG, format="%(levelname)-8s %(name)-12s %(message)s", + level=logging.DEBUG, + format="%(levelname)-8s %(name)-12s %(message)s", ) logging.getLogger("parsedatetime").setLevel(logging.INFO) logging.getLogger("keyring.backend").setLevel(logging.ERROR) diff --git a/jrnl/install.py b/jrnl/install.py index 5f5f0032..ced4bba6 100644 --- a/jrnl/install.py +++ b/jrnl/install.py @@ -48,7 +48,12 @@ default_config = { "highlight": True, "linewrap": 79, "indent_character": "|", - "colors": {"date": "none", "title": "none", "body": "none", "tags": "none",}, + "colors": { + "date": "none", + "title": "none", + "body": "none", + "tags": "none", + }, } diff --git a/jrnl/jrnl.py b/jrnl/jrnl.py index 3be2e2da..01f649fc 100644 --- a/jrnl/jrnl.py +++ b/jrnl/jrnl.py @@ -182,7 +182,8 @@ def _get_editor_template(config, **kwargs): except OSError: logging.error("Write mode: template not loaded") print( - f"[Could not read template at '{config['template']}']", file=sys.stderr, + f"[Could not read template at '{config['template']}']", + file=sys.stderr, ) sys.exit(1) diff --git a/poetry.lock b/poetry.lock index aa0435b0..5e352d30 100644 --- a/poetry.lock +++ b/poetry.lock @@ -87,18 +87,20 @@ description = "The uncompromising code formatter." name = "black" optional = false python-versions = ">=3.6" -version = "19.10b0" +version = "20.8b1" [package.dependencies] appdirs = "*" -attrs = ">=18.1.0" -click = ">=6.5" +click = ">=7.1.2" +mypy-extensions = ">=0.4.3" pathspec = ">=0.6,<1" -regex = "*" -toml = ">=0.9.4" +regex = ">=2020.1.8" +toml = ">=0.10.1" typed-ast = ">=1.4.0" +typing-extensions = ">=3.7.4" [package.extras] +colorama = ["colorama (>=0.4.3)"] d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] [[package]] @@ -314,6 +316,14 @@ tornado = ">=5.0" extras = ["languages"] version = "0.5.8" +[[package]] +category = "dev" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +name = "mypy-extensions" +optional = false +python-versions = "*" +version = "0.4.3" + [[package]] category = "dev" description = "Natural Language Toolkit" @@ -594,6 +604,14 @@ optional = false python-versions = "*" version = "1.4.1" +[[package]] +category = "dev" +description = "Backported and Experimental Type Hints for Python 3.5+" +name = "typing-extensions" +optional = false +python-versions = "*" +version = "3.7.4.3" + [[package]] category = "main" description = "tzinfo object for the local timezone" @@ -644,7 +662,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["pytest (>=3.5,<3.7.3 || >3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] [metadata] -content-hash = "3d3d18f22ed32c53aec93cfd1f57c36863191c7a3e5c0353c4388dcffb0bf57e" +content-hash = "cbe4eeb5e842298b28cfe5afd9126693845dbac0bbb4d2dbb2e9e1977b7a8c6e" lock-version = "1.0" python-versions = ">=3.7.0, <3.10.0" @@ -677,8 +695,7 @@ behave = [ {file = "behave-1.2.6.tar.gz", hash = "sha256:b9662327aa53294c1351b0a9c369093ccec1d21026f050c3bd9b3e5cccf81a86"}, ] black = [ - {file = "black-19.10b0-py36-none-any.whl", hash = "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b"}, - {file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"}, + {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, ] cffi = [ {file = "cffi-1.14.3-2-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:3eeeb0405fd145e714f7633a5173318bd88d8bbfc3dd0a5751f8c4f70ae629bc"}, @@ -827,6 +844,10 @@ mkdocs = [ {file = "mkdocs-1.1.2-py3-none-any.whl", hash = "sha256:096f52ff52c02c7e90332d2e53da862fde5c062086e1b5356a6e392d5d60f5e9"}, {file = "mkdocs-1.1.2.tar.gz", hash = "sha256:f0b61e5402b99d7789efa032c7a74c90a20220a9c81749da06dbfbcbd52ffb39"}, ] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] nltk = [ {file = "nltk-3.5.zip", hash = "sha256:845365449cd8c5f9731f7cb9f8bd6fd0767553b9d53af9eb1b3abf7700936b35"}, ] @@ -1037,6 +1058,11 @@ typed-ast = [ {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34"}, {file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"}, ] +typing-extensions = [ + {file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"}, + {file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"}, + {file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"}, +] tzlocal = [ {file = "tzlocal-2.1-py2.py3-none-any.whl", hash = "sha256:e2cb6c6b5b604af38597403e9852872d7f534962ae2954c7f35efcb1ccacf4a4"}, {file = "tzlocal-2.1.tar.gz", hash = "sha256:643c97c5294aedc737780a49d9df30889321cbe1204eac2c2ec6134035a92e44"}, diff --git a/pyproject.toml b/pyproject.toml index 3ea02760..7e212e2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ packaging = "^20.4" [tool.poetry.dev-dependencies] behave = "^1.2" mkdocs = "^1.0" -black = {version = "^19.10b0",allow-prereleases = true} +black = {version = "^20.8b1",allow-prereleases = true} toml = "^0.10.0" pyflakes = "^2.2.0" pytest = "^6.1.2" diff --git a/tests/test_parse_args.py b/tests/test_parse_args.py index 6f6a02db..b9147ac0 100644 --- a/tests/test_parse_args.py +++ b/tests/test_parse_args.py @@ -94,7 +94,11 @@ def test_not_multiple_alone(): @pytest.mark.parametrize( "cli", - ["two -not one -not three", "-not one two -not three", "-not one -not three two",], + [ + "two -not one -not three", + "-not one two -not three", + "-not one -not three two", + ], ) def test_not_mixed(cli): result = expected_args(excluded=["one", "three"], text=["two"]) diff --git a/tests/test_time.py b/tests/test_time.py index e04e1733..89f65cb7 100644 --- a/tests/test_time.py +++ b/tests/test_time.py @@ -10,10 +10,13 @@ def test_default_hour_is_added(): def test_default_minute_is_added(): - assert time.parse( - "2020-06-20", - inclusive=False, - default_hour=0, - default_minute=30, - bracketed=False, - ) == datetime.datetime(2020, 6, 20, 0, 30) + assert ( + time.parse( + "2020-06-20", + inclusive=False, + default_hour=0, + default_minute=30, + bracketed=False, + ) + == datetime.datetime(2020, 6, 20, 0, 30) + )