Browse Source

dev env: upgrade black; reformat

Fabian Peter Hammerle 6 months ago
parent
commit
71aeeb6a9a
6 changed files with 44 additions and 15 deletions
  1. 1 1
      Pipfile
  2. 3 4
      Pipfile.lock
  3. 9 2
      ical2vdir/__init__.py
  4. 5 1
      setup.py
  5. 22 6
      tests/prop_test.py
  6. 4 1
      tests/vdir_test.py

+ 1 - 1
Pipfile

@@ -9,7 +9,7 @@ ical2vdir = {editable = true,path = "."}
 [dev-packages]
 # black requires python>=3.6
 # https://github.com/psf/black/commit/e74117f172e29e8a980e2c9de929ad50d3769150#diff-2eeaed663bd0d25b7e608891384b7298R51
-black = {version = "==19.10b0", markers = "python_version >= '3.6'"}
+black = {version = "==20.8b1", markers = "python_version >= '3.6'"}
 mypy = "*"
 pylint = "*"
 pylint-import-requirements = "*"

+ 3 - 4
Pipfile.lock

@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "3de9bec65bee29841396fc157eef776df7819495c7b6fa9897d5bd0e88cc41df"
+            "sha256": "f8caad99976835d7f8a237785d975a0bea63d3c0df9fe048394b4f49e339b615"
         },
         "pipfile-spec": 6,
         "requires": {
@@ -73,12 +73,11 @@
         },
         "black": {
             "hashes": [
-                "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b",
-                "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"
+                "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"
             ],
             "index": "pypi",
             "markers": "python_version >= '3.6'",
-            "version": "==19.10b0"
+            "version": "==20.8b1"
         },
         "click": {
             "hashes": [

+ 9 - 2
ical2vdir/__init__.py

@@ -60,7 +60,11 @@ def _events_equal(event_a: icalendar.cal.Event, event_b: icalendar.cal.Event) ->
             return False
         if not _event_prop_equal(prop_a, prop_b):
             _LOGGER.debug(
-                "%s/%s: %r != %r", event_a["UID"], key, prop_a, prop_b,
+                "%s/%s: %r != %r",
+                event_a["UID"],
+                key,
+                prop_a,
+                prop_b,
             )
             return False
     return True
@@ -158,7 +162,10 @@ def _main():
         help="Reduce verbosity.",
     )
     argparser.add_argument(
-        "-v", "--verbose", action="store_true", help="Increase verbosity",
+        "-v",
+        "--verbose",
+        action="store_true",
+        help="Increase verbosity",
     )
     args = argparser.parse_args()
     if args.verbose:

+ 5 - 1
setup.py

@@ -48,7 +48,11 @@ setuptools.setup(
         "Programming Language :: Python :: 3.8",
         "Topic :: Utilities",
     ],
-    entry_points={"console_scripts": ["ical2vdir = ical2vdir:_main",]},
+    entry_points={
+        "console_scripts": [
+            "ical2vdir = ical2vdir:_main",
+        ]
+    },
     install_requires=["icalendar>=4,<5"],
     setup_requires=["setuptools_scm"],
     tests_require=["pytest"],

+ 22 - 6
tests/prop_test.py

@@ -51,8 +51,16 @@ def _parametrize(obj: typing.Any, params: dict) -> typing.Any:
             vCalAddress("mailto:someelse@somewhere.com"),
             False,
         ),
-        (vRecur(FREQ="WEEKLY", COUNT=21), vRecur(FREQ="WEEKLY", COUNT=21), True,),
-        (vRecur(FREQ="WEEKLY", COUNT=21), vRecur(FREQ="WEEKLY", COUNT=42), False,),
+        (
+            vRecur(FREQ="WEEKLY", COUNT=21),
+            vRecur(FREQ="WEEKLY", COUNT=21),
+            True,
+        ),
+        (
+            vRecur(FREQ="WEEKLY", COUNT=21),
+            vRecur(FREQ="WEEKLY", COUNT=42),
+            False,
+        ),
         (
             vDDDTypes(
                 datetime.datetime(2012, 7, 3, 16, 39, 2, tzinfo=datetime.timezone.utc)
@@ -156,11 +164,15 @@ def _parametrize(obj: typing.Any, params: dict) -> typing.Any:
         ),
         (
             [
-                vCalAddress("someone@somewhere.com",),
+                vCalAddress(
+                    "someone@somewhere.com",
+                ),
                 vCalAddress("someelse@somewhere.com"),
             ],
             [
-                vCalAddress("someone@somewhere.com",),
+                vCalAddress(
+                    "someone@somewhere.com",
+                ),
                 _parametrize(
                     vCalAddress("someelse@somewhere.com"),
                     dict(UTYPE="INDIVIDUAL", PARTSTAT="ACCEPTED"),
@@ -170,14 +182,18 @@ def _parametrize(obj: typing.Any, params: dict) -> typing.Any:
         ),
         (
             [
-                vCalAddress("someone@somewhere.com",),
+                vCalAddress(
+                    "someone@somewhere.com",
+                ),
                 _parametrize(
                     vCalAddress("someelse@somewhere.com"),
                     dict(UTYPE="INDIVIDUAL", PARTSTAT="ACCEPTED"),
                 ),
             ],
             [
-                vCalAddress("someone@somewhere.com",),
+                vCalAddress(
+                    "someone@somewhere.com",
+                ),
                 _parametrize(
                     vCalAddress("someelse@somewhere.com"),
                     dict(UTYPE="INDIVIDUAL", PARTSTAT="ACCEPTED"),

+ 4 - 1
tests/vdir_test.py

@@ -67,7 +67,10 @@ def test__write_event_cleanup(tmp_path: pathlib.Path):
 @pytest.mark.parametrize(
     ("event_ical", "expected_filename"),
     [
-        (_SINGLE_EVENT_ICAL, "1qa2ws3ed4rf5tg@google.com.ics",),
+        (
+            _SINGLE_EVENT_ICAL,
+            "1qa2ws3ed4rf5tg@google.com.ics",
+        ),
         (
             b"""BEGIN:VEVENT
 SUMMARY:work