Created
February 4, 2015 19:52
-
-
Save tseaver/adac94c24aedde278b15 to your computer and use it in GitHub Desktop.
Chasing pylint yet again
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git diff | |
diff --git a/gcloud/credentials.py b/gcloud/credentials.py | |
index 582537f..232842c 100644 | |
--- a/gcloud/credentials.py | |
+++ b/gcloud/credentials.py | |
@@ -18,7 +18,7 @@ import base64 | |
import calendar | |
import datetime | |
import six | |
-from six.moves.urllib.parse import urlencode # pylint: disable=F0401 | |
+URLENCODE = six.moves.urllib.parse.urlencode | |
from Crypto.Hash import SHA256 | |
from Crypto.PublicKey import RSA | |
@@ -260,4 +260,4 @@ def generate_signed_url(credentials, resource, expiration, | |
# Return the built URL. | |
return '{endpoint}{resource}?{querystring}'.format( | |
endpoint=api_access_endpoint, resource=resource, | |
- querystring=urlencode(query_params)) | |
+ querystring=URLENCODE(query_params)) | |
diff --git a/gcloud/datastore/_implicit_environ.py b/gcloud/datastore/_implicit_environ.py | |
index 504cd4c..6f3fec0 100644 | |
--- a/gcloud/datastore/_implicit_environ.py | |
+++ b/gcloud/datastore/_implicit_environ.py | |
@@ -20,7 +20,8 @@ imply the current dataset ID and connection from the enviroment. | |
import socket | |
-from six.moves.http_client import HTTPConnection # pylint: disable=F0401 | |
+import six | |
+HTTP_CONNECTION = six.moves.http_client.HTTPConnection | |
try: | |
from google.appengine.api import app_identity | |
@@ -68,7 +69,7 @@ def compute_engine_id(): | |
host = '169.254.169.254' | |
uri_path = '/computeMetadata/v1/project/project-id' | |
headers = {'Metadata-Flavor': 'Google'} | |
- connection = HTTPConnection(host, timeout=0.1) | |
+ connection = HTTP_CONNECTION(host, timeout=0.1) | |
try: | |
connection.request('GET', uri_path, headers=headers) | |
diff --git a/gcloud/datastore/test___init__.py b/gcloud/datastore/test___init__.py | |
index 0ebc28a..fb03cc6 100644 | |
--- a/gcloud/datastore/test___init__.py | |
+++ b/gcloud/datastore/test___init__.py | |
@@ -50,7 +50,7 @@ class Test_set_default_dataset_id(unittest2.TestCase): | |
return connection | |
return _Monkey(_implicit_environ, | |
- HTTPConnection=_factory, | |
+ HTTP_CONNECTION=_factory, | |
app_identity=app_identity) | |
def test_no_env_var_set(self): | |
diff --git a/gcloud/storage/blob.py b/gcloud/storage/blob.py | |
index 4528b6f..5164c09 100644 | |
--- a/gcloud/storage/blob.py | |
+++ b/gcloud/storage/blob.py | |
@@ -22,7 +22,7 @@ import datetime | |
from io import BytesIO | |
import six | |
-from six.moves.urllib.parse import quote # pylint: disable=F0401 | |
+QUOTE = six.moves.urllib.parse.quote | |
from _gcloud_vendor.apitools.base.py import http_wrapper | |
from _gcloud_vendor.apitools.base.py import transfer | |
@@ -125,7 +125,7 @@ class Blob(_PropertyMixin): | |
elif not self.name: | |
raise ValueError('Cannot determine path without a blob name.') | |
- return self.bucket.path + '/o/' + quote(self.name, safe='') | |
+ return self.bucket.path + '/o/' + QUOTE(self.name, safe='') | |
@property | |
def public_url(self): | |
@@ -137,7 +137,7 @@ class Blob(_PropertyMixin): | |
return '{storage_base_url}/{bucket_name}/{quoted_name}'.format( | |
storage_base_url='http://commondatastorage.googleapis.com', | |
bucket_name=self.bucket.name, | |
- quoted_name=quote(self.name, safe='')) | |
+ quoted_name=QUOTE(self.name, safe='')) | |
def generate_signed_url(self, expiration, method='GET'): | |
"""Generates a signed URL for this blob. | |
@@ -162,7 +162,7 @@ class Blob(_PropertyMixin): | |
""" | |
resource = '/{bucket_name}/{quoted_name}'.format( | |
bucket_name=self.bucket.name, | |
- quoted_name=quote(self.name, safe='')) | |
+ quoted_name=QUOTE(self.name, safe='')) | |
return generate_signed_url( | |
self.connection.credentials, resource=resource, | |
diff --git a/gcloud/storage/connection.py b/gcloud/storage/connection.py | |
index 666f07e..5817198 100644 | |
--- a/gcloud/storage/connection.py | |
+++ b/gcloud/storage/connection.py | |
@@ -16,7 +16,8 @@ | |
import json | |
-from six.moves.urllib.parse import urlencode # pylint: disable=F0401 | |
+import six | |
+URLENCODE = six.moves.urllib.parse.urlencode | |
from gcloud.connection import Connection as _Base | |
from gcloud.exceptions import make_exception | |
@@ -127,7 +128,7 @@ class Connection(_Base): | |
query_params = query_params or {} | |
query_params.update({'project': self.project}) | |
- url += '?' + urlencode(query_params) | |
+ url += '?' + URLENCODE(query_params) | |
return url | |
$ tox -e lint | |
... | |
lint runtests: commands[1] | python run_pylint.py | |
Diff base not specified, listing all files in repository. | |
************* Module gcloud.datastore._implicit_environ | |
C: 24, 0: Invalid class name "HTTP_CONNECTION" (invalid-name) | |
************* Module gcloud.storage.blob | |
E:128,42: Argument 'safe' passed by position and keyword in function call (redundant-keyword-arg) | |
E:140,24: Argument 'safe' passed by position and keyword in function call (redundant-keyword-arg) | |
E:165,24: Argument 'safe' passed by position and keyword in function call (redundant-keyword-arg) | |
Pylint failed on library code with status 18. | |
ERROR: InvocationError: '/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/bin/python run_pylint.py' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment