Fix other PEP8 issues in assorted files
parent
f90e87afcc
commit
137139f2bb
25
docs/conf.py
25
docs/conf.py
|
|
@ -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
|
||||
|
|
@ -176,21 +177,21 @@ htmlhelp_basename = 'django-polymorphicdoc'
|
|||
# -- 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
|
||||
|
|
@ -233,9 +234,9 @@ man_pages = [
|
|||
# (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.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ import django
|
|||
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 *
|
||||
|
||||
|
|
@ -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):
|
||||
|
|
@ -35,7 +40,8 @@ def print_timing(func, message='', iterations=1):
|
|||
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,
|
||||
|
|
@ -57,7 +63,7 @@ class Command(NoArgsCommand):
|
|||
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:
|
||||
|
|
@ -66,7 +72,8 @@ class Command(NoArgsCommand):
|
|||
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()
|
||||
|
|
@ -81,7 +88,8 @@ class Command(NoArgsCommand):
|
|||
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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
@ -39,7 +43,8 @@ def print_timing(func, message='', iterations=1):
|
|||
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,
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
10
runtests.py
10
runtests.py
|
|
@ -19,15 +19,15 @@ sys.stderr.write('Using Django version {0} from {1}\n'.format(
|
|||
|
||||
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=(
|
||||
|
|
@ -37,7 +37,7 @@ if not settings.configured:
|
|||
'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',
|
||||
|
|
|
|||
24
setup.py
24
setup.py
|
|
@ -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',
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue