Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
  • Loading branch information
Hunor Csomortáni authored and MartinBasti committed Mar 4, 2019
1 parent 80c593a commit 60add4a
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion omps/api/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

API = Blueprint('v1', __name__)

from . import packages, push # register routes
from . import packages, push # noqa, register routes
4 changes: 2 additions & 2 deletions omps/api/v1/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import requests

from . import API
from omps.quay import QUAY_ORG_MANAGER, ReleaseVersion
from omps.quay import QUAY_ORG_MANAGER

logger = logging.getLogger(__name__)


@API.route("/<organization>/<repo>", defaults={'version': None},
methods=('DELETE',))
methods=('DELETE',))
@API.route("/<organization>/<repo>/<version>", methods=('DELETE',))
def delete_package_release(organization, repo, version=None):
"""
Expand Down
2 changes: 1 addition & 1 deletion omps/api/v1/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def _get_package_version(quay_org, repo, version=None):


@API.route("/<organization>/<repo>/zipfile", defaults={"version": None},
methods=('POST',))
methods=('POST',))
@API.route("/<organization>/<repo>/zipfile/<version>", methods=('POST',))
def push_zipfile(organization, repo, version=None):
"""
Expand Down
1 change: 1 addition & 0 deletions omps/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ def _register_blueprints(app):
logger.debug('Registering blueprints')
app.register_blueprint(API_V1, url_prefix='/v1')


app = create_app()
6 changes: 3 additions & 3 deletions omps/quay.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ def get_latest_release_version(self, repo):
# no valid versions found, assume that this will be first package
# uploaded by service
raise QuayPackageNotFound(
"Package {}/{} has not valid versions uploaded".format(
self._organization, repo
)
"Package {}/{} has not valid versions uploaded".format(
self._organization, repo
)
)

return max(self.get_releases(repo))

Expand Down
8 changes: 4 additions & 4 deletions omps/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ class Config(object):
}
}



def __init__(self, conf_section_obj):
"""
Initialize the Config object with defaults and then override them
Expand Down Expand Up @@ -190,10 +188,12 @@ def set_item(self, key, value):
if value is not None:
value = convert(value)
except (TypeError, ValueError):
raise TypeError("Configuration value conversion failed for name: %s" % key)
error = "Configuration value conversion failed for name: %s"
raise TypeError(error % key)
# unknown type/unsupported conversion
elif convert is not None:
raise TypeError("Unsupported type %s for configuration item name: %s" % (convert, key))
error = "Unsupported type %s for configuration item name: %s"
raise TypeError(error % (convert, key))

# Set the attribute to the correct value
setattr(self, key, value)
Expand Down
3 changes: 2 additions & 1 deletion tests/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def test_push_koji_nvr(client):


ZIP_ENDPOINT_NOVER = '/organization-X/repo-Y/zipfile'


@pytest.mark.parametrize('endpoint', [
ZIP_ENDPOINT_NOVER,
'/organization-X/repo-Y/zipfile/1.0.1',
Expand Down Expand Up @@ -114,4 +116,3 @@ def test_404_for_mistyped_entrypoints(client, endpoint):
rv_json = rv.get_json()
assert rv_json['error'] == 'NotFound'
assert rv_json['status'] == 404

2 changes: 2 additions & 0 deletions tests/api/v1/test_api_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def test_push_koji_nvr(client):


ZIP_ENDPOINT_NOVER = '/v1/organization-X/repo-Y/zipfile'


@pytest.mark.parametrize('endpoint', [
ZIP_ENDPOINT_NOVER,
'/v1/organization-X/repo-Y/zipfile/1.0.1',
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def datadir(tmpdir):
:return: tmpdir data path
"""
path = os.path.join(tmpdir, "data")
path = os.path.join(tmpdir, "data")
data_dir = os.path.join(os.path.dirname(__file__), "data")
shutil.copytree(data_dir, path)
return path
Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ commands = flake8

[flake8]
max-line-length: 90
ignore =
# E731 do not assign a lambda expression, use a def
E731

0 comments on commit 60add4a

Please sign in to comment.