Skip to content

Commit

Permalink
fix pylint errors in copy_conditions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
balamurugana committed May 5, 2020
1 parent 3a8336b commit d8f236b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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/compat.py; fi

@which isort >/dev/null || pip install --user --upgrade isort
@isort --diff --recursive .

Expand Down
39 changes: 17 additions & 22 deletions minio/copy_conditions.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
#
Expand All @@ -44,7 +43,7 @@
#


class CopyConditions(collectionsAbc.MutableMapping):
class CopyConditions(MutableMapping):
"""
A :class:`CopyConditions <CopyConditions>` collection of
supported CopyObject conditions.
Expand Down Expand Up @@ -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

0 comments on commit d8f236b

Please sign in to comment.