Made ietf/utils pyflakes-clean.

- Legacy-Id: 7496
This commit is contained in:
Henrik Levkowetz 2014-03-16 07:26:03 +00:00
parent 02031a01b9
commit 49edc7404e
4 changed files with 25 additions and 29 deletions

View file

@ -191,14 +191,12 @@ class Draft():
pages = []
page = []
line = ""
debug = False
newpage = False
sentence = False
blankcount = 0
linecount = 0
# two functions with side effects
def striplines(p):
r = []
beg = end = 0
for i in range(len(p)):
l = p[i]
@ -522,7 +520,6 @@ class Draft():
authors = []
companies = []
author_info = []
companies_seen = []
self._docheader = ""
@ -533,7 +530,7 @@ class Draft():
for line in self.lines[:30]:
self._docheader += line+"\n"
author_on_line = False
company_on_line = False
_debug( "**" + line)
leading_space = len(re.findall("^ *", line)[0])
line_len = len(line.rstrip())
@ -609,7 +606,6 @@ class Draft():
company = match.group(1)
authors += [ "" ]
companies += [ company ]
company_on_line = True
#_debug("\nLine: " + line)
#_debug("Format: " + authformat)
_debug("Company: '%s'" % company)
@ -772,7 +768,7 @@ class Draft():
authors[i] = (fullname, first, middle, surname, suffix)
companies[i] = None
break
except AssertionError, e:
except AssertionError:
sys.stderr.write("filename: "+self.filename+"\n")
sys.stderr.write("authpat: "+authpat+"\n")
raise
@ -788,9 +784,7 @@ class Draft():
_debug("2: authors[%s]: %s" % (i, authors[i]))
if start and col != None:
_debug("\n * %s" % (authors[i], ))
done = False
nonblank_count = 0
keyword = False
blanklines = 0
email = None
for line in self.lines[start+1:]:
@ -1101,6 +1095,7 @@ def getmeta(fn):
# ----------------------------------------------------------------------
def _output(docname, fields, outfile=sys.stdout):
global company_domain
if opt_getauthors:
# Output an (incomplete!) getauthors-compatible format. Country
# information is always UNKNOWN, and information about security and
@ -1165,6 +1160,7 @@ def _printmeta(fn, outfile=sys.stdout):
# Main
# ----------------------------------------------------------------------
company_domain = {}
def _main(outfile=sys.stdout):
global opt_debug, opt_timestamp, opt_trace, opt_authorinfo, opt_getauthors, files, company_domain, opt_attributes
# set default values, if any
@ -1234,6 +1230,7 @@ def _main(outfile=sys.stdout):
if file == "-":
file = sys.stdin
elif file.endswith(".gz"):
import gzip
file = gzip.open(file)
else:
file = open(file)

View file

@ -325,7 +325,7 @@ def smtp_error_logging(thing):
""") % e.original_msg.as_string()
try:
send_mail_preformatted(request=None, preformatted=msg)
except smtplib.SMTPException as ticket_mail_error:
except smtplib.SMTPException:
log("Exception encountered while sending a ticket to the secretariat")
(extype,value) = sys.exc_info()[:2]
log("SMTP Exception: %s : %s" % (extype,value))

View file

@ -1,16 +1,16 @@
import datetime
from django.conf import settings
from django.contrib.auth.models import User
from ietf.iesg.models import TelechatDate
import debug # pyflakes:ignore
from ietf.doc.models import Document, DocAlias, State, DocumentAuthor, BallotType, DocEvent, BallotDocEvent
from ietf.group.models import Group, GroupHistory, Role, RoleHistory
from ietf.ipr.models import IprDetail, IprDocAlias
from ietf.meeting.models import Meeting
from ietf.doc.models import *
from ietf.doc.utils import *
from ietf.name.models import *
from ietf.group.models import *
from ietf.person.models import *
import debug # pyflakes:ignore
from ietf.name.models import StreamName
from ietf.person.models import Person, Alias, Email
def create_person(group, role_name, name=None, username=None, email_address=None):
"""Add person/user/email and role."""
@ -36,12 +36,12 @@ def make_immutable_base_data():
all tests in a run."""
# telechat dates
t = datetime.date.today()
old = TelechatDate.objects.create(date=t - datetime.timedelta(days=14)).date
date1 = TelechatDate.objects.create(date=t).date
date2 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14)).date
date3 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 2)).date
date4 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 3)).date
#t = datetime.date.today()
#old = TelechatDate.objects.create(date=t - datetime.timedelta(days=14)).date
#date1 = TelechatDate.objects.create(date=t).date
#date2 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14)).date
#date3 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 2)).date
#date4 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 3)).date
# system
system_person = Person.objects.create(name="(System)", ascii="(System)", address="")
@ -77,9 +77,9 @@ def make_immutable_base_data():
rfc_editor = create_group(name="RFC Editor", acronym="rfceditor", type_id="rfcedtyp")
create_person(rfc_editor, "auth", name="Rfc Editor", username="rfc", email_address="rfc@edit.or")
iesg = create_group(name="Internet Engineering Steering Group", acronym="iesg", type_id="ietf", parent=ietf)
iesg = create_group(name="Internet Engineering Steering Group", acronym="iesg", type_id="ietf", parent=ietf) # pyflakes:ignore
individ = create_group(name="Individual submissions", acronym="none", type_id="individ")
individ = create_group(name="Individual submissions", acronym="none", type_id="individ") # pyflakes:ignore
# one area
area = create_group(name="Far Future", acronym="farfut", type_id="area", parent=ietf)
@ -165,7 +165,7 @@ def make_test_data():
# plain IETF'er
u = User.objects.create(username="plain")
plainman = Person.objects.create(name="Plain Man", ascii="Plain Man", user=u)
email = Email.objects.create(address="plain@example.com", person=plainman)
email = Email.objects.create(address="plain@example.com", person=plainman) # pyflakes:ignore
# group personnel
create_person(mars_wg, "chair", name="WG Chair Man", username="marschairman")
@ -294,7 +294,7 @@ def make_test_data():
target_rfc.set_state(State.objects.get(slug='rfc',type__slug='draft'))
target_rfc.save()
docalias = DocAlias.objects.create(name=name,document=target_rfc)
docalias = DocAlias.objects.create(name='rfc%d'%rfc_num,document=target_rfc)
docalias = DocAlias.objects.create(name='rfc%d'%rfc_num,document=target_rfc) # pyflakes:ignore
return target_rfc
rfc_for_status_change_test_factory('draft-ietf-random-thing',9999,'ps')
rfc_for_status_change_test_factory('draft-ietf-random-otherthing',9998,'inf')

View file

@ -40,9 +40,8 @@ import urllib2 as urllib
from difflib import unified_diff
import django.test
from django.db import connection, connections, transaction, DEFAULT_DB_ALIAS
from django.db import connection, connections, DEFAULT_DB_ALIAS
from django.test.testcases import connections_support_transactions
from django.test.testcases import disable_transaction_methods
from django.test.client import Client
from django.conf import settings
from django.core.management import call_command