Skip to content

Commit 1465d61

Browse files
QA: moved to black and fixed style
1 parent 18f4791 commit 1465d61

File tree

13 files changed

+405
-360
lines changed

13 files changed

+405
-360
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,16 @@ clean:
113113
@rm -f .coverage
114114

115115
auto-style:
116-
@type autopep8 >/dev/null 2>&1 || (echo "Run '$(PIP) install autopep8' first." >&2 ; exit 1)
117-
@autopep8 -i -r $(SRC_CORE) $(SRC_TEST) setup.py
116+
@type black >/dev/null 2>&1 || (echo "Run '$(PIP) install black' first." >&2 ; exit 1)
117+
@black $(SRC_CORE) $(SRC_TEST) setup.py
118118
@type standard >/dev/null 2>&1 || (echo "Run 'npm install -g standard' first." >&2 ; exit 1)
119119
@standard --fix resources/*.js
120120

121-
lint: auto-style code-style code-lint js-lint css-lint
121+
lint: code-style code-lint js-lint css-lint
122122

123123
code-style:
124124
@type pycodestyle >/dev/null 2>&1 || (echo "Run '$(PIP) install pycodestyle' first." >&2 ; exit 1)
125-
@pycodestyle --max-line-length=80 --exclude=*appstore* $(SRC_CORE) $(SRC_TEST)
125+
@pycodestyle --exclude=*appstore* $(SRC_CORE) $(SRC_TEST)
126126

127127
code-lint:
128128
@type pylint >/dev/null 2>&1 || (echo "Run '$(PIP) install pylint' first." >&2 ; exit 1)

setup.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[metadata]
2+
version = attr: things3.__version__
3+
4+
[pycodestyle]
5+
max_line_length = 88
6+
ignore = E203,W503
7+
8+
[flake8]
9+
max-line-length = 88
10+
max-complexity = 10
11+
ignore = E203,W503

setup.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,28 @@ def package_files(directory):
1616
return paths
1717

1818

19-
APP = ['bin/things-app']
19+
APP = ["bin/things-app"]
2020
APP_NAME = "KanbanView"
2121
AUTHOR = "Alexander Willner"
2222
AUTHOR_MAIL = "[email protected]"
2323
DESCRIPTON = "A simple read-only CLI, API and Web Service for Things 3"
2424
URL = "https://kanbanview.app"
2525
VERSION = "2.7.0.dev1"
26-
DATA_FILES = package_files('resources')
26+
DATA_FILES = package_files("resources")
2727
OPTIONS = {
28-
'argv_emulation': False,
29-
'iconfile': 'resources/icon.icns',
30-
'plist': {'CFBundleName': APP_NAME,
31-
'CFBundleDisplayName': APP_NAME,
32-
'CFBundleGetInfoString': APP_NAME,
33-
'CFBundleIdentifier': "ws.willner.kanbanview",
34-
'CFBundleVersion': VERSION,
35-
'LSApplicationCategoryType': "public.app-category.productivity",
36-
'LSMinimumSystemVersion': "10.13.0",
37-
'NSHumanReadableCopyright': 'Copyright 2020 ' + AUTHOR},
38-
'optimize': '2'
28+
"argv_emulation": False,
29+
"iconfile": "resources/icon.icns",
30+
"plist": {
31+
"CFBundleName": APP_NAME,
32+
"CFBundleDisplayName": APP_NAME,
33+
"CFBundleGetInfoString": APP_NAME,
34+
"CFBundleIdentifier": "ws.willner.kanbanview",
35+
"CFBundleVersion": VERSION,
36+
"LSApplicationCategoryType": "public.app-category.productivity",
37+
"LSMinimumSystemVersion": "10.13.0",
38+
"NSHumanReadableCopyright": "Copyright 2020 " + AUTHOR,
39+
},
40+
"optimize": "2",
3941
}
4042

4143

@@ -59,18 +61,18 @@ def package_files(directory):
5961
"Operating System :: MacOS :: MacOS X",
6062
"Environment :: Console",
6163
"Framework :: Flask",
62-
"Natural Language :: English"
64+
"Natural Language :: English",
6365
],
64-
python_requires='>=3.6',
66+
python_requires=">=3.6",
6567
version=VERSION,
6668
data_files=DATA_FILES,
67-
options={'py2app': OPTIONS},
68-
setup_requires=['py2app'],
69+
options={"py2app": OPTIONS},
70+
setup_requires=["py2app"],
6971
entry_points={
70-
'console_scripts': [
71-
'things-cli = things3.things3_cli:main',
72-
'things-api = things3.things3_api:main',
73-
'things-kanban = things3.things3_app:main'
72+
"console_scripts": [
73+
"things-cli = things3.things3_cli:main",
74+
"things-api = things3.things3_api:main",
75+
"things-kanban = things3.things3_app:main",
7476
]
75-
}
77+
},
7678
)

tests/test_things3.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ class Things3Case(unittest.TestCase):
1313
FILEPATH = dict(filepath="resources/demo.sqlite3")
1414

1515
def setUp(self):
16-
self.things3 = Things3(database='resources/demo.sqlite3')
17-
self.things3.tag_mit = 'MIT'
16+
self.things3 = Things3(database="resources/demo.sqlite3")
17+
self.things3.tag_mit = "MIT"
1818

1919
def test_today(self):
2020
"""Test Today."""
2121
tasks = self.things3.get_today()
2222
self.assertEqual(4, len(tasks))
2323
titles = []
2424
for task in tasks:
25-
titles.append(task['title'])
25+
titles.append(task["title"])
2626
self.assertIn("Today MIT task without a project", titles)
2727
self.assertIn("Today items are shown here", titles)
2828

@@ -32,7 +32,7 @@ def test_inbox(self):
3232
self.assertEqual(3, len(tasks))
3333
titles = []
3434
for task in tasks:
35-
titles.append(task['title'])
35+
titles.append(task["title"])
3636
self.assertIn("Currently Things 3 tasks are supported", titles)
3737
self.assertIn("This is a demo setup", titles)
3838
self.assertIn("New tasks are shown here", titles)
@@ -44,7 +44,7 @@ def test_upcoming(self):
4444
# things.py: was 6 in old version
4545
titles = []
4646
for task in tasks:
47-
titles.append(task['title'])
47+
titles.append(task["title"])
4848
self.assertIn("Waiting for this...", titles)
4949

5050
def test_next(self):
@@ -122,9 +122,9 @@ def test_get_areas(self):
122122
def test_get_minutes_today(self):
123123
"""Test get minutes today."""
124124
minutes = self.things3.get_minutes_today()
125-
self.assertEqual([{'minutes': 35}], minutes)
125+
self.assertEqual([{"minutes": 35}], minutes)
126126

127-
# @unittest.skip(reason="not migrated to new lib")
127+
# @unittest.skip(reason="not migrated to new lib")
128128
def test_anonymize(self):
129129
"""Test anonymized tasks."""
130130
tasks = self.things3.get_today()
@@ -134,5 +134,5 @@ def test_anonymize(self):
134134
self.assertNotEqual(tasks.pop(), task)
135135

136136

137-
if __name__ == '__main__':
137+
if __name__ == "__main__":
138138
unittest.main()

tests/test_things3_api.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class Things3APICase(unittest.TestCase):
1313
"""Class documentation goes here."""
1414

1515
things3_api = things3_api.Things3API()
16-
things3 = things3.Things3(database='resources/demo.sqlite3')
16+
things3 = things3.Things3(database="resources/demo.sqlite3")
1717
things3.config = configparser.ConfigParser()
18-
things3.config.read('tests/kanbanviewrc')
18+
things3.config.read("tests/kanbanviewrc")
1919
things3_api.things3 = things3
2020

2121
def test_today(self):
@@ -35,7 +35,7 @@ def test_not_implemented(self):
3535

3636
def test_not_found(self):
3737
"""Test not found."""
38-
result = self.things3_api.on_get('sdf').status_code
38+
result = self.things3_api.on_get("sdf").status_code
3939
self.assertEqual(404, result)
4040

4141
def test_toggle(self):
@@ -51,8 +51,7 @@ def test_toggle(self):
5151

5252
def test_filter(self):
5353
"""Test Filter."""
54-
self.things3_api.api_filter(
55-
'project', 'F736F7F8-C9D5-4F30-B158-3684669985BC')
54+
self.things3_api.api_filter("project", "F736F7F8-C9D5-4F30-B158-3684669985BC")
5655
result = json.loads(self.things3_api.api("next").response[0])
5756
self.assertEqual(26, len(result))
5857
self.things3_api.api_filter_reset()
@@ -61,15 +60,14 @@ def test_filter(self):
6160

6261
def test_get_file(self):
6362
"""Test get file."""
64-
result = self.things3_api.on_get(
65-
"/kanban.html").response[0].decode("utf-8")
63+
result = self.things3_api.on_get("/kanban.html").response[0].decode("utf-8")
6664
self.assertIn("kanban.js", result)
6765

6866
def test_config(self):
6967
"""Test configuration."""
70-
result = self.things3_api.config_get('TAG_MIT').response[0]
68+
result = self.things3_api.config_get("TAG_MIT").response[0]
7169
self.assertEqual(b"MIT", result)
7270

7371

74-
if __name__ == '__main__':
72+
if __name__ == "__main__":
7573
unittest.main()

tests/test_things3_cli.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
class Things3CLICase(unittest.TestCase):
1313
"""Class documentation goes here."""
1414

15-
things3_cli = things3_cli.Things3CLI(database='resources/demo.sqlite3')
15+
things3_cli = things3_cli.Things3CLI(database="resources/demo.sqlite3")
1616

1717
def test_methods(self):
1818
"""Invoke all commands."""
1919
parser = self.things3_cli.get_parser()
20-
for command in parser._subparsers._actions[1].choices: # noqa # pylint: disable=protected-access
20+
for command in parser._subparsers._actions[ # pylint: disable=W0212
21+
1
22+
].choices:
2123
if command != "feedback":
2224
args = parser.parse_args([command])
2325
new_out = io.StringIO()
@@ -31,7 +33,7 @@ def test_methods(self):
3133

3234
def test_today(self):
3335
"""Test Today."""
34-
args = self.things3_cli.get_parser().parse_args(['today'])
36+
args = self.things3_cli.get_parser().parse_args(["today"])
3537
new_out = io.StringIO()
3638
old_out = sys.stdout
3739
try:
@@ -43,7 +45,7 @@ def test_today(self):
4345

4446
def test_csv(self):
4547
"""Test Next via CSV."""
46-
args = self.things3_cli.get_parser().parse_args(['-c', 'next'])
48+
args = self.things3_cli.get_parser().parse_args(["-c", "next"])
4749
new_out = io.StringIO()
4850
old_out = sys.stdout
4951
try:
@@ -55,7 +57,7 @@ def test_csv(self):
5557

5658
def test_json(self):
5759
"""Test Upcoming via JSON."""
58-
args = self.things3_cli.get_parser().parse_args(['-j', 'upcoming'])
60+
args = self.things3_cli.get_parser().parse_args(["-j", "upcoming"])
5961
new_out = io.StringIO()
6062
old_out = sys.stdout
6163
try:
@@ -66,5 +68,5 @@ def test_json(self):
6668
self.assertIn("4F7006C4ADF7", new_out.getvalue())
6769

6870

69-
if __name__ == '__main__':
71+
if __name__ == "__main__":
7072
unittest.main()

tests/test_things3_kanban.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class Things3KanbanCase(unittest.TestCase):
1313
"""Class documentation goes here."""
1414

15-
things3 = Things3(database='resources/demo.sqlite3')
15+
things3 = Things3(database="resources/demo.sqlite3")
1616

1717
class CustomStringIO(io.StringIO):
1818
"""Do not close output for testing."""
@@ -28,5 +28,5 @@ def test_today(self):
2828
self.assertIn("Today MIT", output.getvalue())
2929

3030

31-
if __name__ == '__main__':
31+
if __name__ == "__main__":
3232
unittest.main()

0 commit comments

Comments
 (0)