Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
Check for Google import order style in flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
pferate committed Jul 11, 2016
1 parent 6b6c56d commit 09e9420
Show file tree
Hide file tree
Showing 47 changed files with 155 additions and 134 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
#

import os
from pkg_resources import get_distribution
import sys

import mock

# In order to load django before 1.7, we need to create a faux
# settings module and load it. This assumes django has been installed
# (but it must be for the docs to build), so if it has not already
# been installed run `pip install -r docs/requirements.txt`.
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.contrib.test_django_settings'
import django
import mock
from pkg_resources import get_distribution
if django.VERSION[1] < 7:
sys.path.insert(0, '.')

Expand Down
1 change: 1 addition & 0 deletions oauth2client/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import base64
import json

import six


Expand Down
2 changes: 1 addition & 1 deletion oauth2client/_pycrypto_crypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.
"""pyCrypto Crypto-related routines for oauth2client."""

from Crypto.PublicKey import RSA
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Util.asn1 import DerSequence

Expand Down
11 changes: 6 additions & 5 deletions oauth2client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,26 @@
import json
import logging
import os
import shutil
import socket
import sys
import tempfile
import shutil

import httplib2
import six
from six.moves import http_client
from six.moves import urllib

import httplib2
from oauth2client import clientsecrets
from oauth2client import GOOGLE_AUTH_URI
from oauth2client import GOOGLE_DEVICE_URI
from oauth2client import GOOGLE_REVOKE_URI
from oauth2client import GOOGLE_TOKEN_URI
from oauth2client import GOOGLE_TOKEN_INFO_URI
from oauth2client import GOOGLE_TOKEN_URI
from oauth2client import util
from oauth2client._helpers import _from_bytes
from oauth2client._helpers import _to_bytes
from oauth2client._helpers import _urlsafe_b64decode
from oauth2client import clientsecrets
from oauth2client import util


__author__ = '[email protected] (Joe Gregorio)'
Expand Down
2 changes: 1 addition & 1 deletion oauth2client/clientsecrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"""

import json
import six

import six

__author__ = '[email protected] (Joe Gregorio)'

Expand Down
3 changes: 1 addition & 2 deletions oauth2client/contrib/_fcntl_opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
# limitations under the License.

import errno
import time

import fcntl
import time

from oauth2client.contrib.locked_file import _Opener
from oauth2client.contrib.locked_file import AlreadyLockedException
Expand Down
4 changes: 2 additions & 2 deletions oauth2client/contrib/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"""

import datetime
import httplib2
import json

import httplib2
from six.moves import http_client
from six.moves.urllib import parse as urlparse

from oauth2client import util
from oauth2client._helpers import _from_bytes
from oauth2client.client import _UTCNOW
from oauth2client import util


METADATA_ROOT = 'http://metadata.google.internal/computeMetadata/v1/'
Expand Down
7 changes: 3 additions & 4 deletions oauth2client/contrib/appengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,18 @@
import pickle
import threading

import httplib2
import webapp2 as webapp

from google.appengine.api import app_identity
from google.appengine.api import memcache
from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext.webapp.util import login_required
import httplib2
import webapp2 as webapp

from oauth2client import clientsecrets
from oauth2client import GOOGLE_AUTH_URI
from oauth2client import GOOGLE_REVOKE_URI
from oauth2client import GOOGLE_TOKEN_URI
from oauth2client import clientsecrets
from oauth2client import util
from oauth2client.client import AccessTokenRefreshError
from oauth2client.client import AssertionCredentials
Expand Down
2 changes: 1 addition & 1 deletion oauth2client/contrib/devshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import os
import socket

from oauth2client._helpers import _to_bytes
from oauth2client import client
from oauth2client._helpers import _to_bytes

# Expose utcnow() at module level to allow for
# easier testing (by replacing with a stub).
Expand Down
3 changes: 2 additions & 1 deletion oauth2client/contrib/django_orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
Only Django versions 1.8+ are supported.
"""

import oauth2client
import base64
import pickle

from django.db import models
from django.utils.encoding import smart_bytes, smart_text

import oauth2client
from oauth2client.client import Storage as BaseStorage


Expand Down
3 changes: 2 additions & 1 deletion oauth2client/contrib/django_util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,10 @@ def test_callback(sender, request, credentials, **kwargs):
from django.core import exceptions
from django.core import urlresolvers
import httplib2
from six.moves.urllib import parse

from oauth2client import clientsecrets
from oauth2client.contrib.django_util import storage
from six.moves.urllib import parse

GOOGLE_OAUTH2_DEFAULT_SCOPES = ('email',)
GOOGLE_OAUTH2_REQUEST_ATTRIBUTE = 'oauth'
Expand Down
3 changes: 2 additions & 1 deletion oauth2client/contrib/django_util/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# limitations under the License.

from django import shortcuts
from oauth2client.contrib import django_util
from six import wraps

from oauth2client.contrib import django_util


def oauth_required(decorated_function=None, scopes=None, **decorator_kwargs):
""" Decorator to require OAuth2 credentials for a view
Expand Down
1 change: 1 addition & 0 deletions oauth2client/contrib/django_util/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

from django.conf import urls

from oauth2client.contrib.django_util import views

urlpatterns = [
Expand Down
4 changes: 3 additions & 1 deletion oauth2client/contrib/django_util/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
import json
import os
import pickle

from django import http
from django.core import urlresolvers
from django import shortcuts
from django.core import urlresolvers

from oauth2client import client
from oauth2client.contrib import django_util
from oauth2client.contrib.django_util import signals
Expand Down
10 changes: 5 additions & 5 deletions oauth2client/contrib/flask_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,11 @@ def requires_calendar():
:class:`oauth2client.Storage`.
"""

from functools import wraps
import hashlib
import json
import os
import pickle
from functools import wraps

import six.moves.http_client as httplib
import httplib2

try:
from flask import Blueprint
Expand All @@ -182,10 +179,13 @@ def requires_calendar():
except ImportError: # pragma: NO COVER
raise ImportError('The flask utilities require flask 0.9 or newer.')

import httplib2
import six.moves.http_client as httplib

from oauth2client import clientsecrets
from oauth2client.client import FlowExchangeError
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.contrib.dictionary_storage import DictionaryStorage
from oauth2client import clientsecrets


__author__ = '[email protected] (Jon Wayne Parrott)'
Expand Down
3 changes: 1 addition & 2 deletions oauth2client/contrib/multistore_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@
import os
import threading

from oauth2client import util
from oauth2client.client import Credentials
from oauth2client.client import Storage as BaseStorage
from oauth2client import util
from oauth2client.contrib.locked_file import LockedFile


__author__ = '[email protected] (Joe Beda)'

logger = logging.getLogger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion oauth2client/contrib/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ class User(Base):

from __future__ import absolute_import

import oauth2client.client
import sqlalchemy.types

import oauth2client.client


class CredentialsType(sqlalchemy.types.PickleType):
"""Type representing credentials.
Expand Down
2 changes: 1 addition & 1 deletion oauth2client/contrib/xsrfutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import hmac
import time

from oauth2client._helpers import _to_bytes
from oauth2client import util
from oauth2client._helpers import _to_bytes

__authors__ = [
'"Doug Coker" <[email protected]>',
Expand Down
9 changes: 5 additions & 4 deletions oauth2client/service_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,24 @@
import base64
import copy
import datetime
import httplib2
import json
import time

import httplib2

from oauth2client import crypt
from oauth2client import GOOGLE_REVOKE_URI
from oauth2client import GOOGLE_TOKEN_URI
from oauth2client._helpers import _from_bytes
from oauth2client import util
from oauth2client._helpers import _from_bytes
from oauth2client.client import _apply_user_agent
from oauth2client.client import _initialize_headers
from oauth2client.client import _UTCNOW
from oauth2client.client import AccessTokenInfo
from oauth2client.client import AssertionCredentials
from oauth2client.client import clean_headers
from oauth2client.client import EXPIRY_FORMAT
from oauth2client.client import SERVICE_ACCOUNT
from oauth2client.client import _UTCNOW
from oauth2client import crypt


_PASSWORD_DEFAULT = 'notasecret'
Expand Down
2 changes: 1 addition & 1 deletion oauth2client/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

from six.moves import BaseHTTPServer
from six.moves import http_client
from six.moves import urllib
from six.moves import input
from six.moves import urllib

from oauth2client import client
from oauth2client import util
Expand Down
1 change: 1 addition & 0 deletions samples/call_compute_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# See: https://developers.google.com/compute/docs/authentication

from googleapiclient.discovery import build

from oauth2client.client import GoogleCredentials


Expand Down
3 changes: 2 additions & 1 deletion samples/googleappengine/call_compute_service_from_gae.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# To be used to test GoogleCredentials.get_application_default()
# from devel GAE (ie, dev_appserver.py).

import webapp2
from googleapiclient.discovery import build
import webapp2

from oauth2client.client import GoogleCredentials


Expand Down
3 changes: 2 additions & 1 deletion samples/oauth2_for_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

# See: https://developers.google.com/accounts/docs/OAuth2ForDevices

from googleapiclient.discovery import build
import httplib2
from six.moves import input

from oauth2client.client import OAuth2WebServerFlow
from googleapiclient.discovery import build

CLIENT_ID = "some+client+id"
CLIENT_SECRET = "some+client+secret"
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_gce_system_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
# limitations under the License.

import json
import unittest2

import httplib2
from six.moves import http_client
from six.moves import urllib
import unittest2

from oauth2client import GOOGLE_TOKEN_INFO_URI
from oauth2client.client import GoogleCredentials
Expand Down
1 change: 1 addition & 0 deletions scripts/run_system_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import httplib2
from six.moves import http_client

from oauth2client import client
from oauth2client.service_account import ServiceAccountCredentials

Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
from __future__ import print_function

import sys

from setuptools import find_packages
from setuptools import setup

import oauth2client

if sys.version_info < (2, 6):
Expand Down
Loading

0 comments on commit 09e9420

Please sign in to comment.