Skip to content

Commit

Permalink
Re-enable flake8 for core package and tests (#3664)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Wayne Parrott authored Jul 24, 2017
1 parent 1598d5d commit c5922c6
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 25 deletions.
3 changes: 3 additions & 0 deletions core/.flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[flake8]
import-order-style=google
# Note: this forces all google imports to be in the third group. See
# https://github.com/PyCQA/flake8-import-order/issues/111
application-import-names=google
exclude =
__pycache__,
.git,
Expand Down
10 changes: 5 additions & 5 deletions core/google/cloud/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@
import re
from threading import local as Local

import google_auth_httplib2
import httplib2
import six
from six.moves import http_client

import google.auth
from google.protobuf import duration_pb2
from google.protobuf import timestamp_pb2
import google_auth_httplib2

try:
import grpc
import google.auth.transport.grpc
except ImportError: # pragma: NO COVER
grpc = None

import httplib2
import six
from six.moves import http_client


_NOW = datetime.datetime.utcnow # To be replaced by tests.
_RFC3339_MICROS = '%Y-%m-%dT%H:%M:%S.%fZ'
Expand Down
2 changes: 1 addition & 1 deletion core/google/cloud/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import json
import platform
from pkg_resources import get_distribution

from pkg_resources import get_distribution
import six
from six.moves.urllib.parse import urlencode

Expand Down
4 changes: 2 additions & 2 deletions core/google/cloud/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
import json
from pickle import PicklingError

import google.auth.credentials
from google.oauth2 import service_account
import google_auth_httplib2
import six

import google.auth.credentials
from google.cloud._helpers import _determine_default_project
from google.cloud.credentials import get_credentials
from google.oauth2 import service_account


_GOOGLE_AUTH_CREDENTIALS_HELP = (
Expand Down
6 changes: 3 additions & 3 deletions core/google/cloud/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

import base64
import datetime

import six
from six.moves.urllib.parse import urlencode

import google.auth
import google.auth.credentials

from google.cloud._helpers import UTC
from google.cloud._helpers import _NOW
from google.cloud._helpers import _microseconds_from_datetime
from google.cloud._helpers import _NOW
from google.cloud._helpers import UTC


def get_credentials():
Expand Down
5 changes: 3 additions & 2 deletions core/google/cloud/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@

import copy
import json

import six

from google.cloud._helpers import _to_bytes

_HTTP_CODE_TO_EXCEPTION = {} # populated at end of module

try:
from grpc._channel import _Rendezvous
except ImportError: # pragma: NO COVER
_Rendezvous = None

_HTTP_CODE_TO_EXCEPTION = {} # populated at end of module


# pylint: disable=invalid-name
GrpcRendezvous = _Rendezvous
Expand Down
7 changes: 3 additions & 4 deletions core/google/cloud/future/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
import functools
import threading

from google.longrunning import operations_pb2
from google.protobuf import json_format
from google.rpc import code_pb2

from google.cloud import _helpers
from google.cloud import exceptions
from google.cloud.future import polling
from google.longrunning import operations_pb2
from google.protobuf import json_format
from google.rpc import code_pb2


class Operation(polling.PollingFuture):
Expand Down
2 changes: 1 addition & 1 deletion core/nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def lint(session):
session.install(
'flake8', 'flake8-import-order', 'pylint', 'gcp-devrel-py-tools')
session.install('.')
session.run('flake8', 'google/cloud/core')
session.run('flake8', 'google', 'tests')
session.run(
'gcp-devrel-py-tools', 'run-pylint',
'--config', 'pylint.config.py',
Expand Down
11 changes: 5 additions & 6 deletions core/tests/unit/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import unittest

import mock
import six


class Test_get_credentials(unittest.TestCase):
Expand Down Expand Up @@ -169,12 +170,10 @@ def test_w_int(self):
self.assertEqual(self._call_fut(123), 123)

def test_w_long(self):
try:
long
except NameError: # pragma: NO COVER Py3K
pass
else:
self.assertEqual(self._call_fut(long(123)), 123)
if six.PY3:
raise unittest.SkipTest('No long on Python 3')

self.assertEqual(self._call_fut(long(123)), 123) # noqa: F821

def test_w_naive_datetime(self):
import datetime
Expand Down
1 change: 0 additions & 1 deletion core/tests/unit/test_iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ def test_from_api_repr_complete(self):
{'role': VIEWER_ROLE, 'members': [VIEWER1, VIEWER2]},
],
}
empty = frozenset()
klass = self._get_target_class()
policy = klass.from_api_repr(RESOURCE)
self.assertEqual(policy.etag, 'DEADBEEF')
Expand Down

0 comments on commit c5922c6

Please sign in to comment.