Skip to content

Commit

Permalink
OSSV3-6189: Isort fix (zalando#116)
Browse files Browse the repository at this point in the history
* Updating isort call to check if the repo is using isort v4 or sort v5 +
* Updating isort reqs to 5.8.0
* Isort and black formatting changes

Co-authored-by: Jason Weir <91488+Gidgidonihah@users.noreply.github.com>
  • Loading branch information
MichaelPorras and Gidgidonihah authored Apr 5, 2021
1 parent 8653154 commit 87e58ab
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 48 deletions.
12 changes: 11 additions & 1 deletion bin/python/lint
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,17 @@ black --config $PROJECT_ROOT/configuration/pyproject.toml --check "$SHELL_DIR"
print_tool_status "black" $?

echo Running isort...
isort -sp $PROJECT_ROOT/configuration/pyproject.toml -rc -c "$SHELL_DIR"
# Check which version of isort is installed and run the corresponding command.
isort_version=$(isort --version-number)
major_version=$(echo $isort_version | cut -d. -f1)

if [ $major_version -ge 5 ]; then
echo "Using isort 5.x+ command (installed isort version: $isort_version)"
isort --settings-path $PROJECT_ROOT/configuration/pyproject.toml -c --src "$SHELL_DIR" "$SHELL_DIR"
else
echo "Using isort 4.x command (installed isort version: $isort_version)"
isort -sp $PROJECT_ROOT/configuration/pyproject.toml -rc -c "$SHELL_DIR"
fi
print_tool_status "isort" $?

# echo "Running pylint against changed files (without failing the build)..."
Expand Down
1 change: 0 additions & 1 deletion bin/python/remote_config/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from http import HTTPStatus

import requests

from oauth2client.service_account import ServiceAccountCredentials


Expand Down
1 change: 0 additions & 1 deletion bin/python/remote_config/application.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from cleo import Application as BaseApplication

from remote_config.commands import GetCommand
from remote_config.commands import ListCommand
from remote_config.commands import PublishCommand
Expand Down
3 changes: 2 additions & 1 deletion bin/python/remote_config/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""CLI Commands for the Remote Config Application."""
from remote_config.commands.get import GetCommand
from remote_config.commands.list import ListCommand
from remote_config.commands.publish import PublishCommand
from remote_config.commands.rollback import RollbackCommand
from remote_config.commands.list import ListCommand


__all__ = ["GetCommand", "PublishCommand", "RollbackCommand", "ListCommand"]
3 changes: 1 addition & 2 deletions bin/python/remote_config/commands/command.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# pylint: disable=attribute-defined-outside-init
from cleo import Command as BaseCommand
from clikit.api.args.format.option import Option

from remote_config.api import FirebaseRemoteConfig


Expand Down Expand Up @@ -30,7 +29,7 @@ def __init__(self, *args, **kwargs):
)

def handle(self):
""" Set up the remote config API class for all children.
"""Set up the remote config API class for all children.
NOTE: Must be called from the child handle method.
"""
Expand Down
2 changes: 1 addition & 1 deletion bin/python/remote_config/commands/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class GetCommand(Command):
""" Retrieve the current Firebase Remote Config template from server.
"""Retrieve the current Firebase Remote Config template from server.
get
{filename? : Save output to the supplied filename}
Expand Down
2 changes: 1 addition & 1 deletion bin/python/remote_config/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class ListCommand(Command):
""" Print the last n Remote Config versions.
"""Print the last n Remote Config versions.
ls
{name? : Who do you want to list?}
Expand Down
2 changes: 1 addition & 1 deletion bin/python/remote_config/commands/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


class PublishCommand(Command):
""" Publish local template to Firebase server.
"""Publish local template to Firebase server.
publish
{filename : File path to publish}
Expand Down
2 changes: 1 addition & 1 deletion bin/python/remote_config/commands/rollback.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class RollbackCommand(Command):
""" Roll back to an available version of Firebase Remote Config template.
"""Roll back to an available version of Firebase Remote Config template.
rollback
{version : The version of the template to roll back to.}
Expand Down
69 changes: 32 additions & 37 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = ["Danielle Hanks <dhanks@owletcare.com>"]
python = "^3.7"
black = "^19.10b0"
codecov = "^2.1.3"
isort = "^4.3.21"
isort = "^5.8.0"
poetry = "^1.1.0"
pylint = "^2.5.2"
pytest = "^5.4.2"
Expand Down

0 comments on commit 87e58ab

Please sign in to comment.