Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pylint errors in copy_conditions.py #908

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

check:
@which pylint >/dev/null || pip install --user --upgrade pylint
@if python --version | grep -qi 'python 3'; then pylint --reports=no minio/definitions.py; fi
@if python --version | grep -qi 'python 3'; then pylint --reports=no minio/copy_conditions.py minio/definitions.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