diff --git a/.github/workflows/pythonpackage-linux.yml b/.github/workflows/pythonpackage-linux.yml index 8c72d3358..e122ab2be 100644 --- a/.github/workflows/pythonpackage-linux.yml +++ b/.github/workflows/pythonpackage-linux.yml @@ -27,7 +27,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools - pip install urllib3 certifi pytz pyflakes faker nose autopep8 isort + pip install urllib3 certifi pytz pyflakes faker nose autopep8 isort pylint - name: Run check run: | make check diff --git a/Makefile b/Makefile index 4ba3bcd6d..a82d62ff9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ .PHONY: examples tests publish check: + @which pylint >/dev/null || pip install --user --upgrade pylint + @if python --version | grep -qi 'python 3'; then pylint --reports=no minio/copy_conditions.py; fi + @which isort >/dev/null || pip install --user --upgrade isort @isort --diff --recursive . diff --git a/minio/copy_conditions.py b/minio/copy_conditions.py index 0f02759f1..30156df16 100644 --- a/minio/copy_conditions.py +++ b/minio/copy_conditions.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# MinIO Python Library for Amazon S3 Compatible Cloud Storage, (C) 2016 MinIO, Inc. +# MinIO Python Library for Amazon S3 Compatible Cloud Storage, +# (C) 2016 MinIO, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,15 +25,13 @@ """ -import collections +try: + from collections import MutableMapping +except ImportError: + from collections.abc import MutableMapping from .helpers import is_non_empty_string -try: - collectionsAbc = collections.abc -except AttributeError: - collectionsAbc = collections - # CopyCondition explanation: # http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html # @@ -44,7 +43,7 @@ # -class CopyConditions(collectionsAbc.MutableMapping): +class CopyConditions(MutableMapping): """ A :class:`CopyConditions ` collection of supported CopyObject conditions. @@ -75,25 +74,21 @@ def __len__(self): return len(self._store) def set_match_etag(self, etag): - """ - """ + """Set ETag match condition.""" is_non_empty_string(etag) - self._store['X-Amz-Copy-Source-If-Match'] = etag + self._store["X-Amz-Copy-Source-If-Match"] = etag def set_match_etag_except(self, etag): - """ - """ + """Set ETag not match condition.""" is_non_empty_string(etag) - self._store['X-Amz-Copy-Source-If-None-Match'] = etag + self._store["X-Amz-Copy-Source-If-None-Match"] = etag def set_unmodified_since(self, mod_time): - """ - """ - time = mod_time.strftime('%a, %d %b %Y %H:%M:%S GMT') - self._store['X-Amz-Copy-Source-If-Unmodified-Since'] = time + """Set unmodified since condition.""" + time = mod_time.strftime("%a, %d %b %Y %H:%M:%S GMT") + self._store["X-Amz-Copy-Source-If-Unmodified-Since"] = time def set_modified_since(self, mod_time): - """ - """ - time = mod_time.strftime('%a, %d %b %Y %H:%M:%S GMT') - self._store['X-Amz-Copy-Source-If-Modified-Since'] = time + """Set modified since condition.""" + time = mod_time.strftime("%a, %d %b %Y %H:%M:%S GMT") + self._store["X-Amz-Copy-Source-If-Modified-Since"] = time