Skip to content

Commit

Permalink
Fix other PEP8 issues in assorted files
Browse files Browse the repository at this point in the history
  • Loading branch information
vdboor committed Dec 28, 2015
1 parent f90e87a commit 137139f
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 39 deletions.
25 changes: 13 additions & 12 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os
import sys
import os

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -176,21 +177,21 @@
# -- Options for LaTeX output --------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'django-polymorphic.tex', u'django-polymorphic Documentation',
u'Bert Constantin, Chris Glass, Diederik van der Boor', 'manual'),
('index', 'django-polymorphic.tex', u'django-polymorphic Documentation',
u'Bert Constantin, Chris Glass, Diederik van der Boor', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -233,9 +234,9 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'django-polymorphic', u'django-polymorphic Documentation',
u'Bert Constantin, Chris Glass, Diederik van der Boor', 'django-polymorphic', 'One line description of project.',
'Miscellaneous'),
('index', 'django-polymorphic', u'django-polymorphic Documentation',
u'Bert Constantin, Chris Glass, Diederik van der Boor', 'django-polymorphic', 'One line description of project.',
'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
Expand Down
20 changes: 14 additions & 6 deletions example/pexp/management/commands/p2cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from django.core.management.base import NoArgsCommand
from django.db import connection
from pprint import pprint
import time, sys
import time
import sys

from pexp.models import *

Expand All @@ -22,7 +23,11 @@ def reset_queries():


def show_queries():
print; print 'QUERIES:', len(connection.queries); pprint(connection.queries); print; connection.queries = []
print
print 'QUERIES:', len(connection.queries)
pprint(connection.queries)
print
connection.queries = []


def print_timing(func, message='', iterations=1):
Expand All @@ -35,7 +40,8 @@ def wrapper(*arg):
t2 = time.time()
results.append((t2 - t1) * 1000.0)
res_sum = 0
for r in results: res_sum += r
for r in results:
res_sum += r
median = res_sum / len(results)
print '%s%-19s: %.4f ms, %i queries (%i times)' % (
message, func.func_name,
Expand All @@ -57,7 +63,7 @@ def handle_noargs(self, **options):
b = ModelB.objects.create(field1='B1', field2='B2')
c = ModelC.objects.create(field1='C1', field2='C2', field3='C3')
reset_queries()
print ModelC.base_objects.all();
print ModelC.base_objects.all()
show_queries()

if False:
Expand All @@ -66,7 +72,8 @@ def handle_noargs(self, **options):
a = ModelA.objects.create(field1=str(i % 100))
b = ModelB.objects.create(field1=str(i % 100), field2=str(i % 200))
c = ModelC.objects.create(field1=str(i % 100), field2=str(i % 200), field3=str(i % 300))
if i % 100 == 0: print i
if i % 100 == 0:
print i

f = print_timing(poly_sql_query, iterations=1000)
f()
Expand All @@ -81,7 +88,8 @@ def handle_noargs(self, **options):
b = nModelB.objects.create(field1='B1', field2='B2')
c = nModelC.objects.create(field1='C1', field2='C2', field3='C3')
qs = ModelA.objects.raw("SELECT * from pexp_modela")
for o in list(qs): print o
for o in list(qs):
print o

from django.db import connection, transaction
from random import Random
Expand Down
6 changes: 5 additions & 1 deletion example/pexp/management/commands/pcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def reset_queries():


def show_queries():
print; print 'QUERIES:', len(connection.queries); pprint(connection.queries); print; connection.queries = []
print
print 'QUERIES:', len(connection.queries)
pprint(connection.queries)
print
connection.queries = []


class Command(NoArgsCommand):
Expand Down
9 changes: 7 additions & 2 deletions example/pexp/management/commands/polybench.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ def reset_queries():


def show_queries():
print; print 'QUERIES:', len(connection.queries); pprint(connection.queries); print; reset_queries()
print
print 'QUERIES:', len(connection.queries)
pprint(connection.queries)
print
reset_queries()

import time

Expand All @@ -39,7 +43,8 @@ def wrapper(*arg):
t2 = time.time()
results.append((t2 - t1) * 1000.0)
res_sum = 0
for r in results: res_sum += r
for r in results:
res_sum += r
median = res_sum / len(results)
print '%s%-19s: %.0f ms, %i queries' % (
message, func.func_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def reset_queries():


def show_queries():
print; print 'QUERIES:', len(connection.queries); pprint(connection.queries); print; connection.queries = []
print
print 'QUERIES:', len(connection.queries)
pprint(connection.queries)
print
connection.queries = []


class Command(NoArgsCommand):
Expand Down
10 changes: 5 additions & 5 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

if not settings.configured:
settings.configure(
DEBUG = True,
TEMPLATE_DEBUG = True,
DATABASES = {
DEBUG=True,
TEMPLATE_DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
},
TEMPLATE_LOADERS = (
TEMPLATE_LOADERS=(
'django.template.loaders.app_directories.Loader',
),
TEMPLATE_CONTEXT_PROCESSORS=(
Expand All @@ -37,7 +37,7 @@
'django.core.context_processors.request',
]
),
TEST_RUNNER = 'django.test.runner.DiscoverRunner' if django.VERSION >= (1,7) else 'django.test.simple.DjangoTestSuiteRunner',
TEST_RUNNER = 'django.test.runner.DiscoverRunner' if django.VERSION >= (1, 7) else 'django.test.simple.DjangoTestSuiteRunner',
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
Expand Down
24 changes: 12 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ def find_version(*parts):


setup(
name = 'django_polymorphic',
version = find_version('polymorphic', '__init__.py'),
license = 'BSD',
name='django_polymorphic',
version=find_version('polymorphic', '__init__.py'),
license='BSD',

description = 'Seamless Polymorphic Inheritance for Django Models',
long_description = read('README.rst'),
url = 'https://github.com/chrisglass/django_polymorphic',
description='Seamless Polymorphic Inheritance for Django Models',
long_description=read('README.rst'),
url='https://github.com/chrisglass/django_polymorphic',

author = 'Bert Constantin',
author_email = 'bert.constantin@gmx.de',
author='Bert Constantin',
author_email='bert.constantin@gmx.de',

maintainer = 'Christopher Glass',
maintainer_email = 'tribaal@gmail.com',
maintainer='Christopher Glass',
maintainer_email='tribaal@gmail.com',

packages = find_packages(),
package_data = {
packages=find_packages(),
package_data={
'polymorphic': [
'templates/admin/polymorphic/*.html',
],
Expand Down

0 comments on commit 137139f

Please sign in to comment.