diff --git a/appengine/flexible/django_cloudsql/mysite/settings.py b/appengine/flexible/django_cloudsql/mysite/settings.py index fbb767d978f..f8032204fb6 100644 --- a/appengine/flexible/django_cloudsql/mysite/settings.py +++ b/appengine/flexible/django_cloudsql/mysite/settings.py @@ -86,8 +86,9 @@ # In the flexible environment, you connect to CloudSQL using a unix socket. # Locally, you can use the CloudSQL proxy to proxy a localhost connection # to the instance - DATABASES['default']['HOST'] = '/cloudsql/' +DATABASES['default']['HOST'] = '/cloudsql/' if os.getenv('GAE_APPENGINE_HOSTNAME'): + pass else: DATABASES['default']['HOST'] = '127.0.0.1' # [END dbconfig] diff --git a/appengine/flexible/django_cloudsql/mysite/urls.py b/appengine/flexible/django_cloudsql/mysite/urls.py index d2fc27790dd..302e8e9e675 100644 --- a/appengine/flexible/django_cloudsql/mysite/urls.py +++ b/appengine/flexible/django_cloudsql/mysite/urls.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns -from django.conf import settings urlpatterns = [url(r'^', include('polls.urls')), url(r'^admin/', admin.site.urls)] diff --git a/appengine/standard/angular/main.py b/appengine/standard/angular/main.py index 3380d304a1a..127605e7d21 100644 --- a/appengine/standard/angular/main.py +++ b/appengine/standard/angular/main.py @@ -14,10 +14,10 @@ import json -import model - import webapp2 +import model + def AsDict(guest): return {'id': guest.key.id(), 'first': guest.first, 'last': guest.last} diff --git a/appengine/standard/i18n/main.py b/appengine/standard/i18n/main.py index e50ab1260a0..e2277049510 100644 --- a/appengine/standard/i18n/main.py +++ b/appengine/standard/i18n/main.py @@ -20,10 +20,10 @@ For more information, see README.md """ -from i18n_utils import BaseHandler - import webapp2 +from i18n_utils import BaseHandler + class MainHandler(BaseHandler): """A simple handler with internationalized strings. diff --git a/container_engine/django_tutorial/polls/migrations/0001_initial.py b/container_engine/django_tutorial/polls/migrations/0001_initial.py index 2ae7f95ca7f..0609ba72f43 100644 --- a/container_engine/django_tutorial/polls/migrations/0001_initial.py +++ b/container_engine/django_tutorial/polls/migrations/0001_initial.py @@ -17,7 +17,9 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Choice', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id', models.AutoField( + auto_created=True, primary_key=True, serialize=False, + verbose_name='ID')), ('choice_text', models.CharField(max_length=200)), ('votes', models.IntegerField(default=0)), ], @@ -25,14 +27,19 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Question', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id', models.AutoField( + auto_created=True, primary_key=True, serialize=False, + verbose_name='ID')), ('question_text', models.CharField(max_length=200)), - ('pub_date', models.DateTimeField(verbose_name=b'date published')), + ('pub_date', models.DateTimeField( + verbose_name=b'date published')), ], ), migrations.AddField( model_name='choice', name='question', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='polls.Question'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='polls.Question'), ), ] diff --git a/nox.py b/nox.py index 083fafa8042..664540e5710 100644 --- a/nox.py +++ b/nox.py @@ -61,7 +61,7 @@ def list_files(folder, pattern): yield os.path.join(root, filename) -def collect_sample_dirs(start_dir, blacklist=set()): +def collect_sample_dirs(start_dir, blacklist=set(), suffix='_test.py'): """Recursively collects a list of dirs that contain tests. This works by listing the contents of directories and finding @@ -69,7 +69,7 @@ def collect_sample_dirs(start_dir, blacklist=set()): """ # Collect all the directories that have tests in them. for parent, subdirs, files in os.walk(start_dir): - if any(f for f in files if f[-8:] == '_test.py'): + if any(f for f in files if f.endswith(suffix) and f not in blacklist): # Don't recurse further, since py.test will do that. del subdirs[:] # This dir has tests in it. yield it. @@ -240,9 +240,14 @@ def session_lint(session): """Lints each sample.""" sample_directories = session.posargs if not sample_directories: - sample_directories = collect_sample_dirs('.') - - # On travis, on lint changed samples. + # The top-level dir isn't a sample dir - only its subdirs. + _, subdirs, _ = next(os.walk('.')) + sample_directories = ( + sample_dir for subdir in subdirs if not subdir.startswith('.') + for sample_dir in collect_sample_dirs( + subdir, suffix='.py', blacklist='conftest.py')) + + # On travis, only lint changed samples. if ON_TRAVIS: changed_files = get_changed_files() sample_directories = filter_samples(