Skip to content

Commit

Permalink
Switching to line length 120
Browse files Browse the repository at this point in the history
  • Loading branch information
meatballhat committed May 15, 2020
1 parent ad33a4a commit 327b203
Show file tree
Hide file tree
Showing 19 changed files with 278 additions and 1,021 deletions.
6 changes: 2 additions & 4 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
max_line_length = 88
max_line_length = 120
show_source = true
exclude = .git,.venv,.venv2,.venv3,__pycache__,.cache

Expand All @@ -12,8 +12,6 @@ exclude = .git,.venv,.venv2,.venv3,__pycache__,.cache
# ref:
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
#
# The ignored E501 is intended to be _temporary_ and should be removed once all
# of the long lines can be addressed.
extend_ignore = E203,E231,E302,E501
extend_ignore = E203,E231,E302

# vim:filetype=dosini
9 changes: 2 additions & 7 deletions mock_connect/mock_connect/http_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ def _make_json_ready(thing):


def endpoint(
authenticated: bool = False,
auth_optional: bool = False,
cls=None,
writes_json: bool = False,
authenticated: bool = False, auth_optional: bool = False, cls=None, writes_json: bool = False,
):
def decorator(function):
@wraps(function)
Expand All @@ -69,9 +66,7 @@ def wrapper(object_id=None, *args, **kwargs):
object_id = int(object_id)
item = cls.get_object(object_id)
if item is None:
result = error(
404, "%s with ID %s not found." % (cls.__name__, object_id)
)
result = error(404, "%s with ID %s not found." % (cls.__name__, object_id))
else:
result = _make_json_ready(function(item, *args, **kwargs))

Expand Down
16 changes: 4 additions & 12 deletions mock_connect/mock_connect/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,18 @@ def upload(connect_app):
def deploy(connect_app):
bundle_id = request.get_json(force=True).get("bundle")
if bundle_id is None:
return error(
400, "bundle_id is required"
) # message and status code probably wrong
return error(400, "bundle_id is required") # message and status code probably wrong
bundle = Bundle.get_object(bundle_id)
if bundle is None:
return error(
404, "bundle %s not found" % bundle_id
) # message and status code probably wrong
return error(404, "bundle %s not found" % bundle_id) # message and status code probably wrong

manifest = bundle.get_manifest()
old_app_mode = connect_app.app_mode
# noinspection SpellCheckingInspection
new_app_mode = AppMode.value_of(manifest["metadata"]["appmode"])

if old_app_mode is not None and old_app_mode != new_app_mode:
return error(
400, "Cannot change app mode once deployed"
) # message and status code probably wrong
return error(400, "Cannot change app mode once deployed") # message and status code probably wrong

connect_app.bundle_deployed(bundle, new_app_mode)

Expand Down Expand Up @@ -161,9 +155,7 @@ def python_settings():
def content(connect_app):
bundle = connect_app.get_bundle()
if bundle is None:
return error(
400, "The content has not been deployed."
) # message and status code probably wrong
return error(400, "The content has not been deployed.") # message and status code probably wrong
return bundle.get_rendered_content()


Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.black]
line-length = 120
target-version = ['py27', 'py35', 'py36', 'py37', 'py38']
Loading

0 comments on commit 327b203

Please sign in to comment.